Commit 9970d8b6 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Restructure vp9_decode_mb_tokens_8x8() a bit.

Don't declare variables if they only ever have a single value and are
used only as argument to another function call; instead, just hardcode
the value in the function call directly. Split out UV and Y coefficient
loops for clarity. Use xd->block[].qcoeff instead of xd->qcoeff + magic
to remove use of magic offset variables.

Change-Id: I5b17eda1bb666c69c2b7ea957d5525cd78192e33
parent f090b6b4
...@@ -302,76 +302,71 @@ int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi, ...@@ -302,76 +302,71 @@ int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
BOOL_DECODER* const bc) { BOOL_DECODER* const bc) {
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;
unsigned short *const eobs = xd->eobs; unsigned short *const eobs = xd->eobs;
PLANE_TYPE type; PLANE_TYPE type;
int c, i, eobtotal = 0, seg_eob; int c, i, eobtotal = 0, seg_eob;
const int segment_id = xd->mode_info_context->mbmi.segment_id; const int segment_id = xd->mode_info_context->mbmi.segment_id;
INT16 *qcoeff_ptr = &xd->qcoeff[0];
TX_TYPE tx_type = DCT_DCT;
int bufthred = (xd->mode_info_context->mbmi.mode == I8X8_PRED || // 2nd order DC block
xd->mode_info_context->mbmi.mode == SPLITMV) ? 16 : 24;
if (xd->mode_info_context->mbmi.mode != B_PRED && if (xd->mode_info_context->mbmi.mode != B_PRED &&
xd->mode_info_context->mbmi.mode != SPLITMV && xd->mode_info_context->mbmi.mode != SPLITMV &&
xd->mode_info_context->mbmi.mode != I8X8_PRED) { xd->mode_info_context->mbmi.mode != I8X8_PRED) {
ENTROPY_CONTEXT *const a = A + vp9_block2above_8x8[24]; ENTROPY_CONTEXT *const a = A + vp9_block2above_8x8[24];
ENTROPY_CONTEXT *const l = L + vp9_block2left_8x8[24]; ENTROPY_CONTEXT *const l = L + vp9_block2left_8x8[24];
const int *const scan = vp9_default_zig_zag1d;
type = PLANE_TYPE_Y2;
seg_eob = get_eob(xd, segment_id, 4);
eobs[24] = c = decode_coefs(pbi, xd, bc, a, l, type,
tx_type, seg_eob, qcoeff_ptr + 24 * 16,
scan, TX_8X8, vp9_coef_bands);
eobs[24] = c = decode_coefs(pbi, xd, bc, a, l, PLANE_TYPE_Y2,
DCT_DCT, get_eob(xd, segment_id, 4),
xd->block[24].qcoeff,
vp9_default_zig_zag1d, TX_8X8, vp9_coef_bands);
eobtotal += c - 4; eobtotal += c - 4;
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;
}
// luma blocks
seg_eob = get_eob(xd, segment_id, 64); seg_eob = get_eob(xd, segment_id, 64);
for (i = 0; i < 16; i += 4) {
for (i = 0; i < bufthred ; i += 4) {
ENTROPY_CONTEXT *const a = A + vp9_block2above_8x8[i]; ENTROPY_CONTEXT *const a = A + vp9_block2above_8x8[i];
ENTROPY_CONTEXT *const l = L + vp9_block2left_8x8[i]; ENTROPY_CONTEXT *const l = L + vp9_block2left_8x8[i];
const int *const scan = vp9_default_zig_zag1d_8x8;
tx_type = DCT_DCT;
if (i == 16)
type = PLANE_TYPE_UV;
if (type == PLANE_TYPE_Y_WITH_DC) {
tx_type = get_tx_type(xd, xd->block + i);
}
eobs[i] = c = decode_coefs(pbi, xd, bc, a, l, type, eobs[i] = c = decode_coefs(pbi, xd, bc, a, l, type,
tx_type, seg_eob, qcoeff_ptr, type == PLANE_TYPE_Y_WITH_DC ?
scan, TX_8X8, vp9_coef_bands_8x8); get_tx_type(xd, xd->block + i) : DCT_DCT,
seg_eob, xd->block[i].qcoeff,
vp9_default_zig_zag1d_8x8,
TX_8X8, vp9_coef_bands_8x8);
a[1] = a[0]; a[1] = a[0];
l[1] = l[0]; l[1] = l[0];
eobtotal += c; eobtotal += c;
qcoeff_ptr += 64;
} }
if (bufthred == 16) { // chroma blocks
type = PLANE_TYPE_UV; if (xd->mode_info_context->mbmi.mode == I8X8_PRED ||
tx_type = DCT_DCT; xd->mode_info_context->mbmi.mode == SPLITMV) {
// use 4x4 transform for U, V components in I8X8/splitmv prediction mode
seg_eob = get_eob(xd, segment_id, 16); seg_eob = get_eob(xd, segment_id, 16);
// use 4x4 transform for U, V components in I8X8 prediction mode
for (i = 16; i < 24; i++) { for (i = 16; i < 24; i++) {
ENTROPY_CONTEXT *const a = A + vp9_block2above[i]; ENTROPY_CONTEXT *const a = A + vp9_block2above[i];
ENTROPY_CONTEXT *const l = L + vp9_block2left[i]; ENTROPY_CONTEXT *const l = L + vp9_block2left[i];
const int *scan = vp9_default_zig_zag1d;
eobs[i] = c = decode_coefs(pbi, xd, bc, a, l, type,
tx_type, seg_eob, qcoeff_ptr,
scan, TX_4X4, vp9_coef_bands);
eobs[i] = c = decode_coefs(pbi, xd, bc, a, l, PLANE_TYPE_UV,
DCT_DCT, seg_eob, xd->block[i].qcoeff,
vp9_default_zig_zag1d, TX_4X4, vp9_coef_bands);
eobtotal += c;
}
} else {
for (i = 16; i < 24; i += 4) {
ENTROPY_CONTEXT *const a = A + vp9_block2above_8x8[i];
ENTROPY_CONTEXT *const l = L + vp9_block2left_8x8[i];
eobs[i] = c = decode_coefs(pbi, xd, bc, a, l, PLANE_TYPE_UV,
DCT_DCT, seg_eob, xd->block[i].qcoeff,
vp9_default_zig_zag1d_8x8,
TX_8X8, vp9_coef_bands_8x8);
a[1] = a[0];
l[1] = l[0];
eobtotal += c; eobtotal += c;
qcoeff_ptr += 16;
} }
} }
......
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