libavcodec/truemotion1.c File Reference

Duck TrueMotion v1 Video Decoder by Alex Beregszaszi and Mike Melanson (melanson@pcisys.net). More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "avcodec.h"
#include "dsputil.h"
#include "truemotion1data.h"

Go to the source code of this file.

Data Structures

struct  TrueMotion1Context
struct  frame_header
struct  comp_types

Defines

#define FLAG_SPRITE   32
#define FLAG_KEYFRAME   16
#define FLAG_INTERFRAME   8
#define FLAG_INTERPOLATED   4
#define ALGO_NOP   0
#define ALGO_RGB16V   1
#define ALGO_RGB16H   2
#define ALGO_RGB24H   3
#define BLOCK_2x2   0
#define BLOCK_2x4   1
#define BLOCK_4x2   2
#define BLOCK_4x4   3
#define GET_NEXT_INDEX()
#define APPLY_C_PREDICTOR()
#define APPLY_C_PREDICTOR_24()
#define APPLY_Y_PREDICTOR()
#define APPLY_Y_PREDICTOR_24()
#define OUTPUT_PIXEL_PAIR()

Functions

static void select_delta_tables (TrueMotion1Context *s, int delta_table_index)
static int make_ydt15_entry (int p1, int p2, int16_t *ydt)
static int make_cdt15_entry (int p1, int p2, int16_t *cdt)
static int make_ydt16_entry (int p1, int p2, int16_t *ydt)
static int make_cdt16_entry (int p1, int p2, int16_t *cdt)
static int make_ydt24_entry (int p1, int p2, int16_t *ydt)
static int make_cdt24_entry (int p1, int p2, int16_t *cdt)
static void gen_vector_table15 (TrueMotion1Context *s, const uint8_t *sel_vector_table)
static void gen_vector_table16 (TrueMotion1Context *s, const uint8_t *sel_vector_table)
static void gen_vector_table24 (TrueMotion1Context *s, const uint8_t *sel_vector_table)
static int truemotion1_decode_header (TrueMotion1Context *s)
static av_cold int truemotion1_decode_init (AVCodecContext *avctx)
static void truemotion1_decode_16bit (TrueMotion1Context *s)
static void truemotion1_decode_24bit (TrueMotion1Context *s)
static int truemotion1_decode_frame (AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
static av_cold int truemotion1_decode_end (AVCodecContext *avctx)

Variables

static const comp_types compression_types [17]
AVCodec truemotion1_decoder


Detailed Description

Duck TrueMotion v1 Video Decoder by Alex Beregszaszi and Mike Melanson (melanson@pcisys.net).

The TrueMotion v1 decoder presently only decodes 16-bit TM1 data and outputs RGB555 (or RGB565) data. 24-bit TM1 data is not supported yet.

Definition in file truemotion1.c.


Define Documentation

#define ALGO_NOP   0

Definition at line 101 of file truemotion1.c.

Referenced by truemotion1_decode_frame().

#define ALGO_RGB16H   2

Definition at line 103 of file truemotion1.c.

#define ALGO_RGB16V   1

Definition at line 102 of file truemotion1.c.

#define ALGO_RGB24H   3

Definition at line 104 of file truemotion1.c.

Referenced by truemotion1_decode_frame(), and truemotion1_decode_header().

 
#define APPLY_C_PREDICTOR (  ) 

Value:

if(index > 1023){\
        av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \
        return; \
    }\
    predictor_pair = s->c_predictor_table[index]; \
    horiz_pred += (predictor_pair >> 1); \
    if (predictor_pair & 1) { \
        GET_NEXT_INDEX() \
        if (!index) { \
            GET_NEXT_INDEX() \
            predictor_pair = s->c_predictor_table[index]; \
            horiz_pred += ((predictor_pair >> 1) * 5); \
            if (predictor_pair & 1) \
                GET_NEXT_INDEX() \
            else \
                index++; \
        } \
    } else \
        index++;

Definition at line 521 of file truemotion1.c.

Referenced by truemotion1_decode_16bit().

 
#define APPLY_C_PREDICTOR_24 (  ) 

Value:

if(index > 1023){\
        av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \
        return; \
    }\
    predictor_pair = s->c_predictor_table[index]; \
    horiz_pred += (predictor_pair >> 1); \
    if (predictor_pair & 1) { \
        GET_NEXT_INDEX() \
        if (!index) { \
            GET_NEXT_INDEX() \
            predictor_pair = s->fat_c_predictor_table[index]; \
            horiz_pred += (predictor_pair >> 1); \
            if (predictor_pair & 1) \
                GET_NEXT_INDEX() \
            else \
                index++; \
        } \
    } else \
        index++;

Definition at line 542 of file truemotion1.c.

Referenced by truemotion1_decode_24bit().

 
#define APPLY_Y_PREDICTOR (  ) 

Value:

if(index > 1023){\
        av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \
        return; \
    }\
    predictor_pair = s->y_predictor_table[index]; \
    horiz_pred += (predictor_pair >> 1); \
    if (predictor_pair & 1) { \
        GET_NEXT_INDEX() \
        if (!index) { \
            GET_NEXT_INDEX() \
            predictor_pair = s->y_predictor_table[index]; \
            horiz_pred += ((predictor_pair >> 1) * 5); \
            if (predictor_pair & 1) \
                GET_NEXT_INDEX() \
            else \
                index++; \
        } \
    } else \
        index++;

Definition at line 564 of file truemotion1.c.

Referenced by truemotion1_decode_16bit().

 
#define APPLY_Y_PREDICTOR_24 (  ) 

Value:

if(index > 1023){\
        av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \
        return; \
    }\
    predictor_pair = s->y_predictor_table[index]; \
    horiz_pred += (predictor_pair >> 1); \
    if (predictor_pair & 1) { \
        GET_NEXT_INDEX() \
        if (!index) { \
            GET_NEXT_INDEX() \
            predictor_pair = s->fat_y_predictor_table[index]; \
            horiz_pred += (predictor_pair >> 1); \
            if (predictor_pair & 1) \
                GET_NEXT_INDEX() \
            else \
                index++; \
        } \
    } else \
        index++;

Definition at line 585 of file truemotion1.c.

Referenced by truemotion1_decode_24bit().

#define BLOCK_2x2   0

Definition at line 107 of file truemotion1.c.

Referenced by truemotion1_decode_16bit(), and truemotion1_decode_24bit().

#define BLOCK_2x4   1

Definition at line 108 of file truemotion1.c.

#define BLOCK_4x2   2

Definition at line 109 of file truemotion1.c.

Referenced by truemotion1_decode_16bit(), and truemotion1_decode_24bit().

#define BLOCK_4x4   3

Definition at line 110 of file truemotion1.c.

#define FLAG_INTERFRAME   8

Definition at line 80 of file truemotion1.c.

Referenced by truemotion1_decode_header().

#define FLAG_INTERPOLATED   4

Definition at line 81 of file truemotion1.c.

Referenced by truemotion1_decode_header().

#define FLAG_KEYFRAME   16

#define FLAG_SPRITE   32

Definition at line 78 of file truemotion1.c.

Referenced by truemotion1_decode_header().

 
#define GET_NEXT_INDEX (  ) 

Value:

{\
    if (index_stream_index >= s->index_stream_size) { \
        av_log(s->avctx, AV_LOG_INFO, " help! truemotion1 decoder went out of bounds\n"); \
        return; \
    } \
    index = s->index_stream[index_stream_index++] * 4; \
}

Definition at line 512 of file truemotion1.c.

Referenced by truemotion1_decode_16bit(), and truemotion1_decode_24bit().

 
#define OUTPUT_PIXEL_PAIR (  ) 

Value:

*current_pixel_pair = *vert_pred + horiz_pred; \
    *vert_pred++ = *current_pixel_pair++;

Definition at line 606 of file truemotion1.c.

Referenced by truemotion1_decode_16bit(), and truemotion1_decode_24bit().


Function Documentation

static void gen_vector_table15 ( TrueMotion1Context s,
const uint8_t *  sel_vector_table 
) [static]

Definition at line 251 of file truemotion1.c.

Referenced by truemotion1_decode_header().

static void gen_vector_table16 ( TrueMotion1Context s,
const uint8_t *  sel_vector_table 
) [static]

Definition at line 272 of file truemotion1.c.

Referenced by truemotion1_decode_header().

static void gen_vector_table24 ( TrueMotion1Context s,
const uint8_t *  sel_vector_table 
) [static]

Definition at line 293 of file truemotion1.c.

Referenced by truemotion1_decode_header().

static int make_cdt15_entry ( int  p1,
int  p2,
int16_t *  cdt 
) [static]

Definition at line 185 of file truemotion1.c.

Referenced by gen_vector_table15().

static int make_cdt16_entry ( int  p1,
int  p2,
int16_t *  cdt 
) [static]

Definition at line 214 of file truemotion1.c.

Referenced by gen_vector_table16().

static int make_cdt24_entry ( int  p1,
int  p2,
int16_t *  cdt 
) [static]

Definition at line 241 of file truemotion1.c.

Referenced by gen_vector_table24().

static int make_ydt15_entry ( int  p1,
int  p2,
int16_t *  ydt 
) [static]

Definition at line 170 of file truemotion1.c.

Referenced by gen_vector_table15().

static int make_ydt16_entry ( int  p1,
int  p2,
int16_t *  ydt 
) [static]

Definition at line 199 of file truemotion1.c.

Referenced by gen_vector_table16().

static int make_ydt24_entry ( int  p1,
int  p2,
int16_t *  ydt 
) [static]

Definition at line 228 of file truemotion1.c.

Referenced by gen_vector_table24().

static void select_delta_tables ( TrueMotion1Context s,
int  delta_table_index 
) [static]

Definition at line 144 of file truemotion1.c.

Referenced by truemotion1_decode_header().

static void truemotion1_decode_16bit ( TrueMotion1Context s  )  [static]

Definition at line 610 of file truemotion1.c.

Referenced by truemotion1_decode_frame().

static void truemotion1_decode_24bit ( TrueMotion1Context s  )  [static]

Definition at line 736 of file truemotion1.c.

Referenced by truemotion1_decode_frame().

static av_cold int truemotion1_decode_end ( AVCodecContext avctx  )  [static]

Definition at line 896 of file truemotion1.c.

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

Definition at line 863 of file truemotion1.c.

static int truemotion1_decode_header ( TrueMotion1Context s  )  [static]

Definition at line 322 of file truemotion1.c.

Referenced by truemotion1_decode_frame().

static av_cold int truemotion1_decode_init ( AVCodecContext avctx  )  [static]

Definition at line 464 of file truemotion1.c.


Variable Documentation

const comp_types compression_types[17] [static]

Initial value:

 {
    { ALGO_NOP,    0, 0, 0 },

    { ALGO_RGB16V, 4, 4, BLOCK_4x4 },
    { ALGO_RGB16H, 4, 4, BLOCK_4x4 },
    { ALGO_RGB16V, 4, 2, BLOCK_4x2 },
    { ALGO_RGB16H, 4, 2, BLOCK_4x2 },

    { ALGO_RGB16V, 2, 4, BLOCK_2x4 },
    { ALGO_RGB16H, 2, 4, BLOCK_2x4 },
    { ALGO_RGB16V, 2, 2, BLOCK_2x2 },
    { ALGO_RGB16H, 2, 2, BLOCK_2x2 },

    { ALGO_NOP,    4, 4, BLOCK_4x4 },
    { ALGO_RGB24H, 4, 4, BLOCK_4x4 },
    { ALGO_NOP,    4, 2, BLOCK_4x2 },
    { ALGO_RGB24H, 4, 2, BLOCK_4x2 },

    { ALGO_NOP,    2, 4, BLOCK_2x4 },
    { ALGO_RGB24H, 2, 4, BLOCK_2x4 },
    { ALGO_NOP,    2, 2, BLOCK_2x2 },
    { ALGO_RGB24H, 2, 2, BLOCK_2x2 }
}

Definition at line 120 of file truemotion1.c.

Initial value:

Definition at line 908 of file truemotion1.c.


Generated on Fri Oct 26 02:35:44 2012 for FFmpeg by  doxygen 1.5.8