Merge "Adding vp9_get_qindex function." into experimental

This commit is contained in:
Dmitry Kovalev 2013-05-01 12:04:21 -07:00 committed by Gerrit Code Review
commit 6e4ed2f0fe
5 changed files with 24 additions and 39 deletions

View File

@ -18,6 +18,7 @@
#include "vp9/common/vp9_entropymv.h"
#include "vp9/common/vp9_entropy.h"
#include "vp9/common/vp9_entropymode.h"
#include "vp9/common/vp9_quant_common.h"
#if CONFIG_POSTPROC
#include "vp9/common/vp9_postproc.h"
@ -31,13 +32,6 @@
void vp9_initialize_common(void);
#define MINQ 0
#define MAXQ 255
#define QINDEX_BITS 8
#define QINDEX_RANGE (MAXQ + 1)
#if CONFIG_MULTIPLE_ARF
#define NUM_REF_FRAMES 8
#define NUM_REF_FRAMES_LG2 3

View File

@ -10,6 +10,7 @@
#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_quant_common.h"
#include "vp9/common/vp9_seg_common.h"
static int16_t dc_qlookup[QINDEX_RANGE];
static int16_t ac_qlookup[QINDEX_RANGE];
@ -44,3 +45,16 @@ int16_t vp9_dc_quant(int qindex, int delta) {
int16_t vp9_ac_quant(int qindex, int delta) {
return ac_qlookup[clamp(qindex + delta, 0, MAXQ)];
}
int vp9_get_qindex(MACROBLOCKD *xd, int segment_id, int base_qindex) {
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_ALT_Q)) {
const int data = vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
return xd->mb_segment_abs_delta == SEGMENT_ABSDATA ?
data : // Abs value
clamp(base_qindex + data, 0, MAXQ); // Delta value
} else {
return base_qindex;
}
}

View File

@ -12,11 +12,17 @@
#define VP9_COMMON_VP9_QUANT_COMMON_H_
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_onyxc_int.h"
#define MINQ 0
#define MAXQ 255
#define QINDEX_RANGE (MAXQ - MINQ + 1)
#define QINDEX_BITS 8
void vp9_init_quant_tables();
int16_t vp9_dc_quant(int qindex, int delta);
int16_t vp9_ac_quant(int qindex, int delta);
int vp9_get_qindex(MACROBLOCKD *mb, int segment_id, int base_qindex);
#endif // VP9_COMMON_VP9_QUANT_COMMON_H_

View File

@ -181,22 +181,10 @@ void vp9_init_dequantizer(VP9_COMMON *pc) {
}
}
static int get_qindex(MACROBLOCKD *mb, int segment_id, int base_qindex) {
// Set the Q baseline allowing for any segment level adjustment
if (vp9_segfeature_active(mb, segment_id, SEG_LVL_ALT_Q)) {
const int data = vp9_get_segdata(mb, segment_id, SEG_LVL_ALT_Q);
return mb->mb_segment_abs_delta == SEGMENT_ABSDATA ?
data : // Abs value
clamp(base_qindex + data, 0, MAXQ); // Delta value
} else {
return base_qindex;
}
}
static void mb_init_dequantizer(VP9_COMMON *pc, MACROBLOCKD *xd) {
int i;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
xd->q_index = get_qindex(xd, segment_id, pc->base_qindex);
xd->q_index = vp9_get_qindex(xd, segment_id, pc->base_qindex);
xd->plane[0].dequant = pc->y_dequant[xd->q_index];
for (i = 1; i < MAX_MB_PLANE; i++)

View File

@ -318,27 +318,10 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) {
int i;
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)) {
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 = clamp(qindex, 0, MAXQ);
}
} else {
qindex = cpi->common.base_qindex;
}
const int qindex = vp9_get_qindex(xd, segment_id, cpi->common.base_qindex);
// Y
zbin_extra = (cpi->common.y_dequant[qindex][1] *