libavcodec/idcinvideo.c File Reference

id Quake II Cin Video Decoder by Dr. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "avcodec.h"

Go to the source code of this file.

Data Structures

struct  hnode
struct  IdcinContext

Defines

#define HUFFMAN_TABLE_SIZE   64 * 1024
#define HUF_TOKENS   256
#define PALETTE_COUNT   256

Functions

static int huff_smallest_node (hnode *hnodes, int num_hnodes)
static av_cold void huff_build_tree (IdcinContext *s, int prev)
static av_cold 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, AVPacket *avpkt)
static av_cold int idcin_decode_end (AVCodecContext *avctx)

Variables

AVCodec idcin_decoder


Detailed Description

id Quake II Cin Video Decoder by Dr.

Tim Ferguson For more information about the id CIN format, visit: http://www.csse.monash.edu.au/~timf/

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 Documentation

#define HUF_TOKENS   256

Definition at line 54 of file idcinvideo.c.

Referenced by huff_build_tree(), idcin_decode_init(), and idcin_decode_vlcs().

#define HUFFMAN_TABLE_SIZE   64 * 1024

Definition at line 53 of file idcinvideo.c.

Referenced by idcin_decode_init(), and idcin_read_header().

#define PALETTE_COUNT   256


Function Documentation

static av_cold void huff_build_tree ( IdcinContext s,
int  prev 
) [static]

Definition at line 115 of file idcinvideo.c.

Referenced by idcin_decode_init().

static int huff_smallest_node ( hnode hnodes,
int  num_hnodes 
) [static]

Definition at line 83 of file idcinvideo.c.

Referenced by huff_build_tree().

static av_cold int idcin_decode_end ( AVCodecContext avctx  )  [static]

Definition at line 246 of file idcinvideo.c.

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

Definition at line 209 of file idcinvideo.c.

static av_cold int idcin_decode_init ( AVCodecContext avctx  )  [static]

Definition at line 145 of file idcinvideo.c.

static void idcin_decode_vlcs ( IdcinContext s  )  [static]

Definition at line 173 of file idcinvideo.c.

Referenced by idcin_decode_frame().


Variable Documentation

Initial value:

 {
    "idcinvideo",
    AVMEDIA_TYPE_VIDEO,
    CODEC_ID_IDCIN,
    sizeof(IdcinContext),
    idcin_decode_init,
    NULL,
    idcin_decode_end,
    idcin_decode_frame,
    CODEC_CAP_DR1,
    .long_name = NULL_IF_CONFIG_SMALL("id Quake II CIN video"),
}

Definition at line 256 of file idcinvideo.c.


Generated on Fri Oct 26 02:36:52 2012 for FFmpeg by  doxygen 1.5.8