Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: patched-ffmpeg-mt/libavcodec/ivi_common.h

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * common functions for Indeo Video Interactive codecs (Indeo4 and Indeo5) 2 * common functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
3 * 3 *
4 * Copyright (c) 2009 Maxim Poliakovski 4 * Copyright (c) 2009 Maxim Poliakovski
5 * 5 *
6 * This file is part of FFmpeg. 6 * This file is part of FFmpeg.
7 * 7 *
8 * FFmpeg is free software; you can redistribute it and/or 8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 27 matching lines...) Expand all
38 #define IVI_VLC_BITS 13 ///< max number of bits of the ivi's huffman codes 38 #define IVI_VLC_BITS 13 ///< max number of bits of the ivi's huffman codes
39 39
40 /** 40 /**
41 * huffman codebook descriptor 41 * huffman codebook descriptor
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 47
48 extern const IVIHuffDesc ff_ivi_mb_huff_desc[8]; ///< static macroblock huffman tables 48 /**
49 extern const IVIHuffDesc ff_ivi_blk_huff_desc[8]; ///< static block huffman tabl es 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 };
65
66 extern VLC ff_ivi_mb_vlc_tabs [8]; ///< static macroblock Huffman tables
67 extern VLC ff_ivi_blk_vlc_tabs[8]; ///< static block Huffman tables
50 68
51 69
52 /** 70 /**
53 * run-value (RLE) table descriptor 71 * run-value (RLE) table descriptor
54 */ 72 */
55 typedef struct { 73 typedef struct {
56 uint8_t eob_sym; ///< end of block symbol 74 uint8_t eob_sym; ///< end of block symbol
57 uint8_t esc_sym; ///< escape symbol 75 uint8_t esc_sym; ///< escape symbol
58 uint8_t runtab[256]; 76 uint8_t runtab[256];
59 int8_t valtab[256]; 77 int8_t valtab[256];
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 int mb_size; ///< macroblock size 129 int mb_size; ///< macroblock size
112 int blk_size; ///< block size 130 int blk_size; ///< block size
113 int is_halfpel; ///< precision of the motion compensation: 0 - fullpel, 1 - halfpel 131 int is_halfpel; ///< precision of the motion compensation: 0 - fullpel, 1 - halfpel
114 int inherit_mv; ///< tells if motion vector is inherited fro m reference macroblock 132 int inherit_mv; ///< tells if motion vector is inherited fro m reference macroblock
115 int inherit_qdelta; ///< tells if quantiser delta is inherited f rom reference macroblock 133 int inherit_qdelta; ///< tells if quantiser delta is inherited f rom reference macroblock
116 int qdelta_present; ///< tells if Qdelta signal is present in th e bitstream (Indeo5 only) 134 int qdelta_present; ///< tells if Qdelta signal is present in th e 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 se lector 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
130 int rvmap_sel; ///< rvmap table selector 145 int rvmap_sel; ///< rvmap table selector
131 RVMapDesc *rv_map; ///< ptr to the RLE table for this band 146 RVMapDesc *rv_map; ///< ptr to the RLE table for this band
132 int num_tiles; ///< number of tiles in this band 147 int num_tiles; ///< number of tiles in this band
133 IVITile *tiles; ///< array of tile descriptors 148 IVITile *tiles; ///< array of tile descriptors
134 void (*inv_transform)(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags); ///< inverse transform function pointer 149 void (*inv_transform)(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags); ///< inverse transform function pointer
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 191 }
177 192
178 /** calculate number of tiles in a stride */ 193 /** calculate number of tiles in a stride */
179 #define IVI_NUM_TILES(stride, tile_size) (((stride) + (tile_size) - 1) / (tile_s ize)) 194 #define IVI_NUM_TILES(stride, tile_size) (((stride) + (tile_size) - 1) / (tile_s ize))
180 195
181 /** calculate number of macroblocks in a tile */ 196 /** calculate number of macroblocks in a tile */
182 #define IVI_MBs_PER_TILE(tile_width, tile_height, mb_size) \ 197 #define IVI_MBs_PER_TILE(tile_width, tile_height, mb_size) \
183 ((((tile_width) + (mb_size) - 1) / (mb_size)) * (((tile_height) + (mb_size) - 1) / (mb_size))) 198 ((((tile_width) + (mb_size) - 1) / (mb_size)) * (((tile_height) + (mb_size) - 1) / (mb_size)))
184 199
185 /** convert unsigned values into signed ones (the sign is in the LSB) */ 200 /** convert unsigned values into signed ones (the sign is in the LSB) */
186 /* TODO: find a way to calculate this without the conditional using bit magic */
187 #define IVI_TOSIGNED(val) (-(((val) >> 1) ^ -((val) & 1))) 201 #define IVI_TOSIGNED(val) (-(((val) >> 1) ^ -((val) & 1)))
188 202
189 /** scales motion vector */ 203 /** scales motion vector */
190 static inline int ivi_scale_mv(int mv, int mv_scale) 204 static inline int ivi_scale_mv(int mv, int mv_scale)
191 { 205 {
192 return (mv + (mv > 0) + (mv_scale - 1)) >> mv_scale; 206 return (mv + (mv > 0) + (mv_scale - 1)) >> mv_scale;
193 } 207 }
194 208
195 /** 209 /**
196 * Generates a huffman codebook from the given descriptor 210 * Generates a huffman codebook from the given descriptor
197 * and converts it into the FFmpeg VLC table. 211 * and converts it into the FFmpeg VLC table.
198 * 212 *
199 * @param cb [in] pointer to codebook descriptor 213 * @param cb [in] pointer to codebook descriptor
200 * @param vlc [out] where to place the generated VLC table 214 * @param vlc [out] where to place the generated VLC table
201 * @param flag [in] flag: 1 - for static or 0 for dynamic tables 215 * @param flag [in] flag: 1 - for static or 0 for dynamic tables
202 * @return result code: 0 - OK, -1 = error (invalid codebook descriptor) 216 * @return result code: 0 - OK, -1 = error (invalid codebook descriptor)
203 */ 217 */
204 int ff_ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag); 218 int ff_ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag);
205 219
206 /** 220 /**
207 * Decodes a huffman codebook descriptor from the bitstream. 221 * Initializes static codes used for macroblock and block decoding.
222 */
223 void ff_ivi_init_static_vlc(void);
224
225 /**
226 * Decodes a huffman codebook descriptor from the bitstream
227 * and selects specified huffman table.
208 * 228 *
209 * @param gb [in,out] the GetBit context 229 * @param gb [in,out] the GetBit context
210 * @param desc [out] ptr to descriptor to be filled with data 230 * @param desc_coded [in] flag signalling if table descriptor was coded
211 * @return selector indicating huffman table: 231 * @param which_tab [in] codebook purpose (IVI_MB_HUFF or IVI_BLK_HUFF)
212 * (0...6 - predefined, 7 - custom one supplied with the bitstream) 232 * @param huff_tab [out] pointer to the descriptor of the selected table
233 * @param avctx [in] AVCodecContext pointer
234 * @return zero on success, negative value otherwise
213 */ 235 */
214 int ff_ivi_dec_huff_desc(GetBitContext *gb, IVIHuffDesc *desc); 236 int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
237 IVIHuffTab *huff_tab, AVCodecContext *avctx);
215 238
216 /** 239 /**
217 * Compares two huffman codebook descriptors. 240 * Compares two huffman codebook descriptors.
218 * 241 *
219 * @param desc1 [in] ptr to the 1st descriptor to compare 242 * @param desc1 [in] ptr to the 1st descriptor to compare
220 * @param desc2 [in] ptr to the 2nd descriptor to compare 243 * @param desc2 [in] ptr to the 2nd descriptor to compare
221 * @return comparison result: 0 - equal, 1 - not equal 244 * @return comparison result: 0 - equal, 1 - not equal
222 */ 245 */
223 int ff_ivi_huff_desc_cmp(const IVIHuffDesc *desc1, const IVIHuffDesc *desc2); 246 int ff_ivi_huff_desc_cmp(const IVIHuffDesc *desc1, const IVIHuffDesc *desc2);
224 247
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 */ 333 */
311 uint16_t ivi_calc_band_checksum (IVIBandDesc *band); 334 uint16_t ivi_calc_band_checksum (IVIBandDesc *band);
312 335
313 /** 336 /**
314 * Verifies that band data lies in range. 337 * Verifies that band data lies in range.
315 */ 338 */
316 int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch); 339 int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch);
317 #endif 340 #endif
318 341
319 #endif /* AVCODEC_IVI_COMMON_H */ 342 #endif /* AVCODEC_IVI_COMMON_H */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698