--- 1/draft-ietf-cellar-ffv1-01.txt 2018-04-22 08:13:18.964420735 -0700 +++ 2/draft-ietf-cellar-ffv1-02.txt 2018-04-22 08:13:19.048422722 -0700 @@ -1,20 +1,20 @@ cellar M. Niedermayer Internet-Draft Intended status: Standards Track D. Rice -Expires: July 30, 2018 +Expires: October 24, 2018 J. Martinez - January 26, 2018 + April 22, 2018 - FF Video Codec 1 - draft-ietf-cellar-ffv1-01 + FFV1 Video Coding Format Version 0, 1, and 3 + draft-ietf-cellar-ffv1-02 Abstract This document defines FFV1, a lossless intra-frame video encoding format. FFV1 is designed to efficiently compress video data in a variety of pixel formats. Compared to uncompressed video, FFV1 offers storage compression, frame fixity, and self-description, which makes FFV1 useful as a preservation or intermediate video format. Status of This Memo @@ -25,21 +25,21 @@ Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." - This Internet-Draft will expire on July 30, 2018. + This Internet-Draft will expire on October 24, 2018. Copyright Notice Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents @@ -87,67 +87,68 @@ 4.4. Slice Header . . . . . . . . . . . . . . . . . . . . . . 23 4.4.1. slice_x . . . . . . . . . . . . . . . . . . . . . . . 23 4.4.2. slice_y . . . . . . . . . . . . . . . . . . . . . . . 23 4.4.3. slice_width . . . . . . . . . . . . . . . . . . . . . 24 4.4.4. slice_height . . . . . . . . . . . . . . . . . . . . 24 4.4.5. quant_table_set_index_count . . . . . . . . . . . . . 24 4.4.6. quant_table_set_index . . . . . . . . . . . . . . . . 24 4.4.7. picture_structure . . . . . . . . . . . . . . . . . . 24 4.4.8. sar_num . . . . . . . . . . . . . . . . . . . . . . . 24 4.4.9. sar_den . . . . . . . . . . . . . . . . . . . . . . . 25 - 4.4.10. reset_contexts . . . . . . . . . . . . . . . . . . . 25 - 4.4.11. slice_coding_mode . . . . . . . . . . . . . . . . . . 25 + 4.5. Slice Content . . . . . . . . . . . . . . . . . . . . . . 25 4.5.1. primary_color_count . . . . . . . . . . . . . . . . . 25 - 4.5.2. plane_pixel_height . . . . . . . . . . . . . . . . . 26 - 4.5.3. slice_pixel_height . . . . . . . . . . . . . . . . . 26 - 4.5.4. slice_pixel_y . . . . . . . . . . . . . . . . . . . . 26 + 4.5.2. plane_pixel_height . . . . . . . . . . . . . . . . . 25 + 4.5.3. slice_pixel_height . . . . . . . . . . . . . . . . . 25 + 4.5.4. slice_pixel_y . . . . . . . . . . . . . . . . . . . . 25 4.6. Line . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4.6.1. plane_pixel_width . . . . . . . . . . . . . . . . . . 26 - 4.6.2. slice_pixel_width . . . . . . . . . . . . . . . . . . 27 - 4.6.3. slice_pixel_x . . . . . . . . . . . . . . . . . . . . 27 - 4.6.4. sample_difference . . . . . . . . . . . . . . . . . . 27 - 4.7. Slice Footer . . . . . . . . . . . . . . . . . . . . . . 27 + 4.6.2. slice_pixel_width . . . . . . . . . . . . . . . . . . 26 + 4.6.3. slice_pixel_x . . . . . . . . . . . . . . . . . . . . 26 + 4.6.4. sample_difference . . . . . . . . . . . . . . . . . . 26 + 4.7. Slice Footer . . . . . . . . . . . . . . . . . . . . . . 26 4.7.1. slice_size . . . . . . . . . . . . . . . . . . . . . 27 4.7.2. error_status . . . . . . . . . . . . . . . . . . . . 27 - 4.7.3. slice_crc_parity . . . . . . . . . . . . . . . . . . 28 - 4.8. Parameters . . . . . . . . . . . . . . . . . . . . . . . 28 - 4.8.1. version . . . . . . . . . . . . . . . . . . . . . . . 29 - 4.8.2. micro_version . . . . . . . . . . . . . . . . . . . . 30 - 4.8.3. coder_type . . . . . . . . . . . . . . . . . . . . . 31 - 4.8.4. state_transition_delta . . . . . . . . . . . . . . . 31 - 4.8.5. colorspace_type . . . . . . . . . . . . . . . . . . . 31 - 4.8.6. chroma_planes . . . . . . . . . . . . . . . . . . . . 32 - 4.8.7. bits_per_raw_sample . . . . . . . . . . . . . . . . . 32 - 4.8.8. log2_h_chroma_subsample . . . . . . . . . . . . . . . 32 - 4.8.9. log2_v_chroma_subsample . . . . . . . . . . . . . . . 32 - 4.8.10. alpha_plane . . . . . . . . . . . . . . . . . . . . . 32 - 4.8.11. num_h_slices . . . . . . . . . . . . . . . . . . . . 33 - 4.8.12. num_v_slices . . . . . . . . . . . . . . . . . . . . 33 - 4.8.13. quant_table_set_count . . . . . . . . . . . . . . . . 33 - 4.8.14. states_coded . . . . . . . . . . . . . . . . . . . . 33 - 4.8.15. initial_state_delta . . . . . . . . . . . . . . . . . 33 - 4.8.16. ec . . . . . . . . . . . . . . . . . . . . . . . . . 33 - 4.8.17. intra . . . . . . . . . . . . . . . . . . . . . . . . 34 - 4.9. Quantization Table Set . . . . . . . . . . . . . . . . . 34 - 4.9.1. quant_tables . . . . . . . . . . . . . . . . . . . . 35 - 4.9.2. context_count . . . . . . . . . . . . . . . . . . . . 35 - 5. Restrictions . . . . . . . . . . . . . . . . . . . . . . . . 35 - 6. Security Considerations . . . . . . . . . . . . . . . . . . . 36 - 7. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . 36 - 7.1. Decoder implementation suggestions . . . . . . . . . . . 37 - 7.1.1. Multi-threading support and independence of slices . 37 - 8. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 37 - 9. ToDo . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 - 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 38 - 10.1. Normative References . . . . . . . . . . . . . . . . . . 38 - 10.2. Informative References . . . . . . . . . . . . . . . . . 38 + 4.7.3. slice_crc_parity . . . . . . . . . . . . . . . . . . 27 + 4.8. Parameters . . . . . . . . . . . . . . . . . . . . . . . 27 + 4.8.1. version . . . . . . . . . . . . . . . . . . . . . . . 28 + 4.8.2. micro_version . . . . . . . . . . . . . . . . . . . . 29 + 4.8.3. coder_type . . . . . . . . . . . . . . . . . . . . . 29 + 4.8.4. state_transition_delta . . . . . . . . . . . . . . . 30 + 4.8.5. colorspace_type . . . . . . . . . . . . . . . . . . . 30 + 4.8.6. chroma_planes . . . . . . . . . . . . . . . . . . . . 30 + 4.8.7. bits_per_raw_sample . . . . . . . . . . . . . . . . . 30 + 4.8.8. log2_h_chroma_subsample . . . . . . . . . . . . . . . 31 + 4.8.9. log2_v_chroma_subsample . . . . . . . . . . . . . . . 31 + 4.8.10. alpha_plane . . . . . . . . . . . . . . . . . . . . . 31 + 4.8.11. num_h_slices . . . . . . . . . . . . . . . . . . . . 31 + 4.8.12. num_v_slices . . . . . . . . . . . . . . . . . . . . 31 + 4.8.13. quant_table_set_count . . . . . . . . . . . . . . . . 32 + 4.8.14. states_coded . . . . . . . . . . . . . . . . . . . . 32 + 4.8.15. initial_state_delta . . . . . . . . . . . . . . . . . 32 + 4.8.16. ec . . . . . . . . . . . . . . . . . . . . . . . . . 32 + 4.8.17. intra . . . . . . . . . . . . . . . . . . . . . . . . 32 + 4.9. Quantization Table Set . . . . . . . . . . . . . . . . . 33 + 4.9.1. quant_tables . . . . . . . . . . . . . . . . . . . . 34 + 4.9.2. context_count . . . . . . . . . . . . . . . . . . . . 34 + 5. Restrictions . . . . . . . . . . . . . . . . . . . . . . . . 34 + 6. Security Considerations . . . . . . . . . . . . . . . . . . . 35 + 7. Media Type Definition . . . . . . . . . . . . . . . . . . . . 35 + 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 37 + 9. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . 37 + 9.1. Decoder implementation suggestions . . . . . . . . . . . 37 + 9.1.1. Multi-threading support and independence of slices . 37 + 10. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 38 + 11. ToDo . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 + 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 38 + 12.1. Normative References . . . . . . . . . . . . . . . . . . 38 + 12.2. Informative References . . . . . . . . . . . . . . . . . 39 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 40 1. Introduction This document describes FFV1, a lossless video encoding format. The design of FFV1 considers the storage of image characteristics, data fixity, and the optimized use of encoding time and storage requirements. FFV1 is designed to support a wide range of lossless video applications such as long-term audiovisual preservation, scientific imaging, screen recording, and other video encoding @@ -181,49 +182,52 @@ [YCbCr]. 2. Notation and Conventions The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. 2.1. Definitions + "Container": Format that encapsulates "Frames" and (when required) a + "Configuration Record" into a bitstream. + "Sample": The smallest addressable representation of a color - component or a luma component in a frame. Examples of sample are - Luma, Blue Chrominance, Red Chrominance, Alpha, Red, Green, Blue. + component or a luma component in a "Frame". Examples of sample are + Luma, Blue Chrominance, Red Chrominance, Alpha, Red, Green, and Blue. "Pixel": The smallest addressable representation of a color in a - frame. It is composed of 1 or more samples. + "Frame". It is composed of 1 or more samples. "ESC": An ESCape symbol to indicate that the symbol to be stored is too large for normal storage and that an alternate storage method. "MSB": Most Significant Bit, the bit that can cause the largest change in magnitude of the symbol. "RCT": Reversible Color Transform, a near linear, exactly reversible integer transform that converts between RGB and YCbCr representations of a Pixel. - "VLC": Variable Length Code, a code which maps source symbols to a + "VLC": Variable Length Code, a code that maps source symbols to a variable number of bits. "RGB": A reference to the method of storing the value of a Pixel by using three numeric values that represent Red, Green, and Blue. "YCbCr": A reference to the method of storing the value of a Pixel by using three numeric values that represent the luma of the Pixel (Y) and the chrominance of the Pixel (Cb and Cr). YCbCr word is used for historical reasons and currently references any color space relying - on 1 luma and 2 chrominances e.g. YCbCr, YCgCo or ICtCp. Exact - meaning of the three numeric values is unspecified. + on 1 luma sample and 2 chrominance samples e.g. YCbCr, YCgCo or + ICtCp. Exact meaning of the three numeric values is unspecified. "TBA": To Be Announced. Used in reference to the development of future iterations of the FFV1 specification. 2.2. Conventions Note: the operators and the order of precedence are the same as used in the C programming language [ISO.9899.1990]. 2.2.1. Arithmetic operators @@ -325,47 +329,47 @@ a == b, a != b a & b a | b a && b a || b a ? b : c a = b, a += b, a -= b, a *= b 2.2.6. Pseudo-code - Several components of FFV1 are described in this document using - pseudo-code. Note that the pseudo-code is used for clarity in order - to illustrate the structure of FFV1 and not intended to specify any - particular implementation. The pseudo-code used is based upon the C - programming language [ISO.9899.1990] as uses its "if/else", "while" - and "for" functions as well as functions defined within this - document. + The FFV1 bitstream is described in this document using pseudo-code. + Note that the pseudo-code is used for clarity in order to illustrate + the structure of FFV1 and not intended to specify any particular + implementation. The pseudo-code used is based upon the C programming + language [ISO.9899.1990] as uses its "if/else", "while" and "for" + functions as well as functions defined within this document. 2.2.7. Range "a...b" means any value starting from a to b, inclusive. 2.2.8. NumBytes "NumBytes" is a non-negative integer that expresses the size in 8-bit - octets of particular FFV1 components such as the "Configuration - Record" and "Frame". FFV1 relies on its container to store the - "NumBytes" values, see Section 4.1.3. + octets of particular FFV1 "Configuration Record" or "Frame". FFV1 + relies on its "Container" to store the "NumBytes" values, see + Section 4.1.3. 2.2.9. Bitstream functions 2.2.9.1. remaining_bits_in_bitstream "remaining_bits_in_bitstream( )" means the count of remaining bits - after the pointer in that bitstream component. It is computed from - the "NumBytes" value multiplied by 8 minus the count of bits of that - component already read by the bitstream parser. + after the pointer in that "Configuration Record" or "Frame". It is + computed from the "NumBytes" value multiplied by 8 minus the count of + bits of that "Configuration Record" or "Frame" already read by the + bitstream parser. 2.2.9.2. byte_aligned "byte_aligned( )" is true if "remaining_bits_in_bitstream( NumBytes )" is a multiple of 8, otherwise false. 2.2.9.3. get_bits "get_bits( i )" is the action to read the next "i" bits in the bitstream, from most significant bit to least significant bit, and to @@ -553,44 +557,44 @@ Y=g+(Cb+Cr)>>2 g=Y-(Cb+Cr)>>2 r=Cr+g b=Cb+g Exception for the JPEG2000-RCT conversion: if bits_per_raw_sample is - between 9 and 15 inclusive, the following formulae for reversible - conversions between YCbCr and RGB MUST be used instead of the ones - above: + between 9 and 15 inclusive and alpha_plane is 0, the following + formulae for reversible conversions between YCbCr and RGB MUST be + used instead of the ones above: Cb=g-b Cr=r-b Y=b+(Cb+Cr)>>2 b=Y-(Cb+Cr)>>2 r=Cr+b g=Cb+b Background: At the time of this writing, in all known implementations of FFV1 bitstream, when bits_per_raw_sample was between 9 and 15 - inclusive, GBR planes were used as BGR planes during both encoding - and decoding. In the meanwhile, 16-bit JPEG2000-RCT was implemented - without this issue in one implementation and validated by one - conformance checker. Methods to address this exception for the - transform are under consideration for the next version of the FFV1 - bitstream. + inclusive and alpha_plane is 0, GBR planes were used as BGR planes + during both encoding and decoding. In the meanwhile, 16-bit + JPEG2000-RCT was implemented without this issue in one implementation + and validated by one conformance checker. Methods to address this + exception for the transform are under consideration for the next + version of the FFV1 bitstream. [ISO.15444-1.2016] When FFV1 uses the JPEG2000-RCT, the horizontal lines are interleaved to improve caching efficiency since it is most likely that the RCT will immediately be converted to RGB during decoding. The interleaved coding order is also Y, then Cb, then Cr, and then if used Alpha. As an example, a "Frame" that is two pixels wide and two pixels high, @@ -666,21 +670,21 @@ R_{0} = 65280 L_{0} = 2^8 * B_{0} + B_{1} j_{0} = 2 3.8.1.2. Range non binary values To encode scalar integers, it would be possible to encode each bit separately and use the past bits as context. However that would mean - 255 contexts per 8-bit symbol which is not only a waste of memory but + 255 contexts per 8-bit symbol that is not only a waste of memory but also requires more past data to reach a reasonably good estimate of the probabilities. Alternatively assuming a Laplacian distribution and only dealing with its variance and mean (as in Huffman coding) would also be possible, however, for maximum flexibility and simplicity, the chosen method uses a single symbol to encode if a number is 0 and if not encodes the number using its exponent, mantissa and sign. The exact contexts used are best described by the following code, followed by some comments. pseudo-code | type @@ -788,24 +792,24 @@ 209,211,221,212,213,215,224,216,217,218,219,220,222,228,223,225, 226,224,227,229,240,230,231,232,233,234,235,236,238,239,237,242, 241,243,242,244,245,246,247,248,249,250,251,252,252,253,254,255, 3.8.2. Golomb Rice mode This coding mode uses Golomb Rice codes. The VLC is split into 2 - parts, the prefix stores the most significant bits, the suffix stores - the k least significant bits or stores the whole number in the ESC - case. The end of the bitstream of the "Frame" is filled with 0-bits - until that the bitstream contains a multiple of 8 bits. + parts, the prefix stores the most significant bits and the suffix + stores the k least significant bits or stores the whole number in the + ESC case. The end of the bitstream of the "Frame" is filled with + 0-bits until that the bitstream contains a multiple of 8 bits. 3.8.2.1. Prefix +----------------+-------+ | bits | value | +----------------+-------+ | 1 | 0 | | 01 | 1 | | ... | ... | | 0000 0000 0001 | 11 | @@ -831,26 +835,26 @@ | 2 | "1 00" | 0 | | 2 | "1 10" | 2 | | 2 | "01 01" | 5 | | any | "000000000000 10000000" | 139 | +-----+-------------------------+-------+ 3.8.2.4. Run mode Run mode is entered when the context is 0 and left as soon as a non-0 difference is found. The level is identical to the predicted one. - The run and the first different level is coded. + The run and the first different level are coded. 3.8.2.5. Run length coding The run value is encoded in 2 parts, the prefix part stores the more - significant part of the run as well as adjusting the run_index which + significant part of the run as well as adjusting the run_index that determines the number of bits in the less significant part of the run. The 2nd part of the value stores the less significant part of the run as it is. The run_index is reset for each plane and slice to 0. pseudo-code | type --------------------------------------------------------------|----- log2_run[41]={ | 0, 0, 0, 0, 1, 1, 1, 1, | 2, 2, 2, 2, 3, 3, 3, 3, | @@ -899,41 +903,41 @@ | sg | Golomb Rice coded signed scalar symbol coded with the | | | method described in Section 3.8.2 | | br | Range coded Boolean (1-bit) symbol with the method | | | described in Section 3.8.1.1 | | ur | Range coded unsigned scalar symbol coded with the method | | | described in Section 3.8.1.2 | | sr | Range coded signed scalar symbol coded with the method | | | described in Section 3.8.1.2 | +--------+----------------------------------------------------------+ - The same context which is initialized to 128 is used for all fields - in the header. + The same context that is initialized to 128 is used for all fields in + the header. The following MUST be provided by external means during initialization of the decoder: "frame_pixel_width" is defined as "Frame" width in pixels. "frame_pixel_height" is defined as "Frame" height in pixels. Default values at the decoder initialization phase: "ConfigurationRecordIsPresent" is set to 0. 4.1. Configuration Record In the case of a FFV1 bitstream with "version >= 3", a "Configuration - Record" is stored in the underlying container, at the track header + Record" is stored in the underlying "Container", at the track header level. It contains the parameters used for all instances of "Frame". The size of the "Configuration Record", "NumBytes", is supplied by - the underlying container. + the underlying "Container". pseudo-code | type --------------------------------------------------------------|----- ConfigurationRecord( NumBytes ) { | ConfigurationRecordIsPresent = 1 | Parameters( ) | while( remaining_bits_in_bitstream( NumBytes ) > 32 ) | reserved_for_future_use | u(1) configuration_record_crc_parity | u(32) } | @@ -955,37 +959,37 @@ The CRC generator polynomial used is the standard IEEE CRC polynomial (0x104C11DB7) with initial value 0. 4.1.3. Mapping FFV1 into Containers This "Configuration Record" can be placed in any file format supporting "Configuration Records", fitting as much as possible with how the file format uses to store "Configuration Records". The "Configuration Record" storage place and "NumBytes" are currently defined and supported by this version of this specification for the - following container formats: + following formats: 4.1.3.1. AVI File Format The "Configuration Record" extends the stream format chunk ("AVI ", "hdlr", "strl", "strf") with the ConfigurationRecord bitstream. See [AVI] for more information about chunks. "NumBytes" is defined as the size, in bytes, of the strf chunk indicated in the chunk header minus the size of the stream format structure. 4.1.3.2. ISO Base Media File Format The "Configuration Record" extends the sample description box ("moov", "trak", "mdia", "minf", "stbl", "stsd") with a "glbl" box - which contains the ConfigurationRecord bitstream. See + that contains the ConfigurationRecord bitstream. See [ISO.14496-12.2015] for more information about boxes. "NumBytes" is defined as the size, in bytes, of the "glbl" box indicated in the box header minus the size of the box header. 4.1.3.3. NUT File Format The codec_specific_data element (in "stream_header" packet) contains the ConfigurationRecord bitstream. See [NUT] for more information about elements. @@ -1044,24 +1048,20 @@ SliceHeader( ) { | slice_x | ur slice_y | ur slice_width - 1 | ur slice_height - 1 | ur for( i = 0; i < quant_table_set_index_count; i++ ) | quant_table_set_index [ i ] | ur picture_structure | ur sar_num | ur sar_den | ur - if (version >= 4) { | - reset_contexts | br - slice_coding_mode | ur - } | } | 4.4.1. slice_x "slice_x" indicates the x position on the slice raster formed by num_h_slices. Inferred to be 0 if not present. 4.4.2. slice_y @@ -1114,38 +1114,20 @@ "sar_num" specifies the sample aspect ratio numerator. Inferred to be 0 if not present. MUST be 0 if sample aspect ratio is unknown. 4.4.9. sar_den "sar_den" specifies the sample aspect ratio numerator. Inferred to be 0 if not present. MUST be 0 if sample aspect ratio is unknown. -4.4.10. reset_contexts - - "reset_contexts" indicates if slice contexts must be reset. - Inferred to be 0 if not present. - -4.4.11. slice_coding_mode - - "slice_coding_mode" indicates the slice coding mode. - Inferred to be 0 if not present. - - +-------+-----------------------------+ - | value | slice coding mode | - +-------+-----------------------------+ - | 0 | Range Coding or Golomb Rice | - | 1 | raw PCM | - | Other | reserved for future use | - +-------+-----------------------------+ - 4.5. Slice Content pseudo-code | type --------------------------------------------------------------|----- SliceContent( ) { | if (colorspace_type == 0) { | for( p = 0; p < primary_color_count; p++ ) | for( y = 0; y < plane_pixel_height[ p ]; y++ ) | Line( p, y ) | } else if (colorspace_type == 1) { | @@ -1212,22 +1194,23 @@ num_h_slices) - slice_pixel_x". 4.6.3. slice_pixel_x "slice_pixel_x" is the slice horizontal position in pixels. Its value is "floor(slice_x * frame_pixel_width / num_h_slices)". 4.6.4. sample_difference "sample_difference[ p ][ y ][ x ]" is the sample difference for - sample at plane "p", y position "y" and x position "x". Sample value - is computed based on prediction and context described in Section 3.2. + sample at plane "p", y position "y", and x position "x". The sample + value is computed based on prediction and context described in + Section 3.2. 4.7. Slice Footer Note: slice footer is always byte aligned. pseudo-code | type --------------------------------------------------------------|----- SliceFooter( ) { | slice_size | u(24) if (ec) { | @@ -1339,37 +1322,21 @@ Meaning of micro_version for version 3: +-------+-------------------------+ | value | micro_version | +-------+-------------------------+ | 0...3 | reserved* | | 4 | first stable variant | | Other | reserved for future use | +-------+-------------------------+ - * development versions which may be incompatible with the stable - variants. - - Meaning of micro_version for version 4 (note: at the time of writing - of this specification, version 4 is not considered stable so the - first stable version value is to be announced in the future): - - +---------+-------------------------+ - | value | micro_version | - +---------+-------------------------+ - | 0...TBA | reserved* | - | TBA | first stable variant | - | Other | reserved for future use | - +---------+-------------------------+ - - * development versions which may be incompatible with the stable - variants. + * development versions may be incompatible with the stable variants. 4.8.3. coder_type "coder_type" specifies the coder used. +-------+-------------------------------------------------+ | value | coder used | +-------+-------------------------------------------------+ | 0 | Golomb Rice | | 1 | Range Coder with default state transition table | @@ -1395,22 +1362,23 @@ | | losslessly encoded | | method | +-------+---------------------+------------------+------------------+ | 0 | YCbCr | No Pixel | plane then line | | | | transformation | | | 1 | RGB | JPEG2000-RCT | line then plane | | Other | reserved for future | reserved for | reserved for | | | use | future use | future use | +-------+---------------------+------------------+------------------+ Restrictions: - If "colorspace_type" is 1, "chroma_planes" MUST be 1, - "h_chroma_subsample" MUST be 1, "v_chroma_subsample" MUST be 1. + If "colorspace_type" is 1, then "chroma_planes" MUST be 1, + "log2_h_chroma_subsample" MUST be 0, and "log2_v_chroma_subsample" + MUST be 0. 4.8.6. chroma_planes "chroma_planes" indicates if chroma (color) planes are present. +-------+-------------------------------+ | value | presence | +-------+-------------------------------+ | 0 | chroma planes are not present | | 1 | chroma planes are present | @@ -1522,37 +1490,40 @@ | 1 | Frames are independent (keyframes only) | | Other | reserved for future use | +-------+-----------------------------------------------------------+ 4.9. Quantization Table Set The Quantization Table Sets are stored by storing the number of equal entries -1 of the first half of the table (represented as "len - 1" in the pseudo-code below) using the method described in Section 3.8.1.2. The second half doesn't need to be stored as it is - identical to the first with flipped sign. + identical to the first with flipped sign. "scale" and "len_count[ i + ][ j ]" are temporary values used for the computing of + "context_count[ i ]" and are not used outside Quantization Table Set + pseudo-code. example: Table: 0 0 1 1 1 1 2 2 -2 -2 -2 -1 -1 -1 -1 0 Stored values: 1, 3, 1 pseudo-code | type --------------------------------------------------------------|----- QuantizationTableSet( i ) { | scale = 1 | for( j = 0; j < MAX_CONTEXT_INPUTS; j++ ) { | QuantizationTable( i, j, scale ) | scale *= 2 * len_count[ i ][ j ] - 1 | } | - context_count[ i ] = ( scale + 1 ) / 2 | + context_count[ i ] = ceil ( scale / 2 ) | } | MAX_CONTEXT_INPUTS is 5. pseudo-code | type --------------------------------------------------------------|----- QuantizationTable(i, j, scale) { | v = 0 | for( k = 0; k < 128; ) { | len - 1 | ur @@ -1590,21 +1561,21 @@ num_h_slices * num_v_slices / 4. Note: 101376 is the frame size in pixels of a 352x288 frame also known as CIF ("Common Intermediate Format") frame size format. For each "Frame", each position in the slice raster MUST be filled by one and only one slice of the "Frame" (no missing slice position, no slice overlapping). For each "Frame" with keyframe value of 0, each slice MUST have the same value of slice_x, slice_y, slice_width, slice_height as a slice - in the previous "Frame", except if reset_contexts is 1. + in the previous "Frame". 6. Security Considerations Like any other codec, (such as [RFC6716]), FFV1 should not be used with insecure ciphers or cipher-modes that are vulnerable to known plaintext attacks. Some of the header bits as well as the padding are easily predictable. Implementations of the FFV1 codec need to take appropriate security considerations into account, as outlined in [RFC4732]. It is @@ -1622,37 +1593,118 @@ The reference implementation [REFIMPL] contains no known buffer overflow or cases where a specially crafted packet or video segment could cause a significant increase in CPU load. The reference implementation [REFIMPL] was validated in the following conditions: o Sending the decoder valid packets generated by the reference encoder and verifying that the decoder's output matches the - encoders input. + encoder's input. o Sending the decoder packets generated by the reference encoder and then subjected to random corruption. o Sending the decoder random packets that are not FFV1. In all of the conditions above, the decoder and encoder was run inside the [VALGRIND] memory debugger as well as clangs address sanitizer [Address-Sanitizer], which track reads and writes to invalid memory regions as well as the use of uninitialized memory. There were no errors reported on any of the tested conditions. -7. Appendixes -7.1. Decoder implementation suggestions +7. Media Type Definition -7.1.1. Multi-threading support and independence of slices + This registration is done using the template defined in [RFC6838] and + following [RFC4855]. + + Type name: video + + Subtype name: FFV1 + + Required parameters: None. + + Optional parameters: + + This parameter is used to signal the capabilities of a receiver + implementation. This parameter MUST NOT be used for any other + purpose. + + version: The version of the FFV1 encoding as defined by + Section 4.8.1. + + micro_version: The micro_version of the FFV1 encoding as defined by + Section 4.8.2. + + coder_type: The coder_type of the FFV1 encoding as defined by + Section 4.8.3. + + colorspace_type: The colorspace_type of the FFV1 encoding as defined + by Section 4.8.5. + + bits_per_raw_sample: The version of the FFV1 encoding as defined by + Section 4.8.7. + + max-slices: The value of max-slices is an integer indicating the + maximum count of slices with a frames of the FFV1 encoding. + + Encoding considerations: + + This media type is defined for encapsulation in several audiovisual + container formats and contains binary data; see Section 4.1.3. This + media type is framed binary data Section 4.8 of [RFC4288]. + + Security considerations: + + See Section 6 of this document. + + Interoperability considerations: None. + + Published specification: + + [I-D.ietf-cellar-ffv1] and RFC XXXX. + + [RFC Editor: Upon publication as an RFC, please replace "XXXX" with + the number assigned to this document and remove this note.] + Applications which use this media type: + + Any application that requires the transport of lossless video can use + this media type. Some examples are, but not limited to screen + recording, scientific imaging, and digital video preservation. + + Fragment identifier considerations: N/A. + + Additional information: None. + + Person & email address to contact for further information: Michael + Niedermayer + + Intended usage: COMMON + + Restrictions on usage: None. + + Author: Dave Rice + + Change controller: IETF cellar working group delegated from the IESG. + +8. IANA Considerations + + The IANA is requested to register the following values: + + o Media type registration as described in Section 7. + +9. Appendixes + +9.1. Decoder implementation suggestions + +9.1.1. Multi-threading support and independence of slices The FFV1 bitstream is parsable in two ways: in sequential order as described in this document or with the pre-analysis of the footer of each slice. Each slice footer contains a slice_size field so the boundary of each slice is computable without having to parse the slice content. That allows multi-threading as well as independence of slice content (a bitstream error in a slice header or slice content has no impact on the decoding of the other slices). After having checked keyframe field, a decoder SHOULD parse @@ -1674,47 +1726,65 @@ | second slice content | | second slice footer | | --------------------------------------------------------------- | | ... | | --------------------------------------------------------------- | | last slice header | | last slice content | | last slice footer | +-----------------------------------------------------------------+ -8. Changelog +10. Changelog See -9. ToDo +11. ToDo o mean,k estimation for the Golomb Rice codes -10. References +12. References -10.1. Normative References +12.1. Normative References + + [I-D.ietf-cellar-ffv1] + Niedermayer, M., Rice, D., and J. Martinez, "FF Video + Codec 1", draft-ietf-cellar-ffv1-01 (work in progress), + January 2018. [ISO.15444-1.2016] International Organization for Standardization, "Information technology -- JPEG 2000 image coding system: Core coding system", October 2016. [ISO.9899.1990] International Organization for Standardization, "Programming languages - C", ISO Standard 9899, 1990. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . -10.2. Informative References + [RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and + Registration Procedures", RFC 4288, DOI 10.17487/RFC4288, + December 2005, . + + [RFC4855] Casner, S., "Media Type Registration of RTP Payload + Formats", RFC 4855, DOI 10.17487/RFC4855, February 2007, + . + + [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type + Specifications and Registration Procedures", BCP 13, + RFC 6838, DOI 10.17487/RFC6838, January 2013, + . + +12.2. Informative References [Address-Sanitizer] The Clang Team, "ASAN AddressSanitizer website", undated, . [AVI] Microsoft, "AVI RIFF File Reference", undated, . [FFV1_V0] Niedermayer, M., "Commit to mark FFV1 version 0 as non-