From 3d1e8c9a85d0bb16049cb1622f1d2d9a034c5379 Mon Sep 17 00:00:00 2001 From: Paul Wilkins Date: Thu, 13 Nov 2014 12:35:07 -0800 Subject: [PATCH] Further AQ1 clean up. Further patch to restructure AQ mode 1. Change-Id: I566452a033d047a49a40441a7be24690ea69412d --- vp9/encoder/vp9_aq_variance.c | 37 +++++++++++------------------------ vp9/encoder/vp9_aq_variance.h | 1 - vp9/encoder/vp9_encoder.c | 4 ---- 3 files changed, 11 insertions(+), 31 deletions(-) diff --git a/vp9/encoder/vp9_aq_variance.c b/vp9/encoder/vp9_aq_variance.c index 3dea1e33f..fbf3cff09 100644 --- a/vp9/encoder/vp9_aq_variance.c +++ b/vp9/encoder/vp9_aq_variance.c @@ -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); } } } diff --git a/vp9/encoder/vp9_aq_variance.h b/vp9/encoder/vp9_aq_variance.h index e157702d9..ac144fb32 100644 --- a/vp9/encoder/vp9_aq_variance.h +++ b/vp9/encoder/vp9_aq_variance.h @@ -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); diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index e1022c452..877e2c359 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -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; -- 2.40.0