shithub: libvpx

Download patch

ref: 79a194692fd449b4fd10a6235aa59f285b6656c3
parent: e3efed7f4c188bcacdae813a3ee9e93f0f649234
parent: bd6bf2596957b722ee5d7d789e0fedb9bf86435e
author: Marco Paniconi <[email protected]>
date: Tue Nov 10 18:10:31 EST 2015

Merge "Add bias to zero/small motion for noisy source."

--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -1483,18 +1483,30 @@
     this_rdc.rate += ref_frame_cost[ref_frame];
     this_rdc.rdcost = RDCOST(x->rdmult, x->rddiv, this_rdc.rate, this_rdc.dist);
 
-    // Bias against non-zero (above some threshold) motion for large blocks.
-    // This is temporary fix to avoid selection of large mv for big blocks.
     if (cpi->oxcf.speed >= 5 &&
-        cpi->oxcf.content != VP9E_CONTENT_SCREEN &&
-        (frame_mv[this_mode][ref_frame].as_mv.row > 64 ||
-        frame_mv[this_mode][ref_frame].as_mv.row < -64 ||
-        frame_mv[this_mode][ref_frame].as_mv.col > 64 ||
-        frame_mv[this_mode][ref_frame].as_mv.col < -64)) {
-      if (bsize == BLOCK_64X64)
-        this_rdc.rdcost = this_rdc.rdcost << 1;
-      else if (bsize >= BLOCK_32X32)
-        this_rdc.rdcost = 3 * this_rdc.rdcost >> 1;
+        cpi->oxcf.content != VP9E_CONTENT_SCREEN) {
+      // Bias against non-zero (above some threshold) motion for large blocks.
+      // This is temporary fix to avoid selection of large mv for big blocks.
+      if (frame_mv[this_mode][ref_frame].as_mv.row > 64 ||
+          frame_mv[this_mode][ref_frame].as_mv.row < -64 ||
+          frame_mv[this_mode][ref_frame].as_mv.col > 64 ||
+          frame_mv[this_mode][ref_frame].as_mv.col < -64) {
+        if (bsize == BLOCK_64X64)
+          this_rdc.rdcost = this_rdc.rdcost << 1;
+        else if (bsize >= BLOCK_32X32)
+          this_rdc.rdcost = 3 * this_rdc.rdcost >> 1;
+      }
+      // If noise estimation is enabled, and estimated level is above threshold,
+      // add a bias to LAST reference with small motion, for large blocks.
+      if (cpi->noise_estimate.enabled &&
+          cpi->noise_estimate.level >= kMedium &&
+          bsize >= BLOCK_32X32 &&
+          ref_frame == LAST_FRAME &&
+          frame_mv[this_mode][ref_frame].as_mv.row < 8 &&
+          frame_mv[this_mode][ref_frame].as_mv.row > -8 &&
+          frame_mv[this_mode][ref_frame].as_mv.col < 8 &&
+          frame_mv[this_mode][ref_frame].as_mv.col > -8)
+        this_rdc.rdcost = 7 * this_rdc.rdcost >> 3;
     }
 
     // Skipping checking: test to see if this block can be reconstructed by