const int eob = p->eobs[block];
const PLANE_TYPE type = pd->plane_type;
const int default_eob = 16 << (tx_size << 1);
- const int mul = 1 << (tx_size >= TX_32X32 ? tx_size - TX_16X16 : 0);
+ const int shift = (tx_size >= TX_32X32 ? tx_size - TX_16X16 : 0);
+ const int mul = 1 << shift;
const int16_t *dequant_ptr = pd->dequant;
+#if CONFIG_NEW_QUANT
+#if CONFIG_TX_SKIP
+ const int use_rect_quant = is_rect_quant_used(&xd->mi[0].src_mi->mbmi, plane);
+#endif
+ const dequant_val_type_nuq *dequant_val = pd->dequant_val_nuq;
+#endif // CONFIG_NEW_QUANT
const uint8_t *const band_translate = get_band_translate(tx_size);
const scan_order *const so = get_scan(xd, tx_size, type, block);
const int16_t *const scan = so->scan;
rate0 = tokens[next][0].rate;
rate1 = tokens[next][1].rate;
- if ((abs(x) * dequant_ptr[rc != 0] > abs(coeff[rc]) * mul) &&
- (abs(x) * dequant_ptr[rc != 0] < abs(coeff[rc]) * mul +
- dequant_ptr[rc != 0]))
- shortcut = 1;
- else
- shortcut = 0;
+#if CONFIG_NEW_QUANT
+#if CONFIG_TX_SKIP
+ if (use_rect_quant) {
+ shortcut =
+ ((abs(x) * dequant_ptr[rc != 0] > abs(coeff[rc]) * mul) &&
+ ((abs(x) - 1) * dequant_ptr[rc != 0] < abs(coeff[rc]) * mul));
+ } else {
+ shortcut = (
+ (vp9_dequant_abscoeff_nuq(
+ abs(x), dequant_ptr[rc != 0],
+ dequant_val[band_translate[i]]) > abs(coeff[rc]) * mul) &&
+ (vp9_dequant_abscoeff_nuq(
+ abs(x) - 1, dequant_ptr[rc != 0],
+ dequant_val[band_translate[i]]) < abs(coeff[rc]) * mul));
+ }
+#else // CONFIG_TX_SKIP
+ shortcut = (
+ (vp9_dequant_abscoeff_nuq(
+ abs(x), dequant_ptr[rc != 0],
+ dequant_val[band_translate[i]]) > abs(coeff[rc]) * mul) &&
+ (vp9_dequant_abscoeff_nuq(
+ abs(x) - 1, dequant_ptr[rc != 0],
+ dequant_val[band_translate[i]]) < abs(coeff[rc]) * mul));
+#endif // CONFIG_TX_SKIP
+#else // CONFIG_NEW_QUANT
+ shortcut = ((abs(x) * dequant_ptr[rc != 0] > abs(coeff[rc]) * mul) &&
+ ((abs(x) - 1) * dequant_ptr[rc != 0] < abs(coeff[rc]) * mul));
+#endif // CONFIG_NEW_QUANT
if (shortcut) {
sz = -(x < 0);
base_bits = dct_value_cost[x];
if (shortcut) {
+#if CONFIG_NEW_QUANT
+#if CONFIG_TX_SKIP
+ if (use_rect_quant) {
+#if CONFIG_VP9_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ dx -= ((dequant_ptr[rc != 0] >> (xd->bd - 8)) + sz) ^ sz;
+ } else {
+ dx -= (dequant_ptr[rc != 0] + sz) ^ sz;
+ }
+#else
+ dx -= (dequant_ptr[rc != 0] + sz) ^ sz;
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ } else {
+ dx = vp9_dequant_coeff_nuq(
+ x, dequant_ptr[rc != 0],
+ dequant_val[band_translate[i]]) - coeff[rc] * mul;
+#if CONFIG_VP9_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ dx >>= xd->bd - 8;
+ }
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ }
+#else // CONFIG_TX_SKIP
+ dx = vp9_dequant_coeff_nuq(
+ x, dequant_ptr[rc != 0],
+ dequant_val[band_translate[i]]) - coeff[rc] * mul;
+#if CONFIG_VP9_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ dx >>= xd->bd - 8;
+ }
+#endif // CONFIG_VP9_HIGHBITDEPTH
+#endif // CONFIG_TX_SKIP
+#else // CONFIG_NEW_QUANT
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
dx -= ((dequant_ptr[rc != 0] >> (xd->bd - 8)) + sz) ^ sz;
#else
dx -= (dequant_ptr[rc != 0] + sz) ^ sz;
#endif // CONFIG_VP9_HIGHBITDEPTH
+#endif // CONFIG_NEW_QUANT
d2 = dx * dx;
}
tokens[i][1].rate = base_bits + (best ? rate1 : rate0);
if (x) {
final_eob = i;
}
-
qcoeff[rc] = x;
+#if CONFIG_NEW_QUANT
+#if CONFIG_TX_SKIP
+ if (use_rect_quant) {
+ dqcoeff[rc] = (x * dequant_ptr[rc != 0]) / mul;
+ } else {
+ dqcoeff[rc] = vp9_dequant_abscoeff_nuq(abs(x), dequant_ptr[rc != 0],
+ dequant_val[band_translate[i]]);
+ if (shift) dqcoeff[rc] = ROUND_POWER_OF_TWO(dqcoeff[rc], shift);
+ if (x < 0) dqcoeff[rc] = -dqcoeff[rc];
+ }
+#else // CONFIG_TX_SKIP
+ dqcoeff[rc] = vp9_dequant_abscoeff_nuq(abs(x), dequant_ptr[rc != 0],
+ dequant_val[band_translate[i]]);
+ if (shift) dqcoeff[rc] = ROUND_POWER_OF_TWO(dqcoeff[rc], shift);
+ if (x < 0) dqcoeff[rc] = -dqcoeff[rc];
+#endif // CONFIG_TX_SKIP
+#else
dqcoeff[rc] = (x * dequant_ptr[rc != 0]) / mul;
-
+#endif // CONFIG_NEW_QUANT
next = tokens[i][best].next;
best = best_index[i][best];
}
}
}
-#if CONFIG_VP9_HIGHBITDEPTH
-static void highbd_forw_tx16x16(MACROBLOCK *x, int plane,
- const int16_t *src_diff, int diff_stride,
- tran_low_t *const coeff) {
+#if CONFIG_VP9_HIGHBITDEPTH
+static void highbd_forw_tx16x16(MACROBLOCK *x, int plane,
+ const int16_t *src_diff, int diff_stride,
+ tran_low_t *const coeff) {
+ MACROBLOCKD *const xd = &x->e_mbd;
+ int16_t src_diff2[256];
+ TX_TYPE tx_type = get_tx_type(plane, xd);
+ if (tx_type == DCT_DCT) {
+ vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
+ } else if (tx_type == FLIPADST_DCT) {
+ copy_flipud(src_diff, diff_stride, 16, src_diff2, 16);
+ vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_DCT);
+ } else if (tx_type == DCT_FLIPADST) {
+ copy_fliplr(src_diff, diff_stride, 16, src_diff2, 16);
+ vp9_highbd_fht16x16(src_diff2, coeff, 16, DCT_ADST);
+ } else if (tx_type == FLIPADST_FLIPADST) {
+ copy_fliplrud(src_diff, diff_stride, 16, src_diff2, 16);
+ vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_ADST);
+ } else if (tx_type == ADST_FLIPADST) {
+ copy_fliplr(src_diff, diff_stride, 16, src_diff2, 16);
+ vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_ADST);
+ } else if (tx_type == FLIPADST_ADST) {
+ copy_flipud(src_diff, diff_stride, 16, src_diff2, 16);
+ vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_ADST);
+ } else {
+ vp9_highbd_fht16x16(src_diff, coeff, diff_stride, tx_type);
+ }
+}
+
+static void highbd_forw_tx8x8(MACROBLOCK *x, int plane,
+ const int16_t *src_diff, int diff_stride,
+ tran_low_t *const coeff) {
+ MACROBLOCKD *const xd = &x->e_mbd;
+ int16_t src_diff2[64];
+ TX_TYPE tx_type = get_tx_type(plane, xd);
+ if (tx_type == DCT_DCT) {
+ vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
+ } else if (tx_type == FLIPADST_DCT) {
+ copy_flipud(src_diff, diff_stride, 8, src_diff2, 8);
+ vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_DCT);
+ } else if (tx_type == DCT_FLIPADST) {
+ copy_fliplr(src_diff, diff_stride, 8, src_diff2, 8);
+ vp9_highbd_fht8x8(src_diff2, coeff, 8, DCT_ADST);
+ } else if (tx_type == FLIPADST_FLIPADST) {
+ copy_fliplrud(src_diff, diff_stride, 8, src_diff2, 8);
+ vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_ADST);
+ } else if (tx_type == ADST_FLIPADST) {
+ copy_fliplr(src_diff, diff_stride, 8, src_diff2, 8);
+ vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_ADST);
+ } else if (tx_type == FLIPADST_ADST) {
+ copy_flipud(src_diff, diff_stride, 8, src_diff2, 8);
+ vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_ADST);
+ } else {
+ vp9_highbd_fht8x8(src_diff, coeff, diff_stride, tx_type);
+ }
+}
+
+static void highbd_forw_tx4x4(MACROBLOCK *x, int plane, int block,
+ const int16_t *src_diff, int diff_stride,
+ tran_low_t *const coeff) {
+ MACROBLOCKD *const xd = &x->e_mbd;
+ int16_t src_diff2[16];
+ TX_TYPE tx_type = get_tx_type_4x4(plane, xd, block);
+ if (tx_type == DCT_DCT) {
+ x->fwd_txm4x4(src_diff, coeff, diff_stride);
+ } else if (tx_type == FLIPADST_DCT) {
+ copy_flipud(src_diff, diff_stride, 4, src_diff2, 4);
+ vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_DCT);
+ } else if (tx_type == DCT_FLIPADST) {
+ copy_fliplr(src_diff, diff_stride, 4, src_diff2, 4);
+ vp9_highbd_fht4x4(src_diff2, coeff, 4, DCT_ADST);
+ } else if (tx_type == FLIPADST_FLIPADST) {
+ copy_fliplrud(src_diff, diff_stride, 4, src_diff2, 4);
+ vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_ADST);
+ } else if (tx_type == ADST_FLIPADST) {
+ copy_fliplr(src_diff, diff_stride, 4, src_diff2, 4);
+ vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_ADST);
+ } else if (tx_type == FLIPADST_ADST) {
+ copy_flipud(src_diff, diff_stride, 4, src_diff2, 4);
+ vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_ADST);
+ } else {
+ vp9_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
+ }
+}
+#endif // CONFIG_VP9_HIGHBITDEPTH
+#endif // CONFIG_EXT_TX
+
+#if CONFIG_NEW_QUANT
+void vp9_xform_quant_nuq(MACROBLOCK *x, int plane, int block,
+ BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
+ MACROBLOCKD *const xd = &x->e_mbd;
+ const struct macroblock_plane *const p = &x->plane[plane];
+ const struct macroblockd_plane *const pd = &xd->plane[plane];
+ const scan_order *const scan_order = &vp9_default_scan_orders[tx_size];
+ tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
+ tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
+ tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
+ uint16_t *const eob = &p->eobs[block];
+ const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
+ int i, j;
+ const int16_t *src_diff;
+#if CONFIG_TX_SKIP
+ MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
+ int shift = mbmi->tx_skip_shift;
+#endif
+ const uint8_t* band = get_band_translate(tx_size);
+
+ txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
+ src_diff = &p->src_diff[4 * (j * diff_stride + i)];
+
+#if CONFIG_TX_SKIP
+ if (mbmi->tx_skip[plane != 0]) {
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 64, shift);
+ vp9_quantize_64x64_nuq(coeff, 4096, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 32, shift);
+ vp9_quantize_32x32_nuq(coeff, 1024, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_16X16:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 16, shift);
+ vp9_quantize_nuq(coeff, 256, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_8X8:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 8, shift);
+ vp9_quantize_nuq(coeff, 64, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_4X4:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 4, shift);
+ vp9_quantize_nuq(coeff, 16, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *) pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ return;
+ }
+#endif // CONFIG_TX_SKIP
+
+#if CONFIG_VP9_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_highbd_fdct64x64(src_diff, coeff, diff_stride);
+ vp9_highbd_quantize_64x64_nuq(coeff, 4096, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
+ vp9_highbd_quantize_32x32_nuq(coeff, 1024, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_16X16:
+#if CONFIG_EXT_TX
+ highbd_forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_nuq(coeff, 256, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_8X8:
+#if CONFIG_EXT_TX
+ highbd_forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_nuq(coeff, 64, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_4X4:
+#if CONFIG_EXT_TX
+ highbd_forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
+#else
+ x->fwd_txm4x4(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_nuq(coeff, 16, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ default:
+ assert(0);
+ }
+ return;
+ }
+#endif // CONFIG_VP9_HIGHBITDEPTH
+
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_fdct64x64(src_diff, coeff, diff_stride);
+ vp9_quantize_64x64_nuq(coeff, 4096, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
+ vp9_quantize_32x32_nuq(coeff, 1024, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_16X16:
+#if CONFIG_EXT_TX
+ forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_fdct16x16(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_nuq(coeff, 256, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_8X8:
+#if CONFIG_EXT_TX
+ forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_fdct8x8(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_nuq(coeff, 64, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_4X4:
+#if CONFIG_EXT_TX
+ forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
+#else
+ x->fwd_txm4x4(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_nuq(coeff, 16, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
+
+void vp9_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block,
+ BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
+ MACROBLOCKD *const xd = &x->e_mbd;
+ const struct macroblock_plane *const p = &x->plane[plane];
+ const struct macroblockd_plane *const pd = &xd->plane[plane];
+ const scan_order *const scan_order = &vp9_default_scan_orders[tx_size];
+ tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
+ tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
+ tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
+ uint16_t *const eob = &p->eobs[block];
+ const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
+ int i, j;
+ const int16_t *src_diff;
+#if CONFIG_TX_SKIP
+ MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
+ int shift = mbmi->tx_skip_shift;
+#endif
+ const uint8_t* band = get_band_translate(tx_size);
+
+ txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
+ src_diff = &p->src_diff[4 * (j * diff_stride + i)];
+
+#if CONFIG_TX_SKIP
+ if (mbmi->tx_skip[plane != 0]) {
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 64, shift);
+ vp9_quantize_64x64_fp_nuq(coeff, 4096, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 32, shift);
+ vp9_quantize_32x32_fp_nuq(coeff, 1024, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_16X16:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 16, shift);
+ vp9_quantize_fp_nuq(coeff, 256, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_8X8:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 8, shift);
+ vp9_quantize_fp_nuq(coeff, 64, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_4X4:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 4, shift);
+ vp9_quantize_fp_nuq(coeff, 16, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ return;
+ }
+#endif // CONFIG_TX_SKIP
+
+#if CONFIG_VP9_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_highbd_fdct64x64(src_diff, coeff, diff_stride);
+ vp9_highbd_quantize_64x64_fp_nuq(coeff, 4096, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)
+ p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
+ vp9_highbd_quantize_32x32_fp_nuq(coeff, 1024, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)
+ p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_16X16:
+#if CONFIG_EXT_TX
+ highbd_forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_fp_nuq(coeff, 256, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_8X8:
+#if CONFIG_EXT_TX
+ highbd_forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_fp_nuq(coeff, 64, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_4X4:
+#if CONFIG_EXT_TX
+ highbd_forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
+#else
+ x->fwd_txm4x4(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_fp_nuq(coeff, 16, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ default:
+ assert(0);
+ }
+ return;
+ }
+#endif // CONFIG_VP9_HIGHBITDEPTH
+
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_fdct64x64(src_diff, coeff, diff_stride);
+ vp9_quantize_64x64_fp_nuq(coeff, 4096, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
+ vp9_quantize_32x32_fp_nuq(coeff, 1024, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_16X16:
+#if CONFIG_EXT_TX
+ forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_fdct16x16(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_fp_nuq(coeff, 256, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_8X8:
+#if CONFIG_EXT_TX
+ forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_fdct8x8(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_fp_nuq(coeff, 64, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ case TX_4X4:
+#if CONFIG_EXT_TX
+ forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
+#else
+ x->fwd_txm4x4(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_fp_nuq(coeff, 16, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
+
+void vp9_xform_quant_dc_nuq(MACROBLOCK *x, int plane, int block,
+ BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
+ MACROBLOCKD *const xd = &x->e_mbd;
+ const struct macroblock_plane *const p = &x->plane[plane];
+ const struct macroblockd_plane *const pd = &xd->plane[plane];
+ tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
+ tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
+ tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
+ uint16_t *const eob = &p->eobs[block];
+ const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
+ int i, j;
+ const int16_t *src_diff;
+#if CONFIG_TX_SKIP
+ MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
+ int shift = mbmi->tx_skip_shift;
+#endif
+
+ txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
+ src_diff = &p->src_diff[4 * (j * diff_stride + i)];
+
+#if CONFIG_TX_SKIP
+ if (mbmi->tx_skip[plane != 0]) {
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 64, shift);
+ vp9_quantize_dc_64x64_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0],
+ pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 32, shift);
+ vp9_quantize_dc_32x32_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0],
+ pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_16X16:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 16, shift);
+ vp9_quantize_dc_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_8X8:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 8, shift);
+ vp9_quantize_dc_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_4X4:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 4, shift);
+ vp9_quantize_dc_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ return;
+ }
+#endif // CONFIG_TX_SKIP
+
+#if CONFIG_VP9_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_highbd_fdct64x64_1(src_diff, coeff, diff_stride);
+ vp9_highbd_quantize_dc_64x64_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0],
+ pd->dequant[0],
+ p->cumbins_nuq[0],
+ pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ vp9_highbd_fdct32x32_1(src_diff, coeff, diff_stride);
+ vp9_highbd_quantize_dc_32x32_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0],
+ pd->dequant[0],
+ p->cumbins_nuq[0],
+ pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_16X16:
+#if CONFIG_EXT_TX
+ highbd_forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_highbd_fdct16x16_1(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_dc_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0],
+ pd->dequant[0],
+ p->cumbins_nuq[0],
+ pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_8X8:
+#if CONFIG_EXT_TX
+ highbd_forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_highbd_fdct8x8_1(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_dc_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0],
+ pd->dequant[0],
+ p->cumbins_nuq[0],
+ pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_4X4:
+#if CONFIG_EXT_TX
+ highbd_forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
+#else
+ x->fwd_txm4x4(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_dc_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0],
+ pd->dequant[0],
+ p->cumbins_nuq[0],
+ pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ default:
+ assert(0);
+ }
+ return;
+ }
+#endif // CONFIG_VP9_HIGHBITDEPTH
+
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_fdct64x64_1(src_diff, coeff, diff_stride);
+ vp9_quantize_dc_64x64_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ vp9_fdct32x32_1(src_diff, coeff, diff_stride);
+ vp9_quantize_dc_32x32_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_16X16:
+#if CONFIG_EXT_TX
+ forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_fdct16x16_1(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_dc_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_8X8:
+#if CONFIG_EXT_TX
+ forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_fdct8x8_1(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_dc_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_4X4:
+#if CONFIG_EXT_TX
+ forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
+#else
+ x->fwd_txm4x4(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_dc_nuq(coeff, x->skip_block,
+ p->quant[0], p->quant_shift[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
+
+void vp9_xform_quant_dc_fp_nuq(MACROBLOCK *x, int plane, int block,
+ BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
MACROBLOCKD *const xd = &x->e_mbd;
- int16_t src_diff2[256];
- TX_TYPE tx_type = get_tx_type(plane, xd);
- if (tx_type == DCT_DCT) {
- vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
- } else if (tx_type == FLIPADST_DCT) {
- copy_flipud(src_diff, diff_stride, 16, src_diff2, 16);
- vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_DCT);
- } else if (tx_type == DCT_FLIPADST) {
- copy_fliplr(src_diff, diff_stride, 16, src_diff2, 16);
- vp9_highbd_fht16x16(src_diff2, coeff, 16, DCT_ADST);
- } else if (tx_type == FLIPADST_FLIPADST) {
- copy_fliplrud(src_diff, diff_stride, 16, src_diff2, 16);
- vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_ADST);
- } else if (tx_type == ADST_FLIPADST) {
- copy_fliplr(src_diff, diff_stride, 16, src_diff2, 16);
- vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_ADST);
- } else if (tx_type == FLIPADST_ADST) {
- copy_flipud(src_diff, diff_stride, 16, src_diff2, 16);
- vp9_highbd_fht16x16(src_diff2, coeff, 16, ADST_ADST);
- } else {
- vp9_highbd_fht16x16(src_diff, coeff, diff_stride, tx_type);
+ const struct macroblock_plane *const p = &x->plane[plane];
+ const struct macroblockd_plane *const pd = &xd->plane[plane];
+ tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
+ tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
+ tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
+ uint16_t *const eob = &p->eobs[block];
+ const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
+ int i, j;
+ const int16_t *src_diff;
+#if CONFIG_TX_SKIP
+ MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
+ int shift = mbmi->tx_skip_shift;
+#endif
+
+ txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
+ src_diff = &p->src_diff[4 * (j * diff_stride + i)];
+
+#if CONFIG_TX_SKIP
+ if (mbmi->tx_skip[plane != 0]) {
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 64, shift);
+ vp9_quantize_dc_64x64_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 32, shift);
+ vp9_quantize_dc_32x32_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_16X16:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 16, shift);
+ vp9_quantize_dc_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_8X8:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 8, shift);
+ vp9_quantize_dc_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_4X4:
+ vp9_tx_identity(src_diff, coeff, diff_stride, 4, shift);
+ vp9_quantize_dc_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ return;
}
-}
+#endif // CONFIG_TX_SKIP
-static void highbd_forw_tx8x8(MACROBLOCK *x, int plane,
- const int16_t *src_diff, int diff_stride,
- tran_low_t *const coeff) {
- MACROBLOCKD *const xd = &x->e_mbd;
- int16_t src_diff2[64];
- TX_TYPE tx_type = get_tx_type(plane, xd);
- if (tx_type == DCT_DCT) {
- vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
- } else if (tx_type == FLIPADST_DCT) {
- copy_flipud(src_diff, diff_stride, 8, src_diff2, 8);
- vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_DCT);
- } else if (tx_type == DCT_FLIPADST) {
- copy_fliplr(src_diff, diff_stride, 8, src_diff2, 8);
- vp9_highbd_fht8x8(src_diff2, coeff, 8, DCT_ADST);
- } else if (tx_type == FLIPADST_FLIPADST) {
- copy_fliplrud(src_diff, diff_stride, 8, src_diff2, 8);
- vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_ADST);
- } else if (tx_type == ADST_FLIPADST) {
- copy_fliplr(src_diff, diff_stride, 8, src_diff2, 8);
- vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_ADST);
- } else if (tx_type == FLIPADST_ADST) {
- copy_flipud(src_diff, diff_stride, 8, src_diff2, 8);
- vp9_highbd_fht8x8(src_diff2, coeff, 8, ADST_ADST);
- } else {
- vp9_highbd_fht8x8(src_diff, coeff, diff_stride, tx_type);
+#if CONFIG_VP9_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_highbd_fdct64x64_1(src_diff, coeff, diff_stride);
+ vp9_highbd_quantize_dc_64x64_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0],
+ pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ vp9_highbd_fdct32x32_1(src_diff, coeff, diff_stride);
+ vp9_highbd_quantize_dc_32x32_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0],
+ pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_16X16:
+#if CONFIG_EXT_TX
+ highbd_forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_highbd_fdct16x16_1(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_dc_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0],
+ pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_8X8:
+#if CONFIG_EXT_TX
+ highbd_forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_highbd_fdct8x8_1(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_dc_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0],
+ pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_4X4:
+#if CONFIG_EXT_TX
+ highbd_forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
+#else
+ x->fwd_txm4x4(src_diff, coeff, diff_stride);
+#endif
+ vp9_highbd_quantize_dc_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0],
+ pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ default:
+ assert(0);
+ }
+ return;
}
-}
+#endif // CONFIG_VP9_HIGHBITDEPTH
-static void highbd_forw_tx4x4(MACROBLOCK *x, int plane, int block,
- const int16_t *src_diff, int diff_stride,
- tran_low_t *const coeff) {
- MACROBLOCKD *const xd = &x->e_mbd;
- int16_t src_diff2[16];
- TX_TYPE tx_type = get_tx_type_4x4(plane, xd, block);
- if (tx_type == DCT_DCT) {
- x->fwd_txm4x4(src_diff, coeff, diff_stride);
- } else if (tx_type == FLIPADST_DCT) {
- copy_flipud(src_diff, diff_stride, 4, src_diff2, 4);
- vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_DCT);
- } else if (tx_type == DCT_FLIPADST) {
- copy_fliplr(src_diff, diff_stride, 4, src_diff2, 4);
- vp9_highbd_fht4x4(src_diff2, coeff, 4, DCT_ADST);
- } else if (tx_type == FLIPADST_FLIPADST) {
- copy_fliplrud(src_diff, diff_stride, 4, src_diff2, 4);
- vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_ADST);
- } else if (tx_type == ADST_FLIPADST) {
- copy_fliplr(src_diff, diff_stride, 4, src_diff2, 4);
- vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_ADST);
- } else if (tx_type == FLIPADST_ADST) {
- copy_flipud(src_diff, diff_stride, 4, src_diff2, 4);
- vp9_highbd_fht4x4(src_diff2, coeff, 4, ADST_ADST);
- } else {
- vp9_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
+ switch (tx_size) {
+#if CONFIG_TX64X64
+ case TX_64X64:
+ vp9_fdct64x64_1(src_diff, coeff, diff_stride);
+ vp9_quantize_dc_64x64_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+#endif // CONFIG_TX64X64
+ case TX_32X32:
+ vp9_fdct32x32_1(src_diff, coeff, diff_stride);
+ vp9_quantize_dc_32x32_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_16X16:
+#if CONFIG_EXT_TX
+ forw_tx16x16(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_fdct16x16_1(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_dc_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_8X8:
+#if CONFIG_EXT_TX
+ forw_tx8x8(x, plane, src_diff, diff_stride, coeff);
+#else
+ vp9_fdct8x8_1(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_dc_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ case TX_4X4:
+#if CONFIG_EXT_TX
+ forw_tx4x4(x, plane, block, src_diff, diff_stride, coeff);
+#else
+ x->fwd_txm4x4(src_diff, coeff, diff_stride);
+#endif
+ vp9_quantize_dc_fp_nuq(coeff, x->skip_block,
+ p->quant_fp[0], pd->dequant[0],
+ p->cumbins_nuq[0], pd->dequant_val_nuq[0],
+ qcoeff, dqcoeff, eob);
+ break;
+ default:
+ assert(0);
+ break;
}
}
-#endif // CONFIG_VP9_HIGHBITDEPTH
-#endif // CONFIG_EXT_TX
+#endif // CONFIG_NEW_QUANT
void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
case TX_4X4:
vp9_tx_identity(src_diff, coeff, diff_stride, 4, shift);
vp9_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
- p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
- pd->dequant, eob,
- scan_order->scan, scan_order->iscan);
+ p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
+ pd->dequant, eob,
+ scan_order->scan, scan_order->iscan);
break;
default:
assert(0);
#endif // CONFIG_TX64X64
case TX_32X32:
fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
- vp9_quantize_fp_32x32(coeff, 1024, x->skip_block, p->zbin, p->round_fp,
- p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
- pd->dequant, eob, scan_order->scan,
- scan_order->iscan);
+ vp9_quantize_fp_32x32(coeff, 1024, x->skip_block, p->zbin,
+ p->round_fp, p->quant_fp, p->quant_shift,
+ qcoeff, dqcoeff, pd->dequant, eob,
+ scan_order->scan, scan_order->iscan);
break;
case TX_16X16:
#if CONFIG_EXT_TX
if (max_txsize_lookup[plane_bsize] == tx_size) {
if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] == 0) {
// full forward transform and quantization
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_xform_quant_fp_nuq(x, plane, block, plane_bsize, tx_size);
+ else
+ vp9_xform_quant_nuq(x, plane, block, plane_bsize, tx_size);
+#else
if (x->quant_fp)
vp9_xform_quant_fp(x, plane, block, plane_bsize, tx_size);
else
vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
+#endif // CONFIG_NEW_QUANT
} else if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] == 2) {
// fast path forward transform and quantization
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_xform_quant_dc_fp_nuq(x, plane, block, plane_bsize, tx_size);
+ else
+ vp9_xform_quant_dc_nuq(x, plane, block, plane_bsize, tx_size);
+#else
vp9_xform_quant_dc(x, plane, block, plane_bsize, tx_size);
+#endif
} else {
// skip forward transform
p->eobs[block] = 0;
return;
}
} else {
- vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_xform_quant_fp_nuq(x, plane, block, plane_bsize, tx_size);
+ else
+ vp9_xform_quant_nuq(x, plane, block, plane_bsize, tx_size);
+#else
+ if (x->quant_fp)
+ vp9_xform_quant_fp(x, plane, block, plane_bsize, tx_size);
+ else
+ vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
+#endif
}
}
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
dst = &pd->dst.buf[4 * j * pd->dst.stride + 4 * i];
- vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_xform_quant_fp_nuq(x, plane, block, plane_bsize, tx_size);
+ else
+ vp9_xform_quant_nuq(x, plane, block, plane_bsize, tx_size);
+#else
+ if (x->quant_fp)
+ vp9_xform_quant_fp(x, plane, block, plane_bsize, tx_size);
+ else
+ vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
+#endif
if (p->eobs[block] > 0) {
#if CONFIG_VP9_HIGHBITDEPTH
tran_low_t *dqcoeff, struct macroblock_plane *p,
struct macroblockd_plane *pd,
const scan_order *scan_order, PREDICTION_MODE mode,
- int bs, int shift, int logsizeby32) {
+ TX_SIZE tx_size, int shift, int logsizeby32) {
int i, j, eob, temp;
+ const int bs = 4 << tx_size;
+#if CONFIG_NEW_QUANT
+ // const uint8_t* band = get_band_translate(tx_size);
+#endif
vpx_memset(qcoeff, 0, bs * bs * sizeof(*qcoeff));
vpx_memset(dqcoeff, 0, bs * bs * sizeof(*dqcoeff));
const int src_stride = p->src.stride;
const int dst_stride = pd->dst.stride;
int i, j;
+#if CONFIG_NEW_QUANT
+ const uint8_t* band = get_band_translate(tx_size);
+#endif
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
dst = &pd->dst.buf[4 * (j * dst_stride + i)];
src = &p->src.buf[4 * (j * src_stride + i)];
vp9_subtract_block(64, 64, src_diff, diff_stride,
src, src_stride, dst, dst_stride);
vp9_tx_identity(src_diff, coeff, diff_stride, 64, shift);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_quantize_64x64_fp_nuq(coeff, 4096, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_quantize_64x64_nuq(coeff, 4096, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_quantize_b_64x64(coeff, 4096, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift, qcoeff,
dqcoeff, pd->dequant, eob,
- scan_order->scan, scan_order->iscan);
+ scan_order->scan, scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob)
vp9_tx_identity_add(dqcoeff, dst, dst_stride, 64, shift);
*eob = vp9_dpcm_intra(src, src_stride, dst, dst_stride,
src_diff, diff_stride,
coeff, qcoeff, dqcoeff, p, pd,
- scan_order, mode, 32, shift, 0);
+ scan_order, mode, TX_32X32, shift, 0);
break;
}
src, src_stride, dst, dst_stride);
vp9_tx_identity(src_diff, coeff, diff_stride, 32, shift);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_quantize_32x32_fp_nuq(coeff, 1024, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_quantize_32x32_nuq(coeff, 1024, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift, qcoeff,
dqcoeff, pd->dequant, eob,
scan_order->scan, scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob) {
vp9_tx_identity_add(dqcoeff, dst, dst_stride, 32, shift);
*eob = vp9_dpcm_intra(src, src_stride, dst, dst_stride,
src_diff, diff_stride,
coeff, qcoeff, dqcoeff, p, pd,
- scan_order, mode, 16, shift, -1);
+ scan_order, mode, TX_16X16, shift, -1);
break;
}
vp9_subtract_block(16, 16, src_diff, diff_stride,
src, src_stride, dst, dst_stride);
vp9_tx_identity(src_diff, coeff, diff_stride, 16, shift);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_quantize_fp_nuq(coeff, 256, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_quantize_nuq(coeff, 256, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob) {
vp9_tx_identity_add(dqcoeff, dst, dst_stride, 16, shift);
*eob = vp9_dpcm_intra(src, src_stride, dst, dst_stride,
src_diff, diff_stride,
coeff, qcoeff, dqcoeff, p, pd,
- scan_order, mode, 8, shift, -1);
+ scan_order, mode, TX_8X8, shift, -1);
break;
}
vp9_subtract_block(8, 8, src_diff, diff_stride,
src, src_stride, dst, dst_stride);
vp9_tx_identity(src_diff, coeff, diff_stride, 8, shift);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_quantize_fp_nuq(coeff, 64, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_quantize_nuq(coeff, 64, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob) {
vp9_tx_identity_add(dqcoeff, dst, dst_stride, 8, shift);
*eob = vp9_dpcm_intra(src, src_stride, dst, dst_stride,
src_diff, diff_stride,
coeff, qcoeff, dqcoeff, p, pd,
- scan_order, mode, 4, shift, -1);
+ scan_order, mode, TX_4X4, shift, -1);
break;
}
vp9_subtract_block(4, 4, src_diff, diff_stride,
src, src_stride, dst, dst_stride);
vp9_tx_identity(src_diff, coeff, diff_stride, 4, shift);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_quantize_fp_nuq(coeff, 16, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_quantize_nuq(coeff, 16, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob) {
vp9_highbd_subtract_block(64, 64, src_diff, diff_stride,
src, src_stride, dst, dst_stride, xd->bd);
vp9_highbd_fdct64x64(src_diff, coeff, diff_stride);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_highbd_quantize_64x64_fp_nuq(coeff, 4096, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)
+ p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan,
+ band);
+ else
+ vp9_highbd_quantize_64x64_nuq(coeff, 4096, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)
+ p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_highbd_quantize_b_64x64(coeff, 4096, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift,
qcoeff, dqcoeff, pd->dequant, eob,
scan_order->scan, scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
if (!x->skip_encode && *eob) {
vp9_highbd_idct64x64_add(dqcoeff, dst, dst_stride, *eob, xd->bd);
}
vp9_highbd_subtract_block(32, 32, src_diff, diff_stride,
src, src_stride, dst, dst_stride, xd->bd);
highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_highbd_quantize_32x32_fp_nuq(coeff, 1024, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)
+ p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan,
+ band);
+ else
+ vp9_highbd_quantize_32x32_nuq(coeff, 1024, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)
+ p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift,
qcoeff, dqcoeff, pd->dequant, eob,
scan_order->scan, scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob) {
vp9_highbd_idct32x32_add(dqcoeff, dst, dst_stride, *eob, xd->bd);
vp9_highbd_subtract_block(16, 16, src_diff, diff_stride,
src, src_stride, dst, dst_stride, xd->bd);
vp9_highbd_fht16x16(src_diff, coeff, diff_stride, tx_type);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_highbd_quantize_fp_nuq(coeff, 256, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_highbd_quantize_nuq(coeff, 256, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob) {
vp9_highbd_iht16x16_add(tx_type, dqcoeff, dst, dst_stride,
vp9_highbd_subtract_block(8, 8, src_diff, diff_stride,
src, src_stride, dst, dst_stride, xd->bd);
vp9_highbd_fht8x8(src_diff, coeff, diff_stride, tx_type);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_highbd_quantize_fp_nuq(coeff, 64, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_highbd_quantize_nuq(coeff, 64, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob) {
vp9_highbd_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob,
vp9_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
else
x->fwd_txm4x4(src_diff, coeff, diff_stride);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_highbd_quantize_fp_nuq(coeff, 16, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_highbd_quantize_nuq(coeff, 16, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob) {
vp9_subtract_block(64, 64, src_diff, diff_stride,
src, src_stride, dst, dst_stride);
vp9_fdct64x64(src_diff, coeff, diff_stride);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_quantize_64x64_fp_nuq(coeff, 4096, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_quantize_64x64_nuq(coeff, 4096, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_quantize_b_64x64(coeff, 4096, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob)
vp9_idct64x64_add(dqcoeff, dst, dst_stride, *eob);
vp9_subtract_block(32, 32, src_diff, diff_stride,
src, src_stride, dst, dst_stride);
fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_quantize_32x32_fp_nuq(coeff, 1024, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_quantize_32x32_nuq(coeff, 1024, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)
+ pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob)
vp9_idct32x32_add(dqcoeff, dst, dst_stride, *eob);
vp9_subtract_block(16, 16, src_diff, diff_stride,
src, src_stride, dst, dst_stride);
vp9_fht16x16(src_diff, coeff, diff_stride, tx_type);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_quantize_fp_nuq(coeff, 256, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_quantize_nuq(coeff, 256, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob)
vp9_iht16x16_add(tx_type, dqcoeff, dst, dst_stride, *eob);
vp9_subtract_block(8, 8, src_diff, diff_stride,
src, src_stride, dst, dst_stride);
vp9_fht8x8(src_diff, coeff, diff_stride, tx_type);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_quantize_fp_nuq(coeff, 64, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_quantize_nuq(coeff, 64, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob)
vp9_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob);
vp9_fht4x4(src_diff, coeff, diff_stride, tx_type);
else
x->fwd_txm4x4(src_diff, coeff, diff_stride);
+#if CONFIG_NEW_QUANT
+ if (x->quant_fp)
+ vp9_quantize_fp_nuq(coeff, 16, x->skip_block,
+ p->quant_fp, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+ else
+ vp9_quantize_nuq(coeff, 16, x->skip_block,
+ p->quant, p->quant_shift, pd->dequant,
+ (const cumbins_type_nuq *)p->cumbins_nuq,
+ (const dequant_val_type_nuq *)pd->dequant_val_nuq,
+ qcoeff, dqcoeff, eob,
+ scan_order->scan, band);
+#else
vp9_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
+#endif // CONFIG_NEW_QUANT
}
if (!x->skip_encode && *eob) {
*eob_ptr = eob + 1;
}
+#if CONFIG_NEW_QUANT
+static INLINE int quantize_coeff_nuq(const tran_low_t coeffv,
+ const int16_t quant,
+ const int16_t quant_shift,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr) {
+ const int coeff = coeffv;
+ const int coeff_sign = (coeff >> 31);
+ const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
+ int i, q;
+ int tmp = clamp(abs_coeff, INT16_MIN, INT16_MAX);
+ for (i = 0; i < NUQ_KNOTES; i++) {
+ if (tmp < cumbins_ptr[i]) {
+ q = i;
+ break;
+ }
+ }
+ if (i == NUQ_KNOTES) {
+ tmp -= cumbins_ptr[NUQ_KNOTES - 1];
+ q = NUQ_KNOTES + (((((tmp * quant) >> 16) + tmp) * quant_shift) >> 16);
+ }
+ if (q) {
+ *dqcoeff_ptr =
+ vp9_dequant_abscoeff_nuq(q, dequant, dequant_val);
+ *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
+ *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
+ } else {
+ *qcoeff_ptr = 0;
+ *dqcoeff_ptr = 0;
+ }
+ return (q != 0);
+}
+
+static INLINE int quantize_coeff_bigtx_nuq(const tran_low_t coeffv,
+ const int16_t quant,
+ const int16_t quant_shift,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ int logsizeby32) {
+ const int coeff = coeffv;
+ const int coeff_sign = (coeff >> 31);
+ const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
+ int i, q;
+ int tmp = clamp(abs_coeff, INT16_MIN, INT16_MAX);
+ for (i = 0; i < NUQ_KNOTES; i++) {
+ if (tmp < ROUND_POWER_OF_TWO(cumbins_ptr[i], 1 + logsizeby32)) {
+ q = i;
+ break;
+ }
+ }
+ if (i == NUQ_KNOTES) {
+ tmp -= ROUND_POWER_OF_TWO(cumbins_ptr[NUQ_KNOTES - 1], 1 + logsizeby32);
+ q = NUQ_KNOTES +
+ (((((tmp * quant) >> 16) + tmp) * quant_shift) >> (15 - logsizeby32));
+ }
+ if (q) {
+ *dqcoeff_ptr =
+ ROUND_POWER_OF_TWO(vp9_dequant_abscoeff_nuq(q, dequant, dequant_val),
+ 1 + logsizeby32);
+ // *dqcoeff_ptr = vp9_dequant_abscoeff_nuq(q, dequant, dequant_val) >>
+ // (1 + logsizeby32);
+ *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
+ *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
+ } else {
+ *qcoeff_ptr = 0;
+ *dqcoeff_ptr = 0;
+ }
+ return (q != 0);
+}
+
+#if CONFIG_VP9_HIGHBITDEPTH
+static INLINE int highbd_quantize_coeff_nuq(const tran_low_t coeffv,
+ const int16_t quant,
+ const int16_t quant_shift,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr) {
+ const int coeff = coeffv;
+ const int coeff_sign = (coeff >> 31);
+ const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
+ int i, q;
+ int64_t tmp = clamp(abs_coeff, INT32_MIN, INT32_MAX);
+ for (i = 0; i < NUQ_KNOTES; i++) {
+ if (tmp < cumbins_ptr[i]) {
+ q = i;
+ break;
+ }
+ }
+ if (i == NUQ_KNOTES) {
+ tmp -= cumbins_ptr[NUQ_KNOTES - 1];
+ q = NUQ_KNOTES + (((((tmp * quant) >> 16) + tmp) * quant_shift) >> 16);
+ }
+ if (q) {
+ *dqcoeff_ptr =
+ vp9_dequant_abscoeff_nuq(q, dequant, dequant_val);
+ *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
+ *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
+ } else {
+ *qcoeff_ptr = 0;
+ *dqcoeff_ptr = 0;
+ }
+ return (q != 0);
+}
+
+static INLINE int highbd_quantize_coeff_bigtx_nuq(const tran_low_t coeffv,
+ const int16_t quant,
+ const int16_t quant_shift,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ int logsizeby32) {
+ const int coeff = coeffv;
+ const int coeff_sign = (coeff >> 31);
+ const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
+ int i, q;
+ int64_t tmp = clamp(abs_coeff, INT32_MIN, INT32_MAX);
+ for (i = 0; i < NUQ_KNOTES; i++) {
+ if (tmp < ROUND_POWER_OF_TWO(cumbins_ptr[i], 1 + logsizeby32)) {
+ q = i;
+ break;
+ }
+ }
+ if (i == NUQ_KNOTES) {
+ tmp -= ROUND_POWER_OF_TWO(cumbins_ptr[NUQ_KNOTES - 1], 1 + logsizeby32);
+ q = NUQ_KNOTES +
+ (((((tmp * quant) >> 16) + tmp) * quant_shift) >> (15 - logsizeby32));
+ }
+ if (q) {
+ *dqcoeff_ptr =
+ ROUND_POWER_OF_TWO(vp9_dequant_abscoeff_nuq(q, dequant, dequant_val),
+ 1 + logsizeby32);
+ *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
+ *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
+ } else {
+ *qcoeff_ptr = 0;
+ *dqcoeff_ptr = 0;
+ }
+ return (q != 0);
+}
+#endif // CONFIG_VP9_HIGHBITDEPTH
+
+static INLINE int quantize_coeff_fp_nuq(const tran_low_t coeffv,
+ const int16_t quant,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr) {
+ const int coeff = coeffv;
+ const int coeff_sign = (coeff >> 31);
+ const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
+ int i, q;
+ int tmp = clamp(abs_coeff, INT16_MIN, INT16_MAX);
+ for (i = 0; i < NUQ_KNOTES; i++) {
+ if (tmp < cumbins_ptr[i]) {
+ q = i;
+ break;
+ }
+ }
+ if (i == NUQ_KNOTES) {
+ q = NUQ_KNOTES +
+ ((((int64_t)tmp - cumbins_ptr[NUQ_KNOTES - 1]) * quant) >> 16);
+ }
+ if (q) {
+ *dqcoeff_ptr =
+ vp9_dequant_abscoeff_nuq(q, dequant, dequant_val);
+ *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
+ *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
+ } else {
+ *qcoeff_ptr = 0;
+ *dqcoeff_ptr = 0;
+ }
+ return (q != 0);
+}
+
+static INLINE int quantize_coeff_bigtx_fp_nuq(const tran_low_t coeffv,
+ const int16_t quant,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ int logsizeby32) {
+ const int coeff = coeffv;
+ const int coeff_sign = (coeff >> 31);
+ const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
+ int i, q;
+ int tmp = clamp(abs_coeff, INT16_MIN, INT16_MAX);
+ for (i = 0; i < NUQ_KNOTES; i++) {
+ if (tmp < ROUND_POWER_OF_TWO(cumbins_ptr[i], 1 + logsizeby32)) {
+ q = i;
+ break;
+ }
+ }
+ if (i == NUQ_KNOTES) {
+ q = NUQ_KNOTES +
+ ((((int64_t)tmp - ROUND_POWER_OF_TWO(cumbins_ptr[NUQ_KNOTES - 1],
+ 1 + logsizeby32)) * quant) >>
+ (15 - logsizeby32));
+ }
+ if (q) {
+ *dqcoeff_ptr =
+ ROUND_POWER_OF_TWO(vp9_dequant_abscoeff_nuq(q, dequant, dequant_val),
+ 1 + logsizeby32);
+ // *dqcoeff_ptr = vp9_dequant_abscoeff_nuq(q, dequant, dequant_val) >>
+ // (1 + logsizeby32);
+ *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
+ *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
+ } else {
+ *qcoeff_ptr = 0;
+ *dqcoeff_ptr = 0;
+ }
+ return (q != 0);
+}
+
+#if CONFIG_VP9_HIGHBITDEPTH
+static INLINE int highbd_quantize_coeff_fp_nuq(const tran_low_t coeffv,
+ const int16_t quant,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr) {
+ const int coeff = coeffv;
+ const int coeff_sign = (coeff >> 31);
+ const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
+ int i, q;
+ int64_t tmp = clamp(abs_coeff, INT32_MIN, INT32_MAX);
+ for (i = 0; i < NUQ_KNOTES; i++) {
+ if (tmp < cumbins_ptr[i]) {
+ q = i;
+ break;
+ }
+ }
+ if (i == NUQ_KNOTES) {
+ q = NUQ_KNOTES +
+ (((tmp - cumbins_ptr[NUQ_KNOTES - 1]) * quant) >> 16);
+ }
+ if (q) {
+ *dqcoeff_ptr =
+ vp9_dequant_abscoeff_nuq(q, dequant, dequant_val);
+ *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
+ *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
+ } else {
+ *qcoeff_ptr = 0;
+ *dqcoeff_ptr = 0;
+ }
+ return (q != 0);
+}
+
+static INLINE int highbd_quantize_coeff_bigtx_fp_nuq(
+ const tran_low_t coeffv,
+ const int16_t quant,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ int logsizeby32) {
+ const int coeff = coeffv;
+ const int coeff_sign = (coeff >> 31);
+ const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
+ int i, q;
+ int64_t tmp = clamp(abs_coeff, INT32_MIN, INT32_MAX);
+ for (i = 0; i < NUQ_KNOTES; i++) {
+ if (tmp < ROUND_POWER_OF_TWO(cumbins_ptr[i], 1 + logsizeby32)) {
+ q = i;
+ break;
+ }
+ }
+ if (i == NUQ_KNOTES) {
+ q = NUQ_KNOTES +
+ (((tmp - ROUND_POWER_OF_TWO(cumbins_ptr[NUQ_KNOTES - 1],
+ 1 + logsizeby32)) * quant) >>
+ (15 - logsizeby32));
+ }
+ if (q) {
+ *dqcoeff_ptr =
+ ROUND_POWER_OF_TWO(vp9_dequant_abscoeff_nuq(q, dequant, dequant_val),
+ 1 + logsizeby32);
+ *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
+ *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
+ } else {
+ *qcoeff_ptr = 0;
+ *dqcoeff_ptr = 0;
+ }
+ return (q != 0);
+}
+#endif // CONFIG_VP9_HIGHBITDEPTH
+
+void vp9_quantize_dc_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t quant_shift,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (quantize_coeff_nuq(coeff_ptr[rc],
+ quant,
+ quant_shift,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_quantize_dc_fp_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (quantize_coeff_fp_nuq(coeff_ptr[rc],
+ quant,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
+
#if CONFIG_VP9_HIGHBITDEPTH
void vp9_highbd_quantize_dc(const tran_low_t *coeff_ptr, int skip_block,
const int16_t *round_ptr, const int16_t quant,
}
*eob_ptr = eob + 1;
}
-#endif
+
+#if CONFIG_NEW_QUANT
+void vp9_highbd_quantize_dc_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t quant_shift,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (highbd_quantize_coeff_nuq(coeff_ptr[rc],
+ quant,
+ quant_shift,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_highbd_quantize_dc_fp_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (highbd_quantize_coeff_fp_nuq(coeff_ptr[rc],
+ quant,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
+#endif // CONFIG_VP9_HIGHBITDEPTH
static INLINE void quantize_dc_bigtx(const tran_low_t *coeff_ptr,
int skip_block,
qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr, 0);
}
+#if CONFIG_NEW_QUANT
+void vp9_quantize_dc_32x32_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t quant_shift,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (quantize_coeff_bigtx_nuq(coeff_ptr[rc],
+ quant,
+ quant_shift,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr,
+ 0))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_quantize_dc_32x32_fp_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc],
+ quant,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr,
+ 0))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
+
#if CONFIG_TX64X64
void vp9_quantize_dc_64x64(const tran_low_t *coeff_ptr, int skip_block,
const int16_t *round_ptr, const int16_t quant,
quantize_dc_bigtx(coeff_ptr, skip_block, round_ptr, quant,
qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr, 1);
}
+
+#if CONFIG_NEW_QUANT
+void vp9_quantize_dc_64x64_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t quant_shift,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (quantize_coeff_bigtx_nuq(coeff_ptr[rc],
+ quant,
+ quant_shift,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr,
+ 1))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_quantize_dc_64x64_fp_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc],
+ quant,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr,
+ 1))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX64X64
#if CONFIG_VP9_HIGHBITDEPTH
const int coeff_sign = (coeff >> 31);
const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
- int64_t tmp =
- clamp(abs_coeff +
- ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1 + logsizeby32),
- INT32_MIN, INT32_MAX);
- tmp = (tmp * quant) >> (15 - logsizeby32);
+ const int64_t tmp =
+ (clamp(abs_coeff +
+ ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1 + logsizeby32),
+ INT32_MIN, INT32_MAX) *
+ quant) >> (15 - logsizeby32);
qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign;
dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr / (2 << logsizeby32);
if (tmp)
qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr, 0);
}
+#if CONFIG_NEW_QUANT
+void vp9_highbd_quantize_dc_32x32_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t quant_shift,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (highbd_quantize_coeff_bigtx_nuq(coeff_ptr[rc],
+ quant,
+ quant_shift,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr,
+ 0))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_highbd_quantize_dc_32x32_fp_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (highbd_quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc],
+ quant,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr,
+ 0))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
+
#if CONFIG_TX64X64
void vp9_highbd_quantize_dc_64x64(const tran_low_t *coeff_ptr,
int skip_block,
highbd_quantize_dc_bigtx(coeff_ptr, skip_block, round_ptr, quant,
qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr, 1);
}
+
+#if CONFIG_NEW_QUANT
+void vp9_highbd_quantize_dc_64x64_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t quant_shift,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (highbd_quantize_coeff_bigtx_nuq(coeff_ptr[rc],
+ quant,
+ quant_shift,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr,
+ 1))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_highbd_quantize_dc_64x64_fp_nuq(const tran_low_t *coeff_ptr,
+ int skip_block,
+ const int16_t quant,
+ const int16_t dequant,
+ const tran_low_t *cumbins_ptr,
+ const tran_low_t *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr) {
+ int eob = -1;
+ if (!skip_block) {
+ const int rc = 0;
+ if (highbd_quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc],
+ quant,
+ dequant,
+ cumbins_ptr,
+ dequant_val,
+ qcoeff_ptr,
+ dqcoeff_ptr,
+ 1))
+ eob = 0;
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX64X64
#endif // CONFIG_VP9_HIGHBITDEPTH
*eob_ptr = eob + 1;
}
+#if CONFIG_NEW_QUANT
+void vp9_quantize_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *quant_shift_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (quantize_coeff_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ quant_shift_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc]))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_quantize_fp_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (quantize_coeff_fp_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc]))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
+
#if CONFIG_VP9_HIGHBITDEPTH
void vp9_highbd_quantize_fp_c(const tran_low_t *coeff_ptr,
intptr_t count,
}
*eob_ptr = eob + 1;
}
-#endif
+
+#if CONFIG_NEW_QUANT
+void vp9_highbd_quantize_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *quant_shift_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ (void)iscan;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (highbd_quantize_coeff_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ quant_shift_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc]))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_highbd_quantize_fp_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ (void)iscan;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (highbd_quantize_coeff_fp_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc]))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
+#endif // CONFIG_VP9_HIGHBITDEPTH
// TODO(jingning) Refactor this file and combine functions with similar
// operations.
eob_ptr, scan, iscan, 0);
}
+#if CONFIG_NEW_QUANT
+void vp9_quantize_32x32_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *quant_shift_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (quantize_coeff_bigtx_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ quant_shift_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc],
+ 0))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_quantize_32x32_fp_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc],
+ 0))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
+
#if CONFIG_TX64X64
void vp9_quantize_fp_64x64_c(const tran_low_t *coeff_ptr,
intptr_t n_coeffs,
qcoeff_ptr, dqcoeff_ptr, dequant_ptr,
eob_ptr, scan, iscan, 1);
}
+
+#if CONFIG_NEW_QUANT
+void vp9_quantize_64x64_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *quant_shift_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (quantize_coeff_bigtx_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ quant_shift_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc],
+ 1))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_quantize_64x64_fp_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc],
+ 1))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX64X64
#if CONFIG_VP9_HIGHBITDEPTH
dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0] /
(2 << logsizeby32);
}
-
if (tmp)
eob = i;
}
eob_ptr, scan, iscan, 0);
}
+#if CONFIG_NEW_QUANT
+void vp9_highbd_quantize_32x32_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *quant_shift_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (highbd_quantize_coeff_bigtx_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ quant_shift_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc],
+ 0))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_highbd_quantize_32x32_fp_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (highbd_quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc],
+ 0))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
+
#if CONFIG_TX64X64
void vp9_highbd_quantize_fp_64x64_c(const tran_low_t *coeff_ptr,
intptr_t n_coeffs,
qcoeff_ptr, dqcoeff_ptr, dequant_ptr,
eob_ptr, scan, iscan, 1);
}
+
+#if CONFIG_NEW_QUANT
+void vp9_highbd_quantize_64x64_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *quant_shift_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (highbd_quantize_coeff_bigtx_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ quant_shift_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc],
+ 1))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+
+void vp9_highbd_quantize_64x64_fp_nuq_c(const tran_low_t *coeff_ptr,
+ intptr_t n_coeffs,
+ int skip_block,
+ const int16_t *quant_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ const int16_t *scan,
+ const uint8_t *band) {
+ int eob = -1;
+ vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
+ vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
+ if (!skip_block) {
+ int i;
+ for (i = 0; i < n_coeffs; i++) {
+ const int rc = scan[i];
+ if (highbd_quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc],
+ quant_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rc],
+ &dqcoeff_ptr[rc],
+ 1))
+ eob = i;
+ }
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX64X64
#endif // CONFIG_VP9_HIGHBITDEPTH
}
}
+#if CONFIG_NEW_QUANT
+void vp9_quantize_rect_nuq(const tran_low_t *coeff_ptr,
+ int row,
+ int col,
+ int stride,
+ const int16_t *quant_ptr,
+ const int16_t *quant_shift_ptr,
+ const int16_t *dequant_ptr,
+ const cumbins_type_nuq *cumbins_ptr,
+ const dequant_val_type_nuq *dequant_val,
+ tran_low_t *qcoeff_ptr,
+ tran_low_t *dqcoeff_ptr,
+ uint16_t *eob_ptr,
+ int logsizeby32,
+ const int16_t *scan,
+ const uint8_t *band) {
+ const int n_coeffs = row * col;
+ int i, res, eob = -1;
+ for (i = 0; i < n_coeffs; ++i) {
+ const int rc = scan[i];
+ const int r = rc / col;
+ const int c = rc % col;
+ const int rcs = r * stride + c;
+ qcoeff_ptr[rcs] = dqcoeff_ptr[rcs] = 0;
+ if (logsizeby32 >= 0)
+ res = quantize_coeff_bigtx_nuq(coeff_ptr[rcs],
+ quant_ptr[rc != 0],
+ quant_shift_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rcs],
+ &dqcoeff_ptr[rcs],
+ logsizeby32);
+ else
+ res = quantize_coeff_nuq(coeff_ptr[rcs],
+ quant_ptr[rc != 0],
+ quant_shift_ptr[rc != 0],
+ dequant_ptr[rc != 0],
+ cumbins_ptr[band[i]],
+ dequant_val[band[i]],
+ &qcoeff_ptr[rcs],
+ &dqcoeff_ptr[rcs]);
+ if (res)
+ eob = i;
+ }
+ *eob_ptr = eob + 1;
+}
+#endif // CONFIG_NEW_QUANT
+
int get_eob(tran_low_t *qcoeff_ptr, intptr_t n_coeffs, const int16_t *scan) {
int i, rc, eob = -1;
const int qrounding_factor = q == 0 ? 64 : 48;
for (i = 0; i < 2; ++i) {
- int qrounding_factor_fp = i == 0 ? 48 : 42;
- if (q == 0)
- qrounding_factor_fp = 64;
+ const int qrounding_factor_fp = q == 0 ? 64 : (i == 0 ? 48 : 42);
// y
quant = i == 0 ? vp9_dc_quant(q, cm->y_dc_delta_q, cm->bit_depth)
: vp9_ac_quant(q, 0, cm->bit_depth);
invert_quant(&quants->y_quant[q][i], &quants->y_quant_shift[q][i], quant);
quants->y_quant_fp[q][i] = (1 << 16) / quant;
- quants->y_round_fp[q][i] = (qrounding_factor_fp * quant) >> 7;
+ quants->y_round_fp[q][i] =
+ vp9_round_factor_to_round(quant, qrounding_factor_fp);
quants->y_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
- quants->y_round[q][i] = (qrounding_factor * quant) >> 7;
+ quants->y_round[q][i] =
+ vp9_round_factor_to_round(quant, qrounding_factor);
cm->y_dequant[q][i] = quant;
// uv
invert_quant(&quants->uv_quant[q][i],
&quants->uv_quant_shift[q][i], quant);
quants->uv_quant_fp[q][i] = (1 << 16) / quant;
- quants->uv_round_fp[q][i] = (qrounding_factor_fp * quant) >> 7;
+ quants->uv_round_fp[q][i] =
+ vp9_round_factor_to_round(quant, qrounding_factor_fp);
quants->uv_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
- quants->uv_round[q][i] = (qrounding_factor * quant) >> 7;
+ quants->uv_round[q][i] =
+ vp9_round_factor_to_round(quant, qrounding_factor);
cm->uv_dequant[q][i] = quant;
}
+#if CONFIG_NEW_QUANT
+ for (i = 0; i < COEF_BANDS; i++) {
+ const int quant = cm->y_dequant[q][i != 0];
+ const int uvquant = cm->uv_dequant[q][i != 0];
+ vp9_get_dequant_val_nuq(quant, i, cm->bit_depth,
+ cm->y_dequant_val_nuq[q][i],
+ quants->y_cumbins_nuq[q][i]);
+ vp9_get_dequant_val_nuq(uvquant, i, cm->bit_depth,
+ cm->uv_dequant_val_nuq[q][i],
+ quants->uv_cumbins_nuq[q][i]);
+ }
+#endif // CONFIG_NEW_QUANT
+
for (i = 2; i < 8; i++) {
quants->y_quant[q][i] = quants->y_quant[q][1];
quants->y_quant_fp[q][i] = quants->y_quant_fp[q][1];
x->plane[0].zbin = quants->y_zbin[qindex];
x->plane[0].round = quants->y_round[qindex];
xd->plane[0].dequant = cm->y_dequant[qindex];
+#if CONFIG_NEW_QUANT
+ x->plane[0].cumbins_nuq = quants->y_cumbins_nuq[qindex];
+ xd->plane[0].dequant_val_nuq = cm->y_dequant_val_nuq[qindex];
+#endif
x->plane[0].quant_thred[0] = x->plane[0].zbin[0] * x->plane[0].zbin[0];
x->plane[0].quant_thred[1] = x->plane[0].zbin[1] * x->plane[0].zbin[1];
x->plane[i].zbin = quants->uv_zbin[qindex];
x->plane[i].round = quants->uv_round[qindex];
xd->plane[i].dequant = cm->uv_dequant[qindex];
+#if CONFIG_NEW_QUANT
+ x->plane[i].cumbins_nuq = quants->uv_cumbins_nuq[qindex];
+ xd->plane[i].dequant_val_nuq = cm->uv_dequant_val_nuq[qindex];
+#endif
x->plane[i].quant_thred[0] = x->plane[i].zbin[0] * x->plane[i].zbin[0];
x->plane[i].quant_thred[1] = x->plane[i].zbin[1] * x->plane[i].zbin[1];