summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp8/common/blockd.h10
-rw-r--r--vp8/decoder/detokenize.c25
-rw-r--r--vp8/encoder/encodemb.c24
-rw-r--r--vp8/encoder/rdopt.c8
-rw-r--r--vp8/encoder/tokenize.c109
5 files changed, 83 insertions, 93 deletions
diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h
index a9f6f49d8..a4c618534 100644
--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -52,10 +52,12 @@ typedef struct {
int r, c;
} POS;
-#define PLANE_TYPE_Y_NO_DC 0
-#define PLANE_TYPE_Y2 1
-#define PLANE_TYPE_UV 2
-#define PLANE_TYPE_Y_WITH_DC 3
+typedef enum PlaneType {
+ PLANE_TYPE_Y_NO_DC = 0,
+ PLANE_TYPE_Y2,
+ PLANE_TYPE_UV,
+ PLANE_TYPE_Y_WITH_DC,
+} PLANE_TYPE;
typedef char ENTROPY_CONTEXT;
typedef struct {
diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c
index 50e9a7dea..5b5ec7e2a 100644
--- a/vp8/decoder/detokenize.c
+++ b/vp8/decoder/detokenize.c
@@ -137,7 +137,7 @@ int get_token(int v) {
#if CONFIG_HYBRIDTRANSFORM
void static count_tokens_adaptive_scan(const MACROBLOCKD *xd, INT16 *qcoeff_ptr,
- int block, int type,
+ int block, PLANE_TYPE type,
TX_TYPE tx_type,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
int eob, int seg_eob,
@@ -182,7 +182,7 @@ void static count_tokens_adaptive_scan(const MACROBLOCKD *xd, INT16 *qcoeff_ptr,
}
#endif
-void static count_tokens(INT16 *qcoeff_ptr, int block, int type,
+void static count_tokens(INT16 *qcoeff_ptr, int block, PLANE_TYPE type,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
int eob, int seg_eob, FRAME_CONTEXT *const fc) {
int c, pt, token, band;
@@ -201,7 +201,7 @@ void static count_tokens(INT16 *qcoeff_ptr, int block, int type,
}
}
-void static count_tokens_8x8(INT16 *qcoeff_ptr, int block, int type,
+void static count_tokens_8x8(INT16 *qcoeff_ptr, int block, PLANE_TYPE type,
#if CONFIG_HYBRIDTRANSFORM8X8
TX_TYPE tx_type,
#endif
@@ -233,7 +233,7 @@ void static count_tokens_8x8(INT16 *qcoeff_ptr, int block, int type,
}
}
-void static count_tokens_16x16(INT16 *qcoeff_ptr, int block, int type,
+void static count_tokens_16x16(INT16 *qcoeff_ptr, int block, PLANE_TYPE type,
#if CONFIG_HYBRIDTRANSFORM16X16
TX_TYPE tx_type,
#endif
@@ -303,7 +303,8 @@ static int vp8_get_signed(BOOL_DECODER *br, int value_to_sign) {
} while (0);
static int vp8_decode_coefs(VP8D_COMP *dx, const MACROBLOCKD *xd,
- ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l, int type,
+ ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
+ PLANE_TYPE type,
#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
TX_TYPE tx_type,
#endif
@@ -312,7 +313,7 @@ static int vp8_decode_coefs(VP8D_COMP *dx, const MACROBLOCKD *xd,
const int *coef_bands) {
FRAME_CONTEXT *const fc = &dx->common.fc;
BOOL_DECODER *br = xd->current_bc;
- int tmp, c = (type == 0);
+ int tmp, c = (type == PLANE_TYPE_Y_NO_DC);
const vp8_prob *prob, *coef_probs;
switch (block_type) {
@@ -450,7 +451,8 @@ int vp8_decode_mb_tokens_16x16(VP8D_COMP *pbi, MACROBLOCKD *xd) {
ENTROPY_CONTEXT* const L = (ENTROPY_CONTEXT *)xd->left_context;
char* const eobs = xd->eobs;
- int c, i, type, eobtotal = 0, seg_eob;
+ PLANE_TYPE type;
+ int c, i, eobtotal = 0, seg_eob;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
const int seg_active = segfeature_active(xd, segment_id, SEG_LVL_EOB);
INT16 *qcoeff_ptr = &xd->qcoeff[0];
@@ -471,7 +473,6 @@ int vp8_decode_mb_tokens_16x16(VP8D_COMP *pbi, MACROBLOCKD *xd) {
// Luma block
{
const int* const scan = vp8_default_zig_zag1d_16x16;
- //printf("16: %d\n", tx_type);
c = vp8_decode_coefs(pbi, xd, A, L, type,
#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
tx_type,
@@ -502,7 +503,6 @@ int vp8_decode_mb_tokens_16x16(VP8D_COMP *pbi, MACROBLOCKD *xd) {
ENTROPY_CONTEXT* const l = L + vp8_block2left_8x8[i];
const int* const scan = vp8_default_zig_zag1d_8x8;
- //printf("8: %d\n", tx_type);
c = vp8_decode_coefs(pbi, xd, a, l, type,
#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
tx_type,
@@ -526,7 +526,8 @@ int vp8_decode_mb_tokens_8x8(VP8D_COMP *pbi, MACROBLOCKD *xd) {
ENTROPY_CONTEXT *const L = (ENTROPY_CONTEXT *)xd->left_context;
char *const eobs = xd->eobs;
- int c, i, type, eobtotal = 0, seg_eob;
+ PLANE_TYPE type;
+ int c, i, eobtotal = 0, seg_eob;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
const int seg_active = segfeature_active(xd, segment_id, SEG_LVL_EOB);
INT16 *qcoeff_ptr = &xd->qcoeff[0];
@@ -633,8 +634,8 @@ int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *xd) {
char *const eobs = xd->eobs;
const int *scan = vp8_default_zig_zag1d;
-
- int c, i, type, eobtotal = 0, seg_eob = 16;
+ PLANE_TYPE type;
+ int c, i, eobtotal = 0, seg_eob = 16;
INT16 *qcoeff_ptr = &xd->qcoeff[0];
int segment_id = xd->mode_info_context->mbmi.segment_id;
diff --git a/vp8/encoder/encodemb.c b/vp8/encoder/encodemb.c
index a56305809..5abf69d2f 100644
--- a/vp8/encoder/encodemb.c
+++ b/vp8/encoder/encodemb.c
@@ -266,7 +266,7 @@ static const int plane_rd_mult[4] = {
}\
}
-void optimize_b(MACROBLOCK *mb, int i, int type,
+void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
const VP8_ENCODER_RTCD *rtcd, int tx_type) {
BLOCK *b;
@@ -343,7 +343,7 @@ void optimize_b(MACROBLOCK *mb, int i, int type,
coeff_ptr = b->coeff;
qcoeff_ptr = d->qcoeff;
dqcoeff_ptr = d->dqcoeff;
- i0 = !type;
+ i0 = (type == PLANE_TYPE_Y_NO_DC);
eob = d->eob;
/* Now set up a Viterbi trellis to evaluate alternative roundings. */
@@ -517,7 +517,7 @@ fall between -65 and +65.
**************************************************************************/
#define SUM_2ND_COEFF_THRESH 65
-static void check_reset_2nd_coeffs(MACROBLOCKD *xd, int type,
+static void check_reset_2nd_coeffs(MACROBLOCKD *xd,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l) {
int sum = 0;
int i;
@@ -540,12 +540,12 @@ static void check_reset_2nd_coeffs(MACROBLOCKD *xd, int type,
bd->dqcoeff[rc] = 0;
}
bd->eob = 0;
- *a = *l = (bd->eob != !type);
+ *a = *l = (bd->eob != 0);
}
}
#define SUM_2ND_COEFF_THRESH_8X8 32
-static void check_reset_8x8_2nd_coeffs(MACROBLOCKD *xd, int type,
+static void check_reset_8x8_2nd_coeffs(MACROBLOCKD *xd,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l) {
int sum = 0;
BLOCKD *bd = &xd->block[24];
@@ -570,13 +570,13 @@ static void check_reset_8x8_2nd_coeffs(MACROBLOCKD *xd, int type,
bd->qcoeff[8] = 0;
bd->dqcoeff[8] = 0;
bd->eob = 0;
- *a = *l = (bd->eob != !type);
+ *a = *l = (bd->eob != 0);
}
}
void vp8_optimize_mby_4x4(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
int b;
- int type;
+ PLANE_TYPE type;
int has_2nd_order;
ENTROPY_CONTEXT_PLANES t_above, t_left;
ENTROPY_CONTEXT *ta;
@@ -604,7 +604,7 @@ void vp8_optimize_mby_4x4(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
b = 24;
optimize_b(x, b, PLANE_TYPE_Y2,
ta + vp8_block2above[b], tl + vp8_block2left[b], rtcd, TX_4X4);
- check_reset_2nd_coeffs(&x->e_mbd, PLANE_TYPE_Y2,
+ check_reset_2nd_coeffs(&x->e_mbd,
ta + vp8_block2above[b], tl + vp8_block2left[b]);
}
}
@@ -637,7 +637,7 @@ static void optimize_mb_4x4(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
void vp8_optimize_mby_8x8(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
int b;
- int type;
+ PLANE_TYPE type;
ENTROPY_CONTEXT_PLANES t_above, t_left;
ENTROPY_CONTEXT *ta;
ENTROPY_CONTEXT *tl;
@@ -650,7 +650,7 @@ void vp8_optimize_mby_8x8(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
ta = (ENTROPY_CONTEXT *)&t_above;
tl = (ENTROPY_CONTEXT *)&t_left;
- type = 0;
+ type = PLANE_TYPE_Y_NO_DC;
for (b = 0; b < 16; b += 4) {
optimize_b(x, b, type,
ta + vp8_block2above[b], tl + vp8_block2left[b],
@@ -660,7 +660,7 @@ void vp8_optimize_mby_8x8(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
}
// 8x8 always have 2nd roder haar block
- check_reset_8x8_2nd_coeffs(&x->e_mbd, PLANE_TYPE_Y2,
+ check_reset_8x8_2nd_coeffs(&x->e_mbd,
ta + vp8_block2above_8x8[24], tl + vp8_block2left_8x8[24]);
}
@@ -693,7 +693,7 @@ void optimize_mb_8x8(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd) {
vp8_optimize_mbuv_8x8(x, rtcd);
}
-void optimize_b_16x16(MACROBLOCK *mb, int i, int type,
+void optimize_b_16x16(MACROBLOCK *mb, int i, PLANE_TYPE type,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
const VP8_ENCODER_RTCD *rtcd) {
BLOCK *b = &mb->block[i];
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 814328ef3..6be2d3521 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -568,9 +568,9 @@ int VP8_UVSSE(MACROBLOCK *x, const vp8_variance_rtcd_vtable_t *rtcd) {
}
static int cost_coeffs_2x2(MACROBLOCK *mb,
- BLOCKD *b, int type,
+ BLOCKD *b, PLANE_TYPE type,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l) {
- int c = !type; /* start at coef 0, unless Y with Y2 */
+ int c = (type == PLANE_TYPE_Y_NO_DC); /* start at coef 0, unless Y with Y2 */
int eob = b->eob;
int pt; /* surrounding block/prev coef predictor */
int cost = 0;
@@ -596,11 +596,11 @@ static int cost_coeffs_2x2(MACROBLOCK *mb,
return cost;
}
-static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type,
+static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, PLANE_TYPE type,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
int tx_size) {
const int eob = b->eob;
- int c = !type; /* start at coef 0, unless Y with Y2 */
+ int c = (type == PLANE_TYPE_Y_NO_DC); /* start at coef 0, unless Y with Y2 */
int cost = 0, default_eob, seg_eob;
int pt; /* surrounding block/prev coef predictor */
int const *scan, *band;
diff --git a/vp8/encoder/tokenize.c b/vp8/encoder/tokenize.c
index 4cfa3ecfc..3a516963c 100644
--- a/vp8/encoder/tokenize.c
+++ b/vp8/encoder/tokenize.c
@@ -131,26 +131,22 @@ static void fill_value_tokens() {
static void tokenize1st_order_b_16x16(MACROBLOCKD *xd,
const BLOCKD *const b,
TOKENEXTRA **tp,
- const int type,
- const FRAME_TYPE frametype,
+ PLANE_TYPE type,
ENTROPY_CONTEXT *a,
ENTROPY_CONTEXT *l,
VP8_COMP *cpi,
int dry_run) {
int pt; /* near block/prev token context index */
- int c = 0; /* start at DC unless type 0 */
+ int c = (type == PLANE_TYPE_Y_NO_DC) ? 1 : 0;
const int eob = b->eob; /* one beyond last nonzero coeff */
TOKENEXTRA *t = *tp; /* store tokens starting here */
const short *qcoeff_ptr = b->qcoeff;
#if CONFIG_HYBRIDTRANSFORM16X16
TX_TYPE tx_type = get_tx_type(xd, b);
#endif
-
int seg_eob = 256;
int segment_id = xd->mode_info_context->mbmi.segment_id;
- //if (!dry_run) printf("16: %d\n", tx_type);
-
if (segfeature_active(xd, segment_id, SEG_LVL_EOB))
seg_eob = get_segdata(xd, segment_id, SEG_LVL_EOB);
@@ -180,7 +176,8 @@ static void tokenize1st_order_b_16x16(MACROBLOCKD *xd,
#endif
t->context_tree = cpi->common.fc.coef_probs_16x16[type][band][pt];
- t->skip_eob_node = pt == 0 && ((band > 0 && type > 0) || (band > 1 && type == 0));
+ t->skip_eob_node = pt == 0 && ((band > 0 && type != PLANE_TYPE_Y_NO_DC) ||
+ (band > 1 && type == PLANE_TYPE_Y_NO_DC));
if (!dry_run) {
#if CONFIG_HYBRIDTRANSFORM16X16
if (tx_type != DCT_DCT)
@@ -201,8 +198,6 @@ static void tokenize1st_order_b_16x16(MACROBLOCKD *xd,
static void tokenize2nd_order_b_8x8(MACROBLOCKD *xd,
const BLOCKD *const b,
TOKENEXTRA **tp,
- const int type, /* which plane: 0=Y no DC, 1=Y2, 2=UV, 3=Y with DC */
- const FRAME_TYPE frametype,
ENTROPY_CONTEXT *a,
ENTROPY_CONTEXT *l,
VP8_COMP *cpi,
@@ -212,7 +207,6 @@ static void tokenize2nd_order_b_8x8(MACROBLOCKD *xd,
const int eob = b->eob; /* one beyond last nonzero coeff */
TOKENEXTRA *t = *tp; /* store tokens starting here */
const short *qcoeff_ptr = b->qcoeff;
-
int seg_eob = 4;
int segment_id = xd->mode_info_context->mbmi.segment_id;
@@ -241,20 +235,19 @@ static void tokenize2nd_order_b_8x8(MACROBLOCKD *xd,
}
t->Token = x;
- // printf("Token : %d\n", x);
- t->context_tree = cpi->common.fc.coef_probs_8x8 [type] [band] [pt];
+ t->context_tree = cpi->common.fc.coef_probs_8x8[PLANE_TYPE_Y2][band][pt];
- t->skip_eob_node = pt == 0 && ((band > 0 && type > 0) || (band > 1 && type == 0));
+ t->skip_eob_node = ((pt == 0) && (band > 0));
assert(vp8_coef_encodings[t->Token].Len - t->skip_eob_node > 0);
if (!dry_run)
- ++cpi->coef_counts_8x8 [type] [band] [pt] [x];
+ ++cpi->coef_counts_8x8[PLANE_TYPE_Y2][band][pt][x];
pt = vp8_prev_token_class[x];
++t;
} while (c < eob && ++c < seg_eob);
*tp = t;
- pt = (c != !type); /* 0 <-> all coeff data is zero */
+ pt = (c != 0); /* 0 <-> all coeff data is zero */
*a = *l = pt;
}
@@ -295,13 +288,13 @@ static void tokenize2nd_order_b_4x4(MACROBLOCKD *xd,
token = DCT_EOB_TOKEN;
t->Token = token;
- t->context_tree = cpi->common.fc.coef_probs [1] [band] [pt];
+ t->context_tree = cpi->common.fc.coef_probs[PLANE_TYPE_Y2][band][pt];
t->skip_eob_node = ((pt == 0) && (band > 0));
assert(vp8_coef_encodings[t->Token].Len - t->skip_eob_node > 0);
if (!dry_run)
- ++cpi->coef_counts [1] [band] [pt] [token];
+ ++cpi->coef_counts[PLANE_TYPE_Y2][band][pt][token];
pt = vp8_prev_token_class[token];
++t;
} while (c < eob && ++c < seg_eob);
@@ -314,14 +307,13 @@ static void tokenize2nd_order_b_4x4(MACROBLOCKD *xd,
static void tokenize1st_order_b_8x8(MACROBLOCKD *xd,
const BLOCKD *const b,
TOKENEXTRA **tp,
- const int type, /* which plane: 0=Y no DC, 1=Y2, 2=UV, 3=Y with DC */
- const FRAME_TYPE frametype,
+ PLANE_TYPE type,
ENTROPY_CONTEXT *a,
ENTROPY_CONTEXT *l,
VP8_COMP *cpi,
int dry_run) {
int pt; /* near block/prev token context index */
- int c = type ? 0 : 1; /* start at DC unless type 0 */
+ int c = (type == PLANE_TYPE_Y_NO_DC) ? 1 : 0; /* start at DC unless type 0 */
TOKENEXTRA *t = *tp; /* store tokens starting here */
const short *qcoeff_ptr = b->qcoeff;
#if CONFIG_HYBRIDTRANSFORM8X8
@@ -360,7 +352,8 @@ static void tokenize1st_order_b_8x8(MACROBLOCKD *xd,
#endif
t->context_tree = cpi->common.fc.coef_probs_8x8[type][band][pt];
- t->skip_eob_node = pt == 0 && ((band > 0 && type > 0) || (band > 1 && type == 0));
+ t->skip_eob_node = pt == 0 && ((band > 0 && type != PLANE_TYPE_Y_NO_DC) ||
+ (band > 1 && type == PLANE_TYPE_Y_NO_DC));
assert(vp8_coef_encodings[t->Token].Len - t->skip_eob_node > 0);
if (!dry_run) {
@@ -382,7 +375,6 @@ static void tokenize1st_order_b_8x8(MACROBLOCKD *xd,
static void tokenize1st_order_chroma_4x4(MACROBLOCKD *xd,
TOKENEXTRA **tp,
- int type, /* which plane: 0=Y no DC, 1=Y2, 2=UV, 3=Y with DC */
VP8_COMP *cpi,
int dry_run) {
unsigned int block;
@@ -425,13 +417,13 @@ static void tokenize1st_order_chroma_4x4(MACROBLOCKD *xd,
token = DCT_EOB_TOKEN;
t->Token = token;
- t->context_tree = cpi->common.fc.coef_probs [2] [band] [pt];
+ t->context_tree = cpi->common.fc.coef_probs[PLANE_TYPE_UV][band][pt];
t->skip_eob_node = ((pt == 0) && (band > 0));
assert(vp8_coef_encodings[t->Token].Len - t->skip_eob_node > 0);
if (!dry_run)
- ++cpi->coef_counts [2] [band] [pt] [token];
+ ++cpi->coef_counts[PLANE_TYPE_UV][band][pt][token];
pt = vp8_prev_token_class[token];
++t;
} while (c < eob && ++c < seg_eob);
@@ -445,7 +437,7 @@ static void tokenize1st_order_chroma_4x4(MACROBLOCKD *xd,
#if CONFIG_HYBRIDTRANSFORM
static void tokenize1st_order_ht_4x4(MACROBLOCKD *xd,
TOKENEXTRA **tp,
- int type,
+ PLANE_TYPE type,
VP8_COMP *cpi,
int dry_run) {
unsigned int block;
@@ -469,7 +461,7 @@ static void tokenize1st_order_ht_4x4(MACROBLOCKD *xd,
const int tmp1 = vp8_block2above[block];
const int tmp2 = vp8_block2left[block];
const int16_t *qcoeff_ptr = b->qcoeff;
- int c = type ? 0 : 1;
+ int c = (type == PLANE_TYPE_Y_NO_DC) ? 1 : 0;
a = (ENTROPY_CONTEXT *)xd->above_context + tmp1;
l = (ENTROPY_CONTEXT *)xd->left_context + tmp2;
@@ -512,19 +504,19 @@ static void tokenize1st_order_ht_4x4(MACROBLOCKD *xd,
t->Token = token;
if (tx_type != DCT_DCT)
- t->context_tree = cpi->common.fc.hybrid_coef_probs [type] [band] [pt];
+ t->context_tree = cpi->common.fc.hybrid_coef_probs[type][band][pt];
else
- t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt];
+ t->context_tree = cpi->common.fc.coef_probs[type][band][pt];
- t->skip_eob_node = pt == 0 &&
- ((band > 0 && type > 0) || (band > 1 && type == 0));
+ t->skip_eob_node = pt == 0 && ((band > 0 && type != PLANE_TYPE_Y_NO_DC) ||
+ (band > 1 && type == PLANE_TYPE_Y_NO_DC));
assert(vp8_coef_encodings[t->Token].Len - t->skip_eob_node > 0);
if (!dry_run) {
if (tx_type != DCT_DCT)
- ++cpi->hybrid_coef_counts[type] [band] [pt] [token];
+ ++cpi->hybrid_coef_counts[type][band][pt][token];
else
- ++cpi->coef_counts [type] [band] [pt] [token];
+ ++cpi->coef_counts [type][band][pt][token];
}
pt = vp8_prev_token_class[token];
++t;
@@ -535,13 +527,13 @@ static void tokenize1st_order_ht_4x4(MACROBLOCKD *xd,
*a = *l = pt;
}
- tokenize1st_order_chroma_4x4(xd, tp, PLANE_TYPE_UV, cpi, dry_run);
+ tokenize1st_order_chroma_4x4(xd, tp, cpi, dry_run);
}
#endif
static void tokenize1st_order_b_4x4(MACROBLOCKD *xd,
TOKENEXTRA **tp,
- int type, /* which plane: 0=Y no DC, 1=Y2, 2=UV, 3=Y with DC */
+ PLANE_TYPE type,
VP8_COMP *cpi,
int dry_run) {
unsigned int block;
@@ -560,7 +552,7 @@ static void tokenize1st_order_b_4x4(MACROBLOCKD *xd,
for (block = 0; block < 16; block++, b++) {
const int eob = b->eob;
const int16_t *qcoeff_ptr = b->qcoeff;
- int c = type ? 0 : 1;
+ int c = (type == PLANE_TYPE_Y_NO_DC) ? 1 : 0;
a = (ENTROPY_CONTEXT *)xd->above_context + vp8_block2above[block];
l = (ENTROPY_CONTEXT *)xd->left_context + vp8_block2left[block];
@@ -582,13 +574,13 @@ static void tokenize1st_order_b_4x4(MACROBLOCKD *xd,
token = DCT_EOB_TOKEN;
t->Token = token;
- t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt];
+ t->context_tree = cpi->common.fc.coef_probs[type][band][pt];
- t->skip_eob_node = pt == 0 &&
- ((band > 0 && type > 0) || (band > 1 && type == 0));
+ t->skip_eob_node = pt == 0 && ((band > 0 && type != PLANE_TYPE_Y_NO_DC) ||
+ (band > 1 && type == PLANE_TYPE_Y_NO_DC));
assert(vp8_coef_encodings[t->Token].Len - t->skip_eob_node > 0);
if (!dry_run)
- ++cpi->coef_counts [type] [band] [pt] [token];
+ ++cpi->coef_counts[type][band][pt][token];
pt = vp8_prev_token_class[token];
++t;
} while (c < eob && ++c < seg_eob);
@@ -598,7 +590,7 @@ static void tokenize1st_order_b_4x4(MACROBLOCKD *xd,
*a = *l = pt;
}
- tokenize1st_order_chroma_4x4(xd, tp, PLANE_TYPE_UV, cpi, dry_run);
+ tokenize1st_order_chroma_4x4(xd, tp, cpi, dry_run);
}
int mby_is_skippable_4x4(MACROBLOCKD *xd, int has_y2_block) {
@@ -676,7 +668,7 @@ void vp8_tokenize_mb(VP8_COMP *cpi,
MACROBLOCKD *xd,
TOKENEXTRA **t,
int dry_run) {
- int plane_type;
+ PLANE_TYPE plane_type;
int has_y2_block;
int b;
int tx_size = xd->mode_info_context->mbmi.txfm_size;
@@ -701,10 +693,10 @@ void vp8_tokenize_mb(VP8_COMP *cpi,
} else
skip_inc = 0;
- has_y2_block = (xd->mode_info_context->mbmi.mode != B_PRED
+ has_y2_block = (tx_size != TX_16X16
+ && xd->mode_info_context->mbmi.mode != B_PRED
&& xd->mode_info_context->mbmi.mode != I8X8_PRED
&& xd->mode_info_context->mbmi.mode != SPLITMV);
- if (tx_size == TX_16X16) has_y2_block = 0; // Because of inter frames
switch (tx_size) {
case TX_16X16:
@@ -747,36 +739,37 @@ void vp8_tokenize_mb(VP8_COMP *cpi,
if (!dry_run)
cpi->skip_false_count[mb_skip_context] += skip_inc;
- plane_type = 3;
if (has_y2_block) {
if (tx_size == TX_8X8) {
ENTROPY_CONTEXT *A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)xd->left_context;
tokenize2nd_order_b_8x8(xd,
- xd->block + 24, t, 1, xd->frame_type,
+ xd->block + 24, t,
A + vp8_block2above_8x8[24],
L + vp8_block2left_8x8[24],
cpi, dry_run);
} else
tokenize2nd_order_b_4x4(xd, t, cpi, dry_run);
- plane_type = 0;
- }
+ plane_type = PLANE_TYPE_Y_NO_DC;
+ } else
+ plane_type = PLANE_TYPE_Y_WITH_DC;
if (tx_size == TX_16X16) {
ENTROPY_CONTEXT * A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT * L = (ENTROPY_CONTEXT *)xd->left_context;
- tokenize1st_order_b_16x16(xd, xd->block, t, 3,
- xd->frame_type, A, L, cpi, dry_run);
+ tokenize1st_order_b_16x16(xd, xd->block, t, PLANE_TYPE_Y_WITH_DC,
+ A, L, cpi, dry_run);
for (b = 1; b < 16; b++) {
*(A + vp8_block2above[b]) = *(A);
*(L + vp8_block2left[b] ) = *(L);
}
for (b = 16; b < 24; b += 4) {
- tokenize1st_order_b_8x8(xd, xd->block + b, t, 2, xd->frame_type,
- A + vp8_block2above_8x8[b], L + vp8_block2left_8x8[b], cpi, dry_run);
+ tokenize1st_order_b_8x8(xd, xd->block + b, t, PLANE_TYPE_UV,
+ A + vp8_block2above_8x8[b],
+ L + vp8_block2left_8x8[b], cpi, dry_run);
*(A + vp8_block2above_8x8[b]+1) = *(A + vp8_block2above_8x8[b]);
*(L + vp8_block2left_8x8[b]+1 ) = *(L + vp8_block2left_8x8[b]);
}
@@ -786,13 +779,9 @@ void vp8_tokenize_mb(VP8_COMP *cpi,
else if (tx_size == TX_8X8) {
ENTROPY_CONTEXT *A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)xd->left_context;
- if (xd->mode_info_context->mbmi.mode == I8X8_PRED) {
- plane_type = PLANE_TYPE_Y_WITH_DC;
- }
for (b = 0; b < 16; b += 4) {
tokenize1st_order_b_8x8(xd,
- xd->block + b,
- t, plane_type, xd->frame_type,
+ xd->block + b, t, plane_type,
A + vp8_block2above_8x8[b],
L + vp8_block2left_8x8[b],
cpi, dry_run);
@@ -800,14 +789,12 @@ void vp8_tokenize_mb(VP8_COMP *cpi,
*(L + vp8_block2left_8x8[b] + 1) = *(L + vp8_block2left_8x8[b]);
}
if (xd->mode_info_context->mbmi.mode == I8X8_PRED) {
- tokenize1st_order_chroma_4x4(xd, t, PLANE_TYPE_UV, cpi, dry_run);
+ tokenize1st_order_chroma_4x4(xd, t, cpi, dry_run);
} else {
for (b = 16; b < 24; b += 4) {
- tokenize1st_order_b_8x8(xd,
- xd->block + b, t, 2, xd->frame_type,
+ tokenize1st_order_b_8x8(xd, xd->block + b, t, PLANE_TYPE_UV,
A + vp8_block2above_8x8[b],
- L + vp8_block2left_8x8[b],
- cpi, dry_run);
+ L + vp8_block2left_8x8[b], cpi, dry_run);
*(A + vp8_block2above_8x8[b] + 1) = *(A + vp8_block2above_8x8[b]);
*(L + vp8_block2left_8x8[b] + 1) = *(L + vp8_block2left_8x8[b]);
}