summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp9/common/vp9_onyxc_int.h4
-rw-r--r--vp9/decoder/vp9_decodframe.c14
-rw-r--r--vp9/encoder/vp9_quantize.c96
3 files changed, 52 insertions, 62 deletions
diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h
index ea43e80f5..6f928f5e0 100644
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -169,8 +169,8 @@ typedef enum {
typedef struct VP9Common {
struct vpx_internal_error_info error;
- DECLARE_ALIGNED(16, int16_t, Y1dequant[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, int16_t, UVdequant[QINDEX_RANGE][16]);
+ DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][16]);
+ DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][16]);
int width;
int height;
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index 1e95e2207..af8e7c04a 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -102,15 +102,15 @@ void vp9_init_de_quantizer(VP9D_COMP *pbi) {
VP9_COMMON *const pc = &pbi->common;
for (q = 0; q < QINDEX_RANGE; q++) {
- pc->Y1dequant[q][0] = (int16_t)vp9_dc_quant(q, pc->y1dc_delta_q);
- pc->UVdequant[q][0] = (int16_t)vp9_dc_uv_quant(q, pc->uvdc_delta_q);
+ pc->y_dequant[q][0] = (int16_t)vp9_dc_quant(q, pc->y1dc_delta_q);
+ pc->uv_dequant[q][0] = (int16_t)vp9_dc_uv_quant(q, pc->uvdc_delta_q);
/* all the ac values =; */
for (i = 1; i < 16; i++) {
const int rc = vp9_default_zig_zag1d_4x4[i];
- pc->Y1dequant[q][rc] = (int16_t)vp9_ac_yquant(q);
- pc->UVdequant[q][rc] = (int16_t)vp9_ac_uv_quant(q, pc->uvac_delta_q);
+ pc->y_dequant[q][rc] = (int16_t)vp9_ac_yquant(q);
+ pc->uv_dequant[q][rc] = (int16_t)vp9_ac_uv_quant(q, pc->uvac_delta_q);
}
}
}
@@ -136,10 +136,10 @@ static void mb_init_dequantizer(VP9D_COMP *pbi, MACROBLOCKD *mb) {
mb->q_index = qindex;
for (i = 0; i < 16; i++)
- mb->block[i].dequant = pc->Y1dequant[qindex];
+ mb->block[i].dequant = pc->y_dequant[qindex];
for (i = 16; i < 24; i++)
- mb->block[i].dequant = pc->UVdequant[qindex];
+ mb->block[i].dequant = pc->uv_dequant[qindex];
if (mb->lossless) {
assert(qindex == 0);
@@ -241,7 +241,7 @@ static void decode_16x16(VP9D_COMP *pbi, MACROBLOCKD *xd,
xd->predictor + 16 * 16, xd->dst.u_buffer, 8,
xd->dst.uv_stride, xd->plane[1].eobs[0]);
- vp9_dequant_idct_add_8x8(xd->plane[2].qcoeff, xd->block[16].dequant,
+ vp9_dequant_idct_add_8x8(xd->plane[2].qcoeff, xd->block[20].dequant,
xd->predictor + 16 * 16 + 64, xd->dst.v_buffer, 8,
xd->dst.uv_stride, xd->plane[2].eobs[0]);
}
diff --git a/vp9/encoder/vp9_quantize.c b/vp9/encoder/vp9_quantize.c
index 7a8b2519b..cb6cca0af 100644
--- a/vp9/encoder/vp9_quantize.c
+++ b/vp9/encoder/vp9_quantize.c
@@ -626,14 +626,14 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
invert_quant(cpi->Y1quant[q] + 0, cpi->Y1quant_shift[q] + 0, quant_val);
cpi->Y1zbin[q][0] = ROUND_POWER_OF_TWO(qzbin_factor * quant_val, 7);
cpi->Y1round[q][0] = (qrounding_factor * quant_val) >> 7;
- cpi->common.Y1dequant[q][0] = quant_val;
+ cpi->common.y_dequant[q][0] = quant_val;
cpi->zrun_zbin_boost_y1[q][0] = (quant_val * zbin_boost[0]) >> 7;
quant_val = vp9_dc_uv_quant(q, cpi->common.uvdc_delta_q);
invert_quant(cpi->UVquant[q] + 0, cpi->UVquant_shift[q] + 0, quant_val);
cpi->UVzbin[q][0] = ROUND_POWER_OF_TWO(qzbin_factor * quant_val, 7);
cpi->UVround[q][0] = (qrounding_factor * quant_val) >> 7;
- cpi->common.UVdequant[q][0] = quant_val;
+ cpi->common.uv_dequant[q][0] = quant_val;
cpi->zrun_zbin_boost_uv[q][0] = (quant_val * zbin_boost[0]) >> 7;
// all the 4x4 ac values =;
@@ -644,7 +644,7 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
invert_quant(cpi->Y1quant[q] + rc, cpi->Y1quant_shift[q] + rc, quant_val);
cpi->Y1zbin[q][rc] = ROUND_POWER_OF_TWO(qzbin_factor * quant_val, 7);
cpi->Y1round[q][rc] = (qrounding_factor * quant_val) >> 7;
- cpi->common.Y1dequant[q][rc] = quant_val;
+ cpi->common.y_dequant[q][rc] = quant_val;
cpi->zrun_zbin_boost_y1[q][i] =
ROUND_POWER_OF_TWO(quant_val * zbin_boost[i], 7);
@@ -652,7 +652,7 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
invert_quant(cpi->UVquant[q] + rc, cpi->UVquant_shift[q] + rc, quant_val);
cpi->UVzbin[q][rc] = ROUND_POWER_OF_TWO(qzbin_factor * quant_val, 7);
cpi->UVround[q][rc] = (qrounding_factor * quant_val) >> 7;
- cpi->common.UVdequant[q][rc] = quant_val;
+ cpi->common.uv_dequant[q][rc] = quant_val;
cpi->zrun_zbin_boost_uv[q][i] =
ROUND_POWER_OF_TWO(quant_val * zbin_boost[i], 7);
}
@@ -661,40 +661,39 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) {
int i;
- int QIndex;
+ int qindex;
MACROBLOCKD *xd = &x->e_mbd;
int zbin_extra;
int segment_id = xd->mode_info_context->mbmi.segment_id;
// Select the baseline MB Q index allowing for any segment level change.
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_ALT_Q)) {
- // Abs Value
- if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA)
- QIndex = vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
-
- // Delta Value
- else {
- QIndex = cpi->common.base_qindex +
- vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
+ if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA) {
+ // Abs Value
+ qindex = vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
+ } else {
+ // Delta Value
+ qindex = cpi->common.base_qindex +
+ vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
// Clamp to valid range
- QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0;
+ qindex = clamp(qindex, 0, MAXQ);
}
- } else
- QIndex = cpi->common.base_qindex;
+ } else {
+ qindex = cpi->common.base_qindex;
+ }
// Y
- zbin_extra = (cpi->common.Y1dequant[QIndex][1] *
- (cpi->zbin_mode_boost +
- x->act_zbin_adj)) >> 7;
+ zbin_extra = (cpi->common.y_dequant[qindex][1] *
+ (cpi->zbin_mode_boost + x->act_zbin_adj)) >> 7;
for (i = 0; i < 16; i++) {
- x->block[i].quant = cpi->Y1quant[QIndex];
- x->block[i].quant_shift = cpi->Y1quant_shift[QIndex];
- x->block[i].zbin = cpi->Y1zbin[QIndex];
- x->block[i].round = cpi->Y1round[QIndex];
- x->e_mbd.block[i].dequant = cpi->common.Y1dequant[QIndex];
- x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_y1[QIndex];
+ x->block[i].quant = cpi->Y1quant[qindex];
+ x->block[i].quant_shift = cpi->Y1quant_shift[qindex];
+ x->block[i].zbin = cpi->Y1zbin[qindex];
+ x->block[i].round = cpi->Y1round[qindex];
+ x->e_mbd.block[i].dequant = cpi->common.y_dequant[qindex];
+ x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_y1[qindex];
x->block[i].zbin_extra = (int16_t)zbin_extra;
// Segment skip feature.
@@ -703,49 +702,40 @@ void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) {
}
// UV
- zbin_extra = (cpi->common.UVdequant[QIndex][1] *
- (cpi->zbin_mode_boost +
- x->act_zbin_adj)) >> 7;
+ zbin_extra = (cpi->common.uv_dequant[qindex][1] *
+ (cpi->zbin_mode_boost + x->act_zbin_adj)) >> 7;
for (i = 16; i < 24; i++) {
- x->block[i].quant = cpi->UVquant[QIndex];
- x->block[i].quant_shift = cpi->UVquant_shift[QIndex];
- x->block[i].zbin = cpi->UVzbin[QIndex];
- x->block[i].round = cpi->UVround[QIndex];
- x->e_mbd.block[i].dequant = cpi->common.UVdequant[QIndex];
- x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_uv[QIndex];
+ x->block[i].quant = cpi->UVquant[qindex];
+ x->block[i].quant_shift = cpi->UVquant_shift[qindex];
+ x->block[i].zbin = cpi->UVzbin[qindex];
+ x->block[i].round = cpi->UVround[qindex];
+ x->e_mbd.block[i].dequant = cpi->common.uv_dequant[qindex];
+ x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_uv[qindex];
x->block[i].zbin_extra = (int16_t)zbin_extra;
// Segment skip feature.
x->block[i].skip_block =
- vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
+ vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
}
/* save this macroblock QIndex for vp9_update_zbin_extra() */
- x->e_mbd.q_index = QIndex;
+ x->e_mbd.q_index = qindex;
}
void vp9_update_zbin_extra(VP9_COMP *cpi, MACROBLOCK *x) {
int i;
- int QIndex = x->e_mbd.q_index;
- int zbin_extra;
-
- // Y
- zbin_extra = (cpi->common.Y1dequant[QIndex][1] *
- (cpi->zbin_mode_boost +
- x->act_zbin_adj)) >> 7;
- for (i = 0; i < 16; i++) {
- x->block[i].zbin_extra = (int16_t)zbin_extra;
- }
+ const int qindex = x->e_mbd.q_index;
+ const int y_zbin_extra = (cpi->common.y_dequant[qindex][1] *
+ (cpi->zbin_mode_boost + x->act_zbin_adj)) >> 7;
+ const int uv_zbin_extra = (cpi->common.uv_dequant[qindex][1] *
+ (cpi->zbin_mode_boost + x->act_zbin_adj)) >> 7;
- // UV
- zbin_extra = (cpi->common.UVdequant[QIndex][1] *
- (cpi->zbin_mode_boost +
- x->act_zbin_adj)) >> 7;
+ for (i = 0; i < 16; i++)
+ x->block[i].zbin_extra = (int16_t)y_zbin_extra;
- for (i = 16; i < 24; i++) {
- x->block[i].zbin_extra = (int16_t)zbin_extra;
- }
+ for (i = 16; i < 24; i++)
+ x->block[i].zbin_extra = (int16_t)uv_zbin_extra;
}
void vp9_frame_init_quantizer(VP9_COMP *cpi) {