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

Go to the source code of this file.
Data Structures | |
| struct | hnode_t |
| struct | IdcinContext |
Defines | |
| #define | HUFFMAN_TABLE_SIZE 64 * 1024 |
| #define | HUF_TOKENS 256 |
| #define | PALETTE_COUNT 256 |
Functions | |
| static int | huff_smallest_node (hnode_t *hnodes, int num_hnodes) |
| static void | huff_build_tree (IdcinContext *s, int prev) |
| static int | idcin_decode_init (AVCodecContext *avctx) |
| static void | idcin_decode_vlcs (IdcinContext *s) |
| static int | idcin_decode_frame (AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) |
| static int | idcin_decode_end (AVCodecContext *avctx) |
Variables | |
| AVCodec | idcin_decoder |
This video decoder outputs PAL8 colorspace data. Interacting with this decoder is a little involved. During initialization, the demuxer must transmit the 65536-byte Huffman table(s) to the decoder via extradata. Then, whenever a palette change is encountered while demuxing the file, the demuxer must use the same extradata space to transmit an AVPaletteControl structure.
Id CIN video is purely Huffman-coded, intraframe-only codec. It achieves a little more compression by exploiting the fact that adjacent pixels tend to be similar.
Note that this decoder could use ffmpeg's optimized VLC facilities rather than naive, tree-based Huffman decoding. However, there are 256 Huffman tables. Plus, the VLC bit coding order is right -> left instead or left -> right, so all of the bits would have to be reversed. Further, the original Quake II implementation likely used a similar naive decoding algorithm and it worked fine on much lower spec machines.
Definition in file idcinvideo.c.
| #define HUF_TOKENS 256 |
Definition at line 56 of file idcinvideo.c.
Referenced by huff_build_tree(), idcin_decode_init(), and idcin_decode_vlcs().
| #define HUFFMAN_TABLE_SIZE 64 * 1024 |
| #define PALETTE_COUNT 256 |
Definition at line 57 of file idcinvideo.c.
Referenced by idcin_decode_frame(), ipvideo_decode_opcodes(), vmd_decode(), vmdvideo_decode_frame(), vmdvideo_decode_init(), vqa_decode_frame(), xan_wc3_build_palette(), and xan_wc3_decode_frame().
| static void huff_build_tree | ( | IdcinContext * | s, | |
| int | prev | |||
| ) | [static] |
Definition at line 118 of file idcinvideo.c.
References hnode_t::children, hnode_t::count, HUF_TOKENS, IdcinContext::huff_nodes, huff_smallest_node(), and IdcinContext::num_huff_nodes.
Referenced by idcin_decode_init().

| static int huff_smallest_node | ( | hnode_t * | hnodes, | |
| int | num_hnodes | |||
| ) | [static] |
Definition at line 86 of file idcinvideo.c.
References hnode_t::count, and hnode_t::used.
Referenced by huff_build_tree().
| static int idcin_decode_end | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 249 of file idcinvideo.c.
References IdcinContext::frame, AVCodecContext::priv_data, AVCodecContext::release_buffer, and s.
| static int idcin_decode_frame | ( | AVCodecContext * | avctx, | |
| void * | data, | |||
| int * | data_size, | |||
| uint8_t * | buf, | |||
| int | buf_size | |||
| ) | [static] |
Definition at line 214 of file idcinvideo.c.
References av_log(), AV_LOG_ERROR, IdcinContext::buf, IdcinContext::frame, AVCodecContext::get_buffer, idcin_decode_vlcs(), memcpy, AVCodecContext::palctrl, PALETTE_COUNT, AVCodecContext::priv_data, AVCodecContext::release_buffer, s, and IdcinContext::size.

| static int idcin_decode_init | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 148 of file idcinvideo.c.
References av_log(), AV_LOG_ERROR, IdcinContext::avctx, hnode_t::count, IdcinContext::dsp, dsputil_init(), AVCodecContext::extradata, AVCodecContext::extradata_size, IdcinContext::frame, AVCodecContext::has_b_frames, HUF_TOKENS, huff_build_tree(), IdcinContext::huff_nodes, HUFFMAN_TABLE_SIZE, NULL, AVCodecContext::pix_fmt, PIX_FMT_PAL8, AVCodecContext::priv_data, and s.

| static void idcin_decode_vlcs | ( | IdcinContext * | s | ) | [static] |
Definition at line 178 of file idcinvideo.c.
References av_log(), AV_LOG_ERROR, IdcinContext::avctx, IdcinContext::buf, hnode_t::children, IdcinContext::frame, AVCodecContext::height, HUF_TOKENS, IdcinContext::huff_nodes, IdcinContext::num_huff_nodes, IdcinContext::size, and AVCodecContext::width.
Referenced by idcin_decode_frame().

Initial value:
{
"idcinvideo",
CODEC_TYPE_VIDEO,
CODEC_ID_IDCIN,
sizeof(IdcinContext),
idcin_decode_init,
NULL,
idcin_decode_end,
idcin_decode_frame,
CODEC_CAP_DR1,
}
Definition at line 259 of file idcinvideo.c.
Referenced by avcodec_register_all().
1.5.5