summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2017-06-23 13:59:54 -0700
committerJerome Jiang <jianj@google.com>2017-06-23 14:05:33 -0700
commitb0c4d87ac756f77d9df550915fa03fd3c7608ff3 (patch)
tree60f093942bca9ae0894b82003fd4115cd051c927 /vp8
parente187b27438fbbcd07bc5b891ce30a39845d62711 (diff)
downloadlibvpx-b0c4d87ac756f77d9df550915fa03fd3c7608ff3.tar
libvpx-b0c4d87ac756f77d9df550915fa03fd3c7608ff3.tar.gz
libvpx-b0c4d87ac756f77d9df550915fa03fd3c7608ff3.tar.bz2
libvpx-b0c4d87ac756f77d9df550915fa03fd3c7608ff3.zip
vp8: Clean up skinmap debugging codes.
Use the computed skinmap. Change-Id: I8aabb5922ef5190ec85b9e01807cb79b4803b925
Diffstat (limited to 'vp8')
-rw-r--r--vp8/common/vp8_skin_detection.c28
-rw-r--r--vp8/encoder/onyx_if.c2
2 files changed, 4 insertions, 26 deletions
diff --git a/vp8/common/vp8_skin_detection.c b/vp8/common/vp8_skin_detection.c
index 2c0237087..6739efa5f 100644
--- a/vp8/common/vp8_skin_detection.c
+++ b/vp8/common/vp8_skin_detection.c
@@ -73,10 +73,8 @@ void vp8_compute_skin_map(VP8_COMP *const cpi, FILE *yuv_skinmap_file) {
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 @@ void vp8_compute_skin_map(VP8_COMP *const cpi, FILE *yuv_skinmap_file) {
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);
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 930086ec8..b018ca61e 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1969,7 +1969,7 @@ struct VP8_COMP *vp8_create_compressor(VP8_CONFIG *oxcf) {
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