#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include "common.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 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, uint8_t *buf, int buf_size) |
| static int | truemotion1_decode_end (AVCodecContext *avctx) |
Variables | |
| static comp_types | compression_types [17] |
| AVCodec | truemotion1_decoder |
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 ALGO_NOP 0 |
| #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:
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 517 of file truemotion1.c.
Referenced by truemotion1_decode_16bit().
| #define APPLY_C_PREDICTOR_24 | ( | ) |
Value:
predictor_pair = s->c_predictor_table[index]; \ c_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]; \ c_horiz_pred += (predictor_pair >> 1); \ if (predictor_pair & 1) \ GET_NEXT_INDEX() \ else \ index++; \ } \ } else \ index++;
Definition at line 534 of file truemotion1.c.
Referenced by truemotion1_decode_24bit().
| #define APPLY_Y_PREDICTOR | ( | ) |
Value:
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 553 of file truemotion1.c.
Referenced by truemotion1_decode_16bit().
| #define APPLY_Y_PREDICTOR_24 | ( | ) |
Value:
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 570 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 |
| #define FLAG_INTERPOLATED 4 |
| #define FLAG_KEYFRAME 16 |
Definition at line 79 of file truemotion1.c.
Referenced by truemotion1_decode_16bit(), truemotion1_decode_24bit(), and truemotion1_decode_header().
| #define FLAG_SPRITE 32 |
| #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 508 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++; \
prev_pixel_pair++;
Definition at line 587 of file truemotion1.c.
Referenced by truemotion1_decode_16bit(), and truemotion1_decode_24bit().
| static void gen_vector_table15 | ( | TrueMotion1Context * | s, | |
| const uint8_t * | sel_vector_table | |||
| ) | [static] |
Definition at line 251 of file truemotion1.c.
References TrueMotion1Context::c_predictor_table, TrueMotion1Context::cdt, make_cdt15_entry(), make_ydt15_entry(), TrueMotion1Context::y_predictor_table, and TrueMotion1Context::ydt.
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.
References TrueMotion1Context::c_predictor_table, TrueMotion1Context::cdt, make_cdt16_entry(), make_ydt16_entry(), TrueMotion1Context::y_predictor_table, and TrueMotion1Context::ydt.
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.
References TrueMotion1Context::c_predictor_table, TrueMotion1Context::cdt, TrueMotion1Context::fat_c_predictor_table, TrueMotion1Context::fat_cdt, TrueMotion1Context::fat_y_predictor_table, TrueMotion1Context::fat_ydt, make_cdt24_entry(), make_ydt24_entry(), TrueMotion1Context::y_predictor_table, and TrueMotion1Context::ydt.
Referenced by truemotion1_decode_header().

| static int make_cdt15_entry | ( | int | p1, | |
| int | p2, | |||
| int16_t * | cdt | |||
| ) | [static] |
| static int make_cdt16_entry | ( | int | p1, | |
| int | p2, | |||
| int16_t * | cdt | |||
| ) | [static] |
| static int make_cdt24_entry | ( | int | p1, | |
| int | p2, | |||
| int16_t * | cdt | |||
| ) | [static] |
| static int make_ydt15_entry | ( | int | p1, | |
| int | p2, | |||
| int16_t * | ydt | |||
| ) | [static] |
| static int make_ydt16_entry | ( | int | p1, | |
| int | p2, | |||
| int16_t * | ydt | |||
| ) | [static] |
| static int make_ydt24_entry | ( | int | p1, | |
| int | p2, | |||
| int16_t * | ydt | |||
| ) | [static] |
| static void select_delta_tables | ( | TrueMotion1Context * | s, | |
| int | delta_table_index | |||
| ) | [static] |
Definition at line 144 of file truemotion1.c.
References TrueMotion1Context::cdt, cdts, TrueMotion1Context::fat_cdt, fat_cdts, TrueMotion1Context::fat_ydt, fat_ydts, memcpy, TrueMotion1Context::ydt, and ydts.
Referenced by truemotion1_decode_header().
| static void truemotion1_decode_16bit | ( | TrueMotion1Context * | s | ) | [static] |
Definition at line 592 of file truemotion1.c.
References APPLY_C_PREDICTOR, APPLY_Y_PREDICTOR, TrueMotion1Context::avctx, BLOCK_2x2, BLOCK_4x2, TrueMotion1Context::block_type, TrueMotion1Context::block_width, FLAG_KEYFRAME, TrueMotion1Context::flags, TrueMotion1Context::frame, GET_NEXT_INDEX, AVCodecContext::height, TrueMotion1Context::mb_change_bits, TrueMotion1Context::mb_change_bits_row_size, OUTPUT_PIXEL_PAIR, TrueMotion1Context::prev_frame, TrueMotion1Context::vert_pred, and AVCodecContext::width.
Referenced by truemotion1_decode_frame().
| static void truemotion1_decode_24bit | ( | TrueMotion1Context * | s | ) | [static] |
Definition at line 724 of file truemotion1.c.
References APPLY_C_PREDICTOR_24, APPLY_Y_PREDICTOR_24, TrueMotion1Context::avctx, BLOCK_2x2, BLOCK_4x2, TrueMotion1Context::block_type, TrueMotion1Context::block_width, FLAG_KEYFRAME, TrueMotion1Context::flags, TrueMotion1Context::frame, GET_NEXT_INDEX, AVCodecContext::height, TrueMotion1Context::mb_change_bits, TrueMotion1Context::mb_change_bits_row_size, OUTPUT_PIXEL_PAIR, TrueMotion1Context::prev_frame, TrueMotion1Context::vert_pred, and AVCodecContext::width.
Referenced by truemotion1_decode_frame().
| static int truemotion1_decode_end | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 909 of file truemotion1.c.
References av_free(), TrueMotion1Context::prev_frame, AVCodecContext::priv_data, AVCodecContext::release_buffer, s, and TrueMotion1Context::vert_pred.

| static int truemotion1_decode_frame | ( | AVCodecContext * | avctx, | |
| void * | data, | |||
| int * | data_size, | |||
| uint8_t * | buf, | |||
| int | buf_size | |||
| ) | [static] |
Definition at line 867 of file truemotion1.c.
References ALGO_NOP, ALGO_RGB24H, comp_types::algorithm, av_log(), AV_LOG_ERROR, TrueMotion1Context::avctx, TrueMotion1Context::buf, TrueMotion1Context::compression, TrueMotion1Context::frame, AVCodecContext::get_buffer, AVCodecContext::height, memcpy, TrueMotion1Context::prev_frame, AVCodecContext::priv_data, AVCodecContext::release_buffer, s, TrueMotion1Context::size, truemotion1_decode_16bit(), truemotion1_decode_24bit(), and truemotion1_decode_header().

| static int truemotion1_decode_header | ( | TrueMotion1Context * | s | ) | [static] |
Definition at line 322 of file truemotion1.c.
References ALGO_RGB24H, comp_types::algorithm, av_log(), AV_LOG_ERROR, AV_LOG_INFO, TrueMotion1Context::avctx, comp_types::block_height, TrueMotion1Context::block_height, comp_types::block_type, TrueMotion1Context::block_type, comp_types::block_width, TrueMotion1Context::block_width, TrueMotion1Context::buf, frame_header::checksum, TrueMotion1Context::compression, frame_header::compression, frame_header::control, AVCodecContext::debug, frame_header::deltaset, FF_DEBUG_PICT_INFO, FLAG_INTERFRAME, FLAG_INTERPOLATED, FLAG_KEYFRAME, FLAG_SPRITE, TrueMotion1Context::flags, frame_header::flags, gen_vector_table15(), gen_vector_table16(), gen_vector_table24(), TrueMotion1Context::h, frame_header::header_size, frame_header::header_type, AVCodecContext::height, frame_header::height, TrueMotion1Context::index_stream, TrueMotion1Context::index_stream_size, TrueMotion1Context::last_deltaset, TrueMotion1Context::last_vectable, LE_16, TrueMotion1Context::mb_change_bits, TrueMotion1Context::mb_change_bits_row_size, pc_tbl2, AVCodecContext::pix_fmt, PIX_FMT_BGR24, PIX_FMT_RGB555, select_delta_tables(), TrueMotion1Context::size, tables, frame_header::vectable, frame_header::version, TrueMotion1Context::w, frame_header::width, AVCodecContext::width, TrueMotion1Context::x, frame_header::xoffset, frame_header::xsize, TrueMotion1Context::y, frame_header::yoffset, and frame_header::ysize.
Referenced by truemotion1_decode_frame().

| static int truemotion1_decode_init | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 459 of file truemotion1.c.
References av_malloc(), TrueMotion1Context::avctx, TrueMotion1Context::frame, AVCodecContext::has_b_frames, NULL, TrueMotion1Context::prev_frame, AVCodecContext::priv_data, s, TrueMotion1Context::vert_pred, and AVCodecContext::width.

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:
{
"truemotion1",
CODEC_TYPE_VIDEO,
CODEC_ID_TRUEMOTION1,
sizeof(TrueMotion1Context),
truemotion1_decode_init,
NULL,
truemotion1_decode_end,
truemotion1_decode_frame,
CODEC_CAP_DR1,
}
Definition at line 922 of file truemotion1.c.
Referenced by avcodec_register_all().
1.5.5