draft-ietf-cellar-ffv1-03.txt | draft-ietf-cellar-ffv1-04.txt | |||
---|---|---|---|---|
cellar M. Niedermayer | cellar M. Niedermayer | |||
Internet-Draft | Internet-Draft | |||
Intended status: Informational D. Rice | Intended status: Informational D. Rice | |||
Expires: December 2, 2018 | Expires: January 28, 2019 | |||
J. Martinez | J. Martinez | |||
May 31, 2018 | July 27, 2018 | |||
FFV1 Video Coding Format Version 0, 1, and 3 | FFV1 Video Coding Format Version 0, 1, and 3 | |||
draft-ietf-cellar-ffv1-03 | draft-ietf-cellar-ffv1-04 | |||
Abstract | Abstract | |||
This document defines FFV1, a lossless intra-frame video encoding | This document defines FFV1, a lossless intra-frame video encoding | |||
format. FFV1 is designed to efficiently compress video data in a | format. FFV1 is designed to efficiently compress video data in a | |||
variety of pixel formats. Compared to uncompressed video, FFV1 | variety of pixel formats. Compared to uncompressed video, FFV1 | |||
offers storage compression, frame fixity, and self-description, which | offers storage compression, frame fixity, and self-description, which | |||
makes FFV1 useful as a preservation or intermediate video format. | makes FFV1 useful as a preservation or intermediate video format. | |||
Status of This Memo | Status of This Memo | |||
skipping to change at page 1, line 36 ¶ | skipping to change at page 1, line 36 ¶ | |||
Internet-Drafts are working documents of the Internet Engineering | Internet-Drafts are working documents of the Internet Engineering | |||
Task Force (IETF). Note that other groups may also distribute | Task Force (IETF). Note that other groups may also distribute | |||
working documents as Internet-Drafts. The list of current Internet- | working documents as Internet-Drafts. The list of current Internet- | |||
Drafts is at https://datatracker.ietf.org/drafts/current/. | Drafts is at https://datatracker.ietf.org/drafts/current/. | |||
Internet-Drafts are draft documents valid for a maximum of six months | Internet-Drafts are draft documents valid for a maximum of six months | |||
and may be updated, replaced, or obsoleted by other documents at any | and may be updated, replaced, or obsoleted by other documents at any | |||
time. It is inappropriate to use Internet-Drafts as reference | time. It is inappropriate to use Internet-Drafts as reference | |||
material or to cite them other than as "work in progress." | material or to cite them other than as "work in progress." | |||
This Internet-Draft will expire on December 2, 2018. | This Internet-Draft will expire on January 28, 2019. | |||
Copyright Notice | Copyright Notice | |||
Copyright (c) 2018 IETF Trust and the persons identified as the | Copyright (c) 2018 IETF Trust and the persons identified as the | |||
document authors. All rights reserved. | document authors. All rights reserved. | |||
This document is subject to BCP 78 and the IETF Trust's Legal | This document is subject to BCP 78 and the IETF Trust's Legal | |||
Provisions Relating to IETF Documents | Provisions Relating to IETF Documents | |||
(https://trustee.ietf.org/license-info) in effect on the date of | (https://trustee.ietf.org/license-info) in effect on the date of | |||
publication of this document. Please review these documents | publication of this document. Please review these documents | |||
skipping to change at page 2, line 13 ¶ | skipping to change at page 2, line 13 ¶ | |||
include Simplified BSD License text as described in Section 4.e of | include Simplified BSD License text as described in Section 4.e of | |||
the Trust Legal Provisions and are provided without warranty as | the Trust Legal Provisions and are provided without warranty as | |||
described in the Simplified BSD License. | described in the Simplified BSD License. | |||
Table of Contents | Table of Contents | |||
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 | |||
2. Notation and Conventions . . . . . . . . . . . . . . . . . . 4 | 2. Notation and Conventions . . . . . . . . . . . . . . . . . . 4 | |||
2.1. Definitions . . . . . . . . . . . . . . . . . . . . . . . 4 | 2.1. Definitions . . . . . . . . . . . . . . . . . . . . . . . 4 | |||
2.2. Conventions . . . . . . . . . . . . . . . . . . . . . . . 5 | 2.2. Conventions . . . . . . . . . . . . . . . . . . . . . . . 5 | |||
2.2.1. Arithmetic operators . . . . . . . . . . . . . . . . 5 | 2.2.1. Pseudo-code . . . . . . . . . . . . . . . . . . . . . 5 | |||
2.2.2. Assignment operators . . . . . . . . . . . . . . . . 6 | 2.2.2. Arithmetic Operators . . . . . . . . . . . . . . . . 6 | |||
2.2.3. Comparison operators . . . . . . . . . . . . . . . . 6 | 2.2.3. Assignment Operators . . . . . . . . . . . . . . . . 6 | |||
2.2.4. Mathematical functions . . . . . . . . . . . . . . . 7 | 2.2.4. Comparison Operators . . . . . . . . . . . . . . . . 6 | |||
2.2.5. Order of operation precedence . . . . . . . . . . . . 7 | 2.2.5. Mathematical Functions . . . . . . . . . . . . . . . 7 | |||
2.2.6. Pseudo-code . . . . . . . . . . . . . . . . . . . . . 8 | 2.2.6. Order of Operation Precedence . . . . . . . . . . . . 7 | |||
2.2.7. Range . . . . . . . . . . . . . . . . . . . . . . . . 8 | 2.2.7. Range . . . . . . . . . . . . . . . . . . . . . . . . 8 | |||
2.2.8. NumBytes . . . . . . . . . . . . . . . . . . . . . . 8 | 2.2.8. NumBytes . . . . . . . . . . . . . . . . . . . . . . 8 | |||
2.2.9. Bitstream functions . . . . . . . . . . . . . . . . . 8 | 2.2.9. Bitstream Functions . . . . . . . . . . . . . . . . . 8 | |||
3. General Description . . . . . . . . . . . . . . . . . . . . . 8 | 3. General Description . . . . . . . . . . . . . . . . . . . . . 9 | |||
3.1. Border . . . . . . . . . . . . . . . . . . . . . . . . . 9 | 3.1. Border . . . . . . . . . . . . . . . . . . . . . . . . . 9 | |||
3.2. Samples . . . . . . . . . . . . . . . . . . . . . . . . . 9 | 3.2. Samples . . . . . . . . . . . . . . . . . . . . . . . . . 9 | |||
3.3. Median predictor . . . . . . . . . . . . . . . . . . . . 10 | 3.3. Median Predictor . . . . . . . . . . . . . . . . . . . . 10 | |||
3.4. Context . . . . . . . . . . . . . . . . . . . . . . . . . 10 | 3.4. Context . . . . . . . . . . . . . . . . . . . . . . . . . 11 | |||
3.5. Quantization Table Sets . . . . . . . . . . . . . . . . . 11 | 3.5. Quantization Table Sets . . . . . . . . . . . . . . . . . 11 | |||
3.6. Quantization Table Set indexes . . . . . . . . . . . . . 11 | 3.6. Quantization Table Set Indexes . . . . . . . . . . . . . 11 | |||
3.7. Color spaces . . . . . . . . . . . . . . . . . . . . . . 12 | 3.7. Color spaces . . . . . . . . . . . . . . . . . . . . . . 12 | |||
3.7.1. YCbCr . . . . . . . . . . . . . . . . . . . . . . . . 12 | 3.7.1. YCbCr . . . . . . . . . . . . . . . . . . . . . . . . 12 | |||
3.7.2. RGB . . . . . . . . . . . . . . . . . . . . . . . . . 12 | 3.7.2. RGB . . . . . . . . . . . . . . . . . . . . . . . . . 12 | |||
3.8. Coding of the Sample Difference . . . . . . . . . . . . . 14 | 3.8. Coding of the Sample Difference . . . . . . . . . . . . . 14 | |||
3.8.1. Range coding mode . . . . . . . . . . . . . . . . . . 14 | 3.8.1. Range Coding Mode . . . . . . . . . . . . . . . . . . 14 | |||
3.8.2. Golomb Rice mode . . . . . . . . . . . . . . . . . . 17 | 3.8.2. Golomb Rice Mode . . . . . . . . . . . . . . . . . . 17 | |||
4. Bitstream . . . . . . . . . . . . . . . . . . . . . . . . . . 19 | 4. Bitstream . . . . . . . . . . . . . . . . . . . . . . . . . . 19 | |||
4.1. Configuration Record . . . . . . . . . . . . . . . . . . 20 | 4.1. Parameters . . . . . . . . . . . . . . . . . . . . . . . 20 | |||
4.1.1. reserved_for_future_use . . . . . . . . . . . . . . . 21 | 4.1.1. version . . . . . . . . . . . . . . . . . . . . . . . 21 | |||
4.1.2. configuration_record_crc_parity . . . . . . . . . . . 21 | 4.1.2. micro_version . . . . . . . . . . . . . . . . . . . . 22 | |||
4.1.3. Mapping FFV1 into Containers . . . . . . . . . . . . 21 | 4.1.3. coder_type . . . . . . . . . . . . . . . . . . . . . 22 | |||
4.2. Frame . . . . . . . . . . . . . . . . . . . . . . . . . . 22 | 4.1.4. state_transition_delta . . . . . . . . . . . . . . . 23 | |||
4.3. Slice . . . . . . . . . . . . . . . . . . . . . . . . . . 22 | 4.1.5. colorspace_type . . . . . . . . . . . . . . . . . . . 23 | |||
4.4. Slice Header . . . . . . . . . . . . . . . . . . . . . . 23 | 4.1.6. chroma_planes . . . . . . . . . . . . . . . . . . . . 23 | |||
4.4.1. slice_x . . . . . . . . . . . . . . . . . . . . . . . 23 | 4.1.7. bits_per_raw_sample . . . . . . . . . . . . . . . . . 23 | |||
4.4.2. slice_y . . . . . . . . . . . . . . . . . . . . . . . 23 | 4.1.8. log2_h_chroma_subsample . . . . . . . . . . . . . . . 24 | |||
4.4.3. slice_width . . . . . . . . . . . . . . . . . . . . . 24 | 4.1.9. log2_v_chroma_subsample . . . . . . . . . . . . . . . 24 | |||
4.4.4. slice_height . . . . . . . . . . . . . . . . . . . . 24 | 4.1.10. alpha_plane . . . . . . . . . . . . . . . . . . . . . 24 | |||
4.4.5. quant_table_set_index_count . . . . . . . . . . . . . 24 | 4.1.11. num_h_slices . . . . . . . . . . . . . . . . . . . . 24 | |||
4.4.6. quant_table_set_index . . . . . . . . . . . . . . . . 24 | 4.1.12. num_v_slices . . . . . . . . . . . . . . . . . . . . 24 | |||
4.4.7. picture_structure . . . . . . . . . . . . . . . . . . 24 | 4.1.13. quant_table_set_count . . . . . . . . . . . . . . . . 25 | |||
4.4.8. sar_num . . . . . . . . . . . . . . . . . . . . . . . 24 | 4.1.14. states_coded . . . . . . . . . . . . . . . . . . . . 25 | |||
4.4.9. sar_den . . . . . . . . . . . . . . . . . . . . . . . 25 | 4.1.15. initial_state_delta . . . . . . . . . . . . . . . . . 25 | |||
4.1.16. ec . . . . . . . . . . . . . . . . . . . . . . . . . 25 | ||||
4.5. Slice Content . . . . . . . . . . . . . . . . . . . . . . 25 | 4.1.17. intra . . . . . . . . . . . . . . . . . . . . . . . . 25 | |||
4.5.1. primary_color_count . . . . . . . . . . . . . . . . . 25 | 4.2. Configuration Record . . . . . . . . . . . . . . . . . . 26 | |||
4.5.2. plane_pixel_height . . . . . . . . . . . . . . . . . 25 | 4.2.1. reserved_for_future_use . . . . . . . . . . . . . . . 26 | |||
4.5.3. slice_pixel_height . . . . . . . . . . . . . . . . . 25 | 4.2.2. configuration_record_crc_parity . . . . . . . . . . . 26 | |||
4.5.4. slice_pixel_y . . . . . . . . . . . . . . . . . . . . 25 | 4.2.3. Mapping FFV1 into Containers . . . . . . . . . . . . 27 | |||
4.6. Line . . . . . . . . . . . . . . . . . . . . . . . . . . 26 | 4.3. Frame . . . . . . . . . . . . . . . . . . . . . . . . . . 28 | |||
4.6.1. plane_pixel_width . . . . . . . . . . . . . . . . . . 26 | 4.4. Slice . . . . . . . . . . . . . . . . . . . . . . . . . . 28 | |||
4.6.2. slice_pixel_width . . . . . . . . . . . . . . . . . . 26 | 4.5. Slice Header . . . . . . . . . . . . . . . . . . . . . . 29 | |||
4.6.3. slice_pixel_x . . . . . . . . . . . . . . . . . . . . 26 | 4.5.1. slice_x . . . . . . . . . . . . . . . . . . . . . . . 30 | |||
4.6.4. sample_difference . . . . . . . . . . . . . . . . . . 26 | 4.5.2. slice_y . . . . . . . . . . . . . . . . . . . . . . . 30 | |||
4.7. Slice Footer . . . . . . . . . . . . . . . . . . . . . . 26 | 4.5.3. slice_width . . . . . . . . . . . . . . . . . . . . . 30 | |||
4.7.1. slice_size . . . . . . . . . . . . . . . . . . . . . 27 | 4.5.4. slice_height . . . . . . . . . . . . . . . . . . . . 30 | |||
4.7.2. error_status . . . . . . . . . . . . . . . . . . . . 27 | 4.5.5. quant_table_set_index_count . . . . . . . . . . . . . 30 | |||
4.7.3. slice_crc_parity . . . . . . . . . . . . . . . . . . 27 | 4.5.6. quant_table_set_index . . . . . . . . . . . . . . . . 30 | |||
4.8. Parameters . . . . . . . . . . . . . . . . . . . . . . . 27 | 4.5.7. picture_structure . . . . . . . . . . . . . . . . . . 31 | |||
4.8.1. version . . . . . . . . . . . . . . . . . . . . . . . 28 | 4.5.8. sar_num . . . . . . . . . . . . . . . . . . . . . . . 31 | |||
4.8.2. micro_version . . . . . . . . . . . . . . . . . . . . 29 | 4.5.9. sar_den . . . . . . . . . . . . . . . . . . . . . . . 31 | |||
4.8.3. coder_type . . . . . . . . . . . . . . . . . . . . . 29 | 4.6. Slice Content . . . . . . . . . . . . . . . . . . . . . . 31 | |||
4.8.4. state_transition_delta . . . . . . . . . . . . . . . 30 | 4.6.1. primary_color_count . . . . . . . . . . . . . . . . . 32 | |||
4.8.5. colorspace_type . . . . . . . . . . . . . . . . . . . 30 | 4.6.2. plane_pixel_height . . . . . . . . . . . . . . . . . 32 | |||
4.8.6. chroma_planes . . . . . . . . . . . . . . . . . . . . 30 | 4.6.3. slice_pixel_height . . . . . . . . . . . . . . . . . 32 | |||
4.8.7. bits_per_raw_sample . . . . . . . . . . . . . . . . . 30 | 4.6.4. slice_pixel_y . . . . . . . . . . . . . . . . . . . . 32 | |||
4.8.8. log2_h_chroma_subsample . . . . . . . . . . . . . . . 31 | 4.7. Line . . . . . . . . . . . . . . . . . . . . . . . . . . 32 | |||
4.8.9. log2_v_chroma_subsample . . . . . . . . . . . . . . . 31 | 4.7.1. plane_pixel_width . . . . . . . . . . . . . . . . . . 32 | |||
4.8.10. alpha_plane . . . . . . . . . . . . . . . . . . . . . 31 | 4.7.2. slice_pixel_width . . . . . . . . . . . . . . . . . . 33 | |||
4.8.11. num_h_slices . . . . . . . . . . . . . . . . . . . . 31 | 4.7.3. slice_pixel_x . . . . . . . . . . . . . . . . . . . . 33 | |||
4.8.12. num_v_slices . . . . . . . . . . . . . . . . . . . . 31 | 4.7.4. sample_difference . . . . . . . . . . . . . . . . . . 33 | |||
4.8.13. quant_table_set_count . . . . . . . . . . . . . . . . 32 | 4.8. Slice Footer . . . . . . . . . . . . . . . . . . . . . . 33 | |||
4.8.14. states_coded . . . . . . . . . . . . . . . . . . . . 32 | 4.8.1. slice_size . . . . . . . . . . . . . . . . . . . . . 33 | |||
4.8.15. initial_state_delta . . . . . . . . . . . . . . . . . 32 | 4.8.2. error_status . . . . . . . . . . . . . . . . . . . . 33 | |||
4.8.16. ec . . . . . . . . . . . . . . . . . . . . . . . . . 32 | 4.8.3. slice_crc_parity . . . . . . . . . . . . . . . . . . 34 | |||
4.8.17. intra . . . . . . . . . . . . . . . . . . . . . . . . 32 | 4.9. Quantization Table Set . . . . . . . . . . . . . . . . . 34 | |||
4.9. Quantization Table Set . . . . . . . . . . . . . . . . . 33 | 4.9.1. quant_tables . . . . . . . . . . . . . . . . . . . . 35 | |||
4.9.1. quant_tables . . . . . . . . . . . . . . . . . . . . 34 | 4.9.2. context_count . . . . . . . . . . . . . . . . . . . . 35 | |||
4.9.2. context_count . . . . . . . . . . . . . . . . . . . . 34 | 5. Restrictions . . . . . . . . . . . . . . . . . . . . . . . . 35 | |||
5. Restrictions . . . . . . . . . . . . . . . . . . . . . . . . 34 | 6. Security Considerations . . . . . . . . . . . . . . . . . . . 36 | |||
6. Security Considerations . . . . . . . . . . . . . . . . . . . 35 | 7. Media Type Definition . . . . . . . . . . . . . . . . . . . . 36 | |||
7. Media Type Definition . . . . . . . . . . . . . . . . . . . . 35 | 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 38 | |||
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 37 | 9. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . 38 | |||
9. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . 37 | 9.1. Decoder implementation suggestions . . . . . . . . . . . 38 | |||
9.1. Decoder implementation suggestions . . . . . . . . . . . 37 | 9.1.1. Multi-threading Support and Independence of Slices . 38 | |||
9.1.1. Multi-threading support and independence of slices . 37 | 10. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 39 | |||
10. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 38 | 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 39 | |||
11. ToDo . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 | 11.1. Normative References . . . . . . . . . . . . . . . . . . 39 | |||
12. References . . . . . . . . . . . . . . . . . . . . . . . . . 38 | 11.2. Informative References . . . . . . . . . . . . . . . . . 40 | |||
12.1. Normative References . . . . . . . . . . . . . . . . . . 38 | Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 41 | |||
12.2. Informative References . . . . . . . . . . . . . . . . . 39 | ||||
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 40 | ||||
1. Introduction | 1. Introduction | |||
This document describes FFV1, a lossless video encoding format. The | This document describes FFV1, a lossless video encoding format. The | |||
design of FFV1 considers the storage of image characteristics, data | design of FFV1 considers the storage of image characteristics, data | |||
fixity, and the optimized use of encoding time and storage | fixity, and the optimized use of encoding time and storage | |||
requirements. FFV1 is designed to support a wide range of lossless | requirements. FFV1 is designed to support a wide range of lossless | |||
video applications such as long-term audiovisual preservation, | video applications such as long-term audiovisual preservation, | |||
scientific imaging, screen recording, and other video encoding | scientific imaging, screen recording, and other video encoding | |||
scenarios that seek to avoid the generational loss of lossy video | scenarios that seek to avoid the generational loss of lossy video | |||
skipping to change at page 4, line 50 ¶ | skipping to change at page 4, line 50 ¶ | |||
[YCbCr]. | [YCbCr]. | |||
2. Notation and Conventions | 2. Notation and Conventions | |||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", | |||
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this | |||
document are to be interpreted as described in [RFC2119]. | document are to be interpreted as described in [RFC2119]. | |||
2.1. Definitions | 2.1. Definitions | |||
"Frame": An encoded representation of a complete static image. | ||||
"Slice": A spatial sub-section of a "Frame" that is encoded | ||||
separately from an other region of the same frame. | ||||
"Container": Format that encapsulates "Frames" and (when required) a | "Container": Format that encapsulates "Frames" and (when required) a | |||
"Configuration Record" into a bitstream. | "Configuration Record" into a bitstream. | |||
"Sample": The smallest addressable representation of a color | "Sample": The smallest addressable representation of a color | |||
component or a luma component in a "Frame". Examples of sample are | component or a luma component in a "Frame". Examples of sample are | |||
Luma, Blue Chrominance, Red Chrominance, Alpha, Red, Green, and Blue. | Luma, Blue Chrominance, Red Chrominance, Alpha, Red, Green, and Blue. | |||
"Pixel": The smallest addressable representation of a color in a | "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. | |||
skipping to change at page 5, line 40 ¶ | skipping to change at page 5, line 46 ¶ | |||
and the chrominance of the Pixel (Cb and Cr). YCbCr word is used for | and the chrominance of the Pixel (Cb and Cr). YCbCr word is used for | |||
historical reasons and currently references any color space relying | historical reasons and currently references any color space relying | |||
on 1 luma sample and 2 chrominance samples e.g. YCbCr, YCgCo or | on 1 luma sample and 2 chrominance samples e.g. YCbCr, YCgCo or | |||
ICtCp. Exact meaning of the three numeric values is unspecified. | ICtCp. Exact meaning of the three numeric values is unspecified. | |||
"TBA": To Be Announced. Used in reference to the development of | "TBA": To Be Announced. Used in reference to the development of | |||
future iterations of the FFV1 specification. | future iterations of the FFV1 specification. | |||
2.2. Conventions | 2.2. Conventions | |||
2.2.1. Pseudo-code | ||||
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] and uses its "if/else", "while" and "for" | ||||
functions as well as functions defined within this document. | ||||
2.2.2. Arithmetic Operators | ||||
Note: the operators and the order of precedence are the same as used | Note: the operators and the order of precedence are the same as used | |||
in the C programming language [ISO.9899.1990]. | in the C programming language [ISO.9899.1990]. | |||
2.2.1. Arithmetic operators | ||||
"a + b" means a plus b. | "a + b" means a plus b. | |||
"a - b" means a minus b. | "a - b" means a minus b. | |||
"-a" means negation of a. | "-a" means negation of a. | |||
"a * b" means a multiplied by b. | "a * b" means a multiplied by b. | |||
"a / b" means a divided by b. | "a / b" means a divided by b. | |||
"a & b" means bit-wise "and" of a and b. | "a & b" means bit-wise "and" of a and b. | |||
"a | b" means bit-wise "or" of a and b. | "a | b" means bit-wise "or" of a and b. | |||
"a >> b" means arithmetic right shift of two's complement integer | "a >> b" means arithmetic right shift of two's complement integer | |||
representation of a by b binary digits. | representation of a by b binary digits. | |||
"a << b" means arithmetic left shift of two's complement integer | "a << b" means arithmetic left shift of two's complement integer | |||
representation of a by b binary digits. | representation of a by b binary digits. | |||
2.2.2. Assignment operators | 2.2.3. Assignment Operators | |||
"a = b" means a is assigned b. | "a = b" means a is assigned b. | |||
"a++" is equivalent to a is assigned a + 1. | "a++" is equivalent to a is assigned a + 1. | |||
"a--" is equivalent to a is assigned a - 1. | "a--" is equivalent to a is assigned a - 1. | |||
"a += b" is equivalent to a is assigned a + b. | "a += b" is equivalent to a is assigned a + b. | |||
"a -= b" is equivalent to a is assigned a - b. | "a -= b" is equivalent to a is assigned a - b. | |||
"a *= b" is equivalent to a is assigned a * b. | "a *= b" is equivalent to a is assigned a * b. | |||
2.2.3. Comparison operators | 2.2.4. Comparison Operators | |||
"a > b" means a is greater than b. | "a > b" means a is greater than b. | |||
"a >= b" means a is greater than or equal to b. | "a >= b" means a is greater than or equal to b. | |||
"a < b" means a is less than b. | "a < b" means a is less than b. | |||
"a <= b" means a is less than or equal b. | "a <= b" means a is less than or equal b. | |||
"a == b" means a is equal to b. | "a == b" means a is equal to b. | |||
skipping to change at page 7, line 5 ¶ | skipping to change at page 7, line 21 ¶ | |||
"a != b" means a is not equal to b. | "a != b" means a is not equal to b. | |||
"a && b" means Boolean logical "and" of a and b. | "a && b" means Boolean logical "and" of a and b. | |||
"a || b" means Boolean logical "or" of a and b. | "a || b" means Boolean logical "or" of a and b. | |||
"!a" means Boolean logical "not" of a. | "!a" means Boolean logical "not" of a. | |||
"a ? b : c" if a is true, then b, otherwise c. | "a ? b : c" if a is true, then b, otherwise c. | |||
2.2.4. Mathematical functions | 2.2.5. Mathematical Functions | |||
floor(a) the largest integer less than or equal to a | floor(a) the largest integer less than or equal to a | |||
ceil(a) the largest integer less than or equal to a | ceil(a) the smallest integer greater than or equal to a | |||
sign(a) extracts the sign of a number, i.e. if a < 0 then -1, else if | sign(a) extracts the sign of a number, i.e. if a < 0 then -1, else if | |||
a > 0 then 1, else 0 | a > 0 then 1, else 0 | |||
abs(a) the absolute value of a, i.e. abs(a) = sign(a)*a | abs(a) the absolute value of a, i.e. abs(a) = sign(a)*a | |||
log2(a) the base-two logarithm of a | log2(a) the base-two logarithm of a | |||
min(a,b) the smallest of two values a and b | min(a,b) the smallest of two values a and b | |||
max(a,b) the largest of two values a and b | max(a,b) the largest of two values a and b | |||
median(a,b,c) the numerical middle value in a data set of a, b, and | median(a,b,c) the numerical middle value in a data set of a, b, and | |||
c, i.e. a+b+c-min(a,b,c)-max(a,b,c) | c, i.e. a+b+c-min(a,b,c)-max(a,b,c) | |||
a_{b} the b-th value of a sequence of a | a_{b} the b-th value of a sequence of a | |||
a_{b,c} the 'b,c'-th value of a sequence of a | a_{b,c} the 'b,c'-th value of a sequence of a | |||
2.2.5. Order of operation precedence | 2.2.6. Order of Operation Precedence | |||
When order of precedence is not indicated explicitly by use of | When order of precedence is not indicated explicitly by use of | |||
parentheses, operations are evaluated in the following order (from | parentheses, operations are evaluated in the following order (from | |||
top to bottom, operations of same precedence being evaluated from | top to bottom, operations of same precedence being evaluated from | |||
left to right). This order of operations is based on the order of | left to right). This order of operations is based on the order of | |||
operations used in Standard C. | operations used in Standard C. | |||
a++, a-- | a++, a-- | |||
!a, -a | !a, -a | |||
a * b, a / b, a % b | a * b, a / b, a % b | |||
skipping to change at page 8, line 5 ¶ | skipping to change at page 8, line 19 ¶ | |||
a << b, a >> b | a << b, a >> b | |||
a < b, a <= b, a > b, a >= b | a < b, a <= b, a > b, a >= b | |||
a == b, a != b | a == b, a != b | |||
a & b | a & b | |||
a | b | a | b | |||
a && b | a && b | |||
a || b | a || b | |||
a ? b : c | a ? b : c | |||
a = b, a += b, a -= b, a *= b | a = b, a += b, a -= b, a *= b | |||
2.2.6. Pseudo-code | ||||
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 | 2.2.7. Range | |||
"a...b" means any value starting from a to b, inclusive. | "a...b" means any value starting from a to b, inclusive. | |||
2.2.8. NumBytes | 2.2.8. NumBytes | |||
"NumBytes" is a non-negative integer that expresses the size in 8-bit | "NumBytes" is a non-negative integer that expresses the size in 8-bit | |||
octets of particular FFV1 "Configuration Record" or "Frame". FFV1 | octets of particular FFV1 "Configuration Record" or "Frame". FFV1 | |||
relies on its "Container" to store the "NumBytes" values, see | relies on its "Container" to store the "NumBytes" values, see | |||
Section 4.1.3. | Section 4.2.3. | |||
2.2.9. Bitstream functions | 2.2.9. Bitstream Functions | |||
2.2.9.1. remaining_bits_in_bitstream | 2.2.9.1. remaining_bits_in_bitstream | |||
"remaining_bits_in_bitstream( )" means the count of remaining bits | "remaining_bits_in_bitstream( )" means the count of remaining bits | |||
after the pointer in that "Configuration Record" or "Frame". It is | after the pointer in that "Configuration Record" or "Frame". It is | |||
computed from the "NumBytes" value multiplied by 8 minus the count of | computed from the "NumBytes" value multiplied by 8 minus the count of | |||
bits of that "Configuration Record" or "Frame" already read by the | bits of that "Configuration Record" or "Frame" already read by the | |||
bitstream parser. | bitstream parser. | |||
2.2.9.2. byte_aligned | 2.2.9.2. byte_aligned | |||
skipping to change at page 10, line 8 ¶ | skipping to change at page 10, line 16 ¶ | |||
| | | T | | | | | | T | | | |||
+---+---+---+---+ | +---+---+---+---+ | |||
| |tl | t |tr | | | |tl | t |tr | | |||
+---+---+---+---+ | +---+---+---+---+ | |||
| L | l | X | | | | L | l | X | | | |||
+---+---+---+---+ | +---+---+---+---+ | |||
"X" is the current processed Sample. The identifiers are made of the | "X" is the current processed Sample. The identifiers are made of the | |||
first letters of the words Top, Left and Right. | first letters of the words Top, Left and Right. | |||
3.3. Median predictor | 3.3. Median Predictor | |||
The prediction for any sample value at position "X" may be computed | The prediction for any sample value at position "X" may be computed | |||
based upon the relative neighboring values of "l", "t", and "tl" via | based upon the relative neighboring values of "l", "t", and "tl" via | |||
this equation: | this equation: | |||
"median(l, t, l + t - tl)". | "median(l, t, l + t - tl)". | |||
Note, this prediction template is also used in [ISO.14495-1.1999] and | Note, this prediction template is also used in [ISO.14495-1.1999] and | |||
[HuffYUV]. | [HuffYUV]. | |||
skipping to change at page 10, line 40 ¶ | skipping to change at page 10, line 48 ¶ | |||
Background: a two's complement signed 16-bit signed integer was used | Background: a two's complement signed 16-bit signed integer was used | |||
for storing sample values in all known implementations of FFV1 | for storing sample values in all known implementations of FFV1 | |||
bitstream. So in some circumstances, the most significant bit was | bitstream. So in some circumstances, the most significant bit was | |||
wrongly interpreted (used as a sign bit instead of the 16th bit of an | wrongly interpreted (used as a sign bit instead of the 16th bit of an | |||
unsigned integer). Note that when the issue is discovered, the only | unsigned integer). Note that when the issue is discovered, the only | |||
configuration of all known implementations being impacted is 16-bit | configuration of all known implementations being impacted is 16-bit | |||
YCbCr with no Pixel transformation with Range Coder coder, as other | YCbCr with no Pixel transformation with Range Coder coder, as other | |||
potentially impacted configurations (e.g. 15/16-bit JPEG2000-RCT with | potentially impacted configurations (e.g. 15/16-bit JPEG2000-RCT with | |||
Range Coder coder, or 16-bit content with Golomb Rice coder) were | Range Coder coder, or 16-bit content with Golomb Rice coder) were | |||
implemented nowhere. In the meanwhile, 16-bit JPEG2000-RCT with | implemented nowhere [ISO.15444-1.2016]. In the meanwhile, 16-bit | |||
Range Coder coder was implemented without this issue in one | JPEG2000-RCT with Range Coder coder was implemented without this | |||
implementation and validated by one conformance checker. It is | issue in one implementation and validated by one conformance checker. | |||
expected (to be confirmed) to remove this exception for the media | It is expected (to be confirmed) to remove this exception for the | |||
predictor in the next version of the FFV1 bitstream. | media predictor in the next version of the FFV1 bitstream. | |||
3.4. Context | 3.4. Context | |||
Relative to any sample "X", the Quantized Sample Differences "L-l", | Relative to any sample "X", the Quantized Sample Differences "L-l", | |||
"l-tl", "tl-t", "T-t", and "t-tr" are used as context: | "l-tl", "tl-t", "T-t", and "t-tr" are used as context: | |||
context = Q_{0}[l - tl] + | context = Q_{0}[l - tl] + | |||
Q_{1}[tl - t] + | Q_{1}[tl - t] + | |||
Q_{2}[t - tr] + | Q_{2}[t - tr] + | |||
Q_{3}[L - l] + | Q_{3}[L - l] + | |||
skipping to change at page 11, line 32 ¶ | skipping to change at page 11, line 37 ¶ | |||
quantization steps and their distribution are stored in the FFV1 | quantization steps and their distribution are stored in the FFV1 | |||
bitstream; each Quantization Table has exactly 256 entries, and the 8 | bitstream; each Quantization Table has exactly 256 entries, and the 8 | |||
least significant bits of the Quantized Sample Difference are used as | least significant bits of the Quantized Sample Difference are used as | |||
index: | index: | |||
Q_{j}[k] = quant_tables[i][j][k&255] | Q_{j}[k] = quant_tables[i][j][k&255] | |||
In this formula, "i" is the Quantization Table Set index, "j" is the | In this formula, "i" is the Quantization Table Set index, "j" is the | |||
Quantized Table index, "k" the Quantized Sample Difference. | Quantized Table index, "k" the Quantized Sample Difference. | |||
3.6. Quantization Table Set indexes | 3.6. Quantization Table Set Indexes | |||
For each plane of each slice, a Quantization Table Set is selected | For each plane of each slice, a Quantization Table Set is selected | |||
from an index: | from an index: | |||
o For Y plane, "quant_table_set_index [ 0 ]" index is used | o For Y plane, "quant_table_set_index [ 0 ]" index is used | |||
o For Cb and Cr planes, "quant_table_set_index [ 1 ]" index is used | o For Cb and Cr planes, "quant_table_set_index [ 1 ]" index is used | |||
o For Alpha plane, "quant_table_set_index [ (version <= 3 || | o For Alpha plane, "quant_table_set_index [ (version <= 3 || | |||
chroma_planes) ? 2 : 1 ]" index is used | chroma_planes) ? 2 : 1 ]" index is used | |||
skipping to change at page 12, line 33 ¶ | skipping to change at page 12, line 33 ¶ | |||
o Y, Cb, Cr, Alpha | o Y, Cb, Cr, Alpha | |||
The Y plane MUST be coded first. If the Cb and Cr planes are used | The Y plane MUST be coded first. If the Cb and Cr planes are used | |||
then they MUST be coded after the Y plane. If an Alpha | then they MUST be coded after the Y plane. If an Alpha | |||
(transparency) plane is used, then it MUST be coded last. | (transparency) plane is used, then it MUST be coded last. | |||
3.7.2. RGB | 3.7.2. RGB | |||
JPEG2000-RCT is a Reversible Color Transform that codes RGB (red, | JPEG2000-RCT is a Reversible Color Transform that codes RGB (red, | |||
green, blue) planes losslessly in a modified YCbCr color space. | green, blue) planes losslessly in a modified YCbCr color space | |||
Reversible Pixel transformations between YCbCr and RGB use the | [ISO.15444-1.2016]. Reversible Pixel transformations between YCbCr | |||
following formulae. | and RGB use the following formulae. | |||
Cb=b-g | Cb=b-g | |||
Cr=r-g | Cr=r-g | |||
Y=g+(Cb+Cr)>>2 | Y=g+(Cb+Cr)>>2 | |||
g=Y-(Cb+Cr)>>2 | g=Y-(Cb+Cr)>>2 | |||
r=Cr+g | r=Cr+g | |||
skipping to change at page 13, line 26 ¶ | skipping to change at page 13, line 26 ¶ | |||
Background: At the time of this writing, in all known implementations | Background: At the time of this writing, in all known implementations | |||
of FFV1 bitstream, when bits_per_raw_sample was between 9 and 15 | of FFV1 bitstream, when bits_per_raw_sample was between 9 and 15 | |||
inclusive and alpha_plane is 0, GBR planes were used as BGR planes | inclusive and alpha_plane is 0, GBR planes were used as BGR planes | |||
during both encoding and decoding. In the meanwhile, 16-bit | during both encoding and decoding. In the meanwhile, 16-bit | |||
JPEG2000-RCT was implemented without this issue in one implementation | JPEG2000-RCT was implemented without this issue in one implementation | |||
and validated by one conformance checker. Methods to address this | and validated by one conformance checker. Methods to address this | |||
exception for the transform are under consideration for the next | exception for the transform are under consideration for the next | |||
version of the FFV1 bitstream. | version of the FFV1 bitstream. | |||
[ISO.15444-1.2016] | ||||
When FFV1 uses the JPEG2000-RCT, the horizontal lines are interleaved | When FFV1 uses the JPEG2000-RCT, the horizontal lines are interleaved | |||
to improve caching efficiency since it is most likely that the RCT | to improve caching efficiency since it is most likely that the RCT | |||
will immediately be converted to RGB during decoding. The | will immediately be converted to RGB during decoding. The | |||
interleaved coding order is also Y, then Cb, then Cr, and then if | interleaved coding order is also Y, then Cb, then Cr, and then if | |||
used Alpha. | used Alpha. | |||
As an example, a "Frame" that is two pixels wide and two pixels high, | As an example, a "Frame" that is two pixels wide and two pixels high, | |||
could be comprised of the following structure: | could be comprised of the following structure: | |||
+------------------------+------------------------+ | +------------------------+------------------------+ | |||
skipping to change at page 14, line 17 ¶ | skipping to change at page 14, line 17 ¶ | |||
Instead of coding the n+1 bits of the Sample Difference with Huffman | Instead of coding the n+1 bits of the Sample Difference with Huffman | |||
or Range coding (or n+2 bits, in the case of RCT), only the n (or | or Range coding (or n+2 bits, in the case of RCT), only the n (or | |||
n+1) least significant bits are used, since this is sufficient to | n+1) least significant bits are used, since this is sufficient to | |||
recover the original sample. In the equation below, the term "bits" | recover the original sample. In the equation below, the term "bits" | |||
represents bits_per_raw_sample+1 for RCT or bits_per_raw_sample | represents bits_per_raw_sample+1 for RCT or bits_per_raw_sample | |||
otherwise: | otherwise: | |||
coder_input = | coder_input = | |||
[(sample_difference + 2^(bits-1)) & (2^bits - 1)] - 2^(bits-1) | [(sample_difference + 2^(bits-1)) & (2^bits - 1)] - 2^(bits-1) | |||
3.8.1. Range coding mode | 3.8.1. Range Coding Mode | |||
Early experimental versions of FFV1 used the CABAC Arithmetic coder | Early experimental versions of FFV1 used the CABAC Arithmetic coder | |||
from H.264 as defined in [ISO.14496-10.2014] but due to the uncertain | from H.264 as defined in [ISO.14496-10.2014] but due to the uncertain | |||
patent/royalty situation, as well as its slightly worse performance, | patent/royalty situation, as well as its slightly worse performance, | |||
CABAC was replaced by a Range coder based on an algorithm defined by | CABAC was replaced by a Range coder based on an algorithm defined by | |||
_G. Nigel_ and _N. Martin_ in 1979 [range-coding]. | G. Nigel and N. Martin in 1979 [range-coding]. | |||
3.8.1.1. Range binary values | 3.8.1.1. Range Binary Values | |||
To encode binary digits efficiently a Range coder is used. "C_{i}" | To encode binary digits efficiently a Range coder is used. "C_{i}" | |||
is the i-th Context. "B_{i}" is the i-th byte of the bytestream. | is the i-th Context. "B_{i}" is the i-th byte of the bytestream. | |||
"b_{i}" is the i-th Range coded binary value, "S_{0,i}" is the i-th | "b_{i}" is the i-th Range coded binary value, "S_{0,i}" is the i-th | |||
initial state, which is 128. The length of the bytestream encoding n | initial state, which is 128. The length of the bytestream encoding n | |||
binary symbols is "j_{n}" bytes. | binary symbols is "j_{n}" bytes. | |||
r_{i} = floor( ( R_{i} * S_{i,C_{i}} ) / 2^8 ) | r_{i} = floor( ( R_{i} * S_{i,C_{i}} ) / 2^8 ) | |||
S_{i+1,C_{i}} = zero_state_{S_{i,C_{i}}} XOR | S_{i+1,C_{i}} = zero_state_{S_{i,C_{i}}} XOR | |||
l_i = L_i XOR | l_i = L_i XOR | |||
t_i = R_i - r_i <== | t_i = R_i - r_i <== | |||
b_i = 0 <==> | b_i = 0 <==> | |||
L_i < R_i - r_i | L_i < R_i - r_i | |||
S_{i+1,C_{i}} = one_state_{S_{i,C_{i}}} XOR | S_{i+1,C_{i}} = one_state_{S_{i,C_{i}}} XOR | |||
l_i = L_i - R_i + r_i XOR | l_i = L_i - R_i + r_i XOR | |||
t_i = r_i <== | t_i = r_i <== | |||
b_i = 1 <==> | b_i = 1 <==> | |||
L_i >= R_i - r_i | L_i >= R_i - r_i | |||
S_{i+1,k} = S_{i,k} <== C_i != k | S_{i+1,k} = S_{i,k} <== C_i != k | |||
R_{i+1} = 2^8 * t_{i} XOR | R_{i+1} = 2^8 * t_{i} XOR | |||
L_{i+1} = 2^8 * l_{i} + B_{j_{i}} XOR | L_{i+1} = 2^8 * l_{i} + B_{j_{i}} XOR | |||
j_{i+1} = j_{i} + 1 <== | j_{i+1} = j_{i} + 1 <== | |||
t_{i} < 2^8 | t_{i} < 2^8 | |||
R_{i+1} = t_{i} XOR | R_{i+1} = t_{i} XOR | |||
L_{i+1} = l_{i} XOR | L_{i+1} = l_{i} XOR | |||
j_{i+1} = j_{i} <== | j_{i+1} = j_{i} <== | |||
t_{i} >= 2^8 | t_{i} >= 2^8 | |||
R_{0} = 65280 | R_{0} = 65280 | |||
L_{0} = 2^8 * B_{0} + B_{1} | L_{0} = 2^8 * B_{0} + B_{1} | |||
j_{0} = 2 | j_{0} = 2 | |||
3.8.1.2. Range non binary values | 3.8.1.2. Range Non Binary Values | |||
To encode scalar integers, it would be possible to encode each bit | To encode scalar integers, it would be possible to encode each bit | |||
separately and use the past bits as context. However that would mean | separately and use the past bits as context. However that would mean | |||
255 contexts per 8-bit symbol that 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 | also requires more past data to reach a reasonably good estimate of | |||
the probabilities. Alternatively assuming a Laplacian distribution | the probabilities. Alternatively assuming a Laplacian distribution | |||
and only dealing with its variance and mean (as in Huffman coding) | and only dealing with its variance and mean (as in Huffman coding) | |||
would also be possible, however, for maximum flexibility and | would also be possible, however, for maximum flexibility and | |||
simplicity, the chosen method uses a single symbol to encode if a | simplicity, the chosen method uses a single symbol to encode if a | |||
number is 0 and if not encodes the number using its exponent, | number is 0 and if not encodes the number using its exponent, | |||
skipping to change at page 16, line 5 ¶ | skipping to change at page 16, line 5 ¶ | |||
| | | | |||
put_rac(c, state+1+min(i,9), 0); | | put_rac(c, state+1+min(i,9), 0); | | |||
for (i=e-1; i>=0; i--) | | for (i=e-1; i>=0; i--) | | |||
put_rac(c, state+22+min(i,9), (a>>i)&1); //22..31 | | put_rac(c, state+22+min(i,9), (a>>i)&1); //22..31 | | |||
| | | | |||
if (is_signed) | | if (is_signed) | | |||
put_rac(c, state+11 + min(e, 10), v < 0); //11..21| | put_rac(c, state+11 + min(e, 10), v < 0); //11..21| | |||
} | | } | | |||
} | | } | | |||
3.8.1.3. Initial values for the context model | 3.8.1.3. Initial Values for the Context Model | |||
At keyframes all Range coder state variables are set to their initial | At keyframes all Range coder state variables are set to their initial | |||
state. | state. | |||
3.8.1.4. State transition table | 3.8.1.4. State Transition Table | |||
one_state_{i} = | one_state_{i} = | |||
default_state_transition_{i} + state_transition_delta_{i} | default_state_transition_{i} + state_transition_delta_{i} | |||
zero_state_{i} = 256 - one_state_{256-i} | zero_state_{i} = 256 - one_state_{256-i} | |||
3.8.1.5. default_state_transition | 3.8.1.5. default_state_transition | |||
0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, | 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, | |||
skipping to change at page 17, line 5 ¶ | skipping to change at page 17, line 5 ¶ | |||
180,181,182,183,184,185,186,187,188,189,190,190,191,192,194,194, | 180,181,182,183,184,185,186,187,188,189,190,190,191,192,194,194, | |||
195,196,197,198,199,200,201,202,202,204,205,206,207,208,209,209, | 195,196,197,198,199,200,201,202,202,204,205,206,207,208,209,209, | |||
210,211,212,213,215,215,216,217,218,219,220,220,222,223,224,225, | 210,211,212,213,215,215,216,217,218,219,220,220,222,223,224,225, | |||
226,227,227,229,229,230,231,232,234,234,235,236,237,238,239,240, | 226,227,227,229,229,230,231,232,234,234,235,236,237,238,239,240, | |||
241,242,243,244,245,246,247,248,248, 0, 0, 0, 0, 0, 0, 0, | 241,242,243,244,245,246,247,248,248, 0, 0, 0, 0, 0, 0, 0, | |||
3.8.1.6. alternative state transition table | 3.8.1.6. Alternative State Transition Table | |||
The alternative state transition table has been built using iterative | The alternative state transition table has been built using iterative | |||
minimization of frame sizes and generally performs better than the | minimization of frame sizes and generally performs better than the | |||
default. To use it, the coder_type MUST be set to 2 and the | default. To use it, the coder_type MUST be set to 2 and the | |||
difference to the default MUST be stored in the parameters. The | difference to the default MUST be stored in the parameters. The | |||
reference implementation of FFV1 in FFmpeg uses this table by default | reference implementation of FFV1 in FFmpeg uses this table by default | |||
at the time of this writing when Range coding is used. | at the time of this writing when Range coding is used. | |||
0, 10, 10, 10, 10, 16, 16, 16, 28, 16, 16, 29, 42, 49, 20, 49, | 0, 10, 10, 10, 10, 16, 16, 16, 28, 16, 16, 29, 42, 49, 20, 49, | |||
skipping to change at page 17, line 46 ¶ | skipping to change at page 17, line 46 ¶ | |||
175,189,179,181,186,183,192,185,200,187,191,188,190,197,193,196, | 175,189,179,181,186,183,192,185,200,187,191,188,190,197,193,196, | |||
197,194,195,196,198,202,199,201,210,203,207,204,205,206,208,214, | 197,194,195,196,198,202,199,201,210,203,207,204,205,206,208,214, | |||
209,211,221,212,213,215,224,216,217,218,219,220,222,228,223,225, | 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, | 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, | 241,243,242,244,245,246,247,248,249,250,251,252,252,253,254,255, | |||
3.8.2. Golomb Rice mode | 3.8.2. Golomb Rice Mode | |||
This coding mode uses Golomb Rice codes. The VLC is split into 2 | This coding mode uses Golomb Rice codes. The VLC is split into 2 | |||
parts, the prefix stores the most significant bits and the suffix | parts, the prefix stores the most significant bits and the suffix | |||
stores the k least significant bits or stores the whole number in the | 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 | 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. | 0-bits until that the bitstream contains a multiple of 8 bits. | |||
3.8.2.1. Prefix | 3.8.2.1. Prefix | |||
+----------------+-------+ | +----------------+-------+ | |||
skipping to change at page 18, line 39 ¶ | skipping to change at page 18, line 39 ¶ | |||
| k | bits | value | | | k | bits | value | | |||
+-----+-------------------------+-------+ | +-----+-------------------------+-------+ | |||
| 0 | "1" | 0 | | | 0 | "1" | 0 | | |||
| 0 | "001" | 2 | | | 0 | "001" | 2 | | |||
| 2 | "1 00" | 0 | | | 2 | "1 00" | 0 | | |||
| 2 | "1 10" | 2 | | | 2 | "1 10" | 2 | | |||
| 2 | "01 01" | 5 | | | 2 | "01 01" | 5 | | |||
| any | "000000000000 10000000" | 139 | | | any | "000000000000 10000000" | 139 | | |||
+-----+-------------------------+-------+ | +-----+-------------------------+-------+ | |||
3.8.2.4. Run mode | 3.8.2.4. Run Mode | |||
Run mode is entered when the context is 0 and left as soon as a non-0 | 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. | difference is found. The level is identical to the predicted one. | |||
The run and the first different level are coded. | The run and the first different level are coded. | |||
3.8.2.5. Run length coding | 3.8.2.5. Run Length Coding | |||
The run value is encoded in 2 parts, the prefix part stores the more | 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 that | 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 | 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 | 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 | the run as it is. The run_index is reset for each plane and slice to | |||
0. | 0. | |||
pseudo-code | type | pseudo-code | type | |||
--------------------------------------------------------------|----- | --------------------------------------------------------------|----- | |||
skipping to change at page 19, line 34 ¶ | skipping to change at page 19, line 34 ¶ | |||
else | | else | | |||
run_count = 0; | | run_count = 0; | | |||
if (run_index) | | if (run_index) | | |||
run_index--; | | run_index--; | | |||
run_mode = 2; | | run_mode = 2; | | |||
} | | } | | |||
} | | } | | |||
The log2_run function is also used within [ISO.14495-1.1999]. | The log2_run function is also used within [ISO.14495-1.1999]. | |||
3.8.2.6. Level coding | 3.8.2.6. Level Coding | |||
Level coding is identical to the normal difference coding with the | Level coding is identical to the normal difference coding with the | |||
exception that the 0 value is removed as it cannot occur: | exception that the 0 value is removed as it cannot occur: | |||
if (diff>0) diff--; | if (diff>0) diff--; | |||
encode(diff); | encode(diff); | |||
Note, this is different from JPEG-LS, which doesn't use prediction in | Note, this is different from JPEG-LS, which doesn't use prediction in | |||
run mode and uses a different encoding and context model for the last | run mode and uses a different encoding and context model for the last | |||
difference On a small set of test samples the use of prediction | difference On a small set of test samples the use of prediction | |||
skipping to change at page 20, line 32 ¶ | skipping to change at page 20, line 32 ¶ | |||
initialization of the decoder: | initialization of the decoder: | |||
"frame_pixel_width" is defined as "Frame" width in pixels. | "frame_pixel_width" is defined as "Frame" width in pixels. | |||
"frame_pixel_height" is defined as "Frame" height in pixels. | "frame_pixel_height" is defined as "Frame" height in pixels. | |||
Default values at the decoder initialization phase: | Default values at the decoder initialization phase: | |||
"ConfigurationRecordIsPresent" is set to 0. | "ConfigurationRecordIsPresent" is set to 0. | |||
4.1. Configuration Record | 4.1. Parameters | |||
pseudo-code | type | ||||
--------------------------------------------------------------|----- | ||||
Parameters( ) { | | ||||
version | ur | ||||
if (version >= 3) | | ||||
micro_version | ur | ||||
coder_type | ur | ||||
if (coder_type > 1) | | ||||
for (i = 1; i < 256; i++) | | ||||
state_transition_delta[ i ] | sr | ||||
colorspace_type | ur | ||||
if (version >= 1) | | ||||
bits_per_raw_sample | ur | ||||
chroma_planes | br | ||||
log2_h_chroma_subsample | ur | ||||
log2_v_chroma_subsample | ur | ||||
alpha_plane | br | ||||
if (version >= 3) { | | ||||
num_h_slices - 1 | ur | ||||
num_v_slices - 1 | ur | ||||
quant_table_set_count | ur | ||||
} | | ||||
for( i = 0; i < quant_table_set_count; i++ ) | | ||||
QuantizationTableSet( i ) | | ||||
if (version >= 3) { | | ||||
for( i = 0; i < quant_table_set_count; i++ ) { | | ||||
states_coded | br | ||||
if (states_coded) | | ||||
for( j = 0; j < context_count[ i ]; j++ ) | | ||||
for( k = 0; k < CONTEXT_SIZE; k++ ) | | ||||
initial_state_delta[ i ][ j ][ k ] | sr | ||||
} | | ||||
ec | ur | ||||
intra | ur | ||||
} | | ||||
} | | ||||
4.1.1. version | ||||
"version" specifies the version of the FFV1 bitstream. | ||||
Each version is incompatible with others versions: decoders SHOULD | ||||
reject a file due to unknown version. | ||||
Decoders SHOULD reject a file with version <= 1 && | ||||
ConfigurationRecordIsPresent == 1. | ||||
Decoders SHOULD reject a file with version >= 3 && | ||||
ConfigurationRecordIsPresent == 0. | ||||
+-------+-------------------------+ | ||||
| value | version | | ||||
+-------+-------------------------+ | ||||
| 0 | FFV1 version 0 | | ||||
| 1 | FFV1 version 1 | | ||||
| 2 | reserved* | | ||||
| 3 | FFV1 version 3 | | ||||
| Other | reserved for future use | | ||||
+-------+-------------------------+ | ||||
* Version 2 was never enabled in the encoder thus version 2 files | ||||
SHOULD NOT exist, and this document does not describe them to keep | ||||
the text simpler. | ||||
4.1.2. micro_version | ||||
"micro_version" specifies the micro-version of the FFV1 bitstream. | ||||
After a version is considered stable (a micro-version value is | ||||
assigned to be the first stable variant of a specific version), each | ||||
new micro-version after this first stable variant is compatible with | ||||
the previous micro-version: decoders SHOULD NOT reject a file due to | ||||
an unknown micro-version equal or above the micro-version considered | ||||
as stable. | ||||
Meaning of micro_version for version 3: | ||||
+-------+-------------------------+ | ||||
| value | micro_version | | ||||
+-------+-------------------------+ | ||||
| 0...3 | reserved* | | ||||
| 4 | first stable variant | | ||||
| Other | reserved for future use | | ||||
+-------+-------------------------+ | ||||
* development versions may be incompatible with the stable variants. | ||||
4.1.3. coder_type | ||||
"coder_type" specifies the coder used. | ||||
+-------+-------------------------------------------------+ | ||||
| value | coder used | | ||||
+-------+-------------------------------------------------+ | ||||
| 0 | Golomb Rice | | ||||
| 1 | Range Coder with default state transition table | | ||||
| 2 | Range Coder with custom state transition table | | ||||
| Other | reserved for future use | | ||||
+-------+-------------------------------------------------+ | ||||
4.1.4. state_transition_delta | ||||
"state_transition_delta" specifies the Range coder custom state | ||||
transition table. | ||||
If state_transition_delta is not present in the FFV1 bitstream, all | ||||
Range coder custom state transition table elements are assumed to be | ||||
0. | ||||
4.1.5. colorspace_type | ||||
"colorspace_type" specifies color space losslessly encoded, Pixel | ||||
transformation used by the encoder, as well as interleave method. | ||||
+-------+---------------------+------------------+------------------+ | ||||
| value | color space | transformation | interleave | | ||||
| | 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, then "chroma_planes" MUST be 1, | ||||
"log2_h_chroma_subsample" MUST be 0, and "log2_v_chroma_subsample" | ||||
MUST be 0. | ||||
4.1.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 | | ||||
+-------+-------------------------------+ | ||||
4.1.7. bits_per_raw_sample | ||||
"bits_per_raw_sample" indicates the number of bits for each sample. | ||||
Inferred to be 8 if not present. | ||||
+-------+---------------------------------+ | ||||
| value | bits for each sample | | ||||
+-------+---------------------------------+ | ||||
| 0 | reserved* | | ||||
| Other | the actual bits for each sample | | ||||
+-------+---------------------------------+ | ||||
* Encoders MUST NOT store bits_per_raw_sample = 0 Decoders SHOULD | ||||
accept and interpret bits_per_raw_sample = 0 as 8. | ||||
4.1.8. log2_h_chroma_subsample | ||||
"log2_h_chroma_subsample" indicates the subsample factor, stored in | ||||
powers to which the number 2 must be raised, between luma and chroma | ||||
width ("chroma_width = 2^(-log2_h_chroma_subsample) * luma_width"). | ||||
4.1.9. log2_v_chroma_subsample | ||||
"log2_v_chroma_subsample" indicates the subsample factor, stored in | ||||
powers to which the number 2 must be raised, between luma and chroma | ||||
height ("chroma_height=2^(-log2_v_chroma_subsample) * luma_height"). | ||||
4.1.10. alpha_plane | ||||
"alpha_plane" indicates if a transparency plane is present. | ||||
+-------+-----------------------------------+ | ||||
| value | presence | | ||||
+-------+-----------------------------------+ | ||||
| 0 | transparency plane is not present | | ||||
| 1 | transparency plane is present | | ||||
+-------+-----------------------------------+ | ||||
4.1.11. num_h_slices | ||||
"num_h_slices" indicates the number of horizontal elements of the | ||||
slice raster. | ||||
Inferred to be 1 if not present. | ||||
4.1.12. num_v_slices | ||||
"num_v_slices" indicates the number of vertical elements of the slice | ||||
raster. | ||||
Inferred to be 1 if not present. | ||||
4.1.13. quant_table_set_count | ||||
"quant_table_set_count" indicates the number of Quantization | ||||
Table Sets. | ||||
Inferred to be 1 if not present. | ||||
MUST NOT be 0. | ||||
4.1.14. states_coded | ||||
"states_coded" indicates if the respective Quantization Table Set has | ||||
the initial states coded. | ||||
Inferred to be 0 if not present. | ||||
+-------+-----------------------------------------------------------+ | ||||
| value | initial states | | ||||
+-------+-----------------------------------------------------------+ | ||||
| 0 | initial states are not present and are assumed to be all | | ||||
| | 128 | | ||||
| 1 | initial states are present | | ||||
+-------+-----------------------------------------------------------+ | ||||
4.1.15. initial_state_delta | ||||
"initial_state_delta[ i ][ j ][ k ]" indicates the initial Range | ||||
coder state, it is encoded using "k" as context index and | ||||
pred = j ? initial_states[ i ][j - 1][ k ] : 128 | ||||
initial_state[ i ][ j ][ k ] = | ||||
( pred + initial_state_delta[ i ][ j ][ k ] ) & 255 | ||||
4.1.16. ec | ||||
"ec" indicates the error detection/correction type. | ||||
+-------+--------------------------------------------+ | ||||
| value | error detection/correction type | | ||||
+-------+--------------------------------------------+ | ||||
| 0 | 32-bit CRC on the global header | | ||||
| 1 | 32-bit CRC per slice and the global header | | ||||
| Other | reserved for future use | | ||||
+-------+--------------------------------------------+ | ||||
4.1.17. intra | ||||
"intra" indicates the relationship between the instances of "Frame". | ||||
Inferred to be 0 if not present. | ||||
+-------+-----------------------------------------------------------+ | ||||
| value | relationship | | ||||
+-------+-----------------------------------------------------------+ | ||||
| 0 | Frames are independent or dependent (keyframes and non | | ||||
| | keyframes) | | ||||
| 1 | Frames are independent (keyframes only) | | ||||
| Other | reserved for future use | | ||||
+-------+-----------------------------------------------------------+ | ||||
4.2. Configuration Record | ||||
In the case of a FFV1 bitstream with "version >= 3", a "Configuration | 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". | level. It contains the parameters used for all instances of "Frame". | |||
The size of the "Configuration Record", "NumBytes", is supplied by | The size of the "Configuration Record", "NumBytes", is supplied by | |||
the underlying "Container". | the underlying "Container". | |||
pseudo-code | type | pseudo-code | type | |||
--------------------------------------------------------------|----- | --------------------------------------------------------------|----- | |||
ConfigurationRecord( NumBytes ) { | | ConfigurationRecord( NumBytes ) { | | |||
ConfigurationRecordIsPresent = 1 | | ConfigurationRecordIsPresent = 1 | | |||
Parameters( ) | | Parameters( ) | | |||
while( remaining_bits_in_bitstream( NumBytes ) > 32 ) | | while( remaining_bits_in_bitstream( NumBytes ) > 32 ) | | |||
reserved_for_future_use | u(1) | reserved_for_future_use | u(1) | |||
configuration_record_crc_parity | u(32) | configuration_record_crc_parity | u(32) | |||
} | | } | | |||
4.1.1. reserved_for_future_use | 4.2.1. reserved_for_future_use | |||
"reserved_for_future_use" has semantics that are reserved for future | "reserved_for_future_use" has semantics that are reserved for future | |||
use. | use. | |||
Encoders conforming to this version of this specification SHALL NOT | Encoders conforming to this version of this specification SHALL NOT | |||
write this value. | write this value. | |||
Decoders conforming to this version of this specification SHALL | Decoders conforming to this version of this specification SHALL | |||
ignore its value. | ignore its value. | |||
4.1.2. configuration_record_crc_parity | 4.2.2. configuration_record_crc_parity | |||
"configuration_record_crc_parity" 32 bits that are chosen so that the | "configuration_record_crc_parity" 32 bits that are chosen so that the | |||
"Configuration Record" as a whole has a crc remainder of 0. | "Configuration Record" as a whole has a crc remainder of 0. | |||
This is equivalent to storing the crc remainder in the 32-bit parity. | This is equivalent to storing the crc remainder in the 32-bit parity. | |||
The CRC generator polynomial used is the standard IEEE CRC polynomial | The CRC generator polynomial used is the standard IEEE CRC polynomial | |||
(0x104C11DB7) with initial value 0. | (0x104C11DB7) with initial value 0. | |||
4.1.3. Mapping FFV1 into Containers | 4.2.3. Mapping FFV1 into Containers | |||
This "Configuration Record" can be placed in any file format | This "Configuration Record" can be placed in any file format | |||
supporting "Configuration Records", fitting as much as possible with | supporting "Configuration Records", fitting as much as possible with | |||
how the file format uses to store "Configuration Records". The | how the file format uses to store "Configuration Records". The | |||
"Configuration Record" storage place and "NumBytes" are currently | "Configuration Record" storage place and "NumBytes" are currently | |||
defined and supported by this version of this specification for the | defined and supported by this version of this specification for the | |||
following formats: | following formats: | |||
4.1.3.1. AVI File Format | 4.2.3.1. AVI File Format | |||
The "Configuration Record" extends the stream format chunk ("AVI ", | The "Configuration Record" extends the stream format chunk ("AVI ", | |||
"hdlr", "strl", "strf") with the ConfigurationRecord bitstream. | "hdlr", "strl", "strf") with the ConfigurationRecord bitstream. | |||
See [AVI] for more information about chunks. | See [AVI] for more information about chunks. | |||
"NumBytes" is defined as the size, in bytes, of the strf chunk | "NumBytes" is defined as the size, in bytes, of the strf chunk | |||
indicated in the chunk header minus the size of the stream format | indicated in the chunk header minus the size of the stream format | |||
structure. | structure. | |||
4.1.3.2. ISO Base Media File Format | 4.2.3.2. ISO Base Media File Format | |||
The "Configuration Record" extends the sample description box | The "Configuration Record" extends the sample description box | |||
("moov", "trak", "mdia", "minf", "stbl", "stsd") with a "glbl" box | ("moov", "trak", "mdia", "minf", "stbl", "stsd") with a "glbl" box | |||
that contains the ConfigurationRecord bitstream. See | that contains the ConfigurationRecord bitstream. See | |||
[ISO.14496-12.2015] for more information about boxes. | [ISO.14496-12.2015] for more information about boxes. | |||
"NumBytes" is defined as the size, in bytes, of the "glbl" box | "NumBytes" is defined as the size, in bytes, of the "glbl" box | |||
indicated in the box header minus the size of the box header. | indicated in the box header minus the size of the box header. | |||
4.1.3.3. NUT File Format | 4.2.3.3. NUT File Format | |||
The codec_specific_data element (in "stream_header" packet) contains | The codec_specific_data element (in "stream_header" packet) contains | |||
the ConfigurationRecord bitstream. See [NUT] for more information | the ConfigurationRecord bitstream. See [NUT] for more information | |||
about elements. | about elements. | |||
"NumBytes" is defined as the size, in bytes, of the | "NumBytes" is defined as the size, in bytes, of the | |||
codec_specific_data element as indicated in the "length" field of | codec_specific_data element as indicated in the "length" field of | |||
codec_specific_data | codec_specific_data | |||
4.1.3.4. Matroska File Format | 4.2.3.4. Matroska File Format | |||
FFV1 SHOULD use "V_FFV1" as the Matroska "Codec ID". For FFV1 | FFV1 SHOULD use "V_FFV1" as the Matroska "Codec ID". For FFV1 | |||
versions 2 or less, the Matroska "CodecPrivate" Element SHOULD NOT be | versions 2 or less, the Matroska "CodecPrivate" Element SHOULD NOT be | |||
used. For FFV1 versions 3 or greater, the Matroska "CodecPrivate" | used. For FFV1 versions 3 or greater, the Matroska "CodecPrivate" | |||
Element MUST contain the FFV1 "Configuration Record" structure and no | Element MUST contain the FFV1 "Configuration Record" structure and no | |||
other data. See [Matroska] for more information about elements. | other data. See [Matroska] for more information about elements. | |||
"NumBytes" is defined as the "Element Data Size" of the | "NumBytes" is defined as the "Element Data Size" of the | |||
"CodecPrivate" Element. | "CodecPrivate" Element. | |||
4.2. Frame | 4.3. Frame | |||
A "Frame" consists of the keyframe field, parameters (if version | A "Frame" consists of the keyframe field, parameters (if version | |||
<=1), and a sequence of independent slices. | <=1), and a sequence of independent slices. | |||
pseudo-code | type | pseudo-code | type | |||
--------------------------------------------------------------|----- | --------------------------------------------------------------|----- | |||
Frame( NumBytes ) { | | Frame( NumBytes ) { | | |||
keyframe | br | keyframe | br | |||
if (keyframe && !ConfigurationRecordIsPresent | | if (keyframe && !ConfigurationRecordIsPresent | | |||
Parameters( ) | | Parameters( ) | | |||
while ( remaining_bits_in_bitstream( NumBytes ) ) | | while ( remaining_bits_in_bitstream( NumBytes ) ) | | |||
Slice( ) | | Slice( ) | | |||
} | | } | | |||
4.3. Slice | Architecture overview of slices in a "Frame": | |||
+-----------------------------------------------------------------+ | ||||
| first slice header | | ||||
| first slice content | | ||||
| first slice footer | | ||||
| --------------------------------------------------------------- | | ||||
| second slice header | | ||||
| second slice content | | ||||
| second slice footer | | ||||
| --------------------------------------------------------------- | | ||||
| ... | | ||||
| --------------------------------------------------------------- | | ||||
| last slice header | | ||||
| last slice content | | ||||
| last slice footer | | ||||
+-----------------------------------------------------------------+ | ||||
4.4. Slice | ||||
pseudo-code | type | pseudo-code | type | |||
--------------------------------------------------------------|----- | --------------------------------------------------------------|----- | |||
Slice( ) { | | Slice( ) { | | |||
if (version >= 3) | | if (version >= 3) | | |||
SliceHeader( ) | | SliceHeader( ) | | |||
SliceContent( ) | | SliceContent( ) | | |||
if (coder_type == 0) | | if (coder_type == 0) | | |||
while (!byte_aligned()) | | while (!byte_aligned()) | | |||
padding | u(1) | padding | u(1) | |||
if (version <= 1) { | | ||||
while (remaining_bits_in_bitstream( NumBytes ) != 0 ) | | ||||
reserved | u(1) | ||||
} | | ||||
if (version >= 3) | | if (version >= 3) | | |||
SliceFooter( ) | | SliceFooter( ) | | |||
} | | } | | |||
"padding" specifies a bit without any significance and used only for | "padding" specifies a bit without any significance and used only for | |||
byte alignment. MUST be 0. | byte alignment. MUST be 0. | |||
4.4. Slice Header | "reserved" specifies a bit without any significance in this revision | |||
of the specification and may have a significance in a later revision | ||||
of this specification. | ||||
Encoders SHOULD NOT fill these bits. | ||||
Decoders SHOULD ignore these bits. | ||||
Note in case these bits are used in a later revision of this | ||||
specification: any revision of this specification SHOULD care about | ||||
avoiding to add 40 bits of content after "SliceContent" for version 0 | ||||
and 1 of the bitstream. Background: due to some non conforming | ||||
encoders, some bitstreams where found with 40 extra bits | ||||
corresponding to "error_status" and "slice_crc_parity", a decoder | ||||
conforming to the revised specification could not do the difference | ||||
between a revised bitstream and a buggy bitstream. | ||||
4.5. Slice Header | ||||
pseudo-code | type | pseudo-code | type | |||
--------------------------------------------------------------|----- | --------------------------------------------------------------|----- | |||
SliceHeader( ) { | | SliceHeader( ) { | | |||
slice_x | ur | slice_x | ur | |||
slice_y | ur | slice_y | ur | |||
slice_width - 1 | ur | slice_width - 1 | ur | |||
slice_height - 1 | ur | slice_height - 1 | ur | |||
for( i = 0; i < quant_table_set_index_count; i++ ) | | for( i = 0; i < quant_table_set_index_count; i++ ) | | |||
quant_table_set_index [ i ] | ur | quant_table_set_index [ i ] | ur | |||
picture_structure | ur | picture_structure | ur | |||
sar_num | ur | sar_num | ur | |||
sar_den | ur | sar_den | ur | |||
} | | } | | |||
4.4.1. slice_x | 4.5.1. slice_x | |||
"slice_x" indicates the x position on the slice raster formed by | "slice_x" indicates the x position on the slice raster formed by | |||
num_h_slices. | num_h_slices. | |||
Inferred to be 0 if not present. | Inferred to be 0 if not present. | |||
4.4.2. slice_y | 4.5.2. slice_y | |||
"slice_y" indicates the y position on the slice raster formed by | "slice_y" indicates the y position on the slice raster formed by | |||
num_v_slices. | num_v_slices. | |||
Inferred to be 0 if not present. | Inferred to be 0 if not present. | |||
4.4.3. slice_width | 4.5.3. slice_width | |||
"slice_width" indicates the width on the slice raster formed by | "slice_width" indicates the width on the slice raster formed by | |||
num_h_slices. | num_h_slices. | |||
Inferred to be 1 if not present. | Inferred to be 1 if not present. | |||
4.4.4. slice_height | 4.5.4. slice_height | |||
"slice_height" indicates the height on the slice raster formed by | "slice_height" indicates the height on the slice raster formed by | |||
num_v_slices. | num_v_slices. | |||
Inferred to be 1 if not present. | Inferred to be 1 if not present. | |||
4.4.5. quant_table_set_index_count | 4.5.5. quant_table_set_index_count | |||
"quant_table_set_index_count" is defined as "1 + ( ( chroma_planes || | "quant_table_set_index_count" is defined as "1 + ( ( chroma_planes || | |||
version \<= 3 ) ? 1 : 0 ) + ( alpha_plane ? 1 : 0 )". | version \<= 3 ) ? 1 : 0 ) + ( alpha_plane ? 1 : 0 )". | |||
4.4.6. quant_table_set_index | 4.5.6. quant_table_set_index | |||
"quant_table_set_index" indicates the Quantization Table Set index to | "quant_table_set_index" indicates the Quantization Table Set index to | |||
select the Quantization Table Set and the initial states for the | select the Quantization Table Set and the initial states for the | |||
slice. | slice. | |||
Inferred to be 0 if not present. | Inferred to be 0 if not present. | |||
4.4.7. picture_structure | 4.5.7. picture_structure | |||
"picture_structure" specifies the temporal and spatial relationship | "picture_structure" specifies the temporal and spatial relationship | |||
of each line of the "Frame". | of each line of the "Frame". | |||
Inferred to be 0 if not present. | Inferred to be 0 if not present. | |||
+-------+-------------------------+ | +-------+-------------------------+ | |||
| value | picture structure used | | | value | picture structure used | | |||
+-------+-------------------------+ | +-------+-------------------------+ | |||
| 0 | unknown | | | 0 | unknown | | |||
| 1 | top field first | | | 1 | top field first | | |||
| 2 | bottom field first | | | 2 | bottom field first | | |||
| 3 | progressive | | | 3 | progressive | | |||
| Other | reserved for future use | | | Other | reserved for future use | | |||
+-------+-------------------------+ | +-------+-------------------------+ | |||
4.4.8. sar_num | 4.5.8. sar_num | |||
"sar_num" specifies the sample aspect ratio numerator. | "sar_num" specifies the sample aspect ratio numerator. | |||
Inferred to be 0 if not present. | Inferred to be 0 if not present. | |||
MUST be 0 if sample aspect ratio is unknown. | MUST be 0 if sample aspect ratio is unknown. | |||
4.4.9. sar_den | 4.5.9. sar_den | |||
"sar_den" specifies the sample aspect ratio numerator. | "sar_den" specifies the sample aspect ratio denominator. | |||
Inferred to be 0 if not present. | Inferred to be 0 if not present. | |||
MUST be 0 if sample aspect ratio is unknown. | MUST be 0 if sample aspect ratio is unknown. | |||
4.5. Slice Content | 4.6. Slice Content | |||
pseudo-code | type | pseudo-code | type | |||
--------------------------------------------------------------|----- | --------------------------------------------------------------|----- | |||
SliceContent( ) { | | SliceContent( ) { | | |||
if (colorspace_type == 0) { | | if (colorspace_type == 0) { | | |||
for( p = 0; p < primary_color_count; p++ ) | | for( p = 0; p < primary_color_count; p++ ) | | |||
for( y = 0; y < plane_pixel_height[ p ]; y++ ) | | for( y = 0; y < plane_pixel_height[ p ]; y++ ) | | |||
Line( p, y ) | | Line( p, y ) | | |||
} else if (colorspace_type == 1) { | | } else if (colorspace_type == 1) { | | |||
for( y = 0; y < slice_pixel_height; y++ ) | | for( y = 0; y < slice_pixel_height; y++ ) | | |||
for( p = 0; p < primary_color_count; p++ ) | | for( p = 0; p < primary_color_count; p++ ) | | |||
Line( p, y ) | | Line( p, y ) | | |||
} | | } | | |||
} | | } | | |||
4.5.1. primary_color_count | 4.6.1. primary_color_count | |||
"primary_color_count" is defined as 1 + ( chroma_planes ? 2 : 0 ) + ( | "primary_color_count" is defined as "1 + ( chroma_planes ? 2 : 0 ) + | |||
alpha_plane ? 1 : 0 ). | ( alpha_plane ? 1 : 0 )". | |||
4.5.2. plane_pixel_height | 4.6.2. plane_pixel_height | |||
"plane_pixel_height[ p ]" is the height in pixels of plane p of the | "plane_pixel_height[ p ]" is the height in pixels of plane p of the | |||
slice. | slice. | |||
"plane_pixel_height[ 0 ]" and "plane_pixel_height[ 1 + ( | "plane_pixel_height[ 0 ]" and "plane_pixel_height[ 1 + ( | |||
chroma_planes ? 2 : 0 ) ]" value is "slice_pixel_height". | chroma_planes ? 2 : 0 ) ]" value is "slice_pixel_height". | |||
If "chroma_planes" is set to 1, "plane_pixel_height[ 1 ]" and | If "chroma_planes" is set to 1, "plane_pixel_height[ 1 ]" and | |||
"plane_pixel_height[ 2 ]" value is "ceil(slice_pixel_height / | "plane_pixel_height[ 2 ]" value is "ceil(slice_pixel_height / | |||
log2_v_chroma_subsample)". | log2_v_chroma_subsample)". | |||
4.5.3. slice_pixel_height | 4.6.3. slice_pixel_height | |||
"slice_pixel_height" is the height in pixels of the slice. | "slice_pixel_height" is the height in pixels of the slice. | |||
Its value is "floor(( slice_y + slice_height ) * slice_pixel_height / | Its value is "floor(( slice_y + slice_height ) * slice_pixel_height / | |||
num_v_slices) - slice_pixel_y". | num_v_slices) - slice_pixel_y". | |||
4.5.4. slice_pixel_y | 4.6.4. slice_pixel_y | |||
"slice_pixel_y" is the slice vertical position in pixels. | "slice_pixel_y" is the slice vertical position in pixels. | |||
Its value is "floor(slice_y * frame_pixel_height / num_v_slices)". | Its value is "floor(slice_y * frame_pixel_height / num_v_slices)". | |||
4.6. Line | 4.7. Line | |||
pseudo-code | type | pseudo-code | type | |||
--------------------------------------------------------------|----- | --------------------------------------------------------------|----- | |||
Line( p, y ) { | | Line( p, y ) { | | |||
if (colorspace_type == 0) { | | if (colorspace_type == 0) { | | |||
for( x = 0; x < plane_pixel_width[ p ]; x++ ) | | for( x = 0; x < plane_pixel_width[ p ]; x++ ) | | |||
sample_difference[ p ][ y ][ x ] | | sample_difference[ p ][ y ][ x ] | | |||
} else if (colorspace_type == 1) { | | } else if (colorspace_type == 1) { | | |||
for( x = 0; x < slice_pixel_width; x++ ) | | for( x = 0; x < slice_pixel_width; x++ ) | | |||
sample_difference[ p ][ y ][ x ] | | sample_difference[ p ][ y ][ x ] | | |||
} | | } | | |||
} | | } | | |||
4.6.1. plane_pixel_width | 4.7.1. plane_pixel_width | |||
"plane_pixel_width[ p ]" is the width in pixels of plane p of the | "plane_pixel_width[ p ]" is the width in pixels of plane p of the | |||
slice. | slice. | |||
"plane_pixel_width[ 0 ]" and "plane_pixel_width[ 1 + ( chroma_planes | "plane_pixel_width[ 0 ]" and "plane_pixel_width[ 1 + ( chroma_planes | |||
? 2 : 0 ) ]" value is "slice_pixel_width". | ? 2 : 0 ) ]" value is "slice_pixel_width". | |||
If "chroma_planes" is set to 1, "plane_pixel_width[ 1 ]" and | If "chroma_planes" is set to 1, "plane_pixel_width[ 1 ]" and | |||
"plane_pixel_width[ 2 ]" value is "ceil(slice_pixel_width / (1 << | "plane_pixel_width[ 2 ]" value is "ceil(slice_pixel_width / (1 << | |||
log2_h_chroma_subsample))". | log2_h_chroma_subsample))". | |||
4.6.2. slice_pixel_width | 4.7.2. slice_pixel_width | |||
"slice_pixel_width" is the width in pixels of the slice. | "slice_pixel_width" is the width in pixels of the slice. | |||
Its value is "floor(( slice_x + slice_width ) * slice_pixel_width / | Its value is "floor(( slice_x + slice_width ) * slice_pixel_width / | |||
num_h_slices) - slice_pixel_x". | num_h_slices) - slice_pixel_x". | |||
4.6.3. slice_pixel_x | 4.7.3. slice_pixel_x | |||
"slice_pixel_x" is the slice horizontal position in pixels. | "slice_pixel_x" is the slice horizontal position in pixels. | |||
Its value is "floor(slice_x * frame_pixel_width / num_h_slices)". | Its value is "floor(slice_x * frame_pixel_width / num_h_slices)". | |||
4.6.4. sample_difference | 4.7.4. sample_difference | |||
"sample_difference[ p ][ y ][ x ]" is the sample difference for | "sample_difference[ p ][ y ][ x ]" is the sample difference for | |||
sample at plane "p", y position "y", and x position "x". The sample | sample at plane "p", y position "y", and x position "x". The sample | |||
value is computed based on prediction and context described in | value is computed based on prediction and context described in | |||
Section 3.2. | Section 3.2. | |||
4.7. Slice Footer | 4.8. Slice Footer | |||
Note: slice footer is always byte aligned. | Note: slice footer is always byte aligned. | |||
pseudo-code | type | pseudo-code | type | |||
--------------------------------------------------------------|----- | --------------------------------------------------------------|----- | |||
SliceFooter( ) { | | SliceFooter( ) { | | |||
slice_size | u(24) | slice_size | u(24) | |||
if (ec) { | | if (ec) { | | |||
error_status | u(8) | error_status | u(8) | |||
slice_crc_parity | u(32) | slice_crc_parity | u(32) | |||
} | | } | | |||
} | | } | | |||
4.7.1. slice_size | 4.8.1. slice_size | |||
"slice_size" indicates the size of the slice in bytes. | "slice_size" indicates the size of the slice in bytes. | |||
Note: this allows finding the start of slices before previous slices | Note: this allows finding the start of slices before previous slices | |||
have been fully decoded. And allows this way parallel decoding as | have been fully decoded, and allows parallel decoding as well as | |||
well as error resilience. | error resilience. | |||
4.7.2. error_status | 4.8.2. error_status | |||
"error_status" specifies the error status. | "error_status" specifies the error status. | |||
+-------+--------------------------------------+ | +-------+--------------------------------------+ | |||
| value | error status | | | value | error status | | |||
+-------+--------------------------------------+ | +-------+--------------------------------------+ | |||
| 0 | no error | | | 0 | no error | | |||
| 1 | slice contains a correctable error | | | 1 | slice contains a correctable error | | |||
| 2 | slice contains a uncorrectable error | | | 2 | slice contains a uncorrectable error | | |||
| Other | reserved for future use | | | Other | reserved for future use | | |||
+-------+--------------------------------------+ | +-------+--------------------------------------+ | |||
4.7.3. slice_crc_parity | 4.8.3. slice_crc_parity | |||
"slice_crc_parity" 32 bits that are chosen so that the slice as a | "slice_crc_parity" 32 bits that are chosen so that the slice as a | |||
whole has a crc remainder of 0. | whole has a crc remainder of 0. | |||
This is equivalent to storing the crc remainder in the 32-bit parity. | This is equivalent to storing the crc remainder in the 32-bit parity. | |||
The CRC generator polynomial used is the standard IEEE CRC polynomial | The CRC generator polynomial used is the standard IEEE CRC polynomial | |||
(0x104C11DB7) with initial value 0. | (0x104C11DB7) with initial value 0. | |||
4.8. Parameters | ||||
pseudo-code | type | ||||
--------------------------------------------------------------|----- | ||||
Parameters( ) { | | ||||
version | ur | ||||
if (version >= 3) | | ||||
micro_version | ur | ||||
coder_type | ur | ||||
if (coder_type > 1) | | ||||
for (i = 1; i < 256; i++) | | ||||
state_transition_delta[ i ] | sr | ||||
colorspace_type | ur | ||||
if (version >= 1) | | ||||
bits_per_raw_sample | ur | ||||
chroma_planes | br | ||||
log2_h_chroma_subsample | ur | ||||
log2_v_chroma_subsample | ur | ||||
alpha_plane | br | ||||
if (version >= 3) { | | ||||
num_h_slices - 1 | ur | ||||
num_v_slices - 1 | ur | ||||
quant_table_set_count | ur | ||||
} | | ||||
for( i = 0; i < quant_table_set_count; i++ ) | | ||||
QuantizationTableSet( i ) | | ||||
if (version >= 3) { | | ||||
for( i = 0; i < quant_table_set_count; i++ ) { | | ||||
states_coded | br | ||||
if (states_coded) | | ||||
for( j = 0; j < context_count[ i ]; j++ ) | | ||||
for( k = 0; k < CONTEXT_SIZE; k++ ) | | ||||
initial_state_delta[ i ][ j ][ k ] | sr | ||||
} | | ||||
ec | ur | ||||
intra | ur | ||||
} | | ||||
} | | ||||
4.8.1. version | ||||
"version" specifies the version of the FFV1 bitstream. | ||||
Each version is incompatible with others versions: decoders SHOULD | ||||
reject a file due to unknown version. | ||||
Decoders SHOULD reject a file with version <= 1 && | ||||
ConfigurationRecordIsPresent == 1. | ||||
Decoders SHOULD reject a file with version >= 3 && | ||||
ConfigurationRecordIsPresent == 0. | ||||
+-------+-------------------------+ | ||||
| value | version | | ||||
+-------+-------------------------+ | ||||
| 0 | FFV1 version 0 | | ||||
| 1 | FFV1 version 1 | | ||||
| 2 | reserved* | | ||||
| 3 | FFV1 version 3 | | ||||
| Other | reserved for future use | | ||||
+-------+-------------------------+ | ||||
* Version 2 was never enabled in the encoder thus version 2 files | ||||
SHOULD NOT exist, and this document does not describe them to keep | ||||
the text simpler. | ||||
4.8.2. micro_version | ||||
"micro_version" specifies the micro-version of the FFV1 bitstream. | ||||
After a version is considered stable (a micro-version value is | ||||
assigned to be the first stable variant of a specific version), each | ||||
new micro-version after this first stable variant is compatible with | ||||
the previous micro-version: decoders SHOULD NOT reject a file due to | ||||
an unknown micro-version equal or above the micro-version considered | ||||
as stable. | ||||
Meaning of micro_version for version 3: | ||||
+-------+-------------------------+ | ||||
| value | micro_version | | ||||
+-------+-------------------------+ | ||||
| 0...3 | reserved* | | ||||
| 4 | first stable variant | | ||||
| Other | reserved for future use | | ||||
+-------+-------------------------+ | ||||
* 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 | | ||||
| 2 | Range Coder with custom state transition table | | ||||
| Other | reserved for future use | | ||||
+-------+-------------------------------------------------+ | ||||
4.8.4. state_transition_delta | ||||
"state_transition_delta" specifies the Range coder custom state | ||||
transition table. | ||||
If state_transition_delta is not present in the FFV1 bitstream, all | ||||
Range coder custom state transition table elements are assumed to be | ||||
0. | ||||
4.8.5. colorspace_type | ||||
"colorspace_type" specifies color space losslessly encoded, Pixel | ||||
transformation used by the encoder, as well as interleave method. | ||||
+-------+---------------------+------------------+------------------+ | ||||
| value | color space | transformation | interleave | | ||||
| | 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, 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 | | ||||
+-------+-------------------------------+ | ||||
4.8.7. bits_per_raw_sample | ||||
"bits_per_raw_sample" indicates the number of bits for each sample. | ||||
Inferred to be 8 if not present. | ||||
+-------+---------------------------------+ | ||||
| value | bits for each sample | | ||||
+-------+---------------------------------+ | ||||
| 0 | reserved* | | ||||
| Other | the actual bits for each sample | | ||||
+-------+---------------------------------+ | ||||
* Encoders MUST NOT store bits_per_raw_sample = 0 Decoders SHOULD | ||||
accept and interpret bits_per_raw_sample = 0 as 8. | ||||
4.8.8. log2_h_chroma_subsample | ||||
"log2_h_chroma_subsample" indicates the subsample factor, stored in | ||||
powers to which the number 2 must be raised, between luma and chroma | ||||
width ("chroma_width = 2^(-log2_h_chroma_subsample) * luma_width"). | ||||
4.8.9. log2_v_chroma_subsample | ||||
"log2_v_chroma_subsample" indicates the subsample factor, stored in | ||||
powers to which the number 2 must be raised, between luma and chroma | ||||
height ("chroma_height=2^(-log2_v_chroma_subsample) * luma_height"). | ||||
4.8.10. alpha_plane | ||||
"alpha_plane" indicates if a transparency plane is present. | ||||
+-------+-----------------------------------+ | ||||
| value | presence | | ||||
+-------+-----------------------------------+ | ||||
| 0 | transparency plane is not present | | ||||
| 1 | transparency plane is present | | ||||
+-------+-----------------------------------+ | ||||
4.8.11. num_h_slices | ||||
"num_h_slices" indicates the number of horizontal elements of the | ||||
slice raster. | ||||
Inferred to be 1 if not present. | ||||
4.8.12. num_v_slices | ||||
"num_v_slices" indicates the number of vertical elements of the slice | ||||
raster. | ||||
Inferred to be 1 if not present. | ||||
4.8.13. quant_table_set_count | ||||
"quant_table_set_count" indicates the number of Quantization | ||||
Table Sets. | ||||
Inferred to be 1 if not present. | ||||
MUST NOT be 0. | ||||
4.8.14. states_coded | ||||
"states_coded" indicates if the respective Quantization Table Set has | ||||
the initial states coded. | ||||
Inferred to be 0 if not present. | ||||
+-------+-----------------------------------------------------------+ | ||||
| value | initial states | | ||||
+-------+-----------------------------------------------------------+ | ||||
| 0 | initial states are not present and are assumed to be all | | ||||
| | 128 | | ||||
| 1 | initial states are present | | ||||
+-------+-----------------------------------------------------------+ | ||||
4.8.15. initial_state_delta | ||||
"initial_state_delta[ i ][ j ][ k ]" indicates the initial Range | ||||
coder state, it is encoded using "k" as context index and | ||||
pred = j ? initial_states[ i ][j - 1][ k ] : 128 | ||||
initial_state[ i ][ j ][ k ] = | ||||
( pred + initial_state_delta[ i ][ j ][ k ] ) & 255 | ||||
4.8.16. ec | ||||
"ec" indicates the error detection/correction type. | ||||
+-------+--------------------------------------------+ | ||||
| value | error detection/correction type | | ||||
+-------+--------------------------------------------+ | ||||
| 0 | 32-bit CRC on the global header | | ||||
| 1 | 32-bit CRC per slice and the global header | | ||||
| Other | reserved for future use | | ||||
+-------+--------------------------------------------+ | ||||
4.8.17. intra | ||||
"intra" indicates the relationship between the instances of "Frame". | ||||
Inferred to be 0 if not present. | ||||
+-------+-----------------------------------------------------------+ | ||||
| value | relationship | | ||||
+-------+-----------------------------------------------------------+ | ||||
| 0 | Frames are independent or dependent (keyframes and non | | ||||
| | keyframes) | | ||||
| 1 | Frames are independent (keyframes only) | | ||||
| Other | reserved for future use | | ||||
+-------+-----------------------------------------------------------+ | ||||
4.9. Quantization Table Set | 4.9. Quantization Table Set | |||
The Quantization Table Sets are stored by storing the number of equal | 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" | entries -1 of the first half of the table (represented as "len - 1" | |||
in the pseudo-code below) using the method described in | 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 | Section 3.8.1.2. The second half doesn't need to be stored as it is | |||
identical to the first with flipped sign. "scale" and "len_count[ i | identical to the first with flipped sign. "scale" and "len_count[ i | |||
][ j ]" are temporary values used for the computing of | ][ j ]" are temporary values used for the computing of | |||
"context_count[ i ]" and are not used outside Quantization Table Set | "context_count[ i ]" and are not used outside Quantization Table Set | |||
pseudo-code. | pseudo-code. | |||
skipping to change at page 36, line 18 ¶ | skipping to change at page 37, line 18 ¶ | |||
Required parameters: None. | Required parameters: None. | |||
Optional parameters: | Optional parameters: | |||
This parameter is used to signal the capabilities of a receiver | This parameter is used to signal the capabilities of a receiver | |||
implementation. This parameter MUST NOT be used for any other | implementation. This parameter MUST NOT be used for any other | |||
purpose. | purpose. | |||
version: The version of the FFV1 encoding as defined by | version: The version of the FFV1 encoding as defined by | |||
Section 4.8.1. | Section 4.1.1. | |||
micro_version: The micro_version of the FFV1 encoding as defined by | micro_version: The micro_version of the FFV1 encoding as defined by | |||
Section 4.8.2. | Section 4.1.2. | |||
coder_type: The coder_type of the FFV1 encoding as defined by | coder_type: The coder_type of the FFV1 encoding as defined by | |||
Section 4.8.3. | Section 4.1.3. | |||
colorspace_type: The colorspace_type of the FFV1 encoding as defined | colorspace_type: The colorspace_type of the FFV1 encoding as defined | |||
by Section 4.8.5. | by Section 4.1.5. | |||
bits_per_raw_sample: The version of the FFV1 encoding as defined by | bits_per_raw_sample: The version of the FFV1 encoding as defined by | |||
Section 4.8.7. | Section 4.1.7. | |||
max-slices: The value of max-slices is an integer indicating the | max-slices: The value of max-slices is an integer indicating the | |||
maximum count of slices with a frames of the FFV1 encoding. | maximum count of slices with a frames of the FFV1 encoding. | |||
Encoding considerations: | Encoding considerations: | |||
This media type is defined for encapsulation in several audiovisual | This media type is defined for encapsulation in several audiovisual | |||
container formats and contains binary data; see Section 4.1.3. This | container formats and contains binary data; see Section 4.2.3. This | |||
media type is framed binary data Section 4.8 of [RFC4288]. | media type is framed binary data Section 4.8 of [RFC4288]. | |||
Security considerations: | Security considerations: | |||
See Section 6 of this document. | See Section 6 of this document. | |||
Interoperability considerations: None. | Interoperability considerations: None. | |||
Published specification: | Published specification: | |||
skipping to change at page 37, line 35 ¶ | skipping to change at page 38, line 35 ¶ | |||
8. IANA Considerations | 8. IANA Considerations | |||
The IANA is requested to register the following values: | The IANA is requested to register the following values: | |||
o Media type registration as described in Section 7. | o Media type registration as described in Section 7. | |||
9. Appendixes | 9. Appendixes | |||
9.1. Decoder implementation suggestions | 9.1. Decoder implementation suggestions | |||
9.1.1. Multi-threading support and independence of slices | 9.1.1. Multi-threading Support and Independence of Slices | |||
The FFV1 bitstream is parsable in two ways: in sequential order as | 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 | 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 | each slice. Each slice footer contains a slice_size field so the | |||
boundary of each slice is computable without having to parse the | boundary of each slice is computable without having to parse the | |||
slice content. That allows multi-threading as well as independence | slice content. That allows multi-threading as well as independence | |||
of slice content (a bitstream error in a slice header or slice | of slice content (a bitstream error in a slice header or slice | |||
content has no impact on the decoding of the other slices). | content has no impact on the decoding of the other slices). | |||
After having checked keyframe field, a decoder SHOULD parse | After having checked keyframe field, a decoder SHOULD parse | |||
slice_size fields, from slice_size of the last slice at the end of | slice_size fields, from slice_size of the last slice at the end of | |||
the "Frame" up to slice_size of the first slice at the beginning of | the "Frame" up to slice_size of the first slice at the beginning of | |||
the "Frame", before parsing slices, in order to have slices | the "Frame", before parsing slices, in order to have slices | |||
boundaries. A decoder MAY fallback on sequential order e.g. in case | boundaries. A decoder MAY fallback on sequential order e.g. in case | |||
of a corrupted "Frame" (frame size unknown, slice_size of slices not | of a corrupted "Frame" (frame size unknown, slice_size of slices not | |||
coherent...) or if there is no possibility of seek into the stream. | coherent...) or if there is no possibility of seek into the stream. | |||
Architecture overview of slices in a "Frame": | ||||
+-----------------------------------------------------------------+ | ||||
| first slice header | | ||||
| first slice content | | ||||
| first slice footer | | ||||
| --------------------------------------------------------------- | | ||||
| second slice header | | ||||
| second slice content | | ||||
| second slice footer | | ||||
| --------------------------------------------------------------- | | ||||
| ... | | ||||
| --------------------------------------------------------------- | | ||||
| last slice header | | ||||
| last slice content | | ||||
| last slice footer | | ||||
+-----------------------------------------------------------------+ | ||||
10. Changelog | 10. Changelog | |||
See <https://github.com/FFmpeg/FFV1/commits/master> | See <https://github.com/FFmpeg/FFV1/commits/master> | |||
11. ToDo | 11. References | |||
o mean,k estimation for the Golomb Rice codes | ||||
12. References | ||||
12.1. Normative References | 11.1. Normative References | |||
[I-D.ietf-cellar-ffv1] | [I-D.ietf-cellar-ffv1] | |||
Niedermayer, M., Rice, D., and J. Martinez, "FFV1 Video | Niedermayer, M., Rice, D., and J. Martinez, "FFV1 Video | |||
Coding Format Version 0, 1, and 3", draft-ietf-cellar- | Coding Format Version 0, 1, and 3", draft-ietf-cellar- | |||
ffv1-02 (work in progress), April 2018. | ffv1-03 (work in progress), June 2018. | |||
[ISO.15444-1.2016] | [ISO.15444-1.2016] | |||
International Organization for Standardization, | International Organization for Standardization, | |||
"Information technology -- JPEG 2000 image coding system: | "Information technology -- JPEG 2000 image coding system: | |||
Core coding system", October 2016. | Core coding system", October 2016. | |||
[ISO.9899.1990] | [ISO.9899.1990] | |||
International Organization for Standardization, | International Organization for Standardization, | |||
"Programming languages - C", ISO Standard 9899, 1990. | "Programming languages - C", ISO Standard 9899, 1990. | |||
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate | |||
Requirement Levels", BCP 14, RFC 2119, | Requirement Levels", BCP 14, RFC 2119, | |||
DOI 10.17487/RFC2119, March 1997, | DOI 10.17487/RFC2119, March 1997, | |||
<https://www.rfc-editor.org/info/rfc2119>. | <https://www.rfc-editor.org/info/rfc2119>. | |||
[RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and | [RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and | |||
Registration Procedures", RFC 4288, DOI 10.17487/RFC4288, | Registration Procedures", RFC 4288, DOI 10.17487/RFC4288, | |||
December 2005, <https://www.rfc-editor.org/info/rfc4288>. | December 2005, <https://www.rfc-editor.org/info/rfc4288>. | |||
[RFC4732] Handley, M., Ed., Rescorla, E., Ed., and IAB, "Internet | ||||
Denial-of-Service Considerations", RFC 4732, | ||||
DOI 10.17487/RFC4732, December 2006, | ||||
<https://www.rfc-editor.org/info/rfc4732>. | ||||
[RFC4855] Casner, S., "Media Type Registration of RTP Payload | [RFC4855] Casner, S., "Media Type Registration of RTP Payload | |||
Formats", RFC 4855, DOI 10.17487/RFC4855, February 2007, | Formats", RFC 4855, DOI 10.17487/RFC4855, February 2007, | |||
<https://www.rfc-editor.org/info/rfc4855>. | <https://www.rfc-editor.org/info/rfc4855>. | |||
[RFC6716] Valin, JM., Vos, K., and T. Terriberry, "Definition of the | ||||
Opus Audio Codec", RFC 6716, DOI 10.17487/RFC6716, | ||||
September 2012, <https://www.rfc-editor.org/info/rfc6716>. | ||||
[RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type | [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type | |||
Specifications and Registration Procedures", BCP 13, | Specifications and Registration Procedures", BCP 13, | |||
RFC 6838, DOI 10.17487/RFC6838, January 2013, | RFC 6838, DOI 10.17487/RFC6838, January 2013, | |||
<https://www.rfc-editor.org/info/rfc6838>. | <https://www.rfc-editor.org/info/rfc6838>. | |||
12.2. Informative References | 11.2. Informative References | |||
[Address-Sanitizer] | [Address-Sanitizer] | |||
The Clang Team, "ASAN AddressSanitizer website", undated, | The Clang Team, "ASAN AddressSanitizer website", undated, | |||
<https://clang.llvm.org/docs/AddressSanitizer.html>. | <https://clang.llvm.org/docs/AddressSanitizer.html>. | |||
[AVI] Microsoft, "AVI RIFF File Reference", undated, | [AVI] Microsoft, "AVI RIFF File Reference", undated, | |||
<https://msdn.microsoft.com/en-us/library/windows/desktop/ | <https://msdn.microsoft.com/en-us/library/windows/desktop/ | |||
dd318189%28v=vs.85%29.aspx>. | dd318189%28v=vs.85%29.aspx>. | |||
[FFV1_V0] Niedermayer, M., "Commit to mark FFV1 version 0 as non- | [FFV1_V0] Niedermayer, M., "Commit to mark FFV1 version 0 as non- | |||
skipping to change at page 40, line 32 ¶ | skipping to change at page 41, line 18 ¶ | |||
[range-coding] | [range-coding] | |||
Nigel, G. and N. Martin, "Range encoding: an algorithm for | Nigel, G. and N. Martin, "Range encoding: an algorithm for | |||
removing redundancy from a digitised message.", Proc. | removing redundancy from a digitised message.", Proc. | |||
Institution of Electronic and Radio Engineers | Institution of Electronic and Radio Engineers | |||
International Conference on Video and Data Recording , | International Conference on Video and Data Recording , | |||
July 1979. | July 1979. | |||
[REFIMPL] Niedermayer, M., "The reference FFV1 implementation / the | [REFIMPL] Niedermayer, M., "The reference FFV1 implementation / the | |||
FFV1 codec in FFmpeg", undated, <https://ffmpeg.org>. | FFV1 codec in FFmpeg", undated, <https://ffmpeg.org>. | |||
[RFC4732] Handley, M., Ed., Rescorla, E., Ed., and IAB, "Internet | ||||
Denial-of-Service Considerations", RFC 4732, | ||||
DOI 10.17487/RFC4732, December 2006, | ||||
<https://www.rfc-editor.org/info/rfc4732>. | ||||
[RFC6716] Valin, JM., Vos, K., and T. Terriberry, "Definition of the | ||||
Opus Audio Codec", RFC 6716, DOI 10.17487/RFC6716, | ||||
September 2012, <https://www.rfc-editor.org/info/rfc6716>. | ||||
[VALGRIND] | [VALGRIND] | |||
Valgrind Developers, "Valgrind website", undated, | Valgrind Developers, "Valgrind website", undated, | |||
<https://valgrind.org/>. | <https://valgrind.org/>. | |||
[YCbCr] Wikipedia, "YCbCr", undated, | [YCbCr] Wikipedia, "YCbCr", undated, | |||
<https://en.wikipedia.org/w/index.php?title=YCbCr>. | <https://en.wikipedia.org/w/index.php?title=YCbCr>. | |||
Authors' Addresses | Authors' Addresses | |||
Michael Niedermayer | Michael Niedermayer | |||
End of changes. 96 change blocks. | ||||
458 lines changed or deleted | 474 lines changed or added | |||
This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |