]> granicus.if.org Git - libvpx/commitdiff
Further AQ1 clean up.
authorPaul Wilkins <paulwilkins@google.com>
Thu, 13 Nov 2014 20:35:07 +0000 (12:35 -0800)
committerPaul Wilkins <paulwilkins@google.com>
Fri, 21 Nov 2014 00:00:51 +0000 (16:00 -0800)
Further patch to restructure AQ mode 1.

Change-Id: I566452a033d047a49a40441a7be24690ea69412d

vp9/encoder/vp9_aq_variance.c
vp9/encoder/vp9_aq_variance.h
vp9/encoder/vp9_encoder.c

index 3dea1e33f8225570313225e136c3e4ca41d444cd..fbf3cff09006a3135d4057e696f5d0e95308cce8 100644 (file)
 #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);
     }
   }
 }
index e157702d954ca0d6cd368871fd6d05349fa1b927..ac144fb329111aa45522f69ddb05a373c769f837 100644 (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);
index e1022c452413c751f3674e371126088a3b84dabe..877e2c359c7cec5afec251a3f999ee6055d19c7c 100644 (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;