Mercurial > libavcodec.hg
comparison ivi_common.h @ 11309:d617766bf19b libavcodec
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)
author | kostya |
---|---|
date | Sat, 27 Feb 2010 12:32:31 +0000 |
parents | 06e2ff1295bd |
children | 7dd2a45249a9 |
comparison
equal
deleted
inserted
replaced
11308:06e2ff1295bd | 11309:d617766bf19b |
---|---|
42 */ | 42 */ |
43 typedef struct { | 43 typedef struct { |
44 int32_t num_rows; | 44 int32_t num_rows; |
45 uint8_t xbits[16]; | 45 uint8_t xbits[16]; |
46 } IVIHuffDesc; | 46 } IVIHuffDesc; |
47 | |
48 /** | |
49 * macroblock/block huffman table descriptor | |
50 */ | |
51 typedef struct { | |
52 int32_t tab_sel; /// index of one of the predefined tables | |
53 /// or "7" for custom one | |
54 VLC *tab; /// pointer to the table associated with tab_sel | |
55 | |
56 //! the following are used only when tab_sel == 7 | |
57 IVIHuffDesc cust_desc; /// custom Huffman codebook descriptor | |
58 VLC cust_tab; /// vlc table for custom codebook | |
59 } IVIHuffTab; | |
60 | |
61 enum { | |
62 IVI_MB_HUFF = 0, /// Huffman table is used for coding macroblocks | |
63 IVI_BLK_HUFF = 1 /// Huffman table is used for coding blocks | |
64 }; | |
47 | 65 |
48 extern VLC ff_ivi_mb_vlc_tabs [8]; ///< static macroblock Huffman tables | 66 extern VLC ff_ivi_mb_vlc_tabs [8]; ///< static macroblock Huffman tables |
49 extern VLC ff_ivi_blk_vlc_tabs[8]; ///< static block Huffman tables | 67 extern VLC ff_ivi_blk_vlc_tabs[8]; ///< static block Huffman tables |
50 | 68 |
51 | 69 |
116 int qdelta_present; ///< tells if Qdelta signal is present in the bitstream (Indeo5 only) | 134 int qdelta_present; ///< tells if Qdelta signal is present in the bitstream (Indeo5 only) |
117 int quant_mat; ///< dequant matrix index | 135 int quant_mat; ///< dequant matrix index |
118 int glob_quant; ///< quant base for this band | 136 int glob_quant; ///< quant base for this band |
119 const uint8_t *scan; ///< ptr to the scan pattern | 137 const uint8_t *scan; ///< ptr to the scan pattern |
120 | 138 |
121 int huff_sel; ///< huffman table for this band | 139 IVIHuffTab blk_vlc; ///< vlc table for decoding block data |
122 IVIHuffDesc huff_desc; ///< table descriptor associated with the selector above | |
123 VLC *blk_vlc; ///< ptr to the vlc table for decoding block data | |
124 VLC blk_vlc_cust; ///< custom block vlc table | |
125 | 140 |
126 uint16_t *dequant_intra; ///< ptr to dequant tables for intra blocks | 141 uint16_t *dequant_intra; ///< ptr to dequant tables for intra blocks |
127 uint16_t *dequant_inter; ///< ptr dequant tables for inter blocks | 142 uint16_t *dequant_inter; ///< ptr dequant tables for inter blocks |
128 int num_corr; ///< number of correction entries | 143 int num_corr; ///< number of correction entries |
129 uint8_t corr[61*2]; ///< rvmap correction pairs | 144 uint8_t corr[61*2]; ///< rvmap correction pairs |
206 * Initializes static codes used for macroblock and block decoding. | 221 * Initializes static codes used for macroblock and block decoding. |
207 */ | 222 */ |
208 void ff_ivi_init_static_vlc(void); | 223 void ff_ivi_init_static_vlc(void); |
209 | 224 |
210 /** | 225 /** |
211 * Decodes a huffman codebook descriptor from the bitstream. | 226 * Decodes a huffman codebook descriptor from the bitstream |
212 * | 227 * and selects specified huffman table. |
213 * @param gb [in,out] the GetBit context | 228 * |
214 * @param desc [out] ptr to descriptor to be filled with data | 229 * @param gb [in,out] the GetBit context |
215 * @return selector indicating huffman table: | 230 * @param desc_coded [in] flag signalling if table descriptor was coded |
216 * (0...6 - predefined, 7 - custom one supplied with the bitstream) | 231 * @param which_tab [in] codebook purpose (IVI_MB_HUFF or IVI_BLK_HUFF) |
217 */ | 232 * @param huff_tab [out] pointer to the descriptor of the selected table |
218 int ff_ivi_dec_huff_desc(GetBitContext *gb, IVIHuffDesc *desc); | 233 * @param avctx [in] AVCodecContext pointer |
234 * @return zero on success, negative value otherwise | |
235 */ | |
236 int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab, | |
237 IVIHuffTab *huff_tab, AVCodecContext *avctx); | |
219 | 238 |
220 /** | 239 /** |
221 * Compares two huffman codebook descriptors. | 240 * Compares two huffman codebook descriptors. |
222 * | 241 * |
223 * @param desc1 [in] ptr to the 1st descriptor to compare | 242 * @param desc1 [in] ptr to the 1st descriptor to compare |