libavcodec/ivi_common.c File Reference

This file contains functions and data shared by both Indeo4 and Indeo5 decoders. More...

#include "avcodec.h"
#include "get_bits.h"
#include "ivi_common.h"
#include "libavutil/common.h"
#include "ivi_dsp.h"

Go to the source code of this file.

Defines

#define ALT_BITSTREAM_READER_LE

Functions

static uint16_t inv_bits (uint16_t val, int nbits)
 Reverses "nbits" bits of the value "val" and returns the result in the least significant bits.
int ff_ivi_create_huff_from_desc (const IVIHuffDesc *cb, VLC *vlc, int flag)
 Generates a huffman codebook from the given descriptor and converts it into the FFmpeg VLC table.
void ff_ivi_init_static_vlc (void)
 Initializes static codes used for macroblock and block decoding.
int ff_ivi_dec_huff_desc (GetBitContext *gb, int desc_coded, int which_tab, IVIHuffTab *huff_tab, AVCodecContext *avctx)
 Decodes a huffman codebook descriptor from the bitstream and selects specified huffman table.
int ff_ivi_huff_desc_cmp (const IVIHuffDesc *desc1, const IVIHuffDesc *desc2)
 Compares two huffman codebook descriptors.
void ff_ivi_huff_desc_copy (IVIHuffDesc *dst, const IVIHuffDesc *src)
 Copies huffman codebook descriptors.
int av_cold ff_ivi_init_planes (IVIPlaneDesc *planes, const IVIPicConfig *cfg)
 Initializes planes (prepares descriptors, allocates buffers etc).
void av_cold ff_ivi_free_buffers (IVIPlaneDesc *planes)
 Frees planes, bands and macroblocks buffers.
int av_cold ff_ivi_init_tiles (IVIPlaneDesc *planes, int tile_width, int tile_height)
 Initializes tile and macroblock descriptors.
int ff_ivi_dec_tile_data_size (GetBitContext *gb)
 Decodes size of the tile data.
int ff_ivi_decode_blocks (GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
 Decodes block data: extracts huffman-coded transform coefficients from the bitstream, dequantizes them, applies inverse transform and motion compensation in order to reconstruct the picture.
void ff_ivi_process_empty_tile (AVCodecContext *avctx, IVIBandDesc *band, IVITile *tile, int32_t mv_scale)
 Handles empty tiles by performing data copying and motion compensation respectively.
void ff_ivi_output_plane (IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch)
 Converts and outputs the current plane.

Variables

const IVIHuffDesc ff_ivi_mb_huff_desc [8]
 static macroblock huffman tables
const IVIHuffDesc ff_ivi_blk_huff_desc [8]
 static block huffman tables
VLC ff_ivi_mb_vlc_tabs [8]
 static macroblock Huffman tables
VLC ff_ivi_blk_vlc_tabs [8]
 static block Huffman tables
const RVMapDesc ff_ivi_rvmap_tabs [9]
 Run-value (RLE) tables.


Detailed Description

This file contains functions and data shared by both Indeo4 and Indeo5 decoders.

Definition in file ivi_common.c.


Define Documentation

#define ALT_BITSTREAM_READER_LE

Definition at line 29 of file ivi_common.c.


Function Documentation

int ff_ivi_create_huff_from_desc ( const IVIHuffDesc cb,
VLC vlc,
int  flag 
)

Generates a huffman codebook from the given descriptor and converts it into the FFmpeg VLC table.

Parameters:
cb [in] pointer to codebook descriptor
vlc [out] where to place the generated VLC table
flag [in] flag: 1 - for static or 0 for dynamic tables
Returns:
result code: 0 - OK, -1 = error (invalid codebook descriptor)

Definition at line 58 of file ivi_common.c.

Referenced by ff_ivi_dec_huff_desc(), and ff_ivi_init_static_vlc().

int ff_ivi_dec_huff_desc ( GetBitContext gb,
int  desc_coded,
int  which_tab,
IVIHuffTab huff_tab,
AVCodecContext avctx 
)

Decodes a huffman codebook descriptor from the bitstream and selects specified huffman table.

Parameters:
gb [in,out] the GetBit context
desc_coded [in] flag signalling if table descriptor was coded
which_tab [in] codebook purpose (IVI_MB_HUFF or IVI_BLK_HUFF)
huff_tab [out] pointer to the descriptor of the selected table
avctx [in] AVCodecContext pointer
Returns:
zero on success, negative value otherwise

Definition at line 111 of file ivi_common.c.

Referenced by decode_band_hdr(), and decode_pic_hdr().

int ff_ivi_dec_tile_data_size ( GetBitContext gb  ) 

Decodes size of the tile data.

The size is stored as a variable-length field having the following format: if (tile_data_size < 255) than this field is only one byte long if (tile_data_size >= 255) than this field four is byte long: 0xFF X1 X2 X3 where X1-X3 is size of the tile data

Parameters:
gb [in,out] the GetBit context
Returns:
size of the tile data in bytes

Definition at line 313 of file ivi_common.c.

Referenced by decode_band().

int ff_ivi_decode_blocks ( GetBitContext gb,
IVIBandDesc band,
IVITile tile 
)

Decodes block data: extracts huffman-coded transform coefficients from the bitstream, dequantizes them, applies inverse transform and motion compensation in order to reconstruct the picture.

Parameters:
gb [in,out] the GetBit context
band [in] pointer to the band descriptor
tile [in] pointer to the tile descriptor
Returns:
result code: 0 - OK, -1 = error (corrupted blocks data)

Definition at line 330 of file ivi_common.c.

Referenced by decode_band().

void av_cold ff_ivi_free_buffers ( IVIPlaneDesc planes  ) 

Frees planes, bands and macroblocks buffers.

Parameters:
planes [in] pointer to the array of the plane descriptors

Definition at line 229 of file ivi_common.c.

Referenced by decode_close(), and ff_ivi_init_planes().

int ff_ivi_huff_desc_cmp ( const IVIHuffDesc desc1,
const IVIHuffDesc desc2 
)

Compares two huffman codebook descriptors.

Parameters:
desc1 [in] ptr to the 1st descriptor to compare
desc2 [in] ptr to the 2nd descriptor to compare
Returns:
comparison result: 0 - equal, 1 - not equal

Definition at line 155 of file ivi_common.c.

Referenced by ff_ivi_dec_huff_desc().

void ff_ivi_huff_desc_copy ( IVIHuffDesc dst,
const IVIHuffDesc src 
)

Copies huffman codebook descriptors.

Parameters:
dst [out] ptr to the destination descriptor
src [in] ptr to the source descriptor

Definition at line 161 of file ivi_common.c.

Referenced by ff_ivi_dec_huff_desc().

int av_cold ff_ivi_init_planes ( IVIPlaneDesc planes,
const IVIPicConfig cfg 
)

Initializes planes (prepares descriptors, allocates buffers etc).

Parameters:
planes [in,out] pointer to the array of the plane descriptors
cfg [in] pointer to the ivi_pic_config structure describing picture layout
Returns:
result code: 0 - OK

Definition at line 167 of file ivi_common.c.

Referenced by decode_gop_header(), and decode_init().

void ff_ivi_init_static_vlc ( void   ) 

Initializes static codes used for macroblock and block decoding.

Definition at line 92 of file ivi_common.c.

Referenced by decode_init().

int av_cold ff_ivi_init_tiles ( IVIPlaneDesc planes,
int  tile_width,
int  tile_height 
)

Initializes tile and macroblock descriptors.

Parameters:
planes [in,out] pointer to the array of the plane descriptors
tile_width [in] tile width
tile_height [in] tile height
Returns:
result code: 0 - OK

Definition at line 249 of file ivi_common.c.

Referenced by decode_gop_header().

void ff_ivi_output_plane ( IVIPlaneDesc plane,
uint8_t *  dst,
int  dst_pitch 
)

Converts and outputs the current plane.

This conversion is done by adding back the bias value of 128 (subtracted in the encoder) and clipping the result.

Parameters:
plane [in] pointer to the descriptor of the plane being processed
dst [out] pointer to the buffer receiving converted pixels
dst_pitch [in] pitch for moving to the next y line

Definition at line 601 of file ivi_common.c.

Referenced by decode_frame().

void ff_ivi_process_empty_tile ( AVCodecContext avctx,
IVIBandDesc band,
IVITile tile,
int32_t  mv_scale 
)

Handles empty tiles by performing data copying and motion compensation respectively.

Parameters:
avctx [in] ptr to the AVCodecContext
band [in] pointer to the band descriptor
tile [in] pointer to the tile descriptor
mv_scale [in] scaling factor for motion vectors

Definition at line 465 of file ivi_common.c.

Referenced by decode_band().

static uint16_t inv_bits ( uint16_t  val,
int  nbits 
) [static]

Reverses "nbits" bits of the value "val" and returns the result in the least significant bits.

Definition at line 46 of file ivi_common.c.

Referenced by ff_ivi_create_huff_from_desc().


Variable Documentation

Initial value:

 {
    {10, {1, 2, 3, 4, 4, 7, 5, 5, 4, 1}},
    {11, {2, 3, 4, 4, 4, 7, 5, 4, 3, 3, 2}},
    {12, {2, 4, 5, 5, 5, 5, 6, 4, 4, 3, 1, 1}},
    {13, {3, 3, 4, 4, 5, 6, 6, 4, 4, 3, 2, 1, 1}},
    {11, {3, 4, 4, 5, 5, 5, 6, 5, 4, 2, 2}},
    {13, {3, 4, 5, 5, 5, 5, 6, 4, 3, 3, 2, 1, 1}},
    {13, {3, 4, 5, 5, 5, 6, 5, 4, 3, 3, 2, 1, 1}},
    {9,  {3, 4, 4, 5, 5, 5, 6, 5, 5}}
}
static block huffman tables

Definition at line 633 of file ivi_common.c.

static block Huffman tables

Definition at line 40 of file ivi_common.c.

Initial value:

 {
    {8,  {0, 4, 5, 4, 4, 4, 6, 6}},
    {12, {0, 2, 2, 3, 3, 3, 3, 5, 3, 2, 2, 2}},
    {12, {0, 2, 3, 4, 3, 3, 3, 3, 4, 3, 2, 2}},
    {12, {0, 3, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2}},
    {13, {0, 4, 4, 3, 3, 3, 3, 2, 3, 3, 2, 1, 1}},
    {9,  {0, 4, 4, 4, 4, 3, 3, 3, 2}},
    {10, {0, 4, 4, 4, 4, 3, 3, 2, 2, 2}},
    {12, {0, 4, 4, 4, 3, 3, 2, 3, 2, 2, 2, 2}}
}
static macroblock huffman tables

These are 2x8 predefined Huffman codebooks for coding macroblock/block signals.

They are specified using "huffman descriptors" in order to avoid huge static tables. The decoding tables will be generated at startup from these descriptors.

Definition at line 622 of file ivi_common.c.

static macroblock Huffman tables

Definition at line 39 of file ivi_common.c.

Run-value (RLE) tables.

Definition at line 648 of file ivi_common.c.

Referenced by decode_init().


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