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)
#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_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_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}};
+ {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_LOWBD_32 = 1,
- QUANT_FUNC_LAST = 2
+ 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_fp_32x32_facade},
- {vp10_quantize_b_facade, vp10_quantize_b_32x32_facade},
- {vp10_quantize_dc_facade, vp10_quantize_dc_32x32_facade},
- {NULL, NULL}};
+ {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] = {
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;
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) {
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;
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);
}
}
}
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,
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) {
- // 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) {
+ 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;
- (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
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
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;
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