diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c index 98b273303..99e2c5a28 100644 --- a/vp9/encoder/vp9_aq_cyclicrefresh.c +++ b/vp9/encoder/vp9_aq_cyclicrefresh.c @@ -209,7 +209,7 @@ void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi, int is_skin = 0; if (refresh_this_block == 0 && bsize <= BLOCK_16X16 && - cpi->oxcf.content != VP9E_CONTENT_SCREEN) { + cpi->use_skin_detection) { is_skin = vp9_compute_skin_block(p[0].src.buf, p[1].src.buf, p[2].src.buf, diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index a67813e73..a2445b0c1 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -773,13 +773,14 @@ static int choose_partitioning(VP9_COMP *cpi, 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 - // to 32x32. Avoid checking superblocks on/near boundary for high resoln + // to 32x32. Avoid checking superblocks on/near boundary and avoid low + // resolutons for now. // 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. x->sb_is_skin = 0; #if !CONFIG_VP9_HIGHBITDEPTH - if (cpi->oxcf.content != VP9E_CONTENT_SCREEN && (low_res || (mi_col >= 8 && - mi_col + 8 < cm->mi_cols && mi_row >= 8 && mi_row + 8 < cm->mi_rows))) { + 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)) { int num_16x16_skin = 0; int num_16x16_nonskin = 0; uint8_t *ysignal = x->plane[0].src.buf; diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 8c646938c..5341c9444 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -1671,6 +1671,7 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf, cpi->resize_state = 0; cpi->resize_avg_qp = 0; cpi->resize_buffer_underflow = 0; + cpi->use_skin_detection = 0; cpi->common.buffer_pool = pool; cpi->rc.high_source_sad = 0; @@ -3130,7 +3131,7 @@ static void set_size_dependent_vars(VP9_COMP *cpi, int *q, if (oxcf->pass == 2 && cpi->sf.static_segmentation) configure_static_seg_features(cpi); -#if CONFIG_VP9_POSTPROC +#if CONFIG_VP9_POSTPROC && !(CONFIG_VP9_TEMPORAL_DENOISING) if (oxcf->noise_sensitivity > 0) { int l = 0; switch (oxcf->noise_sensitivity) { @@ -3330,6 +3331,14 @@ static void encode_without_recode_loop(VP9_COMP *cpi, set_size_independent_vars(cpi); set_size_dependent_vars(cpi, &q, &bottom_index, &top_index); + if (cpi->oxcf.speed >= 5 && + cpi->oxcf.pass == 0 && + cpi->oxcf.rc_mode == VPX_CBR && + cpi->oxcf.content != VP9E_CONTENT_SCREEN && + cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) { + cpi->use_skin_detection = 1; + } + vp9_set_quantizer(cm, q); vp9_set_variance_partition_thresholds(cpi, q); diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index 76c36f4e5..838ceacd6 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -494,6 +494,8 @@ typedef struct VP9_COMP { int resize_buffer_underflow; int resize_count; + int use_skin_detection; + NOISE_ESTIMATE noise_estimate; // VAR_BASED_PARTITION thresholds diff --git a/vp9/encoder/vp9_noise_estimate.c b/vp9/encoder/vp9_noise_estimate.c index b1a261986..e56cc9b01 100644 --- a/vp9/encoder/vp9_noise_estimate.c +++ b/vp9/encoder/vp9_noise_estimate.c @@ -162,7 +162,9 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) { for (mi_row = 0; mi_row < cm->mi_rows; mi_row++) { for (mi_col = 0; mi_col < cm->mi_cols; mi_col++) { // 16x16 blocks, 1/4 sample of frame. - if (mi_row % 4 == 0 && mi_col % 4 == 0) { + if (mi_row % 4 == 0 && mi_col % 4 == 0 && + mi_row < cm->mi_rows - 1 && + mi_col < cm->mi_cols - 1) { int bl_index = mi_row * cm->mi_cols + mi_col; int bl_index1 = bl_index + 1; int bl_index2 = bl_index + cm->mi_cols;