vqavideo.c File Reference


Detailed Description

VQA Video Decoder by Mike Melanson (melanson@pcisys.net) For more information about the VQA format, visit: http://wiki.multimedia.cx/index.php?title=VQA.

The VQA video decoder outputs PAL8 or RGB555 colorspace data, depending on the type of data in the file.

This decoder needs the 42-byte VQHD header from the beginning of the VQA file passed through the extradata field. The VQHD header is laid out as:

bytes 0-3 chunk fourcc: 'VQHD' bytes 4-7 chunk size in big-endian format, should be 0x0000002A bytes 8-49 VQHD chunk data

Bytes 8-49 are what this decoder expects to see.

Briefly, VQA is a vector quantized animation format that operates in a VGA palettized colorspace. It operates on pixel vectors (blocks) of either 4x2 or 4x4 in size. Compressed VQA chunks can contain vector codebooks, palette information, and code maps for rendering vectors onto frames. Any of these components can also be compressed with a run-length encoding (RLE) algorithm commonly referred to as "format80".

VQA takes a novel approach to rate control. Each group of n frames (usually, n = 8) relies on a different vector codebook. Rather than transporting an entire codebook every 8th frame, the new codebook is broken up into 8 pieces and sent along with the compressed video chunks for each of the 8 frames preceding the 8 frames which require the codebook. A full codebook is also sent on the very first frame of a file. This is an interesting technique, although it makes random file seeking difficult despite the fact that the frames are all intracoded.

V1,2 VQA uses 12-bit codebook indices. If the 12-bit indices were packed into bytes and then RLE compressed, bytewise, the results would be poor. That is why the coding method divides each index into 2 parts, the top 4 bits and the bottom 8 bits, then RL encodes the 4-bit pieces together and the 8-bit pieces together. If most of the vectors are clustered into one group of 256 vectors, most of the 4-bit index pieces should be the same.

Definition in file vqavideo.c.

Go to the source code of this file.

Classes

struct  VqaContext

Functions

static void vqa_debug (const char *format,...)
static int vqa_decode_init (AVCodecContext *avctx)
static void decode_format80 (unsigned char *src, int src_size, unsigned char *dest, int dest_size, int check_size)
static void vqa_decode_chunk (VqaContext *s)
static int vqa_decode_frame (AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size)
static int vqa_decode_end (AVCodecContext *avctx)

Variables

AVCodec vqa_decoder


Function Documentation

static void vqa_debug ( const char *  format,
  ... 
) [inline, static]

Definition at line 98 of file vqavideo.c.

Referenced by decode_format80().

static int vqa_decode_init ( AVCodecContext avctx  )  [static]

Definition at line 132 of file vqavideo.c.

static void decode_format80 ( unsigned char *  src,
int  src_size,
unsigned char *  dest,
int  dest_size,
int  check_size 
) [static]

Definition at line 205 of file vqavideo.c.

Referenced by vqa_decode_chunk().

static void vqa_decode_chunk ( VqaContext s  )  [static]

Definition at line 296 of file vqavideo.c.

Referenced by vqa_decode_frame().

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

Definition at line 568 of file vqavideo.c.

static int vqa_decode_end ( AVCodecContext avctx  )  [static]

Definition at line 598 of file vqavideo.c.


Variable Documentation

Initial value:

 {
    "vqavideo",
    CODEC_TYPE_VIDEO,
    CODEC_ID_WS_VQA,
    sizeof(VqaContext),
    vqa_decode_init,
    NULL,
    vqa_decode_end,
    vqa_decode_frame,
    CODEC_CAP_DR1,
}

Definition at line 612 of file vqavideo.c.


Generated on Sat Dec 18 05:15:56 2010 for MythTV by  doxygen 1.5.5