libavcodec/ivi_common.h File Reference

This file contains structures and macros shared by both Indeo4 and Indeo5 decoders. More...

#include "avcodec.h"
#include "get_bits.h"
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  IVIHuffDesc
 huffman codebook descriptor More...
struct  IVIHuffTab
 macroblock/block huffman table descriptor More...
struct  RVMapDesc
 run-value (RLE) table descriptor More...
struct  IVIMbInfo
 information for Indeo macroblock (16x16, 8x8 or 4x4) More...
struct  IVITile
 information for Indeo tile More...
struct  IVIBandDesc
 information for Indeo wavelet band More...
struct  IVIPlaneDesc
 color plane (luma or chroma) information More...
struct  IVIPicConfig

Defines

#define IVI_VLC_BITS   13
 max number of bits of the ivi's huffman codes
#define IVI_NUM_TILES(stride, tile_size)   (((stride) + (tile_size) - 1) / (tile_size))
 calculate number of tiles in a stride
#define IVI_MBs_PER_TILE(tile_width, tile_height, mb_size)   ((((tile_width) + (mb_size) - 1) / (mb_size)) * (((tile_height) + (mb_size) - 1) / (mb_size)))
 calculate number of macroblocks in a tile
#define IVI_TOSIGNED(val)   (-(((val) >> 1) ^ -((val) & 1)))
 convert unsigned values into signed ones (the sign is in the LSB)

Typedefs

typedef void( InvTransformPtr )(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
 Declare inverse transform function types.
typedef void( DCTransformPtr )(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)

Enumerations

enum  { IVI_MB_HUFF = 0, IVI_BLK_HUFF = 1 }

Functions

static int ivi_pic_config_cmp (IVIPicConfig *str1, IVIPicConfig *str2)
 compare some properties of two pictures
static int ivi_scale_mv (int mv, int mv_scale)
 scale motion vector
int ff_ivi_create_huff_from_desc (const IVIHuffDesc *cb, VLC *vlc, int flag)
 Generate a huffman codebook from the given descriptor and convert it into the FFmpeg VLC table.
void ff_ivi_init_static_vlc (void)
 Initialize 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)
 Decode a huffman codebook descriptor from the bitstream and select specified huffman table.
int ff_ivi_huff_desc_cmp (const IVIHuffDesc *desc1, const IVIHuffDesc *desc2)
 Compare two huffman codebook descriptors.
void ff_ivi_huff_desc_copy (IVIHuffDesc *dst, const IVIHuffDesc *src)
 Copy huffman codebook descriptors.
int ff_ivi_init_planes (IVIPlaneDesc *planes, const IVIPicConfig *cfg)
 Initialize planes (prepares descriptors, allocates buffers etc).
void ff_ivi_free_buffers (IVIPlaneDesc *planes)
 Free planes, bands and macroblocks buffers.
int ff_ivi_init_tiles (IVIPlaneDesc *planes, int tile_width, int tile_height)
 Initialize tile and macroblock descriptors.
int ff_ivi_dec_tile_data_size (GetBitContext *gb)
 Decode size of the tile data.
int ff_ivi_decode_blocks (GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
 Decode block data: extract huffman-coded transform coefficients from the bitstream, dequantize them, apply 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)
 Handle empty tiles by performing data copying and motion compensation respectively.
void ff_ivi_output_plane (IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch)
 Convert and output the current plane.
uint16_t ivi_calc_band_checksum (IVIBandDesc *band)
 Calculate band checksum from band data.
int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch)
 Verify that band data lies in range.

Variables

VLC ff_ivi_mb_vlc_tabs [8]
 static macroblock Huffman tables
VLC ff_ivi_blk_vlc_tabs [8]
 static block Huffman tables
const uint8_t ff_ivi_vertical_scan_8x8 [64]
 Common scan patterns (defined in ivi_common.c).
const uint8_t ff_ivi_horizontal_scan_8x8 [64]
const uint8_t ff_ivi_direct_scan_4x4 [16]
const RVMapDesc ff_ivi_rvmap_tabs [9]
 Run-value (RLE) tables.


Detailed Description

This file contains structures and macros shared by both Indeo4 and Indeo5 decoders.

Definition in file ivi_common.h.


Define Documentation

#define IVI_MBs_PER_TILE ( tile_width,
tile_height,
mb_size   )     ((((tile_width) + (mb_size) - 1) / (mb_size)) * (((tile_height) + (mb_size) - 1) / (mb_size)))

calculate number of macroblocks in a tile

Definition at line 208 of file ivi_common.h.

Referenced by ff_ivi_init_tiles().

#define IVI_NUM_TILES ( stride,
tile_size   )     (((stride) + (tile_size) - 1) / (tile_size))

calculate number of tiles in a stride

Definition at line 205 of file ivi_common.h.

Referenced by ff_ivi_init_tiles().

#define IVI_TOSIGNED ( val   )     (-(((val) >> 1) ^ -((val) & 1)))

convert unsigned values into signed ones (the sign is in the LSB)

Definition at line 212 of file ivi_common.h.

Referenced by decode_mb_info(), and ff_ivi_decode_blocks().

#define IVI_VLC_BITS   13

max number of bits of the ivi's huffman codes

Definition at line 36 of file ivi_common.h.

Referenced by decode_mb_info(), ff_ivi_create_huff_from_desc(), and ff_ivi_decode_blocks().


Typedef Documentation

typedef void( DCTransformPtr)(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)

Definition at line 80 of file ivi_common.h.

typedef void( InvTransformPtr)(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)

Declare inverse transform function types.

Definition at line 79 of file ivi_common.h.


Enumeration Type Documentation

anonymous enum

Enumerator:
IVI_MB_HUFF 
IVI_BLK_HUFF  Huffman table is used for coding macroblocks.

Definition at line 59 of file ivi_common.h.


Function Documentation

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

Generate a huffman codebook from the given descriptor and convert it into the FFmpeg VLC table.

Parameters:
[in] cb pointer to codebook descriptor
[out] vlc where to place the generated VLC table
[in] flag 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 
)

Decode a huffman codebook descriptor from the bitstream and select specified huffman table.

Parameters:
[in,out] gb the GetBit context
[in] desc_coded flag signalling if table descriptor was coded
[in] which_tab codebook purpose (IVI_MB_HUFF or IVI_BLK_HUFF)
[out] huff_tab pointer to the descriptor of the selected table
[in] avctx 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  ) 

Decode 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:
[in,out] gb 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 
)

Decode block data: extract huffman-coded transform coefficients from the bitstream, dequantize them, apply inverse transform and motion compensation in order to reconstruct the picture.

Parameters:
[in,out] gb the GetBit context
[in] band pointer to the band descriptor
[in] tile 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 ff_ivi_free_buffers ( IVIPlaneDesc planes  ) 

Free planes, bands and macroblocks buffers.

Parameters:
[in] planes 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 
)

Compare two huffman codebook descriptors.

Parameters:
[in] desc1 ptr to the 1st descriptor to compare
[in] desc2 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 
)

Copy huffman codebook descriptors.

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

Definition at line 161 of file ivi_common.c.

Referenced by ff_ivi_dec_huff_desc().

int ff_ivi_init_planes ( IVIPlaneDesc planes,
const IVIPicConfig cfg 
)

Initialize planes (prepares descriptors, allocates buffers etc).

Parameters:
[in,out] planes pointer to the array of the plane descriptors
[in] cfg 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   ) 

Initialize static codes used for macroblock and block decoding.

Definition at line 92 of file ivi_common.c.

Referenced by decode_init().

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

Initialize tile and macroblock descriptors.

Parameters:
[in,out] planes pointer to the array of the plane descriptors
[in] tile_width tile width
[in] tile_height 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 
)

Convert and output the current plane.

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

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

Definition at line 608 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 
)

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

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

Definition at line 472 of file ivi_common.c.

Referenced by decode_band().

uint16_t ivi_calc_band_checksum ( IVIBandDesc band  ) 

Calculate band checksum from band data.

Referenced by decode_band().

int ivi_check_band ( IVIBandDesc band,
const uint8_t *  ref,
int  pitch 
)

Verify that band data lies in range.

static int ivi_pic_config_cmp ( IVIPicConfig str1,
IVIPicConfig str2 
) [inline, static]

compare some properties of two pictures

Definition at line 196 of file ivi_common.h.

Referenced by decode_gop_header().

static int ivi_scale_mv ( int  mv,
int  mv_scale 
) [inline, static]

scale motion vector

Definition at line 215 of file ivi_common.h.

Referenced by decode_mb_info(), and ff_ivi_process_empty_tile().


Variable Documentation

static block Huffman tables

Definition at line 40 of file ivi_common.c.

const uint8_t ff_ivi_direct_scan_4x4[16]

Definition at line 677 of file ivi_common.c.

Referenced by decode_gop_header().

const uint8_t ff_ivi_horizontal_scan_8x8[64]

Definition at line 666 of file ivi_common.c.

Referenced by decode_gop_header().

static macroblock Huffman tables

Definition at line 39 of file ivi_common.c.

Run-value (RLE) tables.

Definition at line 685 of file ivi_common.c.

Referenced by decode_init().

const uint8_t ff_ivi_vertical_scan_8x8[64]

Common scan patterns (defined in ivi_common.c).

Definition at line 655 of file ivi_common.c.

Referenced by decode_gop_header().


Generated on Fri Oct 26 02:39:45 2012 for FFmpeg by  doxygen 1.5.8