shithub: libvpx

Download patch

ref: 50c06052e9c7cdb9b2ccec678e4e457b1b137599
parent: 0fe8304d0ba90388d06aaec588edf729e088ea1d
parent: 7d8061a44a8a8cd4ecb0463723cd6a2493c24b56
author: Jingning Han <[email protected]>
date: Wed Mar 4 05:47:56 EST 2015

Merge "Use SAD value to set chroma cost flag"

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -610,7 +610,6 @@
   uint8_t const *ref_buf, *src_buf;
   MV *tmp_mv = &xd->mi[0].src_mi->mbmi.mv[0].as_mv;
   int best_sad;
-  unsigned int best_sse;
   MV this_mv;
 
   // Set up prediction 1-D reference set
@@ -659,13 +658,11 @@
       tmp_mv->col = search_pos[idx].col + this_mv.col;
     }
   }
-
-  ref_buf = xd->plane[0].pre[0].buf + tmp_mv->row * ref_stride + tmp_mv->col;
-  cpi->fn_ptr[bsize].vf(src_buf, src_stride, ref_buf, ref_stride, &best_sse);
   tmp_mv->row *= 8;
   tmp_mv->col *= 8;
   x->pred_mv[LAST_FRAME] = *tmp_mv;
-  return best_sse;
+
+  return best_sad;
 }
 #endif
 
@@ -712,9 +709,9 @@
 
   if (!is_key_frame) {
     MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
-    unsigned int var = 0, uv_sse;
+    unsigned int uv_sad;
 #if GLOBAL_MOTION
-    unsigned int y_sse;
+    unsigned int y_sad;
     BLOCK_SIZE bsize;
 #endif
     vp9_setup_pre_planes(xd, 0, yv12, mi_row, mi_col,
@@ -735,7 +732,7 @@
     else
       bsize = BLOCK_32X32;
 
-    y_sse = motion_estimation(cpi, x, bsize);
+    y_sad = motion_estimation(cpi, x, bsize);
 #endif
 
     vp9_build_inter_predictors_sb(xd, mi_row, mi_col, BLOCK_64X64);
@@ -744,13 +741,13 @@
       struct macroblock_plane  *p = &x->plane[i];
       struct macroblockd_plane *pd = &xd->plane[i];
       const BLOCK_SIZE bs = get_plane_block_size(BLOCK_64X64, pd);
-      var += cpi->fn_ptr[bs].vf(p->src.buf, p->src.stride,
-                                pd->dst.buf, pd->dst.stride, &uv_sse);
+      uv_sad = cpi->fn_ptr[bs].sdf(p->src.buf, p->src.stride,
+                                   pd->dst.buf, pd->dst.stride);
 
 #if GLOBAL_MOTION
-      x->color_sensitivity[i - 1] = uv_sse * 6 > y_sse;
+      x->color_sensitivity[i - 1] = uv_sad * 4 > y_sad;
 #else
-      x->color_sensitivity[i - 1] = (uv_sse > 2048);
+      x->color_sensitivity[i - 1] = (uv_sad > 512);
 #endif
     }