diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2010-02-27 12:32:31 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2010-02-27 12:32:31 +0000 |
commit | e322aacedd1e91cbd1b1463ae9b4bb59a8316b5c (patch) | |
tree | d0979e86a0cb869af2ee7a401334b630594bf719 /libavcodec/ivi_common.h | |
parent | 4982a77e56bba5c21964cf55a55c40525cd0f399 (diff) | |
download | ffmpeg-e322aacedd1e91cbd1b1463ae9b4bb59a8316b5c.tar.gz |
Encapsulate VLC information needed for decoding blocks and macroblocks in
Indeo 5 into single structure IVIHuffTab and factorize code using it.
Based on patch by Maxim (max_pole at German GMX)
Originally committed as revision 22092 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ivi_common.h')
-rw-r--r-- | libavcodec/ivi_common.h | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/libavcodec/ivi_common.h b/libavcodec/ivi_common.h index 95ab506fc6..ef0a0f4917 100644 --- a/libavcodec/ivi_common.h +++ b/libavcodec/ivi_common.h @@ -45,6 +45,24 @@ typedef struct { uint8_t xbits[16]; } IVIHuffDesc; +/** + * macroblock/block huffman table descriptor + */ +typedef struct { + int32_t tab_sel; /// index of one of the predefined tables + /// or "7" for custom one + VLC *tab; /// pointer to the table associated with tab_sel + + //! the following are used only when tab_sel == 7 + IVIHuffDesc cust_desc; /// custom Huffman codebook descriptor + VLC cust_tab; /// vlc table for custom codebook +} IVIHuffTab; + +enum { + IVI_MB_HUFF = 0, /// Huffman table is used for coding macroblocks + IVI_BLK_HUFF = 1 /// Huffman table is used for coding blocks +}; + extern VLC ff_ivi_mb_vlc_tabs [8]; ///< static macroblock Huffman tables extern VLC ff_ivi_blk_vlc_tabs[8]; ///< static block Huffman tables @@ -118,10 +136,7 @@ typedef struct { int glob_quant; ///< quant base for this band const uint8_t *scan; ///< ptr to the scan pattern - int huff_sel; ///< huffman table for this band - IVIHuffDesc huff_desc; ///< table descriptor associated with the selector above - VLC *blk_vlc; ///< ptr to the vlc table for decoding block data - VLC blk_vlc_cust; ///< custom block vlc table + IVIHuffTab blk_vlc; ///< vlc table for decoding block data uint16_t *dequant_intra; ///< ptr to dequant tables for intra blocks uint16_t *dequant_inter; ///< ptr dequant tables for inter blocks @@ -208,14 +223,18 @@ int ff_ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag); void ff_ivi_init_static_vlc(void); /** - * Decodes a huffman codebook descriptor from the bitstream. + * Decodes a huffman codebook descriptor from the bitstream + * and selects specified huffman table. * - * @param gb [in,out] the GetBit context - * @param desc [out] ptr to descriptor to be filled with data - * @return selector indicating huffman table: - * (0...6 - predefined, 7 - custom one supplied with the bitstream) + * @param gb [in,out] the GetBit context + * @param desc_coded [in] flag signalling if table descriptor was coded + * @param which_tab [in] codebook purpose (IVI_MB_HUFF or IVI_BLK_HUFF) + * @param huff_tab [out] pointer to the descriptor of the selected table + * @param avctx [in] AVCodecContext pointer + * @return zero on success, negative value otherwise */ -int ff_ivi_dec_huff_desc(GetBitContext *gb, IVIHuffDesc *desc); +int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab, + IVIHuffTab *huff_tab, AVCodecContext *avctx); /** * Compares two huffman codebook descriptors. |