Use uniform quantization settings for non-transform blocks

Do not treat first element (dc) differently.

on screen_content
tx-skip only: +16.4% (was +15.45%)

no significant impact on natrual videos

Change-Id: I79415a9e948ebbb4a69109311c10126d8a0b96ab
This commit is contained in:
hui su 2015-04-17 11:38:37 -07:00
parent 761cd0b010
commit 1f7b49f7cd
9 changed files with 564 additions and 254 deletions

View File

@ -331,7 +331,13 @@ struct macroblockd_plane {
const int16_t *dequant;
#if CONFIG_NEW_QUANT
const dequant_val_type_nuq *dequant_val_nuq;
#endif
#endif // CONFIG_NEW_QUANT
#if CONFIG_TX_SKIP
const int16_t *dequant_pxd;
#if CONFIG_NEW_QUANT
const dequant_val_type_nuq *dequant_val_nuq_pxd;
#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX_SKIP
ENTROPY_CONTEXT *above_context;
ENTROPY_CONTEXT *left_context;
#if CONFIG_PALETTE

View File

@ -74,6 +74,17 @@ typedef struct VP9Common {
uv_dequant_val_nuq[QINDEX_RANGE][COEF_BANDS]);
#endif // CONFIG_NEW_QUANT
#if CONFIG_TX_SKIP
DECLARE_ALIGNED(16, int16_t, y_dequant_pxd[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_dequant_pxd[QINDEX_RANGE][8]);
#if CONFIG_NEW_QUANT
DECLARE_ALIGNED(16, dequant_val_type_nuq,
y_dequant_val_nuq_pxd[QINDEX_RANGE][COEF_BANDS]);
DECLARE_ALIGNED(16, dequant_val_type_nuq,
uv_dequant_val_nuq_pxd[QINDEX_RANGE][COEF_BANDS]);
#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX_SKIP
vpx_color_space_t color_space;
int width;

View File

@ -28,6 +28,7 @@ extern "C" {
#define TX_SKIP_Q_THRESH_INTER 64
#define TX_SKIP_Q_THRESH_INTRA 255
#define TX_SKIP_SHIFT_THRESH 0
#define PXD_QUANT_INDEX 0
#endif // CONFIG_TX_SKIP
int16_t vp9_dc_quant(int qindex, int delta, vpx_bit_depth_t bit_depth);

View File

@ -201,6 +201,13 @@ static void setup_plane_dequants(VP9_COMMON *cm, MACROBLOCKD *xd, int q_index) {
xd->plane[0].dequant_val_nuq =
(const dequant_val_type_nuq *)cm->y_dequant_val_nuq[q_index];
#endif // CONFIG_NEW_QUANT
#if CONFIG_TX_SKIP
xd->plane[0].dequant_pxd = cm->y_dequant_pxd[q_index];
#if CONFIG_NEW_QUANT
xd->plane[0].dequant_val_nuq_pxd =
(const dequant_val_type_nuq *)cm->y_dequant_val_nuq_pxd[q_index];
#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX_SKIP
for (i = 1; i < MAX_MB_PLANE; i++) {
xd->plane[i].dequant = cm->uv_dequant[q_index];
@ -208,6 +215,13 @@ static void setup_plane_dequants(VP9_COMMON *cm, MACROBLOCKD *xd, int q_index) {
xd->plane[i].dequant_val_nuq =
(const dequant_val_type_nuq *)cm->uv_dequant_val_nuq[q_index];
#endif // CONFIG_NEW_QUANT
#if CONFIG_TX_SKIP
xd->plane[i].dequant_pxd = cm->uv_dequant_pxd[q_index];
#if CONFIG_NEW_QUANT
xd->plane[i].dequant_val_nuq_pxd =
(const dequant_val_type_nuq *)cm->uv_dequant_val_nuq_pxd[q_index];
#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX_SKIP
}
}
@ -2588,6 +2602,24 @@ void vp9_init_dequantizer(VP9_COMMON *cm) {
cm->uv_dequant_val_nuq[q][b], NULL);
}
#endif // CONFIG_NEW_QUANT
#if CONFIG_TX_SKIP
cm->y_dequant_pxd[q][0] = cm->y_dequant[q][PXD_QUANT_INDEX];
cm->y_dequant_pxd[q][1] = cm->y_dequant[q][PXD_QUANT_INDEX];
cm->uv_dequant_pxd[q][0] = cm->uv_dequant[q][PXD_QUANT_INDEX];
cm->uv_dequant_pxd[q][1] = cm->uv_dequant[q][PXD_QUANT_INDEX];
#if CONFIG_NEW_QUANT
for (b = 0; b < COEF_BANDS; ++b) {
vp9_get_dequant_val_nuq(
cm->y_dequant_pxd[q][b != 0], b, cm->bit_depth,
cm->y_dequant_val_nuq_pxd[q][b], NULL);
vp9_get_dequant_val_nuq(
cm->uv_dequant_pxd[q][b != 0], b, cm->bit_depth,
cm->uv_dequant_val_nuq_pxd[q][b], NULL);
}
#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX_SKIP
(void) b;
}
}

View File

@ -252,9 +252,19 @@ int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
int eob;
eob = decode_coefs(cm, xd, pd->plane_type,
BLOCK_OFFSET(pd->dqcoeff, block), tx_size,
#if CONFIG_TX_SKIP
xd->mi->src_mi->mbmi.tx_skip[plane != 0] ?
pd->dequant_pxd : pd->dequant,
#else
pd->dequant,
#endif // CONFIG_TX_SKIP
#if CONFIG_NEW_QUANT
#if CONFIG_TX_SKIP
xd->mi->src_mi->mbmi.tx_skip[plane != 0] ?
pd->dequant_val_nuq_pxd : pd->dequant_val_nuq,
#else
pd->dequant_val_nuq,
#endif // CONFIG_TX_SKIP
#endif // CONFIG_NEW_QUANT
ctx, so->scan,
so->neighbors, r);

View File

@ -40,7 +40,18 @@ struct macroblock_plane {
int16_t *round;
#if CONFIG_NEW_QUANT
cumbins_type_nuq *cumbins_nuq;
#endif
#endif // CONFIG_NEW_QUANT
#if CONFIG_TX_SKIP
int16_t *quant_pxd_fp;
int16_t *round_pxd_fp;
int16_t *quant_pxd;
int16_t *quant_shift_pxd;
int16_t *zbin_pxd;
int16_t *round_pxd;
#if CONFIG_NEW_QUANT
cumbins_type_nuq *cumbins_nuq_pxd;
#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX_SKIP
int64_t quant_thred[2];
};

View File

@ -146,7 +146,13 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block,
const int default_eob = 16 << (tx_size << 1);
const int shift = (tx_size >= TX_32X32 ? tx_size - TX_16X16 : 0);
const int mul = 1 << shift;
#if CONFIG_TX_SKIP
const int16_t *dequant_ptr =
xd->mi[0].src_mi->mbmi.tx_skip[plane != 0] ?
pd->dequant_pxd : pd->dequant;
#else
const int16_t *dequant_ptr = pd->dequant;
#endif // CONFIG_TX_SKIP
#if CONFIG_NEW_QUANT
#if CONFIG_TX_SKIP
const int use_rect_quant = is_rect_quant_used(&xd->mi[0].src_mi->mbmi, plane);
@ -174,6 +180,11 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block,
assert((!type && !plane) || (type && plane));
assert(eob <= default_eob);
#if CONFIG_TX_SKIP && CONFIG_NEW_QUANT
if (xd->mi[0].src_mi->mbmi.tx_skip[plane != 0])
dequant_val = pd->dequant_val_nuq_pxd;
#endif // CONFIG_TX_SKIP && CONFIG_NEW_QUANT
/* Now set up a Viterbi trellis to evaluate alternative roundings. */
if (!ref)
rdmult = (rdmult * 9) >> 4;
@ -723,16 +734,42 @@ void vp9_xform_quant_nuq(MACROBLOCK *x, int plane, int block,
band = vp9_coefband_tx_skip;
vp9_tx_identity(src_diff, coeff, diff_stride, bs, shift);
if (tx_size <= TX_16X16) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_nuq(coeff, bs * bs, x->skip_block,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_nuq(coeff, bs * bs, 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,
p->quant_pxd, p->quant_shift_pxd, pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
} else if (tx_size == TX_32X32) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_32x32_nuq(coeff, bs * bs, x->skip_block,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_32x32_nuq(coeff, bs * bs, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
qcoeff, dqcoeff, eob,
@ -740,9 +777,23 @@ void vp9_xform_quant_nuq(MACROBLOCK *x, int plane, int block,
}
#if CONFIG_TX64X64
else if (tx_size == TX_64X64) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_64x64_nuq(coeff, bs * bs, x->skip_block,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_64x64_nuq(coeff, bs * bs, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
qcoeff, dqcoeff, eob,
@ -926,28 +977,64 @@ void vp9_xform_quant_fp_nuq(MACROBLOCK *x, int plane, int block,
band = vp9_coefband_tx_skip;
vp9_tx_identity(src_diff, coeff, diff_stride, bs, shift);
if (tx_size <= TX_16X16) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
(const dequant_val_type_nuq *)pd->dequant_val_nuq,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
} else if (tx_size == TX_32X32) {
vp9_quantize_32x32_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_32x32_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_32x32_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
}
#if CONFIG_TX64X64
else if (tx_size == TX_64X64) {
vp9_quantize_64x64_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_64x64_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_64x64_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
}
@ -1125,23 +1212,55 @@ void vp9_xform_quant_dc_nuq(MACROBLOCK *x, int plane, int block,
int bs = 4 << tx_size;
vp9_tx_identity(src_diff, coeff, diff_stride, bs, shift);
if (tx_size <= TX_16X16) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_dc_nuq(coeff, x->skip_block,
p->quant_pxd[0], p->quant_shift_pxd[0],
pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0],
pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
#endif // CONFIG_VP9_HIGHBITDEPTH
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],
p->quant_pxd[0], p->quant_shift_pxd[0],
pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0], pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
} else if (tx_size == TX_32X32) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_dc_32x32_nuq(coeff, x->skip_block,
p->quant_pxd[0], p->quant_shift_pxd[0],
pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0],
pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
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],
p->quant_pxd[0], p->quant_shift_pxd[0],
pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0],
pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
}
#if CONFIG_TX64X64
else if (tx_size == TX_64X64) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_dc_64x64_nuq(coeff, x->skip_block,
p->quant_pxd[0], p->quant_shift_pxd[0],
pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0],
pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
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],
p->quant_pxd[0], p->quant_shift_pxd[0],
pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0],
pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
}
#endif // CONFIG_TX64X64
@ -1300,21 +1419,53 @@ void vp9_xform_quant_dc_fp_nuq(MACROBLOCK *x, int plane, int block,
int bs = 4 << tx_size;
vp9_tx_identity(src_diff, coeff, diff_stride, bs, shift);
if (tx_size <= TX_16X16) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_dc_fp_nuq(coeff, x->skip_block,
p->quant_pxd_fp[0], pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0],
pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
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],
p->quant_pxd_fp[0], pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0],
pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
} else if (tx_size == TX_32X32) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_dc_32x32_fp_nuq(coeff, x->skip_block,
p->quant_pxd_fp[0],
pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0],
pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
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],
p->quant_pxd_fp[0], pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0],
pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
}
#if CONFIG_TX64X64
else if (tx_size == TX_64X64) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
vp9_highbd_quantize_dc_64x64_fp_nuq(coeff, x->skip_block,
p->quant_pxd_fp[0],
pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0],
pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
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],
p->quant_pxd_fp[0], pd->dequant_pxd[0],
p->cumbins_nuq_pxd[0],
pd->dequant_val_nuq_pxd[0],
qcoeff, dqcoeff, eob);
}
#endif // CONFIG_TX64X64
@ -1479,44 +1630,46 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
if (tx_size <= TX_16X16) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_fp(coeff, bs * bs, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
vp9_highbd_quantize_fp(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd, p->quant_shift_pxd,
qcoeff, dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_fp(coeff, bs * bs, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
vp9_quantize_fp(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd, p->quant_shift_pxd, qcoeff,
dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
} else if (tx_size == TX_32X32) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_fp_32x32(coeff, bs * bs, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift,
qcoeff, dqcoeff, pd->dequant, eob,
vp9_highbd_quantize_fp_32x32(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd,
p->quant_shift_pxd,
qcoeff, dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_fp_32x32(coeff, bs * bs, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
vp9_quantize_fp_32x32(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd, p->quant_shift_pxd,
qcoeff, dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
}
#if CONFIG_TX64X64
else if (tx_size == TX_64X64) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_fp_64x64(coeff, bs * bs, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift,
qcoeff, dqcoeff, pd->dequant, eob,
vp9_highbd_quantize_fp_64x64(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd,
p->quant_shift_pxd, qcoeff, dqcoeff,
pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_fp_64x64(coeff, bs * bs, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
vp9_quantize_fp_64x64(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd, p->quant_shift_pxd,
qcoeff, dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
}
#endif // CONFIG_TX64X64
@ -1671,38 +1824,38 @@ void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
if (tx_size <= TX_16X16) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_dc(coeff, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
vp9_highbd_quantize_dc(coeff, x->skip_block, p->round_pxd,
p->quant_pxd_fp[0], qcoeff, dqcoeff,
pd->dequant_pxd[0], eob);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_dc(coeff, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
vp9_quantize_dc(coeff, x->skip_block, p->round_pxd,
p->quant_pxd_fp[0], qcoeff, dqcoeff,
pd->dequant_pxd[0], eob);
} else if (tx_size == TX_32X32) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_dc_32x32(coeff, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
vp9_highbd_quantize_dc_32x32(coeff, x->skip_block, p->round_pxd,
p->quant_pxd_fp[0], qcoeff, dqcoeff,
pd->dequant_pxd[0], eob);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_dc_32x32(coeff, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
vp9_quantize_dc_32x32(coeff, x->skip_block, p->round_pxd,
p->quant_pxd_fp[0], qcoeff, dqcoeff,
pd->dequant_pxd[0], eob);
}
#if CONFIG_TX64X64
else if (tx_size == TX_64X64) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_dc_64x64(coeff, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
vp9_highbd_quantize_dc_64x64(coeff, x->skip_block, p->round_pxd,
p->quant_pxd_fp[0], qcoeff, dqcoeff,
pd->dequant_pxd[0], eob);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_dc_64x64(coeff, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
vp9_quantize_dc_64x64(coeff, x->skip_block, p->round_pxd,
p->quant_pxd_fp[0], qcoeff, dqcoeff,
pd->dequant_pxd[0], eob);
}
#endif // CONFIG_TX64X64
@ -1849,44 +2002,46 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
if (tx_size <= TX_16X16) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_b(coeff, bs * bs, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
vp9_highbd_quantize_b(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd, p->quant_shift_pxd,
qcoeff, dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_b(coeff, bs * bs, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
vp9_quantize_b(coeff, bs * bs, x->skip_block, p->zbin_pxd, p->round_pxd,
p->quant_pxd, p->quant_shift_pxd, qcoeff, dqcoeff,
pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
} else if (tx_size == TX_32X32) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_b_32x32(coeff, bs * bs, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift,
qcoeff, dqcoeff, pd->dequant, eob,
vp9_highbd_quantize_b_32x32(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd,
p->quant_shift_pxd, qcoeff, dqcoeff,
pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_b_32x32(coeff, bs * bs, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
vp9_quantize_b_32x32(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd, p->quant_shift_pxd,
qcoeff, dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
}
#if CONFIG_TX64X64
else if (tx_size == TX_64X64) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_b_64x64(coeff, bs * bs, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift, qcoeff,
dqcoeff, pd->dequant, eob, scan_order->scan,
vp9_highbd_quantize_b_64x64(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd,
p->quant_shift_pxd, qcoeff, dqcoeff,
pd->dequant_pxd, eob, scan_order->scan,
scan_order->iscan);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_b_64x64(coeff, bs * bs, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
vp9_quantize_b_64x64(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd, p->quant_shift_pxd,
qcoeff, dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
}
#endif // CONFIG_TX64X64
@ -2350,9 +2505,10 @@ static int vp9_dpcm_intra(uint8_t *src, int src_stride,
dst + i, dst_stride);
vp9_tx_identity_rect(src_diff + i, coeff + i, bs, 1,
diff_stride, bs, shift);
vp9_quantize_rect(coeff + i, bs, 1, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff + i, dqcoeff + i,
pd->dequant, logsizeby32, bs, i == 0, 0);
vp9_quantize_rect(coeff + i, bs, 1, p->zbin_pxd, p->round_pxd,
p->quant_pxd,
p->quant_shift_pxd, qcoeff + i, dqcoeff + i,
pd->dequant_pxd, logsizeby32, bs, i == 0, 0);
vp9_tx_identity_add_rect(dqcoeff + i, dst + i, bs, 1,
bs, dst_stride, shift);
if (i < bs - 1)
@ -2370,9 +2526,10 @@ static int vp9_dpcm_intra(uint8_t *src, int src_stride,
vp9_tx_identity_rect(src_diff + diff_stride * i,
coeff + bs * i, 1, bs,
diff_stride, bs, shift);
vp9_quantize_rect(coeff + bs * i, 1, bs, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff + bs * i, dqcoeff + bs * i,
pd->dequant, logsizeby32, bs, i == 0, 0);
vp9_quantize_rect(coeff + bs * i, 1, bs, p->zbin_pxd, p->round_pxd,
p->quant_pxd,
p->quant_shift_pxd, qcoeff + bs * i, dqcoeff + bs * i,
pd->dequant_pxd, logsizeby32, bs, i == 0, 0);
vp9_tx_identity_add_rect(dqcoeff + bs * i, dst + dst_stride * i,
1, bs, bs, dst_stride, shift);
if (i < bs - 1)
@ -2384,8 +2541,8 @@ static int vp9_dpcm_intra(uint8_t *src, int src_stride,
vp9_subtract_block_c(1, bs, src_diff, diff_stride, src, src_stride,
dst, dst_stride);
vp9_tx_identity_rect(src_diff, coeff, 1, bs, diff_stride, bs, shift);
vp9_quantize_rect(coeff, 1, bs, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff, pd->dequant,
vp9_quantize_rect(coeff, 1, bs, p->zbin_pxd, p->round_pxd, p->quant_pxd,
p->quant_shift_pxd, qcoeff, dqcoeff, pd->dequant_pxd,
logsizeby32, bs, 1, 0);
vp9_tx_identity_add_rect(dqcoeff, dst, 1, bs, bs, dst_stride, shift);
@ -2394,9 +2551,10 @@ static int vp9_dpcm_intra(uint8_t *src, int src_stride,
dst + dst_stride, dst_stride);
vp9_tx_identity_rect(src_diff + diff_stride, coeff + bs, bs - 1, 1,
diff_stride, bs, shift);
vp9_quantize_rect(coeff + bs, bs - 1, 1, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff + bs, dqcoeff + bs,
pd->dequant, logsizeby32, bs, 0, 0);
vp9_quantize_rect(coeff + bs, bs - 1, 1, p->zbin_pxd, p->round_pxd,
p->quant_pxd,
p->quant_shift_pxd, qcoeff + bs, dqcoeff + bs,
pd->dequant_pxd, logsizeby32, bs, 0, 0);
vp9_tx_identity_add_rect(dqcoeff + bs, dst + dst_stride, bs - 1, 1,
bs, dst_stride, shift);
@ -2413,10 +2571,10 @@ static int vp9_dpcm_intra(uint8_t *src, int src_stride,
vp9_tx_identity_rect(src_diff + i * diff_stride + j,
coeff + bs * i + j, 1, 1, diff_stride,
bs, shift);
vp9_quantize_rect(coeff + bs * i + j, 1, 1, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff + bs * i + j,
dqcoeff + bs * i + j, pd->dequant,
logsizeby32, bs, 0, 0);
vp9_quantize_rect(coeff + bs * i + j, 1, 1, p->zbin_pxd, p->round_pxd,
p->quant_pxd, p->quant_shift_pxd,
qcoeff + bs * i + j, dqcoeff + bs * i + j,
pd->dequant_pxd, logsizeby32, bs, 0, 0);
vp9_tx_identity_add_rect(dqcoeff + bs * i + j,
dst + dst_stride * i + j, 1, 1, bs,
dst_stride, shift);
@ -2457,9 +2615,10 @@ static int vp9_highbd_dpcm_intra(uint8_t *src, int src_stride,
dst_stride, bd);
vp9_tx_identity_rect(src_diff + i, coeff + i, bs, 1,
diff_stride, bs, shift);
vp9_quantize_rect(coeff + i, bs, 1, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff + i, dqcoeff + i,
pd->dequant, logsizeby32, bs, i == 0, 1);
vp9_quantize_rect(coeff + i, bs, 1, p->zbin_pxd, p->round_pxd,
p->quant_pxd, p->quant_shift_pxd, qcoeff + i,
dqcoeff + i, pd->dequant_pxd, logsizeby32, bs,
i == 0, 1);
vp9_highbd_tx_identity_add_rect(dqcoeff + i, dst + i, bs, 1,
bs, dst_stride, shift, bd);
if (i < bs - 1)
@ -2476,9 +2635,10 @@ static int vp9_highbd_dpcm_intra(uint8_t *src, int src_stride,
dst_stride, bd);
vp9_tx_identity_rect(src_diff + diff_stride * i, coeff + bs * i, 1, bs,
diff_stride, bs, shift);
vp9_quantize_rect(coeff + bs * i, 1, bs, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff + bs * i, dqcoeff + bs * i,
pd->dequant, logsizeby32, bs, i == 0, 1);
vp9_quantize_rect(coeff + bs * i, 1, bs, p->zbin_pxd, p->round_pxd,
p->quant_pxd, p->quant_shift_pxd, qcoeff + bs * i,
dqcoeff + bs * i, pd->dequant_pxd, logsizeby32, bs,
i == 0, 1);
vp9_highbd_tx_identity_add_rect(dqcoeff + bs * i, dst + dst_stride * i,
1, bs, bs, dst_stride, shift, bd);
if (i < bs - 1)
@ -2490,8 +2650,8 @@ static int vp9_highbd_dpcm_intra(uint8_t *src, int src_stride,
vp9_highbd_subtract_block_c(1, bs, src_diff, diff_stride, src, src_stride,
dst, dst_stride, bd);
vp9_tx_identity_rect(src_diff, coeff, 1, bs, diff_stride, bs, shift);
vp9_quantize_rect(coeff, 1, bs, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff, pd->dequant,
vp9_quantize_rect(coeff, 1, bs, p->zbin_pxd, p->round_pxd, p->quant_pxd,
p->quant_shift_pxd, qcoeff, dqcoeff, pd->dequant_pxd,
logsizeby32, bs, 1, 1);
vp9_highbd_tx_identity_add_rect(dqcoeff, dst, 1, bs, bs, dst_stride,
shift, bd);
@ -2500,9 +2660,9 @@ static int vp9_highbd_dpcm_intra(uint8_t *src, int src_stride,
dst + dst_stride, dst_stride, bd);
vp9_tx_identity_rect(src_diff + diff_stride, coeff + bs, bs - 1, 1,
diff_stride, bs, shift);
vp9_quantize_rect(coeff + bs, bs - 1, 1, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff + bs, dqcoeff + bs,
pd->dequant, logsizeby32, bs, 0, 1);
vp9_quantize_rect(coeff + bs, bs - 1, 1, p->zbin_pxd, p->round_pxd,
p->quant_pxd, p->quant_shift_pxd, qcoeff + bs,
dqcoeff + bs, pd->dequant_pxd, logsizeby32, bs, 0, 1);
vp9_highbd_tx_identity_add_rect(dqcoeff + bs, dst + dst_stride, bs - 1, 1,
bs, dst_stride, shift, bd);
@ -2519,9 +2679,10 @@ static int vp9_highbd_dpcm_intra(uint8_t *src, int src_stride,
vp9_tx_identity_rect(src_diff + i * diff_stride + j,
coeff + bs * i + j, 1, 1, diff_stride,
bs, shift);
vp9_quantize_rect(coeff + bs * i + j, 1, 1, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff + bs * i + j,
dqcoeff + bs * i + j, pd->dequant,
vp9_quantize_rect(coeff + bs * i + j, 1, 1, p->zbin_pxd, p->round_pxd,
p->quant_pxd, p->quant_shift_pxd,
qcoeff + bs * i + j, dqcoeff + bs * i + j,
pd->dequant_pxd,
logsizeby32, bs, 0, 1);
vp9_highbd_tx_identity_add_rect(dqcoeff + bs * i + j,
dst + dst_stride * i + j, 1, 1, bs,
@ -2610,18 +2771,13 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
scan_order, mode, tx_size, shift,
tx_size > TX_16X16 ? 0 : -1, xd->bd);
else
*eob = vp9_dpcm_intra(src, src_stride, dst, dst_stride,
src_diff, diff_stride,
coeff, qcoeff, dqcoeff, p, pd,
scan_order, mode, tx_size, shift,
tx_size > TX_16X16 ? 0 : -1);
#else
*eob = vp9_dpcm_intra(src, src_stride, dst, dst_stride,
src_diff, diff_stride,
coeff, qcoeff, dqcoeff, p, pd,
scan_order, mode, tx_size, shift,
tx_size > TX_16X16 ? 0 : -1);
#endif // CONFIG_VP9_HIGHBITDEPTH
*eob = vp9_dpcm_intra(src, src_stride, dst, dst_stride,
src_diff, diff_stride,
coeff, qcoeff, dqcoeff, p, pd,
scan_order, mode, tx_size, shift,
tx_size > TX_16X16 ? 0 : -1);
if (*eob)
*(args->skip) = 0;
return;
@ -2651,74 +2807,72 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
if (use_hbd) {
if (x->quant_fp)
vp9_highbd_quantize_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
vp9_highbd_quantize_nuq(coeff, bs * bs, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
} else {
if (x->quant_fp)
vp9_quantize_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
vp9_quantize_nuq(coeff, bs * bs, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd, p->quant_shift_pxd, pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
}
#else // CONFIG_VP9_HIGHBITDEPTH
if (x->quant_fp)
vp9_quantize_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
vp9_quantize_nuq(coeff, bs * bs, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd, p->quant_shift_pxd, pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
#endif // CONFIG_VP9_HIGHBITDEPTH
#else // CONFIG_NEW_QUANT
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_b(coeff, bs * bs, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift, qcoeff,
dqcoeff, pd->dequant, eob,
vp9_highbd_quantize_b(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd, p->quant_shift_pxd,
qcoeff, dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
else
vp9_quantize_b(coeff, bs * bs, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
#else // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_b(coeff, bs * bs, 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_VP9_HIGHBITDEPTH
vp9_quantize_b(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd, p->quant_shift_pxd,
qcoeff, dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
#endif // CONFIG_NEW_QUANT
} else if (tx_size == TX_32X32) {
#if CONFIG_NEW_QUANT
@ -2726,76 +2880,77 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
if (use_hbd) {
if (x->quant_fp)
vp9_highbd_quantize_32x32_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)p->
cumbins_nuq,
cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
vp9_highbd_quantize_32x32_nuq(coeff, bs * bs, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq,
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
} else {
if (x->quant_fp)
vp9_quantize_32x32_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
vp9_quantize_32x32_nuq(coeff, bs * bs, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
}
#else // CONFIG_VP9_HIGHBITDEPTH
if (x->quant_fp)
vp9_quantize_32x32_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
vp9_quantize_32x32_nuq(coeff, bs * bs, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
scan_order->scan, band);/**/
#endif // CONFIG_VP9_HIGHBITDEPTH
#else // CONFIG_NEW_QUANT
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_b_32x32(coeff, bs * bs, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift,
qcoeff, dqcoeff, pd->dequant, eob,
vp9_highbd_quantize_b_32x32(coeff, bs * bs, x->skip_block,
p->zbin_pxd, p->round_pxd, p->quant_pxd,
p->quant_shift_pxd, qcoeff, dqcoeff,
pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
else
vp9_quantize_b_32x32(coeff, bs * bs, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift, qcoeff,
dqcoeff, pd->dequant, eob,
scan_order->scan, scan_order->iscan);
#else // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_b_32x32(coeff, bs * bs, 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_VP9_HIGHBITDEPTH
vp9_quantize_b_32x32(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd, p->quant_shift_pxd,
qcoeff, dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
#endif // CONFIG_NEW_QUANT
}
#if CONFIG_TX64X64
@ -2805,78 +2960,79 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
if (use_hbd) {
if (x->quant_fp)
vp9_highbd_quantize_64x64_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq,
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
vp9_highbd_quantize_64x64_nuq(coeff, bs * bs, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq,
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
} else {
if (x->quant_fp)
vp9_quantize_64x64_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq,
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
vp9_quantize_64x64_nuq(coeff, bs * bs, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
}
#else
if (x->quant_fp)
vp9_quantize_64x64_fp_nuq(coeff, bs * bs, x->skip_block,
p->quant_fp, pd->dequant,
p->quant_pxd_fp, pd->dequant_pxd,
(const cumbins_type_nuq *)
p->cumbins_nuq,
p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
else
vp9_quantize_64x64_nuq(coeff, bs * bs, x->skip_block,
p->quant, p->quant_shift, pd->dequant,
(const cumbins_type_nuq *)p->cumbins_nuq,
p->quant_pxd, p->quant_shift_pxd,
pd->dequant_pxd,
(const cumbins_type_nuq *)p->cumbins_nuq_pxd,
(const dequant_val_type_nuq *)
pd->dequant_val_nuq,
pd->dequant_val_nuq_pxd,
qcoeff, dqcoeff, eob,
scan_order->scan, band);
#endif // CONFIG_VP9_HIGHBITDEPTH
#else // CONFIG_NEW_QUANT
#if CONFIG_VP9_HIGHBITDEPTH
if (use_hbd)
vp9_highbd_quantize_b_64x64(coeff, bs * bs, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift,
qcoeff, dqcoeff, pd->dequant, eob,
vp9_highbd_quantize_b_64x64(coeff, bs * bs, x->skip_block,
p->zbin_pxd, p->round_pxd, p->quant_pxd,
p->quant_shift_pxd, qcoeff, dqcoeff,
pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
else
vp9_quantize_b_64x64(coeff, bs * bs, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift, qcoeff,
dqcoeff, pd->dequant, eob,
scan_order->scan, scan_order->iscan);
#else // CONFIG_VP9_HIGHBITDEPTH
vp9_quantize_b_64x64(coeff, bs * bs, 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_VP9_HIGHBITDEPTH
vp9_quantize_b_64x64(coeff, bs * bs, x->skip_block, p->zbin_pxd,
p->round_pxd, p->quant_pxd, p->quant_shift_pxd,
qcoeff, dqcoeff, pd->dequant_pxd, eob,
scan_order->scan, scan_order->iscan);
#endif // CONFIG_NEW_QUANT
}
#endif // CONFIG_TX64X64
@ -2888,10 +3044,8 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
vp9_highbd_tx_identity_add(dqcoeff, dst, dst_stride, 4 << tx_size,
shift, xd->bd);
else
vp9_tx_identity_add(dqcoeff, dst, dst_stride, 4 << tx_size, shift);
#else
vp9_tx_identity_add(dqcoeff, dst, dst_stride, 4 << tx_size, shift);
#endif // CONFIG_VP9_HIGHBITDEPTH
vp9_tx_identity_add(dqcoeff, dst, dst_stride, 4 << tx_size, shift);
}
if (*eob)

View File

@ -2018,6 +2018,40 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
quants->uv_round[q][i] = quants->uv_round[q][1];
cm->uv_dequant[q][i] = cm->uv_dequant[q][1];
}
#if CONFIG_TX_SKIP
for (i = 0; i < 8; i++) {
quants->y_quant_pxd[q][i] = quants->y_quant[q][PXD_QUANT_INDEX];
quants->y_quant_pxd_fp[q][i] = quants->y_quant_fp[q][PXD_QUANT_INDEX];
quants->y_round_pxd_fp[q][i] = quants->y_round_fp[q][PXD_QUANT_INDEX];
quants->y_quant_shift_pxd[q][i] =
quants->y_quant_shift[q][PXD_QUANT_INDEX];
quants->y_zbin_pxd[q][i] = quants->y_zbin[q][PXD_QUANT_INDEX];
quants->y_round_pxd[q][i] = quants->y_round[q][PXD_QUANT_INDEX];
cm->y_dequant_pxd[q][i] = cm->y_dequant[q][PXD_QUANT_INDEX];
quants->uv_quant_pxd[q][i] = quants->uv_quant[q][PXD_QUANT_INDEX];
quants->uv_quant_pxd_fp[q][i] = quants->uv_quant_fp[q][PXD_QUANT_INDEX];
quants->uv_round_pxd_fp[q][i] = quants->uv_round_fp[q][PXD_QUANT_INDEX];
quants->uv_quant_shift_pxd[q][i] =
quants->uv_quant_shift[q][PXD_QUANT_INDEX];
quants->uv_zbin_pxd[q][i] = quants->uv_zbin[q][PXD_QUANT_INDEX];
quants->uv_round_pxd[q][i] = quants->uv_round[q][PXD_QUANT_INDEX];
cm->uv_dequant_pxd[q][i] = cm->uv_dequant[q][PXD_QUANT_INDEX];
}
#if CONFIG_NEW_QUANT
for (i = 0; i < COEF_BANDS; i++) {
const int quant = cm->y_dequant_pxd[q][i != 0];
const int uvquant = cm->uv_dequant_pxd[q][i != 0];
vp9_get_dequant_val_nuq(quant, i, cm->bit_depth,
cm->y_dequant_val_nuq_pxd[q][i],
quants->y_cumbins_nuq_pxd[q][i]);
vp9_get_dequant_val_nuq(uvquant, i, cm->bit_depth,
cm->uv_dequant_val_nuq_pxd[q][i],
quants->uv_cumbins_nuq_pxd[q][i]);
}
#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX_SKIP
}
}
@ -2041,7 +2075,20 @@ void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) {
#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
#endif // CONFIG_NEW_QUANT
#if CONFIG_TX_SKIP
x->plane[0].quant_pxd = quants->y_quant_pxd[qindex];
x->plane[0].quant_pxd_fp = quants->y_quant_pxd_fp[qindex];
x->plane[0].round_pxd_fp = quants->y_round_pxd_fp[qindex];
x->plane[0].quant_shift_pxd = quants->y_quant_shift_pxd[qindex];
x->plane[0].zbin_pxd = quants->y_zbin_pxd[qindex];
x->plane[0].round_pxd = quants->y_round_pxd[qindex];
xd->plane[0].dequant_pxd = cm->y_dequant_pxd[qindex];
#if CONFIG_NEW_QUANT
x->plane[0].cumbins_nuq_pxd = quants->y_cumbins_nuq_pxd[qindex];
xd->plane[0].dequant_val_nuq_pxd = cm->y_dequant_val_nuq_pxd[qindex];
#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX_SKIP
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];
@ -2058,7 +2105,20 @@ void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) {
#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
#endif // CONFIG_NEW_QUANT
#if CONFIG_TX_SKIP
x->plane[i].quant_pxd = quants->uv_quant_pxd[qindex];
x->plane[i].quant_pxd_fp = quants->uv_quant_pxd_fp[qindex];
x->plane[i].round_pxd_fp = quants->uv_round_pxd_fp[qindex];
x->plane[i].quant_shift_pxd = quants->uv_quant_shift_pxd[qindex];
x->plane[i].zbin_pxd = quants->uv_zbin_pxd[qindex];
x->plane[i].round_pxd = quants->uv_round_pxd[qindex];
xd->plane[i].dequant_pxd = cm->uv_dequant_pxd[qindex];
#if CONFIG_NEW_QUANT
x->plane[i].cumbins_nuq_pxd = quants->uv_cumbins_nuq_pxd[qindex];
xd->plane[i].dequant_val_nuq_pxd = cm->uv_dequant_val_nuq_pxd[qindex];
#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX_SKIP
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];

View File

@ -42,6 +42,31 @@ typedef struct {
DECLARE_ALIGNED(16, int16_t, uv_quant_shift[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_zbin[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]);
#if CONFIG_TX_SKIP
DECLARE_ALIGNED(16, int16_t, y_quant_pxd[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, y_quant_shift_pxd[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, y_zbin_pxd[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, y_round_pxd[QINDEX_RANGE][8]);
// TODO(jingning): in progress of re-working the quantization. will decide
// if we want to deprecate the current use of y_quant.
DECLARE_ALIGNED(16, int16_t, y_quant_pxd_fp[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_quant_pxd_fp[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, y_round_pxd_fp[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_round_pxd_fp[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_quant_pxd[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_quant_shift_pxd[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_zbin_pxd[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_round_pxd[QINDEX_RANGE][8]);
#if CONFIG_NEW_QUANT
DECLARE_ALIGNED(16, tran_low_t,
y_cumbins_nuq_pxd[QINDEX_RANGE][COEF_BANDS][NUQ_KNOTES]);
DECLARE_ALIGNED(16, tran_low_t,
uv_cumbins_nuq_pxd[QINDEX_RANGE][COEF_BANDS][NUQ_KNOTES]);
#endif // CONFIG_NEW_QUANT
#endif // CONFIG_TX_SKIP
} QUANTS;
void vp9_quantize_dc(const tran_low_t *coeff_ptr, int skip_block,