Mercurial > libavcodec.hg
comparison intrax8.c @ 10261:64ee90bc6c31 libavcodec
Change VLC table creation in x8_vlc_init to use INIT_VLC_USE_NEW_STATIC.
author | reimar |
---|---|
date | Thu, 24 Sep 2009 11:04:46 +0000 |
parents | 0dce4fe6e6f3 |
children | 7dd2a45249a9 |
comparison
equal
deleted
inserted
replaced
10260:48aebab3bac1 | 10261:64ee90bc6c31 |
---|---|
42 static VLC j_dc_vlc[2][8]; //[quant], [select] | 42 static VLC j_dc_vlc[2][8]; //[quant], [select] |
43 static VLC j_orient_vlc[2][4]; //[quant], [select] | 43 static VLC j_orient_vlc[2][4]; //[quant], [select] |
44 | 44 |
45 static av_cold void x8_vlc_init(void){ | 45 static av_cold void x8_vlc_init(void){ |
46 int i; | 46 int i; |
47 int offset = 0; | |
48 int sizeidx = 0; | |
49 static const uint16_t sizes[8*4 + 8*2 + 2 + 4] = { | |
50 576, 548, 582, 618, 546, 616, 560, 642, | |
51 584, 582, 704, 664, 512, 544, 656, 640, | |
52 512, 648, 582, 566, 532, 614, 596, 648, | |
53 586, 552, 584, 590, 544, 578, 584, 624, | |
54 | |
55 528, 528, 526, 528, 536, 528, 526, 544, | |
56 544, 512, 512, 528, 528, 544, 512, 544, | |
57 | |
58 128, 128, 128, 128, 128, 128}; | |
59 | |
60 static VLC_TYPE table[28150][2]; | |
47 | 61 |
48 #define init_ac_vlc(dst,src) \ | 62 #define init_ac_vlc(dst,src) \ |
63 dst.table = &table[offset]; \ | |
64 dst.table_allocated = sizes[sizeidx]; \ | |
65 offset += sizes[sizeidx++]; \ | |
49 init_vlc(&dst, \ | 66 init_vlc(&dst, \ |
50 AC_VLC_BITS,77, \ | 67 AC_VLC_BITS,77, \ |
51 &src[1],4,2, \ | 68 &src[1],4,2, \ |
52 &src[0],4,2, \ | 69 &src[0],4,2, \ |
53 INIT_VLC_USE_STATIC) | 70 INIT_VLC_USE_NEW_STATIC) |
54 //set ac tables | 71 //set ac tables |
55 for(i=0;i<8;i++){ | 72 for(i=0;i<8;i++){ |
56 init_ac_vlc( j_ac_vlc[0][0][i], x8_ac0_highquant_table[i][0] ); | 73 init_ac_vlc( j_ac_vlc[0][0][i], x8_ac0_highquant_table[i][0] ); |
57 init_ac_vlc( j_ac_vlc[0][1][i], x8_ac1_highquant_table[i][0] ); | 74 init_ac_vlc( j_ac_vlc[0][1][i], x8_ac1_highquant_table[i][0] ); |
58 init_ac_vlc( j_ac_vlc[1][0][i], x8_ac0_lowquant_table [i][0] ); | 75 init_ac_vlc( j_ac_vlc[1][0][i], x8_ac0_lowquant_table [i][0] ); |
60 } | 77 } |
61 #undef init_ac_vlc | 78 #undef init_ac_vlc |
62 | 79 |
63 //set dc tables | 80 //set dc tables |
64 #define init_dc_vlc(dst,src) \ | 81 #define init_dc_vlc(dst,src) \ |
82 dst.table = &table[offset]; \ | |
83 dst.table_allocated = sizes[sizeidx]; \ | |
84 offset += sizes[sizeidx++]; \ | |
65 init_vlc(&dst, \ | 85 init_vlc(&dst, \ |
66 DC_VLC_BITS,34, \ | 86 DC_VLC_BITS,34, \ |
67 &src[1],4,2, \ | 87 &src[1],4,2, \ |
68 &src[0],4,2, \ | 88 &src[0],4,2, \ |
69 INIT_VLC_USE_STATIC); | 89 INIT_VLC_USE_NEW_STATIC); |
70 for(i=0;i<8;i++){ | 90 for(i=0;i<8;i++){ |
71 init_dc_vlc( j_dc_vlc[0][i], x8_dc_highquant_table[i][0]); | 91 init_dc_vlc( j_dc_vlc[0][i], x8_dc_highquant_table[i][0]); |
72 init_dc_vlc( j_dc_vlc[1][i], x8_dc_lowquant_table [i][0]); | 92 init_dc_vlc( j_dc_vlc[1][i], x8_dc_lowquant_table [i][0]); |
73 } | 93 } |
74 #undef init_dc_vlc | 94 #undef init_dc_vlc |
75 | 95 |
76 //set orient tables | 96 //set orient tables |
77 #define init_or_vlc(dst,src) \ | 97 #define init_or_vlc(dst,src) \ |
98 dst.table = &table[offset]; \ | |
99 dst.table_allocated = sizes[sizeidx]; \ | |
100 offset += sizes[sizeidx++]; \ | |
78 init_vlc(&dst, \ | 101 init_vlc(&dst, \ |
79 OR_VLC_BITS,12, \ | 102 OR_VLC_BITS,12, \ |
80 &src[1],4,2, \ | 103 &src[1],4,2, \ |
81 &src[0],4,2, \ | 104 &src[0],4,2, \ |
82 INIT_VLC_USE_STATIC); | 105 INIT_VLC_USE_NEW_STATIC); |
83 for(i=0;i<2;i++){ | 106 for(i=0;i<2;i++){ |
84 init_or_vlc( j_orient_vlc[0][i], x8_orient_highquant_table[i][0]); | 107 init_or_vlc( j_orient_vlc[0][i], x8_orient_highquant_table[i][0]); |
85 } | 108 } |
86 for(i=0;i<4;i++){ | 109 for(i=0;i<4;i++){ |
87 init_or_vlc( j_orient_vlc[1][i], x8_orient_lowquant_table [i][0]) | 110 init_or_vlc( j_orient_vlc[1][i], x8_orient_lowquant_table [i][0]) |
88 } | 111 } |
112 if (offset != sizeof(table)/sizeof(VLC_TYPE)/2) | |
113 av_log(NULL, AV_LOG_ERROR, "table size %i does not match needed %i\n", (int)(sizeof(table)/sizeof(VLC_TYPE)/2), offset); | |
89 } | 114 } |
90 #undef init_or_vlc | 115 #undef init_or_vlc |
91 | 116 |
92 static void x8_reset_vlc_tables(IntraX8Context * w){ | 117 static void x8_reset_vlc_tables(IntraX8Context * w){ |
93 memset(w->j_dc_vlc,0,sizeof(w->j_dc_vlc)); | 118 memset(w->j_dc_vlc,0,sizeof(w->j_dc_vlc)); |