libavcodec/truemotion2.c File Reference

Duck TrueMotion2 decoder. More...

#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"

Go to the source code of this file.

Data Structures

struct  TM2Context
struct  TM2Codes
 Huffman codes for each of streams. More...
struct  TM2Huff
 structure for gathering Huffman codes information More...

Defines

#define TM2_ESCAPE   0x80000000
#define TM2_DELTAS   64
#define TM2_INIT_POINTERS()
#define TM2_INIT_POINTERS_2()
#define TM2_RECALC_BLOCK(CHR, stride, last, CD)

Enumerations

enum  TM2_STREAMS {
  TM2_C_HI = 0, TM2_C_LO, TM2_L_HI, TM2_L_LO,
  TM2_UPD, TM2_MOT, TM2_TYPE, TM2_NUM_STREAMS
}
enum  TM2_BLOCKS {
  TM2_HI_RES = 0, TM2_MED_RES, TM2_LOW_RES, TM2_NULL_RES,
  TM2_UPDATE, TM2_STILL, TM2_MOTION
}

Functions

static int tm2_read_tree (TM2Context *ctx, uint32_t prefix, int length, TM2Huff *huff)
static int tm2_build_huff_table (TM2Context *ctx, TM2Codes *code)
static void tm2_free_codes (TM2Codes *code)
static int tm2_get_token (GetBitContext *gb, TM2Codes *code)
static int tm2_read_header (TM2Context *ctx, const uint8_t *buf)
static int tm2_read_deltas (TM2Context *ctx, int stream_id)
static int tm2_read_stream (TM2Context *ctx, const uint8_t *buf, int stream_id, int buf_size)
static int GET_TOK (TM2Context *ctx, int type)
static void tm2_apply_deltas (TM2Context *ctx, int *Y, int stride, int *deltas, int *last)
static void tm2_high_chroma (int *data, int stride, int *last, int *CD, int *deltas)
static void tm2_low_chroma (int *data, int stride, int *clast, int *CD, int *deltas, int bx)
static void tm2_hi_res_block (TM2Context *ctx, AVFrame *pic, int bx, int by)
static void tm2_med_res_block (TM2Context *ctx, AVFrame *pic, int bx, int by)
static void tm2_low_res_block (TM2Context *ctx, AVFrame *pic, int bx, int by)
static void tm2_null_res_block (TM2Context *ctx, AVFrame *pic, int bx, int by)
static void tm2_still_block (TM2Context *ctx, AVFrame *pic, int bx, int by)
static void tm2_update_block (TM2Context *ctx, AVFrame *pic, int bx, int by)
static void tm2_motion_block (TM2Context *ctx, AVFrame *pic, int bx, int by)
static int tm2_decode_blocks (TM2Context *ctx, AVFrame *p)
static int decode_frame (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static av_cold int decode_init (AVCodecContext *avctx)
static av_cold int decode_end (AVCodecContext *avctx)

Variables

static const int tm2_stream_order [TM2_NUM_STREAMS]
AVCodec ff_truemotion2_decoder


Detailed Description

Duck TrueMotion2 decoder.

Definition in file truemotion2.c.


Define Documentation

#define TM2_DELTAS   64

Definition at line 32 of file truemotion2.c.

Referenced by tm2_read_deltas().

#define TM2_ESCAPE   0x80000000

Definition at line 31 of file truemotion2.c.

Referenced by tm2_read_stream().

 
#define TM2_INIT_POINTERS (  ) 

Value:

int *last, *clast; \
    int *Y, *U, *V;\
    int Ystride, Ustride, Vstride;\
\
    Ystride = ctx->avctx->width;\
    Vstride = (ctx->avctx->width + 1) >> 1;\
    Ustride = (ctx->avctx->width + 1) >> 1;\
    Y = (ctx->cur?ctx->Y2:ctx->Y1) + by * 4 * Ystride + bx * 4;\
    V = (ctx->cur?ctx->V2:ctx->V1) + by * 2 * Vstride + bx * 2;\
    U = (ctx->cur?ctx->U2:ctx->U1) + by * 2 * Ustride + bx * 2;\
    last = ctx->last + bx * 4;\
    clast = ctx->clast + bx * 4;

Definition at line 336 of file truemotion2.c.

Referenced by tm2_hi_res_block(), tm2_low_res_block(), tm2_med_res_block(), and tm2_null_res_block().

 
#define TM2_INIT_POINTERS_2 (  ) 

Value:

int *Yo, *Uo, *Vo;\
    int oYstride, oUstride, oVstride;\
\
    TM2_INIT_POINTERS();\
    oYstride = Ystride;\
    oVstride = Vstride;\
    oUstride = Ustride;\
    Yo = (ctx->cur?ctx->Y1:ctx->Y2) + by * 4 * oYstride + bx * 4;\
    Vo = (ctx->cur?ctx->V1:ctx->V2) + by * 2 * oVstride + bx * 2;\
    Uo = (ctx->cur?ctx->U1:ctx->U2) + by * 2 * oUstride + bx * 2;

Definition at line 350 of file truemotion2.c.

Referenced by tm2_motion_block(), tm2_still_block(), and tm2_update_block().

#define TM2_RECALC_BLOCK ( CHR,
stride,
last,
CD   ) 

Value:

{\
    CD[0] = CHR[1] - last[1];\
    CD[1] = (int)CHR[stride + 1] - (int)CHR[1];\
    last[0] = (int)CHR[stride + 0];\
    last[1] = (int)CHR[stride + 1];}

Definition at line 363 of file truemotion2.c.

Referenced by tm2_motion_block(), tm2_still_block(), and tm2_update_block().


Enumeration Type Documentation

enum TM2_BLOCKS

Enumerator:
TM2_HI_RES 
TM2_MED_RES 
TM2_LOW_RES 
TM2_NULL_RES 
TM2_UPDATE 
TM2_STILL 
TM2_MOTION 

Definition at line 37 of file truemotion2.c.

Enumerator:
TM2_C_HI 
TM2_C_LO 
TM2_L_HI 
TM2_L_LO 
TM2_UPD 
TM2_MOT 
TM2_TYPE 
TM2_NUM_STREAMS 

Definition at line 34 of file truemotion2.c.


Function Documentation

static av_cold int decode_end ( AVCodecContext avctx  )  [static]

Definition at line 843 of file truemotion2.c.

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

Definition at line 754 of file truemotion2.c.

static av_cold int decode_init ( AVCodecContext avctx  )  [static]

Definition at line 808 of file truemotion2.c.

static int GET_TOK ( TM2Context ctx,
int  type 
) [inline, static]

static void tm2_apply_deltas ( TM2Context ctx,
int *  Y,
int  stride,
int *  deltas,
int *  last 
) [inline, static]

static int tm2_build_huff_table ( TM2Context ctx,
TM2Codes code 
) [static]

Definition at line 117 of file truemotion2.c.

Referenced by tm2_read_stream().

static int tm2_decode_blocks ( TM2Context ctx,
AVFrame p 
) [static]

Definition at line 668 of file truemotion2.c.

Referenced by decode_frame().

static void tm2_free_codes ( TM2Codes code  )  [static]

Definition at line 186 of file truemotion2.c.

Referenced by tm2_read_stream().

static int tm2_get_token ( GetBitContext gb,
TM2Codes code 
) [inline, static]

Definition at line 193 of file truemotion2.c.

Referenced by tm2_read_stream().

static void tm2_hi_res_block ( TM2Context ctx,
AVFrame pic,
int  bx,
int  by 
) [inline, static]

Definition at line 420 of file truemotion2.c.

Referenced by tm2_decode_blocks().

static void tm2_high_chroma ( int *  data,
int  stride,
int *  last,
int *  CD,
int *  deltas 
) [inline, static]

Definition at line 388 of file truemotion2.c.

Referenced by tm2_hi_res_block(), and tm2_low_chroma().

static void tm2_low_chroma ( int *  data,
int  stride,
int *  clast,
int *  CD,
int *  deltas,
int  bx 
) [inline, static]

Definition at line 401 of file truemotion2.c.

Referenced by tm2_low_res_block(), tm2_med_res_block(), and tm2_null_res_block().

static void tm2_low_res_block ( TM2Context ctx,
AVFrame pic,
int  bx,
int  by 
) [inline, static]

Definition at line 463 of file truemotion2.c.

Referenced by tm2_decode_blocks().

static void tm2_med_res_block ( TM2Context ctx,
AVFrame pic,
int  bx,
int  by 
) [inline, static]

Definition at line 441 of file truemotion2.c.

Referenced by tm2_decode_blocks().

static void tm2_motion_block ( TM2Context ctx,
AVFrame pic,
int  bx,
int  by 
) [inline, static]

Definition at line 623 of file truemotion2.c.

Referenced by tm2_decode_blocks().

static void tm2_null_res_block ( TM2Context ctx,
AVFrame pic,
int  bx,
int  by 
) [inline, static]

Definition at line 504 of file truemotion2.c.

Referenced by tm2_decode_blocks().

static int tm2_read_deltas ( TM2Context ctx,
int  stream_id 
) [static]

Definition at line 223 of file truemotion2.c.

Referenced by tm2_read_stream().

static int tm2_read_header ( TM2Context ctx,
const uint8_t *  buf 
) [inline, static]

Definition at line 200 of file truemotion2.c.

Referenced by decode_frame().

static int tm2_read_stream ( TM2Context ctx,
const uint8_t *  buf,
int  stream_id,
int  buf_size 
) [static]

Definition at line 248 of file truemotion2.c.

Referenced by decode_frame().

static int tm2_read_tree ( TM2Context ctx,
uint32_t  prefix,
int  length,
TM2Huff huff 
) [static]

Definition at line 88 of file truemotion2.c.

Referenced by tm2_build_huff_table().

static void tm2_still_block ( TM2Context ctx,
AVFrame pic,
int  bx,
int  by 
) [inline, static]

Definition at line 550 of file truemotion2.c.

Referenced by tm2_decode_blocks().

static void tm2_update_block ( TM2Context ctx,
AVFrame pic,
int  bx,
int  by 
) [inline, static]

Definition at line 585 of file truemotion2.c.

Referenced by tm2_decode_blocks().


Variable Documentation

Initial value:

 {
    "truemotion2",
    AVMEDIA_TYPE_VIDEO,
    CODEC_ID_TRUEMOTION2,
    sizeof(TM2Context),
    decode_init,
    NULL,
    decode_end,
    decode_frame,
    CODEC_CAP_DR1,
    .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0"),
}

Definition at line 867 of file truemotion2.c.

const int tm2_stream_order[TM2_NUM_STREAMS] [static]

Initial value:

Definition at line 750 of file truemotion2.c.

Referenced by decode_frame().


Generated on Fri Oct 26 02:38:18 2012 for FFmpeg by  doxygen 1.5.8