comparison vc9.c @ 2465:5565203c95ee libavcodec

use dc tables from msmpeg4 instead of duplicating them patch by anonymous
author michael
date Wed, 26 Jan 2005 12:01:35 +0000
parents ab390f13c7f5
children 81a9f883a17a
comparison
equal deleted inserted replaced
2464:ab390f13c7f5 2465:5565203c95ee
24 * @file vc9.c 24 * @file vc9.c
25 * VC-9 and WMV3 decoder 25 * VC-9 and WMV3 decoder
26 * 26 *
27 * TODO: Norm-6 bitplane imode, most AP stuff, optimize, all of MB layer :) 27 * TODO: Norm-6 bitplane imode, most AP stuff, optimize, all of MB layer :)
28 * TODO: use MPV_ !! 28 * TODO: use MPV_ !!
29 * TODO: export decode012 in bitstream.h ?
30 */ 29 */
31 #include "common.h" 30 #include "common.h"
32 #include "dsputil.h" 31 #include "dsputil.h"
33 #include "avcodec.h" 32 #include "avcodec.h"
34 #include "mpegvideo.h" 33 #include "mpegvideo.h"
35 #include "vc9data.h" 34 #include "vc9data.h"
35 extern const uint32_t ff_table0_dc_lum[120][2], ff_table1_dc_lum[120][2];
36 extern const uint32_t ff_table0_dc_chroma[120][2], ff_table1_dc_chroma[120][2];
36 37
37 /* Some inhibiting stuff */ 38 /* Some inhibiting stuff */
38 #define HAS_ADVANCED_PROFILE 1 39 #define HAS_ADVANCED_PROFILE 1
39 #define TRACE 1 40 #define TRACE 1
40 41
137 static VLC vc9_cbpcy_i_vlc; 138 static VLC vc9_cbpcy_i_vlc;
138 #define VC9_CBPCY_P_VLC_BITS 9 //14 139 #define VC9_CBPCY_P_VLC_BITS 9 //14
139 static VLC vc9_cbpcy_p_vlc[4]; 140 static VLC vc9_cbpcy_p_vlc[4];
140 #define VC9_4MV_BLOCK_PATTERN_VLC_BITS 6 141 #define VC9_4MV_BLOCK_PATTERN_VLC_BITS 6
141 static VLC vc9_4mv_block_pattern_vlc[4]; 142 static VLC vc9_4mv_block_pattern_vlc[4];
142 #define VC9_LUMA_DC_VLC_BITS 9 143 #define VC9_DC_VLC_BITS 9
143 static VLC vc9_luma_dc_vlc[2]; 144 static VLC vc9_luma_dc_vlc[2];
144 #define VC9_CHROMA_DC_VLC_BITS 9
145 static VLC vc9_chroma_dc_vlc[2]; 145 static VLC vc9_chroma_dc_vlc[2];
146 146
147 //We mainly need data and is_raw, so this struct could be avoided 147 //We mainly need data and is_raw, so this struct could be avoided
148 //to save a level of indirection; feel free to modify 148 //to save a level of indirection; feel free to modify
149 typedef struct BitPlane { 149 typedef struct BitPlane {
343 vc9_cbpcy_i_bits, 1, 1, 343 vc9_cbpcy_i_bits, 1, 1,
344 vc9_cbpcy_i_codes, 2, 2, 1); 344 vc9_cbpcy_i_codes, 2, 2, 1);
345 INIT_VLC(&vc9_imode_vlc, VC9_IMODE_VLC_BITS, 7, 345 INIT_VLC(&vc9_imode_vlc, VC9_IMODE_VLC_BITS, 7,
346 vc9_imode_bits, 1, 1, 346 vc9_imode_bits, 1, 1,
347 vc9_imode_codes, 1, 1, 1); 347 vc9_imode_codes, 1, 1, 1);
348 for (i=0; i<2; i++) 348 INIT_VLC(&vc9_luma_dc_vlc[0], VC9_DC_VLC_BITS, 120,
349 { 349 &ff_table0_dc_lum[0][1], 8, 4,
350 INIT_VLC(&vc9_luma_dc_vlc[i], VC9_LUMA_DC_VLC_BITS, 26, 350 &ff_table0_dc_lum[0][0], 8, 4, 1);
351 vc9_luma_dc_bits[i], 1, 1, 351 INIT_VLC(&vc9_chroma_dc_vlc[0], VC9_DC_VLC_BITS, 120,
352 vc9_luma_dc_codes[i], 4, 4, 1); 352 &ff_table0_dc_chroma[0][1], 8, 4,
353 INIT_VLC(&vc9_chroma_dc_vlc[i], VC9_CHROMA_DC_VLC_BITS, 26, 353 &ff_table0_dc_chroma[0][0], 8, 4, 1);
354 vc9_chroma_dc_bits[i], 1, 1, 354 INIT_VLC(&vc9_luma_dc_vlc[1], VC9_DC_VLC_BITS, 120,
355 vc9_chroma_dc_codes[i], 4, 4, 1); 355 &ff_table1_dc_lum[0][1], 8, 4,
356 } 356 &ff_table1_dc_lum[0][0], 8, 4, 1);
357 INIT_VLC(&vc9_chroma_dc_vlc[1], VC9_DC_VLC_BITS, 120,
358 &ff_table1_dc_chroma[0][1], 8, 4,
359 &ff_table1_dc_chroma[0][0], 8, 4, 1);
357 for (i=0; i<3; i++) 360 for (i=0; i<3; i++)
358 { 361 {
359 INIT_VLC(&vc9_ttmb_vlc[i], VC9_TTMB_VLC_BITS, 16, 362 INIT_VLC(&vc9_ttmb_vlc[i], VC9_TTMB_VLC_BITS, 16,
360 vc9_ttmb_bits[i], 1, 1, 363 vc9_ttmb_bits[i], 1, 1,
361 vc9_ttmb_codes[i], 2, 2, 1); 364 vc9_ttmb_codes[i], 2, 2, 1);
1371 int decode_luma_intra_block(VC9Context *v, int mquant) 1374 int decode_luma_intra_block(VC9Context *v, int mquant)
1372 { 1375 {
1373 int dcdiff; 1376 int dcdiff;
1374 1377
1375 dcdiff = get_vlc2(&v->gb, v->luma_dc_vlc->table, 1378 dcdiff = get_vlc2(&v->gb, v->luma_dc_vlc->table,
1376 VC9_LUMA_DC_VLC_BITS, 2); 1379 VC9_DC_VLC_BITS, 2);
1377 if (dcdiff) 1380 if (dcdiff)
1378 { 1381 {
1379 if (dcdiff == 119 /* ESC index value */) 1382 if (dcdiff == 119 /* ESC index value */)
1380 { 1383 {
1381 /* TODO: Optimize */ 1384 /* TODO: Optimize */