| Index: source/libvpx/vp9/encoder/vp9_quantize.c
|
| ===================================================================
|
| --- source/libvpx/vp9/encoder/vp9_quantize.c (revision 278778)
|
| +++ source/libvpx/vp9/encoder/vp9_quantize.c (working copy)
|
| @@ -19,6 +19,50 @@
|
| #include "vp9/encoder/vp9_quantize.h"
|
| #include "vp9/encoder/vp9_rdopt.h"
|
|
|
| +void vp9_quantize_dc(const int16_t *coeff_ptr, int skip_block,
|
| + const int16_t *round_ptr, const int16_t quant,
|
| + int16_t *qcoeff_ptr, int16_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;
|
| +
|
| + int tmp = clamp(abs_coeff + round_ptr[rc != 0], INT16_MIN, INT16_MAX);
|
| + tmp = (tmp * 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;
|
| +}
|
| +
|
| +void vp9_quantize_dc_32x32(const int16_t *coeff_ptr, int skip_block,
|
| + const int16_t *round_ptr, const int16_t quant,
|
| + int16_t *qcoeff_ptr, int16_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;
|
| +
|
| + int tmp = clamp(abs_coeff + round_ptr[rc != 0], INT16_MIN, INT16_MAX);
|
| + tmp = (tmp * 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;
|
| +}
|
| +
|
| void vp9_quantize_b_c(const int16_t *coeff_ptr, intptr_t count,
|
| int skip_block,
|
| const int16_t *zbin_ptr, const int16_t *round_ptr,
|
| @@ -167,6 +211,7 @@
|
| quant = i == 0 ? vp9_dc_quant(q, cm->y_dc_delta_q)
|
| : vp9_ac_quant(q, 0);
|
| 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_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
|
| quants->y_round[q][i] = (qrounding_factor * quant) >> 7;
|
| cm->y_dequant[q][i] = quant;
|
| @@ -176,6 +221,7 @@
|
| : vp9_ac_quant(q, cm->uv_ac_delta_q);
|
| 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_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
|
| quants->uv_round[q][i] = (qrounding_factor * quant) >> 7;
|
| cm->uv_dequant[q][i] = quant;
|
| @@ -193,12 +239,14 @@
|
|
|
| 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];
|
| quants->y_quant_shift[q][i] = quants->y_quant_shift[q][1];
|
| quants->y_zbin[q][i] = quants->y_zbin[q][1];
|
| quants->y_round[q][i] = quants->y_round[q][1];
|
| cm->y_dequant[q][i] = cm->y_dequant[q][1];
|
|
|
| quants->uv_quant[q][i] = quants->uv_quant[q][1];
|
| + quants->uv_quant_fp[q][i] = quants->uv_quant_fp[q][1];
|
| quants->uv_quant_shift[q][i] = quants->uv_quant_shift[q][1];
|
| quants->uv_zbin[q][i] = quants->uv_zbin[q][1];
|
| quants->uv_round[q][i] = quants->uv_round[q][1];
|
| @@ -227,6 +275,7 @@
|
|
|
| // Y
|
| x->plane[0].quant = quants->y_quant[qindex];
|
| + x->plane[0].quant_fp = quants->y_quant_fp[qindex];
|
| x->plane[0].quant_shift = quants->y_quant_shift[qindex];
|
| x->plane[0].zbin = quants->y_zbin[qindex];
|
| x->plane[0].round = quants->y_round[qindex];
|
| @@ -236,6 +285,7 @@
|
| // UV
|
| for (i = 1; i < 3; i++) {
|
| x->plane[i].quant = quants->uv_quant[qindex];
|
| + x->plane[i].quant_fp = quants->uv_quant_fp[qindex];
|
| x->plane[i].quant_shift = quants->uv_quant_shift[qindex];
|
| x->plane[i].zbin = quants->uv_zbin[qindex];
|
| x->plane[i].round = quants->uv_round[qindex];
|
|
|