Merge "vp8: Clean up skinmap debugging codes."

This commit is contained in:
Jerome Jiang 2017-06-26 21:32:51 +00:00 committed by Gerrit Code Review
commit ddae8f7632
2 changed files with 4 additions and 26 deletions

View File

@ -73,10 +73,8 @@ void vp8_compute_skin_map(VP8_COMP *const cpi, FILE *yuv_skinmap_file) {
VP8_COMMON *const cm = &cpi->common; VP8_COMMON *const cm = &cpi->common;
uint8_t *y; uint8_t *y;
const uint8_t *src_y = cpi->Source->y_buffer; 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_ystride = cpi->Source->y_stride;
const int src_uvstride = cpi->Source->uv_stride; int offset = 0;
YV12_BUFFER_CONFIG skinmap; YV12_BUFFER_CONFIG skinmap;
memset(&skinmap, 0, sizeof(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; y = skinmap.y_buffer;
// Loop through blocks and set skin map based on center pixel of block. // 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. // 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) { for (mb_row = 0; mb_row < cm->mb_rows; mb_row += 1) {
num_bl = 0; num_bl = 0;
for (mb_col = 0; mb_col < cm->mb_cols; mb_col += 1) { for (mb_col = 0; mb_col < cm->mb_cols; mb_col += 1) {
int is_skin = 0; const int is_skin = cpi->skin_map[offset++];
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);
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j++) { for (j = 0; j < 16; j++) {
if (is_skin) y[i * src_ystride + j] = is_skin ? 255 : src_y[i * src_ystride + j];
y[i * src_ystride + j] = 255;
else
y[i * src_ystride + j] = src_y[i * src_ystride + j];
} }
} }
num_bl++; num_bl++;
y += 16; y += 16;
src_y += 16; src_y += 16;
src_u += 8;
src_v += 8;
} }
y += (src_ystride << 4) - (num_bl << 4); y += (src_ystride << 4) - (num_bl << 4);
src_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_write_yuv_frame(yuv_skinmap_file, &skinmap);
vpx_free_frame_buffer(&skinmap); vpx_free_frame_buffer(&skinmap);

View File

@ -1969,7 +1969,7 @@ struct VP8_COMP *vp8_create_compressor(VP8_CONFIG *oxcf) {
yuv_denoised_file = fopen("denoised.yuv", "ab"); yuv_denoised_file = fopen("denoised.yuv", "ab");
#endif #endif
#ifdef OUTPUT_YUV_SKINMAP #ifdef OUTPUT_YUV_SKINMAP
yuv_skinmap_file = fopen("skinmap.yuv", "ab"); yuv_skinmap_file = fopen("skinmap.yuv", "wb");
#endif #endif
#if 0 #if 0