Commit f19a1caf authored by Ronald S. Bultje's avatar Ronald S. Bultje
Browse files

Remove special-case inline detokenization in b_pred reconstruction.

Just like for all other block modes, b_pred tokens can be read together
before starting macroblock reconstruction. This removes special cases
for b_pred in decode_macroblock() and allows to make decode_coefs_4x4()
static in detokenize.c.

While at it, remove the redundant handling and checking of plane_type
and block_index (i) in decode_coefs_4x4(). Since the function is static,
and is called only from decode_mb_tokens_4x4(), we don't need to worry
that the arguments ever go out of sync.

Change-Id: I2d415da0b51b89d0490a6b9e24cc86363c2090f7
parent 0eb55904
...@@ -292,7 +292,7 @@ static void decode_superblock(VP9D_COMP *pbi, MACROBLOCKD *xd, ...@@ -292,7 +292,7 @@ static void decode_superblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
} else if (tx_size == TX_8X8) { } else if (tx_size == TX_8X8) {
eobtotal = vp9_decode_mb_tokens_8x8(pbi, xd, bc); eobtotal = vp9_decode_mb_tokens_8x8(pbi, xd, bc);
} else { } else {
eobtotal = vp9_decode_mb_tokens(pbi, xd, bc); eobtotal = vp9_decode_mb_tokens_4x4(pbi, xd, bc);
} }
if (eobtotal == 0) { // skip loopfilter if (eobtotal == 0) { // skip loopfilter
xd->mode_info_context->mbmi.mb_skip_coeff = 1; xd->mode_info_context->mbmi.mb_skip_coeff = 1;
...@@ -395,8 +395,8 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd, ...@@ -395,8 +395,8 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
eobtotal = vp9_decode_mb_tokens_16x16(pbi, xd, bc); eobtotal = vp9_decode_mb_tokens_16x16(pbi, xd, bc);
} else if (tx_size == TX_8X8) { } else if (tx_size == TX_8X8) {
eobtotal = vp9_decode_mb_tokens_8x8(pbi, xd, bc); eobtotal = vp9_decode_mb_tokens_8x8(pbi, xd, bc);
} else if (mode != B_PRED) { } else {
eobtotal = vp9_decode_mb_tokens(pbi, xd, bc); eobtotal = vp9_decode_mb_tokens_4x4(pbi, xd, bc);
} }
} }
...@@ -423,9 +423,7 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd, ...@@ -423,9 +423,7 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
/* do prediction */ /* do prediction */
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) { if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) {
if (mode != I8X8_PRED) { if (mode != I8X8_PRED) {
if (mode != B_PRED) {
vp9_build_intra_predictors_mbuv(xd); vp9_build_intra_predictors_mbuv(xd);
}
if (mode != B_PRED) { if (mode != B_PRED) {
vp9_build_intra_predictors_mby(xd); vp9_build_intra_predictors_mby(xd);
} }
...@@ -493,8 +491,6 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd, ...@@ -493,8 +491,6 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
xd->mode_info_context->bmi[i].as_mode.context = b->bmi.as_mode.context = xd->mode_info_context->bmi[i].as_mode.context = b->bmi.as_mode.context =
vp9_find_bpred_context(b); vp9_find_bpred_context(b);
#endif #endif
if (!xd->mode_info_context->mbmi.mb_skip_coeff)
eobtotal += vp9_decode_coefs_4x4(pbi, xd, bc, PLANE_TYPE_Y_WITH_DC, i);
#if CONFIG_COMP_INTRA_PRED #if CONFIG_COMP_INTRA_PRED
b_mode2 = xd->mode_info_context->bmi[i].as_mode.second; b_mode2 = xd->mode_info_context->bmi[i].as_mode.second;
...@@ -517,14 +513,6 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd, ...@@ -517,14 +513,6 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
*(b->base_dst) + b->dst, 16, b->dst_stride); *(b->base_dst) + b->dst, 16, b->dst_stride);
} }
} }
if (!xd->mode_info_context->mbmi.mb_skip_coeff) {
for (i = 16; i < 24; ++i)
eobtotal += vp9_decode_coefs_4x4(pbi, xd, bc, PLANE_TYPE_UV, i);
}
vp9_build_intra_predictors_mbuv(xd);
pbi->idct_add_uv_block(xd->qcoeff + 16 * 16, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer,
xd->dst.v_buffer, xd->dst.uv_stride, xd->eobs + 16);
} else if (mode == SPLITMV) { } else if (mode == SPLITMV) {
if (tx_size == TX_8X8) { if (tx_size == TX_8X8) {
vp9_dequant_idct_add_y_block_8x8(xd->qcoeff, xd->block[0].dequant, vp9_dequant_idct_add_y_block_8x8(xd->qcoeff, xd->block[0].dequant,
...@@ -596,8 +584,7 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd, ...@@ -596,8 +584,7 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
(xd->qcoeff + 16 * 16, xd->block[16].dequant, (xd->qcoeff + 16 * 16, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer, xd->dst.v_buffer, xd->predictor + 16 * 16, xd->dst.u_buffer, xd->dst.v_buffer,
xd->dst.uv_stride, xd->eobs + 16, xd); xd->dst.uv_stride, xd->eobs + 16, xd);
else if (xd->mode_info_context->mbmi.mode != I8X8_PRED && else if (xd->mode_info_context->mbmi.mode != I8X8_PRED)
xd->mode_info_context->mbmi.mode != B_PRED)
pbi->idct_add_uv_block(xd->qcoeff + 16 * 16, xd->block[16].dequant, pbi->idct_add_uv_block(xd->qcoeff + 16 * 16, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer, xd->dst.v_buffer, xd->predictor + 16 * 16, xd->dst.u_buffer, xd->dst.v_buffer,
xd->dst.uv_stride, xd->eobs + 16); xd->dst.uv_stride, xd->eobs + 16);
......
...@@ -568,8 +568,9 @@ int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi, ...@@ -568,8 +568,9 @@ int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
return eobtotal; return eobtotal;
} }
int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd, static int decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
BOOL_DECODER* const bc, int type, int i) { BOOL_DECODER* const bc,
PLANE_TYPE type, int i) {
ENTROPY_CONTEXT *const A = (ENTROPY_CONTEXT *)xd->above_context; ENTROPY_CONTEXT *const A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT *const L = (ENTROPY_CONTEXT *)xd->left_context; ENTROPY_CONTEXT *const L = (ENTROPY_CONTEXT *)xd->left_context;
ENTROPY_CONTEXT *const a = A + vp9_block2above[i]; ENTROPY_CONTEXT *const a = A + vp9_block2above[i];
...@@ -577,16 +578,9 @@ int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd, ...@@ -577,16 +578,9 @@ int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
INT16 *qcoeff_ptr = &xd->qcoeff[0]; INT16 *qcoeff_ptr = &xd->qcoeff[0];
const int *scan = vp9_default_zig_zag1d; const int *scan = vp9_default_zig_zag1d;
unsigned short *const eobs = xd->eobs; unsigned short *const eobs = xd->eobs;
int c, seg_eob;
TX_TYPE tx_type = DCT_DCT;
int segment_id = xd->mode_info_context->mbmi.segment_id; int segment_id = xd->mode_info_context->mbmi.segment_id;
int c, seg_eob = get_eob(xd, segment_id, 16);
seg_eob = get_eob(xd, segment_id, 16); TX_TYPE tx_type = DCT_DCT;
if (i == 24)
type = PLANE_TYPE_Y2;
else if (i >= 16)
type = PLANE_TYPE_UV;
if (type == PLANE_TYPE_Y_WITH_DC) if (type == PLANE_TYPE_Y_WITH_DC)
tx_type = get_tx_type(xd, &xd->block[i]); tx_type = get_tx_type(xd, &xd->block[i]);
...@@ -611,24 +605,26 @@ int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd, ...@@ -611,24 +605,26 @@ int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
return c; return c;
} }
int vp9_decode_mb_tokens(VP9D_COMP* const dx, int vp9_decode_mb_tokens_4x4(VP9D_COMP* const dx,
MACROBLOCKD* const xd, MACROBLOCKD* const xd,
BOOL_DECODER* const bc) { BOOL_DECODER* const bc) {
int i, type, eobtotal = 0; int i, eobtotal = 0;
PLANE_TYPE type;
if (xd->mode_info_context->mbmi.mode != B_PRED && if (xd->mode_info_context->mbmi.mode != B_PRED &&
xd->mode_info_context->mbmi.mode != I8X8_PRED && xd->mode_info_context->mbmi.mode != I8X8_PRED &&
xd->mode_info_context->mbmi.mode != SPLITMV) { xd->mode_info_context->mbmi.mode != SPLITMV) {
eobtotal += decode_coefs_4x4(dx, xd, bc, PLANE_TYPE_Y2, 24) - 16;
eobtotal += vp9_decode_coefs_4x4(dx, xd, bc, PLANE_TYPE_Y2, 24) - 16;
type = PLANE_TYPE_Y_NO_DC; type = PLANE_TYPE_Y_NO_DC;
} else { } else {
type = PLANE_TYPE_Y_WITH_DC; type = PLANE_TYPE_Y_WITH_DC;
} }
for (i = 0; i < 24; ++i) { for (i = 0; i < 16; ++i) {
eobtotal += vp9_decode_coefs_4x4(dx, xd, bc, type, i); eobtotal += decode_coefs_4x4(dx, xd, bc, type, i);
} }
do {
eobtotal += decode_coefs_4x4(dx, xd, bc, PLANE_TYPE_UV, i);
} while (++i < 24);
return eobtotal; return eobtotal;
} }
...@@ -15,13 +15,14 @@ ...@@ -15,13 +15,14 @@
#include "onyxd_int.h" #include "onyxd_int.h"
void vp9_reset_mb_tokens_context(MACROBLOCKD* const); void vp9_reset_mb_tokens_context(MACROBLOCKD* const);
int vp9_decode_mb_tokens(VP9D_COMP* const, MACROBLOCKD* const,
int vp9_decode_mb_tokens_4x4(VP9D_COMP* const, MACROBLOCKD* const,
BOOL_DECODER* const); BOOL_DECODER* const);
int vp9_decode_mb_tokens_8x8(VP9D_COMP* const, MACROBLOCKD* const, int vp9_decode_mb_tokens_8x8(VP9D_COMP* const, MACROBLOCKD* const,
BOOL_DECODER* const); BOOL_DECODER* const);
int vp9_decode_mb_tokens_16x16(VP9D_COMP* const, MACROBLOCKD* const, int vp9_decode_mb_tokens_16x16(VP9D_COMP* const, MACROBLOCKD* const,
BOOL_DECODER* const); BOOL_DECODER* const);
int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd, BOOL_DECODER* const bc,
int type, int i);
#endif /* DETOKENIZE_H */ #endif /* DETOKENIZE_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment