Index: source/libvpx/vp8/encoder/tokenize.c |
=================================================================== |
--- source/libvpx/vp8/encoder/tokenize.c (revision 177019) |
+++ source/libvpx/vp8/encoder/tokenize.c (working copy) |
@@ -23,7 +23,7 @@ |
#ifdef ENTROPY_STATS |
_int64 context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; |
#endif |
-void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t) ; |
+void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t) ; |
void vp8_fix_contexts(MACROBLOCKD *x); |
#include "dct_value_tokens.h" |
@@ -102,11 +102,12 @@ |
static void tokenize2nd_order_b |
( |
- MACROBLOCKD *x, |
+ MACROBLOCK *x, |
TOKENEXTRA **tp, |
VP8_COMP *cpi |
) |
{ |
+ MACROBLOCKD *xd = &x->e_mbd; |
int pt; /* near block/prev token context index */ |
int c; /* start at DC */ |
TOKENEXTRA *t = *tp;/* store tokens starting here */ |
@@ -117,11 +118,11 @@ |
int band, rc, v, token; |
int eob; |
- b = x->block + 24; |
+ b = xd->block + 24; |
qcoeff_ptr = b->qcoeff; |
- a = (ENTROPY_CONTEXT *)x->above_context + 8; |
- l = (ENTROPY_CONTEXT *)x->left_context + 8; |
- eob = x->eobs[24]; |
+ a = (ENTROPY_CONTEXT *)xd->above_context + 8; |
+ l = (ENTROPY_CONTEXT *)xd->left_context + 8; |
+ eob = xd->eobs[24]; |
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l); |
if(!eob) |
@@ -131,7 +132,7 @@ |
t->context_tree = cpi->common.fc.coef_probs [1] [0] [pt]; |
t->skip_eob_node = 0; |
- ++cpi->coef_counts [1] [0] [pt] [DCT_EOB_TOKEN]; |
+ ++x->coef_counts [1] [0] [pt] [DCT_EOB_TOKEN]; |
t++; |
*tp = t; |
*a = *l = 0; |
@@ -145,7 +146,7 @@ |
t->context_tree = cpi->common.fc.coef_probs [1] [0] [pt]; |
t->skip_eob_node = 0; |
- ++cpi->coef_counts [1] [0] [pt] [token]; |
+ ++x->coef_counts [1] [0] [pt] [token]; |
pt = vp8_prev_token_class[token]; |
t++; |
c = 1; |
@@ -164,7 +165,7 @@ |
t->skip_eob_node = ((pt == 0)); |
- ++cpi->coef_counts [1] [band] [pt] [token]; |
+ ++x->coef_counts [1] [band] [pt] [token]; |
pt = vp8_prev_token_class[token]; |
t++; |
@@ -177,7 +178,7 @@ |
t->skip_eob_node = 0; |
- ++cpi->coef_counts [1] [band] [pt] [DCT_EOB_TOKEN]; |
+ ++x->coef_counts [1] [band] [pt] [DCT_EOB_TOKEN]; |
t++; |
} |
@@ -189,12 +190,13 @@ |
static void tokenize1st_order_b |
( |
- MACROBLOCKD *x, |
+ MACROBLOCK *x, |
TOKENEXTRA **tp, |
int type, /* which plane: 0=Y no DC, 1=Y2, 2=UV, 3=Y with DC */ |
VP8_COMP *cpi |
) |
{ |
+ MACROBLOCKD *xd = &x->e_mbd; |
unsigned int block; |
const BLOCKD *b; |
int pt; /* near block/prev token context index */ |
@@ -207,15 +209,15 @@ |
int band, rc, v; |
int tmp1, tmp2; |
- b = x->block; |
+ b = xd->block; |
/* Luma */ |
for (block = 0; block < 16; block++, b++) |
{ |
tmp1 = vp8_block2above[block]; |
tmp2 = vp8_block2left[block]; |
qcoeff_ptr = b->qcoeff; |
- a = (ENTROPY_CONTEXT *)x->above_context + tmp1; |
- l = (ENTROPY_CONTEXT *)x->left_context + tmp2; |
+ a = (ENTROPY_CONTEXT *)xd->above_context + tmp1; |
+ l = (ENTROPY_CONTEXT *)xd->left_context + tmp2; |
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l); |
@@ -228,7 +230,7 @@ |
t->context_tree = cpi->common.fc.coef_probs [type] [c] [pt]; |
t->skip_eob_node = 0; |
- ++cpi->coef_counts [type] [c] [pt] [DCT_EOB_TOKEN]; |
+ ++x->coef_counts [type] [c] [pt] [DCT_EOB_TOKEN]; |
t++; |
*tp = t; |
*a = *l = 0; |
@@ -243,7 +245,7 @@ |
t->context_tree = cpi->common.fc.coef_probs [type] [c] [pt]; |
t->skip_eob_node = 0; |
- ++cpi->coef_counts [type] [c] [pt] [token]; |
+ ++x->coef_counts [type] [c] [pt] [token]; |
pt = vp8_prev_token_class[token]; |
t++; |
c++; |
@@ -261,7 +263,7 @@ |
t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt]; |
t->skip_eob_node = (pt == 0); |
- ++cpi->coef_counts [type] [band] [pt] [token]; |
+ ++x->coef_counts [type] [band] [pt] [token]; |
pt = vp8_prev_token_class[token]; |
t++; |
@@ -273,7 +275,7 @@ |
t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt]; |
t->skip_eob_node = 0; |
- ++cpi->coef_counts [type] [band] [pt] [DCT_EOB_TOKEN]; |
+ ++x->coef_counts [type] [band] [pt] [DCT_EOB_TOKEN]; |
t++; |
} |
@@ -287,8 +289,8 @@ |
tmp1 = vp8_block2above[block]; |
tmp2 = vp8_block2left[block]; |
qcoeff_ptr = b->qcoeff; |
- a = (ENTROPY_CONTEXT *)x->above_context + tmp1; |
- l = (ENTROPY_CONTEXT *)x->left_context + tmp2; |
+ a = (ENTROPY_CONTEXT *)xd->above_context + tmp1; |
+ l = (ENTROPY_CONTEXT *)xd->left_context + tmp2; |
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l); |
@@ -299,7 +301,7 @@ |
t->context_tree = cpi->common.fc.coef_probs [2] [0] [pt]; |
t->skip_eob_node = 0; |
- ++cpi->coef_counts [2] [0] [pt] [DCT_EOB_TOKEN]; |
+ ++x->coef_counts [2] [0] [pt] [DCT_EOB_TOKEN]; |
t++; |
*tp = t; |
*a = *l = 0; |
@@ -314,7 +316,7 @@ |
t->context_tree = cpi->common.fc.coef_probs [2] [0] [pt]; |
t->skip_eob_node = 0; |
- ++cpi->coef_counts [2] [0] [pt] [token]; |
+ ++x->coef_counts [2] [0] [pt] [token]; |
pt = vp8_prev_token_class[token]; |
t++; |
c = 1; |
@@ -333,7 +335,7 @@ |
t->skip_eob_node = (pt == 0); |
- ++cpi->coef_counts [2] [band] [pt] [token]; |
+ ++x->coef_counts [2] [band] [pt] [token]; |
pt = vp8_prev_token_class[token]; |
t++; |
@@ -346,7 +348,7 @@ |
t->skip_eob_node = 0; |
- ++cpi->coef_counts [2] [band] [pt] [DCT_EOB_TOKEN]; |
+ ++x->coef_counts [2] [band] [pt] [DCT_EOB_TOKEN]; |
t++; |
} |
@@ -374,16 +376,18 @@ |
} |
-void vp8_tokenize_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t) |
+void vp8_tokenize_mb(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t) |
{ |
+ MACROBLOCKD *xd = &x->e_mbd; |
int plane_type; |
int has_y2_block; |
- has_y2_block = (x->mode_info_context->mbmi.mode != B_PRED |
- && x->mode_info_context->mbmi.mode != SPLITMV); |
+ has_y2_block = (xd->mode_info_context->mbmi.mode != B_PRED |
+ && xd->mode_info_context->mbmi.mode != SPLITMV); |
- x->mode_info_context->mbmi.mb_skip_coeff = mb_is_skippable(x, has_y2_block); |
- if (x->mode_info_context->mbmi.mb_skip_coeff) |
+ xd->mode_info_context->mbmi.mb_skip_coeff = |
+ mb_is_skippable(xd, has_y2_block); |
+ if (xd->mode_info_context->mbmi.mb_skip_coeff) |
{ |
if (!cpi->common.mb_no_coeff_skip) |
{ |
@@ -391,8 +395,8 @@ |
} |
else |
{ |
- vp8_fix_contexts(x); |
- cpi->skip_true_count++; |
+ vp8_fix_contexts(xd); |
+ x->skip_true_count++; |
} |
return; |
@@ -488,7 +492,8 @@ |
TOKENEXTRA **tp, |
ENTROPY_CONTEXT *a, |
ENTROPY_CONTEXT *l, |
- VP8_COMP *cpi |
+ VP8_COMP *cpi, |
+ MACROBLOCK *x |
) |
{ |
int pt; /* near block/prev token context index */ |
@@ -498,13 +503,12 @@ |
t->Token = DCT_EOB_TOKEN; |
t->context_tree = cpi->common.fc.coef_probs [1] [0] [pt]; |
t->skip_eob_node = 0; |
- ++cpi->coef_counts [1] [0] [pt] [DCT_EOB_TOKEN]; |
+ ++x->coef_counts [1] [0] [pt] [DCT_EOB_TOKEN]; |
++t; |
*tp = t; |
pt = 0; |
*a = *l = pt; |
- |
} |
static void stuff1st_order_b |
@@ -513,7 +517,8 @@ |
ENTROPY_CONTEXT *a, |
ENTROPY_CONTEXT *l, |
int type, |
- VP8_COMP *cpi |
+ VP8_COMP *cpi, |
+ MACROBLOCK *x |
) |
{ |
int pt; /* near block/prev token context index */ |
@@ -524,20 +529,21 @@ |
t->Token = DCT_EOB_TOKEN; |
t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt]; |
t->skip_eob_node = 0; |
- ++cpi->coef_counts [type] [band] [pt] [DCT_EOB_TOKEN]; |
+ ++x->coef_counts [type] [band] [pt] [DCT_EOB_TOKEN]; |
++t; |
*tp = t; |
pt = 0; /* 0 <-> all coeff data is zero */ |
*a = *l = pt; |
+} |
-} |
static |
void stuff1st_order_buv |
( |
TOKENEXTRA **tp, |
ENTROPY_CONTEXT *a, |
ENTROPY_CONTEXT *l, |
- VP8_COMP *cpi |
+ VP8_COMP *cpi, |
+ MACROBLOCK *x |
) |
{ |
int pt; /* near block/prev token context index */ |
@@ -547,38 +553,38 @@ |
t->Token = DCT_EOB_TOKEN; |
t->context_tree = cpi->common.fc.coef_probs [2] [0] [pt]; |
t->skip_eob_node = 0; |
- ++cpi->coef_counts[2] [0] [pt] [DCT_EOB_TOKEN]; |
+ ++x->coef_counts[2] [0] [pt] [DCT_EOB_TOKEN]; |
++t; |
*tp = t; |
pt = 0; /* 0 <-> all coeff data is zero */ |
*a = *l = pt; |
- |
} |
-void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t) |
+void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t) |
{ |
- ENTROPY_CONTEXT * A = (ENTROPY_CONTEXT *)x->above_context; |
- ENTROPY_CONTEXT * L = (ENTROPY_CONTEXT *)x->left_context; |
+ MACROBLOCKD *xd = &x->e_mbd; |
+ ENTROPY_CONTEXT * A = (ENTROPY_CONTEXT *)xd->above_context; |
+ ENTROPY_CONTEXT * L = (ENTROPY_CONTEXT *)xd->left_context; |
int plane_type; |
int b; |
plane_type = 3; |
- if((x->mode_info_context->mbmi.mode != B_PRED |
- && x->mode_info_context->mbmi.mode != SPLITMV)) |
+ if((xd->mode_info_context->mbmi.mode != B_PRED |
+ && xd->mode_info_context->mbmi.mode != SPLITMV)) |
{ |
stuff2nd_order_b(t, |
- A + vp8_block2above[24], L + vp8_block2left[24], cpi); |
+ A + vp8_block2above[24], L + vp8_block2left[24], cpi, x); |
plane_type = 0; |
} |
for (b = 0; b < 16; b++) |
stuff1st_order_b(t, |
A + vp8_block2above[b], |
- L + vp8_block2left[b], plane_type, cpi); |
+ L + vp8_block2left[b], plane_type, cpi, x); |
for (b = 16; b < 24; b++) |
stuff1st_order_buv(t, |
A + vp8_block2above[b], |
- L + vp8_block2left[b], cpi); |
+ L + vp8_block2left[b], cpi, x); |
} |
void vp8_fix_contexts(MACROBLOCKD *x) |