idnits 2.17.1 draft-ietf-cellar-ffv1-06.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 -- The document date (October 18, 2018) is 1989 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- -- Looks like a reference, but probably isn't: '1' on line 633 -- Looks like a reference, but probably isn't: '2' on line 633 == Outdated reference: A later version (-20) exists of draft-ietf-cellar-ffv1-05 ** Obsolete normative reference: RFC 4288 (Obsoleted by RFC 6838) Summary: 1 error (**), 0 flaws (~~), 2 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 cellar M. Niedermayer 3 Internet-Draft 4 Intended status: Informational D. Rice 5 Expires: April 21, 2019 6 J. Martinez 7 October 18, 2018 9 FFV1 Video Coding Format Version 0, 1, and 3 10 draft-ietf-cellar-ffv1-06 12 Abstract 14 This document defines FFV1, a lossless intra-frame video encoding 15 format. FFV1 is designed to efficiently compress video data in a 16 variety of pixel formats. Compared to uncompressed video, FFV1 17 offers storage compression, frame fixity, and self-description, which 18 makes FFV1 useful as a preservation or intermediate video format. 20 Status of This Memo 22 This Internet-Draft is submitted in full conformance with the 23 provisions of BCP 78 and BCP 79. 25 Internet-Drafts are working documents of the Internet Engineering 26 Task Force (IETF). Note that other groups may also distribute 27 working documents as Internet-Drafts. The list of current Internet- 28 Drafts is at https://datatracker.ietf.org/drafts/current/. 30 Internet-Drafts are draft documents valid for a maximum of six months 31 and may be updated, replaced, or obsoleted by other documents at any 32 time. It is inappropriate to use Internet-Drafts as reference 33 material or to cite them other than as "work in progress." 35 This Internet-Draft will expire on April 21, 2019. 37 Copyright Notice 39 Copyright (c) 2018 IETF Trust and the persons identified as the 40 document authors. All rights reserved. 42 This document is subject to BCP 78 and the IETF Trust's Legal 43 Provisions Relating to IETF Documents 44 (https://trustee.ietf.org/license-info) in effect on the date of 45 publication of this document. Please review these documents 46 carefully, as they describe your rights and restrictions with respect 47 to this document. Code Components extracted from this document must 48 include Simplified BSD License text as described in Section 4.e of 49 the Trust Legal Provisions and are provided without warranty as 50 described in the Simplified BSD License. 52 Table of Contents 54 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 55 2. Notation and Conventions . . . . . . . . . . . . . . . . . . 4 56 2.1. Definitions . . . . . . . . . . . . . . . . . . . . . . . 5 57 2.2. Conventions . . . . . . . . . . . . . . . . . . . . . . . 5 58 2.2.1. Pseudo-code . . . . . . . . . . . . . . . . . . . . . 6 59 2.2.2. Arithmetic Operators . . . . . . . . . . . . . . . . 6 60 2.2.3. Assignment Operators . . . . . . . . . . . . . . . . 6 61 2.2.4. Comparison Operators . . . . . . . . . . . . . . . . 7 62 2.2.5. Mathematical Functions . . . . . . . . . . . . . . . 7 63 2.2.6. Order of Operation Precedence . . . . . . . . . . . . 8 64 2.2.7. Range . . . . . . . . . . . . . . . . . . . . . . . . 8 65 2.2.8. NumBytes . . . . . . . . . . . . . . . . . . . . . . 8 66 2.2.9. Bitstream Functions . . . . . . . . . . . . . . . . . 8 67 3. Sample Coding . . . . . . . . . . . . . . . . . . . . . . . . 9 68 3.1. Border . . . . . . . . . . . . . . . . . . . . . . . . . 9 69 3.2. Samples . . . . . . . . . . . . . . . . . . . . . . . . . 10 70 3.3. Median Predictor . . . . . . . . . . . . . . . . . . . . 10 71 3.4. Context . . . . . . . . . . . . . . . . . . . . . . . . . 11 72 3.5. Quantization Table Sets . . . . . . . . . . . . . . . . . 11 73 3.6. Quantization Table Set Indexes . . . . . . . . . . . . . 12 74 3.7. Color spaces . . . . . . . . . . . . . . . . . . . . . . 12 75 3.7.1. YCbCr . . . . . . . . . . . . . . . . . . . . . . . . 12 76 3.7.2. RGB . . . . . . . . . . . . . . . . . . . . . . . . . 13 77 3.8. Coding of the Sample Difference . . . . . . . . . . . . . 14 78 3.8.1. Range Coding Mode . . . . . . . . . . . . . . . . . . 14 79 3.8.2. Golomb Rice Mode . . . . . . . . . . . . . . . . . . 18 80 4. Bitstream . . . . . . . . . . . . . . . . . . . . . . . . . . 20 81 4.1. Parameters . . . . . . . . . . . . . . . . . . . . . . . 21 82 4.1.1. version . . . . . . . . . . . . . . . . . . . . . . . 22 83 4.1.2. micro_version . . . . . . . . . . . . . . . . . . . . 23 84 4.1.3. coder_type . . . . . . . . . . . . . . . . . . . . . 23 85 4.1.4. state_transition_delta . . . . . . . . . . . . . . . 24 86 4.1.5. colorspace_type . . . . . . . . . . . . . . . . . . . 24 87 4.1.6. chroma_planes . . . . . . . . . . . . . . . . . . . . 24 88 4.1.7. bits_per_raw_sample . . . . . . . . . . . . . . . . . 24 89 4.1.8. log2_h_chroma_subsample . . . . . . . . . . . . . . . 25 90 4.1.9. log2_v_chroma_subsample . . . . . . . . . . . . . . . 25 91 4.1.10. alpha_plane . . . . . . . . . . . . . . . . . . . . . 25 92 4.1.11. num_h_slices . . . . . . . . . . . . . . . . . . . . 25 93 4.1.12. num_v_slices . . . . . . . . . . . . . . . . . . . . 25 94 4.1.13. quant_table_set_count . . . . . . . . . . . . . . . . 26 95 4.1.14. states_coded . . . . . . . . . . . . . . . . . . . . 26 96 4.1.15. initial_state_delta . . . . . . . . . . . . . . . . . 26 97 4.1.16. ec . . . . . . . . . . . . . . . . . . . . . . . . . 26 98 4.1.17. intra . . . . . . . . . . . . . . . . . . . . . . . . 26 99 4.2. Configuration Record . . . . . . . . . . . . . . . . . . 27 100 4.2.1. reserved_for_future_use . . . . . . . . . . . . . . . 27 101 4.2.2. configuration_record_crc_parity . . . . . . . . . . . 27 102 4.2.3. Mapping FFV1 into Containers . . . . . . . . . . . . 28 103 4.3. Frame . . . . . . . . . . . . . . . . . . . . . . . . . . 29 104 4.4. Slice . . . . . . . . . . . . . . . . . . . . . . . . . . 29 105 4.5. Slice Header . . . . . . . . . . . . . . . . . . . . . . 30 106 4.5.1. slice_x . . . . . . . . . . . . . . . . . . . . . . . 31 107 4.5.2. slice_y . . . . . . . . . . . . . . . . . . . . . . . 31 108 4.5.3. slice_width . . . . . . . . . . . . . . . . . . . . . 31 109 4.5.4. slice_height . . . . . . . . . . . . . . . . . . . . 31 110 4.5.5. quant_table_set_index_count . . . . . . . . . . . . . 31 111 4.5.6. quant_table_set_index . . . . . . . . . . . . . . . . 31 112 4.5.7. picture_structure . . . . . . . . . . . . . . . . . . 32 113 4.5.8. sar_num . . . . . . . . . . . . . . . . . . . . . . . 32 114 4.5.9. sar_den . . . . . . . . . . . . . . . . . . . . . . . 32 115 4.6. Slice Content . . . . . . . . . . . . . . . . . . . . . . 32 116 4.6.1. primary_color_count . . . . . . . . . . . . . . . . . 33 117 4.6.2. plane_pixel_height . . . . . . . . . . . . . . . . . 33 118 4.6.3. slice_pixel_height . . . . . . . . . . . . . . . . . 33 119 4.6.4. slice_pixel_y . . . . . . . . . . . . . . . . . . . . 33 120 4.7. Line . . . . . . . . . . . . . . . . . . . . . . . . . . 33 121 4.7.1. plane_pixel_width . . . . . . . . . . . . . . . . . . 34 122 4.7.2. slice_pixel_width . . . . . . . . . . . . . . . . . . 34 123 4.7.3. slice_pixel_x . . . . . . . . . . . . . . . . . . . . 34 124 4.7.4. sample_difference . . . . . . . . . . . . . . . . . . 34 125 4.8. Slice Footer . . . . . . . . . . . . . . . . . . . . . . 34 126 4.8.1. slice_size . . . . . . . . . . . . . . . . . . . . . 35 127 4.8.2. error_status . . . . . . . . . . . . . . . . . . . . 35 128 4.8.3. slice_crc_parity . . . . . . . . . . . . . . . . . . 35 129 4.9. Quantization Table Set . . . . . . . . . . . . . . . . . 35 130 4.9.1. quant_tables . . . . . . . . . . . . . . . . . . . . 36 131 4.9.2. context_count . . . . . . . . . . . . . . . . . . . . 37 132 5. Restrictions . . . . . . . . . . . . . . . . . . . . . . . . 37 133 6. Security Considerations . . . . . . . . . . . . . . . . . . . 37 134 7. Media Type Definition . . . . . . . . . . . . . . . . . . . . 38 135 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 40 136 9. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . 40 137 9.1. Decoder implementation suggestions . . . . . . . . . . . 40 138 9.1.1. Multi-threading Support and Independence of Slices . 40 139 10. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 40 140 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 40 141 11.1. Normative References . . . . . . . . . . . . . . . . . . 40 142 11.2. Informative References . . . . . . . . . . . . . . . . . 41 143 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 43 145 1. Introduction 147 This document describes FFV1, a lossless video encoding format. The 148 design of FFV1 considers the storage of image characteristics, data 149 fixity, and the optimized use of encoding time and storage 150 requirements. FFV1 is designed to support a wide range of lossless 151 video applications such as long-term audiovisual preservation, 152 scientific imaging, screen recording, and other video encoding 153 scenarios that seek to avoid the generational loss of lossy video 154 encodings. 156 This document defines a version 0, 1, and 3 of FFV1. The 157 distinctions of the versions are provided throughout the document, 158 but in summary: 160 o Version 0 of FFV1 was the original implementation of FFV1 and has 161 been in non-experimental use since April 14, 2006 [FFV1_V0]. 163 o Version 1 of FFV1 adds support of more video bit depths and has 164 been in use since April 24, 2009 [FFV1_V1]. 166 o Version 2 of FFV1 only existed in experimental form and is not 167 described by this document, but is available as a LyX file at 168 . 171 o Version 3 of FFV1 adds several features such as increased 172 description of the characteristics of the encoding images and 173 embedded CRC data to support fixity verification of the encoding. 174 Version 3 has been in non-experimental use since August 17, 2013 175 [FFV1_V3]. 177 The latest version of this document is available at 178 180 This document assumes familiarity with mathematical and coding 181 concepts such as Range coding [range-coding] and YCbCr color spaces 182 [YCbCr]. 184 2. Notation and Conventions 186 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 187 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 188 document are to be interpreted as described in [RFC2119]. 190 2.1. Definitions 192 "Container": Format that encapsulates "Frames" (see Section 4.3) and 193 (when required) a "Configuration Record" into a bitstream. 195 "Sample": The smallest addressable representation of a color 196 component or a luma component in a "Frame". Examples of "Sample" are 197 Luma, Blue Chrominance, Red Chrominance, Alpha, Red, Green, and Blue. 199 "Plane": A discrete component of a static image comprised of 200 "Samples" that represent a specific quantification of "Samples" of 201 that image. 203 "Pixel": The smallest addressable representation of a color in a 204 "Frame". It is composed of 1 or more "Samples". 206 "ESC": An ESCape symbol to indicate that the symbol to be stored is 207 too large for normal storage and that an alternate storage method. 209 "MSB": Most Significant Bit, the bit that can cause the largest 210 change in magnitude of the symbol. 212 "RCT": Reversible Color Transform, a near linear, exactly reversible 213 integer transform that converts between RGB and YCbCr representations 214 of a "Pixel". 216 "VLC": Variable Length Code, a code that maps source symbols to a 217 variable number of bits. 219 "RGB": A reference to the method of storing the value of a "Pixel" by 220 using three numeric values that represent Red, Green, and Blue. 222 "YCbCr": A reference to the method of storing the value of a "Pixel" 223 by using three numeric values that represent the luma of the "Pixel" 224 (Y) and the chrominance of the "Pixel" (Cb and Cr). YCbCr word is 225 used for historical reasons and currently references any color space 226 relying on 1 luma "Sample" and 2 chrominance "Samples" e.g. YCbCr, 227 YCgCo or ICtCp. Exact meaning of the three numeric values is 228 unspecified. 230 "TBA": To Be Announced. Used in reference to the development of 231 future iterations of the FFV1 specification. 233 2.2. Conventions 234 2.2.1. Pseudo-code 236 The FFV1 bitstream is described in this document using pseudo-code. 237 Note that the pseudo-code is used for clarity in order to illustrate 238 the structure of FFV1 and not intended to specify any particular 239 implementation. The pseudo-code used is based upon the C programming 240 language [ISO.9899.1990] and uses its "if/else", "while" and "for" 241 functions as well as functions defined within this document. 243 2.2.2. Arithmetic Operators 245 Note: the operators and the order of precedence are the same as used 246 in the C programming language [ISO.9899.1990]. 248 "a + b" means a plus b. 250 "a - b" means a minus b. 252 "-a" means negation of a. 254 "a * b" means a multiplied by b. 256 "a / b" means a divided by b. 258 "a & b" means bit-wise "and" of a and b. 260 "a | b" means bit-wise "or" of a and b. 262 "a >> b" means arithmetic right shift of two's complement integer 263 representation of a by b binary digits. 265 "a << b" means arithmetic left shift of two's complement integer 266 representation of a by b binary digits. 268 2.2.3. Assignment Operators 270 "a = b" means a is assigned b. 272 "a++" is equivalent to a is assigned a + 1. 274 "a--" is equivalent to a is assigned a - 1. 276 "a += b" is equivalent to a is assigned a + b. 278 "a -= b" is equivalent to a is assigned a - b. 280 "a *= b" is equivalent to a is assigned a * b. 282 2.2.4. Comparison Operators 284 "a > b" means a is greater than b. 286 "a >= b" means a is greater than or equal to b. 288 "a < b" means a is less than b. 290 "a <= b" means a is less than or equal b. 292 "a == b" means a is equal to b. 294 "a != b" means a is not equal to b. 296 "a && b" means Boolean logical "and" of a and b. 298 "a || b" means Boolean logical "or" of a and b. 300 "!a" means Boolean logical "not" of a. 302 "a ? b : c" if a is true, then b, otherwise c. 304 2.2.5. Mathematical Functions 306 floor(a) the largest integer less than or equal to a 308 ceil(a) the smallest integer greater than or equal to a 310 sign(a) extracts the sign of a number, i.e. if a < 0 then -1, else if 311 a > 0 then 1, else 0 313 abs(a) the absolute value of a, i.e. abs(a) = sign(a)*a 315 log2(a) the base-two logarithm of a 317 min(a,b) the smallest of two values a and b 319 max(a,b) the largest of two values a and b 321 median(a,b,c) the numerical middle value in a data set of a, b, and 322 c, i.e. a+b+c-min(a,b,c)-max(a,b,c) 324 a_{b} the b-th value of a sequence of a 326 a_{b,c} the 'b,c'-th value of a sequence of a 328 2.2.6. Order of Operation Precedence 330 When order of precedence is not indicated explicitly by use of 331 parentheses, operations are evaluated in the following order (from 332 top to bottom, operations of same precedence being evaluated from 333 left to right). This order of operations is based on the order of 334 operations used in Standard C. 336 a++, a-- 337 !a, -a 338 a * b, a / b, a % b 339 a + b, a - b 340 a << b, a >> b 341 a < b, a <= b, a > b, a >= b 342 a == b, a != b 343 a & b 344 a | b 345 a && b 346 a || b 347 a ? b : c 348 a = b, a += b, a -= b, a *= b 350 2.2.7. Range 352 "a...b" means any value starting from a to b, inclusive. 354 2.2.8. NumBytes 356 "NumBytes" is a non-negative integer that expresses the size in 8-bit 357 octets of particular FFV1 "Configuration Record" or "Frame". FFV1 358 relies on its "Container" to store the "NumBytes" values, see 359 Section 4.2.3. 361 2.2.9. Bitstream Functions 363 2.2.9.1. remaining_bits_in_bitstream 365 "remaining_bits_in_bitstream( )" means the count of remaining bits 366 after the pointer in that "Configuration Record" or "Frame". It is 367 computed from the "NumBytes" value multiplied by 8 minus the count of 368 bits of that "Configuration Record" or "Frame" already read by the 369 bitstream parser. 371 2.2.9.2. byte_aligned 373 "byte_aligned( )" is true if "remaining_bits_in_bitstream( NumBytes 374 )" is a multiple of 8, otherwise false. 376 2.2.9.3. get_bits 378 "get_bits( i )" is the action to read the next "i" bits in the 379 bitstream, from most significant bit to least significant bit, and to 380 return the corresponding value. The pointer is increased by "i". 382 3. Sample Coding 384 For each "Slice" (as described in Section 4.4) of a "Frame", the 385 "Planes", "Lines", and "Samples" are coded in an order determined by 386 the "Color Space" (see Section 3.7). Each "Sample" is predicted by 387 the median predictor as described in Section 3.3 from other "Samples" 388 within the same "Plane" and the difference is stored using the method 389 described in Section 3.8. 391 3.1. Border 393 A border is assumed for each coded "Slice" for the purpose of the 394 median predictor and context according to the following rules: 396 o one column of "Samples" to the left of the coded slice is assumed 397 as identical to the "Samples" of the leftmost column of the coded 398 slice shifted down by one row. The value of the topmost "Sample" 399 of the column of "Samples" to the left of the coded slice is 400 assumed to be "0" 402 o one column of "Samples" to the right of the coded slice is assumed 403 as identical to the "Samples" of the rightmost column of the coded 404 slice 406 o an additional column of "Samples" to the left of the coded slice 407 and two rows of "Samples" above the coded slice are assumed to be 408 "0" 410 The following table depicts a slice of 9 "Samples" 411 "a,b,c,d,e,f,g,h,i" in a 3x3 arrangement along with its assumed 412 border. 414 +---+---+---+---+---+---+---+---+ 415 | 0 | 0 | | 0 | 0 | 0 | | 0 | 416 +---+---+---+---+---+---+---+---+ 417 | 0 | 0 | | 0 | 0 | 0 | | 0 | 418 +---+---+---+---+---+---+---+---+ 419 | | | | | | | | | 420 +---+---+---+---+---+---+---+---+ 421 | 0 | 0 | | a | b | c | | c | 422 +---+---+---+---+---+---+---+---+ 423 | 0 | a | | d | e | f | | f | 424 +---+---+---+---+---+---+---+---+ 425 | 0 | d | | g | h | i | | i | 426 +---+---+---+---+---+---+---+---+ 428 3.2. Samples 430 Relative to any "Sample" "X", six other relatively positioned 431 "Samples" from the coded "Samples" and presumed border are identified 432 according to the labels used in the following diagram. The labels 433 for these relatively positioned "Samples" are used within the median 434 predictor and context. 436 +---+---+---+---+ 437 | | | T | | 438 +---+---+---+---+ 439 | |tl | t |tr | 440 +---+---+---+---+ 441 | L | l | X | | 442 +---+---+---+---+ 444 The labels for these relative "Samples" are made of the first letters 445 of the words Top, Left and Right. 447 3.3. Median Predictor 449 The prediction for any "Sample" value at position "X" may be computed 450 based upon the relative neighboring values of "l", "t", and "tl" via 451 this equation: 453 "median(l, t, l + t - tl)". 455 Note, this prediction template is also used in [ISO.14495-1.1999] and 456 [HuffYUV]. 458 Exception for the median predictor: if "colorspace_type == 0 && 459 bits_per_raw_sample == 16 && ( coder_type == 1 || coder_type == 2 )", 460 the following median predictor MUST be used: 462 "median(left16s, top16s, left16s + top16s - diag16s)" 464 where: 466 left16s = l >= 32768 ? ( l - 65536 ) : l 467 top16s = t >= 32768 ? ( t - 65536 ) : t 468 diag16s = tl >= 32768 ? ( tl - 65536 ) : tl 470 Background: a two's complement signed 16-bit signed integer was used 471 for storing "Sample" values in all known implementations of FFV1 472 bitstream. So in some circumstances, the most significant bit was 473 wrongly interpreted (used as a sign bit instead of the 16th bit of an 474 unsigned integer). Note that when the issue is discovered, the only 475 configuration of all known implementations being impacted is 16-bit 476 YCbCr with no Pixel transformation with Range Coder coder, as other 477 potentially impacted configurations (e.g. 15/16-bit JPEG2000-RCT with 478 Range Coder coder, or 16-bit content with Golomb Rice coder) were 479 implemented nowhere [ISO.15444-1.2016]. In the meanwhile, 16-bit 480 JPEG2000-RCT with Range Coder coder was implemented without this 481 issue in one implementation and validated by one conformance checker. 482 It is expected (to be confirmed) to remove this exception for the 483 median predictor in the next version of the FFV1 bitstream. 485 3.4. Context 487 Relative to any "Sample" "X", the Quantized Sample Differences "L-l", 488 "l-tl", "tl-t", "T-t", and "t-tr" are used as context: 490 context = Q_{0}[l - tl] + 491 Q_{1}[tl - t] + 492 Q_{2}[t - tr] + 493 Q_{3}[L - l] + 494 Q_{4}[T - t] 496 If "context >= 0" then "context" is used and the difference between 497 the "Sample" and its predicted value is encoded as is, else 498 "-context" is used and the difference between the "Sample" and its 499 predicted value is encoded with a flipped sign. 501 3.5. Quantization Table Sets 503 The FFV1 bitstream contains 1 or more Quantization Table Sets. Each 504 Quantization Table Set contains exactly 5 Quantization Tables with 505 each Quantization Table corresponding to 1 of the 5 Quantized Sample 506 Differences. For each Quantization Table, both the number of 507 quantization steps and their distribution are stored in the FFV1 508 bitstream; each Quantization Table has exactly 256 entries, and the 8 509 least significant bits of the Quantized Sample Difference are used as 510 index: 512 Q_{j}[k] = quant_tables[i][j][k&255] 514 In this formula, "i" is the Quantization Table Set index, "j" is the 515 Quantized Table index, "k" the Quantized Sample Difference. 517 3.6. Quantization Table Set Indexes 519 For each "Plane" of each slice, a Quantization Table Set is selected 520 from an index: 522 o For Y "Plane", "quant_table_set_index [ 0 ]" index is used 524 o For Cb and Cr "Planes", "quant_table_set_index [ 1 ]" index is 525 used 527 o For Alpha "Plane", "quant_table_set_index [ (version <= 3 || 528 chroma_planes) ? 2 : 1 ]" index is used 530 Background: in first implementations of FFV1 bitstream, the index for 531 Cb and Cr "Planes" was stored even if it is not used (chroma_planes 532 set to 0), this index is kept for version <= 3 in order to keep 533 compatibility with FFV1 bitstreams in the wild. 535 3.7. Color spaces 537 FFV1 supports two color spaces: YCbCr and RGB. Both color spaces 538 allow an optional Alpha "Plane" that can be used to code transparency 539 data. 541 The FFV1 bitstream interleaves data in an order determined by the 542 color space. In YCbCr for each "Plane", each "Line" is coded from 543 top to bottom and for each "Line", each "Sample" is coded from left 544 to right. In JPEG2000-RCT for each "Line" from top to bottom, each 545 "Plane" is coded and for each "Plane", each "Sample" is encoded from 546 left to right. 548 3.7.1. YCbCr 550 In YCbCr color space, the Cb and Cr "Planes" are optional, but if 551 used then MUST be used together. Omitting the Cb and Cr "Planes" 552 codes the frames in grayscale without color data. An FFV1 "Frame" 553 using YCbCr MUST use one of the following arrangements: 555 o Y 556 o Y, Alpha 558 o Y, Cb, Cr 560 o Y, Cb, Cr, Alpha 562 The Y "Plane" MUST be coded first. If the Cb and Cr "Planes" are 563 used then they MUST be coded after the Y "Plane". If an Alpha 564 (transparency) "Plane" is used, then it MUST be coded last. 566 3.7.2. RGB 568 JPEG2000-RCT is a Reversible Color Transform that codes RGB (red, 569 green, blue) "Planes" losslessly in a modified YCbCr color space 570 [ISO.15444-1.2016]. Reversible Pixel transformations between YCbCr 571 and RGB use the following formulae. 573 Cb=b-g 575 Cr=r-g 577 Y=g+(Cb+Cr)>>2 579 g=Y-(Cb+Cr)>>2 581 r=Cr+g 583 b=Cb+g 585 Exception for the JPEG2000-RCT conversion: if bits_per_raw_sample is 586 between 9 and 15 inclusive and alpha_plane is 0, the following 587 formulae for reversible conversions between YCbCr and RGB MUST be 588 used instead of the ones above: 590 Cb=g-b 592 Cr=r-b 594 Y=b+(Cb+Cr)>>2 596 b=Y-(Cb+Cr)>>2 598 r=Cr+b 600 g=Cb+b 602 Background: At the time of this writing, in all known implementations 603 of FFV1 bitstream, when bits_per_raw_sample was between 9 and 15 604 inclusive and alpha_plane is 0, GBR "Planes" were used as BGR 605 "Planes" during both encoding and decoding. In the meanwhile, 16-bit 606 JPEG2000-RCT was implemented without this issue in one implementation 607 and validated by one conformance checker. Methods to address this 608 exception for the transform are under consideration for the next 609 version of the FFV1 bitstream. 611 When FFV1 uses the JPEG2000-RCT, the horizontal "Lines" are 612 interleaved to improve caching efficiency since it is most likely 613 that the JPEG2000-RCT will immediately be converted to RGB during 614 decoding. The interleaved coding order is also Y, then Cb, then Cr, 615 and then if used Alpha. 617 As an example, a "Frame" that is two "Pixels" wide and two "Pixels" 618 high, could be comprised of the following structure: 620 +------------------------+------------------------+ 621 | Pixel[1,1] | Pixel[2,1] | 622 | Y[1,1] Cb[1,1] Cr[1,1] | Y[2,1] Cb[2,1] Cr[2,1] | 623 +------------------------+------------------------+ 624 | Pixel[1,2] | Pixel[2,2] | 625 | Y[1,2] Cb[1,2] Cr[1,2] | Y[2,2] Cb[2,2] Cr[2,2] | 626 +------------------------+------------------------+ 628 In JPEG2000-RCT, the coding order would be left to right and then top 629 to bottom, with values interleaved by "Lines" and stored in this 630 order: 632 Y[1,1] Y[2,1] Cb[1,1] Cb[2,1] Cr[1,1] Cr[2,1] Y[1,2] Y[2,2] Cb[1,2] 633 Cb[2,2] Cr[1,2] Cr[2,2] 635 3.8. Coding of the Sample Difference 637 Instead of coding the n+1 bits of the Sample Difference with Huffman 638 or Range coding (or n+2 bits, in the case of JPEG2000-RCT), only the 639 n (or n+1, in the case of JPEG2000-RCT) least significant bits are 640 used, since this is sufficient to recover the original "Sample". In 641 the equation below, the term "bits" represents bits_per_raw_sample+1 642 for JPEG2000-RCT or bits_per_raw_sample otherwise: 644 coder_input = 645 [(sample_difference + 2^(bits-1)) & (2^bits - 1)] - 2^(bits-1) 647 3.8.1. Range Coding Mode 649 Early experimental versions of FFV1 used the CABAC Arithmetic coder 650 from H.264 as defined in [ISO.14496-10.2014] but due to the uncertain 651 patent/royalty situation, as well as its slightly worse performance, 652 CABAC was replaced by a Range coder based on an algorithm defined by 653 G. Nigel and N. Martin in 1979 [range-coding]. 655 3.8.1.1. Range Binary Values 657 To encode binary digits efficiently a Range coder is used. "C_{i}" 658 is the i-th Context. "B_{i}" is the i-th byte of the bytestream. 659 "b_{i}" is the i-th Range coded binary value, "S_{0,i}" is the i-th 660 initial state, which is 128. The length of the bytestream encoding n 661 binary symbols is "j_{n}" bytes. 663 r_{i} = floor( ( R_{i} * S_{i,C_{i}} ) / 2^8 ) 665 S_{i+1,C_{i}} = zero_state_{S_{i,C_{i}}} XOR 666 l_i = L_i XOR 667 t_i = R_i - r_i <== 668 b_i = 0 <==> 669 L_i < R_i - r_i 671 S_{i+1,C_{i}} = one_state_{S_{i,C_{i}}} XOR 672 l_i = L_i - R_i + r_i XOR 673 t_i = r_i <== 674 b_i = 1 <==> 675 L_i >= R_i - r_i 677 S_{i+1,k} = S_{i,k} <== C_i != k 679 R_{i+1} = 2^8 * t_{i} XOR 680 L_{i+1} = 2^8 * l_{i} + B_{j_{i}} XOR 681 j_{i+1} = j_{i} + 1 <== 682 t_{i} < 2^8 684 R_{i+1} = t_{i} XOR 685 L_{i+1} = l_{i} XOR 686 j_{i+1} = j_{i} <== 687 t_{i} >= 2^8 689 R_{0} = 65280 691 L_{0} = 2^8 * B_{0} + B_{1} 693 j_{0} = 2 695 3.8.1.2. Range Non Binary Values 697 To encode scalar integers, it would be possible to encode each bit 698 separately and use the past bits as context. However that would mean 699 255 contexts per 8-bit symbol that is not only a waste of memory but 700 also requires more past data to reach a reasonably good estimate of 701 the probabilities. Alternatively assuming a Laplacian distribution 702 and only dealing with its variance and mean (as in Huffman coding) 703 would also be possible, however, for maximum flexibility and 704 simplicity, the chosen method uses a single symbol to encode if a 705 number is 0 and if not encodes the number using its exponent, 706 mantissa and sign. The exact contexts used are best described by the 707 following code, followed by some comments. 709 pseudo-code | type 710 --------------------------------------------------------------|----- 711 void put_symbol(RangeCoder *c, uint8_t *state, int v, int \ | 712 is_signed) { | 713 int i; | 714 put_rac(c, state+0, !v); | 715 if (v) { | 716 int a= abs(v); | 717 int e= log2(a); | 718 | 719 for (i=0; i=0; i--) | 724 put_rac(c, state+22+min(i,9), (a>>i)&1); //22..31 | 725 | 726 if (is_signed) | 727 put_rac(c, state+11 + min(e, 10), v < 0); //11..21| 728 } | 729 } | 731 3.8.1.3. Initial Values for the Context Model 733 At keyframes all Range coder state variables are set to their initial 734 state. 736 3.8.1.4. State Transition Table 738 one_state_{i} = 739 default_state_transition_{i} + state_transition_delta_{i} 741 zero_state_{i} = 256 - one_state_{256-i} 743 3.8.1.5. default_state_transition 744 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 746 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 748 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 750 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 752 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 754 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99,100,101,102,103, 756 104,105,106,107,108,109,110,111,112,113,114,114,115,116,117,118, 758 119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,133, 760 134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149, 762 150,151,152,152,153,154,155,156,157,158,159,160,161,162,163,164, 764 165,166,167,168,169,170,171,171,172,173,174,175,176,177,178,179, 766 180,181,182,183,184,185,186,187,188,189,190,190,191,192,194,194, 768 195,196,197,198,199,200,201,202,202,204,205,206,207,208,209,209, 770 210,211,212,213,215,215,216,217,218,219,220,220,222,223,224,225, 772 226,227,227,229,229,230,231,232,234,234,235,236,237,238,239,240, 774 241,242,243,244,245,246,247,248,248, 0, 0, 0, 0, 0, 0, 0, 776 3.8.1.6. Alternative State Transition Table 778 The alternative state transition table has been built using iterative 779 minimization of frame sizes and generally performs better than the 780 default. To use it, the coder_type (see Section 4.1.3) MUST be set 781 to 2 and the difference to the default MUST be stored in the 782 "Parameters", see Section 4.1. The reference implementation of FFV1 783 in FFmpeg uses this table by default at the time of this writing when 784 Range coding is used. 786 0, 10, 10, 10, 10, 16, 16, 16, 28, 16, 16, 29, 42, 49, 20, 49, 788 59, 25, 26, 26, 27, 31, 33, 33, 33, 34, 34, 37, 67, 38, 39, 39, 790 40, 40, 41, 79, 43, 44, 45, 45, 48, 48, 64, 50, 51, 52, 88, 52, 792 53, 74, 55, 57, 58, 58, 74, 60,101, 61, 62, 84, 66, 66, 68, 69, 794 87, 82, 71, 97, 73, 73, 82, 75,111, 77, 94, 78, 87, 81, 83, 97, 796 85, 83, 94, 86, 99, 89, 90, 99,111, 92, 93,134, 95, 98,105, 98, 798 105,110,102,108,102,118,103,106,106,113,109,112,114,112,116,125, 800 115,116,117,117,126,119,125,121,121,123,145,124,126,131,127,129, 802 165,130,132,138,133,135,145,136,137,139,146,141,143,142,144,148, 804 147,155,151,149,151,150,152,157,153,154,156,168,158,162,161,160, 806 172,163,169,164,166,184,167,170,177,174,171,173,182,176,180,178, 808 175,189,179,181,186,183,192,185,200,187,191,188,190,197,193,196, 810 197,194,195,196,198,202,199,201,210,203,207,204,205,206,208,214, 812 209,211,221,212,213,215,224,216,217,218,219,220,222,228,223,225, 814 226,224,227,229,240,230,231,232,233,234,235,236,238,239,237,242, 816 241,243,242,244,245,246,247,248,249,250,251,252,252,253,254,255, 818 3.8.2. Golomb Rice Mode 820 This coding mode uses Golomb Rice codes. The VLC is split into 2 821 parts, the prefix stores the most significant bits and the suffix 822 stores the k least significant bits or stores the whole number in the 823 ESC case. The end of the bitstream of the "Frame" is filled with 824 0-bits until that the bitstream contains a multiple of 8 bits. 826 3.8.2.1. Prefix 827 +----------------+-------+ 828 | bits | value | 829 +----------------+-------+ 830 | 1 | 0 | 831 | 01 | 1 | 832 | ... | ... | 833 | 0000 0000 0001 | 11 | 834 | 0000 0000 0000 | ESC | 835 +----------------+-------+ 837 3.8.2.2. Suffix 839 +-------+-----------------------------------------------------------+ 840 | non | the k least significant bits MSB first | 841 | ESC | | 842 | ESC | the value - 11, in MSB first order, ESC may only be used | 843 | | if the value cannot be coded as non ESC | 844 +-------+-----------------------------------------------------------+ 846 3.8.2.3. Examples 848 +-----+-------------------------+-------+ 849 | k | bits | value | 850 +-----+-------------------------+-------+ 851 | 0 | "1" | 0 | 852 | 0 | "001" | 2 | 853 | 2 | "1 00" | 0 | 854 | 2 | "1 10" | 2 | 855 | 2 | "01 01" | 5 | 856 | any | "000000000000 10000000" | 139 | 857 +-----+-------------------------+-------+ 859 3.8.2.4. Run Mode 861 Run mode is entered when the context is 0 and left as soon as a non-0 862 difference is found. The level is identical to the predicted one. 863 The run and the first different level are coded. 865 3.8.2.5. Run Length Coding 867 The run value is encoded in 2 parts, the prefix part stores the more 868 significant part of the run as well as adjusting the run_index that 869 determines the number of bits in the less significant part of the 870 run. The 2nd part of the value stores the less significant part of 871 the run as it is. The run_index is reset for each "Plane" and slice 872 to 0. 874 pseudo-code | type 875 --------------------------------------------------------------|----- 876 log2_run[41]={ | 877 0, 0, 0, 0, 1, 1, 1, 1, | 878 2, 2, 2, 2, 3, 3, 3, 3, | 879 4, 4, 5, 5, 6, 6, 7, 7, | 880 8, 9,10,11,12,13,14,15, | 881 16,17,18,19,20,21,22,23, | 882 24, | 883 }; | 884 | 885 if (run_count == 0 && run_mode == 1) { | 886 if (get_bits(1)) { | 887 run_count = 1 << log2_run[run_index]; | 888 if (x + run_count <= w) | 889 run_index++; | 890 } else { | 891 if (log2_run[run_index]) | 892 run_count = get_bits(log2_run[run_index]); | 893 else | 894 run_count = 0; | 895 if (run_index) | 896 run_index--; | 897 run_mode = 2; | 898 } | 899 } | 901 The log2_run function is also used within [ISO.14495-1.1999]. 903 3.8.2.6. Level Coding 905 Level coding is identical to the normal difference coding with the 906 exception that the 0 value is removed as it cannot occur: 908 if (diff>0) diff--; 909 encode(diff); 911 Note, this is different from JPEG-LS, which doesn't use prediction in 912 run mode and uses a different encoding and context model for the last 913 difference On a small set of test "Samples" the use of prediction 914 slightly improved the compression rate. 916 4. Bitstream 918 An FFV1 bitstream is composed of a series of 1 or more "Frames" and 919 (when required) a "Configuration Record". 921 Within the following sub-sections, pseudo-code is used to explain the 922 structure of each FFV1 bitstream component, as described in 923 Section 2.2.1. The following table lists symbols used to annotate 924 that pseudo-code in order to define the storage of the data 925 referenced in that line of pseudo-code. 927 +--------+----------------------------------------------------------+ 928 | Symbol | Definition | 929 +--------+----------------------------------------------------------+ 930 | u(n) | unsigned big endian integer using n bits | 931 | sg | Golomb Rice coded signed scalar symbol coded with the | 932 | | method described in Section 3.8.2 | 933 | br | Range coded Boolean (1-bit) symbol with the method | 934 | | described in Section 3.8.1.1 | 935 | ur | Range coded unsigned scalar symbol coded with the method | 936 | | described in Section 3.8.1.2 | 937 | sr | Range coded signed scalar symbol coded with the method | 938 | | described in Section 3.8.1.2 | 939 +--------+----------------------------------------------------------+ 941 The same context that is initialized to 128 is used for all fields in 942 the header. 944 The following MUST be provided by external means during 945 initialization of the decoder: 947 "frame_pixel_width" is defined as "Frame" width in "Pixels". 949 "frame_pixel_height" is defined as "Frame" height in "Pixels". 951 Default values at the decoder initialization phase: 953 "ConfigurationRecordIsPresent" is set to 0. 955 4.1. Parameters 957 The "Parameters" section contains significant characteristics about 958 the decoding configuration used for all instances of "Frame" (in FFV1 959 version 0 and 1) or the whole FFV1 bitstream (other versions), 960 including the stream version, color configuration, and quantization 961 tables. The pseudo-code below describes the contents of the 962 bitstream. 964 pseudo-code | type 965 --------------------------------------------------------------|----- 966 Parameters( ) { | 967 version | ur 968 if (version >= 3) | 969 micro_version | ur 970 coder_type | ur 971 if (coder_type > 1) | 972 for (i = 1; i < 256; i++) | 973 state_transition_delta[ i ] | sr 974 colorspace_type | ur 975 if (version >= 1) | 976 bits_per_raw_sample | ur 977 chroma_planes | br 978 log2_h_chroma_subsample | ur 979 log2_v_chroma_subsample | ur 980 alpha_plane | br 981 if (version >= 3) { | 982 num_h_slices - 1 | ur 983 num_v_slices - 1 | ur 984 quant_table_set_count | ur 985 } | 986 for( i = 0; i < quant_table_set_count; i++ ) | 987 QuantizationTableSet( i ) | 988 if (version >= 3) { | 989 for( i = 0; i < quant_table_set_count; i++ ) { | 990 states_coded | br 991 if (states_coded) | 992 for( j = 0; j < context_count[ i ]; j++ ) | 993 for( k = 0; k < CONTEXT_SIZE; k++ ) | 994 initial_state_delta[ i ][ j ][ k ] | sr 995 } | 996 ec | ur 997 intra | ur 998 } | 999 } | 1001 4.1.1. version 1003 "version" specifies the version of the FFV1 bitstream. 1004 Each version is incompatible with others versions: decoders SHOULD 1005 reject a file due to unknown version. 1006 Decoders SHOULD reject a file with version <= 1 && 1007 ConfigurationRecordIsPresent == 1. 1008 Decoders SHOULD reject a file with version >= 3 && 1009 ConfigurationRecordIsPresent == 0. 1011 +-------+-------------------------+ 1012 | value | version | 1013 +-------+-------------------------+ 1014 | 0 | FFV1 version 0 | 1015 | 1 | FFV1 version 1 | 1016 | 2 | reserved* | 1017 | 3 | FFV1 version 3 | 1018 | Other | reserved for future use | 1019 +-------+-------------------------+ 1021 * Version 2 was never enabled in the encoder thus version 2 files 1022 SHOULD NOT exist, and this document does not describe them to keep 1023 the text simpler. 1025 4.1.2. micro_version 1027 "micro_version" specifies the micro-version of the FFV1 bitstream. 1028 After a version is considered stable (a micro-version value is 1029 assigned to be the first stable variant of a specific version), each 1030 new micro-version after this first stable variant is compatible with 1031 the previous micro-version: decoders SHOULD NOT reject a file due to 1032 an unknown micro-version equal or above the micro-version considered 1033 as stable. 1035 Meaning of micro_version for version 3: 1037 +-------+-------------------------+ 1038 | value | micro_version | 1039 +-------+-------------------------+ 1040 | 0...3 | reserved* | 1041 | 4 | first stable variant | 1042 | Other | reserved for future use | 1043 +-------+-------------------------+ 1045 * development versions may be incompatible with the stable variants. 1047 4.1.3. coder_type 1049 "coder_type" specifies the coder used. 1051 +-------+-------------------------------------------------+ 1052 | value | coder used | 1053 +-------+-------------------------------------------------+ 1054 | 0 | Golomb Rice | 1055 | 1 | Range Coder with default state transition table | 1056 | 2 | Range Coder with custom state transition table | 1057 | Other | reserved for future use | 1058 +-------+-------------------------------------------------+ 1060 4.1.4. state_transition_delta 1062 "state_transition_delta" specifies the Range coder custom state 1063 transition table. 1064 If state_transition_delta is not present in the FFV1 bitstream, all 1065 Range coder custom state transition table elements are assumed to be 1066 0. 1068 4.1.5. colorspace_type 1070 "colorspace_type" specifies the color space losslessly encoded, the 1071 Pixel transformation used by the encoder, as well as interleave 1072 method. 1074 +-------+---------------------+------------------+------------------+ 1075 | value | color space | transformation | interleave | 1076 | | losslessly encoded | | method | 1077 +-------+---------------------+------------------+------------------+ 1078 | 0 | YCbCr | No Pixel | "Plane" then | 1079 | | | transformation | "Line" | 1080 | 1 | RGB | JPEG2000-RCT | "Line" then | 1081 | | | | "Plane" | 1082 | Other | reserved for future | reserved for | reserved for | 1083 | | use | future use | future use | 1084 +-------+---------------------+------------------+------------------+ 1086 Restrictions: 1087 If "colorspace_type" is 1, then "chroma_planes" MUST be 1, 1088 "log2_h_chroma_subsample" MUST be 0, and "log2_v_chroma_subsample" 1089 MUST be 0. 1091 4.1.6. chroma_planes 1093 "chroma_planes" indicates if chroma (color) "Planes" are present. 1095 +-------+---------------------------------+ 1096 | value | presence | 1097 +-------+---------------------------------+ 1098 | 0 | chroma "Planes" are not present | 1099 | 1 | chroma "Planes" are present | 1100 +-------+---------------------------------+ 1102 4.1.7. bits_per_raw_sample 1104 "bits_per_raw_sample" indicates the number of bits for each "Sample". 1105 Inferred to be 8 if not present. 1107 +-------+-----------------------------------+ 1108 | value | bits for each sample | 1109 +-------+-----------------------------------+ 1110 | 0 | reserved* | 1111 | Other | the actual bits for each "Sample" | 1112 +-------+-----------------------------------+ 1114 * Encoders MUST NOT store bits_per_raw_sample = 0 Decoders SHOULD 1115 accept and interpret bits_per_raw_sample = 0 as 8. 1117 4.1.8. log2_h_chroma_subsample 1119 "log2_h_chroma_subsample" indicates the subsample factor, stored in 1120 powers to which the number 2 must be raised, between luma and chroma 1121 width ("chroma_width = 2^(-log2_h_chroma_subsample) * luma_width"). 1123 4.1.9. log2_v_chroma_subsample 1125 "log2_v_chroma_subsample" indicates the subsample factor, stored in 1126 powers to which the number 2 must be raised, between luma and chroma 1127 height ("chroma_height=2^(-log2_v_chroma_subsample) * luma_height"). 1129 4.1.10. alpha_plane 1131 "alpha_plane" indicates if a transparency "Plane" is present. 1133 +-------+-------------------------------------+ 1134 | value | presence | 1135 +-------+-------------------------------------+ 1136 | 0 | transparency "Plane" is not present | 1137 | 1 | transparency "Plane" is present | 1138 +-------+-------------------------------------+ 1140 4.1.11. num_h_slices 1142 "num_h_slices" indicates the number of horizontal elements of the 1143 slice raster. 1144 Inferred to be 1 if not present. 1146 4.1.12. num_v_slices 1148 "num_v_slices" indicates the number of vertical elements of the slice 1149 raster. 1150 Inferred to be 1 if not present. 1152 4.1.13. quant_table_set_count 1154 "quant_table_set_count" indicates the number of Quantization 1155 Table Sets. 1156 Inferred to be 1 if not present. 1157 MUST NOT be 0. 1159 4.1.14. states_coded 1161 "states_coded" indicates if the respective Quantization Table Set has 1162 the initial states coded. 1163 Inferred to be 0 if not present. 1165 +-------+-----------------------------------------------------------+ 1166 | value | initial states | 1167 +-------+-----------------------------------------------------------+ 1168 | 0 | initial states are not present and are assumed to be all | 1169 | | 128 | 1170 | 1 | initial states are present | 1171 +-------+-----------------------------------------------------------+ 1173 4.1.15. initial_state_delta 1175 "initial_state_delta[ i ][ j ][ k ]" indicates the initial Range 1176 coder state, it is encoded using "k" as context index and 1178 pred = j ? initial_states[ i ][j - 1][ k ] : 128 1180 initial_state[ i ][ j ][ k ] = 1181 ( pred + initial_state_delta[ i ][ j ][ k ] ) & 255 1183 4.1.16. ec 1185 "ec" indicates the error detection/correction type. 1187 +-------+--------------------------------------------+ 1188 | value | error detection/correction type | 1189 +-------+--------------------------------------------+ 1190 | 0 | 32-bit CRC on the global header | 1191 | 1 | 32-bit CRC per slice and the global header | 1192 | Other | reserved for future use | 1193 +-------+--------------------------------------------+ 1195 4.1.17. intra 1197 "intra" indicates the relationship between the instances of "Frame". 1198 Inferred to be 0 if not present. 1200 +-------+-----------------------------------------------------------+ 1201 | value | relationship | 1202 +-------+-----------------------------------------------------------+ 1203 | 0 | Frames are independent or dependent (keyframes and non | 1204 | | keyframes) | 1205 | 1 | Frames are independent (keyframes only) | 1206 | Other | reserved for future use | 1207 +-------+-----------------------------------------------------------+ 1209 4.2. Configuration Record 1211 In the case of a FFV1 bitstream with "version >= 3", a "Configuration 1212 Record" is stored in the underlying "Container", at the track header 1213 level. It contains the "Parameters" used for all instances of 1214 "Frame". The size of the "Configuration Record", "NumBytes", is 1215 supplied by the underlying "Container". 1217 pseudo-code | type 1218 --------------------------------------------------------------|----- 1219 ConfigurationRecord( NumBytes ) { | 1220 ConfigurationRecordIsPresent = 1 | 1221 Parameters( ) | 1222 while( remaining_bits_in_bitstream( NumBytes ) > 32 ) | 1223 reserved_for_future_use | u(1) 1224 configuration_record_crc_parity | u(32) 1225 } | 1227 4.2.1. reserved_for_future_use 1229 "reserved_for_future_use" has semantics that are reserved for future 1230 use. 1231 Encoders conforming to this version of this specification SHALL NOT 1232 write this value. 1233 Decoders conforming to this version of this specification SHALL 1234 ignore its value. 1236 4.2.2. configuration_record_crc_parity 1238 "configuration_record_crc_parity" 32 bits that are chosen so that the 1239 "Configuration Record" as a whole has a crc remainder of 0. 1240 This is equivalent to storing the crc remainder in the 32-bit parity. 1241 The CRC generator polynomial used is the standard IEEE CRC polynomial 1242 (0x104C11DB7) with initial value 0. 1244 4.2.3. Mapping FFV1 into Containers 1246 This "Configuration Record" can be placed in any file format 1247 supporting "Configuration Records", fitting as much as possible with 1248 how the file format uses to store "Configuration Records". The 1249 "Configuration Record" storage place and "NumBytes" are currently 1250 defined and supported by this version of this specification for the 1251 following formats: 1253 4.2.3.1. AVI File Format 1255 The "Configuration Record" extends the stream format chunk ("AVI ", 1256 "hdlr", "strl", "strf") with the ConfigurationRecord bitstream. 1257 See [AVI] for more information about chunks. 1259 "NumBytes" is defined as the size, in bytes, of the strf chunk 1260 indicated in the chunk header minus the size of the stream format 1261 structure. 1263 4.2.3.2. ISO Base Media File Format 1265 The "Configuration Record" extends the sample description box 1266 ("moov", "trak", "mdia", "minf", "stbl", "stsd") with a "glbl" box 1267 that contains the ConfigurationRecord bitstream. See 1268 [ISO.14496-12.2015] for more information about boxes. 1270 "NumBytes" is defined as the size, in bytes, of the "glbl" box 1271 indicated in the box header minus the size of the box header. 1273 4.2.3.3. NUT File Format 1275 The codec_specific_data element (in "stream_header" packet) contains 1276 the ConfigurationRecord bitstream. See [NUT] for more information 1277 about elements. 1279 "NumBytes" is defined as the size, in bytes, of the 1280 codec_specific_data element as indicated in the "length" field of 1281 codec_specific_data 1283 4.2.3.4. Matroska File Format 1285 FFV1 SHOULD use "V_FFV1" as the Matroska "Codec ID". For FFV1 1286 versions 2 or less, the Matroska "CodecPrivate" Element SHOULD NOT be 1287 used. For FFV1 versions 3 or greater, the Matroska "CodecPrivate" 1288 Element MUST contain the FFV1 "Configuration Record" structure and no 1289 other data. See [Matroska] for more information about elements. 1291 "NumBytes" is defined as the "Element Data Size" of the 1292 "CodecPrivate" Element. 1294 4.3. Frame 1296 A "Frame" is an encoded representation of a complete static image. 1297 The whole "Frame" is provided by the underlaying container. 1299 A "Frame" consists of the keyframe field, "Parameters" (if version 1300 <=1), and a sequence of independent slices. The pseudo-code below 1301 describes the contents of a "Frame". 1303 pseudo-code | type 1304 --------------------------------------------------------------|----- 1305 Frame( NumBytes ) { | 1306 keyframe | br 1307 if (keyframe && !ConfigurationRecordIsPresent | 1308 Parameters( ) | 1309 while ( remaining_bits_in_bitstream( NumBytes ) ) | 1310 Slice( ) | 1311 } | 1313 Architecture overview of slices in a "Frame": 1315 +-----------------------------------------------------------------+ 1316 | first slice header | 1317 | first slice content | 1318 | first slice footer | 1319 | --------------------------------------------------------------- | 1320 | second slice header | 1321 | second slice content | 1322 | second slice footer | 1323 | --------------------------------------------------------------- | 1324 | ... | 1325 | --------------------------------------------------------------- | 1326 | last slice header | 1327 | last slice content | 1328 | last slice footer | 1329 +-----------------------------------------------------------------+ 1331 4.4. Slice 1333 A "Slice" is an independent spatial sub-section of a "Frame" that is 1334 encoded separately from an other region of the same "Frame". The use 1335 of more than one "Slice" per "Frame" can be useful for taking 1336 advantage of the opportunities of multithreaded encoding and 1337 decoding. 1339 A "Slice" consists of a "Slice Header" (when relevant), a "Slice 1340 Content", and a "Slice Footer" (when relevant). The pseudo-code 1341 below describes the contents of a "Slice". 1343 pseudo-code | type 1344 --------------------------------------------------------------|----- 1345 Slice( ) { | 1346 if (version >= 3) | 1347 SliceHeader( ) | 1348 SliceContent( ) | 1349 if (coder_type == 0) | 1350 while (!byte_aligned()) | 1351 padding | u(1) 1352 if (version <= 1) { | 1353 while (remaining_bits_in_bitstream( NumBytes ) != 0 ) | 1354 reserved | u(1) 1355 } | 1356 if (version >= 3) | 1357 SliceFooter( ) | 1358 } | 1360 "padding" specifies a bit without any significance and used only for 1361 byte alignment. MUST be 0. 1363 "reserved" specifies a bit without any significance in this revision 1364 of the specification and may have a significance in a later revision 1365 of this specification. 1366 Encoders SHOULD NOT fill these bits. 1367 Decoders SHOULD ignore these bits. 1368 Note in case these bits are used in a later revision of this 1369 specification: any revision of this specification SHOULD care about 1370 avoiding to add 40 bits of content after "SliceContent" for version 0 1371 and 1 of the bitstream. Background: due to some non conforming 1372 encoders, some bitstreams where found with 40 extra bits 1373 corresponding to "error_status" and "slice_crc_parity", a decoder 1374 conforming to the revised specification could not do the difference 1375 between a revised bitstream and a buggy bitstream. 1377 4.5. Slice Header 1379 A "Slice Header" provides information about the decoding 1380 configuration of the "Slice", such as its spatial position, size, and 1381 aspect ratio. The pseudo-code below describes the contents of the 1382 "Slice Header". 1384 pseudo-code | type 1385 --------------------------------------------------------------|----- 1386 SliceHeader( ) { | 1387 slice_x | ur 1388 slice_y | ur 1389 slice_width - 1 | ur 1390 slice_height - 1 | ur 1391 for( i = 0; i < quant_table_set_index_count; i++ ) | 1392 quant_table_set_index [ i ] | ur 1393 picture_structure | ur 1394 sar_num | ur 1395 sar_den | ur 1396 } | 1398 4.5.1. slice_x 1400 "slice_x" indicates the x position on the slice raster formed by 1401 num_h_slices. 1402 Inferred to be 0 if not present. 1404 4.5.2. slice_y 1406 "slice_y" indicates the y position on the slice raster formed by 1407 num_v_slices. 1408 Inferred to be 0 if not present. 1410 4.5.3. slice_width 1412 "slice_width" indicates the width on the slice raster formed by 1413 num_h_slices. 1414 Inferred to be 1 if not present. 1416 4.5.4. slice_height 1418 "slice_height" indicates the height on the slice raster formed by 1419 num_v_slices. 1420 Inferred to be 1 if not present. 1422 4.5.5. quant_table_set_index_count 1424 "quant_table_set_index_count" is defined as "1 + ( ( chroma_planes || 1425 version \<= 3 ) ? 1 : 0 ) + ( alpha_plane ? 1 : 0 )". 1427 4.5.6. quant_table_set_index 1429 "quant_table_set_index" indicates the Quantization Table Set index to 1430 select the Quantization Table Set and the initial states for the 1431 slice. 1433 Inferred to be 0 if not present. 1435 4.5.7. picture_structure 1437 "picture_structure" specifies the temporal and spatial relationship 1438 of each "Line" of the "Frame". 1439 Inferred to be 0 if not present. 1441 +-------+-------------------------+ 1442 | value | picture structure used | 1443 +-------+-------------------------+ 1444 | 0 | unknown | 1445 | 1 | top field first | 1446 | 2 | bottom field first | 1447 | 3 | progressive | 1448 | Other | reserved for future use | 1449 +-------+-------------------------+ 1451 4.5.8. sar_num 1453 "sar_num" specifies the "Sample" aspect ratio numerator. 1454 Inferred to be 0 if not present. 1455 A value of 0 means that aspect ratio is unknown. 1456 Encoders MUST write 0 if "Sample" aspect ratio is unknown. 1457 If "sar_den" is 0, decoders SHOULD ignore the encoded value and 1458 consider that "sar_num" is 0. 1460 4.5.9. sar_den 1462 "sar_den" specifies the "Sample" aspect ratio denominator. 1463 Inferred to be 0 if not present. 1464 A value of 0 means that aspect ratio is unknown. 1465 Encoders MUST write 0 if "Sample" aspect ratio is unknown. 1466 If "sar_num" is 0, decoders SHOULD ignore the encoded value and 1467 consider that "sar_den" is 0. 1469 4.6. Slice Content 1471 A "Slice Content" contains all "Line" elements part of the "Slice". 1473 Depending on the configuration, "Line" elements are ordered by 1474 "Plane" then by row (YCbCr) or by row then by "Plane" (RGB). 1476 pseudo-code | type 1477 --------------------------------------------------------------|----- 1478 SliceContent( ) { | 1479 if (colorspace_type == 0) { | 1480 for( p = 0; p < primary_color_count; p++ ) | 1481 for( y = 0; y < plane_pixel_height[ p ]; y++ ) | 1482 Line( p, y ) | 1483 } else if (colorspace_type == 1) { | 1484 for( y = 0; y < slice_pixel_height; y++ ) | 1485 for( p = 0; p < primary_color_count; p++ ) | 1486 Line( p, y ) | 1487 } | 1488 } | 1490 4.6.1. primary_color_count 1492 "primary_color_count" is defined as "1 + ( chroma_planes ? 2 : 0 ) + 1493 ( alpha_plane ? 1 : 0 )". 1495 4.6.2. plane_pixel_height 1497 "plane_pixel_height[ p ]" is the height in pixels of plane p of the 1498 slice. 1499 "plane_pixel_height[ 0 ]" and "plane_pixel_height[ 1 + ( 1500 chroma_planes ? 2 : 0 ) ]" value is "slice_pixel_height". 1501 If "chroma_planes" is set to 1, "plane_pixel_height[ 1 ]" and 1502 "plane_pixel_height[ 2 ]" value is "ceil(slice_pixel_height / 1503 log2_v_chroma_subsample)". 1505 4.6.3. slice_pixel_height 1507 "slice_pixel_height" is the height in pixels of the slice. 1508 Its value is "floor(( slice_y + slice_height ) * slice_pixel_height / 1509 num_v_slices) - slice_pixel_y". 1511 4.6.4. slice_pixel_y 1513 "slice_pixel_y" is the slice vertical position in pixels. 1514 Its value is "floor(slice_y * frame_pixel_height / num_v_slices)". 1516 4.7. Line 1518 A "Line" is a list of the sample differences (relative to the 1519 predictor) of primary color components. The pseudo-code below 1520 describes the contents of the "Line". 1522 pseudo-code | type 1523 --------------------------------------------------------------|----- 1524 Line( p, y ) { | 1525 if (colorspace_type == 0) { | 1526 for( x = 0; x < plane_pixel_width[ p ]; x++ ) | 1527 sample_difference[ p ][ y ][ x ] | 1528 } else if (colorspace_type == 1) { | 1529 for( x = 0; x < slice_pixel_width; x++ ) | 1530 sample_difference[ p ][ y ][ x ] | 1531 } | 1532 } | 1534 4.7.1. plane_pixel_width 1536 "plane_pixel_width[ p ]" is the width in "Pixels" of "Plane" p of the 1537 slice. 1538 "plane_pixel_width[ 0 ]" and "plane_pixel_width[ 1 + ( chroma_planes 1539 ? 2 : 0 ) ]" value is "slice_pixel_width". 1540 If "chroma_planes" is set to 1, "plane_pixel_width[ 1 ]" and 1541 "plane_pixel_width[ 2 ]" value is "ceil(slice_pixel_width / (1 << 1542 log2_h_chroma_subsample))". 1544 4.7.2. slice_pixel_width 1546 "slice_pixel_width" is the width in "Pixels" of the slice. 1547 Its value is "floor(( slice_x + slice_width ) * slice_pixel_width / 1548 num_h_slices) - slice_pixel_x". 1550 4.7.3. slice_pixel_x 1552 "slice_pixel_x" is the slice horizontal position in "Pixels". 1553 Its value is "floor(slice_x * frame_pixel_width / num_h_slices)". 1555 4.7.4. sample_difference 1557 "sample_difference[ p ][ y ][ x ]" is the sample difference for 1558 "Sample" at "Plane" "p", y position "y", and x position "x". The 1559 "Sample" value is computed based on median predictor and context 1560 described in Section 3.2. 1562 4.8. Slice Footer 1564 A "Slice Footer" provides information about slice size and 1565 (optionally) parity. The pseudo-code below describes the contents of 1566 the "Slice Header". 1568 Note: "Slice Footer" is always byte aligned. 1570 pseudo-code | type 1571 --------------------------------------------------------------|----- 1572 SliceFooter( ) { | 1573 slice_size | u(24) 1574 if (ec) { | 1575 error_status | u(8) 1576 slice_crc_parity | u(32) 1577 } | 1578 } | 1580 4.8.1. slice_size 1582 "slice_size" indicates the size of the slice in bytes. 1583 Note: this allows finding the start of slices before previous slices 1584 have been fully decoded, and allows parallel decoding as well as 1585 error resilience. 1587 4.8.2. error_status 1589 "error_status" specifies the error status. 1591 +-------+--------------------------------------+ 1592 | value | error status | 1593 +-------+--------------------------------------+ 1594 | 0 | no error | 1595 | 1 | slice contains a correctable error | 1596 | 2 | slice contains a uncorrectable error | 1597 | Other | reserved for future use | 1598 +-------+--------------------------------------+ 1600 4.8.3. slice_crc_parity 1602 "slice_crc_parity" 32 bits that are chosen so that the slice as a 1603 whole has a crc remainder of 0. 1604 This is equivalent to storing the crc remainder in the 32-bit parity. 1605 The CRC generator polynomial used is the standard IEEE CRC polynomial 1606 (0x104C11DB7) with initial value 0. 1608 4.9. Quantization Table Set 1610 The Quantization Table Sets are stored by storing the number of equal 1611 entries -1 of the first half of the table (represented as "len - 1" 1612 in the pseudo-code below) using the method described in 1613 Section 3.8.1.2. The second half doesn't need to be stored as it is 1614 identical to the first with flipped sign. "scale" and "len_count[ i 1615 ][ j ]" are temporary values used for the computing of 1616 "context_count[ i ]" and are not used outside Quantization Table Set 1617 pseudo-code. 1619 example: 1621 Table: 0 0 1 1 1 1 2 2 -2 -2 -2 -1 -1 -1 -1 0 1623 Stored values: 1, 3, 1 1625 pseudo-code | type 1626 --------------------------------------------------------------|----- 1627 QuantizationTableSet( i ) { | 1628 scale = 1 | 1629 for( j = 0; j < MAX_CONTEXT_INPUTS; j++ ) { | 1630 QuantizationTable( i, j, scale ) | 1631 scale *= 2 * len_count[ i ][ j ] - 1 | 1632 } | 1633 context_count[ i ] = ceil ( scale / 2 ) | 1634 } | 1636 MAX_CONTEXT_INPUTS is 5. 1638 pseudo-code | type 1639 --------------------------------------------------------------|----- 1640 QuantizationTable(i, j, scale) { | 1641 v = 0 | 1642 for( k = 0; k < 128; ) { | 1643 len - 1 | ur 1644 for( a = 0; a < len; a++ ) { | 1645 quant_tables[ i ][ j ][ k ] = scale* v | 1646 k++ | 1647 } | 1648 v++ | 1649 } | 1650 for( k = 1; k < 128; k++ ) { | 1651 quant_tables[ i ][ j ][ 256 - k ] = \ | 1652 -quant_tables[ i ][ j ][ k ] | 1653 } | 1654 quant_tables[ i ][ j ][ 128 ] = \ | 1655 -quant_tables[ i ][ j ][ 127 ] | 1656 len_count[ i ][ j ] = v | 1657 } | 1659 4.9.1. quant_tables 1661 "quant_tables[ i ][ j ][ k ]" indicates the quantification table 1662 value of the Quantized Sample Difference "k" of the Quantization 1663 Table "j" of the Set Quantization Table Set "i". 1665 4.9.2. context_count 1667 "context_count[ i ]" indicates the count of contexts for Quantization 1668 Table Set "i". 1670 5. Restrictions 1672 To ensure that fast multithreaded decoding is possible, starting 1673 version 3 and if frame_pixel_width * frame_pixel_height is more than 1674 101376, slice_width * slice_height MUST be less or equal to 1675 num_h_slices * num_v_slices / 4. Note: 101376 is the frame size in 1676 "Pixels" of a 352x288 frame also known as CIF ("Common Intermediate 1677 Format") frame size format. 1679 For each "Frame", each position in the slice raster MUST be filled by 1680 one and only one slice of the "Frame" (no missing slice position, no 1681 slice overlapping). 1683 For each "Frame" with keyframe value of 0, each slice MUST have the 1684 same value of slice_x, slice_y, slice_width, slice_height as a slice 1685 in the previous "Frame". 1687 6. Security Considerations 1689 Like any other codec, (such as [RFC6716]), FFV1 should not be used 1690 with insecure ciphers or cipher-modes that are vulnerable to known 1691 plaintext attacks. Some of the header bits as well as the padding 1692 are easily predictable. 1694 Implementations of the FFV1 codec need to take appropriate security 1695 considerations into account, as outlined in [RFC4732]. It is 1696 extremely important for the decoder to be robust against malicious 1697 payloads. Malicious payloads must not cause the decoder to overrun 1698 its allocated memory or to take an excessive amount of resources to 1699 decode. Although problems in encoders are typically rarer, the same 1700 applies to the encoder. Malicious video streams must not cause the 1701 encoder to misbehave because this would allow an attacker to attack 1702 transcoding gateways. A frequent security problem in image and video 1703 codecs is also to not check for integer overflows in "Pixel" count 1704 computations, that is to allocate width * height without considering 1705 that the multiplication result may have overflowed the arithmetic 1706 types range. 1708 The reference implementation [REFIMPL] contains no known buffer 1709 overflow or cases where a specially crafted packet or video segment 1710 could cause a significant increase in CPU load. 1712 The reference implementation [REFIMPL] was validated in the following 1713 conditions: 1715 o Sending the decoder valid packets generated by the reference 1716 encoder and verifying that the decoder's output matches the 1717 encoder's input. 1719 o Sending the decoder packets generated by the reference encoder and 1720 then subjected to random corruption. 1722 o Sending the decoder random packets that are not FFV1. 1724 In all of the conditions above, the decoder and encoder was run 1725 inside the [VALGRIND] memory debugger as well as clangs address 1726 sanitizer [Address-Sanitizer], which track reads and writes to 1727 invalid memory regions as well as the use of uninitialized memory. 1728 There were no errors reported on any of the tested conditions. 1730 7. Media Type Definition 1732 This registration is done using the template defined in [RFC6838] and 1733 following [RFC4855]. 1735 Type name: video 1737 Subtype name: FFV1 1739 Required parameters: None. 1741 Optional parameters: 1743 This parameter is used to signal the capabilities of a receiver 1744 implementation. This parameter MUST NOT be used for any other 1745 purpose. 1747 version: The version of the FFV1 encoding as defined by 1748 Section 4.1.1. 1750 micro_version: The micro_version of the FFV1 encoding as defined by 1751 Section 4.1.2. 1753 coder_type: The coder_type of the FFV1 encoding as defined by 1754 Section 4.1.3. 1756 colorspace_type: The colorspace_type of the FFV1 encoding as defined 1757 by Section 4.1.5. 1759 bits_per_raw_sample: The version of the FFV1 encoding as defined by 1760 Section 4.1.7. 1762 max-slices: The value of max-slices is an integer indicating the 1763 maximum count of slices with a frames of the FFV1 encoding. 1765 Encoding considerations: 1767 This media type is defined for encapsulation in several audiovisual 1768 container formats and contains binary data; see Section 4.2.3. This 1769 media type is framed binary data Section 4.8 of [RFC4288]. 1771 Security considerations: 1773 See Section 6 of this document. 1775 Interoperability considerations: None. 1777 Published specification: 1779 [I-D.ietf-cellar-ffv1] and RFC XXXX. 1781 [RFC Editor: Upon publication as an RFC, please replace "XXXX" with 1782 the number assigned to this document and remove this note.] 1784 Applications which use this media type: 1786 Any application that requires the transport of lossless video can use 1787 this media type. Some examples are, but not limited to screen 1788 recording, scientific imaging, and digital video preservation. 1790 Fragment identifier considerations: N/A. 1792 Additional information: None. 1794 Person & email address to contact for further information: Michael 1795 Niedermayer 1797 Intended usage: COMMON 1799 Restrictions on usage: None. 1801 Author: Dave Rice 1803 Change controller: IETF cellar working group delegated from the IESG. 1805 8. IANA Considerations 1807 The IANA is requested to register the following values: 1809 o Media type registration as described in Section 7. 1811 9. Appendixes 1813 9.1. Decoder implementation suggestions 1815 9.1.1. Multi-threading Support and Independence of Slices 1817 The FFV1 bitstream is parsable in two ways: in sequential order as 1818 described in this document or with the pre-analysis of the footer of 1819 each slice. Each slice footer contains a slice_size field so the 1820 boundary of each slice is computable without having to parse the 1821 slice content. That allows multi-threading as well as independence 1822 of slice content (a bitstream error in a slice header or slice 1823 content has no impact on the decoding of the other slices). 1825 After having checked keyframe field, a decoder SHOULD parse 1826 slice_size fields, from slice_size of the last slice at the end of 1827 the "Frame" up to slice_size of the first slice at the beginning of 1828 the "Frame", before parsing slices, in order to have slices 1829 boundaries. A decoder MAY fallback on sequential order e.g. in case 1830 of a corrupted "Frame" (frame size unknown, slice_size of slices not 1831 coherent...) or if there is no possibility of seek into the stream. 1833 10. Changelog 1835 See 1837 11. References 1839 11.1. Normative References 1841 [I-D.ietf-cellar-ffv1] 1842 Niedermayer, M., Rice, D., and J. Martinez, "FFV1 Video 1843 Coding Format Version 0, 1, and 3", draft-ietf-cellar- 1844 ffv1-05 (work in progress), September 2018. 1846 [ISO.15444-1.2016] 1847 International Organization for Standardization, 1848 "Information technology -- JPEG 2000 image coding system: 1849 Core coding system", October 2016. 1851 [ISO.9899.1990] 1852 International Organization for Standardization, 1853 "Programming languages - C", ISO Standard 9899, 1990. 1855 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1856 Requirement Levels", BCP 14, RFC 2119, 1857 DOI 10.17487/RFC2119, March 1997, 1858 . 1860 [RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and 1861 Registration Procedures", RFC 4288, DOI 10.17487/RFC4288, 1862 December 2005, . 1864 [RFC4732] Handley, M., Ed., Rescorla, E., Ed., and IAB, "Internet 1865 Denial-of-Service Considerations", RFC 4732, 1866 DOI 10.17487/RFC4732, December 2006, 1867 . 1869 [RFC4855] Casner, S., "Media Type Registration of RTP Payload 1870 Formats", RFC 4855, DOI 10.17487/RFC4855, February 2007, 1871 . 1873 [RFC6716] Valin, JM., Vos, K., and T. Terriberry, "Definition of the 1874 Opus Audio Codec", RFC 6716, DOI 10.17487/RFC6716, 1875 September 2012, . 1877 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 1878 Specifications and Registration Procedures", BCP 13, 1879 RFC 6838, DOI 10.17487/RFC6838, January 2013, 1880 . 1882 11.2. Informative References 1884 [Address-Sanitizer] 1885 The Clang Team, "ASAN AddressSanitizer website", undated, 1886 . 1888 [AVI] Microsoft, "AVI RIFF File Reference", undated, 1889 . 1892 [FFV1_V0] Niedermayer, M., "Commit to mark FFV1 version 0 as non- 1893 experimental", April 2006, . 1897 [FFV1_V1] Niedermayer, M., "Commit to release FFV1 version 1", April 1898 2009, . 1901 [FFV1_V3] Niedermayer, M., "Commit to mark FFV1 version 3 as non- 1902 experimental", August 2013, . 1906 [HuffYUV] Rudiak-Gould, B., "HuffYUV", December 2003, 1907 . 1910 [ISO.14495-1.1999] 1911 International Organization for Standardization, 1912 "Information technology -- Lossless and near-lossless 1913 compression of continuous-tone still images: Baseline", 1914 December 1999. 1916 [ISO.14496-10.2014] 1917 International Organization for Standardization, 1918 "Information technology -- Coding of audio-visual objects 1919 -- Part 10: Advanced Video Coding", September 2014. 1921 [ISO.14496-12.2015] 1922 International Organization for Standardization, 1923 "Information technology -- Coding of audio-visual objects 1924 -- Part 12: ISO base media file format", December 2015. 1926 [Matroska] 1927 IETF, "Matroska", 2016, . 1930 [NUT] Niedermayer, M., "NUT Open Container Format", December 1931 2013, . 1933 [range-coding] 1934 Nigel, G. and N. Martin, "Range encoding: an algorithm for 1935 removing redundancy from a digitised message.", Proc. 1936 Institution of Electronic and Radio Engineers 1937 International Conference on Video and Data Recording , 1938 July 1979. 1940 [REFIMPL] Niedermayer, M., "The reference FFV1 implementation / the 1941 FFV1 codec in FFmpeg", undated, . 1943 [VALGRIND] 1944 Valgrind Developers, "Valgrind website", undated, 1945 . 1947 [YCbCr] Wikipedia, "YCbCr", undated, 1948 . 1950 Authors' Addresses 1952 Michael Niedermayer 1954 Email: michael@niedermayer.cc 1956 Dave Rice 1958 Email: dave@dericed.com 1960 Jerome Martinez 1962 Email: jerome@mediaarea.net