Commit b0c4d87a authored by Jerome Jiang's avatar Jerome Jiang
Browse files

vp8: Clean up skinmap debugging codes.

Use the computed skinmap.

Change-Id: I8aabb5922ef5190ec85b9e01807cb79b4803b925
parent e187b274
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment