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