idnits 2.17.1 draft-ietf-tsvwg-rlc-fec-scheme-09.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 1510 has weird spacing: '...am seed a 32-...' -- The document date (September 19, 2018) is 2045 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-09 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 82 Packet 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 Packet 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 Packet 831 Flows 833 This fully-specified FEC Scheme defines the Sliding Window Random 834 Linear Codes (RLC) over GF(2^^8). 836 4.1. Formats and Codes 838 4.1.1. FEC Framework Configuration Information 840 Following the guidelines of [RFC6363], section 5.6, this section 841 provides the FEC Framework Configuration Information (or FFCI). This 842 FCCI needs to be shared (e.g., using SDP) between the FECFRAME sender 843 and receiver instances in order to synchronize them. It includes a 844 FEC Encoding ID, mandatory for any FEC Scheme specification, plus 845 scheme-specific elements. 847 4.1.1.1. FEC Encoding ID 849 o FEC Encoding ID: the value assigned to this fully specified FEC 850 Scheme MUST be XXXX, as assigned by IANA (Section 10). 852 When SDP is used to communicate the FFCI, this FEC Encoding ID is 853 carried in the 'encoding-id' parameter. 855 4.1.1.2. FEC Scheme-Specific Information 857 The FEC Scheme-Specific Information (FSSI) includes elements that are 858 specific to the present FEC Scheme. More precisely: 860 Encoding symbol size (E): a non-negative integer that indicates the 861 size of each encoding symbol in bytes; 863 This element is required both by the sender (RLC encoder) and the 864 receiver(s) (RLC decoder). 866 When SDP is used to communicate the FFCI, this FEC Scheme-specific 867 information is carried in the 'fssi' parameter in textual 868 representation as specified in [RFC6364]. For instance: 870 fssi=E:1400 872 If another mechanism requires the FSSI to be carried as an opaque 873 octet string (for instance, after a Base64 encoding), the encoding 874 format consists of the following 2 octets: 876 Encoding symbol length (E): 16-bit field. 878 0 1 879 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 880 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 881 | Encoding Symbol Length (E) | 882 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 884 Figure 3: FSSI Encoding Format 886 4.1.2. Explicit Source FEC Payload ID 888 A FEC Source Packet MUST contain an Explicit Source FEC Payload ID 889 that is appended to the end of the packet as illustrated in Figure 4. 891 +--------------------------------+ 892 | IP Header | 893 +--------------------------------+ 894 | Transport Header | 895 +--------------------------------+ 896 | ADU | 897 +--------------------------------+ 898 | Explicit Source FEC Payload ID | 899 +--------------------------------+ 901 Figure 4: Structure of an FEC Source Packet with the Explicit Source 902 FEC Payload ID 904 More precisely, the Explicit Source FEC Payload ID is composed of the 905 following field (Figure 5): 907 Encoding Symbol ID (ESI) (32-bit field): this unsigned integer 908 identifies the first source symbol of the ADUI corresponding to 909 this FEC Source Packet. The ESI is incremented for each new 910 source symbol, and after reaching the maximum value (2^32-1), 911 wrapping to zero occurs. 913 0 1 2 3 914 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 915 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 916 | Encoding Symbol ID (ESI) | 917 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 919 Figure 5: Source FEC Payload ID Encoding Format 921 4.1.3. Repair FEC Payload ID 923 A FEC Repair Packet MAY contain one or more repair symbols. When 924 there are several repair symbols, all of them MUST have been 925 generated from the same encoding window, using Repair_Key values that 926 are managed as explained below. A receiver can easily deduce the 927 number of repair symbols within a FEC Repair Packet by comparing the 928 received FEC Repair Packet size (equal to the UDP payload size when 929 UDP is the underlying transport protocol) and the symbol size, E, 930 communicated in the FFCI. 932 A FEC Repair Packet MUST contain a Repair FEC Payload ID that is 933 prepended to the repair symbol as illustrated in Figure 6. 935 +--------------------------------+ 936 | IP Header | 937 +--------------------------------+ 938 | Transport Header | 939 +--------------------------------+ 940 | Repair FEC Payload ID | 941 +--------------------------------+ 942 | Repair Symbol | 943 +--------------------------------+ 945 Figure 6: Structure of an FEC Repair Packet with the Repair FEC 946 Payload ID 948 More precisely, the Repair FEC Payload ID is composed of the 949 following fields (Figure 7): 951 Repair_Key (16-bit field): this unsigned integer is used as a seed 952 by the coefficient generation function (Section 3.5) in order to 953 generate the desired number of coding coefficients. When a FEC 954 Repair Packet contains several repair symbols, this repair key 955 value is that of the first repair symbol. The remaining repair 956 keys can be deduced by incrementing by 1 this value, up to a 957 maximum value of 65535 after which it loops back to 0. 959 Density Threshold for the coding coefficients, DT (4-bit field): 960 this unsigned integer carries the Density Threshold (DT) used by 961 the coding coefficient generation function Section 3.5. More 962 precisely, it controls the probability of having a non zero coding 963 coefficient, which equals (DT+1) / 16. When a FEC Repair Packet 964 contains several repair symbols, the DT value applies to all of 965 them; 966 Number of Source Symbols in the encoding window, NSS (12-bit field): 968 this unsigned integer indicates the number of source symbols in 969 the encoding window when this repair symbol was generated. When a 970 FEC Repair Packet contains several repair symbols, this NSS value 971 applies to all of them; 972 ESI of First Source Symbol in the encoding window, FSS_ESI (32-bit 973 field): 974 this unsigned integer indicates the ESI of the first source symbol 975 in the encoding window when this repair symbol was generated. 976 When a FEC Repair Packet contains several repair symbols, this 977 FSS_ESI value applies to all of them; 979 0 1 2 3 980 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 981 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 982 | Repair_Key | DT |NSS (# src symb in ew) | 983 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 984 | FSS_ESI | 985 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 987 Figure 7: Repair FEC Payload ID Encoding Format 989 4.1.4. Additional Procedures 991 The following procedure applies: 993 o The ESI of source symbols MUST start with value 0 for the first 994 source symbol and MUST be managed sequentially. Wrapping to zero 995 happens after reaching the maximum 32-bit value. 997 5. Sliding Window RLC FEC Scheme over GF(2) for Arbitrary Packet Flows 999 This fully-specified FEC Scheme defines the Sliding Window Random 1000 Linear Codes (RLC) over GF(2) (binary case). 1002 5.1. Formats and Codes 1003 5.1.1. FEC Framework Configuration Information 1005 5.1.1.1. FEC Encoding ID 1007 o FEC Encoding ID: the value assigned to this fully specified FEC 1008 Scheme MUST be YYYY, as assigned by IANA (Section 10). 1010 When SDP is used to communicate the FFCI, this FEC Encoding ID is 1011 carried in the 'encoding-id' parameter. 1013 5.1.1.2. FEC Scheme-Specific Information 1015 All the considerations of Section 4.1.1.2 apply here. 1017 5.1.2. Explicit Source FEC Payload ID 1019 All the considerations of Section 4.1.1.2 apply here. 1021 5.1.3. Repair FEC Payload ID 1023 All the considerations of Section 4.1.1.2 apply here, with the only 1024 exception that the Repair_Key field is useless if DT = 15 (indeed, in 1025 that case all the coefficients are necessarily equal to 1 and the 1026 coefficient generation function does not use any PRNG). When DT = 15 1027 it is RECOMMENDED that the sender use value 0 for the Repair_Key 1028 field, but a receiver SHALL ignore this field. 1030 5.1.4. Additional Procedures 1032 All the considerations of Section 4.1.1.2 apply here. 1034 6. FEC Code Specification 1036 6.1. Encoding Side 1038 This section provides a high level description of a Sliding Window 1039 RLC encoder. 1041 Whenever a new FEC Repair Packet is needed, the RLC encoder instance 1042 first gathers the ew_size source symbols currently in the sliding 1043 encoding window. Then it chooses a repair key, which can be a 1044 monotonically increasing integer value, incremented for each repair 1045 symbol up to a maximum value of 65535 (as it is carried within a 1046 16-bit field) after which it loops back to 0. This repair key is 1047 communicated to the coefficient generation function (Section 3.5) in 1048 order to generate ew_size coding coefficients. Finally, the FECFRAME 1049 sender computes the repair symbol as a linear combination of the 1050 ew_size source symbols using the ew_size coding coefficients 1051 (Section 3.6). When E is small and when there is an incentive to 1052 pack several repair symbols within the same FEC Repair Packet, the 1053 appropriate number of repair symbols are computed. In that case the 1054 repair key for each of them MUST be incremented by 1, keeping the 1055 same ew_size source symbols, since only the first repair key will be 1056 carried in the Repair FEC Payload ID. The FEC Repair Packet can then 1057 be passed to the transport layer for transmission. The source versus 1058 repair FEC packet transmission order is out of scope of this document 1059 and several approaches exist that are implementation specific. 1061 Other solutions are possible to select a repair key value when a new 1062 FEC Repair Packet is needed, for instance by choosing a random 1063 integer between 0 and 65535. However, selecting the same repair key 1064 as before (which may happen in case of a random process) is only 1065 meaningful if the encoding window has changed, otherwise the same FEC 1066 Repair Packet will be generated. 1068 6.2. Decoding Side 1070 This section provides a high level description of a Sliding Window 1071 RLC decoder. 1073 A FECFRAME receiver needs to maintain a linear system whose variables 1074 are the received and lost source symbols. Upon receiving a FEC 1075 Repair Packet, a receiver first extracts all the repair symbols it 1076 contains (in case several repair symbols are packed together). For 1077 each repair symbol, when at least one of the corresponding source 1078 symbols it protects has been lost, the receiver adds an equation to 1079 the linear system (or no equation if this repair packet does not 1080 change the linear system rank). This equation of course re-uses the 1081 ew_size coding coefficients that are computed by the same coefficient 1082 generation function (Section Section 3.5), using the repair key and 1083 encoding window descriptions carried in the Repair FEC Payload ID. 1084 Whenever possible (i.e., when a sub-system covering one or more lost 1085 source symbols is of full rank), decoding is performed in order to 1086 recover lost source symbols. Each time an ADUI can be totally 1087 recovered, padding is removed (thanks to the Length field, L, of the 1088 ADUI) and the ADU is assigned to the corresponding application flow 1089 (thanks to the Flow ID field, F, of the ADUI). This ADU is finally 1090 passed to the corresponding upper application. Received FEC Source 1091 Packets, containing an ADU, MAY be passed to the application either 1092 immediately or after some time to guaranty an ordered delivery to the 1093 application. This document does not mandate any approach as this is 1094 an operational and management decision. 1096 With real-time flows, a lost ADU that is decoded after the maximum 1097 latency or an ADU received after this delay has no value to the 1098 application. This raises the question of deciding whether or not an 1099 ADU is late. This decision MAY be taken within the FECFRAME receiver 1100 (e.g., using the decoding window, see Section 3.1) or within the 1101 application (e.g., using RTP timestamps within the ADU). Deciding 1102 which option to follow and whether or not to pass all ADUs, including 1103 those assumed late, to the application are operational decisions that 1104 depend on the application and are therefore out of scope of this 1105 document. Additionally, Appendix B discusses a backward compatible 1106 optimization whereby late source symbols MAY still be used within the 1107 FECFRAME receiver in order to improve transmission robustness. 1109 7. Implementation Status 1111 Editor's notes: RFC Editor, please remove this section motivated by 1112 RFC 6982 before publishing the RFC. Thanks. 1114 An implementation of the Sliding Window RLC FEC Scheme for FECFRAME 1115 exists: 1117 o Organisation: Inria 1118 o Description: This is an implementation of the Sliding Window RLC 1119 FEC Scheme limited to GF(2^^8). It relies on a modified version 1120 of our OpenFEC (http://openfec.org) FEC code library. It is 1121 integrated in our FECFRAME software (see [fecframe-ext]). 1122 o Maturity: prototype. 1123 o Coverage: this software complies with the Sliding Window RLC FEC 1124 Scheme. 1125 o Licensing: proprietary. 1126 o Contact: vincent.roca@inria.fr 1128 8. Security Considerations 1130 The FEC Framework document [RFC6363] provides a comprehensive 1131 analysis of security considerations applicable to FEC Schemes. 1132 Therefore, the present section follows the security considerations 1133 section of [RFC6363] and only discusses specific topics. 1135 8.1. Attacks Against the Data Flow 1137 8.1.1. Access to Confidential Content 1139 The Sliding Window RLC FEC Scheme specified in this document does not 1140 change the recommendations of [RFC6363]. To summarize, if 1141 confidentiality is a concern, it is RECOMMENDED that one of the 1142 solutions mentioned in [RFC6363] is used with special considerations 1143 to the way this solution is applied (e.g., is encryption applied 1144 before or after FEC protection, within the end-system or in a 1145 middlebox), to the operational constraints (e.g., performing FEC 1146 decoding in a protected environment may be complicated or even 1147 impossible) and to the threat model. 1149 8.1.2. Content Corruption 1151 The Sliding Window RLC FEC Scheme specified in this document does not 1152 change the recommendations of [RFC6363]. To summarize, it is 1153 RECOMMENDED that one of the solutions mentioned in [RFC6363] is used 1154 on both the FEC Source and Repair Packets. 1156 8.2. Attacks Against the FEC Parameters 1158 The FEC Scheme specified in this document defines parameters that can 1159 be the basis of attacks. More specifically, the following parameters 1160 of the FFCI may be modified by an attacker who targets receivers 1161 (Section 4.1.1.2): 1163 o FEC Encoding ID: changing this parameter leads a receiver to 1164 consider a different FEC Scheme. The consequences are severe, the 1165 format of the Explicit Source FEC Payload ID and Repair FEC 1166 Payload ID of received packets will probably differ, leading to 1167 various malfunctions. Even if the original and modified FEC 1168 Schemes share the same format, FEC decoding will either fail or 1169 lead to corrupted decoded symbols. This will happen if an 1170 attacker turns value YYYY (i.e., RLC over GF(2)) to value XXXX 1171 (RLC over GF(2^^8)), an additional consequence being a higher 1172 processing overhead at the receiver. In any case, the attack 1173 results in a form of Denial of Service (DoS); 1174 o Encoding symbol length (E): setting this E parameter to a 1175 different value will confuse a receiver. If the size of a 1176 received FEC Repair Packet is no longer multiple of the modified E 1177 value, a receiver quickly detects a problem and SHOULD reject the 1178 packet. If the new E value is a sub-multiple of the original E 1179 value (e.g., half the original value), then receivers may not 1180 detect the problem immediately. For instance a receiver may think 1181 that a received FEC Repair Packet contains more repair symbols 1182 (e.g., twice as many if E is reduced by half), leading to 1183 malfunctions whose nature depends on implementation details. Here 1184 also, the attack always results in a form of DoS; 1186 It is therefore RECOMMENDED that security measures be taken to 1187 guarantee the FFCI integrity, as specified in [RFC6363]. How to 1188 achieve this depends on the way the FFCI is communicated from the 1189 sender to the receiver, which is not specified in this document. 1191 Similarly, attacks are possible against the Explicit Source FEC 1192 Payload ID and Repair FEC Payload ID. More specifically, in case of 1193 a FEC Source Packet, the following value can be modified by an 1194 attacker who targets receivers: 1196 o Encoding Symbol ID (ESI): changing the ESI leads a receiver to 1197 consider a wrong ADU, resulting in severe consequences, including 1198 corrupted content passed to the receiving application; 1200 And in case of a FEC Repair Packet: 1202 o Repair Key: changing this value leads a receiver to generate a 1203 wrong coding coefficient sequence, and therefore any source symbol 1204 decoded using the repair symbols contained in this packet will be 1205 corrupted; 1206 o DT: changing this value also leads a receiver to generate a wrong 1207 coding coefficient sequence, and therefore any source symbol 1208 decoded using the repair symbols contained in this packet will be 1209 corrupted. In addition, if the DT value is significantly 1210 increased, it will generate a higher processing overhead at a 1211 receiver. In case of very large encoding windows, this may impact 1212 the terminal performance; 1213 o NSS: changing this value leads a receiver to consider a different 1214 set of source symbols, and therefore any source symbol decoded 1215 using the repair symbols contained in this packet will be 1216 corrupted. In addition, if the NSS value is significantly 1217 increased, it will generate a higher processing overhead at a 1218 receiver, which may impact the terminal performance; 1219 o FSS_ESI: changing this value also leads a receiver to consider a 1220 different set of source symbols and therefore any source symbol 1221 decoded using the repair symbols contained in this packet will be 1222 corrupted. 1224 It is therefore RECOMMENDED that security measures are taken to 1225 guarantee the FEC Source and Repair Packets as stated in [RFC6363]. 1227 8.3. When Several Source Flows are to be Protected Together 1229 The Sliding Window RLC FEC Scheme specified in this document does not 1230 change the recommendations of [RFC6363]. 1232 8.4. Baseline Secure FEC Framework Operation 1234 The Sliding Window RLC FEC Scheme specified in this document does not 1235 change the recommendations of [RFC6363] concerning the use of the 1236 IPsec/ESP security protocol as a mandatory to implement (but not 1237 mandatory to use) security scheme. This is well suited to situations 1238 where the only insecure domain is the one over which the FEC 1239 Framework operates. 1241 8.5. Additional Security Considerations for Numerical Computations 1243 In addition to the above security considerations, inherited from 1244 [RFC6363], the present document introduces several formulae, in 1245 particular in Section 3.1.1. It is RECOMMENDED to check that the 1246 computed values stay within reasonnable bounds since numerical 1247 overflows, caused by an erroneous implementation or an erroneous 1248 input value, may lead to hazardous behaviours. However what 1249 "reasonnable bounds" means is use-case and implementation dependent 1250 and is not detailed in this document. 1252 Section 3.1.2 also mentions the possibility of "using the timestamp 1253 field of an RTP packet header" when applicable. A malicious attacker 1254 may deliberately corrupt this header field in order to trigger 1255 hazardous behaviours at a FECFRAME receiver. Protection against this 1256 type of content corruption can be addressed with the above 1257 recommendations on a baseline secure operation. In addition, it is 1258 also RECOMMENDED to check that the timestamp value be within 1259 reasonnable bounds. 1261 9. Operations and Management Considerations 1263 The FEC Framework document [RFC6363] provides a comprehensive 1264 analysis of operations and management considerations applicable to 1265 FEC Schemes. Therefore, the present section only discusses specific 1266 topics. 1268 9.1. Operational Recommendations: Finite Field GF(2) Versus GF(2^^8) 1270 The present document specifies two FEC Schemes that differ on the 1271 Finite Field used for the coding coefficients. It is expected that 1272 the RLC over GF(2^^8) FEC Scheme will be mostly used since it 1273 warrants a higher packet loss protection. In case of small encoding 1274 windows, the associated processing overhead is not an issue (e.g., we 1275 measured decoding speeds between 745 Mbps and 2.8 Gbps on an ARM 1276 Cortex-A15 embedded board in [Roca17]). Of course the CPU overhead 1277 will increase with the encoding window size, because more operations 1278 in the GF(2^^8) finite field will be needed. 1280 The RLC over GF(2) FEC Scheme offers an alternative. In that case 1281 operations symbols can be directly XOR-ed together which warrants 1282 high bitrate encoding and decoding operations, and can be an 1283 advantage with large encoding windows. However packet loss 1284 protection is significantly reduced by using this FEC Scheme. 1286 9.2. Operational Recommendations: Coding Coefficients Density Threshold 1288 In addition to the choice of the Finite Field, the two FEC Schemes 1289 define a coding coefficient density threshold (DT) parameter. This 1290 parameter enables a sender to control the code density, i.e., the 1291 proportion of coefficients that are non zero on average. With RLC 1292 over GF(2^^8), it is usually appropriate that small encoding windows 1293 be associated to a density threshold equal to 15, the maximum value, 1294 in order to warrant a high loss protection. 1296 On the opposite, with larger encoding windows, it is usually 1297 appropriate that the density threshold be reduced. With large 1298 encoding windows, an alternative can be to use RLC over GF(2) and a 1299 density threshold equal to 7 (i.e., an average density equal to 1/2) 1300 or smaller. 1302 Note that using a density threshold equal to 15 with RLC over GF(2) 1303 is equivalent to using an XOR code that compute the XOR sum of all 1304 the source symbols in the encoding window. In that case: (1) a 1305 single repair symbol can be produced for any encoding window, and (2) 1306 the repair_key parameter becomes useless (the coding coefficients 1307 generation function does not rely on the PRNG). 1309 10. IANA Considerations 1311 This document registers two values in the "FEC Framework (FECFRAME) 1312 FEC Encoding IDs" registry [RFC6363] as follows: 1314 o YYYY refers to the Sliding Window Random Linear Codes (RLC) over 1315 GF(2) FEC Scheme for Arbitrary Packet Flows, as defined in 1316 Section 5 of this document. 1317 o XXXX refers to the Sliding Window Random Linear Codes (RLC) over 1318 GF(2^^8) FEC Scheme for Arbitrary Packet Flows, as defined in 1319 Section 4 of this document. 1321 11. Acknowledgments 1323 The authors would like to thank Russ Housley, Alan DeKok, Spencer 1324 Dawkins, Gorry Fairhurst, Jonathan Detchart, Emmanuel Lochin, and 1325 Marie-Jose Montpetit for their valuable feedbacks on this document. 1327 12. References 1329 12.1. Normative References 1331 [fecframe-ext] 1332 Roca, V. and A. Begen, "Forward Error Correction (FEC) 1333 Framework Extension to Sliding Window Codes", Transport 1334 Area Working Group (TSVWG) draft-ietf-tsvwg-fecframe-ext 1335 (Work in Progress), September 2018, 1336 . 1339 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1340 Requirement Levels", BCP 14, RFC 2119, 1341 DOI 10.17487/RFC2119, March 1997, 1342 . 1344 [RFC6363] Watson, M., Begen, A., and V. Roca, "Forward Error 1345 Correction (FEC) Framework", RFC 6363, 1346 DOI 10.17487/RFC6363, October 2011, 1347 . 1349 [RFC6364] Begen, A., "Session Description Protocol Elements for the 1350 Forward Error Correction (FEC) Framework", RFC 6364, 1351 DOI 10.17487/RFC6364, October 2011, 1352 . 1354 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 1355 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 1356 May 2017, . 1358 12.2. Informative References 1360 [KR12] Rikitake, K., "TinyMT Pseudo Random Number Generator for 1361 Erlang", ACM 11th SIGPLAN Erlang Workshop (Erlang'12), 1362 September 14, 2012, Copenhagen, Denmark, DOI: 1363 http://dx.doi.org/10.1145/2364489.2364504, September 2012. 1365 [PGM13] Plank, J., Greenan, K., and E. Miller, "A Complete 1366 Treatment of Software Implementations of Finite Field 1367 Arithmetic for Erasure Coding Applications", University of 1368 Tennessee Technical Report UT-CS-13-717, 1369 http://web.eecs.utk.edu/~plank/plank/papers/ 1370 UT-CS-13-717.html, October 2013, 1371 . 1374 [RFC5510] Lacan, J., Roca, V., Peltotalo, J., and S. Peltotalo, 1375 "Reed-Solomon Forward Error Correction (FEC) Schemes", 1376 RFC 5510, DOI 10.17487/RFC5510, April 2009, 1377 . 1379 [RFC6726] Paila, T., Walsh, R., Luby, M., Roca, V., and R. Lehtonen, 1380 "FLUTE - File Delivery over Unidirectional Transport", 1381 RFC 6726, DOI 10.17487/RFC6726, November 2012, 1382 . 1384 [RFC6816] Roca, V., Cunche, M., and J. Lacan, "Simple Low-Density 1385 Parity Check (LDPC) Staircase Forward Error Correction 1386 (FEC) Scheme for FECFRAME", RFC 6816, 1387 DOI 10.17487/RFC6816, December 2012, 1388 . 1390 [RFC6865] Roca, V., Cunche, M., Lacan, J., Bouabdallah, A., and K. 1391 Matsuzono, "Simple Reed-Solomon Forward Error Correction 1392 (FEC) Scheme for FECFRAME", RFC 6865, 1393 DOI 10.17487/RFC6865, February 2013, 1394 . 1396 [RFC8406] Adamson, B., Adjih, C., Bilbao, J., Firoiu, V., Fitzek, 1397 F., Ghanem, S., Lochin, E., Masucci, A., Montpetit, M-J., 1398 Pedersen, M., Peralta, G., Roca, V., Ed., Saxena, P., and 1399 S. Sivakumar, "Taxonomy of Coding Techniques for Efficient 1400 Network Communications", RFC 8406, DOI 10.17487/RFC8406, 1401 June 2018, . 1403 [Roca16] Roca, V., Teibi, B., Burdinat, C., Tran, T., and C. 1404 Thienot, "Block or Convolutional AL-FEC Codes? A 1405 Performance Comparison for Robust Low-Latency 1406 Communications", HAL open-archive document,hal-01395937 1407 https://hal.inria.fr/hal-01395937/en/, November 2016, 1408 . 1410 [Roca17] Roca, V., Teibi, B., Burdinat, C., Tran, T., and C. 1411 Thienot, "Less Latency and Better Protection with AL-FEC 1412 Sliding Window Codes: a Robust Multimedia CBR Broadcast 1413 Case Study", 13th IEEE International Conference on 1414 Wireless and Mobile Computing, Networking and 1415 Communications (WiMob17), October 1416 2017 https://hal.inria.fr/hal-01571609v1/en/, October 1417 2017, . 1419 Appendix A. TinyMT32 Pseudo-Random Number Generator 1421 The TinyMT32 PRNG reference implementation is distributed under a BSD 1422 license by the authors and excerpts of it are reproduced in Figure 8. 1423 The differences with respect to the original source code are: 1425 o the unused parts of the original source code have been removed; 1426 o the appropriate parameter set has been added to the initialization 1427 function; 1428 o the tinymt32_rand() function has been added; 1429 o the function order has been changed; 1430 o certain internal variables have been renamed for compactness 1431 purposes. 1433 1434 /** 1435 * Tiny Mersenne Twister only 127 bit internal state 1436 * 1437 * Authors : Mutsuo Saito (Hiroshima University) 1438 * Makoto Matsumoto (University of Tokyo) 1439 * 1440 * Copyright (c) 2011, 2013 Mutsuo Saito, Makoto Matsumoto, 1441 * Hiroshima University and The University of Tokyo. 1442 * All rights reserved. 1443 * 1444 * Redistribution and use in source and binary forms, with or without 1445 * modification, are permitted provided that the following conditions 1446 * are met: 1447 * 1448 * - Redistributions of source code must retain the above copyright 1449 * notice, this list of conditions and the following disclaimer. 1450 * - Redistributions in binary form must reproduce the above 1451 * copyright notice, this list of conditions and the following 1452 * disclaimer in the documentation and/or other materials 1453 * provided with the distribution. 1454 * - Neither the name of the Hiroshima University nor the names of 1455 * its contributors may be used to endorse or promote products 1456 * derived from this software without specific prior written 1457 * permission. 1458 * 1459 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 1460 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 1461 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1462 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 1463 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 1464 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1465 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 1466 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1467 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 1468 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 1469 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 1470 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1471 * SUCH DAMAGE. 1472 */ 1474 #include 1476 /** 1477 * tinymt32 internal state vector and parameters 1478 */ 1479 typedef struct { 1480 uint32_t status[4]; 1481 uint32_t mat1; 1482 uint32_t mat2; 1483 uint32_t tmat; 1484 } tinymt32_t; 1486 static void tinymt32_next_state (tinymt32_t * s); 1487 static uint32_t tinymt32_temper (tinymt32_t * s); 1488 static double tinymt32_generate_32double (tinymt32_t * s); 1490 /** 1491 * Parameter set to use for the IETF RLC FEC Schemes specification. 1492 * Do not change. 1493 * This parameter set is the first entry of the precalculated parameter 1494 * sets in file tinymt32dc.0.1048576.txt, by Kenji Rikitake, available 1495 * at: https://github.com/jj1bdx/tinymtdc-longbatch/blob/master/ 1496 * tinymt32dc/tinymt32dc.0.1048576.txt 1497 * It is also the parameter set used: 1498 * Rikitake, K., "TinyMT Pseudo Random Number Generator for 1499 * Erlang", ACM 11th SIGPLAN Erlang Workshop (Erlang'12), 1500 * September, 2012. 1501 */ 1502 #define TINYMT32_MAT1_PARAM 0x8f7011ee 1503 #define TINYMT32_MAT2_PARAM 0xfc78ff1f 1504 #define TINYMT32_TMAT_PARAM 0x3793fdff 1506 /** 1507 * This function initializes the internal state array with a 32-bit 1508 * unsigned integer seed. 1509 * @param s pointer to tinymt internal state. 1510 * @param seed a 32-bit unsigned integer used as a seed. 1511 */ 1512 void tinymt32_init (tinymt32_t * s, uint32_t seed) 1513 { 1514 #define MIN_LOOP 8 1515 #define PRE_LOOP 8 1516 s->status[0] = seed; 1517 s->status[1] = s->mat1 = TINYMT32_MAT1_PARAM; 1518 s->status[2] = s->mat2 = TINYMT32_MAT2_PARAM; 1519 s->status[3] = s->tmat = TINYMT32_TMAT_PARAM; 1520 for (int i = 1; i < MIN_LOOP; i++) { 1521 s->status[i & 3] ^= i + UINT32_C(1812433253) 1522 * (s->status[(i - 1) & 3] 1523 ^ (s->status[(i - 1) & 3] >> 30)); 1524 } 1525 for (int i = 0; i < PRE_LOOP; i++) { 1526 tinymt32_next_state(s); 1527 } 1528 } 1530 /** 1531 * This function outputs an integer in the [0 .. maxv-1] range. 1532 * @param s pointer to tinymt internal state. 1533 * @return 32-bit unsigned integer between 0 and maxv-1 inclusive. 1534 */ 1535 uint32_t tinymt32_rand (tinymt32_t * s, uint32_t maxv) 1536 { 1537 return (uint32_t)(tinymt32_generate_32double(s) * (double)maxv); 1538 } 1540 /** 1541 * Internal tinymt32 constants and functions. 1542 * Users should not call these functions directly. 1543 */ 1544 #define TINYMT32_MEXP 127 1545 #define TINYMT32_SH0 1 1546 #define TINYMT32_SH1 10 1547 #define TINYMT32_SH8 8 1548 #define TINYMT32_MASK UINT32_C(0x7fffffff) 1549 #define TINYMT32_MUL (1.0f / 16777216.0f) 1551 /** 1552 * This function changes internal state of tinymt32. 1553 * @param s pointer to tinymt internal state. 1554 */ 1555 static void tinymt32_next_state (tinymt32_t * s) 1556 { 1557 uint32_t x; 1558 uint32_t y; 1560 y = s->status[3]; 1561 x = (s->status[0] & TINYMT32_MASK) 1562 ^ s->status[1] 1563 ^ s->status[2]; 1564 x ^= (x << TINYMT32_SH0); 1565 y ^= (y >> TINYMT32_SH0) ^ x; 1566 s->status[0] = s->status[1]; 1567 s->status[1] = s->status[2]; 1568 s->status[2] = x ^ (y << TINYMT32_SH1); 1569 s->status[3] = y; 1570 s->status[1] ^= -((int32_t)(y & 1)) & s->mat1; 1571 s->status[2] ^= -((int32_t)(y & 1)) & s->mat2; 1572 } 1574 /** 1575 * This function outputs 32-bit unsigned integer from internal state. 1576 * @param s pointer to tinymt internal state. 1577 * @return 32-bit unsigned pseudos number 1578 */ 1579 static uint32_t tinymt32_temper (tinymt32_t * s) 1580 { 1581 uint32_t t0, t1; 1582 t0 = s->status[3]; 1583 t1 = s->status[0] + (s->status[2] >> TINYMT32_SH8); 1584 t0 ^= t1; 1585 t0 ^= -((int32_t)(t1 & 1)) & s->tmat; 1586 return t0; 1587 } 1589 /** 1590 * This function outputs double precision floating point number from 1591 * internal state. The returned value has 32-bit precision. 1592 * In other words, this function makes one double precision floating 1593 * point number from one 32-bit unsigned integer. 1594 * @param s pointer to tinymt internal state. 1595 * @return floating point number r (0.0 <= r < 1.0) 1596 */ 1597 static double tinymt32_generate_32double (tinymt32_t * s) 1598 { 1599 tinymt32_next_state(s); 1600 return (double)tinymt32_temper(s) * (1.0 / 4294967296.0); 1601 } 1602 1604 Figure 8: TinyMT32 pseudo-code 1606 Appendix B. Decoding Beyond Maximum Latency Optimization 1608 This annex introduces non normative considerations. It is provided 1609 as suggestions, without any impact on interoperability. For more 1610 information see [Roca16]. 1612 With a real-time source ADU flow, it is possible to improve the 1613 decoding performance of sliding window codes without impacting 1614 maximum latency, at the cost of extra memory and CPU overhead. The 1615 optimization consists, for a FECFRAME receiver, to extend the linear 1616 system beyond the decoding window maximum size, by keeping a certain 1617 number of old source symbols whereas their associated ADUs timed-out: 1619 ls_max_size > dw_max_size 1621 Usually the following choice is a good trade-off between decoding 1622 performance and extra CPU overhead: 1624 ls_max_size = 2 * dw_max_size 1626 When the dw_max_size is very small, it may be preferable to keep a 1627 minimum ls_max_size value (e.g., LS_MIN_SIZE_DEFAULT = 40 symbols). 1628 Going below this threshold will not save a significant amount of 1629 memory nor CPU cycles. Therefore: 1631 ls_max_size = max(2 * dw_max_size, LS_MIN_SIZE_DEFAULT) 1633 Finally, it is worth noting that a good receiver, i.e., a receiver 1634 that benefits from an FEC protection significantly higher than what 1635 is required to recover from packet losses, can choose to reduce the 1636 ls_max_size. In that case lost ADUs will be recovered without 1637 relying on this optimization. 1639 ls_max_size 1640 /---------------------------------^-------------------------------\ 1642 late source symbols 1643 (pot. decoded but not delivered) dw_max_size 1644 /--------------^-----------------\ /--------------^---------------\ 1645 src0 src1 src2 src3 src4 src5 src6 src7 src8 src9 src10 src11 src12 1647 Figure 9: Relationship between parameters to decode beyond maximum 1648 latency. 1650 It means that source symbols, and therefore ADUs, may be decoded even 1651 if the added latency exceeds the maximum value permitted by the 1652 application (the "late source symbols" of Figure 9). It follows that 1653 the corresponding ADUs will not be useful to the application. 1655 However, decoding these "late symbols" significantly improves the 1656 global robustness in bad reception conditions and is therefore 1657 recommended for receivers experiencing bad communication conditions 1658 [Roca16]. In any case whether or not to use this optimization and 1659 what exact value to use for the ls_max_size parameter are local 1660 decisions made by each receiver independently, without any impact on 1661 the other receivers nor on the source. 1663 Authors' Addresses 1665 Vincent Roca 1666 INRIA 1667 Univ. Grenoble Alpes 1668 France 1670 EMail: vincent.roca@inria.fr 1672 Belkacem Teibi 1673 INRIA 1674 Univ. Grenoble Alpes 1675 France 1677 EMail: belkacem.teibi@inria.fr