hvirtual/quicktime/ffmpeg/libavcodec/ffv1.c File Reference

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

Include dependency graph for ffv1.c:

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 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 int encode_line (FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits)
static void encode_plane (FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index)
static void encode_rgb_frame (FFV1Context *s, uint32_t *src, int w, int h, int stride)
static void write_quant_table (RangeCoder *c, int16_t *quant_table)
static void write_header (FFV1Context *f)
static int common_init (AVCodecContext *avctx)
static int encode_init (AVCodecContext *avctx)
static void clear_state (FFV1Context *f)
static int encode_frame (AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
static void common_end (FFV1Context *s)
static int encode_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 int decode_init (AVCodecContext *avctx)
static int decode_frame (AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size)

Variables

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]
static const uint8_t log2_run [32]
AVCodec ffv1_decoder


Detailed Description

FF Video Codec 1 (an experimental lossless codec)

Definition in file ffv1.c.


Define Documentation

#define CONTEXT_SIZE   32

#define MAX_PLANES   4

Definition at line 34 of file ffv1.c.


Function Documentation

static void clear_state ( FFV1Context f  )  [static]

static void common_end ( FFV1Context s  )  [static]

Definition at line 697 of file ffv1.c.

References av_freep(), FFV1Context::plane, FFV1Context::plane_count, and PlaneContext::state.

Referenced by decode_end(), and encode_end().

Here is the call graph for this function:

static int common_init ( AVCodecContext avctx  )  [static]

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

static int decode_init ( AVCodecContext avctx  )  [static]

Definition at line 935 of file ffv1.c.

References common_init().

Here is the call graph for this function:

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

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

Definition at line 773 of file ffv1.c.

References decode_line(), and FFV1Context::run_index.

Referenced by decode_frame().

Here is the call graph for this function:

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

Definition at line 800 of file ffv1.c.

References b, decode_line(), r, and FFV1Context::run_index.

Referenced by decode_frame().

Here is the call graph for this function:

static int encode_end ( AVCodecContext avctx  )  [static]

Definition at line 707 of file ffv1.c.

References common_end(), AVCodecContext::priv_data, and s.

Here is the call graph for this function:

static int encode_frame ( AVCodecContext avctx,
unsigned char *  buf,
int  buf_size,
void *  data 
) [static]

static int encode_init ( AVCodecContext avctx  )  [static]

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

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

Definition at line 435 of file ffv1.c.

References FFV1Context::avctx, AVCodecContext::context_model, encode_line(), and FFV1Context::run_index.

Referenced by encode_frame().

Here is the call graph for this function:

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

Definition at line 458 of file ffv1.c.

References FFV1Context::avctx, b, AVCodecContext::context_model, encode_line(), r, and FFV1Context::run_index.

Referenced by encode_frame().

Here is the call graph for this function:

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

Definition at line 187 of file ffv1.c.

Referenced by encode_line(), 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 207 of file ffv1.c.

References LL, FFV1Context::quant_table, and T.

Referenced by decode_line(), and encode_line().

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

Definition at line 248 of file ffv1.c.

References a, e, and get_rac().

Referenced by decode_header(), decode_line(), decode_q_branch(), read_header(), and read_quant_table().

Here is the call graph for this function:

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

Definition at line 329 of file ffv1.c.

References VlcState::bias, VlcState::count, VlcState::drift, fold(), get_sr_golomb(), and update_vlc_state().

Referenced by decode_line().

Here is the call graph for this function:

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

Definition at line 199 of file ffv1.c.

References T.

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

Definition at line 222 of file ffv1.c.

References a, ABS, e, and put_rac().

Referenced by encode_header(), encode_line(), encode_q_branch(), write_header(), and write_quant_table().

Here is the call graph for this function:

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

Definition at line 302 of file ffv1.c.

References VlcState::bias, VlcState::count, VlcState::drift, fold(), set_sr_golomb(), and update_vlc_state().

Referenced by encode_line().

Here is the call graph for this function:

static int read_header ( FFV1Context f  )  [static]

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

Definition at line 842 of file ffv1.c.

References CONTEXT_SIZE, and get_symbol().

Referenced by read_header().

Here is the call graph for this function:

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

Definition at line 271 of file ffv1.c.

References ABS, VlcState::bias, VlcState::count, VlcState::drift, and VlcState::error_sum.

Referenced by get_vlc_symbol(), and put_vlc_symbol().

static void write_header ( FFV1Context f  )  [static]

static void write_quant_table ( RangeCoder c,
int16_t *  quant_table 
) [static]

Definition at line 497 of file ffv1.c.

References CONTEXT_SIZE, and put_symbol().

Referenced by write_header().

Here is the call graph for this function:


Variable Documentation

Initial value:

Definition at line 1017 of file ffv1.c.

Referenced by avcodec_register_all().

const uint8_t log2_run[32] [static]

Initial value:

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

Definition at line 146 of file ffv1.c.

Referenced by decode_line(), and encode_line().

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

Definition at line 91 of file ffv1.c.


Generated on Mon Apr 28 14:04:01 2008 for Cinelerra by  doxygen 1.5.5