Merge "vp9: Non-rd partition selection: use consec_zeromv to set sb_is_skin."

This commit is contained in:
Marco Paniconi 2016-03-23 01:06:57 +00:00 committed by Gerrit Code Review
commit c8fc6ed14a

View File

@ -772,36 +772,55 @@ static int choose_partitioning(VP9_COMP *cpi,
vp9_build_inter_predictors_sb(xd, mi_row, mi_col, BLOCK_64X64); vp9_build_inter_predictors_sb(xd, mi_row, mi_col, BLOCK_64X64);
// Check if most of the superblock is skin content, and if so, force split // Check if most of the superblock is skin content, and if so, force split
// to 32x32. Avoid checking superblocks on/near boundary and avoid low // to 32x32, and set x->sb_is_skin for use in mode selection.
// resolutons for now. // Avoid checking superblocks on/near boundary and avoid low resolutions.
// Note superblock may still pick 64X64 if y_sad is very small // Note superblock may still pick 64X64 if y_sad is very small
// (i.e., y_sad < cpi->vbp_threshold_sad) below. For now leave this as is. // (i.e., y_sad < cpi->vbp_threshold_sad) below. For now leave this as is.
x->sb_is_skin = 0; x->sb_is_skin = 0;
#if !CONFIG_VP9_HIGHBITDEPTH #if !CONFIG_VP9_HIGHBITDEPTH
if (cpi->use_skin_detection && !low_res && (mi_col >= 8 && if (cpi->use_skin_detection && !low_res && (mi_col >= 8 &&
mi_col + 8 < cm->mi_cols && mi_row >= 8 && mi_row + 8 < cm->mi_rows)) { mi_col + 8 < cm->mi_cols && mi_row >= 8 && mi_row + 8 < cm->mi_rows)) {
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
int bl_index1, bl_index2, bl_index3;
int num_16x16_skin = 0; int num_16x16_skin = 0;
int num_16x16_nonskin = 0; int num_16x16_nonskin = 0;
int is_skin = 0;
int consec_zeromv = 0;
uint8_t *ysignal = x->plane[0].src.buf; uint8_t *ysignal = x->plane[0].src.buf;
uint8_t *usignal = x->plane[1].src.buf; uint8_t *usignal = x->plane[1].src.buf;
uint8_t *vsignal = x->plane[2].src.buf; uint8_t *vsignal = x->plane[2].src.buf;
int spuv = x->plane[1].src.stride; int spuv = x->plane[1].src.stride;
for (i = 0; i < 4; i++) { const int block_index = mi_row * cm->mi_cols + mi_col;
for (j = 0; j < 4; j++) { const int bw = num_8x8_blocks_wide_lookup[BLOCK_64X64];
int is_skin = vp9_compute_skin_block(ysignal, const int bh = num_8x8_blocks_high_lookup[BLOCK_64X64];
usignal, const int xmis = VPXMIN(cm->mi_cols - mi_col, bw);
vsignal, const int ymis = VPXMIN(cm->mi_rows - mi_row, bh);
sp, // Loop through the 16x16 sub-blocks.
spuv, int j, i;
BLOCK_16X16, for (i = 0; i < ymis; i+=2) {
0, for (j = 0; j < xmis; j+=2) {
0); int bl_index = block_index + i * cm->mi_cols + j;
bl_index1 = bl_index + 1;
bl_index2 = bl_index + cm->mi_cols;
bl_index3 = bl_index2 + 1;
consec_zeromv = VPXMIN(cr->consec_zero_mv[bl_index],
VPXMIN(cr->consec_zero_mv[bl_index1],
VPXMIN(cr->consec_zero_mv[bl_index2],
cr->consec_zero_mv[bl_index3])));
is_skin = vp9_compute_skin_block(ysignal,
usignal,
vsignal,
sp,
spuv,
BLOCK_16X16,
consec_zeromv,
0);
num_16x16_skin += is_skin; num_16x16_skin += is_skin;
num_16x16_nonskin += (1 - is_skin); num_16x16_nonskin += (1 - is_skin);
if (num_16x16_nonskin > 3) { if (num_16x16_nonskin > 3) {
// Exit loop if at least 4 of the 16x16 blocks are not skin. // Exit loop if at least 4 of the 16x16 blocks are not skin.
i = 4; i = ymis;
j = 4; j = xmis;
} }
ysignal += 16; ysignal += 16;
usignal += 8; usignal += 8;