33 #define MAX_TABLE_DEPTH(table_bits, max_bits) ((max_bits+table_bits-1)/table_bits)
39 #define DC_VLC_MTD MAX_TABLE_DEPTH(DC_VLC_BITS, MAX_DC_VLC_BITS)
40 #define AC_VLC_MTD MAX_TABLE_DEPTH(AC_VLC_BITS, MAX_AC_VLC_BITS)
41 #define OR_VLC_MTD MAX_TABLE_DEPTH(OR_VLC_BITS, MAX_OR_VLC_BITS)
51 static const uint16_t
sizes[8*4 + 8*2 + 2 + 4] = {
52 576, 548, 582, 618, 546, 616, 560, 642,
53 584, 582, 704, 664, 512, 544, 656, 640,
54 512, 648, 582, 566, 532, 614, 596, 648,
55 586, 552, 584, 590, 544, 578, 584, 624,
57 528, 528, 526, 528, 536, 528, 526, 544,
58 544, 512, 512, 528, 528, 544, 512, 544,
60 128, 128, 128, 128, 128, 128};
64 #define init_ac_vlc(dst,src) \
65 dst.table = &table[offset]; \
66 dst.table_allocated = sizes[sizeidx]; \
67 offset += sizes[sizeidx++]; \
72 INIT_VLC_USE_NEW_STATIC)
83 #define init_dc_vlc(dst,src) \
84 dst.table = &table[offset]; \
85 dst.table_allocated = sizes[sizeidx]; \
86 offset += sizes[sizeidx++]; \
91 INIT_VLC_USE_NEW_STATIC);
99 #define init_or_vlc(dst,src) \
100 dst.table = &table[offset]; \
101 dst.table_allocated = sizes[sizeidx]; \
102 offset += sizes[sizeidx++]; \
107 INIT_VLC_USE_NEW_STATIC);
114 if (offset !=
sizeof(table)/
sizeof(
VLC_TYPE)/2)
150 #define extra_bits(eb) (eb)
151 #define extra_run (0xFF<<8)
152 #define extra_level (0x00<<8)
153 #define run_offset(r) ((r)<<16)
154 #define level_offset(l) ((l)<<24)
199 int *
const run,
int *
const level,
int *
const final){
214 (*final) = t = (i>22);
223 l=(0xE50000>>(i&(0x1E)))&3;
224 t=(0x01030F>>(l<<3));
238 (*run) =(sm&0xff) + (e&( mask));
239 (*level)=(sm>>8) + (e&(~mask));
242 static const uint8_t crazy_mix_runlevel[32]={
243 0x22,0x32,0x33,0x53,0x23,0x42,0x43,0x63,
244 0x24,0x52,0x34,0x73,0x25,0x62,0x44,0x83,
245 0x26,0x72,0x35,0x54,0x27,0x82,0x45,0x64,
246 0x28,0x92,0x36,0x74,0x29,0xa2,0x46,0x84};
250 (*run) =crazy_mix_runlevel[e]>>4;
251 (*level)=crazy_mix_runlevel[e]&0x0F;
261 static const uint8_t dc_index_offset[] ={ 0, 1,2, 3,4, 5,7, 9,13, 17,25, 33,49, 65,97, 129,193};
293 (*level)= (i ^ e) - e;
306 &range, &sum, w->
edges);
315 if(range < quant || range < 3){
327 if(range < 2*w->quant){
328 if( (w->
edges&3) == 0){
336 static const uint8_t prediction_table[3][12]={
337 {0,8,4, 10,11, 2,6,9,1,3,5,7},
338 {4,0,8, 11,10, 3,5,2,6,9,1,7},
339 {8,0,4, 10,11, 1,7,2,6,9,3,5}
416 i=( 0xFFEAF4C4>>(2*b+8*
a) )&3;
418 else w->
orient=( 0xFFEAD8>>(2*c+8*(w->
quant>12)) )&3;
439 #define B(x,y) s->block[0][s->dsp.idct_permutation[(x)+(y)*8]]
440 #define T(x) ((x) * dc_level + 0x8000) >> 16;
515 256, 256, 256, 256, 256, 256, 259, 262,
516 265, 269, 272, 275, 278, 282, 285, 288,
517 292, 295, 299, 303, 306, 310, 314, 317,
518 321, 325, 329, 333, 337, 341, 345, 349,
519 353, 358, 362, 366, 371, 375, 379, 384,
520 389, 393, 398, 403, 408, 413, 417, 422,
521 428, 433, 438, 443, 448, 454, 459, 465,
522 470, 476, 482, 488, 493, 499, 505, 511
530 int ac_mode,dc_mode,est_run,dc_level;
533 int use_quant_matrix;
555 use_quant_matrix = 0;
589 level= (level+1) * w->
dquant;
593 level = (level ^ sign) - sign;
595 if(use_quant_matrix){
604 if(w->
flat_dc && ((
unsigned)(dc_level+1)) < 3){
611 dc_level+= (w->
predicted_dc*divide_quant + (1<<12) )>>13;
618 zeros_only = (dc_level == 0);
627 if( (
unsigned int)(dc_level+1) >= 3 && (w->
edges&3) != 3 ){
631 direction= (0x6A017C>>(w->
orient*2))&3;
659 if(!( (w->
edges&2) || ( zeros_only && (w->
orient|4)==4 ) )){
662 if(!( (w->
edges&1) || ( zeros_only && (w->
orient|8)==8 ) )){
679 s->
dest[0] += s->
mb_y * linesize << 3;
680 s->
dest[1] += ( s->
mb_y&(~1) ) * uvlinesize << 2;
681 s->
dest[2] += ( s->
mb_y&(~1) ) * uvlinesize << 2;
731 w->
quant = dquant >> 1;
732 w->
qsum = quant_offset;