libavcodec/ffv1.c File Reference

FF Video Codec 1 (an experimental lossless codec). More...

#include "avcodec.h"
#include "bitstream.h"
#include "dsputil.h"
#include "rangecoder.h"
#include "golomb.h"
#include "mathops.h"

Go to the source code of this file.

Data Structures

struct  VlcState
struct  PlaneContext
struct  FFV1Context

Defines

#define MAX_PLANES   4
#define CONTEXT_SIZE   32

Functions

static av_always_inline int fold (int diff, int bits)
static int predict (int_fast16_t *src, int_fast16_t *last)
static int get_context (FFV1Context *f, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2)
static void put_symbol (RangeCoder *c, uint8_t *state, int v, int is_signed)
static int get_symbol (RangeCoder *c, uint8_t *state, int is_signed)
static void update_vlc_state (VlcState *const state, const int v)
static void put_vlc_symbol (PutBitContext *pb, VlcState *const state, int v, int bits)
static int get_vlc_symbol (GetBitContext *gb, VlcState *const state, int bits)
static av_cold int common_init (AVCodecContext *avctx)
static void clear_state (FFV1Context *f)
static av_cold int common_end (AVCodecContext *avctx)
static void decode_line (FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits)
static void decode_plane (FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index)
static void decode_rgb_frame (FFV1Context *s, uint32_t *src, int w, int h, int stride)
static int read_quant_table (RangeCoder *c, int16_t *quant_table, int scale)
static int read_header (FFV1Context *f)
static av_cold int decode_init (AVCodecContext *avctx)
static int decode_frame (AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)

Variables

const uint8_t ff_log2_run [32]
static const int8_t quant3 [256]
static const int8_t quant5 [256]
static const int8_t quant7 [256]
static const int8_t quant9 [256]
static const int8_t quant11 [256]
static const int8_t quant13 [256]
AVCodec ffv1_decoder


Detailed Description

FF Video Codec 1 (an experimental lossless codec).

Definition in file ffv1.c.


Define Documentation

#define CONTEXT_SIZE   32

Definition at line 36 of file ffv1.c.

Referenced by clear_state(), read_header(), and read_quant_table().

#define MAX_PLANES   4

Definition at line 35 of file ffv1.c.


Function Documentation

static void clear_state ( FFV1Context f  )  [static]

Definition at line 613 of file ffv1.c.

Referenced by decode_frame().

static av_cold int common_end ( AVCodecContext avctx  )  [static]

Definition at line 693 of file ffv1.c.

Referenced by decode_end(), and encode_end().

static av_cold int common_init ( AVCodecContext avctx  )  [static]

Definition at line 529 of file ffv1.c.

static int decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
const uint8_t *  buf,
int  buf_size 
) [static]

Definition at line 938 of file ffv1.c.

static av_cold int decode_init ( AVCodecContext avctx  )  [static]

Definition at line 929 of file ffv1.c.

static void decode_line ( FFV1Context s,
int  w,
int_fast16_t *  sample[2],
int  plane_index,
int  bits 
) [inline, static]

Definition at line 707 of file ffv1.c.

Referenced by decode_plane(), and decode_rgb_frame().

static void decode_plane ( FFV1Context s,
uint8_t *  src,
int  w,
int  h,
int  stride,
int  plane_index 
) [static]

Definition at line 764 of file ffv1.c.

Referenced by decode_frame().

static void decode_rgb_frame ( FFV1Context s,
uint32_t *  src,
int  w,
int  h,
int  stride 
) [static]

Definition at line 793 of file ffv1.c.

Referenced by decode_frame().

static av_always_inline int fold ( int  diff,
int  bits 
) [static]

Definition at line 184 of file ffv1.c.

Referenced by get_vlc_symbol(), and put_vlc_symbol().

static int get_context ( FFV1Context f,
int_fast16_t *  src,
int_fast16_t *  last,
int_fast16_t *  last2 
) [inline, static]

Definition at line 204 of file ffv1.c.

Referenced by decode_line().

static int get_symbol ( RangeCoder c,
uint8_t *  state,
int  is_signed 
) [inline, static]

static int get_vlc_symbol ( GetBitContext gb,
VlcState *const   state,
int  bits 
) [inline, static]

Definition at line 325 of file ffv1.c.

Referenced by decode_line().

static int predict ( int_fast16_t *  src,
int_fast16_t *  last 
) [inline, static]

Definition at line 196 of file ffv1.c.

static void put_symbol ( RangeCoder c,
uint8_t *  state,
int  v,
int  is_signed 
) [inline, static]

Definition at line 219 of file ffv1.c.

Referenced by encode_header(), encode_q_branch(), encode_q_branch2(), and encode_qlogs().

static void put_vlc_symbol ( PutBitContext pb,
VlcState *const   state,
int  v,
int  bits 
) [inline, static]

Definition at line 298 of file ffv1.c.

static int read_header ( FFV1Context f  )  [static]

Definition at line 864 of file ffv1.c.

Referenced by decode_frame(), and mjpegb_decode_frame().

static int read_quant_table ( RangeCoder c,
int16_t *  quant_table,
int  scale 
) [static]

Definition at line 836 of file ffv1.c.

Referenced by read_header().

static void update_vlc_state ( VlcState *const   state,
const int  v 
) [inline, static]

Definition at line 267 of file ffv1.c.

Referenced by get_vlc_symbol(), and put_vlc_symbol().


Variable Documentation

const uint8_t ff_log2_run[32]

Definition at line 33 of file bitstream.c.

Initial value:

 {
    "ffv1",
    CODEC_TYPE_VIDEO,
    CODEC_ID_FFV1,
    sizeof(FFV1Context),
    decode_init,
    NULL,
    common_end,
    decode_frame,
    CODEC_CAP_DR1 ,
    NULL,
    .long_name= NULL_IF_CONFIG_SMALL("FFmpeg codec #1"),
}

Definition at line 1014 of file ffv1.c.

const int8_t quant11[256] [static]

Initial value:

{
 0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5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-5,-5,-5,-5,
-4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,-2,-2,-1,
}

Definition at line 130 of file ffv1.c.

const int8_t quant3[256] [static]

Initial value:

{
 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0,
}

Definition at line 40 of file ffv1.c.

const int8_t quant5[256] [static]

Initial value:

{
 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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