Further AQ1 clean up.

Further patch to restructure AQ mode 1.

Change-Id: I566452a033d047a49a40441a7be24690ea69412d
This commit is contained in:
Paul Wilkins 2014-11-13 12:35:07 -08:00
parent 6a760d483d
commit 3d1e8c9a85
3 changed files with 11 additions and 31 deletions

View File

@ -25,10 +25,11 @@
#define ENERGY_IN_BOUNDS(energy)\
assert((energy) >= ENERGY_MIN && (energy) <= ENERGY_MAX)
static double q_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 };
static double q_ratio[MAX_SEGMENTS] =
{1.0, 0.875, 1.143, 1.0, 1.0, 1.0, 1.0, 1.0};
static int segment_id[ENERGY_SPAN] = {1, 0, 2};
#define Q_RATIO(i) q_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};
@ -38,25 +39,9 @@ DECLARE_ALIGNED(16, static const uint16_t, vp9_highbd_64_zeros[64]) = {0};
unsigned int vp9_vaq_segment_id(int energy) {
ENERGY_IN_BOUNDS(energy);
return SEGMENT_ID(energy);
}
void vp9_vaq_init() {
int i;
double base_ratio;
assert(ENERGY_SPAN <= MAX_SEGMENTS);
vp9_clear_system_state();
base_ratio = 1.5;
for (i = ENERGY_MIN; i <= ENERGY_MAX; i++) {
Q_RATIO(i) = pow(base_ratio, i/3.0);
}
}
void vp9_vaq_frame_setup(VP9_COMP *cpi) {
VP9_COMMON *cm = &cpi->common;
struct segmentation *seg = &cm->seg;
@ -71,20 +56,20 @@ void vp9_vaq_frame_setup(VP9_COMP *cpi) {
seg->abs_delta = SEGMENT_DELTADATA;
vp9_clear_system_state();
vp9_clear_system_state();
for (i = ENERGY_MIN; i <= ENERGY_MAX; i++) {
for (i = 0; i < MAX_SEGMENTS; i++) {
int qindex_delta;
if (Q_RATIO(i) == 1) {
// No need to enable SEG_LVL_ALT_Q for this segment
// No need to enable SEG_LVL_ALT_Q for this segment
if (q_ratio[i] == 1.0) {
continue;
}
qindex_delta = vp9_compute_qdelta(&cpi->rc, base_q, base_q * Q_RATIO(i),
qindex_delta = vp9_compute_qdelta(&cpi->rc, base_q, base_q * q_ratio[i],
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);
vp9_set_segdata(seg, i, SEG_LVL_ALT_Q, qindex_delta);
vp9_enable_segfeature(seg, i, SEG_LVL_ALT_Q);
}
}
}

View File

@ -19,7 +19,6 @@ extern "C" {
#endif
unsigned int vp9_vaq_segment_id(int energy);
void vp9_vaq_init();
void vp9_vaq_frame_setup(VP9_COMP *cpi);
int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs);

View File

@ -3720,10 +3720,6 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
set_frame_size(cpi);
}
if (oxcf->aq_mode == VARIANCE_AQ) {
vp9_vaq_init();
}
for (i = 0; i < MAX_REF_FRAMES; ++i)
cpi->scaled_ref_idx[i] = INVALID_REF_BUFFER_IDX;