Parameterize transform scale for quantizer This is to facilitate changing transform scale later Change-Id: Ic8ca5afba57d2489ebd191ccc40c1b31605a0d8c
diff --git a/vp10/common/idct.c b/vp10/common/idct.c index 47a3219..b06a5e9 100644 --- a/vp10/common/idct.c +++ b/vp10/common/idct.c
@@ -19,6 +19,23 @@ #include "vpx_dsp/inv_txfm.h" #include "vpx_ports/mem.h" +int get_tx_scale(const MACROBLOCKD *const xd, const TX_TYPE tx_type, + const TX_SIZE tx_size) { + (void) tx_type; +#if CONFIG_VP9_HIGHBITDEPTH + if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { + if (xd->bd == BITDEPTH_10) { + return 0; + } else { + return tx_size == TX_32X32; + } + } +#else + (void)xd; +#endif + return tx_size == TX_32X32; +} + #if CONFIG_EXT_TX static void iidtx4_c(const tran_low_t *input, tran_low_t *output) { int i;
diff --git a/vp10/common/idct.h b/vp10/common/idct.h index 31b26b8..ffdad0c 100644 --- a/vp10/common/idct.h +++ b/vp10/common/idct.h
@@ -14,6 +14,7 @@ #include <assert.h> #include "./vpx_config.h" +#include "vp10/common/blockd.h" #include "vp10/common/common.h" #include "vp10/common/enums.h" #include "vpx_dsp/inv_txfm.h" @@ -48,6 +49,10 @@ } highbd_transform_2d; #endif // CONFIG_VP9_HIGHBITDEPTH +#define MAX_TX_SCALE 1 +int get_tx_scale(const MACROBLOCKD *const xd, const TX_TYPE tx_type, + const TX_SIZE tx_size); + void vp10_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride, int eob); void vp10_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
diff --git a/vp10/decoder/detokenize.c b/vp10/decoder/detokenize.c index bf48221..cfc19d4 100644 --- a/vp10/decoder/detokenize.c +++ b/vp10/decoder/detokenize.c
@@ -15,9 +15,7 @@ #include "vp10/common/blockd.h" #include "vp10/common/common.h" #include "vp10/common/entropy.h" -#if CONFIG_COEFFICIENT_RANGE_CHECKING #include "vp10/common/idct.h" -#endif #include "vp10/decoder/detokenize.h" @@ -113,15 +111,7 @@ cat6_prob = vp10_cat6_prob; #endif -#if CONFIG_VP9_HIGHBITDEPTH - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH && xd->bd == BITDEPTH_10) { - dq_shift = 0; - } else { - dq_shift = (tx_size == TX_32X32); - } -#else - dq_shift = (tx_size == TX_32X32); -#endif + dq_shift = get_tx_scale(xd, 0, tx_size); while (c < max_eob) { int val = -1; @@ -257,15 +247,7 @@ const uint8_t *cat5_prob; const uint8_t *cat6_prob; -#if CONFIG_VP9_HIGHBITDEPTH - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH && xd->bd == BITDEPTH_10) { - dq_shift = 0; - } else { - dq_shift = (tx_size == TX_32X32); - } -#else - dq_shift = (tx_size == TX_32X32); -#endif + dq_shift = get_tx_scale(xd, 0, tx_size); if (counts) { coef_counts = counts->coef[tx_size][type][ref];
diff --git a/vp10/encoder/encodemb.c b/vp10/encoder/encodemb.c index 429ac4f..060fe0b 100644 --- a/vp10/encoder/encodemb.c +++ b/vp10/encoder/encodemb.c
@@ -129,15 +129,7 @@ assert((!type && !plane) || (type && plane)); assert(eob <= default_eob); -#if CONFIG_VP9_HIGHBITDEPTH - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH && xd->bd == BITDEPTH_10) { - mul = 1; - } else { - mul = 1 + (tx_size == TX_32X32); - } -#else - mul = 1 + (tx_size == TX_32X32); -#endif + mul = 1 << get_tx_scale(xd, tx_type, tx_size); /* Now set up a Viterbi trellis to evaluate alternative roundings. */ if (!ref) @@ -323,35 +315,29 @@ #if CONFIG_VP9_HIGHBITDEPTH typedef enum QUANT_FUNC { QUANT_FUNC_LOWBD = 0, - QUANT_FUNC_LOWBD_32 = 1, - QUANT_FUNC_HIGHBD = 2, - QUANT_FUNC_HIGHBD_32 = 3, - QUANT_FUNC_LAST = 4 -} QUANT_FUNC; - -static VP10_QUANT_FACADE - quant_func_list[VP10_XFORM_QUANT_LAST][QUANT_FUNC_LAST] = { - {vp10_quantize_fp_facade, vp10_quantize_fp_32x32_facade, - vp10_highbd_quantize_fp_facade, vp10_highbd_quantize_fp_32x32_facade}, - {vp10_quantize_b_facade, vp10_quantize_b_32x32_facade, - vp10_highbd_quantize_b_facade, vp10_highbd_quantize_b_32x32_facade}, - {vp10_quantize_dc_facade, vp10_quantize_dc_32x32_facade, - vp10_highbd_quantize_dc_facade, vp10_highbd_quantize_dc_32x32_facade}, - {NULL, NULL, NULL, NULL}}; - -#else -typedef enum QUANT_FUNC { - QUANT_FUNC_LOWBD = 0, - QUANT_FUNC_LOWBD_32 = 1, + QUANT_FUNC_HIGHBD = 1, QUANT_FUNC_LAST = 2 } QUANT_FUNC; static VP10_QUANT_FACADE quant_func_list[VP10_XFORM_QUANT_LAST][QUANT_FUNC_LAST] = { - {vp10_quantize_fp_facade, vp10_quantize_fp_32x32_facade}, - {vp10_quantize_b_facade, vp10_quantize_b_32x32_facade}, - {vp10_quantize_dc_facade, vp10_quantize_dc_32x32_facade}, + {vp10_quantize_fp_facade, vp10_highbd_quantize_fp_facade}, + {vp10_quantize_b_facade, vp10_highbd_quantize_b_facade}, + {vp10_quantize_dc_facade, vp10_highbd_quantize_dc_facade}, {NULL, NULL}}; + +#else +typedef enum QUANT_FUNC { + QUANT_FUNC_LOWBD = 0, + QUANT_FUNC_LAST = 1 +} QUANT_FUNC; + +static VP10_QUANT_FACADE + quant_func_list[VP10_XFORM_QUANT_LAST][QUANT_FUNC_LAST] = { + {vp10_quantize_fp_facade}, + {vp10_quantize_b_facade}, + {vp10_quantize_dc_facade}, + {NULL}}; #endif static FWD_TXFM_OPT fwd_txfm_opt_list[VP10_XFORM_QUANT_LAST] = { @@ -378,7 +364,9 @@ const int tx2d_size = tx1d_size * tx1d_size; FWD_TXFM_PARAM fwd_txfm_param; - fwd_txfm_param.tx_type = get_tx_type(plane_type, xd, block, tx_size); + QUANT_PARAM qparam; + + fwd_txfm_param.tx_type = tx_type; fwd_txfm_param.tx_size = tx_size; fwd_txfm_param.fwd_txfm_opt = fwd_txfm_opt_list[xform_quant_idx]; fwd_txfm_param.rd_transform = x->use_lp32x32fdct; @@ -386,6 +374,7 @@ src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)]; + qparam.log_scale = get_tx_scale(xd, tx_type, tx_size); #if CONFIG_VP9_HIGHBITDEPTH fwd_txfm_param.bd = xd->bd; if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { @@ -394,12 +383,9 @@ if (x->skip_block) { vp10_quantize_skip(tx2d_size, qcoeff, dqcoeff, eob); } else { - if (tx_size == TX_32X32 && xd->bd != 10) - quant_func_list[xform_quant_idx][QUANT_FUNC_HIGHBD_32]( - coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob, scan_order); - else - quant_func_list[xform_quant_idx][QUANT_FUNC_HIGHBD]( - coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob, scan_order); + quant_func_list[xform_quant_idx][QUANT_FUNC_HIGHBD]( + coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob, + scan_order, &qparam); } } return; @@ -411,12 +397,9 @@ if (x->skip_block) { vp10_quantize_skip(tx2d_size, qcoeff, dqcoeff, eob); } else { - if (tx_size == TX_32X32) - quant_func_list[xform_quant_idx][QUANT_FUNC_LOWBD_32]( - coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob, scan_order); - else - quant_func_list[xform_quant_idx][QUANT_FUNC_LOWBD]( - coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob, scan_order); + quant_func_list[xform_quant_idx][QUANT_FUNC_LOWBD]( + coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob, + scan_order, &qparam); } } }
diff --git a/vp10/encoder/quantize.c b/vp10/encoder/quantize.c index 3f8f0f4..e1d0add 100644 --- a/vp10/encoder/quantize.c +++ b/vp10/encoder/quantize.c
@@ -33,52 +33,79 @@ const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc) { + const scan_order *sc, const QUANT_PARAM *qparam) { // obsolete skip_block const int skip_block = 0; - vp10_quantize_fp(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round_fp, - p->quant_fp, p->quant_shift, qcoeff_ptr, dqcoeff_ptr, - pd->dequant, eob_ptr, sc->scan, sc->iscan); + if (qparam->log_scale == 0) { + vp10_quantize_fp(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round_fp, + p->quant_fp, p->quant_shift, qcoeff_ptr, dqcoeff_ptr, + pd->dequant, eob_ptr, sc->scan, sc->iscan); + } else { + vp10_quantize_fp_32x32(coeff_ptr, n_coeffs, skip_block, p->zbin, + p->round_fp, p->quant_fp, p->quant_shift, qcoeff_ptr, + dqcoeff_ptr, pd->dequant, eob_ptr, sc->scan, + sc->iscan); + } } void vp10_quantize_b_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc) { + const scan_order *sc, const QUANT_PARAM *qparam) { // obsolete skip_block const int skip_block = 0; - vpx_quantize_b(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round, p->quant, - p->quant_shift, qcoeff_ptr, dqcoeff_ptr, pd->dequant, eob_ptr, - sc->scan, sc->iscan); + if (qparam->log_scale == 0) { + vpx_quantize_b(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round, p->quant, + p->quant_shift, qcoeff_ptr, dqcoeff_ptr, pd->dequant, + eob_ptr, sc->scan, sc->iscan); + } else { + vpx_quantize_b_32x32(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round, + p->quant, p->quant_shift, qcoeff_ptr, dqcoeff_ptr, + pd->dequant, eob_ptr, sc->scan, sc->iscan); + } } void vp10_quantize_dc_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc) { + const scan_order *sc, const QUANT_PARAM *qparam) { // obsolete skip_block const int skip_block = 0; (void)sc; - vpx_quantize_dc(coeff_ptr, (int)n_coeffs, skip_block, p->round, - p->quant_fp[0], qcoeff_ptr, dqcoeff_ptr, pd->dequant[0], - eob_ptr); + if (qparam->log_scale == 0) { + vpx_quantize_dc(coeff_ptr, (int)n_coeffs, skip_block, p->round, + p->quant_fp[0], qcoeff_ptr, dqcoeff_ptr, pd->dequant[0], + eob_ptr); + } else { + vpx_quantize_dc_32x32(coeff_ptr, skip_block, p->round, p->quant_fp[0], + qcoeff_ptr, dqcoeff_ptr, pd->dequant[0], eob_ptr); + } } #if CONFIG_VP9_HIGHBITDEPTH void vp10_highbd_quantize_fp_facade( const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc) { + tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc, + const QUANT_PARAM *qparam) { // obsolete skip_block const int skip_block = 0; - vp10_highbd_quantize_fp(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round_fp, - p->quant_fp, p->quant_shift, qcoeff_ptr, dqcoeff_ptr, - pd->dequant, eob_ptr, sc->scan, sc->iscan); + if (qparam->log_scale == 0) { + vp10_highbd_quantize_fp(coeff_ptr, n_coeffs, skip_block, p->zbin, + p->round_fp, p->quant_fp, p->quant_shift, + qcoeff_ptr, dqcoeff_ptr, pd->dequant, eob_ptr, + sc->scan, sc->iscan); + } else { + vp10_highbd_quantize_fp_32x32(coeff_ptr, n_coeffs, skip_block, p->zbin, + p->round_fp, p->quant_fp, p->quant_shift, + qcoeff_ptr, dqcoeff_ptr, pd->dequant, eob_ptr, + sc->scan, sc->iscan); + } } void vp10_highbd_quantize_b_facade(const tran_low_t *coeff_ptr, @@ -86,114 +113,42 @@ tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc) { + const scan_order *sc, + const QUANT_PARAM *qparam) { // obsolete skip_block const int skip_block = 0; - vpx_highbd_quantize_b(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round, - p->quant, p->quant_shift, qcoeff_ptr, dqcoeff_ptr, - pd->dequant, eob_ptr, sc->scan, sc->iscan); + if (qparam->log_scale == 0) { + vpx_highbd_quantize_b(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round, + p->quant, p->quant_shift, qcoeff_ptr, dqcoeff_ptr, + pd->dequant, eob_ptr, sc->scan, sc->iscan); + } else { + vpx_highbd_quantize_b_32x32(coeff_ptr, n_coeffs, skip_block, p->zbin, + p->round, p->quant, p->quant_shift, qcoeff_ptr, + dqcoeff_ptr, pd->dequant, eob_ptr, sc->scan, + sc->iscan); + } } void vp10_highbd_quantize_dc_facade( const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc) { + tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc, + const QUANT_PARAM *qparam) { // obsolete skip_block const int skip_block = 0; (void)sc; - vpx_highbd_quantize_dc(coeff_ptr, (int)n_coeffs, skip_block, p->round, - p->quant_fp[0], qcoeff_ptr, dqcoeff_ptr, - pd->dequant[0], eob_ptr); -} -#endif // CONFIG_VP9_HIGHBITDEPTH - -void vp10_quantize_fp_32x32_facade(const tran_low_t *coeff_ptr, - intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, - const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc) { - // obsolete skip_block - const int skip_block = 0; - - vp10_quantize_fp_32x32(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round_fp, - p->quant_fp, p->quant_shift, qcoeff_ptr, dqcoeff_ptr, - pd->dequant, eob_ptr, sc->scan, sc->iscan); -} - -void vp10_quantize_b_32x32_facade(const tran_low_t *coeff_ptr, - intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, - const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc) { - // obsolete skip_block - const int skip_block = 0; - - vpx_quantize_b_32x32(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round, - p->quant, p->quant_shift, qcoeff_ptr, dqcoeff_ptr, - pd->dequant, eob_ptr, sc->scan, sc->iscan); -} - -void vp10_quantize_dc_32x32_facade(const tran_low_t *coeff_ptr, - intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, - const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc) { - // obsolete skip_block - const int skip_block = 0; - - (void)sc; - (void)n_coeffs; - - vpx_quantize_dc_32x32(coeff_ptr, skip_block, p->round, p->quant_fp[0], - qcoeff_ptr, dqcoeff_ptr, pd->dequant[0], eob_ptr); -} - -#if CONFIG_VP9_HIGHBITDEPTH -void vp10_highbd_quantize_fp_32x32_facade( - const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc) { - // obsolete skip_block - const int skip_block = 0; - - vp10_highbd_quantize_fp_32x32(coeff_ptr, n_coeffs, skip_block, p->zbin, - p->round_fp, p->quant_fp, p->quant_shift, - qcoeff_ptr, dqcoeff_ptr, pd->dequant, eob_ptr, - sc->scan, sc->iscan); -} - -void vp10_highbd_quantize_b_32x32_facade( - const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc) { - // obsolete skip_block - const int skip_block = 0; - - vpx_highbd_quantize_b_32x32(coeff_ptr, n_coeffs, skip_block, p->zbin, - p->round, p->quant, p->quant_shift, qcoeff_ptr, - dqcoeff_ptr, pd->dequant, eob_ptr, sc->scan, - sc->iscan); -} - -void vp10_highbd_quantize_dc_32x32_facade( - const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc) { - // obsolete skip_block - const int skip_block = 0; - - (void)sc; - (void)n_coeffs; - - vpx_highbd_quantize_dc_32x32(coeff_ptr, skip_block, p->round, p->quant_fp[0], - qcoeff_ptr, dqcoeff_ptr, pd->dequant[0], - eob_ptr); + if (qparam->log_scale == 0) { + vpx_highbd_quantize_dc(coeff_ptr, (int)n_coeffs, skip_block, p->round, + p->quant_fp[0], qcoeff_ptr, dqcoeff_ptr, + pd->dequant[0], eob_ptr); + } else { + vpx_highbd_quantize_dc_32x32(coeff_ptr, skip_block, p->round, + p->quant_fp[0], qcoeff_ptr, dqcoeff_ptr, + pd->dequant[0], eob_ptr); + } } #endif // CONFIG_VP9_HIGHBITDEPTH
diff --git a/vp10/encoder/quantize.h b/vp10/encoder/quantize.h index 6128460..92ffd5c 100644 --- a/vp10/encoder/quantize.h +++ b/vp10/encoder/quantize.h
@@ -19,12 +19,17 @@ extern "C" { #endif +typedef struct QUANT_PARAM { + int log_scale; +} QUANT_PARAM; + typedef void (*VP10_QUANT_FACADE)(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc); + const scan_order *sc, + const QUANT_PARAM *qparam); typedef struct { // 0: dc 1: ac 2-8: ac repeated to SIMD width @@ -48,7 +53,6 @@ void vp10_regular_quantize_b_4x4(MACROBLOCK *x, int plane, int block, const int16_t *scan, const int16_t *iscan); - struct VP10_COMP; struct VP10Common; @@ -71,74 +75,41 @@ const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc); + const scan_order *sc, const QUANT_PARAM *qparam); void vp10_quantize_b_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc); + const scan_order *sc, const QUANT_PARAM *qparam); void vp10_quantize_dc_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc); + const scan_order *sc, const QUANT_PARAM *qparam); #if CONFIG_VP9_HIGHBITDEPTH void vp10_highbd_quantize_fp_facade( const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc); + tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc, + const QUANT_PARAM *qparam); void vp10_highbd_quantize_b_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc); + const scan_order *sc, + const QUANT_PARAM *qparam); void vp10_highbd_quantize_dc_facade( const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc); + tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc, + const QUANT_PARAM *qparam); #endif // CONFIG_VP9_HIGHBITDEPTH -void vp10_quantize_fp_32x32_facade(const tran_low_t *coeff_ptr, - intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, - const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc); - -void vp10_quantize_b_32x32_facade(const tran_low_t *coeff_ptr, - intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, - const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc); - -void vp10_quantize_dc_32x32_facade(const tran_low_t *coeff_ptr, - intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, - const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, - const scan_order *sc); -#if CONFIG_VP9_HIGHBITDEPTH -void vp10_highbd_quantize_fp_32x32_facade( - const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc); - -void vp10_highbd_quantize_b_32x32_facade( - const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc); - -void vp10_highbd_quantize_dc_32x32_facade( - const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p, - tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd, - tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc); -#endif // CONFIG_VP9_HIGHBITDEPTH #ifdef __cplusplus } // extern "C" #endif
diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c index 328e70c..c317c05 100644 --- a/vp10/encoder/rdopt.c +++ b/vp10/encoder/rdopt.c
@@ -1003,7 +1003,7 @@ const struct macroblock_plane *const p = &x->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane]; int64_t this_sse; - int shift = tx_size == TX_32X32 ? 0 : 2; + int shift = (MAX_TX_SCALE - get_tx_scale(xd, 0, tx_size)) * 2; tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block); tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); #if CONFIG_VP9_HIGHBITDEPTH @@ -1177,19 +1177,11 @@ const int64_t orig_sse = (int64_t)coeff[0] * coeff[0]; const int64_t resd_sse = coeff[0] - dqcoeff[0]; int64_t dc_correct = orig_sse - resd_sse * resd_sse; + int shift = (MAX_TX_SCALE - get_tx_scale(xd, 0, tx_size)) * 2; #if CONFIG_VP9_HIGHBITDEPTH dc_correct >>= ((xd->bd - 8) * 2); - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH && - xd->bd == BITDEPTH_10) { - dc_correct >>= 2; - } else { - if (tx_size != TX_32X32) - dc_correct >>= 2; - } -#else - if (tx_size != TX_32X32) - dc_correct >>= 2; #endif + dc_correct >>= shift; dist = VPXMAX(0, sse - dc_correct); }