FFV1
FFV1, which stands for "FF video codec 1", is a lossless intra-frame video format. It can use either variable length coding or arithmetic coding for entropy coding. The encoder and decoder are part of the free, open-source library libavcodec in the project FFmpeg. FFV1 is included in ffdshow.
Prediction process
FFV1 is not strictly an intra-frame format; despite not using inter-frame prediction, it allows the context model to adapt over multiple frames. This can be useful for compression due to the very large size of the context table, but can be disabled to force the encoder to generate a strictly intra-frame bitstream. During progressive scanning of a frame, the difference between a current pixel and its predicted value, judging by neighboring pixels, is sent to the entropy-coding process. The prediction is done as follows:
- Prediction = Median( Top, Left, Top + Left - TopLeft )
The third value, "Top + Left - TopLeft", is also known as the gradient, so in simple terms the prediction is the median of the top, left, and gradient prediction methods. For improved performance and simplicity, the edges of the frame are assumed to be zero to avoid special cases. The prediction in encoding and decoding is managed using a ring buffer.
Entropy coding process
The residuals are coded using either variable-length coding or arithmetic coding. Both options use a very large context model. The "small" context model uses 11*11*11=1331 contexts based on the neighboring values of (Left-TopLeft), (TopLeft-Top), and (Top-TopRight). The "large" context model uses 11*11*5*5*5=15125 contexts based on the same values as before, but also (TopTop - Top) and (LeftLeft-Left), where "TopTop" is the pixel two above the current one vertically, and "LeftLeft" is the pixel two to the left of the current one. In arithmetic coding, each "context" actually has 32 sub-contexts used for various portions of coding each residual, resulting in a grand total of 484,000 contexts for the "large" model.
Status
The codec is no longer marked as experimental. The bitstream is fixed, but documentation remains incomplete.