2 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
12 #include "type_aliases.h"
14 #include "onyxd_int.h"
15 #include "vpx_mem/vpx_mem.h"
16 #include "vpx_ports/mem.h"
19 #define BOOL_DATA UINT8
21 #define OCB_X PREV_COEF_CONTEXTS * ENTROPY_NODES
22 //ALIGN16 UINT16 onyx_coef_bands_x[16] = { 0, 1*OCB_X, 2*OCB_X, 3*OCB_X, 6*OCB_X, 4*OCB_X, 5*OCB_X, 6*OCB_X, 6*OCB_X, 6*OCB_X, 6*OCB_X, 6*OCB_X, 6*OCB_X, 6*OCB_X, 6*OCB_X, 7*OCB_X};
23 DECLARE_ALIGNED(16, UINT8
, vp8_coef_bands_x
[16]) = { 0, 1 * OCB_X
, 2 * OCB_X
, 3 * OCB_X
, 6 * OCB_X
, 4 * OCB_X
, 5 * OCB_X
, 6 * OCB_X
, 6 * OCB_X
, 6 * OCB_X
, 6 * OCB_X
, 6 * OCB_X
, 6 * OCB_X
, 6 * OCB_X
, 6 * OCB_X
, 7 * OCB_X
};
25 #define EOB_CONTEXT_NODE 0
26 #define ZERO_CONTEXT_NODE 1
27 #define ONE_CONTEXT_NODE 2
28 #define LOW_VAL_CONTEXT_NODE 3
29 #define TWO_CONTEXT_NODE 4
30 #define THREE_CONTEXT_NODE 5
31 #define HIGH_LOW_CONTEXT_NODE 6
32 #define CAT_ONE_CONTEXT_NODE 7
33 #define CAT_THREEFOUR_CONTEXT_NODE 8
34 #define CAT_THREE_CONTEXT_NODE 9
35 #define CAT_FIVE_CONTEXT_NODE 10
40 DECLARE_ALIGNED(16, static const TOKENEXTRABITS
, vp8d_token_extra_bits2
[MAX_ENTROPY_TOKENS
]) =
42 { 0, -1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //ZERO_TOKEN
43 { 1, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //ONE_TOKEN
44 { 2, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //TWO_TOKEN
45 { 3, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //THREE_TOKEN
46 { 4, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //FOUR_TOKEN
47 { 5, 0, { 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //DCT_VAL_CATEGORY1
48 { 7, 1, { 145, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //DCT_VAL_CATEGORY2
49 { 11, 2, { 140, 148, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //DCT_VAL_CATEGORY3
50 { 19, 3, { 135, 140, 155, 176, 0, 0, 0, 0, 0, 0, 0, 0 } }, //DCT_VAL_CATEGORY4
51 { 35, 4, { 130, 134, 141, 157, 180, 0, 0, 0, 0, 0, 0, 0 } }, //DCT_VAL_CATEGORY5
52 { 67, 10, { 129, 130, 133, 140, 153, 177, 196, 230, 243, 254, 254, 0 } }, //DCT_VAL_CATEGORY6
53 { 0, -1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, // EOB TOKEN
57 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60 DECLARE_ALIGNED(16, const UINT8
, vp8_block2context_leftabove
[25*3]) =
62 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, //end of vp8_block2context
63 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 0, 0, 1, 1, 0, 0, 1, 1, 0, //end of vp8_block2left
64 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 0, 1, 0, 1, 0, 1, 0 //end of vp8_block2above
68 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 void vp8_reset_mb_tokens_context(MACROBLOCKD
*x
)
74 ENTROPY_CONTEXT
**const A
= x
->above_context
;
75 ENTROPY_CONTEXT(* const L
)[4] = x
->left_context
;
81 for (i
= 0; i
< 24; i
++)
84 a
= A
[ vp8_block2context
[i
] ] + vp8_block2above
[i
];
85 l
= L
[ vp8_block2context
[i
] ] + vp8_block2left
[i
];
90 if (x
->mbmi
.mode
!= B_PRED
&& x
->mbmi
.mode
!= SPLITMV
)
92 a
= A
[Y2CONTEXT
] + vp8_block2above
[24];
93 l
= L
[Y2CONTEXT
] + vp8_block2left
[24];
100 #define ONYXBLOCK2CONTEXT_OFFSET 0
101 #define ONYXBLOCK2LEFT_OFFSET 25
102 #define ONYXBLOCK2ABOVE_OFFSET 50
104 DECLARE_ALIGNED(16, const static unsigned char, norm
[128]) =
106 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
107 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
108 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
109 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
113 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
114 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116 void init_detokenizer(VP8D_COMP
*dx
)
118 const VP8_COMMON
*const oc
= & dx
->common
;
119 MACROBLOCKD
*x
= & dx
->mb
;
121 dx
->detoken
.norm_ptr
= (unsigned char *)norm
;
122 dx
->detoken
.vp8_coef_tree_ptr
= (vp8_tree_index
*)vp8_coef_tree
;
123 dx
->detoken
.ptr_onyxblock2context_leftabove
= (UINT8
*)vp8_block2context_leftabove
;
124 dx
->detoken
.ptr_onyx_coef_bands_x
= vp8_coef_bands_x
;
125 dx
->detoken
.scan
= (int *)vp8_default_zig_zag1d
;
126 dx
->detoken
.teb_base_ptr
= (TOKENEXTRABITS
*)vp8d_token_extra_bits2
;
128 dx
->detoken
.qcoeff_start_ptr
= &x
->qcoeff
[0];
131 dx
->detoken
.coef_probs
[0] = (unsigned char *)(oc
->fc
.coef_probs
[0] [ 0 ] [0]);
132 dx
->detoken
.coef_probs
[1] = (unsigned char *)(oc
->fc
.coef_probs
[1] [ 0 ] [0]);
133 dx
->detoken
.coef_probs
[2] = (unsigned char *)(oc
->fc
.coef_probs
[2] [ 0 ] [0]);
134 dx
->detoken
.coef_probs
[3] = (unsigned char *)(oc
->fc
.coef_probs
[3] [ 0 ] [0]);
139 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144 //shift = norm[range]; \
145 // shift = norm_ptr[range]; \
148 /*if(range < 0x80)*/ \
150 shift = detoken->norm_ptr[range]; \
156 count += BR_COUNT ; \
157 value |= (*bufptr) << (BR_COUNT-count); \
162 #define DECODE_AND_APPLYSIGN(value_to_sign) \
163 split = (range + 1) >> 1; \
164 if ( (value >> 24) < split ) \
171 range = range-split; \
172 value = value-(split<<24); \
173 v = -value_to_sign; \
184 #define DECODE_AND_BRANCH_IF_ZERO(probability,branch) \
186 split = 1 + ((( probability*(range-1) ) )>> 8); \
187 if ( (value >> 24) < split ) \
193 value -= (split<<24); \
194 range = range - split; \
198 #define DECODE_AND_LOOP_IF_ZERO(probability,branch) \
200 split = 1 + ((( probability*(range-1) ) ) >> 8); \
201 if ( (value >> 24) < split ) \
207 Prob += vp8_coef_bands_x[c]; \
210 value -= (split<<24); \
211 range = range - split; \
215 #define DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT(val) \
216 DECODE_AND_APPLYSIGN(val) \
217 Prob = coef_probs + (ENTROPY_NODES*2); \
219 qcoeff_ptr [ scan[c] ] = (INT16) v; \
222 qcoeff_ptr [ scan[15] ] = (INT16) v; \
226 #define DECODE_EXTRABIT_AND_ADJUST_VAL(t,bits_count)\
227 split = 1 + (((range-1) * vp8d_token_extra_bits2[t].Probs[bits_count]) >> 8); \
228 if(value >= (split<<24))\
230 range = range-split;\
231 value = value-(split<<24);\
232 val += ((UINT16)1<<bits_count);\
242 int vp8_decode_mb_tokens(VP8D_COMP
*dx
, MACROBLOCKD
*x
)
244 ENTROPY_CONTEXT
**const A
= x
->above_context
;
245 ENTROPY_CONTEXT(* const L
)[4] = x
->left_context
;
246 const VP8_COMMON
*const oc
= & dx
->common
;
248 BOOL_DECODER
*bc
= x
->current_bc
;
259 register unsigned int range
;
260 register unsigned int value
;
262 register unsigned int shift
;
269 INT16 val
, bits_count
;
280 if (x
->mbmi
.mode
!= B_PRED
&& x
->mbmi
.mode
!= SPLITMV
)
285 qcoeff_ptr
= &x
->qcoeff
[24*16];
286 scan
= vp8_default_zig_zag1d
;
291 scan
= vp8_default_zig_zag1d
;
292 qcoeff_ptr
= &x
->qcoeff
[0];
298 bufptr
= &bc
->buffer
[bc
->pos
];
301 coef_probs
= (unsigned char *)(oc
->fc
.coef_probs
[type
] [ 0 ] [0]);
304 a
= A
[ vp8_block2context
[i
] ] + vp8_block2above
[i
];
305 l
= L
[ vp8_block2context
[i
] ] + vp8_block2left
[i
];
308 VP8_COMBINEENTROPYCONTEXTS(t
, *a
, *l
);
310 Prob
+= t
* ENTROPY_NODES
;
313 Prob
+= vp8_coef_bands_x
[c
];
314 DECODE_AND_BRANCH_IF_ZERO(Prob
[EOB_CONTEXT_NODE
], BLOCK_FINISHED
);
317 DECODE_AND_LOOP_IF_ZERO(Prob
[ZERO_CONTEXT_NODE
], CHECK_0_
);
318 DECODE_AND_BRANCH_IF_ZERO(Prob
[ONE_CONTEXT_NODE
], ONE_CONTEXT_NODE_0_
);
319 DECODE_AND_BRANCH_IF_ZERO(Prob
[LOW_VAL_CONTEXT_NODE
], LOW_VAL_CONTEXT_NODE_0_
);
320 DECODE_AND_BRANCH_IF_ZERO(Prob
[HIGH_LOW_CONTEXT_NODE
], HIGH_LOW_CONTEXT_NODE_0_
);
321 DECODE_AND_BRANCH_IF_ZERO(Prob
[CAT_THREEFOUR_CONTEXT_NODE
], CAT_THREEFOUR_CONTEXT_NODE_0_
);
322 DECODE_AND_BRANCH_IF_ZERO(Prob
[CAT_FIVE_CONTEXT_NODE
], CAT_FIVE_CONTEXT_NODE_0_
);
323 val
= vp8d_token_extra_bits2
[DCT_VAL_CATEGORY6
].min_val
;
324 bits_count
= vp8d_token_extra_bits2
[DCT_VAL_CATEGORY6
].Length
;
328 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY6
, bits_count
);
331 while (bits_count
>= 0);
333 DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT(val
);
335 CAT_FIVE_CONTEXT_NODE_0_
:
336 val
= vp8d_token_extra_bits2
[DCT_VAL_CATEGORY5
].min_val
;
337 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY5
, 4);
338 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY5
, 3);
339 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY5
, 2);
340 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY5
, 1);
341 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY5
, 0);
342 DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT(val
);
344 CAT_THREEFOUR_CONTEXT_NODE_0_
:
345 DECODE_AND_BRANCH_IF_ZERO(Prob
[CAT_THREE_CONTEXT_NODE
], CAT_THREE_CONTEXT_NODE_0_
);
346 val
= vp8d_token_extra_bits2
[DCT_VAL_CATEGORY4
].min_val
;
347 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY4
, 3);
348 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY4
, 2);
349 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY4
, 1);
350 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY4
, 0);
351 DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT(val
);
353 CAT_THREE_CONTEXT_NODE_0_
:
354 val
= vp8d_token_extra_bits2
[DCT_VAL_CATEGORY3
].min_val
;
355 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY3
, 2);
356 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY3
, 1);
357 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY3
, 0);
358 DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT(val
);
360 HIGH_LOW_CONTEXT_NODE_0_
:
361 DECODE_AND_BRANCH_IF_ZERO(Prob
[CAT_ONE_CONTEXT_NODE
], CAT_ONE_CONTEXT_NODE_0_
);
363 val
= vp8d_token_extra_bits2
[DCT_VAL_CATEGORY2
].min_val
;
364 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY2
, 1);
365 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY2
, 0);
366 DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT(val
);
368 CAT_ONE_CONTEXT_NODE_0_
:
369 val
= vp8d_token_extra_bits2
[DCT_VAL_CATEGORY1
].min_val
;
370 DECODE_EXTRABIT_AND_ADJUST_VAL(DCT_VAL_CATEGORY1
, 0);
371 DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT(val
);
373 LOW_VAL_CONTEXT_NODE_0_
:
374 DECODE_AND_BRANCH_IF_ZERO(Prob
[TWO_CONTEXT_NODE
], TWO_CONTEXT_NODE_0_
);
375 DECODE_AND_BRANCH_IF_ZERO(Prob
[THREE_CONTEXT_NODE
], THREE_CONTEXT_NODE_0_
);
376 DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT(4);
378 THREE_CONTEXT_NODE_0_
:
379 DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT(3);
382 DECODE_SIGN_WRITE_COEFF_AND_CHECK_EXIT(2);
385 DECODE_AND_APPLYSIGN(1);
386 Prob
= coef_probs
+ ENTROPY_NODES
;
390 qcoeff_ptr
[ scan
[c
] ] = (INT16
) v
;
395 qcoeff_ptr
[ scan
[15] ] = (INT16
) v
;
397 t
= ((x
->Block
[i
].eob
= c
) != !type
); // any nonzero data?
398 eobtotal
+= x
->Block
[i
].eob
;
409 scan
= vp8_default_zig_zag1d
;//x->scan_order1d;
413 coef_probs
= (unsigned char *)(oc
->fc
.coef_probs
[type
] [ 0 ] [0]);
414 qcoeff_ptr
= &x
->qcoeff
[0];
421 coef_probs
= (unsigned char *)(oc
->fc
.coef_probs
[type
] [ 0 ] [0]);
429 bc
->pos
= bufptr
- bc
->buffer
;
436 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
437 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
438 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
439 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
443 //uses relative offsets
445 const vp8_tree_index vp8_coef_tree_x
[ 22] = /* corresponding _CONTEXT_NODEs */
447 -DCT_EOB_TOKEN
, 1, /* 0 = EOB */
448 -ZERO_TOKEN
, 1, /* 1 = ZERO */
449 -ONE_TOKEN
, 1, /* 2 = ONE */
450 2, 5, /* 3 = LOW_VAL */
451 -TWO_TOKEN
, 1, /* 4 = TWO */
452 -THREE_TOKEN
, -FOUR_TOKEN
, /* 5 = THREE */
453 2, 3, /* 6 = HIGH_LOW */
454 -DCT_VAL_CATEGORY1
, -DCT_VAL_CATEGORY2
, /* 7 = CAT_ONE */
455 2, 3, /* 8 = CAT_THREEFOUR */
456 -DCT_VAL_CATEGORY3
, -DCT_VAL_CATEGORY4
, /* 9 = CAT_THREE */
457 -DCT_VAL_CATEGORY5
, -DCT_VAL_CATEGORY6
/* 10 = CAT_FIVE */
461 #define _SCALEDOWN 8 //16 //8
463 int vp8_decode_mb_tokens_v5(DETOK
*detoken
, int type
);
465 int vp8_decode_mb_tokens_v5_c(DETOK
*detoken
, int type
)
467 BOOL_DECODER
*bc
= detoken
->current_bc
;
476 register unsigned int range
;
477 register unsigned int value
;
478 register unsigned int shift
;
495 qcoeff_ptr
= detoken
->qcoeff_start_ptr
;
497 // if( detoken->mode != B_PRED && detoken->mode != SPLITMV)
503 qcoeff_ptr
+= 24 * 16;
510 bufptr
= &bc
->buffer
[bc
->pos
];
513 coef_probs
= detoken
->coef_probs
[type
]; //(unsigned char *)( oc->fc.coef_probs [type] [ 0 ] [0]);
516 a
= detoken
->A
[ detoken
->ptr_onyxblock2context_leftabove
[i
] ];
517 l
= detoken
->L
[ detoken
->ptr_onyxblock2context_leftabove
[i
] ];
519 a
+= detoken
->ptr_onyxblock2context_leftabove
[i
+ ONYXBLOCK2ABOVE_OFFSET
];
520 l
+= detoken
->ptr_onyxblock2context_leftabove
[i
+ ONYXBLOCK2LEFT_OFFSET
];
522 //#define ONYX_COMBINEENTROPYCONTEXTS( Dest, A, B) \
523 //Dest = ((A)!=0) + ((B)!=0);
525 VP8_COMBINEENTROPYCONTEXTS(t
, *a
, *l
);
528 Prob
+= t
* ENTROPY_NODES
;
535 // onyx_tree_index * onyx_coef_tree_ptr = onyx_coef_tree_x;
537 Prob
+= detoken
->ptr_onyx_coef_bands_x
[c
];
543 split
= 1 + (((range
- 1) * (Prob
[t
>>1])) >> 8);
545 if (value
>> 24 >= split
)
547 range
= range
- split
;
548 value
= value
- (split
<< 24);
551 //used to eliminate else branch
557 t
= detoken
->vp8_coef_tree_ptr
[ t
];
566 if (t
== -DCT_EOB_TOKEN
)
576 TOKENEXTRABITS
*teb_ptr
;
578 // teb_ptr = &onyxd_token_extra_bits2[t];
579 // teb_ptr = &onyxd_token_extra_bits2[v];
580 teb_ptr
= &detoken
->teb_base_ptr
[v
];
583 v
= teb_ptr
->min_val
;
584 bits_count
= teb_ptr
->Length
;
588 split
= 1 + (((range
- 1) * teb_ptr
->Probs
[bits_count
]) >> _SCALEDOWN
);
590 if ((value
>> 24) >= split
)
592 range
= range
- split
;
593 value
= value
- (split
<< 24);
594 v
+= ((UINT16
)1 << bits_count
);
596 //used to eliminate else branch
606 while (bits_count
>= 0);
613 split
= 1 + (((range
- 1) * vp8_prob_half
) >> 8);
615 if ((value
>> 24) >= split
)
617 range
= range
- split
;
618 value
= value
- (split
<< 24);
619 v
= (v
^ -1) + 1; /* negate w/out conditionals */
621 //used to eliminate else branch
628 Prob
+= ENTROPY_NODES
;
631 Prob
+= ENTROPY_NODES
;
636 //if t is zero, we will skip the eob table check
638 qcoeff_ptr
[detoken
->scan
[c
] ] = (INT16
) v
;
643 if (t
!= -DCT_EOB_TOKEN
)
648 t
= ((detoken
->eob
[i
] = c
) != !type
); // any nonzero data?
649 // eobtotal += detoken->eob[i];
663 // coef_probs = (unsigned char *)(oc->fc.coef_probs [type] [ 0 ] [0]);
664 coef_probs
= detoken
->coef_probs
[type
]; //(unsigned char *)( oc->fc.coef_probs [type] [ 0 ] [0]);
665 qcoeff_ptr
= detoken
->qcoeff_start_ptr
;
672 // coef_probs =(unsigned char *)( oc->fc.coef_probs [type] [ 0 ] [0]);
673 coef_probs
= detoken
->coef_probs
[type
]; //(unsigned char *)( oc->fc.coef_probs [type] [ 0 ] [0]);
681 bc
->pos
= bufptr
- bc
->buffer
;
685 int vp8_decode_mb_tokens(VP8D_COMP
*dx
, MACROBLOCKD
*x
)
687 // const ONYX_COMMON * const oc = & dx->common;
691 dx->detoken.norm_ptr = norm;
692 dx->detoken.onyx_coef_tree_ptr = onyx_coef_tree;
693 dx->detoken.ptr_onyxblock2context_leftabove = ONYXBLOCK2CONTEXT_LEFTABOVE;
694 dx->detoken.ptr_onyx_coef_bands_x = onyx_coef_bands_x;
695 dx->detoken.scan = default_zig_zag1d;
696 dx->detoken.teb_base_ptr = onyxd_token_extra_bits2;
698 dx->detoken.qcoeff_start_ptr = &x->qcoeff[0];
700 dx->detoken.A = x->above_context;
701 dx->detoken.L = x->left_context;
703 dx->detoken.coef_probs[0] = (unsigned char *)( oc->fc.coef_probs [0] [ 0 ] [0]);
704 dx->detoken.coef_probs[1] = (unsigned char *)( oc->fc.coef_probs [1] [ 0 ] [0]);
705 dx->detoken.coef_probs[2] = (unsigned char *)( oc->fc.coef_probs [2] [ 0 ] [0]);
706 dx->detoken.coef_probs[3] = (unsigned char *)( oc->fc.coef_probs [3] [ 0 ] [0]);
709 dx
->detoken
.current_bc
= x
->current_bc
;
710 dx
->detoken
.A
= x
->above_context
;
711 dx
->detoken
.L
= x
->left_context
;
715 if (x
->mbmi
.mode
!= B_PRED
&& x
->mbmi
.mode
!= SPLITMV
)
721 vp8_decode_mb_tokens_v5(&dx
->detoken
, type
);
723 for (i
= 0; i
< 25; i
++)
725 x
->Block
[i
].eob
= dx
->detoken
.eob
[i
];
726 eobtotal
+= dx
->detoken
.eob
[i
];