<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM 'rfc2629.dtd' []>
<rfc ipr="trust200902" category="std" docName="draft-niedermayer-cellar-ffv1-00">
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc private=""?>
<?rfc topblock="yes"?>
<?rfc comments="no"?>
<front>
<title abbrev="FFV1">FF Video Codec 1</title>

<author initials="M." surname="Niedermayer" fullname="Michael Niedermayer">
<organization></organization>
<address>
<postal>
<street></street>
<city></city>
<code></code>
<country></country>
<region></region>
</postal>
<phone></phone>
<email></email>
<uri></uri>
</address>
</author>
<date year="2016" month="July" day="7"/>

<area>art</area>
<workgroup>cellar</workgroup>
<keyword></keyword>


<abstract>
<t>This document defines FFV1, a lossless intra-frame video encoding format. FFV1 is designed to efficiently compress video data in a variety of pixel formats. Compared to uncompressed video, FFV1 offers storage compression, frame fixity, and self-description, which makes FFV1 useful as a preservation or intermediate video format.
</t>
</abstract>


</front>

<middle>

<section anchor="introduction" title="Introduction">
<t>The FFV1 video codec is a simple and efficient lossless intra-frame only codec.
</t>
<t>The latest version of this document is available at <eref target="https://raw.github.com/FFmpeg/FFV1/master/ffv1.md"/>
</t>
<t>This document assumes familiarity with mathematical and coding concepts such as Range coding and YCbCr colorspaces.
</t>
</section>

<section anchor="notation-and-conventions" title="Notation and Conventions">
<t>The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in <eref target="https://tools.ietf.org/html/rfc2119">RFC 2119</eref>.
</t>

<section anchor="definitions" title="Definitions">
<t>ESC    An ESCape symbol to indicate that the symbol to be stored is too large for normal
       storage and that an alternate storage method.
</t>
<t>MSB    Most Significant Bit, the bit that can cause the largest change in magnitude of
       the symbol.
</t>
<t>RCT    Reversible Color Transform, a near linear, exactly reversible integer transform
       that converts between RGB and YCbCr representations of a sample.
</t>
<t>VLC    Variable Length Code.
</t>
<t>RGB    A reference to the method of storing the value of a sample by using three numeric
       values that represent Red, Green, and Blue.
</t>
<t>YCbCr  A reference to the method of storing the value of a sample by using three numeric
       values that represent the luminance of the sample (Y) and the chrominance of the
       sample (Cb and Cr).
</t>
<t>TBA    To Be Announced. Used in reference to the development of future iterations of the
       FFV1 specification.
</t>
</section>
</section>

<section anchor="conventions" title="Conventions">
<t>Note: the operators and the order of precedence are the same as used in the C programming language <xref target="references"/>.
</t>

<section anchor="arithmetic-operators" title="Arithmetic operators">
<t><spanx style="verb">a + b</spanx>       means a plus b.
</t>
<t><spanx style="verb">a - b</spanx>       means a minus b.
</t>
<t><spanx style="verb">-a</spanx>          means negation of a.
</t>
<t><spanx style="verb">a \* b</spanx>      means a multiplied by b.
</t>
<t><spanx style="verb">a / b</spanx>       means a divided by b.
</t>
<t><spanx style="verb">a &amp; b</spanx>       means bit-wise &quot;and&quot; of a and b.
</t>
<t><spanx style="verb">a | b</spanx>       means bit-wise &quot;or&quot; of a and b.
</t>
<t><spanx style="verb">a &gt;&gt; b</spanx>      means arithmetic right shift of two’s complement integer representation of a by b binary digits.
</t>
<t><spanx style="verb">a &lt;&lt; b</spanx>      means arithmetic left shift of two’s complement integer representation of a by b binary digits.
</t>
</section>

<section anchor="assignment-operators" title="Assignment operators">
<t><spanx style="verb">a = b</spanx>       means a is assigned b.
</t>
<t><spanx style="verb">a++</spanx>         is equivalent to a = a + 1.
</t>
<t><spanx style="verb">a–</spanx>          is equivalent to a = a - 1.
</t>
<t><spanx style="verb">a += b</spanx>      is equivalent to a = a + b.
</t>
<t><spanx style="verb">a -= b</spanx>      is equivalent to a = a - b.
</t>
</section>

<section anchor="comparison-operators" title="Comparison operators">
<t><spanx style="verb">a &gt; b</spanx>       means a is greater than b.
</t>
<t><spanx style="verb">a &gt;= b</spanx>      means a is greater than or equal to b.
</t>
<t><spanx style="verb">a &lt; b</spanx>       means a is less than b.
</t>
<t><spanx style="verb">a &lt;= b</spanx>      means a is less than or equal b.
</t>
<t><spanx style="verb">a == b</spanx>      means a is equal to b.
</t>
<t><spanx style="verb">a != b</spanx>      means a is not equalto b.
</t>
<t><spanx style="verb">a &amp;&amp; b</spanx>      means boolean logical &quot;and&quot; of a and b.
</t>
<t><spanx style="verb">a || b</spanx>      means boolean logical &quot;or&quot; of a and b.
</t>
<t><spanx style="verb">!a</spanx>          means boolean logical &quot;not&quot;.
</t>
<t><spanx style="verb">a ? b : c</spanx>   if a is true, then b, otherwise c.
</t>
</section>

<section anchor="mathematical-functions" title="Mathematical functions">
<t>$\lfloor a \rfloor$ the largest integer less than or equal to a
</t>
<t>$\lceil a \rceil$   the smallest integer greater than or equal to a
</t>
</section>

<section anchor="order-of-operation-precedence" title="Order of operation precedence">
<t>When order of precedence is not indicated explicitly by use of parentheses, operations are evaluated in the following order (from top to bottom, operations of same precedence being evaluated from left to right). This order of operations is based on the order of operations used in Standard C.
</t>

<figure align="center"><artwork align="center">
a++, a–
!a, -a
a * b, a / b, a % b
a + b, a - b
a &lt;&lt; b, a &gt;&gt; b
a &lt; b, a &lt;= b, a &gt; b, a &gt;= b
a == b, a != b
a &amp; b
a | b
a &amp;&amp; b
a || b
a ? b : c
a = b, a += b, a -= b
</artwork></figure>
</section>

<section anchor="range" title="Range">
<t><spanx style="verb">a...b</spanx> means any value starting from a to b, inclusive.
</t>
</section>

<section anchor="bitstream-functions" title="Bitstream functions">
<t><spanx style="verb">remaining_bits_in_bitstream( )</spanx> 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.
</t>
<t><spanx style="verb">byte_aligned( )</spanx> means <spanx style="verb">remaining_bits_in_bitstream( )</spanx> is a multiple of 8.
</t>
<t>\pagebreak
</t>
</section>
</section>

<section anchor="general-description" title="General Description">
<t>Each frame is split in 1 to 4 planes (Y, Cb, Cr, Alpha). In the case of the normal YCbCr colorspace the Y plane is coded first followed by the Cb and Cr planes, if an Alpha/transparency plane exists, it is coded last. In the case of the JPEG2000-RCT colorspace the lines are interleaved to improve caching efficiency since it is most likely that the RCT will immediately be converted to RGB during decoding; the interleaved coding order is also Y, Cb, Cr, Alpha.
</t>
<t>Samples within a plane are coded in raster scan order (left-&gt;right, top-&gt;bottom). Each sample is predicted by the median predictor from samples in the same plane and the difference is stored see <xref target="coding-of-the-sample-difference"/>.
</t>

<section anchor="border" title="Border">
<t>For the purpose of the predictior and context, samples above the coded slice are assumed to be 0; samples to the right of the coded slice are identical to the closest left sample; samples to the left of the coded slice are identical to the top right sample (if there is one), otherwise 0.
</t>
<texttable>
<ttcol align="center"></ttcol>
<ttcol align="center"></ttcol>
<ttcol align="center"></ttcol>
<ttcol align="center"></ttcol>
<ttcol align="center"></ttcol>
<ttcol align="center"></ttcol>
<ttcol align="center"></ttcol>
<ttcol align="center"></ttcol>

<c>0</c><c>0</c><c></c><c>0</c><c>0</c><c>0</c><c></c><c>0</c>
<c>0</c><c>0</c><c></c><c>0</c><c>0</c><c>0</c><c></c><c>0</c>
<c></c><c></c><c></c><c></c><c></c><c></c><c></c><c></c>
<c>0</c><c>0</c><c></c><c>a</c><c>b</c><c>c</c><c></c><c>c</c>
<c>0</c><c>a</c><c></c><c>d</c><c></c><c>e</c><c></c><c>e</c>
<c>0</c><c>d</c><c></c><c>f</c><c>g</c><c>h</c><c></c><c>h</c>
</texttable>
</section>

<section anchor="median-predictor" title="Median predictor">
<t>median(left, top, left + top - diag)
</t>
<t>left, top, diag are the left, top and left-top samples
</t>
<t>Note, this is also used in <xref target="references"/>.
</t>
</section>

<section anchor="context" title="Context">
<texttable>
<ttcol align="center"></ttcol>
<ttcol align="center"></ttcol>
<ttcol align="center"></ttcol>
<ttcol align="center"></ttcol>

<c></c><c></c><c>T</c><c></c>
<c></c><c>tl</c><c>t</c><c>tr</c>
<c>L</c><c>l</c><c>X</c><c></c>
</texttable>
<t>The quantized sample differences L-l, l-tl, tl-t, t-T, t-tr are used as context:
</t>
<t>$context=Q_{0}[l-tl]+\left|Q_{0}\right|(Q_{1}[tl-t]+\left|Q_{1}\right|(Q_{2}[t-tr]+\left|Q_{2}\right|(Q_{3}[L-l]+\left|Q_{3}\right|Q_{4}[T-t])))$
</t>
<t>If the context is smaller than 0 then -context is used and the difference between the sample and its predicted value is encoded with a flipped sign.
</t>
</section>

<section anchor="quantization" title="Quantization">
<t>There are 5 quantization tables for the 5 sample differences, both the number of quantization steps and their distribution are stored in the bitstream. Each quantization table has exactly 256 entries, and the 8 least significant bits of the sample difference are used as index:
</t>
<t>$Q_{i}[a-b]=Table_{i}[(a-b)&amp;255]$
</t>
</section>

<section anchor="colorspace" title="Colorspace">

<section anchor="jpeg2000rct" title="JPEG2000-RCT">
<t>$Cb=b-g$
</t>
<t>$Cr=r-g$
</t>
<t>$Y=g+(Cb+Cr)&gt;&gt;2$
</t>
<t>$g=Y-(Cb+Cr)&gt;&gt;2$
</t>
<t>$r=Cr+g$
</t>
<t>$b=Cb+g$
</t>
<t><xref target="references"/>
</t>
</section>
</section>

<section anchor="coding-of-the-sample-difference" title="Coding of the sample difference">
<t>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 n+1) least significant bits are used, since this is sufficient to recover the original sample. In the equation below, the term &quot;bits&quot; represents bits_per_raw_sample+1 for RCT or bits_per_raw_sample otherwise:
</t>
<t>$coder_input=\left[\left(sample_difference+2^{bits-1}\right)&amp;\left(2^{bits}-1\right)\right]-2^{bits-1}$
</t>

<section anchor="range-coding-mode" title="Range coding mode">
<t>Early experimental versions of FFV1 used the CABAC Arithmetic coder from <xref target="references"/> but due to the uncertain patent/royality situation, as well as its slightly worse performance, CABAC was replaced by a Range coder based on an algorithm defined by <spanx style="emph">G. Nigel N. Martin</spanx> in 1979 <xref target="references"/>.
</t>

<section anchor="range-binary-values" title="Range binary values">
<t>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. $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 binary symbols is $j_{n}$ bytes.
</t>
<t>$r_{i}=\left\lfloor \frac{R_{i}S_{i,C_{i}}}{2^{8}}\right\rfloor$
</t>
<t>$\begin{array}{ccccccccc}
S_{i+1,C_{i}}=zero_state_{S_{i,C_{i}}} &amp; \wedge &amp; l<spanx style="emph">{i}=L</spanx>{i} &amp; \wedge &amp; t_{i}=R_{i}-r_{i} &amp; \Longleftarrow &amp; b_{i}=0 &amp; \Longleftrightarrow &amp; L_{i}
<figure align="center"><artwork align="center">

</artwork></figure>
=one_state_{S_{i,C_{i}}} &amp; \wedge &amp; l_{i}=L_{i}-R_{i}+r_{i} &amp; \wedge &amp; t_{i}=r_{i} &amp; \Longleftarrow &amp; b_{i}=1 &amp; \Longleftrightarrow &amp; L_{i}\geq R_{i}-r_{i}
\end{array}$
</t>
<t>$\begin{array}{ccc}
S_{i+1,k}=S_{i,k} &amp; \Longleftarrow &amp; C_{i}\neq k
\end{array}$
</t>
<t>$\begin{array}{ccccccc}
R_{i+1}=2^{8}t_{i} &amp; \wedge &amp; L_{i+1}=2^{8}l_{i}+B_{j_{i}} &amp; \wedge &amp; j_{i+1}=j_{i}+1 &amp; \Longleftarrow &amp; t_{i}&lt;2^{8}
<vspace/>
R_{i+1}=t_{i} &amp; \wedge &amp; L_{i+1}=l_{i} &amp; \wedge &amp; j_{i+1}=j_{i} &amp; \Longleftarrow &amp; t_{i}\geq2^{8}
\end{array}$
</t>
<t>$R_{0}=65280$
</t>
<t>$L_{0}=2^{8}B_{0}+B_{1}$
</t>
<t>$j_{0}=2$
</t>
</section>

<section anchor="range-non-binary-values" title="Range non binary values">
<t>To encode scalar integers it would be possible to encode each bit separately and use the past bits as context. However that would mean 255 contexts per 8-bit symbol which is not only a waste of memory but also requires more past data to reach a reasonably good estimate of the probabilities. Alternatively assuming a Laplacian distribution and only dealing with its variance and mean (as in Huffman coding) would also be possible, however, for maximum flexibility and simplicity, the chosen method uses a single symbol to encode if a number is 0 and if not encodes the number using its exponent, mantissa and sign. The exact contexts used are best described by the following code, followed by some comments.
</t>

<figure align="center"><artwork align="center" type="c">
void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed) {
    int i;
    put_rac(c, state+0, !v);
    if (v) {
        int a= ABS(v);
        int e= log2(a);

        for (i=0; i&lt;e; i++)
            put_rac(c, state+1+MIN(i,9), 1);  //1..10

        put_rac(c, state+1+MIN(i,9), 0);
        for (i=e-1; i&gt;=0; i--)
            put_rac(c, state+22+MIN(i,9), (a&gt;&gt;i)&amp;1); //22..31

        if (is_signed)
            put_rac(c, state+11 + MIN(e, 10), v &lt; 0); //11..21
    }
}
</artwork></figure>
</section>

<section anchor="initial-values-for-the-context-model" title="Initial values for the context model">
<t>At keyframes all Range coder state variables are set to their initial state.
</t>
</section>

<section anchor="state-transition-table" title="State transition table">
<t>$one_state_{i}=default_state_transition_{i}+state_transition_delta_{i}$
</t>
<t>$zero_state_{i}=256-one_state_{256-i}$
</t>
</section>

<section anchor="defaultstatetransition" title="default_state_transition">

<figure align="center"><artwork align="center">
  0,  0,  0,  0,  0,  0,  0,  0, 20, 21, 22, 23, 24, 25, 26, 27,

 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42,

 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57,

 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,

 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,

 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99,100,101,102,103,

104,105,106,107,108,109,110,111,112,113,114,114,115,116,117,118,

119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,133,

134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,

150,151,152,152,153,154,155,156,157,158,159,160,161,162,163,164,

165,166,167,168,169,170,171,171,172,173,174,175,176,177,178,179,

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,

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,

241,242,243,244,245,246,247,248,248,  0,  0,  0,  0,  0,  0,  0,
</artwork></figure>
</section>

<section anchor="alternative-state-transition-table" title="alternative state transition table">
<t>The alternative state transition table has been build using iterative minimization of frame sizes and generally performs better than the default. To use it, the coder_type has to be set to 2 and the difference to the default has to be stored in the parameters. The reference implemenation of FFV1 in FFmpeg uses this table by default at the time of this writing when Range coding is used.
</t>

<figure align="center"><artwork align="center">
  0, 10, 10, 10, 10, 16, 16, 16, 28, 16, 16, 29, 42, 49, 20, 49,

 59, 25, 26, 26, 27, 31, 33, 33, 33, 34, 34, 37, 67, 38, 39, 39,

 40, 40, 41, 79, 43, 44, 45, 45, 48, 48, 64, 50, 51, 52, 88, 52,

 53, 74, 55, 57, 58, 58, 74, 60,101, 61, 62, 84, 66, 66, 68, 69,

 87, 82, 71, 97, 73, 73, 82, 75,111, 77, 94, 78, 87, 81, 83, 97,

 85, 83, 94, 86, 99, 89, 90, 99,111, 92, 93,134, 95, 98,105, 98,

105,110,102,108,102,118,103,106,106,113,109,112,114,112,116,125,

115,116,117,117,126,119,125,121,121,123,145,124,126,131,127,129,

165,130,132,138,133,135,145,136,137,139,146,141,143,142,144,148,

147,155,151,149,151,150,152,157,153,154,156,168,158,162,161,160,

172,163,169,164,166,184,167,170,177,174,171,173,182,176,180,178,

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,

209,211,221,212,213,215,224,216,217,218,219,220,222,228,223,225,

226,224,227,229,240,230,231,232,233,234,235,236,238,239,237,242,

241,243,242,244,245,246,247,248,249,250,251,252,252,253,254,255,
</artwork></figure>
</section>
</section>

<section anchor="huffman-coding-mode" title="Huffman coding mode">
<t>This coding mode uses golomb rice codes. The VLC code is split into 2 parts, the prefix stores the most significant bits, the suffix stores the k least significant bits or stores the whole number in the ESC case. The end of the bitstream (of the frame) is filled with 0-bits so that the bitstream contains a multiple of 8 bits.
</t>

<section anchor="prefix" title="Prefix">
<texttable>
<ttcol align="left">bits</ttcol>
<ttcol align="left">value</ttcol>

<c>1</c><c>0</c>
<c>01</c><c>1</c>
<c>...</c><c>...</c>
<c>0000 0000 0001</c><c>11</c>
<c>0000 0000 0000</c><c>ESC</c>
</texttable>
</section>

<section anchor="suffix" title="Suffix">
<texttable>
<ttcol align="left"></ttcol>
<ttcol align="center"></ttcol>

<c>non ESC</c><c>the k least significant bits MSB first</c>
<c>ESC</c><c>the value - 11, in MSB first order, ESC may only be used if the value cannot be coded as non ESC</c>
</texttable>
</section>

<section anchor="examples" title="Examples">
<texttable>
<ttcol align="center">k</ttcol>
<ttcol align="left">bits</ttcol>
<ttcol align="right">value</ttcol>

<c>0</c><c><spanx style="verb">1</spanx></c><c>0</c>
<c>0</c><c><spanx style="verb">001</spanx></c><c>2</c>
<c>2</c><c><spanx style="verb">1 00</spanx></c><c>0</c>
<c>2</c><c><spanx style="verb">1 10</spanx></c><c>2</c>
<c>2</c><c><spanx style="verb">01 01</spanx></c><c>5</c>
<c>any</c><c><spanx style="verb">000000000000 10000000</spanx></c><c>139</c>
</texttable>
</section>

<section anchor="run-mode" title="Run mode">
<t>Run mode is entered when the context is 0, and left as soon as a non-0 difference is found, the level is identical to the predicted one, the run and the first different level is coded.
</t>
</section>

<section anchor="run-length-coding" title="Run length coding">
<t>The run value is encoded in 2 parts, the prefix part stores the more significant part of the run as well as adjusting the run_index which determines the number of bits in the less significant part of the run. The 2nd part of the value stores the less significant part of the run as it is. The run_index is reset for each plane and slice to 0.
</t>

<figure align="center"><artwork align="center" type="c">
log2_run[41]={
 0, 0, 0, 0, 1, 1, 1, 1,
 2, 2, 2, 2, 3, 3, 3, 3,
 4, 4, 5, 5, 6, 6, 7, 7,
 8, 9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,
24,
};

if (run_count == 0 &amp;&amp; run_mode == 1) {
    if (get_bits1()) {
        run_count = 1 &lt;&lt; log2_run[run_index];
        if (x + run_count &lt;= w)
            run_index++;
    } else {
        if (log2_run[run_index])
            run_count = get_bits(log2_run[run_index]);
        else
            run_count = 0;
        if (run_index)
            run_index--;
        run_mode = 2;
    }
}
</artwork></figure>
<t>The log2_run function is also used within <xref target="references"/>.
</t>
</section>

<section anchor="level-coding" title="Level coding">
<t>Level coding is identical to the normal difference coding with the exception that the 0 value is removed as it cannot occur:
</t>

<figure align="center"><artwork align="center" type="c">
    if(diff&gt;0) diff--;
    encode(diff);
</artwork></figure>
<t>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 difference On a small set of test samples the use of prediction slightly improved the compression rate.
</t>
</section>
</section>
</section>
</section>

<section anchor="bitstream" title="Bitstream">
<texttable>
<ttcol align="center">Symbol</ttcol>
<ttcol align="center">Defintion</ttcol>

<c>u(n)</c><c>unsigned big endian integer using n bits</c>
<c>sg</c><c>Golomb Rice coded signed scalar symbol coded with the method described in <xref target="huffman-coding-mode"/></c>
<c>br</c><c>Range coded boolean (1-bit) symbol with the method described in <xref target="range-binary-values"/></c>
<c>ur</c><c>Range coded unsigned scalar symbol coded with the method described in <xref target="range-non-binary-values"/></c>
<c>sr</c><c>Range coded signed scalar symbol coded with the method described in <xref target="range-non-binary-values"/></c>
</texttable>
<t>The same context which is initialized to 128 is used for all fields in the header.
</t>
<t>The following MUST be provided by external means during initialization of the decoder:
</t>
<t><spanx style="verb">frame_pixel_width</spanx> is defined as frame width in pixels.
</t>
<t><spanx style="verb">frame_pixel_height</spanx> is defined as frame height in pixels.
</t>
<t>Default values at the decoder initialization phase:
</t>
<t><spanx style="verb">ConfigurationRecordIsPresent</spanx> is set to 0.
</t>

<section anchor="configuration-record" title="Configuration Record">
<t>In the case of a bitstream with version &gt;= 3, a configuration record is stored in the underlying container, at the track header level.
It contains the parameters used for all frames.
The size of the configuration record, NumBytes, is supplied by the underlying container.
</t>
<t><spanx style="verb">c
ConfigurationRecord( NumBytes ) {
    ConfigurationRecordIsPresent = 1
    Parameters( )
    while( remaining_bits_in_bitstream( ) &gt; 32 )
        reserved_for_future_use                     // u(1)
    configuration_record_crc_parity                 // u(32)</spanx>`
</t>
<t><spanx style="verb">reserved_for_future_use</spanx> has semantics that are reserved for future use.
Encoders conforming to this version of this specification SHALL NOT write this value.
Decoders conforming to this version of this specification SHALL ignore its value.
</t>
<t><spanx style="verb">configuration_record_crc_parity</spanx> 32 bits that are choosen so that the configuration record as a whole has a crc remainder of 0.
This is equivalent to storing the crc remainder in the 32-bit parity.
The CRC generator polynom used is the standard IEEE CRC polynom (0x104C11DB7) with initial value 0.
</t>
<t>This configuration record can be placed in any file format supporting configuration records, fitting as much as possible with how the file format uses to store configuration records. The configuration record storage place and NumBytes are currently defined and supported by this version of this specification for the following container formats:
</t>

<section anchor="in-avi-file-format" title="In AVI File Format">
<t>The Configuration Record extends the stream format chunk (&quot;AVI &quot;, &quot;hdlr&quot;, &quot;strl&quot;, &quot;strf&quot;) with the ConfigurationRecord bistream.
See <xref target="references"/> for more information about chunks.
</t>
<t><spanx style="verb">NumBytes</spanx> is defined as the size, in bytes, of the strf chunk indicated in the chunk header minus the size of the stream format structure.
</t>
</section>

<section anchor="in-isoiec-1449612-mp4-file-format" title="In ISO/IEC 14496-12 (MP4 File Format)">
<t>The Configuration Record extends the sample description box (&quot;moov&quot;, &quot;trak&quot;, &quot;mdia&quot;, &quot;minf&quot;, &quot;stbl&quot;, &quot;stsd&quot;) with a &quot;glbl&quot; box which contains the ConfigurationRecord bitstream.
See <xref target="references"/> for more information about boxes.
</t>
<t><spanx style="verb">NumBytes</spanx> is defined as the size, in bytes, of the &quot;glbl&quot; box indicated in the box header minus the size of the box header.
</t>
</section>

<section anchor="in-nut-file-format" title="In NUT File Format">
<t>The codec_specific_data element (in &quot;stream_header&quot; packet) contains the ConfigurationRecord bitstream.
See <xref target="references"/> for more information about elements.
</t>
<t><spanx style="verb">NumBytes</spanx> is defined as the size, in bytes, of the codec_specific_data element as indicated in the &quot;length&quot; field of codec_specific_data
</t>
</section>
</section>

<section anchor="frame" title="Frame">
<t>A frame consists of the keyframe field, parameters (if version &lt;=1), and a sequence of independent slices.
</t>
<t>|                                                        |
|---------------------------------------------------|---:|
|Frame( ) {                                         |type|
|    keyframe                                       |  br|
|    if( keyframe &amp;&amp; !ConfigurationRecordIsPresent )|    |
|         Parameters( )                             |    |
|    while ( remaining_bits_in_bitstream() )     |    |
|        Slice( )                                   |    |
|}                                                  |    |
</t>
</section>

<section anchor="slice" title="Slice">
<t>|                                                                    |
|------------------------------------------------------------|:------|
|Slice( ) {                                                  | type  |
|    if( version &gt;= 3 )                                     |       |
|        SliceHeader( )                                      |       |
|    SliceContent( )                                         |       |
|    if ( coder_type == 0 )                                 |       |
|        while ( !byte_aligned() )                          |       |
|            padding                                         |  u(1) |
|    if( version &gt;= 3 )                                     |       |
|        SliceFooter( )                                      |       |
|}                                                           |       |
</t>
<t><spanx style="verb">padding</spanx> specifies a bit without any significance and used only for byte alignment.
MUST be 0.
</t>
</section>

<section anchor="slice-header" title="Slice Header">
<texttable>
<ttcol align="center"></ttcol>
<ttcol align="right"></ttcol>

<c>SliceHeader( ) {</c><c>type</c>
<c>   slice_x</c><c>ur</c>
<c>   slice_y</c><c>ur</c>
<c>   slice_width - 1</c><c>ur</c>
<c>   slice_height - 1</c><c>ur</c>
<c>   for( i = 0; i &lt; quant_table_index_count; i++ )</c><c></c>
<c>       quant_table_index [ i ]</c><c>ur</c>
<c>   picture_structure</c><c>ur</c>
<c>   sar_num</c><c>ur</c>
<c>   sar_den</c><c>ur</c>
<c>   if( version &gt;= 4 ) {</c><c></c>
<c>       reset_contexts</c><c>br</c>
<c>       slice_coding_mode</c><c>ur</c>
<c>   }</c><c></c>
<c>}</c><c></c>
</texttable>
<t><spanx style="verb">slice_x</spanx> indicates the x position on the slice raster formed by num_h_slices.
Inferred to be 0 if not present.
</t>
<t><spanx style="verb">slice_y</spanx> indicates the y position on the slice raster formed by num_v_slices.
Inferred to be 0 if not present.
</t>
<t><spanx style="verb">slice_width</spanx> indicates the width on the slice raster formed by num_h_slices.
Inferred to be 1 if not present.
</t>
<t><spanx style="verb">slice_height</spanx> indicates the height on the slice raster formed by num_v_slices.
Inferred to be 1 if not present.
</t>
<t><spanx style="verb">quant_table_index_count</spanx> is defined as 1 + ( ( chroma_planes || version &lt;= 3 ) ? 1 : 0 ) + ( alpha_plane ? 1 : 0 ).
</t>
<t><spanx style="verb">quant_table_index</spanx> indicates the index to select the quantization table set and the initial states for the slice.
Inferred to be 0 if not present.
</t>
<t><spanx style="verb">picture_structure</spanx> specifies the picture structure.
Inferred to be 0 if not present.
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">picure structure used</ttcol>

<c>0</c><c>unknown</c>
<c>1</c><c>top field first</c>
<c>2</c><c>bottom field first</c>
<c>3</c><c>progressive</c>
<c>Other</c><c>reserved for future use</c>
</texttable>
<t><spanx style="verb">sar_num</spanx> specifies the sample aspect ratio numerator.
Inferred to be 0 if not present.
MUST be 0 if sample aspect ratio is unknown.
</t>
<t><spanx style="verb">sar_den</spanx> specifies the sample aspect ratio numerator.
Inferred to be 0 if not present.
MUST be 0 if sample aspect ratio is unknown.
</t>
<t><spanx style="verb">reset_contexts</spanx> indicates if slice contexts must be reset.
Inferred to be 0 if not present.
</t>
<t><spanx style="verb">slice_coding_mode</spanx> indicates the slice coding mode.
Inferred to be 0 if not present.
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">slice coding mode</ttcol>

<c>0</c><c>normal Range Coding or VLC</c>
<c>1</c><c>raw PCM</c>
<c>Other</c><c>reserved for future use</c>
</texttable>
</section>

<section anchor="slice-content" title="Slice Content">
<t>|                                                                      |
|--------------------------------------------------------------|:------|
|SliceContent( ) {                                             | type  |
|    if( colorspace_type == 0) {                              |       |
|        for( p = 0; p &lt; primary_color_count; p++ ) {       |       |
|            for( y = 0; y &lt; plane_pixel_height[ p ]; y++ ) |       |
|                Line( p, y )                                  |       |
|    } else if( colorspace_type == 1 ) {                      |       |
|        for( y = 0; y &lt; slice_pixel_height; y++ )          |       |
|            for( p = 0; p &lt; primary_color_count; p++ ) {   |       |
|                Line( p, y )                                  |       |
|    }                                                         |       |
|}                                                             |       |
</t>
<t><spanx style="verb">primary_color_count</spanx> is defined as 1 + ( chroma_planes ? 2 : 0 ) + ( alpha_plane ? 1 : 0 ).
</t>
<t><spanx style="verb">plane_pixel_height[ p ]</spanx> is the height in pixels of plane p of the slice.
<vspace/>
plane_pixel_height[ 0 ] and plane_pixel_height[ 1 + ( chroma_planes ? 2 : 0 ) ] value is slice_pixel_height
<vspace/>
if chroma_planes is set to 1, plane_pixel_height[ 1 ] and plane_pixel_height[ 2 ] value is $\lceil slice_pixel_height / v_chroma_subsample \rceil$
</t>
<t><spanx style="verb">slice_pixel_height</spanx> is the height in pixels of the slice.
<vspace/>
Its value is $\lfloor ( slice_y + slice_height ) * slice_pixel_height / num_v_slices \rfloor - slice_pixel_y$
</t>
<t><spanx style="verb">slice_pixel_y</spanx> is the slice vertical position in pixels.
<vspace/>
Its value is $\lfloor slice_y * frame_pixel_height / num_v_slices \rfloor$
</t>
</section>

<section anchor="line" title="Line">
<t>|                                                                      |
|--------------------------------------------------------------|:------|
|Line( p, y ) {                                                | type  |
|    if( colorspace_type == 0) {                              |       |
|        for( x = 0; x &lt; plane_pixel_width[ p ]; x++ )      |       |
|            Pixel( p, y, x )                                  |       |
|    } else if( colorspace_type == 1 ) {                      |       |
|        for( x = 0; x &lt; slice_pixel_width; x++ )           |       |
|            Pixel( p, y, x )                                  |       |
|    }                                                         |       |
|}                                                             |       |
</t>
<t><spanx style="verb">plane_pixel_width[ p ]</spanx> is the width in pixels of plane p of the slice.
<vspace/>
plane_pixel_width[ 0 ] and plane_pixel_width[ 1 + ( chroma_planes ? 2 : 0 ) ] value is slice_pixel_width
<vspace/>
if chroma_planes is set to 1, plane_pixel_width[ 1 ] and plane_pixel_width[ 2 ] value is $\lceil slice_pixel_width / v_chroma_subsample \rceil$
</t>
<t><spanx style="verb">slice_pixel_width</spanx> is the width in pixels of the slice.
<vspace/>
Its value is $\lfloor ( slice_x + slice_width ) * slice_pixel_width / num_h_slices \rfloor - slice_pixel_x$
</t>
<t><spanx style="verb">slice_pixel_x</spanx> is the slice horizontal position in pixels.
<vspace/>
Its value is $\lfloor slice_x * frame_pixel_width / num_h_slices \rfloor$
</t>
</section>

<section anchor="slice-footer" title="Slice Footer">
<t>Note: slice footer is always byte aligned.
</t>
<t>|                                                                    |
|------------------------------------------------------------|:------|
|SliceFooter( ) {                                            | type  |
|    slice_size                                             | u(24) |
|    if( ec ) {                                              |       |
|        error_status                                       |  u(8) |
|        slice_crc_parity                                  | u(32) |
|    }                                                       |       |
|}                                                           |       |
</t>
<t><spanx style="verb">slice_size</spanx> indicates the size of the slice in bytes.
Note: this allows finding the start of slices before previous slices have been fully decoded. And allows this way parallel decoding as well as error resilience.
</t>
<t><spanx style="verb">error_status</spanx> specifies the error status.
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">error status</ttcol>

<c>0</c><c>no error</c>
<c>1</c><c>slice contains a correctable error</c>
<c>2</c><c>slice contains a uncorrectable error</c>
<c>Other</c><c>reserved for future use</c>
</texttable>
<t><spanx style="verb">slice_crc_parity</spanx> 32 bits that are choosen so that the slice as a whole has a crc remainder of 0.
This is equivalent to storing the crc remainder in the 32-bit parity.
The CRC generator polynom used is the standard IEEE CRC polynom (0x104C11DB7) with initial value 0.
</t>
</section>

<section anchor="parameters" title="Parameters">
<texttable>
<ttcol align="center"></ttcol>
<ttcol align="right"></ttcol>

<c>Parameters( ) {</c><c>type</c>
<c>   version</c><c>ur</c>
<c>   if( version &gt;= 3 )</c><c></c>
<c>       micro_version</c><c>ur</c>
<c>   coder_type</c><c>ur</c>
<c>   if( coder_type &gt; 1 )</c><c></c>
<c>       for( i = 1; i &lt; 256; i++ )</c><c></c>
<c>           state_transition_delta[ i ]</c><c>sr</c>
<c>   colorspace_type</c><c>ur</c>
<c>   if( version &gt;= 1 )</c><c></c>
<c>       bits_per_raw_sample</c><c>ur</c>
<c>   chroma_planes</c><c>br</c>
<c>   log2( h_chroma_subsample )</c><c>ur</c>
<c>   log2( v_chroma_subsample )</c><c>ur</c>
<c>   alpha_plane</c><c>br</c>
<c>   if( version &gt;= 3 ) {</c><c></c>
<c>       num_h_slices - 1</c><c>ur</c>
<c>       num_v_slices - 1</c><c>ur</c>
<c>       quant_table_count</c><c>ur</c>
<c>   }</c><c></c>
<c>   for( i = 0; i &lt; quant_table_count; i++ )</c><c></c>
<c>       QuantizationTable( i )</c><c></c>
<c>   if( version &gt;= 3 ) {</c><c></c>
<c>       for( i = 0; i &lt; quant_table_count; i++ ) {</c><c></c>
<c>           states_coded</c><c>br</c>
<c>           if( states_coded )</c><c></c>
<c>               for( j = 0; j &lt; context_count[ i ]; j++ )</c><c></c>
<c>                   for( k = 0; k &lt; CONTEXT_SIZE; k++ )</c><c></c>
<c>                       initial_state_delta[ i ][ j ][ k ]</c><c>sr</c>
<c>       }</c><c></c>
<c>       ec</c><c>ur</c>
<c>       intra</c><c>ur</c>
<c>   }</c><c></c>
<c>}</c><c></c>
</texttable>
<t><spanx style="verb">version</spanx> specifies the version of the bitstream.
Each version is incompatible with others versions: decoders SHOULD reject a file due to unknown version.
Decoders SHOULD reject a file with version =&lt; 1 &amp;&amp; ConfigurationRecordIsPresent == 1.
Decoders SHOULD reject a file with version &gt;= 3 &amp;&amp; ConfigurationRecordIsPresent == 0.
</t>
<texttable>
<ttcol align="left">value</ttcol>
<ttcol align="left">version</ttcol>

<c>0</c><c>FFV1 version 0</c>
<c>1</c><c>FFV1 version 1</c>
<c>2</c><c>reserved*</c>
<c>3</c><c>FFV1 version 3</c>
<c>Other</c><c>reserved for future use</c>
</texttable>
<t>* 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.
</t>
<t><spanx style="verb">micro_version</spanx> specifies the micro-version of the 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.
</t>
<t>Meaning of micro_version for version 3:
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">micro_version</ttcol>

<c>0...3</c><c>reserved*</c>
<c>4</c><c>first stable variant</c>
<c>Other</c><c>reserved for future use</c>
</texttable>
<t>* were development versions which may be incompatible with the stable variants.
</t>
<t>Meaning of micro_version for version 4 (note: at the time of writting of this specification, version 4 is not considered stable so the first stable version value is to be annonced in the future):
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">micro_version</ttcol>

<c>0...TBA</c><c>reserved*</c>
<c>TBA</c><c>first stable variant</c>
<c>Other</c><c>reserved for future use</c>
</texttable>
<t>* were development versions which may be incompatible with the stable variants.
</t>
<t><spanx style="verb">coder_type</spanx> specifies the coder used
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">coder used</ttcol>

<c>0</c><c>Golomb Rice</c>
<c>1</c><c>Range Coder with default state transition table</c>
<c>2</c><c>Range Coder with custom state transition table</c>
<c>Other</c><c>reserved for future use</c>
</texttable>
<t><spanx style="verb">state_transition_delta</spanx> specifies the Range coder custom state transition table.
If state_transition_delta is not present in the bitstream, all Range coder custom state transition table elements are assumed to be 0.
</t>
<t><spanx style="verb">colorspace_type</spanx> specifies the color space.
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">color space used</ttcol>

<c>0</c><c>YCbCr</c>
<c>1</c><c>JPEG 2000 RCT</c>
<c>Other</c><c>reserved for future use</c>
</texttable>
<t><spanx style="verb">chroma_planes</spanx> indicates if chroma (color) planes are present.
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">color space used</ttcol>

<c>0</c><c>chroma planes are not present</c>
<c>1</c><c>chroma planes are present</c>
</texttable>
<t><spanx style="verb">bits_per_raw_sample</spanx> indicates the number of bits for each luma and chroma sample. Inferred to be 8 if not present.
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">bits for each luma and chroma sample</ttcol>

<c>0</c><c>reserved*</c>
<c>Other</c><c>the actual bits for each luma and chroma sample</c>
</texttable>
<t>* Encoders MUST NOT store bits_per_raw_sample = 0
Decoders SHOULD accept and interpret bits_per_raw_sample = 0 as 8.
</t>
<t><spanx style="verb">h_chroma_subsample</spanx> indicates the subsample factor between luma and chroma width ($chroma_width=2^{-log2_h_chroma_subsample}luma_width$)
</t>
<t><spanx style="verb">v_chroma_subsample</spanx> indicates the subsample factor between luma and chroma height ($chroma_height=2^{-log2_v_chroma_subsample}luma_height$)
</t>
<t>
<list style="hanging">
<t hangText="alpha_plane">
<vspace />
indicates if a transparency plane is present.</t>
</list>
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">color space used</ttcol>

<c>0</c><c>transparency plane is not present</c>
<c>1</c><c>transparency plane is present</c>
</texttable>
<t><spanx style="verb">num_h_slices</spanx> indicates the number of horizontal elements of the slice raster.
Inferred to be 1 if not present.
</t>
<t><spanx style="verb">num_v_slices</spanx> indicates the number of vertical elements of the slice raster.
Inferred to be 1 if not present.
</t>
<t><spanx style="verb">quant_table_count</spanx> indicates the number of quantization table sets.
Inferred to be 1 if not present.
</t>
<t><spanx style="verb">states_coded</spanx> indicates if the respective quantization table set has the initial states coded.
Inferred to be 0 if not present.
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">initial states</ttcol>

<c>0</c><c>initial states are not present and are assumed to be all 128</c>
<c>1</c><c>initial states are present</c>
</texttable>
<t><spanx style="verb">initial_state_delta</spanx> [ 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 ] ) &amp; 255
</t>
<t><spanx style="verb">ec</spanx> indicates the error detection/correction type.
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">error detection/correction type</ttcol>

<c>0</c><c>32bit CRC on the global header</c>
<c>1</c><c>32bit CRC per slice and the global header</c>
<c>Other</c><c>reserved for future use</c>
</texttable>
<t><spanx style="verb">intra</spanx> indicates the relationship between frames.
    Inferred to be 0 if not present.
</t>
<texttable>
<ttcol align="center">value</ttcol>
<ttcol align="center">relationship</ttcol>

<c>0</c><c>frames are independent or dependent (key and non key frames)</c>
<c>1</c><c>frames are independent (key frames only)</c>
<c>Other</c><c>reserved for future use</c>
</texttable>
</section>

<section anchor="quantization-tables" title="Quantization Tables">
<t>The quantization tables are stored by storing the number of equal entries -1 of the first half of the table using the method described in <xref target="range-non-binary-values"/>. The second half doesn’t need to be stored as it is identical to the first with flipped sign.
</t>
<t>example:
</t>
<t>Table: 0 0 1 1 1 1 2 2-2-2-2-1-1-1-1 0
</t>
<t>Stored values: 1, 3, 1
</t>
<texttable>
<ttcol align="center"></ttcol>

<c>QuantizationTable( i ) {</c>
<c>   scale = 1</c>
<c>   for( j = 0; j &lt; MAX_CONTEXT_INPUTS; j++ ) {</c>
<c>       QuantizationTablePerContext( i, j, scale )</c>
<c>       scale *= 2 * len_count[ i ][ j ] - 1</c>
<c>   }</c>
<c>   context_count[ i ] = ( scale + 1 ) / 2</c>
</texttable>
<t>MAX_CONTEXT_INPUTS is 5.
</t>
<texttable>
<ttcol align="center"></ttcol>
<ttcol align="center"></ttcol>

<c>QuantizationTablePerContext(i, j, scale) {</c><c>type</c>
<c>    v = 0</c><c></c>
<c>    for( k = 0; k &lt; 128; ) {</c><c></c>
<c>        len - 1</c><c>sr</c>
<c>        for( a = 0; a &lt; len; a++ ) {</c><c></c>
<c>            quant_tables[ i ][ j ][ k ] = scale* v</c><c></c>
<c>            k++</c><c></c>
<c>        }</c><c></c>
<c>        v++</c><c></c>
<c>    }</c><c></c>
<c>    for( k = 1; k &lt; 128; k++ ) {</c><c></c>
<c>        quant_tables[ i ][ j ][ 256 - k ] = -quant_tables[ i ][ j ][ k ]</c><c></c>
<c>    }</c><c></c>
<c>    quant_tables[ i ][ j ][ 128 ] = -quant_tables[ i ][ j ][ 127 ]</c><c></c>
<c>    len_count[ i ][ j ] = v</c><c></c>
<c>}</c><c></c>
</texttable>
<t><spanx style="verb">quant_tables</spanx> indicates the quantification table values.
</t>
<t><spanx style="verb">context_count</spanx> indicates the count of contexts.
</t>

<section anchor="restrictions" title="Restrictions">
<t>To ensure that fast multithreaded decoding is possible, starting version 3 and if frame_pixel_width * frame_pixel_height is more than 101376, slice_width * slice_height MUST be less or equal to num_h_slices * num_v_slices / 4.
Note: 101376 is the frame size in pixels of a 352x288 frame also known as CIF (&quot;Common Intermediate Format&quot;) frame size format.
</t>
<t>For each frame, each position in the slice raster MUST be filled by one and only one slice of the frame (no missing slice position, no slice overlapping).
</t>
<t>For each Frame with keyframe value of 0, each slice MUST have the same value of slice_x, slice_y, slice_width, slice_height as a slice in the previous frame, except if reset_contexts is 1.
</t>
</section>
</section>
</section>

<section anchor="appendixes" title="Appendixes">

<section anchor="decoder-implementation-suggestions" title="Decoder implementation suggestions">

<section anchor="multithreading-support-and-independence-of-slices" title="Multi-threading support and independence of slices">
<t>The bitstream is parsable in two ways: in sequential order as described in this document or with the pre-analysis of the footer of each slice. Each slice footer contains a slice_size field so the boundary of each slice is computable without having to parse the slice content. That allows multi-threading as well as independence of slice content (a bitstream error in a slice header or slice content has no impact on the decoding of the other slices).
</t>
<t>After having checked keyframe field, a decoder SHOULD parse 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, before parsing slices, in order to have slices boundaries. A decoder MAY fallback on sequential order e.g. in case of corrupted frame (frame size unknown, slice_size of slices not coherant...) or if there is no possibility of seek into the stream.
</t>
<t>Architecture overwiew of slices in a frame:
</t>
<texttable>
<ttcol align="left"></ttcol>

<c>first slice header</c>
<c>first slice content</c>
<c>first slice footer</c>
<c>---------------------------------------------------------------</c>
<c>second slice header</c>
<c>second slice content</c>
<c>second slice footer</c>
<c>---------------------------------------------------------------</c>
<c>...</c>
<c>---------------------------------------------------------------</c>
<c>last slice header</c>
<c>last slice content</c>
<c>last slice footer</c>
</texttable>
</section>
</section>
</section>

<section anchor="changelog" title="Changelog">
<t>See <eref target="https://github.com/FFmpeg/FFV1/commits/master"/>
</t>
</section>

<section anchor="todo" title="ToDo">
<t>
<list style="symbols">
<t>mean,k estimation for the golomb rice codes</t>
</list>
</t>
</section>

<section anchor="bibliography" title="Bibliography">

<section anchor="references" title="References">
<t>RFC 2119 - Key words for use in RFCs to Indicate Requirement Levels <eref target="https://www.ietf.org/rfc/rfc2119.txt"/>
</t>
<t>ISO/IEC 9899 - Programming languages - C <eref target="http://www.open-std.org/JTC1/SC22/WG14/www/standards"/>
</t>
<t>JPEG-LS FCD 14495 <eref target="http://www.jpeg.org/public/fcd14495p.pdf"/>
</t>
<t>H.264 Draft <eref target="http://bs.hhi.de/~wiegand/JVT-G050.pdf"/>
</t>
<t>HuffYuv <eref target="http://cultact-server.novi.dk/kpo/huffyuv/huffyuv.html"/>
</t>
<t>FFmpeg <eref target="http://ffmpeg.org"/>
</t>
<t>JPEG2000 <eref target="http://www.jpeg.org/jpeg2000/"/>
</t>
<t>Range encoding: an algorithm for removing redundancy from a digitised message. Presented by G. Nigel N. Martin at the Video &amp; Data Recording Conference, IBM UK Scientific Center held in Southampton July 24-27 1979.
</t>
<t>AVI RIFF File Format <eref target="https://msdn.microsoft.com/en-us/library/windows/desktop/dd318189%28v=vs.85%29.aspx"/>
</t>
<t>Information technology Coding of audio-visual objects Part 12: ISO base media file format <eref target="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=61988"/>
</t>
<t>NUT Open Container Format <eref target="http://www.ffmpeg.org/~michael/nut.txt"/>
</t>
</section>
</section>

<section anchor="copyright" title="Copyright">
<t>Copyright 2003-2013 Michael Niedermayer &lt;michaelni@gmx.at&gt;
This text can be used under the GNU Free Documentation License or GNU General Public License. See <eref target="http://www.gnu.org/licenses/fdl.txt"/>.
</t>
</section>

</middle>
</rfc>
