diff --git a/vp10/common/idct.c b/vp10/common/idct.c index 0e211ad67..fbae4aa12 100644 --- a/vp10/common/idct.c +++ b/vp10/common/idct.c @@ -15,6 +15,7 @@ #include "vp10/common/blockd.h" #include "vp10/common/enums.h" #include "vp10/common/idct.h" +#include "vp10/common/vp10_inv_txfm2d_cfg.h" #include "vpx_dsp/inv_txfm.h" #include "vpx_ports/mem.h" @@ -1288,7 +1289,11 @@ void vp10_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, switch (tx_type) { case DCT_DCT: - vp10_highbd_idct4x4_add(input, dest, stride, eob, bd); + if (bd == 10) + vp10_inv_txfm2d_add_4x4(input, CONVERT_TO_SHORTPTR(dest), stride, + &inv_txfm_2d_cfg_dct_dct_4, bd); + else + vp10_highbd_idct4x4_add(input, dest, stride, eob, bd); break; case ADST_DCT: case DCT_ADST: @@ -1327,7 +1332,11 @@ void vp10_highbd_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, TX_TYPE tx_type) { switch (tx_type) { case DCT_DCT: - vp10_highbd_idct8x8_add(input, dest, stride, eob, bd); + if (bd == 10) + vp10_inv_txfm2d_add_8x8(input, CONVERT_TO_SHORTPTR(dest), stride, + &inv_txfm_2d_cfg_dct_dct_8, bd); + else + vp10_highbd_idct8x8_add(input, dest, stride, eob, bd); break; case ADST_DCT: case DCT_ADST: @@ -1366,7 +1375,11 @@ void vp10_highbd_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest, TX_TYPE tx_type) { switch (tx_type) { case DCT_DCT: - vp10_highbd_idct16x16_add(input, dest, stride, eob, bd); + if (bd == 10) + vp10_inv_txfm2d_add_16x16(input, CONVERT_TO_SHORTPTR(dest), stride, + &inv_txfm_2d_cfg_dct_dct_16, bd); + else + vp10_highbd_idct16x16_add(input, dest, stride, eob, bd); break; case ADST_DCT: case DCT_ADST: diff --git a/vp10/encoder/encodemb.c b/vp10/encoder/encodemb.c index c42b7f1db..00f2e0385 100644 --- a/vp10/encoder/encodemb.c +++ b/vp10/encoder/encodemb.c @@ -377,6 +377,7 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block, int blk_row, src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)]; #if CONFIG_VP9_HIGHBITDEPTH + fwd_txfm_param.bd = xd->bd; if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { highbd_fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param); if (xform_quant_idx != VP10_XFORM_QUANT_SKIP_QUANT) { diff --git a/vp10/encoder/hybrid_fwd_txfm.c b/vp10/encoder/hybrid_fwd_txfm.c index e9dd70be6..8a19a4015 100644 --- a/vp10/encoder/hybrid_fwd_txfm.c +++ b/vp10/encoder/hybrid_fwd_txfm.c @@ -13,6 +13,7 @@ #include "./vpx_dsp_rtcd.h" #include "vp10/common/idct.h" +#include "vp10/common/vp10_fwd_txfm2d_cfg.h" #include "vp10/encoder/hybrid_fwd_txfm.h" static INLINE void fdct32x32(int rd_transform, const int16_t *src, @@ -193,7 +194,8 @@ static void fwd_txfm_32x32(int rd_transform, const int16_t *src_diff, #if CONFIG_VP9_HIGHBITDEPTH void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff, - int diff_stride, TX_TYPE tx_type, int lossless) { + int diff_stride, TX_TYPE tx_type, int lossless, + const int bd) { if (lossless) { assert(tx_type == DCT_DCT); vp10_highbd_fwht4x4(src_diff, coeff, diff_stride); @@ -202,7 +204,12 @@ void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff, switch (tx_type) { case DCT_DCT: - vp10_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type); + if (bd == 10) { + vp10_fwd_txfm2d_4x4(src_diff, coeff, diff_stride, + &fwd_txfm_2d_cfg_dct_dct_4, bd); + } else { + vp10_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type); + } break; case ADST_DCT: case DCT_ADST: @@ -237,10 +244,15 @@ void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff, static void highbd_fwd_txfm_8x8(const int16_t *src_diff, tran_low_t *coeff, int diff_stride, TX_TYPE tx_type, - FWD_TXFM_OPT fwd_txfm_opt) { + FWD_TXFM_OPT fwd_txfm_opt, const int bd) { (void)fwd_txfm_opt; switch (tx_type) { case DCT_DCT: + if (bd == 10) { + vp10_fwd_txfm2d_8x8(src_diff, coeff, diff_stride, + &fwd_txfm_2d_cfg_dct_dct_8, bd); + break; + } case ADST_DCT: case DCT_ADST: case ADST_ADST: @@ -278,10 +290,15 @@ static void highbd_fwd_txfm_8x8(const int16_t *src_diff, tran_low_t *coeff, static void highbd_fwd_txfm_16x16(const int16_t *src_diff, tran_low_t *coeff, int diff_stride, TX_TYPE tx_type, - FWD_TXFM_OPT fwd_txfm_opt) { + FWD_TXFM_OPT fwd_txfm_opt, const int bd) { (void)fwd_txfm_opt; switch (tx_type) { case DCT_DCT: + if (bd == 10) { + vp10_fwd_txfm2d_16x16(src_diff, coeff, diff_stride, + &fwd_txfm_2d_cfg_dct_dct_16, bd); + break; + } case ADST_DCT: case DCT_ADST: case ADST_ADST: @@ -319,7 +336,9 @@ static void highbd_fwd_txfm_16x16(const int16_t *src_diff, tran_low_t *coeff, static void highbd_fwd_txfm_32x32(int rd_transform, const int16_t *src_diff, tran_low_t *coeff, int diff_stride, - TX_TYPE tx_type, FWD_TXFM_OPT fwd_txfm_opt) { + TX_TYPE tx_type, FWD_TXFM_OPT fwd_txfm_opt, + const int bd) { + (void)bd; switch (tx_type) { case DCT_DCT: if (fwd_txfm_opt == FWD_TXFM_OPT_NORMAL) @@ -390,20 +409,23 @@ void highbd_fwd_txfm(const int16_t *src_diff, tran_low_t *coeff, const TX_SIZE tx_size = fwd_txfm_param->tx_size; const int rd_transform = fwd_txfm_param->rd_transform; const int lossless = fwd_txfm_param->lossless; + const int bd = fwd_txfm_param->bd; switch (tx_size) { case TX_32X32: highbd_fwd_txfm_32x32(rd_transform, src_diff, coeff, diff_stride, tx_type, - fwd_txfm_opt); + fwd_txfm_opt, bd); break; case TX_16X16: highbd_fwd_txfm_16x16(src_diff, coeff, diff_stride, tx_type, - fwd_txfm_opt); + fwd_txfm_opt, bd); break; case TX_8X8: - highbd_fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type, fwd_txfm_opt); + highbd_fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type, + fwd_txfm_opt, bd); break; case TX_4X4: - vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, lossless); + vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, + lossless, bd); break; default: assert(0); diff --git a/vp10/encoder/hybrid_fwd_txfm.h b/vp10/encoder/hybrid_fwd_txfm.h index 62b8d5acb..d5c5a9d6b 100644 --- a/vp10/encoder/hybrid_fwd_txfm.h +++ b/vp10/encoder/hybrid_fwd_txfm.h @@ -21,6 +21,9 @@ typedef struct FWD_TXFM_PARAM { FWD_TXFM_OPT fwd_txfm_opt; int rd_transform; int lossless; +#if CONFIG_VP9_HIGHBITDEPTH + int bd; +#endif // CONFIG_VP9_HIGHBITDEPTH } FWD_TXFM_PARAM; #ifdef __cplusplus @@ -36,7 +39,8 @@ void vp10_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff, void highbd_fwd_txfm(const int16_t *src_diff, tran_low_t *coeff, int diff_stride, FWD_TXFM_PARAM *fwd_txfm_param); void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff, - int diff_stride, TX_TYPE tx_type, int lossless); + int diff_stride, TX_TYPE tx_type, int lossless, + const int bd); #endif // CONFIG_VP9_HIGHBITDEPTH static INLINE int get_tx1d_size(TX_SIZE tx_size) { diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c index d73675163..ba113d7b4 100644 --- a/vp10/encoder/rdopt.c +++ b/vp10/encoder/rdopt.c @@ -1970,7 +1970,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, const int coeff_ctx = combine_entropy_contexts(*(tempa + idx), *(templ + idy)); #endif // CONFIG_VAR_TX - vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1); + vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1, xd->bd); vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); #if CONFIG_VAR_TX ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan, @@ -1997,7 +1997,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, const int coeff_ctx = combine_entropy_contexts(*(tempa + idx), *(templ + idy)); #endif // CONFIG_VAR_TX - vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0); + vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0, xd->bd); vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); #if CONFIG_VAR_TX ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan, @@ -4305,7 +4305,7 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi, #if CONFIG_VP9_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, - xd->lossless[mi->mbmi.segment_id]); + xd->lossless[mi->mbmi.segment_id], xd->bd); } else { vp10_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, xd->lossless[mi->mbmi.segment_id]);