shithub: libvpx

Download patch

ref: b0c4d87ac756f77d9df550915fa03fd3c7608ff3
parent: e187b27438fbbcd07bc5b891ce30a39845d62711
author: Jerome Jiang <[email protected]>
date: Fri Jun 23 09:59:54 EDT 2017

vp8: Clean up skinmap debugging codes.

Use the computed skinmap.

Change-Id: I8aabb5922ef5190ec85b9e01807cb79b4803b925

--- a/vp8/common/vp8_skin_detection.c
+++ b/vp8/common/vp8_skin_detection.c
@@ -73,10 +73,8 @@
   VP8_COMMON *const cm = &cpi->common;
   uint8_t *y;
   const uint8_t *src_y = cpi->Source->y_buffer;
-  const uint8_t *src_u = cpi->Source->u_buffer;
-  const uint8_t *src_v = cpi->Source->v_buffer;
   const int src_ystride = cpi->Source->y_stride;
-  const int src_uvstride = cpi->Source->uv_stride;
+  int offset = 0;
 
   YV12_BUFFER_CONFIG skinmap;
   memset(&skinmap, 0, sizeof(skinmap));
@@ -89,41 +87,21 @@
   y = skinmap.y_buffer;
   // Loop through blocks and set skin map based on center pixel of block.
   // Set y to white for skin block, otherwise set to source with gray scale.
-  // Ignore rightmost/bottom boundary blocks.
   for (mb_row = 0; mb_row < cm->mb_rows; mb_row += 1) {
     num_bl = 0;
     for (mb_col = 0; mb_col < cm->mb_cols; mb_col += 1) {
-      int is_skin = 0;
-      int consec_zeromv = 0;
-      const int bl_index = mb_row * cm->mb_cols + mb_col;
-      const int bl_index1 = bl_index + 1;
-      const int bl_index2 = bl_index + cm->mb_cols;
-      const int bl_index3 = bl_index2 + 1;
-      consec_zeromv = VPXMIN(cpi->consec_zero_last[bl_index],
-                             VPXMIN(cpi->consec_zero_last[bl_index1],
-                                    VPXMIN(cpi->consec_zero_last[bl_index2],
-                                           cpi->consec_zero_last[bl_index3])));
-      is_skin =
-          vp8_compute_skin_block(src_y, src_u, src_v, src_ystride, src_uvstride,
-                                 SKIN_8X8, consec_zeromv, 0);
+      const int is_skin = cpi->skin_map[offset++];
       for (i = 0; i < 16; i++) {
         for (j = 0; j < 16; j++) {
-          if (is_skin)
-            y[i * src_ystride + j] = 255;
-          else
-            y[i * src_ystride + j] = src_y[i * src_ystride + j];
+          y[i * src_ystride + j] = is_skin ? 255 : src_y[i * src_ystride + j];
         }
       }
       num_bl++;
       y += 16;
       src_y += 16;
-      src_u += 8;
-      src_v += 8;
     }
     y += (src_ystride << 4) - (num_bl << 4);
     src_y += (src_ystride << 4) - (num_bl << 4);
-    src_u += (src_uvstride << 3) - (num_bl << 3);
-    src_v += (src_uvstride << 3) - (num_bl << 3);
   }
   vpx_write_yuv_frame(yuv_skinmap_file, &skinmap);
   vpx_free_frame_buffer(&skinmap);
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1969,7 +1969,7 @@
   yuv_denoised_file = fopen("denoised.yuv", "ab");
 #endif
 #ifdef OUTPUT_YUV_SKINMAP
-  yuv_skinmap_file = fopen("skinmap.yuv", "ab");
+  yuv_skinmap_file = fopen("skinmap.yuv", "wb");
 #endif
 
 #if 0