#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) |
Reverse "nbits" bits of the value "val" and return the result in the least significant bits. | |
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 av_cold | ff_ivi_init_planes (IVIPlaneDesc *planes, const IVIPicConfig *cfg) |
Initialize planes (prepares descriptors, allocates buffers etc). | |
void av_cold | ff_ivi_free_buffers (IVIPlaneDesc *planes) |
Free planes, bands and macroblocks buffers. | |
int av_cold | 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. | |
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 uint8_t | ff_ivi_vertical_scan_8x8 [64] |
Scan patterns shared between indeo4 and indeo5. | |
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. |
Definition in file ivi_common.c.
#define ALT_BITSTREAM_READER_LE |
Definition at line 29 of file ivi_common.c.
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.
[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 |
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.
[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 |
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
[in,out] | gb | the GetBit context |
Definition at line 315 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.
[in,out] | gb | the GetBit context |
[in] | band | pointer to the band descriptor |
[in] | tile | pointer to the tile descriptor |
Definition at line 332 of file ivi_common.c.
Referenced by decode_band().
void av_cold ff_ivi_free_buffers | ( | IVIPlaneDesc * | planes | ) |
Free planes, bands and macroblocks buffers.
[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.
[in] | desc1 | ptr to the 1st descriptor to compare |
[in] | desc2 | ptr to the 2nd descriptor to compare |
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.
[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 av_cold ff_ivi_init_planes | ( | IVIPlaneDesc * | planes, | |
const IVIPicConfig * | cfg | |||
) |
Initialize planes (prepares descriptors, allocates buffers etc).
[in,out] | planes | pointer to the array of the plane descriptors |
[in] | cfg | pointer to the ivi_pic_config structure describing picture layout |
Definition at line 167 of file ivi_common.c.
Referenced by decode_gop_header(), decode_init(), and decode_pic_hdr().
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 av_cold ff_ivi_init_tiles | ( | IVIPlaneDesc * | planes, | |
int | tile_width, | |||
int | tile_height | |||
) |
Initialize tile and macroblock descriptors.
[in,out] | planes | pointer to the array of the plane descriptors |
[in] | tile_width | tile width |
[in] | tile_height | tile height |
Definition at line 249 of file ivi_common.c.
Referenced by decode_gop_header(), and decode_pic_hdr().
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.
[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 610 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.
[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 474 of file ivi_common.c.
Referenced by decode_band().
static uint16_t inv_bits | ( | uint16_t | val, | |
int | nbits | |||
) | [static] |
Reverse "nbits" bits of the value "val" and return the result in the least significant bits.
Definition at line 46 of file ivi_common.c.
Referenced by ff_ivi_create_huff_from_desc().
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}} }
Definition at line 645 of file ivi_common.c.
const uint8_t ff_ivi_direct_scan_4x4[16] |
Initial value:
{ 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15 }
Definition at line 682 of file ivi_common.c.
Referenced by decode_gop_header().
const uint8_t ff_ivi_horizontal_scan_8x8[64] |
Initial value:
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63 }
Definition at line 671 of file ivi_common.c.
Referenced by decode_gop_header().
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}} }
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 634 of file ivi_common.c.
const RVMapDesc ff_ivi_rvmap_tabs[9] |
const uint8_t ff_ivi_vertical_scan_8x8[64] |
Initial value:
{ 0, 8, 16, 24, 32, 40, 48, 56, 1, 9, 17, 25, 33, 41, 49, 57, 2, 10, 18, 26, 34, 42, 50, 58, 3, 11, 19, 27, 35, 43, 51, 59, 4, 12, 20, 28, 36, 44, 52, 60, 5, 13, 21, 29, 37, 45, 53, 61, 6, 14, 22, 30, 38, 46, 54, 62, 7, 15, 23, 31, 39, 47, 55, 63 }
Common scan patterns (defined in ivi_common.c).
Definition at line 660 of file ivi_common.c.
Referenced by decode_gop_header().