shithub: libvpx

Download patch

ref: 1c2df9cd485765e941342f2d76270a49bd177c85
parent: d1e3d0467c7efbc6eeddefc9d568cf928110e8fb
author: Marco <[email protected]>
date: Thu Jan 28 07:10:38 EST 2016

vp9: encoder-breakout: Modify UV thresholds.

Set UV thresholds to 0 for encoder breakout if
block is detected as skin.

Change-Id: Iaaa30b5cc8bae4cf611f8ea8eba693b730e32a3f

--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -812,7 +812,7 @@
       mi->mv[0].as_mv.col > 64 ||
       mi->mv[0].as_mv.col < -64)
     motion_low = 0;
-  if (x->encode_breakout > 0 && motion_low == 1 && !x->sb_is_skin) {
+  if (x->encode_breakout > 0 && motion_low == 1) {
     // Set a maximum for threshold to avoid big PSNR loss in low bit rate
     // case. Use extreme low threshold for static frames to limit
     // skipping.
@@ -852,6 +852,12 @@
   if (var <= thresh_ac && (sse - var) <= thresh_dc) {
     unsigned int sse_u, sse_v;
     unsigned int var_u, var_v;
+    unsigned int thresh_ac_uv = thresh_ac;
+    unsigned int thresh_dc_uv = thresh_dc;
+    if (x->sb_is_skin) {
+      thresh_ac_uv = 0;
+      thresh_dc_uv = 0;
+    }
 
     // Skip UV prediction unless breakout is zero (lossless) to save
     // computation with low impact on the result
@@ -867,7 +873,7 @@
                                     xd->plane[1].dst.stride, &sse_u);
 
     // U skipping condition checking
-    if (((var_u << 2) <= thresh_ac) && (sse_u - var_u <= thresh_dc)) {
+    if (((var_u << 2) <= thresh_ac_uv) && (sse_u - var_u <= thresh_dc_uv)) {
       var_v = cpi->fn_ptr[uv_size].vf(x->plane[2].src.buf,
                                       x->plane[2].src.stride,
                                       xd->plane[2].dst.buf,
@@ -874,7 +880,7 @@
                                       xd->plane[2].dst.stride, &sse_v);
 
       // V skipping condition checking
-      if (((var_v << 2) <= thresh_ac) && (sse_v - var_v <= thresh_dc)) {
+      if (((var_v << 2) <= thresh_ac_uv) && (sse_v - var_v <= thresh_dc_uv)) {
         x->skip = 1;
 
         // The cost of skip bit needs to be added.