shithub: libvpx

Download patch

ref: 60e9b731cf8945403dbcf149a0f6dc745e5cabe1
parent: 2e39817f5e6436cd72634d8f6011b714d8a1d345
author: Paul Wilkins <paulwilkins@google.com>
date: Wed Dec 17 10:35:23 EST 2014

Remove mode dependent zbin boost.

Initial patch to remove get_zbin_mode_boost() and
cpi->zbin_mode_boost.

For now sets a dummy value of 0 for zbin extra pending
a further clean up patch.

Change-Id: I64a1e1eca2d39baa8ffb0871b515a0be05c9a6af

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -3619,7 +3619,6 @@
   if (xd->lossless) {
     x->optimize = 0;
     cm->lf.filter_level = 0;
-    cpi->zbin_mode_boost_enabled = 0;
   }
 
   vp9_frame_init_quantizer(cpi);
@@ -3859,24 +3858,6 @@
   ++counts->uv_mode[y_mode][uv_mode];
 }
 
-static int get_zbin_mode_boost(const MB_MODE_INFO *mbmi, int enabled) {
-  if (enabled) {
-    if (is_inter_block(mbmi)) {
-      if (mbmi->mode == ZEROMV) {
-        return mbmi->ref_frame[0] != LAST_FRAME ? GF_ZEROMV_ZBIN_BOOST
-                                                : LF_ZEROMV_ZBIN_BOOST;
-      } else {
-        return mbmi->sb_type < BLOCK_8X8 ? SPLIT_MV_ZBIN_BOOST
-                                         : MV_ZBIN_BOOST;
-      }
-    } else {
-      return INTRA_ZBIN_BOOST;
-    }
-  } else {
-    return 0;
-  }
-}
-
 static void encode_superblock(VP9_COMP *cpi, ThreadData *td,
                               TOKENEXTRA **t, int output_enabled,
                               int mi_row, int mi_col, BLOCK_SIZE bsize,
@@ -3912,11 +3893,7 @@
 
   set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]);
 
-  // Experimental code. Special case for gf and arf zeromv modes.
-  // Increase zbin size to suppress noise
-  cpi->zbin_mode_boost = get_zbin_mode_boost(mbmi,
-                                             cpi->zbin_mode_boost_enabled);
-  vp9_update_zbin_extra(cpi, x);
+  vp9_update_zbin_extra(x);
 
   if (!is_inter_block(mbmi)) {
     int plane;
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -3148,12 +3148,6 @@
 
   vp9_clear_system_state();
 
-  // Enable or disable mode based tweaking of the zbin.
-  // For 2 pass only used where GF/ARF prediction quality
-  // is above a threshold.
-  cpi->zbin_mode_boost = 0;
-  cpi->zbin_mode_boost_enabled = 0;
-
   // Set the arf sign bias for this frame.
   set_arf_sign_bias(cpi);
 
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -315,9 +315,6 @@
   int *nmvsadcosts[2];
   int *nmvsadcosts_hp[2];
 
-  int zbin_mode_boost;
-  int zbin_mode_boost_enabled;
-
   int64_t last_time_stamp_seen;
   int64_t last_end_time_stamp_seen;
   int64_t first_time_stamp_ever;
--- a/vp9/encoder/vp9_quantize.c
+++ b/vp9/encoder/vp9_quantize.c
@@ -641,7 +641,8 @@
   const int segment_id = xd->mi[0].src_mi->mbmi.segment_id;
   const int qindex = vp9_get_qindex(&cm->seg, segment_id, cm->base_qindex);
   const int rdmult = vp9_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q);
-  const int zbin = cpi->zbin_mode_boost;
+  // TODO(paulwilkins): 0 value for zbin for now pending follow on patch.
+  const int zbin = 0;
   int i;
 
   // Y
@@ -687,12 +688,9 @@
   vp9_initialize_me_consts(cpi, x->q_index);
 }
 
-void vp9_update_zbin_extra(VP9_COMP *cpi, MACROBLOCK *x) {
-  const int qindex = x->q_index;
-  const int y_zbin_extra = (cpi->common.y_dequant[qindex][1] *
-                            cpi->zbin_mode_boost) >> 7;
-  const int uv_zbin_extra = (cpi->common.uv_dequant[qindex][1] *
-                             cpi->zbin_mode_boost) >> 7;
+void vp9_update_zbin_extra(MACROBLOCK *x) {
+  const int y_zbin_extra = 0;
+  const int uv_zbin_extra = 0;
 
   x->plane[0].zbin_extra = (int16_t)y_zbin_extra;
   x->plane[1].zbin_extra = (int16_t)uv_zbin_extra;
@@ -700,7 +698,6 @@
 }
 
 void vp9_frame_init_quantizer(VP9_COMP *cpi) {
-  cpi->zbin_mode_boost = 0;
   vp9_init_plane_quantizers(cpi, &cpi->td.mb);
 }
 
--- a/vp9/encoder/vp9_quantize.h
+++ b/vp9/encoder/vp9_quantize.h
@@ -68,7 +68,7 @@
 
 void vp9_frame_init_quantizer(struct VP9_COMP *cpi);
 
-void vp9_update_zbin_extra(struct VP9_COMP *cpi, MACROBLOCK *x);
+void vp9_update_zbin_extra(MACROBLOCK *x);
 
 void vp9_init_plane_quantizers(struct VP9_COMP *cpi, MACROBLOCK *x);