Commit 0742b1e4 authored by Deb Mukherjee's avatar Deb Mukherjee
Browse files

Fixing 8x8/4x4 ADST for intra modes with tx select

This patch allows use of 8x8 and 4x4 ADST correctly for Intra
16x16 modes and Intra 8x8 modes when the block size selected
is smaller than the prediction mode. Also includes some cleanups
and refactoring.

Rebase.

Change-Id: Ie3257bdf07bdb9c6e9476915e3a80183c8fa005a
parent c6787398
...@@ -494,8 +494,23 @@ static TX_TYPE txfm_map(B_PREDICTION_MODE bmode) { ...@@ -494,8 +494,23 @@ static TX_TYPE txfm_map(B_PREDICTION_MODE bmode) {
return tx_type; return tx_type;
} }
#define USE_ADST_FOR_I16X16_8X8 0
#define USE_ADST_FOR_I16X16_4X4 0
#define USE_ADST_FOR_I8X8_4X4 1
#define USE_ADST_PERIPHERY_ONLY 1
static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, const BLOCKD *b) { static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, const BLOCKD *b) {
// TODO(debargha): explore different patterns for ADST usage when blocksize
// is smaller than the prediction size
TX_TYPE tx_type = DCT_DCT; TX_TYPE tx_type = DCT_DCT;
int ib = (int)(b - xd->block);
if (ib >= 16)
return tx_type;
#if CONFIG_SUPERBLOCKS
// TODO(rbultje, debargha): Explore ADST usage for superblocks
if (xd->mode_info_context->mbmi.encoded_as_sb)
return tx_type;
#endif
if (xd->mode_info_context->mbmi.mode == B_PRED && if (xd->mode_info_context->mbmi.mode == B_PRED &&
xd->q_index < ACTIVE_HT) { xd->q_index < ACTIVE_HT) {
tx_type = txfm_map( tx_type = txfm_map(
...@@ -503,28 +518,92 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, const BLOCKD *b) { ...@@ -503,28 +518,92 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, const BLOCKD *b) {
b->bmi.as_mode.first == B_CONTEXT_PRED ? b->bmi.as_mode.context : b->bmi.as_mode.first == B_CONTEXT_PRED ? b->bmi.as_mode.context :
#endif #endif
b->bmi.as_mode.first); b->bmi.as_mode.first);
} else if (xd->mode_info_context->mbmi.mode == I8X8_PRED &&
xd->q_index < ACTIVE_HT) {
#if USE_ADST_FOR_I8X8_4X4
#if USE_ADST_PERIPHERY_ONLY
// Use ADST for periphery blocks only
int ic = (ib & 10);
b += ic - ib;
tx_type = (ic != 10) ?
txfm_map(pred_mode_conv((MB_PREDICTION_MODE)b->bmi.as_mode.first)) :
DCT_DCT;
#else
// Use ADST
tx_type = txfm_map(pred_mode_conv(
(MB_PREDICTION_MODE)b->bmi.as_mode.first));
#endif
#else
// Use 2D DCT
tx_type = DCT_DCT;
#endif
} else if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
xd->q_index < ACTIVE_HT) {
#if USE_ADST_FOR_I16X16_4X4
#if USE_ADST_PERIPHERY_ONLY
// Use ADST for periphery blocks only
tx_type = (ib < 4 || ((ib & 3) == 0)) ?
txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode)) : DCT_DCT;
#else
// Use ADST
tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
#endif
#else
// Use 2D DCT
tx_type = DCT_DCT;
#endif
} }
return tx_type; return tx_type;
} }
static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, const BLOCKD *b) { static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, const BLOCKD *b) {
// TODO(debargha): explore different patterns for ADST usage when blocksize
// is smaller than the prediction size
TX_TYPE tx_type = DCT_DCT; TX_TYPE tx_type = DCT_DCT;
int ib = (int)(b - xd->block);
if (ib >= 16)
return tx_type;
#if CONFIG_SUPERBLOCKS
// TODO(rbultje, debargha): Explore ADST usage for superblocks
if (xd->mode_info_context->mbmi.encoded_as_sb)
return tx_type;
#endif
if (xd->mode_info_context->mbmi.mode == I8X8_PRED && if (xd->mode_info_context->mbmi.mode == I8X8_PRED &&
xd->q_index < ACTIVE_HT8) { xd->q_index < ACTIVE_HT8) {
// TODO(rbultje): MB_PREDICTION_MODE / B_PREDICTION_MODE should be merged // TODO(rbultje): MB_PREDICTION_MODE / B_PREDICTION_MODE should be merged
// or the relationship otherwise modified to address this type conversion. // or the relationship otherwise modified to address this type conversion.
tx_type = txfm_map(pred_mode_conv( tx_type = txfm_map(pred_mode_conv(
(MB_PREDICTION_MODE)b->bmi.as_mode.first)); (MB_PREDICTION_MODE)b->bmi.as_mode.first));
} else if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
xd->q_index < ACTIVE_HT8) {
#if USE_ADST_FOR_I8X8_4X4
#if USE_ADST_PERIPHERY_ONLY
// Use ADST for periphery blocks only
tx_type = (ib != 10) ?
txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode)) : DCT_DCT;
#else
// Use ADST
tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
#endif
#else
// Use 2D DCT
tx_type = DCT_DCT;
#endif
} }
return tx_type; return tx_type;
} }
static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd, const BLOCKD *b) { static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd, const BLOCKD *b) {
TX_TYPE tx_type = DCT_DCT; TX_TYPE tx_type = DCT_DCT;
if (xd->mode_info_context->mbmi.mode < I8X8_PRED && int ib = (int)(b - xd->block);
if (ib >= 16)
return tx_type;
#if CONFIG_SUPERBLOCKS #if CONFIG_SUPERBLOCKS
!xd->mode_info_context->mbmi.encoded_as_sb && // TODO(rbultje, debargha): Explore ADST usage for superblocks
if (xd->mode_info_context->mbmi.encoded_as_sb)
return tx_type;
#endif #endif
if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
xd->q_index < ACTIVE_HT16) { xd->q_index < ACTIVE_HT16) {
tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode)); tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
} }
...@@ -549,6 +628,16 @@ static TX_TYPE get_tx_type(const MACROBLOCKD *xd, const BLOCKD *b) { ...@@ -549,6 +628,16 @@ static TX_TYPE get_tx_type(const MACROBLOCKD *xd, const BLOCKD *b) {
return tx_type; return tx_type;
} }
static int get_2nd_order_usage(const MACROBLOCKD *xd) {
int has_2nd_order = (xd->mode_info_context->mbmi.mode != SPLITMV &&
xd->mode_info_context->mbmi.mode != I8X8_PRED &&
xd->mode_info_context->mbmi.mode != B_PRED &&
xd->mode_info_context->mbmi.txfm_size != TX_16X16);
if (has_2nd_order)
has_2nd_order = (get_tx_type(xd, xd->block) == DCT_DCT);
return has_2nd_order;
}
extern void vp9_build_block_doffsets(MACROBLOCKD *xd); extern void vp9_build_block_doffsets(MACROBLOCKD *xd);
extern void vp9_setup_block_dptrs(MACROBLOCKD *xd); extern void vp9_setup_block_dptrs(MACROBLOCKD *xd);
......
...@@ -40,20 +40,28 @@ void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int block, int pitch) { ...@@ -40,20 +40,28 @@ void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int block, int pitch) {
void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd) { void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd) {
int i; int i;
BLOCKD *blockd = xd->block; BLOCKD *blockd = xd->block;
int has_2nd_order = get_2nd_order_usage(xd);
if (xd->mode_info_context->mbmi.mode != SPLITMV) { if (has_2nd_order) {
/* do 2nd order transform on the dc block */ /* do 2nd order transform on the dc block */
vp9_short_inv_walsh4x4(blockd[24].dqcoeff, blockd[24].diff); vp9_short_inv_walsh4x4(blockd[24].dqcoeff, blockd[24].diff);
recon_dcblock(xd); recon_dcblock(xd);
} }
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
vp9_inverse_transform_b_4x4(xd, i, 32); TX_TYPE tx_type = get_tx_type_4x4(xd, &xd->block[i]);
if (tx_type != DCT_DCT) {
vp9_ihtllm_c(xd->block[i].dqcoeff, xd->block[i].diff, 32,
tx_type, 4);
} else {
vp9_inverse_transform_b_4x4(xd, i, 32);
}
} }
} }
void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd) { void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd) {
int i; int i;
for (i = 16; i < 24; i++) { for (i = 16; i < 24; i++) {
vp9_inverse_transform_b_4x4(xd, i, 16); vp9_inverse_transform_b_4x4(xd, i, 16);
} }
...@@ -72,20 +80,31 @@ void vp9_inverse_transform_b_8x8(short *input_dqcoeff, short *output_coeff, ...@@ -72,20 +80,31 @@ void vp9_inverse_transform_b_8x8(short *input_dqcoeff, short *output_coeff,
void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd) { void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd) {
int i; int i;
BLOCKD *blockd = xd->block; BLOCKD *blockd = xd->block;
int has_2nd_order = get_2nd_order_usage(xd);
if (xd->mode_info_context->mbmi.mode != SPLITMV) { if (has_2nd_order) {
// do 2nd order transform on the dc block // do 2nd order transform on the dc block
vp9_short_ihaar2x2(blockd[24].dqcoeff, blockd[24].diff, 8); vp9_short_ihaar2x2(blockd[24].dqcoeff, blockd[24].diff, 8);
recon_dcblock_8x8(xd); // need to change for 8x8 recon_dcblock_8x8(xd); // need to change for 8x8
} }
for (i = 0; i < 9; i += 8) { for (i = 0; i < 9; i += 8) {
vp9_inverse_transform_b_8x8(&blockd[i].dqcoeff[0], TX_TYPE tx_type = get_tx_type_8x8(xd, &xd->block[i]);
&blockd[i].diff[0], 32); if (tx_type != DCT_DCT) {
vp9_ihtllm_c(xd->block[i].dqcoeff, xd->block[i].diff, 32, tx_type, 8);
} else {
vp9_inverse_transform_b_8x8(&blockd[i].dqcoeff[0],
&blockd[i].diff[0], 32);
}
} }
for (i = 2; i < 11; i += 8) { for (i = 2; i < 11; i += 8) {
vp9_inverse_transform_b_8x8(&blockd[i + 2].dqcoeff[0], TX_TYPE tx_type = get_tx_type_8x8(xd, &xd->block[i]);
&blockd[i].diff[0], 32); if (tx_type != DCT_DCT) {
vp9_ihtllm_c(xd->block[i + 2].dqcoeff, xd->block[i].diff, 32, tx_type, 8);
} else {
vp9_inverse_transform_b_8x8(&blockd[i + 2].dqcoeff[0],
&blockd[i].diff[0], 32);
}
} }
} }
...@@ -110,8 +129,14 @@ void vp9_inverse_transform_b_16x16(short *input_dqcoeff, ...@@ -110,8 +129,14 @@ void vp9_inverse_transform_b_16x16(short *input_dqcoeff,
} }
void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd) { void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd) {
vp9_inverse_transform_b_16x16(&xd->block[0].dqcoeff[0], BLOCKD *bd = &xd->block[0];
&xd->block[0].diff[0], 32); TX_TYPE tx_type = get_tx_type_16x16(xd, bd);
if (tx_type != DCT_DCT) {
vp9_ihtllm_c(bd->dqcoeff, bd->diff, 32, tx_type, 16);
} else {
vp9_inverse_transform_b_16x16(&xd->block[0].dqcoeff[0],
&xd->block[0].diff[0], 32);
}
} }
void vp9_inverse_transform_mb_16x16(MACROBLOCKD *xd) { void vp9_inverse_transform_mb_16x16(MACROBLOCKD *xd) {
......
...@@ -278,7 +278,7 @@ void vp9_find_mv_refs( ...@@ -278,7 +278,7 @@ void vp9_find_mv_refs(
&index, c_refmv, ref_weight); &index, c_refmv, ref_weight);
// If there is a second valid mv then add it as well. // If there is a second valid mv then add it as well.
if (c2_ref_frame != INTRA_FRAME) { if (c2_ref_frame > INTRA_FRAME) {
scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias ); scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias );
ref_weight = ref_distance_weight[i] + ref_weight = ref_distance_weight[i] +
((c2_ref_frame == ref_frame) << 4); ((c2_ref_frame == ref_frame) << 4);
...@@ -304,7 +304,7 @@ void vp9_find_mv_refs( ...@@ -304,7 +304,7 @@ void vp9_find_mv_refs(
&index, c_refmv, ref_weight); &index, c_refmv, ref_weight);
// If there is a second valid mv then add it as well. // If there is a second valid mv then add it as well.
if (c2_ref_frame != INTRA_FRAME) { if (c2_ref_frame > INTRA_FRAME) {
scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias ); scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias );
ref_weight = ref_distance_weight[i] + ref_weight = ref_distance_weight[i] +
((c2_ref_frame == ref_frame) << 4); ((c2_ref_frame == ref_frame) << 4);
...@@ -337,7 +337,7 @@ void vp9_find_mv_refs( ...@@ -337,7 +337,7 @@ void vp9_find_mv_refs(
&index, c_refmv, ref_weight); &index, c_refmv, ref_weight);
// If there is a second valid mv then add it as well. // If there is a second valid mv then add it as well.
if (c2_ref_frame != INTRA_FRAME) { if (c2_ref_frame > INTRA_FRAME) {
scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias ); scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias );
ref_weight = ref_distance_weight[i] + ref_weight = ref_distance_weight[i] +
((c2_ref_frame == ref_frame) << 4); ((c2_ref_frame == ref_frame) << 4);
......
...@@ -382,8 +382,8 @@ static void combine_interintra(MB_PREDICTION_MODE mode, ...@@ -382,8 +382,8 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
// TODO(debargha): Explore different ways of combining predictors // TODO(debargha): Explore different ways of combining predictors
// or designing the tables below // or designing the tables below
static const int scale_bits = 8; static const int scale_bits = 8;
static const int scale_max = 1 << scale_bits; static const int scale_max = 256; // 1 << scale_bits;
static const int scale_round = (1 << scale_bits) - 1; static const int scale_round = 127; // (1 << (scale_bits - 1));
// This table is a function A + B*exp(-kx), where x is hor. index // This table is a function A + B*exp(-kx), where x is hor. index
static const int weights1d[32] = { static const int weights1d[32] = {
128, 122, 116, 111, 107, 103, 99, 96, 128, 122, 116, 111, 107, 103, 99, 96,
......
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#ifdef DEBUG_DEC_MV #ifdef DEBUG_DEC_MV
int dec_mvcount = 0; int dec_mvcount = 0;
#endif #endif
// #define DEC_DEBUG
#ifdef DEC_DEBUG
extern int dec_debug;
#endif
static int read_bmode(vp9_reader *bc, const vp9_prob *p) { static int read_bmode(vp9_reader *bc, const vp9_prob *p) {
B_PREDICTION_MODE m = treed_read(bc, vp9_bmode_tree, p); B_PREDICTION_MODE m = treed_read(bc, vp9_bmode_tree, p);
...@@ -775,6 +779,11 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, ...@@ -775,6 +779,11 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
xd->pre.u_buffer = cm->yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset; xd->pre.u_buffer = cm->yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset;
xd->pre.v_buffer = cm->yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset; xd->pre.v_buffer = cm->yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset;
#ifdef DEC_DEBUG
if (dec_debug)
printf("%d %d\n", xd->mode_info_context->mbmi.mv[0].as_mv.row,
xd->mode_info_context->mbmi.mv[0].as_mv.col);
#endif
vp9_find_mv_refs(xd, mi, prev_mi, vp9_find_mv_refs(xd, mi, prev_mi,
ref_frame, mbmi->ref_mvs[ref_frame], ref_frame, mbmi->ref_mvs[ref_frame],
cm->ref_frame_sign_bias); cm->ref_frame_sign_bias);
...@@ -787,6 +796,12 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, ...@@ -787,6 +796,12 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
vp9_mv_ref_probs(&pbi->common, mv_ref_p, vp9_mv_ref_probs(&pbi->common, mv_ref_p,
mbmi->mb_mode_context[ref_frame]); mbmi->mb_mode_context[ref_frame]);
#ifdef DEC_DEBUG
if (dec_debug)
printf("[D %d %d] %d %d %d %d\n", ref_frame,
mbmi->mb_mode_context[ref_frame],
mv_ref_p[0], mv_ref_p[1], mv_ref_p[2], mv_ref_p[3]);
#endif
} }
// Is the segment level mode feature enabled for this segment // Is the segment level mode feature enabled for this segment
......
This diff is collapsed.
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
#include "vpx_mem/vpx_mem.h" #include "vpx_mem/vpx_mem.h"
#include "vp9/decoder/vp9_onyxd_int.h" #include "vp9/decoder/vp9_onyxd_int.h"
#ifdef DEC_DEBUG
extern int dec_debug;
#endif
static void add_residual(const int16_t *diff, const uint8_t *pred, int pitch, static void add_residual(const int16_t *diff, const uint8_t *pred, int pitch,
uint8_t *dest, int stride, int width, int height) { uint8_t *dest, int stride, int width, int height) {
int r, c; int r, c;
...@@ -201,16 +197,6 @@ void vp9_dequantize_b_2x2_c(BLOCKD *d) { ...@@ -201,16 +197,6 @@ void vp9_dequantize_b_2x2_c(BLOCKD *d) {
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
DQ[i] = (int16_t)((Q[i] * DQC[i])); DQ[i] = (int16_t)((Q[i] * DQC[i]));
} }
#ifdef DEC_DEBUG
if (dec_debug) {
int j;
printf("Dequantize 2x2\n");
for (j = 0; j < 16; j++) printf("%d ", Q[j]);
printf("\n");
for (j = 0; j < 16; j++) printf("%d ", DQ[j]);
printf("\n");
}
#endif
} }
void vp9_dequant_idct_add_8x8_c(int16_t *input, const int16_t *dq, void vp9_dequant_idct_add_8x8_c(int16_t *input, const int16_t *dq,
...@@ -220,17 +206,6 @@ void vp9_dequant_idct_add_8x8_c(int16_t *input, const int16_t *dq, ...@@ -220,17 +206,6 @@ void vp9_dequant_idct_add_8x8_c(int16_t *input, const int16_t *dq,
int16_t *diff_ptr = output; int16_t *diff_ptr = output;
int i; int i;
#ifdef DEC_DEBUG
if (dec_debug) {
int j;
printf("Input 8x8\n");
for (j = 0; j < 64; j++) {
printf("%d ", input[j]);
if (j % 8 == 7) printf("\n");
}
}
#endif
/* If dc is 1, then input[0] is the reconstructed value, do not need /* If dc is 1, then input[0] is the reconstructed value, do not need
* dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1. * dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1.
*/ */
...@@ -282,47 +257,13 @@ void vp9_dequant_idct_add_8x8_c(int16_t *input, const int16_t *dq, ...@@ -282,47 +257,13 @@ void vp9_dequant_idct_add_8x8_c(int16_t *input, const int16_t *dq,
for (i = 1; i < 64; i++) { for (i = 1; i < 64; i++) {
input[i] = input[i] * dq[1]; input[i] = input[i] * dq[1];
} }
#ifdef DEC_DEBUG
if (dec_debug) {
int j;
printf("Input DQ 8x8\n");
for (j = 0; j < 64; j++) {
printf("%d ", input[j]);
if (j % 8 == 7) printf("\n");
}
}
#endif
// the idct halves ( >> 1) the pitch // the idct halves ( >> 1) the pitch
vp9_short_idct8x8_c(input, output, 16); vp9_short_idct8x8_c(input, output, 16);
#ifdef DEC_DEBUG
if (dec_debug) {
int j;
printf("Output 8x8\n");
for (j = 0; j < 64; j++) {
printf("%d ", output[j]);
if (j % 8 == 7) printf("\n");
}
}
#endif
vpx_memset(input, 0, 128); vpx_memset(input, 0, 128);
add_residual(diff_ptr, pred, pitch, dest, stride, 8, 8); add_residual(diff_ptr, pred, pitch, dest, stride, 8, 8);
#ifdef DEC_DEBUG
if (dec_debug) {
int k, j;
printf("Final 8x8\n");
for (j = 0; j < 8; j++) {
for (k = 0; k < 8; k++) {
printf("%d ", origdest[k]);
}
printf("\n");
origdest += stride;
}
}
#endif
} }
} }
......
...@@ -59,12 +59,11 @@ static const unsigned char cat6_prob[14] = ...@@ -59,12 +59,11 @@ static const unsigned char cat6_prob[14] =
{ 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0 }; { 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0 };
void vp9_reset_mb_tokens_context(MACROBLOCKD* const xd) { void vp9_reset_mb_tokens_context(MACROBLOCKD* const xd) {
/* Clear entropy contexts for Y2 blocks */ /* Clear entropy contexts */
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)
|| xd->mode_info_context->mbmi.txfm_size == TX_16X16 || xd->mode_info_context->mbmi.txfm_size == TX_16X16) {
) {
vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES)); vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES)); vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
} else { } else {
...@@ -309,10 +308,9 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi, ...@@ -309,10 +308,9 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
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;
int has_2nd_order = get_2nd_order_usage(xd);
// 2nd order DC block // 2nd order DC block
if (xd->mode_info_context->mbmi.mode != B_PRED && if (has_2nd_order) {
xd->mode_info_context->mbmi.mode != SPLITMV &&
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];
...@@ -325,6 +323,7 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi, ...@@ -325,6 +323,7 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
} else { } else {
xd->above_context->y2 = 1; xd->above_context->y2 = 1;
xd->left_context->y2 = 1; xd->left_context->y2 = 1;
eobs[24] = 0;
type = PLANE_TYPE_Y_WITH_DC; type = PLANE_TYPE_Y_WITH_DC;
} }
...@@ -336,7 +335,7 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi, ...@@ -336,7 +335,7 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
eobs[i] = c = decode_coefs(pbi, xd, bc, a, l, type, eobs[i] = c = decode_coefs(pbi, xd, bc, a, l, type,
type == PLANE_TYPE_Y_WITH_DC ? type == PLANE_TYPE_Y_WITH_DC ?
get_tx_type(xd, xd->block + i) : DCT_DCT, get_tx_type(xd, xd->block + i) : DCT_DCT,
seg_eob, xd->block[i].qcoeff, seg_eob, xd->block[i].qcoeff,
vp9_default_zig_zag1d_8x8, vp9_default_zig_zag1d_8x8,
TX_8X8, vp9_coef_bands_8x8); TX_8X8, vp9_coef_bands_8x8);
...@@ -392,7 +391,7 @@ int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd, ...@@ -392,7 +391,7 @@ int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
TX_TYPE tx_type = DCT_DCT; TX_TYPE tx_type = DCT_DCT;
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_4x4(xd, &xd->block[i]);
switch (tx_type) { switch (tx_type) {
case ADST_DCT : case ADST_DCT :
scan = vp9_row_scan; scan = vp9_row_scan;
...@@ -429,14 +428,15 @@ static int vp9_decode_mb_tokens_4x4(VP9D_COMP* const dx, ...@@ -429,14 +428,15 @@ static int vp9_decode_mb_tokens_4x4(VP9D_COMP* const dx,
int i, eobtotal = 0; int i, eobtotal = 0;
PLANE_TYPE type; PLANE_TYPE type;
if (xd->mode_info_context->mbmi.mode != B_PRED && int has_2nd_order = get_2nd_order_usage(xd);
xd->mode_info_context->mbmi.mode != I8X8_PRED &&