Commit b87c51ce authored by Paul Wilkins's avatar Paul Wilkins Committed by Gerrit Code Review

Merge "Initial AQ1 restructuring."

parents 508b345b 6a760d48
......@@ -26,11 +26,9 @@
assert((energy) >= ENERGY_MIN && (energy) <= ENERGY_MAX)
static double q_ratio[MAX_SEGMENTS] = { 1, 1, 1, 1, 1, 1, 1, 1 };
static double rdmult_ratio[MAX_SEGMENTS] = { 1, 1, 1, 1, 1, 1, 1, 1 };
static int segment_id[MAX_SEGMENTS] = { 5, 3, 1, 0, 2, 4, 6, 7 };
#define Q_RATIO(i) q_ratio[(i) - ENERGY_MIN]
#define RDMULT_RATIO(i) rdmult_ratio[(i) - ENERGY_MIN]
#define SEGMENT_ID(i) segment_id[(i) - ENERGY_MIN]
DECLARE_ALIGNED(16, static const uint8_t, vp9_64_zeros[64]) = {0};
......@@ -44,14 +42,6 @@ unsigned int vp9_vaq_segment_id(int energy) {
return SEGMENT_ID(energy);
}
double vp9_vaq_rdmult_ratio(int energy) {
ENERGY_IN_BOUNDS(energy);
vp9_clear_system_state();
return RDMULT_RATIO(energy);
}
void vp9_vaq_init() {
int i;
double base_ratio;
......@@ -71,8 +61,6 @@ void vp9_vaq_frame_setup(VP9_COMP *cpi) {
VP9_COMMON *cm = &cpi->common;
struct segmentation *seg = &cm->seg;
const double base_q = vp9_convert_qindex_to_q(cm->base_qindex, cm->bit_depth);
const int base_rdmult = vp9_compute_rd_mult(cpi, cm->base_qindex +
cm->y_dc_delta_q);
int i;
if (cm->frame_type == KEY_FRAME ||
......@@ -86,11 +74,10 @@ void vp9_vaq_frame_setup(VP9_COMP *cpi) {
vp9_clear_system_state();
for (i = ENERGY_MIN; i <= ENERGY_MAX; i++) {
int qindex_delta, segment_rdmult;
int qindex_delta;
if (Q_RATIO(i) == 1) {
// No need to enable SEG_LVL_ALT_Q for this segment
RDMULT_RATIO(i) = 1;
continue;
}
......@@ -98,11 +85,6 @@ void vp9_vaq_frame_setup(VP9_COMP *cpi) {
cm->bit_depth);
vp9_set_segdata(seg, SEGMENT_ID(i), SEG_LVL_ALT_Q, qindex_delta);
vp9_enable_segfeature(seg, SEGMENT_ID(i), SEG_LVL_ALT_Q);
segment_rdmult = vp9_compute_rd_mult(cpi, cm->base_qindex + qindex_delta +
cm->y_dc_delta_q);
RDMULT_RATIO(i) = (double) segment_rdmult / base_rdmult;
}
}
}
......
......@@ -19,8 +19,6 @@ extern "C" {
#endif
unsigned int vp9_vaq_segment_id(int energy);
double vp9_vaq_rdmult_ratio(int energy);
void vp9_vaq_init();
void vp9_vaq_frame_setup(VP9_COMP *cpi);
......
......@@ -851,6 +851,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi,
if (aq_mode == VARIANCE_AQ) {
const int energy = bsize <= BLOCK_16X16 ? x->mb_energy
: vp9_block_energy(cpi, x, bsize);
int segment_qindex;
if (cm->frame_type == KEY_FRAME ||
cpi->refresh_alt_ref_frame ||
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
......@@ -860,11 +861,13 @@ static void rd_pick_sb_modes(VP9_COMP *cpi,
: cm->last_frame_seg_map;
mbmi->segment_id = vp9_get_segment_id(cm, map, bsize, mi_row, mi_col);
}
rdmult_ratio = vp9_vaq_rdmult_ratio(energy);
vp9_init_plane_quantizers(cpi, x);
vp9_clear_system_state();
x->rdmult = (int)round(x->rdmult * rdmult_ratio);
segment_qindex = vp9_get_qindex(&cm->seg, mbmi->segment_id,
cm->base_qindex);
x->rdmult = vp9_compute_rd_mult(cpi, segment_qindex + cm->y_dc_delta_q);
vp9_clear_system_state();
rdmult_ratio = (double)x->rdmult / orig_rdmult;
} else if (aq_mode == COMPLEXITY_AQ) {
const int mi_offset = mi_row * cm->mi_cols + mi_col;
unsigned char complexity = cpi->complexity_map[mi_offset];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment