| Index: source/libvpx/vp9/encoder/vp9_quantize.c
|
| ===================================================================
|
| --- source/libvpx/vp9/encoder/vp9_quantize.c (revision 292072)
|
| +++ source/libvpx/vp9/encoder/vp9_quantize.c (working copy)
|
| @@ -19,9 +19,9 @@
|
| #include "vp9/encoder/vp9_quantize.h"
|
| #include "vp9/encoder/vp9_rd.h"
|
|
|
| -void vp9_quantize_dc(const int16_t *coeff_ptr, int skip_block,
|
| +void vp9_quantize_dc(const tran_low_t *coeff_ptr, int skip_block,
|
| const int16_t *round_ptr, const int16_t quant,
|
| - int16_t *qcoeff_ptr, int16_t *dqcoeff_ptr,
|
| + tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
|
| const int16_t dequant_ptr, uint16_t *eob_ptr) {
|
| const int rc = 0;
|
| const int coeff = coeff_ptr[rc];
|
| @@ -40,9 +40,34 @@
|
| *eob_ptr = eob + 1;
|
| }
|
|
|
| -void vp9_quantize_dc_32x32(const int16_t *coeff_ptr, int skip_block,
|
| +#if CONFIG_VP9_HIGHBITDEPTH
|
| +void vp9_high_quantize_dc(const tran_low_t *coeff_ptr, int skip_block,
|
| + const int16_t *round_ptr, const int16_t quant,
|
| + tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
|
| + const int16_t dequant_ptr, uint16_t *eob_ptr) {
|
| + int eob = -1;
|
| +
|
| + if (!skip_block) {
|
| + const int rc = 0;
|
| + const int coeff = coeff_ptr[rc];
|
| + const int coeff_sign = (coeff >> 31);
|
| + const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
|
| +
|
| + const int64_t tmp =
|
| + (clamp(abs_coeff + round_ptr[rc != 0], INT32_MIN, INT32_MAX) *
|
| + quant) >> 16;
|
| + qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign;
|
| + dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr;
|
| + if (tmp)
|
| + eob = 0;
|
| + }
|
| + *eob_ptr = eob + 1;
|
| +}
|
| +#endif
|
| +
|
| +void vp9_quantize_dc_32x32(const tran_low_t *coeff_ptr, int skip_block,
|
| const int16_t *round_ptr, const int16_t quant,
|
| - int16_t *qcoeff_ptr, int16_t *dqcoeff_ptr,
|
| + tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
|
| const int16_t dequant_ptr, uint16_t *eob_ptr) {
|
| const int rc = 0;
|
| const int coeff = coeff_ptr[rc];
|
| @@ -62,11 +87,36 @@
|
| *eob_ptr = eob + 1;
|
| }
|
|
|
| -void vp9_quantize_fp_c(const int16_t *coeff_ptr, intptr_t count,
|
| +#if CONFIG_VP9_HIGHBITDEPTH
|
| +void vp9_high_quantize_dc_32x32(const tran_low_t *coeff_ptr, int skip_block,
|
| + const int16_t *round_ptr, const int16_t quant,
|
| + tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
|
| + const int16_t dequant_ptr, uint16_t *eob_ptr) {
|
| + int eob = -1;
|
| +
|
| + if (!skip_block) {
|
| + const int rc = 0;
|
| + const int coeff = coeff_ptr[rc];
|
| + const int coeff_sign = (coeff >> 31);
|
| + const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
|
| +
|
| + const int64_t tmp =
|
| + (clamp(abs_coeff + round_ptr[rc != 0], INT32_MIN, INT32_MAX) *
|
| + quant) >> 15;
|
| + qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign;
|
| + dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr / 2;
|
| + if (tmp)
|
| + eob = 0;
|
| + }
|
| + *eob_ptr = eob + 1;
|
| +}
|
| +#endif
|
| +
|
| +void vp9_quantize_fp_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
|
| int skip_block,
|
| const int16_t *zbin_ptr, const int16_t *round_ptr,
|
| const int16_t *quant_ptr, const int16_t *quant_shift_ptr,
|
| - int16_t *qcoeff_ptr, int16_t *dqcoeff_ptr,
|
| + tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
|
| const int16_t *dequant_ptr,
|
| int zbin_oq_value, uint16_t *eob_ptr,
|
| const int16_t *scan, const int16_t *iscan) {
|
| @@ -78,13 +128,13 @@
|
| (void)zbin_oq_value;
|
| (void)iscan;
|
|
|
| - vpx_memset(qcoeff_ptr, 0, count * sizeof(int16_t));
|
| - vpx_memset(dqcoeff_ptr, 0, count * sizeof(int16_t));
|
| + vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
|
| + vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
|
|
|
| if (!skip_block) {
|
| // Quantization pass: All coefficients with index >= zero_flag are
|
| // skippable. Note: zero_flag can be zero.
|
| - for (i = 0; i < count; i++) {
|
| + for (i = 0; i < n_coeffs; i++) {
|
| const int rc = scan[i];
|
| const int coeff = coeff_ptr[rc];
|
| const int coeff_sign = (coeff >> 31);
|
| @@ -103,14 +153,59 @@
|
| *eob_ptr = eob + 1;
|
| }
|
|
|
| +#if CONFIG_VP9_HIGHBITDEPTH
|
| +void vp9_high_quantize_fp_c(const tran_low_t *coeff_ptr, intptr_t count,
|
| + int skip_block, const int16_t *zbin_ptr,
|
| + const int16_t *round_ptr, const int16_t *quant_ptr,
|
| + const int16_t *quant_shift_ptr,
|
| + tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
|
| + const int16_t *dequant_ptr,
|
| + int zbin_oq_value, uint16_t *eob_ptr,
|
| + const int16_t *scan, const int16_t *iscan) {
|
| + int i;
|
| + int eob = -1;
|
| + // TODO(jingning) Decide the need of these arguments after the
|
| + // quantization process is completed.
|
| + (void)zbin_ptr;
|
| + (void)quant_shift_ptr;
|
| + (void)zbin_oq_value;
|
| + (void)iscan;
|
| +
|
| + vpx_memset(qcoeff_ptr, 0, count * sizeof(*qcoeff_ptr));
|
| + vpx_memset(dqcoeff_ptr, 0, count * sizeof(*dqcoeff_ptr));
|
| +
|
| + if (!skip_block) {
|
| + // Quantization pass: All coefficients with index >= zero_flag are
|
| + // skippable. Note: zero_flag can be zero.
|
| + for (i = 0; i < count; i++) {
|
| + const int rc = scan[i];
|
| + const int coeff = coeff_ptr[rc];
|
| + const int coeff_sign = (coeff >> 31);
|
| + const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
|
| +
|
| + const int64_t tmp =
|
| + (clamp(abs_coeff + round_ptr[rc != 0], INT32_MIN, INT32_MAX) *
|
| + quant_ptr[rc != 0]) >> 16;
|
| +
|
| + qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign;
|
| + dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0];
|
| +
|
| + if (tmp)
|
| + eob = i;
|
| + }
|
| + }
|
| + *eob_ptr = eob + 1;
|
| +}
|
| +#endif
|
| +
|
| // TODO(jingning) Refactor this file and combine functions with similar
|
| // operations.
|
| -void vp9_quantize_fp_32x32_c(const int16_t *coeff_ptr, intptr_t n_coeffs,
|
| +void vp9_quantize_fp_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
|
| int skip_block,
|
| const int16_t *zbin_ptr, const int16_t *round_ptr,
|
| const int16_t *quant_ptr,
|
| const int16_t *quant_shift_ptr,
|
| - int16_t *qcoeff_ptr, int16_t *dqcoeff_ptr,
|
| + tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
|
| const int16_t *dequant_ptr,
|
| int zbin_oq_value, uint16_t *eob_ptr,
|
| const int16_t *scan, const int16_t *iscan) {
|
| @@ -120,8 +215,8 @@
|
| (void)zbin_oq_value;
|
| (void)iscan;
|
|
|
| - vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(int16_t));
|
| - vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(int16_t));
|
| + vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
|
| + vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
|
|
|
| if (!skip_block) {
|
| for (i = 0; i < n_coeffs; i++) {
|
| @@ -146,27 +241,72 @@
|
| *eob_ptr = eob + 1;
|
| }
|
|
|
| -void vp9_quantize_b_c(const int16_t *coeff_ptr, intptr_t count,
|
| +#if CONFIG_VP9_HIGHBITDEPTH
|
| +void vp9_high_quantize_fp_32x32_c(const tran_low_t *coeff_ptr,
|
| + intptr_t n_coeffs, int skip_block,
|
| + const int16_t *zbin_ptr,
|
| + const int16_t *round_ptr,
|
| + const int16_t *quant_ptr,
|
| + const int16_t *quant_shift_ptr,
|
| + tran_low_t *qcoeff_ptr,
|
| + tran_low_t *dqcoeff_ptr,
|
| + const int16_t *dequant_ptr,
|
| + int zbin_oq_value, uint16_t *eob_ptr,
|
| + const int16_t *scan, const int16_t *iscan) {
|
| + int i, eob = -1;
|
| + (void)zbin_ptr;
|
| + (void)quant_shift_ptr;
|
| + (void)zbin_oq_value;
|
| + (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) {
|
| + for (i = 0; i < n_coeffs; i++) {
|
| + const int rc = scan[i];
|
| + const int coeff = coeff_ptr[rc];
|
| + const int coeff_sign = (coeff >> 31);
|
| + int64_t tmp = 0;
|
| + const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
|
| +
|
| + if (abs_coeff >= (dequant_ptr[rc != 0] >> 2)) {
|
| + tmp = clamp(abs_coeff + ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1),
|
| + INT32_MIN, INT32_MAX);
|
| + tmp = (tmp * quant_ptr[rc != 0]) >> 15;
|
| + qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign;
|
| + dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0] / 2;
|
| + }
|
| +
|
| + if (tmp)
|
| + eob = i;
|
| + }
|
| + }
|
| + *eob_ptr = eob + 1;
|
| +}
|
| +#endif
|
| +
|
| +void vp9_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
|
| int skip_block,
|
| const int16_t *zbin_ptr, const int16_t *round_ptr,
|
| const int16_t *quant_ptr, const int16_t *quant_shift_ptr,
|
| - int16_t *qcoeff_ptr, int16_t *dqcoeff_ptr,
|
| + tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
|
| const int16_t *dequant_ptr,
|
| int zbin_oq_value, uint16_t *eob_ptr,
|
| const int16_t *scan, const int16_t *iscan) {
|
| - int i, non_zero_count = (int)count, eob = -1;
|
| + int i, non_zero_count = (int)n_coeffs, eob = -1;
|
| const int zbins[2] = { zbin_ptr[0] + zbin_oq_value,
|
| zbin_ptr[1] + zbin_oq_value };
|
| const int nzbins[2] = { zbins[0] * -1,
|
| zbins[1] * -1 };
|
| (void)iscan;
|
|
|
| - vpx_memset(qcoeff_ptr, 0, count * sizeof(int16_t));
|
| - vpx_memset(dqcoeff_ptr, 0, count * sizeof(int16_t));
|
| + vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
|
| + vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
|
|
|
| if (!skip_block) {
|
| // Pre-scan pass
|
| - for (i = (int)count - 1; i >= 0; i--) {
|
| + for (i = (int)n_coeffs - 1; i >= 0; i--) {
|
| const int rc = scan[i];
|
| const int coeff = coeff_ptr[rc];
|
|
|
| @@ -199,12 +339,68 @@
|
| *eob_ptr = eob + 1;
|
| }
|
|
|
| -void vp9_quantize_b_32x32_c(const int16_t *coeff_ptr, intptr_t n_coeffs,
|
| +#if CONFIG_VP9_HIGHBITDEPTH
|
| +void vp9_high_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
|
| + int skip_block, const int16_t *zbin_ptr,
|
| + const int16_t *round_ptr, const int16_t *quant_ptr,
|
| + const int16_t *quant_shift_ptr,
|
| + tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
|
| + const int16_t *dequant_ptr, int zbin_oq_value,
|
| + uint16_t *eob_ptr, const int16_t *scan,
|
| + const int16_t *iscan) {
|
| + int i, non_zero_count = (int)n_coeffs, eob = -1;
|
| + const int zbins[2] = { zbin_ptr[0] + zbin_oq_value,
|
| + zbin_ptr[1] + zbin_oq_value };
|
| + const int nzbins[2] = { zbins[0] * -1,
|
| + zbins[1] * -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) {
|
| + // Pre-scan pass
|
| + for (i = (int)n_coeffs - 1; i >= 0; i--) {
|
| + const int rc = scan[i];
|
| + const int coeff = coeff_ptr[rc];
|
| +
|
| + if (coeff < zbins[rc != 0] && coeff > nzbins[rc != 0])
|
| + non_zero_count--;
|
| + else
|
| + break;
|
| + }
|
| +
|
| + // Quantization pass: All coefficients with index >= zero_flag are
|
| + // skippable. Note: zero_flag can be zero.
|
| + for (i = 0; i < non_zero_count; i++) {
|
| + const int rc = scan[i];
|
| + const int coeff = coeff_ptr[rc];
|
| + const int coeff_sign = (coeff >> 31);
|
| + const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
|
| +
|
| + if (abs_coeff >= zbins[rc != 0]) {
|
| + int64_t tmp = clamp(abs_coeff + round_ptr[rc != 0],
|
| + INT32_MIN, INT32_MAX);
|
| + tmp = ((((tmp * quant_ptr[rc != 0]) >> 16) + tmp) *
|
| + quant_shift_ptr[rc != 0]) >> 16; // quantization
|
| + qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign;
|
| + dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0];
|
| +
|
| + if (tmp)
|
| + eob = i;
|
| + }
|
| + }
|
| + }
|
| + *eob_ptr = eob + 1;
|
| +}
|
| +#endif
|
| +
|
| +void vp9_quantize_b_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
|
| int skip_block,
|
| const int16_t *zbin_ptr, const int16_t *round_ptr,
|
| const int16_t *quant_ptr,
|
| const int16_t *quant_shift_ptr,
|
| - int16_t *qcoeff_ptr, int16_t *dqcoeff_ptr,
|
| + tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
|
| const int16_t *dequant_ptr,
|
| int zbin_oq_value, uint16_t *eob_ptr,
|
| const int16_t *scan, const int16_t *iscan) {
|
| @@ -217,8 +413,8 @@
|
| int i, eob = -1;
|
| (void)iscan;
|
|
|
| - vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(int16_t));
|
| - vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(int16_t));
|
| + vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
|
| + vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
|
|
|
| if (!skip_block) {
|
| // Pre-scan pass
|
| @@ -255,12 +451,84 @@
|
| *eob_ptr = eob + 1;
|
| }
|
|
|
| +#if CONFIG_VP9_HIGHBITDEPTH
|
| +void vp9_high_quantize_b_32x32_c(const tran_low_t *coeff_ptr,
|
| + intptr_t n_coeffs, int skip_block,
|
| + const int16_t *zbin_ptr,
|
| + const int16_t *round_ptr,
|
| + const int16_t *quant_ptr,
|
| + const int16_t *quant_shift_ptr,
|
| + tran_low_t *qcoeff_ptr,
|
| + tran_low_t *dqcoeff_ptr,
|
| + const int16_t *dequant_ptr,
|
| + int zbin_oq_value, uint16_t *eob_ptr,
|
| + const int16_t *scan, const int16_t *iscan) {
|
| + const int zbins[2] = { ROUND_POWER_OF_TWO(zbin_ptr[0] + zbin_oq_value, 1),
|
| + ROUND_POWER_OF_TWO(zbin_ptr[1] + zbin_oq_value, 1) };
|
| + const int nzbins[2] = { zbins[0] * -1, zbins[1] * -1 };
|
| +
|
| + int idx = 0;
|
| + int idx_arr[1024];
|
| + int i, 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) {
|
| + // Pre-scan pass
|
| + for (i = 0; i < n_coeffs; i++) {
|
| + const int rc = scan[i];
|
| + const int coeff = coeff_ptr[rc];
|
| +
|
| + // If the coefficient is out of the base ZBIN range, keep it for
|
| + // quantization.
|
| + if (coeff >= zbins[rc != 0] || coeff <= nzbins[rc != 0])
|
| + idx_arr[idx++] = i;
|
| + }
|
| +
|
| + // Quantization pass: only process the coefficients selected in
|
| + // pre-scan pass. Note: idx can be zero.
|
| + for (i = 0; i < idx; i++) {
|
| + const int rc = scan[idx_arr[i]];
|
| + const int coeff = coeff_ptr[rc];
|
| + 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),
|
| + INT32_MIN, INT32_MAX);
|
| + tmp = ((((tmp * quant_ptr[rc != 0]) >> 16) + tmp) *
|
| + quant_shift_ptr[rc != 0]) >> 15;
|
| +
|
| + qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign;
|
| + dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0] / 2;
|
| +
|
| + if (tmp)
|
| + eob = idx_arr[i];
|
| + }
|
| + }
|
| + *eob_ptr = eob + 1;
|
| +}
|
| +#endif
|
| +
|
| void vp9_regular_quantize_b_4x4(MACROBLOCK *x, int plane, int block,
|
| const int16_t *scan, const int16_t *iscan) {
|
| MACROBLOCKD *const xd = &x->e_mbd;
|
| struct macroblock_plane *p = &x->plane[plane];
|
| struct macroblockd_plane *pd = &xd->plane[plane];
|
|
|
| +#if CONFIG_VP9_HIGHBITDEPTH
|
| + if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
| + vp9_high_quantize_b(BLOCK_OFFSET(p->coeff, block),
|
| + 16, x->skip_block,
|
| + p->zbin, p->round, p->quant, p->quant_shift,
|
| + BLOCK_OFFSET(p->qcoeff, block),
|
| + BLOCK_OFFSET(pd->dqcoeff, block),
|
| + pd->dequant, p->zbin_extra, &p->eobs[block],
|
| + scan, iscan);
|
| + return;
|
| + }
|
| +#endif
|
| vp9_quantize_b(BLOCK_OFFSET(p->coeff, block),
|
| 16, x->skip_block,
|
| p->zbin, p->round, p->quant, p->quant_shift,
|
| @@ -280,13 +548,33 @@
|
| *shift = 1 << (16 - l);
|
| }
|
|
|
| +static int get_qzbin_factor(int q, vpx_bit_depth_t bit_depth) {
|
| + const int quant = vp9_dc_quant(q, 0, bit_depth);
|
| +#if CONFIG_VP9_HIGHBITDEPTH
|
| + switch (bit_depth) {
|
| + case VPX_BITS_8:
|
| + return q == 0 ? 64 : (quant < 148 ? 84 : 80);
|
| + case VPX_BITS_10:
|
| + return q == 0 ? 64 : (quant < 592 ? 84 : 80);
|
| + case VPX_BITS_12:
|
| + return q == 0 ? 64 : (quant < 2368 ? 84 : 80);
|
| + default:
|
| + assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12");
|
| + return -1;
|
| + }
|
| +#else
|
| + (void) bit_depth;
|
| + return q == 0 ? 64 : (quant < 148 ? 84 : 80);
|
| +#endif
|
| +}
|
| +
|
| void vp9_init_quantizer(VP9_COMP *cpi) {
|
| VP9_COMMON *const cm = &cpi->common;
|
| QUANTS *const quants = &cpi->quants;
|
| int i, q, quant;
|
|
|
| for (q = 0; q < QINDEX_RANGE; q++) {
|
| - const int qzbin_factor = q == 0 ? 64 : (vp9_dc_quant(q, 0) < 148 ? 84 : 80);
|
| + const int qzbin_factor = get_qzbin_factor(q, cm->bit_depth);
|
| const int qrounding_factor = q == 0 ? 64 : 48;
|
|
|
| for (i = 0; i < 2; ++i) {
|
| @@ -295,8 +583,8 @@
|
| qrounding_factor_fp = 64;
|
|
|
| // y
|
| - quant = i == 0 ? vp9_dc_quant(q, cm->y_dc_delta_q)
|
| - : vp9_ac_quant(q, 0);
|
| + 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;
|
| @@ -305,8 +593,8 @@
|
| cm->y_dequant[q][i] = quant;
|
|
|
| // uv
|
| - quant = i == 0 ? vp9_dc_quant(q, cm->uv_dc_delta_q)
|
| - : vp9_ac_quant(q, cm->uv_ac_delta_q);
|
| + quant = i == 0 ? vp9_dc_quant(q, cm->uv_dc_delta_q, cm->bit_depth)
|
| + : vp9_ac_quant(q, cm->uv_ac_delta_q, cm->bit_depth);
|
| invert_quant(&quants->uv_quant[q][i],
|
| &quants->uv_quant_shift[q][i], quant);
|
| quants->uv_quant_fp[q][i] = (1 << 16) / quant;
|
| @@ -340,7 +628,7 @@
|
| const VP9_COMMON *const cm = &cpi->common;
|
| MACROBLOCKD *const xd = &x->e_mbd;
|
| QUANTS *const quants = &cpi->quants;
|
| - const int segment_id = xd->mi[0]->mbmi.segment_id;
|
| + const int segment_id = xd->mi[0].src_mi->mbmi.segment_id;
|
| const int qindex = vp9_get_qindex(&cm->seg, segment_id, cm->base_qindex);
|
| const int rdmult = vp9_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q);
|
| const int zbin = cpi->zbin_mode_boost;
|
|
|