idnits 2.17.1 draft-ietf-tsvwg-rlc-fec-scheme-08.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 692 has weird spacing: '...air_key key...' == Line 1509 has weird spacing: '...am seed a 32-...' -- The document date (September 19, 2018) is 2040 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '0' on line 808 -- Looks like a reference, but probably isn't: '1' on line 808 Summary: 0 errors (**), 0 flaws (~~), 3 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 TSVWG V. Roca 3 Internet-Draft B. Teibi 4 Intended status: Standards Track INRIA 5 Expires: March 23, 2019 September 19, 2018 7 Sliding Window Random Linear Code (RLC) Forward Erasure Correction (FEC) 8 Schemes for FECFRAME 9 draft-ietf-tsvwg-rlc-fec-scheme-08 11 Abstract 13 This document describes two fully-specified Forward Erasure 14 Correction (FEC) Schemes for Sliding Window Random Linear Codes 15 (RLC), one for RLC over the Galois Field (A.K.A. Finite Field) 16 GF(2), a second one for RLC over the Galois Field GF(2^^8), each time 17 with the possibility of controlling the code density. They can 18 protect arbitrary media streams along the lines defined by FECFRAME 19 extended to sliding window FEC codes, as defined in [fecframe-ext]. 20 These sliding window FEC codes rely on an encoding window that slides 21 over the source symbols, generating new repair symbols whenever 22 needed. Compared to block FEC codes, these sliding window FEC codes 23 offer key advantages with real-time flows in terms of reduced FEC- 24 related latency while often providing improved packet erasure 25 recovery capabilities. 27 Status of This Memo 29 This Internet-Draft is submitted in full conformance with the 30 provisions of BCP 78 and BCP 79. 32 Internet-Drafts are working documents of the Internet Engineering 33 Task Force (IETF). Note that other groups may also distribute 34 working documents as Internet-Drafts. The list of current Internet- 35 Drafts is at https://datatracker.ietf.org/drafts/current/. 37 Internet-Drafts are draft documents valid for a maximum of six months 38 and may be updated, replaced, or obsoleted by other documents at any 39 time. It is inappropriate to use Internet-Drafts as reference 40 material or to cite them other than as "work in progress." 42 This Internet-Draft will expire on March 23, 2019. 44 Copyright Notice 46 Copyright (c) 2018 IETF Trust and the persons identified as the 47 document authors. All rights reserved. 49 This document is subject to BCP 78 and the IETF Trust's Legal 50 Provisions Relating to IETF Documents 51 (https://trustee.ietf.org/license-info) in effect on the date of 52 publication of this document. Please review these documents 53 carefully, as they describe your rights and restrictions with respect 54 to this document. Code Components extracted from this document must 55 include Simplified BSD License text as described in Section 4.e of 56 the Trust Legal Provisions and are provided without warranty as 57 described in the Simplified BSD License. 59 Table of Contents 61 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 62 1.1. Limits of Block Codes with Real-Time Flows . . . . . . . 3 63 1.2. Lower Latency and Better Protection of Real-Time Flows 64 with the Sliding Window RLC Codes . . . . . . . . . . . . 4 65 1.3. Small Transmission Overheads with the Sliding Window RLC 66 FEC Scheme . . . . . . . . . . . . . . . . . . . . . . . 5 67 1.4. Document Organization . . . . . . . . . . . . . . . . . . 6 68 2. Definitions and Abbreviations . . . . . . . . . . . . . . . . 6 69 3. Procedures . . . . . . . . . . . . . . . . . . . . . . . . . 7 70 3.1. Possible Parameter Derivations . . . . . . . . . . . . . 7 71 3.1.1. Case of a CBR Real-Time Flow . . . . . . . . . . . . 8 72 3.1.2. Other Types of Real-Time Flow . . . . . . . . . . . . 10 73 3.1.3. Case of a Non Real-Time Flow . . . . . . . . . . . . 11 74 3.2. ADU, ADUI and Source Symbols Mappings . . . . . . . . . . 11 75 3.3. Encoding Window Management . . . . . . . . . . . . . . . 13 76 3.4. Pseudo-Random Number Generator (PRNG) . . . . . . . . . . 13 77 3.5. Coding Coefficients Generation Function . . . . . . . . . 15 78 3.6. Finite Fields Operations . . . . . . . . . . . . . . . . 17 79 3.6.1. Finite Field Definitions . . . . . . . . . . . . . . 17 80 3.6.2. Linear Combination of Source Symbols Computation . . 17 81 4. Sliding Window RLC FEC Scheme over GF(2^^8) for Arbitrary ADU 82 Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 83 4.1. Formats and Codes . . . . . . . . . . . . . . . . . . . . 18 84 4.1.1. FEC Framework Configuration Information . . . . . . . 18 85 4.1.2. Explicit Source FEC Payload ID . . . . . . . . . . . 19 86 4.1.3. Repair FEC Payload ID . . . . . . . . . . . . . . . . 20 87 4.1.4. Additional Procedures . . . . . . . . . . . . . . . . 21 88 5. Sliding Window RLC FEC Scheme over GF(2) for Arbitrary ADU 89 Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 90 5.1. Formats and Codes . . . . . . . . . . . . . . . . . . . . 21 91 5.1.1. FEC Framework Configuration Information . . . . . . . 22 92 5.1.2. Explicit Source FEC Payload ID . . . . . . . . . . . 22 93 5.1.3. Repair FEC Payload ID . . . . . . . . . . . . . . . . 22 94 5.1.4. Additional Procedures . . . . . . . . . . . . . . . . 22 95 6. FEC Code Specification . . . . . . . . . . . . . . . . . . . 22 96 6.1. Encoding Side . . . . . . . . . . . . . . . . . . . . . . 22 97 6.2. Decoding Side . . . . . . . . . . . . . . . . . . . . . . 23 98 7. Implementation Status . . . . . . . . . . . . . . . . . . . . 24 99 8. Security Considerations . . . . . . . . . . . . . . . . . . . 24 100 8.1. Attacks Against the Data Flow . . . . . . . . . . . . . . 24 101 8.1.1. Access to Confidential Content . . . . . . . . . . . 24 102 8.1.2. Content Corruption . . . . . . . . . . . . . . . . . 25 103 8.2. Attacks Against the FEC Parameters . . . . . . . . . . . 25 104 8.3. When Several Source Flows are to be Protected Together . 26 105 8.4. Baseline Secure FEC Framework Operation . . . . . . . . . 26 106 8.5. Additional Security Considerations for Numerical 107 Computations . . . . . . . . . . . . . . . . . . . . . . 27 108 9. Operations and Management Considerations . . . . . . . . . . 27 109 9.1. Operational Recommendations: Finite Field GF(2) Versus 110 GF(2^^8) . . . . . . . . . . . . . . . . . . . . . . . . 27 111 9.2. Operational Recommendations: Coding Coefficients Density 112 Threshold . . . . . . . . . . . . . . . . . . . . . . . . 28 113 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 28 114 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 28 115 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 28 116 12.1. Normative References . . . . . . . . . . . . . . . . . . 28 117 12.2. Informative References . . . . . . . . . . . . . . . . . 29 118 Appendix A. TinyMT32 Pseudo-Random Number Generator . . . . . . 31 119 Appendix B. Decoding Beyond Maximum Latency Optimization . . . . 35 120 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 36 122 1. Introduction 124 Application-Level Forward Erasure Correction (AL-FEC) codes, or 125 simply FEC codes, are a key element of communication systems. They 126 are used to recover from packet losses (or erasures) during content 127 delivery sessions to a potentially large number of receivers 128 (multicast/broadcast transmissions). This is the case with the 129 FLUTE/ALC protocol [RFC6726] when used for reliable file transfers 130 over lossy networks, and the FECFRAME protocol when used for reliable 131 continuous media transfers over lossy networks. 133 The present document only focuses on the FECFRAME protocol, used in 134 multicast/broadcast delivery mode, in particular for contents that 135 feature stringent real-time constraints: each source packet has a 136 maximum validity period after which it will not be considered by the 137 destination application. 139 1.1. Limits of Block Codes with Real-Time Flows 141 With FECFRAME, there is a single FEC encoding point (either a end- 142 host/server (source) or a middlebox) and a single FEC decoding point 143 (either a end-host (receiver) or middlebox). In this context, 144 currently standardized AL-FEC codes for FECFRAME like Reed-Solomon 146 [RFC6865], LDPC-Staircase [RFC6816], or Raptor/RaptorQ, are all 147 linear block codes: they require the data flow to be segmented into 148 blocks of a predefined maximum size. 150 To define this block size, it is required to find an appropriate 151 balance between robustness and decoding latency: the larger the block 152 size, the higher the robustness (e.g., in front of long packet 153 erasure bursts), but also the higher the maximum decoding latency 154 (i.e., the maximum time required to recover a lost (erased) packet 155 thanks to FEC protection). Therefore, with a multicast/broadcast 156 session where different receivers experience different packet loss 157 rates, the block size should be chosen by considering the worst 158 communication conditions one wants to support, but without exceeding 159 the desired maximum decoding latency. This choice then impacts the 160 FEC-related latency of all receivers, even those experiencing a good 161 communication quality, since no FEC encoding can happen until all the 162 source data of the block is available at the sender, which directly 163 depends on the block size. 165 1.2. Lower Latency and Better Protection of Real-Time Flows with the 166 Sliding Window RLC Codes 168 This document introduces two fully-specified FEC Schemes that follow 169 a totally different approach: the Sliding Window Random Linear Codes 170 (RLC) over either Galois Fields (A.K.A. Finite Fields) GF(2) (the 171 "binary case") or GF(2^^8), each time with the possibility of 172 controlling the code density. These FEC Schemes are used to protect 173 arbitrary media streams along the lines defined by FECFRAME extended 174 to sliding window FEC codes [fecframe-ext]. These FEC Schemes, and 175 more generally Sliding Window FEC codes, are recommended for instance 176 with media that feature real-time constraints sent within a 177 multicast/broadcast session [Roca17]. 179 The RLC codes belong to the broad class of sliding window AL-FEC 180 codes (A.K.A. convolutional codes) [RFC8406]. The encoding process 181 is based on an encoding window that slides over the set of source 182 packets (in fact source symbols as we will see in Section 3.2), this 183 window being either of fixed size or variable size (A.K.A. an elastic 184 window). Repair symbols are generated on-the-fly, by computing a 185 random linear combination of the source symbols present in the 186 current encoding window, and passed to the transport layer. 188 At the receiver, a linear system is managed from the set of received 189 source and repair packets. New variables (representing source 190 symbols) and equations (representing the linear combination carried 191 by each repair symbol received) are added upon receiving new packets. 192 Variables and the equations they are involved in are removed when 193 they are too old with respect to their validity period (real-time 194 constraints) . Lost source symbols are then recovered thanks to this 195 linear system whenever its rank permits to solve it (at least 196 partially). 198 The protection of any multicast/broadcast session needs to be 199 dimensioned by considering the worst communication conditions one 200 wants to support. This is also true with RLC (more generally any 201 sliding window) code. However the receivers experiencing a good to 202 medium communication quality will observe a reduced FEC-related 203 latency compared to block codes [Roca17] since an isolated lost 204 source packet is quickly recovered with the following repair packet. 205 On the opposite, with a block code, recovering an isolated lost 206 source packet always requires waiting for the first repair packet to 207 arrive after the end of the block. Additionally, under certain 208 situations (e.g., with a limited FEC-related latency budget and with 209 constant bitrate transmissions after FECFRAME encoding), sliding 210 window codes can more efficiently achieve a target transmission 211 quality (e.g., measured by the residual loss after FEC decoding) by 212 sending fewer repair packets (i.e., higher code rate) than block 213 codes. 215 1.3. Small Transmission Overheads with the Sliding Window RLC FEC 216 Scheme 218 The Sliding Window RLC FEC Scheme is designed to limit the packet 219 header overhead. The main requirement is that each repair packet 220 header must enable a receiver to reconstruct the set of source 221 symbols plus the associated coefficients used during the encoding 222 process. In order to minimize packet overhead, the set of source 223 symbols in the encoding window as well as the set of coefficients 224 over GF(2^^m) (where m is 1 or 8, depending on the FEC Scheme) used 225 in the linear combination are not individually listed in the repair 226 packet header. Instead, each FEC Repair Packet header contains: 228 o the Encoding Symbol Identifier (ESI) of the first source symbol in 229 the encoding window as well as the number of symbols (since this 230 number may vary with a variable size, elastic window). These two 231 pieces of information enable each receiver to reconstruct the set 232 of source symbols considered during encoding, the only constraint 233 being that there cannot be any gap; 234 o the seed and density threshold parameters used by a coding 235 coefficients generation function (Section 3.5). These two pieces 236 of information enable each receiver to generate the same set of 237 coding coefficients over GF(2^^m) as the sender; 239 Therefore, no matter the number of source symbols present in the 240 encoding window, each FEC Repair Packet features a fixed 64-bit long 241 header, called Repair FEC Payload ID (Figure 7). Similarly, each FEC 242 Source Packet features a fixed 32-bit long trailer, called Explicit 243 Source FEC Payload ID (Figure 5), that contains the ESI of the first 244 source symbol (Section 3.2). 246 1.4. Document Organization 248 This fully-specified FEC Scheme follows the structure required by 249 [RFC6363], section 5.6. "FEC Scheme Requirements", namely: 251 3. Procedures: This section describes procedures specific to this 252 FEC Scheme, namely: RLC parameters derivation, ADUI and source 253 symbols mapping, pseudo-random number generator, and coding 254 coefficients generation function; 255 4. Formats and Codes: This section defines the Source FEC Payload 256 ID and Repair FEC Payload ID formats, carrying the signalling 257 information associated to each source or repair symbol. It also 258 defines the FEC Framework Configuration Information (FFCI) 259 carrying signalling information for the session; 260 5. FEC Code Specification: Finally this section provides the code 261 specification. 263 2. Definitions and Abbreviations 265 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 266 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 267 "OPTIONAL" in this document are to be interpreted as described in BCP 268 14 [RFC2119] [RFC8174] when, and only when, they appear in all 269 capitals, as shown here. 271 This document uses the following definitions and abbreviations: 273 a^^b a to the power of b 274 GF(q) denotes a finite field (also known as the Galois Field) with q 275 elements. We assume that q = 2^^m in this document 276 m defines the length of the elements in the finite field, in bits. 277 In this document, m is equal to 1 or 8 278 ADU: Application Data Unit 279 ADUI: Application Data Unit Information (includes the F, L and 280 padding fields in addition to the ADU) 281 E: size of an encoding symbol (i.e., source or repair symbol), 282 assumed fixed (in bytes) 283 br_in: transmission bitrate at the input of the FECFRAME sender, 284 assumed fixed (in bits/s) 285 br_out: transmission bitrate at the output of the FECFRAME sender, 286 assumed fixed (in bits/s) 287 max_lat: maximum FEC-related latency within FECFRAME (in seconds) 288 cr: RLC coding rate, ratio between the total number of source 289 symbols and the total number of source plus repair symbols 291 ew_size: encoding window current size at a sender (in symbols) 292 ew_max_size: encoding window maximum size at a sender (in symbols) 293 dw_max_size: decoding window maximum size at a receiver (in symbols) 294 ls_max_size: linear system maximum size (or width) at a receiver (in 295 symbols) 296 PRNG: pseudo-random number generator 297 tinymt32_rand(maxv): PRNG defined in Section 3.4 and used in this 298 specification, that returns a new random integer in [0; maxv-1] 299 DT: coding coefficients density threshold, an integer between 0 and 300 15 (inclusive) the controls the fraction of coefficients that are 301 non zero 303 3. Procedures 305 This section introduces the procedures that are used by these FEC 306 Schemes. 308 3.1. Possible Parameter Derivations 310 The Sliding Window RLC FEC Scheme relies on several parameters: 312 Maximum FEC-related latency budget, max_lat (in seconds) with real- 313 time flows: 314 a source ADU flow can have real-time constraints, and therefore 315 any FECFRAME related operation SHOULD take place within the 316 validity period of each ADU (Appendix B describes an exception to 317 this rule). When there are multiple flows with different real- 318 time constraints, we consider the most stringent constraints (see 319 [RFC6363], Section 10.2, item 6, for recommendations when several 320 flows are globally protected). The maximum FEC-related latency 321 budget, max_lat, accounts for all sources of latency added by FEC 322 encoding (at a sender) and FEC decoding (at a receiver). Other 323 sources of latency (e.g., added by network communications) are out 324 of scope and must be considered separately (said differently, they 325 have already been deducted from max_lat). max_lat can be regarded 326 as the latency budget permitted for all FEC-related operations. 327 This is an input parameter that enables a FECFRAME sender to 328 derive other internal parameters as explained below; 329 Encoding window current (resp. maximum) size, ew_size (resp. 330 ew_max_size) (in symbols): 331 at a FECFRAME sender, during FEC encoding, a repair symbol is 332 computed as a linear combination of the ew_size source symbols 333 present in the encoding window. The ew_max_size is the maximum 334 size of this window, while ew_size is the current size. For 335 instance, at session start, upon receiving new source ADUs, the 336 ew_size progressively increases until it reaches its maximum 337 value, ew_max_size. We have: 339 0 < ew_size <= ew_max_size 340 Decoding window maximum size, dw_max_size (in symbols): at a 341 FECFRAME receiver, dw_max_size is the maximum number of received 342 or lost source symbols that are still within their latency budget; 343 Linear system maximum size, ls_max_size (in symbols): at a FECFRAME 344 receiver, the linear system maximum size, ls_max_size, is the 345 maximum number of received or lost source symbols in the linear 346 system (i.e., the variables). It SHOULD NOT be smaller than 347 dw_max_size since it would mean that, even after receiving a 348 sufficient number of FEC Repair Packets, a lost ADU may not be 349 recovered just because the associated source symbols have been 350 prematurely removed from the linear system, which is usually 351 counter-productive. On the opposite, the linear system MAY grow 352 beyond the dw_max_size (Appendix B); 353 Symbol size, E (in bytes): the E parameter determines the source and 354 repair symbol sizes (necessarily equal). This is an input 355 parameter that enables a FECFRAME sender to derive other internal 356 parameters, as explained below. An implementation at a sender 357 SHOULD fix the E parameter and communicate it as part of the FEC 358 Scheme-Specific Information (Section 4.1.1.2). 359 Code rate, cr: The code rate parameter determines the amount of 360 redundancy added to the flow. More precisely the cr is the ratio 361 between the total number of source symbols and the total number of 362 source plus repair symbols and by definition: 0 < cr <= 1. This 363 is an input parameter that enables a FECFRAME sender to derive 364 other internal parameters, as explained below. However there is 365 no need to communicate the cr parameter per see (it's not required 366 to process a repair symbol at a receiver). This code rate 367 parameter can be static. However, in specific use-cases (e.g., 368 with unicast transmissions in presence of a feedback mechanism 369 that estimates the communication quality, out of scope of 370 FECFRAME), the code rate may be adjusted dynamically. 372 The FEC Schemes can be used in various manners. They can be used to 373 protect a source ADU flow having real-time constraints, or a non- 374 realtime source ADU flow. The source ADU flow may be a Constant 375 Bitrate (CBR) or Variable BitRate (VBR) flow. The flow's minimum/ 376 maximum bitrate might or might not be known. The FEC Schemes can 377 also be used over the Internet or over a CBR communication path. It 378 follows that the FEC Scheme parameters can be derived in different 379 ways, as described in the following sections. 381 3.1.1. Case of a CBR Real-Time Flow 383 In the following, we consider a real-time flow with max_lat latency 384 budget. The encoding symbol size, E, is constant. The code rate, 385 cr, is also constant, its value depending on the expected 386 communication loss model (this choice is out of scope of this 387 document). 389 In a first configuration, the source ADU flow bitrate at the input of 390 the FECFRAME sender is fixed and equal to br_in (in bits/s), and this 391 value is known by the FECFRAME sender. It follows that the 392 transmission bitrate at the output of the FECFRAME sender will be 393 higher, depending on the added repair flow overhead. In order to 394 comply with the maximum FEC-related latency budget, we have: 396 dw_max_size = (max_lat * br_in) / (8 * E) 398 In a second configuration, the FECFRAME sender generates a fixed 399 bitrate flow, equal to the CBR communication path bitrate equal to 400 br_out (in bits/s), and this value is known by the FECFRAME sender, 401 as in [Roca17]. The maximum source flow bitrate needs to be such 402 that, with the added repair flow overhead, the total transmission 403 bitrate remains inferior or equal to br_out. We have: 405 dw_max_size = (max_lat * br_out * cr) / (8 * E) 407 For decoding to be possible within the latency budget, it is required 408 that the encoding window maximum size be smaller than or at most 409 equal to the decoding window maximum size, the exact value having no 410 impact on the the FEC-related latency budget. For the FEC Schemes 411 specified in this document, in line with [Roca17], the ew_max_size 412 SHOULD be computed with: 414 ew_max_size = dw_max_size * 0.75 416 The ew_max_size is the main parameter at a FECFRAME sender. It is 417 RECOMMENDED to check that the ew_max_size value stays within 418 reasonnable bounds in order to avoid hazardous behaviours. 420 The dw_max_size is computed by a FECFRAME sender but not explicitly 421 communicated to a FECFRAME receiver. However a FECFRAME receiver can 422 easily evaluate the ew_max_size by observing the maximum Number of 423 Source Symbols (NSS) value contained in the Repair FEC Payload ID of 424 received FEC Repair Packets (Section 4.1.3). A receiver can then 425 easily compute dw_max_size: 427 dw_max_size = max_NSS_observed / 0.75 429 A receiver can then chose an appropriate linear system maximum size: 431 ls_max_size >= dw_max_size 433 It is good practice to use a larger value for ls_max_size as 434 explained in Appendix B, which does not impact maximum latency nor 435 interoperability. However the linear system size should not be too 436 large for practical reasons (e.g., in order to limit computation 437 complexity). It is RECOMMENDED to check that the ls_max_size value 438 stays within reasonnable bounds in order to avoid hazardous 439 behaviours. 441 The particular case of session start needs to be managed 442 appropriately. Here ew_size increases each time a new source ADU is 443 received by the FECFRAME sender, until it reaches the ew_max_size 444 value. A FECFRAME receiver SHOULD continuously observe the received 445 FEC Repair Packets, since the NSS value carried in the Repair FEC 446 Payload ID will increase too, and adjust its ls_max_size accordingly 447 if need be. 449 3.1.2. Other Types of Real-Time Flow 451 In other configurations, a real-time source ADU flow, with a max_lat 452 latency budget, features a variable bitrate (VBR). A first approach 453 consists in considering the smallest instantaneous bitrate of the 454 source ADU flow, when this parameter is known, and to reuse the 455 derivation of Section 3.1.1. Considering the smallest bitrate means 456 that the encoding window and decoding window maximum sizes estimation 457 are pessimistic: these windows have the smallest size required to 458 enable a decoding on-time at a FECFRAME receiver. If the 459 instantaneous bitrate is higher than this smallest bitrate, this 460 approach leads to an encoding window that is unnecessarily small, 461 which reduces robustness in front of long erasure bursts. 463 Another approach consists in using ADU timing information (e.g., 464 using the timestamp field of an RTP packet header, or registering the 465 time upon receiving a new ADU). From the global FEC-related latency 466 budget the FECFRAME sender can derive a practical maximum latency 467 budget for encoding operations, max_lat_for_encoding. For the FEC 468 Schemes specified in this document, this latency budget SHOULD be 469 computed with: 471 max_lat_for_encoding = max_lat * 0.75 473 It follows that any source symbols associated to an ADU that has 474 timed-out with respect to max_lat_for_encoding SHOULD be removed from 475 the encoding window. With this approach there is no pre-determined 476 ew_size value: this value fluctuates over the time according to the 477 instantaneous source ADU flow bitrate. For practical reasons, a 478 FECFRAME sender may still require that ew_size does not increase 479 beyond a maximum value (Section 3.1.3). 481 With both approaches, and no matter the choice of the FECFRAME 482 sender, a FECFRAME receiver can still easily evaluate the ew_max_size 483 by observing the maximum Number of Source Symbols (NSS) value 484 contained in the Repair FEC Payload ID of received FEC Repair 485 Packets. A receiver can then compute dw_max_size and derive an 486 appropriate ls_max_size as explained in Section 3.1.1. 488 When the observed NSS fluctuates significantly, a FECFRAME receiver 489 may want to adapt its ls_max_size accordingly. In particular when 490 the NSS is significantly reduced, a FECFRAME receiver may want to 491 reduce the ls_max_size too in order to limit computation complexity. 492 However it is usually preferable to use a ls_max_size "too large" 493 (which can increase computation complexity and memory requirements) 494 than the opposite (which can reduce recovery performance). 496 Beyond these general guidelines, the details of how to manage these 497 situations at a FECFRAME sender and receiver can depend on additional 498 considerations that are out of scope of this document. 500 3.1.3. Case of a Non Real-Time Flow 502 Finally there are configurations where a source ADU flow has no real- 503 time constraints. FECFRAME and the FEC Schemes defined in this 504 document can still be used. The choice of appropriate parameter 505 values can be directed by practical considerations. For instance it 506 can derive from an estimation of the maximum memory amount that could 507 be dedicated to the linear system at a FECFRAME receiver, or the 508 maximum computation complexity at a FECFRAME receiver, both of them 509 depending on the ls_max_size parameter. The same considerations also 510 apply to the FECFRAME sender, where the maximum memory amount and 511 computation complexity depend on the ew_max_size parameter. 513 Here also, the NSS value contained in FEC Repair Packets is used by a 514 FECFRAME receiver to determine the current coding window size and 515 ew_max_size by observing its maximum value over the time. 517 Beyond these general guidelines, the details of how to manage these 518 situations at a FECFRAME sender and receiver can depend on additional 519 considerations that are out of scope of this document. 521 3.2. ADU, ADUI and Source Symbols Mappings 523 At a sender, an ADU coming from the application cannot directly be 524 mapped to source symbols. When multiple source flows (e.g., media 525 streams) are mapped onto the same FECFRAME instance, each flow is 526 assigned its own Flow ID value (see below). At a sender, this 527 identifier is prepended to each ADU before FEC encoding. This way, 528 FEC decoding at a receiver also recovers this Flow ID and a recovered 529 ADU can be assigned to the right source flow (note that transport 530 port numbers and IP addresses cannot be used to that purpose as they 531 are not recovered during FEC decoding). 533 Additionally, since ADUs are of variable size, padding is needed so 534 that each ADU (with its flow identifier) contribute to an integral 535 number of source symbols. This requires adding the original ADU 536 length to each ADU before doing FEC encoding. Because of these 537 requirements, an intermediate format, the ADUI, or ADU Information, 538 is considered [RFC6363]. 540 For each incoming ADU, an ADUI MUST created as follows. First of 541 all, 3 bytes are prepended (Figure 1): 543 Flow ID (F) (8-bit field): this unsigned byte contains the integer 544 identifier associated to the source ADU flow to which this ADU 545 belongs. It is assumed that a single byte is sufficient, which 546 implies that no more than 256 flows will be protected by a single 547 FECFRAME session instance. 548 Length (L) (16-bit field): this unsigned integer contains the length 549 of this ADU, in network byte order (i.e., big endian). This 550 length is for the ADU itself and does not include the F, L, or Pad 551 fields. 553 Then, zero padding is added to the ADU if needed: 555 Padding (Pad) (variable size field): this field contains zero 556 padding to align the F, L, ADU and padding up to a size that is 557 multiple of E bytes (i.e., the source and repair symbol length). 559 The data unit resulting from the ADU and the F, L, and Pad fields is 560 called ADUI. Since ADUs can have different sizes, this is also the 561 case for ADUIs. However an ADUI always contributes to an integral 562 number of source symbols. 564 symbol length, E E E 565 < ------------------ >< ------------------ >< ------------------ > 566 +-+--+---------------------------------------------+-------------+ 567 |F| L| ADU | Pad | 568 +-+--+---------------------------------------------+-------------+ 570 Figure 1: ADUI Creation example (here 3 source symbols are created 571 for this ADUI). 573 Note that neither the initial 3 bytes nor the optional padding are 574 sent over the network. However, they are considered during FEC 575 encoding, and a receiver who lost a certain FEC Source Packet (e.g., 576 the UDP datagram containing this FEC Source Packet when UDP is used 577 as the transport protocol) will be able to recover the ADUI if FEC 578 decoding succeeds. Thanks to the initial 3 bytes, this receiver will 579 get rid of the padding (if any) and identify the corresponding ADU 580 flow. 582 3.3. Encoding Window Management 584 Source symbols and the corresponding ADUs are removed from the 585 encoding window: 587 o when the sliding encoding window has reached its maximum size, 588 ew_max_size. In that case the oldest symbol MUST be removed 589 before adding a new symbol, so that the current encoding window 590 size always remains inferior or equal to the maximum size: ew_size 591 <= ew_max_size; 592 o when an ADU has reached its maximum validity duration in case of a 593 real-time flow. When this happens, all source symbols 594 corresponding to the ADUI that expired SHOULD be removed from the 595 encoding window; 597 Source symbols are added to the sliding encoding window each time a 598 new ADU arrives, once the ADU to source symbols mapping has been 599 performed (Section 3.2). The current size of the encoding window, 600 ew_size, is updated after adding new source symbols. This process 601 may require to remove old source symbols so that: ew_size <= 602 ew_max_size. 604 Note that a FEC codec may feature practical limits in the number of 605 source symbols in the encoding window (e.g., for computational 606 complexity reasons). This factor may further limit the ew_max_size 607 value, in addition to the maximum FEC-related latency budget 608 (Section 3.1). 610 3.4. Pseudo-Random Number Generator (PRNG) 612 The RLC FEC Schemes defined in this document rely on the TinyMT32 613 PRNG, a small-sized variant of the Mersenne Twister PRNG, as defined 614 in the reference implementation version 1.1 (2015/04/24) by Mutsuo 615 Saito (Hiroshima University) and Makoto Matsumoto (The University of 616 Tokyo). 618 o Official web site: 620 o Official github site and reference implementation: 621 623 For the RLC FEC Schemes defined in this document, the tinymt32 32-bit 624 version (rather than the 64-bit version) MUST be used. This PRNG 625 requires a parameter set that needs to be pre-calculated. For the 626 RLC FEC Schemes defined in this document, the following parameter set 627 MUST be used: 629 o mat1 = 0x8f7011ee = 2406486510; 630 o mat2 = 0xfc78ff1f = 4235788063; 631 o tmat = 0x3793fdff = 932445695. 633 This parameter set is the first entry of the precalculated parameter 634 sets in file tinymt32dc.0.1048576.txt, by Kenji Rikitake, and 635 available at: 637 o . 640 This is also the parameter set used in [KR12]. 642 The PRNG reference implementation is distributed under a BSD license 643 and excerpts of it are reproduced in Appendix A. In order to 644 validate an implementation of this PRNG, using seed 1, the 10,000th 645 value returned by: tinymt32_rand(s, 0xffff) MUST be equal to 0x7c37. 647 This PRNG MUST first be initialized with a 32-bit unsigned integer, 648 used as a seed. The following function is used to this purpose: 650 void tinymt32_init (tinymt32_t * s, uint32_t seed); 652 With the FEC Schemes defined in this document, the seed is in 653 practice restricted to a value between 0 and 0xFFFF inclusive (note 654 that this PRNG accepts a seed equal to 0), since this is the 655 Repair_Key 16-bit field value of the Repair FEC Payload ID 656 (Section 4.1.3). In addition to the seed, this function takes as 657 parameter a pointer to an instance of a tinymt32_t structure that is 658 used to keep the internal state of the PRNG. 660 Then, each time a new pseudo-random integer between 0 and maxv-1 661 inclusive is needed, the following function is used: 663 uint32_t tinymt32_rand (tinymt32_t * s, uint32_t maxv); 665 This function takes as parameter both a pointer to the same 666 tinymt32_t structure (that needs to be left unchanged between 667 successive calls to the function) and the maxv value. 669 3.5. Coding Coefficients Generation Function 671 The coding coefficients, used during the encoding process, are 672 generated at the RLC encoder by the generate_coding_coefficients() 673 function each time a new repair symbol needs to be produced. The 674 fraction of coefficients that are non zero (i.e., the density) is 675 controlled by the DT (Density Threshold) parameter. When DT equals 676 15, the maximum value, the function guaranties that all coefficients 677 are non zero (i.e., maximum density). When DT is between 0 (minimum 678 value) and strictly inferior to 15, the average probability of having 679 a non zero coefficient equals (DT +1) / 16. 681 These considerations apply both the RLC over GF(2) and RLC over 682 GF(2^^8), the only difference being the value of the m parameter. 683 With the RLC over GF(2) FEC Scheme (Section 5), m MUST be equal to 1. 684 With RLC over GF(2^^8) FEC Scheme (Section 4), m MUST be equal to 8. 686 687 /* 688 * Fills in the table of coding coefficients (of the right size) 689 * provided with the appropriate number of coding coefficients to 690 * use for the repair symbol key provided. 691 * 692 * (in) repair_key key associated to this repair symbol. This 693 * parameter is ignored (useless) if m=2 and dt=15 694 * (in) cc_tab[] pointer to a table of the right size to store 695 * coding coefficients. All coefficients are 696 * stored as bytes, regardless of the m parameter, 697 * upon return of this function. 698 * (in) cc_nb number of entries in the table. This value is 699 * equal to the current encoding window size. 700 * (in) dt integer between 0 and 15 (inclusive) that 701 * controls the density. With value 15, all 702 * coefficients are guaranteed to be non zero 703 * (i.e. equal to 1 with GF(2) and equal to a 704 * value in {1,... 255} with GF(2^^8)), otherwise 705 * a fraction of them will be 0. 706 * (in) m Finite Field GF(2^^m) parameter. In this 707 * document only values 1 and 8 are considered. 708 * (out) returns an error code 709 */ 710 int generate_coding_coefficients (uint16_t repair_key, 711 uint8_t cc_tab[], 712 uint16_t cc_nb, 713 uint8_t dt, 714 uint8_t m) 715 { 716 uint32_t i; 717 tinymt32_t s; /* PRNG internal state */ 719 if (dt > 15) { 720 return SOMETHING_WENT_WRONG; /* bad dt parameter */ 721 } 722 switch (m) { 723 case 1: 724 if (dt == 15) { 725 /* all coefficients are 1 */ 726 memset(cc_tab, 1, cc_nb); 727 } else { 728 /* here coefficients are either 0 or 1 */ 729 tinymt32_init(&s, repair_key); 730 for (i = 0 ; i < cc_nb ; i++) { 731 if (tinymt32_rand(&s, 16) <= dt) { 732 cc_tab[i] = (uint8_t) 1; 733 } else { 734 cc_tab[i] = (uint8_t) 0; 735 } 736 } 737 } 738 break; 740 case 8: 741 tinymt32_init(&s, repair_key); 742 if (dt == 15) { 743 /* coefficient 0 is avoided here in order to include 744 * all the source symbols */ 745 for (i = 0 ; i < cc_nb ; i++) { 746 do { 747 cc_tab[i] = (uint8_t) tinymt32_rand(&s, 256); 748 } while (cc_tab[i] == 0); 749 } 750 } else { 751 /* here a certain fraction of coefficients should be 0 */ 752 for (i = 0 ; i < cc_nb ; i++) { 753 if (tinymt32_rand(&s, 16) <= dt) { 754 do { 755 cc_tab[i] = (uint8_t) tinymt32_rand(&s, 256); 756 } while (cc_tab[i] == 0); 757 } else { 758 cc_tab[i] = 0; 759 } 760 } 761 } 762 break; 764 default: 766 /* bad parameter m */ 767 return SOMETHING_WENT_WRONG; 768 } 769 return EVERYTHING_IS_OKAY; 770 } 771 773 Figure 2: Coding Coefficients Generation Function pseudo-code 775 3.6. Finite Fields Operations 777 3.6.1. Finite Field Definitions 779 The two RLC FEC Schemes specified in this document reuse the Finite 780 Fields defined in [RFC5510], section 8.1. More specifically, the 781 elements of the field GF(2^^m) are represented by polynomials with 782 binary coefficients (i.e., over GF(2)) and degree lower or equal to 783 m-1. The addition between two elements is defined as the addition of 784 binary polynomials in GF(2), which is equivalent to a bitwise XOR 785 operation on the binary representation of these elements. 787 With GF(2^^8), multiplication between two elements is the 788 multiplication modulo a given irreducible polynomial of degree 8. 789 The following irreducible polynomial MUST be used for GF(2^^8): 791 x^^8 + x^^4 + x^^3 + x^^2 + 1 793 With GF(2), multiplication corresponds to a logical AND operation. 795 3.6.2. Linear Combination of Source Symbols Computation 797 The two RLC FEC Schemes require the computation of a linear 798 combination of source symbols, using the coding coefficients produced 799 by the generate_coding_coefficients() function and stored in the 800 cc_tab[] array. 802 With the RLC over GF(2^^8) FEC Scheme, a linear combination of the 803 ew_size source symbol present in the encoding window, say src_0 to 804 src_ew_size_1, in order to generate a repair symbol, is computed as 805 follows. For each byte of position i in each source and the repair 806 symbol, where i belongs to {0; E-1}, compute: 808 repair[i] = cc_tab[0] * src_0[i] + cc_tab[1] * src_1[i] + ... + 809 cc_tab[ew_size - 1] * src_ew_size_1[i] 811 where * is the multiplication over GF(2^^8) and + is an XOR 812 operation. In practice various optimizations need to be used in 813 order to make this computation efficient (see in particular [PGM13]). 815 With the RLC over GF(2) FEC Scheme (binary case), a linear 816 combination is computed as follows. The repair symbol is the XOR sum 817 of all the source symbols corresponding to a coding coefficient 818 cc_tab[j] equal to 1 (i.e., the source symbols corresponding to zero 819 coding coefficients are ignored). The XOR sum of the byte of 820 position i in each source is computed and stored in the corresponding 821 byte of the repair symbol, where i belongs to {0; E-1}. In practice, 822 the XOR sums will be computed several bytes at a time (e.g., on 64 823 bit words, or on arrays of 16 or more bytes when using SIMD CPU 824 extensions). 826 With both FEC Schemes, the details of how to optimize the computation 827 of these linear combinations are of high practical importance but out 828 of scope of this document. 830 4. Sliding Window RLC FEC Scheme over GF(2^^8) for Arbitrary ADU Flows 832 This fully-specified FEC Scheme defines the Sliding Window Random 833 Linear Codes (RLC) over GF(2^^8). 835 4.1. Formats and Codes 837 4.1.1. FEC Framework Configuration Information 839 Following the guidelines of [RFC6363], section 5.6, this section 840 provides the FEC Framework Configuration Information (or FFCI). This 841 FCCI needs to be shared (e.g., using SDP) between the FECFRAME sender 842 and receiver instances in order to synchronize them. It includes a 843 FEC Encoding ID, mandatory for any FEC Scheme specification, plus 844 scheme-specific elements. 846 4.1.1.1. FEC Encoding ID 848 o FEC Encoding ID: the value assigned to this fully specified FEC 849 Scheme MUST be XXXX, as assigned by IANA (Section 10). 851 When SDP is used to communicate the FFCI, this FEC Encoding ID is 852 carried in the 'encoding-id' parameter. 854 4.1.1.2. FEC Scheme-Specific Information 856 The FEC Scheme-Specific Information (FSSI) includes elements that are 857 specific to the present FEC Scheme. More precisely: 859 Encoding symbol size (E): a non-negative integer that indicates the 860 size of each encoding symbol in bytes; 862 This element is required both by the sender (RLC encoder) and the 863 receiver(s) (RLC decoder). 865 When SDP is used to communicate the FFCI, this FEC Scheme-specific 866 information is carried in the 'fssi' parameter in textual 867 representation as specified in [RFC6364]. For instance: 869 fssi=E:1400 871 If another mechanism requires the FSSI to be carried as an opaque 872 octet string (for instance, after a Base64 encoding), the encoding 873 format consists of the following 2 octets: 875 Encoding symbol length (E): 16-bit field. 877 0 1 878 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 879 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 880 | Encoding Symbol Length (E) | 881 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 883 Figure 3: FSSI Encoding Format 885 4.1.2. Explicit Source FEC Payload ID 887 A FEC Source Packet MUST contain an Explicit Source FEC Payload ID 888 that is appended to the end of the packet as illustrated in Figure 4. 890 +--------------------------------+ 891 | IP Header | 892 +--------------------------------+ 893 | Transport Header | 894 +--------------------------------+ 895 | ADU | 896 +--------------------------------+ 897 | Explicit Source FEC Payload ID | 898 +--------------------------------+ 900 Figure 4: Structure of an FEC Source Packet with the Explicit Source 901 FEC Payload ID 903 More precisely, the Explicit Source FEC Payload ID is composed of the 904 following field (Figure 5): 906 Encoding Symbol ID (ESI) (32-bit field): this unsigned integer 907 identifies the first source symbol of the ADUI corresponding to 908 this FEC Source Packet. The ESI is incremented for each new 909 source symbol, and after reaching the maximum value (2^32-1), 910 wrapping to zero occurs. 912 0 1 2 3 913 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 914 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 915 | Encoding Symbol ID (ESI) | 916 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 918 Figure 5: Source FEC Payload ID Encoding Format 920 4.1.3. Repair FEC Payload ID 922 A FEC Repair Packet MAY contain one or more repair symbols. When 923 there are several repair symbols, all of them MUST have been 924 generated from the same encoding window, using Repair_Key values that 925 are managed as explained below. A receiver can easily deduce the 926 number of repair symbols within a FEC Repair Packet by comparing the 927 received FEC Repair Packet size (equal to the UDP payload size when 928 UDP is the underlying transport protocol) and the symbol size, E, 929 communicated in the FFCI. 931 A FEC Repair Packet MUST contain a Repair FEC Payload ID that is 932 prepended to the repair symbol as illustrated in Figure 6. 934 +--------------------------------+ 935 | IP Header | 936 +--------------------------------+ 937 | Transport Header | 938 +--------------------------------+ 939 | Repair FEC Payload ID | 940 +--------------------------------+ 941 | Repair Symbol | 942 +--------------------------------+ 944 Figure 6: Structure of an FEC Repair Packet with the Repair FEC 945 Payload ID 947 More precisely, the Repair FEC Payload ID is composed of the 948 following fields (Figure 7): 950 Repair_Key (16-bit field): this unsigned integer is used as a seed 951 by the coefficient generation function (Section 3.5) in order to 952 generate the desired number of coding coefficients. When a FEC 953 Repair Packet contains several repair symbols, this repair key 954 value is that of the first repair symbol. The remaining repair 955 keys can be deduced by incrementing by 1 this value, up to a 956 maximum value of 65535 after which it loops back to 0. 958 Density Threshold for the coding coefficients, DT (4-bit field): 959 this unsigned integer carries the Density Threshold (DT) used by 960 the coding coefficient generation function Section 3.5. More 961 precisely, it controls the probability of having a non zero coding 962 coefficient, which equals (DT+1) / 16. When a FEC Repair Packet 963 contains several repair symbols, the DT value applies to all of 964 them; 965 Number of Source Symbols in the encoding window, NSS (12-bit field): 967 this unsigned integer indicates the number of source symbols in 968 the encoding window when this repair symbol was generated. When a 969 FEC Repair Packet contains several repair symbols, this NSS value 970 applies to all of them; 971 ESI of First Source Symbol in the encoding window, FSS_ESI (32-bit 972 field): 973 this unsigned integer indicates the ESI of the first source symbol 974 in the encoding window when this repair symbol was generated. 975 When a FEC Repair Packet contains several repair symbols, this 976 FSS_ESI value applies to all of them; 978 0 1 2 3 979 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 980 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 981 | Repair_Key | DT |NSS (# src symb in ew) | 982 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 983 | FSS_ESI | 984 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 986 Figure 7: Repair FEC Payload ID Encoding Format 988 4.1.4. Additional Procedures 990 The following procedure applies: 992 o The ESI of source symbols MUST start with value 0 for the first 993 source symbol and MUST be managed sequentially. Wrapping to zero 994 happens after reaching the maximum 32-bit value. 996 5. Sliding Window RLC FEC Scheme over GF(2) for Arbitrary ADU Flows 998 This fully-specified FEC Scheme defines the Sliding Window Random 999 Linear Codes (RLC) over GF(2) (binary case). 1001 5.1. Formats and Codes 1002 5.1.1. FEC Framework Configuration Information 1004 5.1.1.1. FEC Encoding ID 1006 o FEC Encoding ID: the value assigned to this fully specified FEC 1007 Scheme MUST be YYYY, as assigned by IANA (Section 10). 1009 When SDP is used to communicate the FFCI, this FEC Encoding ID is 1010 carried in the 'encoding-id' parameter. 1012 5.1.1.2. FEC Scheme-Specific Information 1014 All the considerations of Section 4.1.1.2 apply here. 1016 5.1.2. Explicit Source FEC Payload ID 1018 All the considerations of Section 4.1.1.2 apply here. 1020 5.1.3. Repair FEC Payload ID 1022 All the considerations of Section 4.1.1.2 apply here, with the only 1023 exception that the Repair_Key field is useless if DT = 15 (indeed, in 1024 that case all the coefficients are necessarily equal to 1 and the 1025 coefficient generation function does not use any PRNG). When DT = 15 1026 it is RECOMMENDED that the sender use value 0 for the Repair_Key 1027 field, but a receiver SHALL ignore this field. 1029 5.1.4. Additional Procedures 1031 All the considerations of Section 4.1.1.2 apply here. 1033 6. FEC Code Specification 1035 6.1. Encoding Side 1037 This section provides a high level description of a Sliding Window 1038 RLC encoder. 1040 Whenever a new FEC Repair Packet is needed, the RLC encoder instance 1041 first gathers the ew_size source symbols currently in the sliding 1042 encoding window. Then it chooses a repair key, which can be a 1043 monotonically increasing integer value, incremented for each repair 1044 symbol up to a maximum value of 65535 (as it is carried within a 1045 16-bit field) after which it loops back to 0. This repair key is 1046 communicated to the coefficient generation function (Section 3.5) in 1047 order to generate ew_size coding coefficients. Finally, the FECFRAME 1048 sender computes the repair symbol as a linear combination of the 1049 ew_size source symbols using the ew_size coding coefficients 1050 (Section 3.6). When E is small and when there is an incentive to 1051 pack several repair symbols within the same FEC Repair Packet, the 1052 appropriate number of repair symbols are computed. In that case the 1053 repair key for each of them MUST be incremented by 1, keeping the 1054 same ew_size source symbols, since only the first repair key will be 1055 carried in the Repair FEC Payload ID. The FEC Repair Packet can then 1056 be passed to the transport layer for transmission. The source versus 1057 repair FEC packet transmission order is out of scope of this document 1058 and several approaches exist that are implementation specific. 1060 Other solutions are possible to select a repair key value when a new 1061 FEC Repair Packet is needed, for instance by choosing a random 1062 integer between 0 and 65535. However, selecting the same repair key 1063 as before (which may happen in case of a random process) is only 1064 meaningful if the encoding window has changed, otherwise the same FEC 1065 Repair Packet will be generated. 1067 6.2. Decoding Side 1069 This section provides a high level description of a Sliding Window 1070 RLC decoder. 1072 A FECFRAME receiver needs to maintain a linear system whose variables 1073 are the received and lost source symbols. Upon receiving a FEC 1074 Repair Packet, a receiver first extracts all the repair symbols it 1075 contains (in case several repair symbols are packed together). For 1076 each repair symbol, when at least one of the corresponding source 1077 symbols it protects has been lost, the receiver adds an equation to 1078 the linear system (or no equation if this repair packet does not 1079 change the linear system rank). This equation of course re-uses the 1080 ew_size coding coefficients that are computed by the same coefficient 1081 generation function (Section Section 3.5), using the repair key and 1082 encoding window descriptions carried in the Repair FEC Payload ID. 1083 Whenever possible (i.e., when a sub-system covering one or more lost 1084 source symbols is of full rank), decoding is performed in order to 1085 recover lost source symbols. Each time an ADUI can be totally 1086 recovered, padding is removed (thanks to the Length field, L, of the 1087 ADUI) and the ADU is assigned to the corresponding application flow 1088 (thanks to the Flow ID field, F, of the ADUI). This ADU is finally 1089 passed to the corresponding upper application. Received FEC Source 1090 Packets, containing an ADU, MAY be passed to the application either 1091 immediately or after some time to guaranty an ordered delivery to the 1092 application. This document does not mandate any approach as this is 1093 an operational and management decision. 1095 With real-time flows, a lost ADU that is decoded after the maximum 1096 latency or an ADU received after this delay has no value to the 1097 application. This raises the question of deciding whether or not an 1098 ADU is late. This decision MAY be taken within the FECFRAME receiver 1099 (e.g., using the decoding window, see Section 3.1) or within the 1100 application (e.g., using RTP timestamps within the ADU). Deciding 1101 which option to follow and whether or not to pass all ADUs, including 1102 those assumed late, to the application are operational decisions that 1103 depend on the application and are therefore out of scope of this 1104 document. Additionally, Appendix B discusses a backward compatible 1105 optimization whereby late source symbols MAY still be used within the 1106 FECFRAME receiver in order to improve transmission robustness. 1108 7. Implementation Status 1110 Editor's notes: RFC Editor, please remove this section motivated by 1111 RFC 6982 before publishing the RFC. Thanks. 1113 An implementation of the Sliding Window RLC FEC Scheme for FECFRAME 1114 exists: 1116 o Organisation: Inria 1117 o Description: This is an implementation of the Sliding Window RLC 1118 FEC Scheme limited to GF(2^^8). It relies on a modified version 1119 of our OpenFEC (http://openfec.org) FEC code library. It is 1120 integrated in our FECFRAME software (see [fecframe-ext]). 1121 o Maturity: prototype. 1122 o Coverage: this software complies with the Sliding Window RLC FEC 1123 Scheme. 1124 o Licensing: proprietary. 1125 o Contact: vincent.roca@inria.fr 1127 8. Security Considerations 1129 The FEC Framework document [RFC6363] provides a comprehensive 1130 analysis of security considerations applicable to FEC Schemes. 1131 Therefore, the present section follows the security considerations 1132 section of [RFC6363] and only discusses specific topics. 1134 8.1. Attacks Against the Data Flow 1136 8.1.1. Access to Confidential Content 1138 The Sliding Window RLC FEC Scheme specified in this document does not 1139 change the recommendations of [RFC6363]. To summarize, if 1140 confidentiality is a concern, it is RECOMMENDED that one of the 1141 solutions mentioned in [RFC6363] is used with special considerations 1142 to the way this solution is applied (e.g., is encryption applied 1143 before or after FEC protection, within the end-system or in a 1144 middlebox), to the operational constraints (e.g., performing FEC 1145 decoding in a protected environment may be complicated or even 1146 impossible) and to the threat model. 1148 8.1.2. Content Corruption 1150 The Sliding Window RLC FEC Scheme specified in this document does not 1151 change the recommendations of [RFC6363]. To summarize, it is 1152 RECOMMENDED that one of the solutions mentioned in [RFC6363] is used 1153 on both the FEC Source and Repair Packets. 1155 8.2. Attacks Against the FEC Parameters 1157 The FEC Scheme specified in this document defines parameters that can 1158 be the basis of attacks. More specifically, the following parameters 1159 of the FFCI may be modified by an attacker who targets receivers 1160 (Section 4.1.1.2): 1162 o FEC Encoding ID: changing this parameter leads a receiver to 1163 consider a different FEC Scheme. The consequences are severe, the 1164 format of the Explicit Source FEC Payload ID and Repair FEC 1165 Payload ID of received packets will probably differ, leading to 1166 various malfunctions. Even if the original and modified FEC 1167 Schemes share the same format, FEC decoding will either fail or 1168 lead to corrupted decoded symbols. This will happen if an 1169 attacker turns value YYYY (i.e., RLC over GF(2)) to value XXXX 1170 (RLC over GF(2^^8)), an additional consequence being a higher 1171 processing overhead at the receiver. In any case, the attack 1172 results in a form of Denial of Service (DoS); 1173 o Encoding symbol length (E): setting this E parameter to a 1174 different value will confuse a receiver. If the size of a 1175 received FEC Repair Packet is no longer multiple of the modified E 1176 value, a receiver quickly detects a problem and SHOULD reject the 1177 packet. If the new E value is a sub-multiple of the original E 1178 value (e.g., half the original value), then receivers may not 1179 detect the problem immediately. For instance a receiver may think 1180 that a received FEC Repair Packet contains more repair symbols 1181 (e.g., twice as many if E is reduced by half), leading to 1182 malfunctions whose nature depends on implementation details. Here 1183 also, the attack always results in a form of DoS; 1185 It is therefore RECOMMENDED that security measures be taken to 1186 guarantee the FFCI integrity, as specified in [RFC6363]. How to 1187 achieve this depends on the way the FFCI is communicated from the 1188 sender to the receiver, which is not specified in this document. 1190 Similarly, attacks are possible against the Explicit Source FEC 1191 Payload ID and Repair FEC Payload ID. More specifically, in case of 1192 a FEC Source Packet, the following value can be modified by an 1193 attacker who targets receivers: 1195 o Encoding Symbol ID (ESI): changing the ESI leads a receiver to 1196 consider a wrong ADU, resulting in severe consequences, including 1197 corrupted content passed to the receiving application; 1199 And in case of a FEC Repair Packet: 1201 o Repair Key: changing this value leads a receiver to generate a 1202 wrong coding coefficient sequence, and therefore any source symbol 1203 decoded using the repair symbols contained in this packet will be 1204 corrupted; 1205 o DT: changing this value also leads a receiver to generate a wrong 1206 coding coefficient sequence, and therefore any source symbol 1207 decoded using the repair symbols contained in this packet will be 1208 corrupted. In addition, if the DT value is significantly 1209 increased, it will generate a higher processing overhead at a 1210 receiver. In case of very large encoding windows, this may impact 1211 the terminal performance; 1212 o NSS: changing this value leads a receiver to consider a different 1213 set of source symbols, and therefore any source symbol decoded 1214 using the repair symbols contained in this packet will be 1215 corrupted. In addition, if the NSS value is significantly 1216 increased, it will generate a higher processing overhead at a 1217 receiver, which may impact the terminal performance; 1218 o FSS_ESI: changing this value also leads a receiver to consider a 1219 different set of source symbols and therefore any source symbol 1220 decoded using the repair symbols contained in this packet will be 1221 corrupted. 1223 It is therefore RECOMMENDED that security measures are taken to 1224 guarantee the FEC Source and Repair Packets as stated in [RFC6363]. 1226 8.3. When Several Source Flows are to be Protected Together 1228 The Sliding Window RLC FEC Scheme specified in this document does not 1229 change the recommendations of [RFC6363]. 1231 8.4. Baseline Secure FEC Framework Operation 1233 The Sliding Window RLC FEC Scheme specified in this document does not 1234 change the recommendations of [RFC6363] concerning the use of the 1235 IPsec/ESP security protocol as a mandatory to implement (but not 1236 mandatory to use) security scheme. This is well suited to situations 1237 where the only insecure domain is the one over which the FEC 1238 Framework operates. 1240 8.5. Additional Security Considerations for Numerical Computations 1242 In addition to the above security considerations, inherited from 1243 [RFC6363], the present document introduces several formulae, in 1244 particular in Section 3.1.1. It is RECOMMENDED to check that the 1245 computed values stay within reasonnable bounds since numerical 1246 overflows, caused by an erroneous implementation or an erroneous 1247 input value, may lead to hazardous behaviours. However what 1248 "reasonnable bounds" means is use-case and implementation dependent 1249 and is not detailed in this document. 1251 Section 3.1.2 also mentions the possibility of "using the timestamp 1252 field of an RTP packet header" when applicable. A malicious attacker 1253 may deliberately corrupt this header field in order to trigger 1254 hazardous behaviours at a FECFRAME receiver. Protection against this 1255 type of content corruption can be addressed with the above 1256 recommendations on a baseline secure operation. In addition, it is 1257 also RECOMMENDED to check that the timestamp value be within 1258 reasonnable bounds. 1260 9. Operations and Management Considerations 1262 The FEC Framework document [RFC6363] provides a comprehensive 1263 analysis of operations and management considerations applicable to 1264 FEC Schemes. Therefore, the present section only discusses specific 1265 topics. 1267 9.1. Operational Recommendations: Finite Field GF(2) Versus GF(2^^8) 1269 The present document specifies two FEC Schemes that differ on the 1270 Finite Field used for the coding coefficients. It is expected that 1271 the RLC over GF(2^^8) FEC Scheme will be mostly used since it 1272 warrants a higher packet loss protection. In case of small encoding 1273 windows, the associated processing overhead is not an issue (e.g., we 1274 measured decoding speeds between 745 Mbps and 2.8 Gbps on an ARM 1275 Cortex-A15 embedded board in [Roca17]). Of course the CPU overhead 1276 will increase with the encoding window size, because more operations 1277 in the GF(2^^8) finite field will be needed. 1279 The RLC over GF(2) FEC Scheme offers an alternative. In that case 1280 operations symbols can be directly XOR-ed together which warrants 1281 high bitrate encoding and decoding operations, and can be an 1282 advantage with large encoding windows. However packet loss 1283 protection is significantly reduced by using this FEC Scheme. 1285 9.2. Operational Recommendations: Coding Coefficients Density Threshold 1287 In addition to the choice of the Finite Field, the two FEC Schemes 1288 define a coding coefficient density threshold (DT) parameter. This 1289 parameter enables a sender to control the code density, i.e., the 1290 proportion of coefficients that are non zero on average. With RLC 1291 over GF(2^^8), it is usually appropriate that small encoding windows 1292 be associated to a density threshold equal to 15, the maximum value, 1293 in order to warrant a high loss protection. 1295 On the opposite, with larger encoding windows, it is usually 1296 appropriate that the density threshold be reduced. With large 1297 encoding windows, an alternative can be to use RLC over GF(2) and a 1298 density threshold equal to 7 (i.e., an average density equal to 1/2) 1299 or smaller. 1301 Note that using a density threshold equal to 15 with RLC over GF(2) 1302 is equivalent to using an XOR code that compute the XOR sum of all 1303 the source symbols in the encoding window. In that case: (1) a 1304 single repair symbol can be produced for any encoding window, and (2) 1305 the repair_key parameter becomes useless (the coding coefficients 1306 generation function does not rely on the PRNG). 1308 10. IANA Considerations 1310 This document registers two values in the "FEC Framework (FECFRAME) 1311 FEC Encoding IDs" registry [RFC6363] as follows: 1313 o YYYY refers to the Sliding Window Random Linear Codes (RLC) over 1314 GF(2) FEC Scheme for Arbitrary Packet Flows, as defined in 1315 Section 5 of this document. 1316 o XXXX refers to the Sliding Window Random Linear Codes (RLC) over 1317 GF(2^^8) FEC Scheme for Arbitrary Packet Flows, as defined in 1318 Section 4 of this document. 1320 11. Acknowledgments 1322 The authors would like to thank Russ Housley, Alan DeKok, Spencer 1323 Dawkins, Gorry Fairhurst, Jonathan Detchart, Emmanuel Lochin, and 1324 Marie-Jose Montpetit for their valuable feedbacks on this document. 1326 12. References 1328 12.1. Normative References 1330 [fecframe-ext] 1331 Roca, V. and A. Begen, "Forward Error Correction (FEC) 1332 Framework Extension to Sliding Window Codes", Transport 1333 Area Working Group (TSVWG) draft-ietf-tsvwg-fecframe-ext 1334 (Work in Progress), September 2018, 1335 . 1338 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1339 Requirement Levels", BCP 14, RFC 2119, 1340 DOI 10.17487/RFC2119, March 1997, 1341 . 1343 [RFC6363] Watson, M., Begen, A., and V. Roca, "Forward Error 1344 Correction (FEC) Framework", RFC 6363, 1345 DOI 10.17487/RFC6363, October 2011, 1346 . 1348 [RFC6364] Begen, A., "Session Description Protocol Elements for the 1349 Forward Error Correction (FEC) Framework", RFC 6364, 1350 DOI 10.17487/RFC6364, October 2011, 1351 . 1353 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 1354 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 1355 May 2017, . 1357 12.2. Informative References 1359 [KR12] Rikitake, K., "TinyMT Pseudo Random Number Generator for 1360 Erlang", ACM 11th SIGPLAN Erlang Workshop (Erlang'12), 1361 September 14, 2012, Copenhagen, Denmark, DOI: 1362 http://dx.doi.org/10.1145/2364489.2364504, September 2012. 1364 [PGM13] Plank, J., Greenan, K., and E. Miller, "A Complete 1365 Treatment of Software Implementations of Finite Field 1366 Arithmetic for Erasure Coding Applications", University of 1367 Tennessee Technical Report UT-CS-13-717, 1368 http://web.eecs.utk.edu/~plank/plank/papers/ 1369 UT-CS-13-717.html, October 2013, 1370 . 1373 [RFC5510] Lacan, J., Roca, V., Peltotalo, J., and S. Peltotalo, 1374 "Reed-Solomon Forward Error Correction (FEC) Schemes", 1375 RFC 5510, DOI 10.17487/RFC5510, April 2009, 1376 . 1378 [RFC6726] Paila, T., Walsh, R., Luby, M., Roca, V., and R. Lehtonen, 1379 "FLUTE - File Delivery over Unidirectional Transport", 1380 RFC 6726, DOI 10.17487/RFC6726, November 2012, 1381 . 1383 [RFC6816] Roca, V., Cunche, M., and J. Lacan, "Simple Low-Density 1384 Parity Check (LDPC) Staircase Forward Error Correction 1385 (FEC) Scheme for FECFRAME", RFC 6816, 1386 DOI 10.17487/RFC6816, December 2012, 1387 . 1389 [RFC6865] Roca, V., Cunche, M., Lacan, J., Bouabdallah, A., and K. 1390 Matsuzono, "Simple Reed-Solomon Forward Error Correction 1391 (FEC) Scheme for FECFRAME", RFC 6865, 1392 DOI 10.17487/RFC6865, February 2013, 1393 . 1395 [RFC8406] Adamson, B., Adjih, C., Bilbao, J., Firoiu, V., Fitzek, 1396 F., Ghanem, S., Lochin, E., Masucci, A., Montpetit, M-J., 1397 Pedersen, M., Peralta, G., Roca, V., Ed., Saxena, P., and 1398 S. Sivakumar, "Taxonomy of Coding Techniques for Efficient 1399 Network Communications", RFC 8406, DOI 10.17487/RFC8406, 1400 June 2018, . 1402 [Roca16] Roca, V., Teibi, B., Burdinat, C., Tran, T., and C. 1403 Thienot, "Block or Convolutional AL-FEC Codes? A 1404 Performance Comparison for Robust Low-Latency 1405 Communications", HAL open-archive document,hal-01395937 1406 https://hal.inria.fr/hal-01395937/en/, November 2016, 1407 . 1409 [Roca17] Roca, V., Teibi, B., Burdinat, C., Tran, T., and C. 1410 Thienot, "Less Latency and Better Protection with AL-FEC 1411 Sliding Window Codes: a Robust Multimedia CBR Broadcast 1412 Case Study", 13th IEEE International Conference on 1413 Wireless and Mobile Computing, Networking and 1414 Communications (WiMob17), October 1415 2017 https://hal.inria.fr/hal-01571609v1/en/, October 1416 2017, . 1418 Appendix A. TinyMT32 Pseudo-Random Number Generator 1420 The TinyMT32 PRNG reference implementation is distributed under a BSD 1421 license by the authors and excerpts of it are reproduced in Figure 8. 1422 The differences with respect to the original source code are: 1424 o the unused parts of the original source code have been removed; 1425 o the appropriate parameter set has been added to the initialization 1426 function; 1427 o the tinymt32_rand() function has been added; 1428 o the function order has been changed; 1429 o certain internal variables have been renamed for compactness 1430 purposes. 1432 1433 /** 1434 * Tiny Mersenne Twister only 127 bit internal state 1435 * 1436 * Authors : Mutsuo Saito (Hiroshima University) 1437 * Makoto Matsumoto (University of Tokyo) 1438 * 1439 * Copyright (c) 2011, 2013 Mutsuo Saito, Makoto Matsumoto, 1440 * Hiroshima University and The University of Tokyo. 1441 * All rights reserved. 1442 * 1443 * Redistribution and use in source and binary forms, with or without 1444 * modification, are permitted provided that the following conditions 1445 * are met: 1446 * 1447 * - Redistributions of source code must retain the above copyright 1448 * notice, this list of conditions and the following disclaimer. 1449 * - Redistributions in binary form must reproduce the above 1450 * copyright notice, this list of conditions and the following 1451 * disclaimer in the documentation and/or other materials 1452 * provided with the distribution. 1453 * - Neither the name of the Hiroshima University nor the names of 1454 * its contributors may be used to endorse or promote products 1455 * derived from this software without specific prior written 1456 * permission. 1457 * 1458 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 1459 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 1460 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1461 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 1462 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 1463 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1464 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 1465 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1466 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 1467 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 1468 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 1469 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1470 * SUCH DAMAGE. 1471 */ 1473 #include 1475 /** 1476 * tinymt32 internal state vector and parameters 1477 */ 1478 typedef struct { 1479 uint32_t status[4]; 1480 uint32_t mat1; 1481 uint32_t mat2; 1482 uint32_t tmat; 1483 } tinymt32_t; 1485 static void tinymt32_next_state (tinymt32_t * s); 1486 static uint32_t tinymt32_temper (tinymt32_t * s); 1487 static double tinymt32_generate_32double (tinymt32_t * s); 1489 /** 1490 * Parameter set to use for the IETF RLC FEC Schemes specification. 1491 * Do not change. 1492 * This parameter set is the first entry of the precalculated parameter 1493 * sets in file tinymt32dc.0.1048576.txt, by Kenji Rikitake, available 1494 * at: https://github.com/jj1bdx/tinymtdc-longbatch/blob/master/ 1495 * tinymt32dc/tinymt32dc.0.1048576.txt 1496 * It is also the parameter set used: 1497 * Rikitake, K., "TinyMT Pseudo Random Number Generator for 1498 * Erlang", ACM 11th SIGPLAN Erlang Workshop (Erlang'12), 1499 * September, 2012. 1500 */ 1501 #define TINYMT32_MAT1_PARAM 0x8f7011ee 1502 #define TINYMT32_MAT2_PARAM 0xfc78ff1f 1503 #define TINYMT32_TMAT_PARAM 0x3793fdff 1505 /** 1506 * This function initializes the internal state array with a 32-bit 1507 * unsigned integer seed. 1508 * @param s pointer to tinymt internal state. 1509 * @param seed a 32-bit unsigned integer used as a seed. 1510 */ 1511 void tinymt32_init (tinymt32_t * s, uint32_t seed) 1512 { 1513 #define MIN_LOOP 8 1514 #define PRE_LOOP 8 1515 s->status[0] = seed; 1516 s->status[1] = s->mat1 = TINYMT32_MAT1_PARAM; 1517 s->status[2] = s->mat2 = TINYMT32_MAT2_PARAM; 1518 s->status[3] = s->tmat = TINYMT32_TMAT_PARAM; 1519 for (int i = 1; i < MIN_LOOP; i++) { 1520 s->status[i & 3] ^= i + UINT32_C(1812433253) 1521 * (s->status[(i - 1) & 3] 1522 ^ (s->status[(i - 1) & 3] >> 30)); 1523 } 1524 for (int i = 0; i < PRE_LOOP; i++) { 1525 tinymt32_next_state(s); 1526 } 1527 } 1529 /** 1530 * This function outputs an integer in the [0 .. maxv-1] range. 1531 * @param s pointer to tinymt internal state. 1532 * @return 32-bit unsigned integer between 0 and maxv-1 inclusive. 1533 */ 1534 uint32_t tinymt32_rand (tinymt32_t * s, uint32_t maxv) 1535 { 1536 return (uint32_t)(tinymt32_generate_32double(s) * (double)maxv); 1537 } 1539 /** 1540 * Internal tinymt32 constants and functions. 1541 * Users should not call these functions directly. 1542 */ 1543 #define TINYMT32_MEXP 127 1544 #define TINYMT32_SH0 1 1545 #define TINYMT32_SH1 10 1546 #define TINYMT32_SH8 8 1547 #define TINYMT32_MASK UINT32_C(0x7fffffff) 1548 #define TINYMT32_MUL (1.0f / 16777216.0f) 1550 /** 1551 * This function changes internal state of tinymt32. 1552 * @param s pointer to tinymt internal state. 1553 */ 1554 static void tinymt32_next_state (tinymt32_t * s) 1555 { 1556 uint32_t x; 1557 uint32_t y; 1559 y = s->status[3]; 1560 x = (s->status[0] & TINYMT32_MASK) 1561 ^ s->status[1] 1562 ^ s->status[2]; 1563 x ^= (x << TINYMT32_SH0); 1564 y ^= (y >> TINYMT32_SH0) ^ x; 1565 s->status[0] = s->status[1]; 1566 s->status[1] = s->status[2]; 1567 s->status[2] = x ^ (y << TINYMT32_SH1); 1568 s->status[3] = y; 1569 s->status[1] ^= -((int32_t)(y & 1)) & s->mat1; 1570 s->status[2] ^= -((int32_t)(y & 1)) & s->mat2; 1571 } 1573 /** 1574 * This function outputs 32-bit unsigned integer from internal state. 1575 * @param s pointer to tinymt internal state. 1576 * @return 32-bit unsigned pseudos number 1577 */ 1578 static uint32_t tinymt32_temper (tinymt32_t * s) 1579 { 1580 uint32_t t0, t1; 1581 t0 = s->status[3]; 1582 t1 = s->status[0] + (s->status[2] >> TINYMT32_SH8); 1583 t0 ^= t1; 1584 t0 ^= -((int32_t)(t1 & 1)) & s->tmat; 1585 return t0; 1586 } 1588 /** 1589 * This function outputs double precision floating point number from 1590 * internal state. The returned value has 32-bit precision. 1591 * In other words, this function makes one double precision floating 1592 * point number from one 32-bit unsigned integer. 1593 * @param s pointer to tinymt internal state. 1594 * @return floating point number r (0.0 <= r < 1.0) 1595 */ 1596 static double tinymt32_generate_32double (tinymt32_t * s) 1597 { 1598 tinymt32_next_state(s); 1599 return (double)tinymt32_temper(s) * (1.0 / 4294967296.0); 1600 } 1601 1603 Figure 8: TinyMT32 pseudo-code 1605 Appendix B. Decoding Beyond Maximum Latency Optimization 1607 This annex introduces non normative considerations. It is provided 1608 as suggestions, without any impact on interoperability. For more 1609 information see [Roca16]. 1611 With a real-time source ADU flow, it is possible to improve the 1612 decoding performance of sliding window codes without impacting 1613 maximum latency, at the cost of extra memory and CPU overhead. The 1614 optimization consists, for a FECFRAME receiver, to extend the linear 1615 system beyond the decoding window maximum size, by keeping a certain 1616 number of old source symbols whereas their associated ADUs timed-out: 1618 ls_max_size > dw_max_size 1620 Usually the following choice is a good trade-off between decoding 1621 performance and extra CPU overhead: 1623 ls_max_size = 2 * dw_max_size 1625 When the dw_max_size is very small, it may be preferable to keep a 1626 minimum ls_max_size value (e.g., LS_MIN_SIZE_DEFAULT = 40 symbols). 1627 Going below this threshold will not save a significant amount of 1628 memory nor CPU cycles. Therefore: 1630 ls_max_size = max(2 * dw_max_size, LS_MIN_SIZE_DEFAULT) 1632 Finally, it is worth noting that a good receiver, i.e., a receiver 1633 that benefits from an FEC protection significantly higher than what 1634 is required to recover from packet losses, can choose to reduce the 1635 ls_max_size. In that case lost ADUs will be recovered without 1636 relying on this optimization. 1638 ls_max_size 1639 /---------------------------------^-------------------------------\ 1641 late source symbols 1642 (pot. decoded but not delivered) dw_max_size 1643 /--------------^-----------------\ /--------------^---------------\ 1644 src0 src1 src2 src3 src4 src5 src6 src7 src8 src9 src10 src11 src12 1646 Figure 9: Relationship between parameters to decode beyond maximum 1647 latency. 1649 It means that source symbols, and therefore ADUs, may be decoded even 1650 if the added latency exceeds the maximum value permitted by the 1651 application (the "late source symbols" of Figure 9). It follows that 1652 the corresponding ADUs will not be useful to the application. 1654 However, decoding these "late symbols" significantly improves the 1655 global robustness in bad reception conditions and is therefore 1656 recommended for receivers experiencing bad communication conditions 1657 [Roca16]. In any case whether or not to use this optimization and 1658 what exact value to use for the ls_max_size parameter are local 1659 decisions made by each receiver independently, without any impact on 1660 the other receivers nor on the source. 1662 Authors' Addresses 1664 Vincent Roca 1665 INRIA 1666 Univ. Grenoble Alpes 1667 France 1669 EMail: vincent.roca@inria.fr 1671 Belkacem Teibi 1672 INRIA 1673 Univ. Grenoble Alpes 1674 France 1676 EMail: belkacem.teibi@inria.fr