diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index 7b2be31c00aaf0e26654b1655f6e7965d9d35c8a..054d58dba63500587891edc6d1f7aad145dc55cd 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -624,6 +624,9 @@ static TX_TYPE get_tx_type(const MACROBLOCKD *xd, const BLOCKD *b) { } static int get_2nd_order_usage(const MACROBLOCKD *xd) { +#if 1 + return 0; +#else 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 && @@ -631,6 +634,7 @@ static int get_2nd_order_usage(const MACROBLOCKD *xd) { if (has_2nd_order) has_2nd_order = (get_tx_type(xd, xd->block) == DCT_DCT); return has_2nd_order; +#endif } extern void vp9_build_block_doffsets(MACROBLOCKD *xd); diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 04e3fe5b3b794175b78e4ac6100cd9765ea0b49a..facd761f0af1e57e99909b2fb556db88964a9357 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -297,7 +297,8 @@ static void decode_8x8(VP9D_COMP *pbi, MACROBLOCKD *xd, 0, xd->eobs[idx]); } } - } else if (xd->mode_info_context->mbmi.mode == SPLITMV) { + } else if (xd->mode_info_context->mbmi.mode == SPLITMV || + get_2nd_order_usage(xd) == 0) { assert(get_2nd_order_usage(xd) == 0); vp9_dequant_idct_add_y_block_8x8(xd->qcoeff, xd->block[0].dequant, @@ -443,7 +444,7 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd, xd->dst.v_buffer, xd->dst.uv_stride, xd->eobs + 16); - } else if (mode == SPLITMV) { + } else if (mode == SPLITMV || get_2nd_order_usage(xd) == 0) { assert(get_2nd_order_usage(xd) == 0); xd->itxm_add_y_block(xd->qcoeff, xd->block[0].dequant, @@ -588,13 +589,8 @@ static void decode_8x8_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, + x_idx * 16 + (i & 1) * 8, stride, stride, 0, b->eob); } - vp9_dequant_idct_add_uv_block_8x8_inplace_c( - xd->qcoeff + 16 * 16, xd->block[16].dequant, - xd->dst.u_buffer + y_idx * 8 * xd->dst.uv_stride + x_idx * 8, - xd->dst.v_buffer + y_idx * 8 * xd->dst.uv_stride + x_idx * 8, - xd->dst.uv_stride, xd->eobs + 16, xd); } - } else { + } else if (get_2nd_order_usage(xd) == 1) { vp9_dequantize_b_2x2(b); vp9_short_ihaar2x2(&b->dqcoeff[0], b->diff, 8); ((int *)b->qcoeff)[0] = 0; // 2nd order block are set to 0 after idct @@ -609,12 +605,17 @@ static void decode_8x8_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, xd->qcoeff, xd->block[0].dequant, xd->dst.y_buffer + y_idx * 16 * xd->dst.y_stride + x_idx * 16, xd->dst.y_stride, xd->eobs, xd->block[24].diff, xd); - vp9_dequant_idct_add_uv_block_8x8_inplace_c( - xd->qcoeff + 16 * 16, xd->block[16].dequant, - xd->dst.u_buffer + y_idx * 8 * xd->dst.uv_stride + x_idx * 8, - xd->dst.v_buffer + y_idx * 8 * xd->dst.uv_stride + x_idx * 8, - xd->dst.uv_stride, xd->eobs + 16, xd); + } else { + vp9_dequant_idct_add_y_block_8x8_inplace_c( + xd->qcoeff, xd->block[0].dequant, + xd->dst.y_buffer + y_idx * 16 * xd->dst.y_stride + x_idx * 16, + xd->dst.y_stride, xd->eobs, xd); } + vp9_dequant_idct_add_uv_block_8x8_inplace_c( + xd->qcoeff + 16 * 16, xd->block[16].dequant, + xd->dst.u_buffer + y_idx * 8 * xd->dst.uv_stride + x_idx * 8, + xd->dst.v_buffer + y_idx * 8 * xd->dst.uv_stride + x_idx * 8, + xd->dst.uv_stride, xd->eobs + 16, xd); }; static void decode_4x4_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, @@ -646,7 +647,7 @@ static void decode_4x4_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, xd->dst.y_stride, xd->dst.y_stride); } } - } else { + } else if (get_2nd_order_usage(xd) == 1) { vp9_dequantize_b(b); if (xd->eobs[24] > 1) { xd->inv_2ndtxm4x4(&b->dqcoeff[0], b->diff); @@ -666,6 +667,11 @@ static void decode_4x4_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, xd->qcoeff, xd->block[0].dequant, xd->dst.y_buffer + y_idx * 16 * xd->dst.y_stride + x_idx * 16, xd->dst.y_stride, xd->eobs, xd->block[24].diff, xd); + } else { + vp9_dequant_idct_add_y_block_4x4_inplace_c( + xd->qcoeff, xd->block[0].dequant, + xd->dst.y_buffer + y_idx * 16 * xd->dst.y_stride + x_idx * 16, + xd->dst.y_stride, xd->eobs, xd); } vp9_dequant_idct_add_uv_block_4x4_inplace_c( xd->qcoeff + 16 * 16, xd->block[16].dequant, diff --git a/vp9/decoder/vp9_dequantize.h b/vp9/decoder/vp9_dequantize.h index 0fa5144a771f5cad6e2703089c0e4aa6c141c6b5..b7efb44f141fc4812274454bd76104893b5e69ce 100644 --- a/vp9/decoder/vp9_dequantize.h +++ b/vp9/decoder/vp9_dequantize.h @@ -63,6 +63,12 @@ void vp9_dequant_dc_idct_add_y_block_8x8_inplace_c(int16_t *q, const int16_t *dq const int16_t *dc, MACROBLOCKD *xd); +void vp9_dequant_idct_add_y_block_8x8_inplace_c(int16_t *q, const int16_t *dq, + unsigned char *dst, + int stride, + uint16_t *eobs, + MACROBLOCKD *xd); + void vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(int16_t *q, const int16_t *dq, unsigned char *dst, int stride, @@ -70,6 +76,12 @@ void vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(int16_t *q, const int16_t *dq const int16_t *dc, MACROBLOCKD *xd); +void vp9_dequant_idct_add_y_block_4x4_inplace_c(int16_t *q, const int16_t *dq, + unsigned char *dst, + int stride, + uint16_t *eobs, + MACROBLOCKD *xd); + void vp9_dequant_idct_add_uv_block_8x8_inplace_c(int16_t *q, const int16_t *dq, unsigned char *dstu, unsigned char *dstv, diff --git a/vp9/decoder/vp9_idct_blk.c b/vp9/decoder/vp9_idct_blk.c index c3f14648042c7f92da351de8108705f135888eff..80b301931a8ebd1fd19ee1f78e19f8b284d61f4f 100644 --- a/vp9/decoder/vp9_idct_blk.c +++ b/vp9/decoder/vp9_idct_blk.c @@ -64,6 +64,31 @@ void vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(int16_t *q, } } +void vp9_dequant_idct_add_y_block_4x4_inplace_c(int16_t *q, + const int16_t *dq, + uint8_t *dst, + int stride, + uint16_t *eobs, + MACROBLOCKD *xd) { + int i, j; + + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + if (*eobs++ > 1) { + vp9_dequant_idct_add_c(q, dq, dst, dst, stride, stride); + } else { + vp9_dc_only_idct_add_c(q[0]*dq[0], dst, dst, stride, stride); + ((int *)q)[0] = 0; + } + + q += 16; + dst += 4; + } + + dst += 4 * stride - 16; + } +} + void vp9_dequant_idct_add_y_block_c(int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, @@ -221,6 +246,26 @@ void vp9_dequant_dc_idct_add_y_block_8x8_inplace_c(int16_t *q, xd->eobs[12]); } +void vp9_dequant_idct_add_y_block_8x8_inplace_c(int16_t *q, + const int16_t *dq, + uint8_t *dst, + int stride, + uint16_t *eobs, + MACROBLOCKD *xd) { + vp9_dequant_idct_add_8x8_c(q, dq, dst, dst, stride, stride, 0, xd->eobs[0]); + + vp9_dequant_idct_add_8x8_c(&q[64], dq, dst + 8, + dst + 8, stride, stride, 0, xd->eobs[4]); + + vp9_dequant_idct_add_8x8_c(&q[128], dq, dst + 8 * stride, + dst + 8 * stride, stride, stride, 0, + xd->eobs[8]); + + vp9_dequant_idct_add_8x8_c(&q[192], dq, dst + 8 * stride + 8, + dst + 8 * stride + 8, stride, stride, 0, + xd->eobs[12]); +} + void vp9_dequant_idct_add_y_block_8x8_c(int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst,