[FFmpeg-devel] [PATCH] FFV1 specification: Add more details about the configuration record

Jerome Martinez jerome at mediaarea.net
Wed May 13 18:47:11 CEST 2015


Add more details about the configuration record

Version 2+ of the format has a configuration record which is in
the underlying container track definition.
GlobalHeader definition is split in 2 parts:
- a configuration record part, including more details about how to find
it in AVI and MP4, including the algorithm for how to skip remaining
bits directly in the bitstream definition, including the crc_parity,
- the header part itself, which is the prveious GlobalHeader definition
minus crc_parity.
crc_parity definition is also split and moved in the right subsections:
- configuration_record_crc_parity for the configuration record part
subsection,
- slice_crc_parity for the slice subsection.
-------------- next part --------------
From 1f83b63f2554d765f98b934b199734b5c82fe721 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Martinez?= <jerome at mediaarea.net>
Date: Wed, 13 May 2015 18:43:49 +0200
Subject: [PATCH] Add more details about the configuration record

Version 2+ of the format has a configuration record which is in
the underlying container track definition.
GlobalHeader definition is split in 2 parts:
- a configuration record part, including more details about how to find
it in AVI and MP4, including the algorithm for how to skip remaining
bits directly in the bitstream definition, including the crc_parity,
- the header part itself, which is the prveious GlobalHeader definition
minus crc_parity.
crc_parity definition is also split and moved in the right subsections:
- configuration_record_crc_parity for the configuration record part
subsection,
- slice_crc_parity for the slice subsection.
---
 ffv1.lyx | 499 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 437 insertions(+), 62 deletions(-)

diff --git a/ffv1.lyx b/ffv1.lyx
index c8bb2b7..9894a0f 100644
--- a/ffv1.lyx
+++ b/ffv1.lyx
@@ -893,6 +893,20 @@ Range
 a...b means any value starting from a to b, inclusive.
 \end_layout
 
+\begin_layout Subsection
+Bitstream functions
+\end_layout
+
+\begin_layout Description
+remaing_bits_in_bitstream(
+\begin_inset space ~
+\end_inset
+
+) means the count of remaining bits after the current position in the bitstream.
+ It is computed from the NumBytes value multiplied by 8 minus the count
+ of bits already read by the bitstream parser.
+\end_layout
+
 \begin_layout Section
 General Description
 \end_layout
@@ -2525,31 +2539,49 @@ The same context which is initialized to 128 is used for all fields in the
  header.
 \end_layout
 
+\begin_layout Standard
+Default values at the decoder initialization phase:
+\end_layout
+
+\begin_layout Description
+ConfigurationRecordIsPresent is set to 0.
+\end_layout
+
 \begin_layout Subsection
-Frame
+Configuration Record
+\end_layout
+
+\begin_layout Standard
+In the case of a bitstream with version >= 2, a configuration record is
+ stored in the the underlying container, at the track header level.
+\begin_inset Newline newline
+\end_inset
+
+The size of the configuration record, NumBytes, is supplied by the underlying
+ container.
 \end_layout
 
 \begin_layout Standard
 \begin_inset Tabular
-<lyxtabular version="3" rows="9" columns="2">
+<lyxtabular version="3" rows="7" columns="2">
 <features rotate="0" tabularvalignment="middle">
 <column alignment="left" valignment="top">
 <column alignment="center" valignment="top">
 <row>
-<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
 \begin_inset Text
 
 \begin_layout Plain Layout
-Frame( ) {
+ConfigurationRecord( NumBytes ) {
 \end_layout
 
 \end_inset
 </cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
 \begin_layout Plain Layout
-type
+
 \end_layout
 
 \end_inset
@@ -2575,7 +2607,7 @@ type
 \begin_inset space ~
 \end_inset
 
-keyframe
+ConfigurationRecordIsPresent = 1
 \end_layout
 
 \end_inset
@@ -2584,7 +2616,7 @@ keyframe
 \begin_inset Text
 
 \begin_layout Plain Layout
-br
+
 \end_layout
 
 \end_inset
@@ -2610,7 +2642,42 @@ br
 \begin_inset space ~
 \end_inset
 
-if( keyframe ) {
+GlobalHeader( )
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset space ~
+\end_inset
+
+while( remaing_bits_in_bitstream( ) > 32)
 \end_layout
 
 \end_inset
@@ -2661,7 +2728,7 @@ if( keyframe ) {
 \begin_inset space ~
 \end_inset
 
-if( version < 2 )
+reserved
 \end_layout
 
 \end_inset
@@ -2670,14 +2737,14 @@ if( version < 2 )
 \begin_inset Text
 
 \begin_layout Plain Layout
-
+u(1)
 \end_layout
 
 \end_inset
 </cell>
 </row>
 <row>
-<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
 \begin_layout Plain Layout
@@ -2696,7 +2763,249 @@ if( version < 2 )
 \begin_inset space ~
 \end_inset
 
+configuration_record_crc_parity
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+u(32)
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+}
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Description
+configuration_record_crc_parity 32 bits that are choosen so that the configurati
+on record as a whole has a crc remainder of 0.
+\begin_inset Newline newline
+\end_inset
+
+This is equivalent to storing the crc remainder in the 32-bit parity.
+\begin_inset Newline newline
+\end_inset
+
+The CRC generator polynom used is the standard IEEE CRC polynom (0x104C11DB7)
+ with initial value 0.
+\end_layout
+
+\begin_layout Standard
+The configuration record storage place and NumBytes are defined for the
+ following container formats:
+\end_layout
+
+\begin_layout Subsubsection
+In AVI File Format
+\end_layout
+
+\begin_layout Standard
+The Configuration Record extends the stream format chunk (
+\begin_inset Quotes eld
+\end_inset
+
+AVI
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset Quotes eld
+\end_inset
+
+, 
+\begin_inset Quotes eld
+\end_inset
+
+hdlr
+\begin_inset Quotes erd
+\end_inset
+
+, 
+\begin_inset Quotes eld
+\end_inset
+
+strl
+\begin_inset Quotes erd
+\end_inset
+
+, 
+\begin_inset Quotes eld
+\end_inset
+
+strf
+\begin_inset Quotes erd
+\end_inset
+
+) with the ConfigurationRecord bistream.
+\begin_inset Newline newline
+\end_inset
+
+See 
+\begin_inset CommandInset citation
+LatexCommand cite
+key "AVI"
+
+\end_inset
+
+ for more information about chunks.
+\end_layout
+
+\begin_layout Description
+NumBytes is defined as the size, in bytes, of the strf chunk indicated in
+ the chunk header minus the size of the stream format structure.
+\end_layout
+
+\begin_layout Subsubsection
+In ISO/IEC 14496-12 (MP4 File Format)
+\end_layout
+
+\begin_layout Standard
+The Configuration Record extends the sample description box (
+\begin_inset Quotes eld
+\end_inset
+
+moov
+\begin_inset Quotes erd
+\end_inset
+
+, 
+\begin_inset Quotes eld
+\end_inset
+
+trak
+\begin_inset Quotes erd
+\end_inset
+
+, 
+\begin_inset Quotes eld
+\end_inset
+
+mdia
+\begin_inset Quotes erd
+\end_inset
+
+, 
+\begin_inset Quotes eld
+\end_inset
+
+minf
+\begin_inset Quotes erd
+\end_inset
+
+, 
+\begin_inset Quotes eld
+\end_inset
+
+stbl
+\begin_inset Quotes erd
+\end_inset
+
+, 
+\begin_inset Quotes eld
+\end_inset
+
+stsd
+\begin_inset Quotes erd
+\end_inset
+
+) with a 
+\begin_inset Quotes eld
+\end_inset
+
+glbl
+\begin_inset Quotes erd
+\end_inset
+
+ box which contains the ConfigurationRecord bitstream.
+\begin_inset Newline newline
+\end_inset
 
+See 
+\begin_inset CommandInset citation
+LatexCommand cite
+key "ISO14496_12"
+
+\end_inset
+
+ for more information about boxes.
+\end_layout
+
+\begin_layout Description
+NumBytes is defined as the size, in bytes, of the 
+\begin_inset Quotes eld
+\end_inset
+
+glbl
+\begin_inset Quotes erd
+\end_inset
+
+ box indicated in the box header minus the size of the box header.
+\end_layout
+
+\begin_layout Subsection
+Frame
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="7" columns="2">
+<features rotate="0" tabularvalignment="middle">
+<column alignment="left" valignment="top">
+<column alignment="center" valignment="top">
+<row>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Frame( ) {
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+type
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
 \begin_inset space ~
 \end_inset
 
@@ -2712,7 +3021,26 @@ if( version < 2 )
 \begin_inset space ~
 \end_inset
 
+keyframe
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+br
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
+\begin_layout Plain Layout
 \begin_inset space ~
 \end_inset
 
@@ -2728,7 +3056,7 @@ if( version < 2 )
 \begin_inset space ~
 \end_inset
 
-FrameHeader01( )
+if( keyframe && !ConfigurationRecordIsPresent)
 \end_layout
 
 \end_inset
@@ -2744,7 +3072,7 @@ FrameHeader01( )
 </cell>
 </row>
 <row>
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
 \begin_layout Plain Layout
@@ -2763,7 +3091,27 @@ FrameHeader01( )
 \begin_inset space ~
 \end_inset
 
-}
+
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset space ~
+\end_inset
+
+FrameHeader01( )
 \end_layout
 
 \end_inset
@@ -3639,7 +3987,7 @@ u(8)
 \begin_inset space ~
 \end_inset
 
-crc_parity
+slice_crc_parity
 \end_layout
 
 \end_inset
@@ -3849,6 +4197,20 @@ reserved for future use
 
 \end_layout
 
+\begin_layout Description
+slice_crc_parity 32 bits that are choosen so that the slice as a whole has
+ a crc remainder of 0.
+\begin_inset Newline newline
+\end_inset
+
+This is equivalent to storing the crc remainder in the 32-bit parity.
+\begin_inset Newline newline
+\end_inset
+
+The CRC generator polynom used is the standard IEEE CRC polynom (0x104C11DB7)
+ with initial value 0.
+\end_layout
+
 \begin_layout Subsection
 Slice Header
 \end_layout
@@ -5321,7 +5683,7 @@ Version 2 and later files use a global header and a per frame header.
 
 \begin_layout Standard
 \begin_inset Tabular
-<lyxtabular version="3" rows="29" columns="2">
+<lyxtabular version="3" rows="28" columns="2">
 <features rotate="0" tabularvalignment="middle">
 <column alignment="left" valignment="top">
 <column alignment="center" valignment="top">
@@ -6496,41 +6858,6 @@ ur
 </cell>
 </row>
 <row>
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
-
-\begin_layout Plain Layout
-\begin_inset space ~
-\end_inset
-
-
-\begin_inset space ~
-\end_inset
-
-
-\begin_inset space ~
-\end_inset
-
-
-\begin_inset space ~
-\end_inset
-
-crc_parity
-\end_layout
-
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
-
-\begin_layout Plain Layout
-u(32)
-\end_layout
-
-\end_inset
-</cell>
-</row>
-<row>
 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
 \begin_inset Text
 
@@ -6568,6 +6895,16 @@ Each version is incompatible with others versions: decoders SHOULD reject
 \begin_inset Newline newline
 \end_inset
 
+Decoders SHOULD reject a file with version < 2 && ConfigurationRecordIsPresent
+ == 1.
+\begin_inset Newline newline
+\end_inset
+
+Decoders SHOULD reject a file with version >= 2 && ConfigurationRecordIsPresent
+ == 0.
+\begin_inset Newline newline
+\end_inset
+
 
 \begin_inset Tabular
 <lyxtabular version="3" rows="6" columns="2">
@@ -7744,16 +8081,6 @@ reserved for future use
 
 \end_layout
 
-\begin_layout Description
-crc_parity 32bit that are choosen so that the global header as a whole or
- slice as a whole has a crc remainder of 0.
- This is equivalent to storing the crc remainder in the 32bit parity.
- The CRC generator polynom used is the standard IEEE CRC polynom (0x104C11DB7)
- with initial value 0.
- The compressed bitstream is padded so that the 32bit crc end in the last
- 4 bytes.
-\end_layout
-
 \begin_layout Subsection
 Quantization Tables
 \end_layout
@@ -9002,6 +9329,54 @@ key "RangeCoder"
  held in Southampton July 24-27 1979."
 \end_layout
 
+\begin_layout Bibliography
+\labelwidthstring References
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+label "AVI"
+key "AVI"
+
+\end_inset
+
+AVI RIFF File Format 
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+https://msdn.microsoft.com/en-us/library/windows/desktop/dd318189%28v=vs.85%29.aspx
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Bibliography
+\labelwidthstring References
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+label "ISO/IEC 14496-12"
+key "ISO14496_12"
+
+\end_inset
+
+Information technology — Coding of audio-visual objects — Part 12: ISO base
+ media file format 
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=619
+88
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
 \begin_layout Section
 Copyright
 \end_layout
-- 
1.9.5.msysgit.1


More information about the ffmpeg-devel mailing list