libavcodec/ffv1.c File Reference

FF Video Codec 1 (a lossless codec). More...

#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "put_bits.h"
#include "dsputil.h"
#include "rangecoder.h"
#include "golomb.h"
#include "mathops.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avassert.h"
#include "libavutil/crc.h"
#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "libavutil/timer.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
#define MAX_QUANT_TABLES   8
#define MAX_CONTEXT_INPUTS   5
#define MAX_SLICES   256
#define put_rac(C, S, B)

Functions

static av_always_inline int fold (int diff, int bits)
static int predict (int16_t *src, int16_t *last)
static int get_context (PlaneContext *p, int16_t *src, int16_t *last, int16_t *last2)
static void find_best_state (uint8_t best_state[256][256], const uint8_t one_state[256])
static av_always_inline
av_flatten void 
put_symbol_inline (RangeCoder *c, uint8_t *state, int v, int is_signed, uint64_t rc_stat[256][2], uint64_t rc_stat2[32][2])
static av_noinline void put_symbol (RangeCoder *c, uint8_t *state, int v, int is_signed)
static av_flatten int get_symbol_inline (RangeCoder *c, uint8_t *state, int is_signed)
static av_noinline 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 int init_slice_state (FFV1Context *f, FFV1Context *fs)
static int init_slices_state (FFV1Context *f)
static av_cold int init_slice_contexts (FFV1Context *f)
static int allocate_initial_states (FFV1Context *f)
static void clear_slice_state (FFV1Context *f, FFV1Context *fs)
static av_cold int common_end (AVCodecContext *avctx)
static av_always_inline void decode_line (FFV1Context *s, int w, int16_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, uint8_t *src[3], int w, int h, int stride[3])
static int decode_slice_header (FFV1Context *f, FFV1Context *fs)
static int decode_slice (AVCodecContext *c, void *arg)
static int read_quant_table (RangeCoder *c, int16_t *quant_table, int scale)
static int read_quant_tables (RangeCoder *c, int16_t quant_table[MAX_CONTEXT_INPUTS][256])
static int read_extra_header (FFV1Context *f)
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, AVPacket *avpkt)

Variables

const uint8_t ff_log2_run [41]
static const int8_t quant5_10bit [256]
static const int8_t quant5 [256]
static const int8_t quant9_10bit [256]
static const int8_t quant11 [256]
static const uint8_t ver2_state [256]
AVCodec ff_ffv1_decoder


Detailed Description

FF Video Codec 1 (a lossless codec).

Definition in file ffv1.c.


Define Documentation

#define CONTEXT_SIZE   32

Definition at line 49 of file ffv1.c.

Referenced by init_slice_state().

#define MAX_CONTEXT_INPUTS   5

Definition at line 52 of file ffv1.c.

#define MAX_PLANES   4

Definition at line 48 of file ffv1.c.

Referenced by ff_draw_init(), and find_slice_quant().

#define MAX_QUANT_TABLES   8

Definition at line 51 of file ffv1.c.

Referenced by read_extra_header().

#define MAX_SLICES   256

Definition at line 167 of file ffv1.c.

#define put_rac ( C,
S,
 ) 

Value:

do{\
    if(rc_stat){\
    rc_stat[*(S)][B]++;\
        rc_stat2[(S)-state][B]++;\
    }\
    put_rac(C,S,B);\
}while(0)

Referenced by encode_header(), encode_q_branch(), encode_q_branch2(), encode_subband_c0run(), put_rac(), put_symbol(), put_symbol2(), and put_symbol_inline().


Function Documentation

static int allocate_initial_states ( FFV1Context f  )  [static]

Definition at line 790 of file ffv1.c.

Referenced by read_extra_header().

static void clear_slice_state ( FFV1Context f,
FFV1Context fs 
) [static]

Definition at line 1181 of file ffv1.c.

Referenced by decode_slice().

static av_cold int common_end ( AVCodecContext avctx  )  [static]

Definition at line 1404 of file ffv1.c.

static av_cold int common_init ( AVCodecContext avctx  )  [static]

Definition at line 699 of file ffv1.c.

static int decode_frame ( AVCodecContext avctx,
void *  data,
int data_size,
AVPacket avpkt 
) [static]

Definition at line 2041 of file ffv1.c.

static av_cold int decode_init ( AVCodecContext avctx  )  [static]

Definition at line 2026 of file ffv1.c.

static av_always_inline void decode_line ( FFV1Context s,
int  w,
int16_t sample[2],
int  plane_index,
int  bits 
) [static]

Definition at line 1441 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 1502 of file ffv1.c.

Referenced by decode_frame().

static void decode_rgb_frame ( FFV1Context s,
uint8_t src[3],
int  w,
int  h,
int  stride[3] 
) [static]

Definition at line 1543 of file ffv1.c.

static int decode_slice ( AVCodecContext c,
void *  arg 
) [static]

Definition at line 1655 of file ffv1.c.

static int decode_slice_header ( FFV1Context f,
FFV1Context fs 
) [static]

Definition at line 1598 of file ffv1.c.

static void find_best_state ( uint8_t  best_state[256][256],
const uint8_t  one_state[256] 
) [static]

Definition at line 258 of file ffv1.c.

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

Definition at line 220 of file ffv1.c.

Referenced by get_vlc_symbol(), and put_vlc_symbol().

static int get_context ( PlaneContext p,
int16_t src,
int16_t last,
int16_t last2 
) [inline, static]

Definition at line 241 of file ffv1.c.

Referenced by decode_line().

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

static av_flatten int get_symbol_inline ( RangeCoder c,
uint8_t state,
int  is_signed 
) [inline, static]

Definition at line 351 of file ffv1.c.

Referenced by decode_line(), and get_symbol().

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

Definition at line 433 of file ffv1.c.

Referenced by decode_line().

static av_cold int init_slice_contexts ( FFV1Context f  )  [static]

Definition at line 761 of file ffv1.c.

Referenced by decode_init().

static int init_slice_state ( FFV1Context f,
FFV1Context fs 
) [static]

Definition at line 721 of file ffv1.c.

Referenced by decode_slice(), and init_slices_state().

static int init_slices_state ( FFV1Context f  )  [static]

Definition at line 751 of file ffv1.c.

static int predict ( int16_t src,
int16_t last 
) [inline, static]

Definition at line 232 of file ffv1.c.

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

Definition at line 347 of file ffv1.c.

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

static av_always_inline av_flatten void put_symbol_inline ( RangeCoder c,
uint8_t state,
int  v,
int  is_signed,
uint64_t  rc_stat[256][2],
uint64_t  rc_stat2[32][2] 
) [static]

Definition at line 300 of file ffv1.c.

Referenced by put_symbol().

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

Definition at line 406 of file ffv1.c.

static int read_extra_header ( FFV1Context f  )  [static]

Definition at line 1764 of file ffv1.c.

Referenced by decode_init().

static int read_header ( FFV1Context f  )  [static]

Definition at line 1841 of file ffv1.c.

Referenced by decode_frame(), mjpegb_decode_frame(), and shorten_decode_frame().

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

Definition at line 1723 of file ffv1.c.

Referenced by read_quant_tables().

static int read_quant_tables ( RangeCoder c,
int16_t  quant_table[MAX_CONTEXT_INPUTS][256] 
) [static]

Definition at line 1751 of file ffv1.c.

Referenced by read_extra_header(), and read_header().

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

Definition at line 375 of file ffv1.c.

Referenced by get_vlc_symbol(), and put_vlc_symbol().


Variable Documentation

Initial value:

 {
    .name           = "ffv1",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = AV_CODEC_ID_FFV1,
    .priv_data_size = sizeof(FFV1Context),
    .init           = decode_init,
    .close          = common_end,
    .decode         = decode_frame,
    .capabilities   = CODEC_CAP_DR1  |
                      CODEC_CAP_SLICE_THREADS,
    .long_name      = NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
}

Definition at line 2152 of file ffv1.c.

const uint8_t ff_log2_run[41]

Definition at line 36 of file bitstream.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,-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,-4,-4,
-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
-4,-4,-4,-4,-4,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-1,
}

Definition at line 113 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, 2, 2,
 2, 2, 2, 2, 2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,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
-4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,-3,-3,-3,
-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
-3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
-2,-2,-2,-2,-1,-1,-1,-1,-1,-1,-1,-1,-0,-0,-0,-0,
}

Definition at line 94 of file ffv1.c.

const uint8_t ver2_state[256] [static]

Initial value:

 {
   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,
}

Definition at line 132 of file ffv1.c.


Generated on Fri Oct 26 02:50:05 2012 for FFmpeg by  doxygen 1.5.8