if (refresh_this_block == 0 &&
bsize <= BLOCK_16X16 &&
cpi->oxcf.content != VP9E_CONTENT_SCREEN) {
- // Take center pixel in block to determine is_skin.
- const int y_width_shift = (4 << b_width_log2_lookup[bsize]) >> 1;
- const int y_height_shift = (4 << b_height_log2_lookup[bsize]) >> 1;
- const int uv_width_shift = y_width_shift >> 1;
- const int uv_height_shift = y_height_shift >> 1;
- const int stride = p[0].src.stride;
- const int strideuv = p[1].src.stride;
- const uint8_t ysource =
- p[0].src.buf[y_height_shift * stride + y_width_shift];
- const uint8_t usource =
- p[1].src.buf[uv_height_shift * strideuv + uv_width_shift];
- const uint8_t vsource =
- p[2].src.buf[uv_height_shift * strideuv + uv_width_shift];
- is_skin = vp9_skin_pixel(ysource, usource, vsource);
+ is_skin = vp9_compute_skin_block(p[0].src.buf,
+ p[1].src.buf,
+ p[2].src.buf,
+ p[0].src.stride,
+ p[1].src.stride,
+ bsize);
if (is_skin)
refresh_this_block = 1;
}
int is_skin = 0;
if (bs <= BLOCK_16X16 && denoiser->denoising_level >= kDenLow) {
- // Take center pixel in block to determine is_skin.
- const int y_width_shift = (4 << b_width_log2_lookup[bs]) >> 1;
- const int y_height_shift = (4 << b_height_log2_lookup[bs]) >> 1;
- const int uv_width_shift = y_width_shift >> 1;
- const int uv_height_shift = y_height_shift >> 1;
- const int stride = mb->plane[0].src.stride;
- const int strideuv = mb->plane[1].src.stride;
- const uint8_t ysource =
- mb->plane[0].src.buf[y_height_shift * stride + y_width_shift];
- const uint8_t usource =
- mb->plane[1].src.buf[uv_height_shift * strideuv + uv_width_shift];
- const uint8_t vsource =
- mb->plane[2].src.buf[uv_height_shift * strideuv + uv_width_shift];
- is_skin = vp9_skin_pixel(ysource, usource, vsource);
+ is_skin = vp9_compute_skin_block(mb->plane[0].src.buf,
+ mb->plane[1].src.buf,
+ mb->plane[2].src.buf,
+ mb->plane[0].src.stride,
+ mb->plane[1].src.stride,
+ bs);
}
mv_col = ctx->best_sse_mv.as_mv.col;
const uint8_t *src_u = cpi->Source->u_buffer;
const uint8_t *src_v = cpi->Source->v_buffer;
const int src_uvstride = cpi->Source->uv_stride;
- const int y_width_shift = (4 << b_width_log2_lookup[bsize]) >> 1;
- const int y_height_shift = (4 << b_height_log2_lookup[bsize]) >> 1;
- const int uv_width_shift = y_width_shift >> 1;
- const int uv_height_shift = y_height_shift >> 1;
int mi_row, mi_col;
int num_low_motion = 0;
int frame_low_motion = 1;
// been encoded as zero/low motion x (= thresh_consec_zeromv) frames
// in a row. consec_zero_mv[] defined for 8x8 blocks, so consider all
// 4 sub-blocks for 16x16 block. Also, avoid skin blocks.
- const uint8_t ysource =
- src_y[y_height_shift * src_ystride + y_width_shift];
- const uint8_t usource =
- src_u[uv_height_shift * src_uvstride + uv_width_shift];
- const uint8_t vsource =
- src_v[uv_height_shift * src_uvstride + uv_width_shift];
- int is_skin = vp9_skin_pixel(ysource, usource, vsource);
+ int is_skin = vp9_compute_skin_block(src_y,
+ src_u,
+ src_v,
+ src_ystride,
+ src_uvstride,
+ bsize);
if (frame_low_motion &&
cr->consec_zero_mv[bl_index] > thresh_consec_zeromv &&
cr->consec_zero_mv[bl_index1] > thresh_consec_zeromv &&
return (evaluate_skin_color_difference(cb, cr) < skin_threshold);
}
+int vp9_compute_skin_block(const uint8_t *y, const uint8_t *u, const uint8_t *v,
+ int stride, int strideuv, int bsize) {
+ // Take center pixel in block to determine is_skin.
+ const int y_width_shift = (4 << b_width_log2_lookup[bsize]) >> 1;
+ const int y_height_shift = (4 << b_height_log2_lookup[bsize]) >> 1;
+ const int uv_width_shift = y_width_shift >> 1;
+ const int uv_height_shift = y_height_shift >> 1;
+ const uint8_t ysource = y[y_height_shift * stride + y_width_shift];
+ const uint8_t usource = u[uv_height_shift * strideuv + uv_width_shift];
+ const uint8_t vsource = v[uv_height_shift * strideuv + uv_width_shift];
+ return vp9_skin_pixel(ysource, usource, vsource);
+}
+
+
#ifdef OUTPUT_YUV_SKINMAP
// For viewing skin map on input source.
void vp9_compute_skin_map(VP9_COMP *const cpi, FILE *yuv_skinmap_file) {
int vp9_skin_pixel(const uint8_t y, const uint8_t cb, const uint8_t cr);
+int vp9_compute_skin_block(const uint8_t *y, const uint8_t *u, const uint8_t *v,
+ int stride, int strideuv, int bsize);
+
#ifdef OUTPUT_YUV_SKINMAP
// For viewing skin map on input source.
void vp9_compute_skin_map(struct VP9_COMP *const cpi, FILE *yuv_skinmap_file);