diff options
-rw-r--r-- | vp8/encoder/denoising.c | 17 | ||||
-rw-r--r-- | vp8/encoder/denoising.h | 3 | ||||
-rw-r--r-- | vp8/encoder/pickinter.c | 5 | ||||
-rw-r--r-- | vp8/encoder/rdopt.c | 2 |
4 files changed, 17 insertions, 10 deletions
diff --git a/vp8/encoder/denoising.c b/vp8/encoder/denoising.c index 5ae44e82e..c85251e1c 100644 --- a/vp8/encoder/denoising.c +++ b/vp8/encoder/denoising.c @@ -497,7 +497,8 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, loop_filter_info_n *lfi_n, int mb_row, int mb_col, - int block_index) + int block_index, + int consec_zero_last) { int mv_row; @@ -608,11 +609,6 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, motion_threshold = denoiser->denoise_pars.scale_motion_thresh * NOISE_MOTION_THRESHOLD; - // If block is considered to be skin area, lower the motion threshold. - // In current version set threshold = 0, so only denoise zero mv on skin. - if (x->is_skin) - motion_threshold = 0; - if (motion_magnitude2 < denoiser->denoise_pars.scale_increase_filter * NOISE_MOTION_THRESHOLD) x->increase_denoising = 1; @@ -624,6 +620,15 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, if (best_sse > sse_thresh || motion_magnitude2 > motion_threshold) decision = COPY_BLOCK; + // If block is considered skin, don't denoise if the block + // (1) is selected as non-zero motion for current frame, or + // (2) has not been selected as ZERO_LAST mode at least x past frames + // in a row. + // TODO(marpan): Parameter "x" should be varied with framerate. + // In particualar, should be reduced for temporal layers (base layer/LAST). + if (x->is_skin && (consec_zero_last < 2 || motion_magnitude2 > 0)) + decision = COPY_BLOCK; + if (decision == FILTER_BLOCK) { unsigned char *mc_running_avg_y = diff --git a/vp8/encoder/denoising.h b/vp8/encoder/denoising.h index 148ccdafe..34c561df8 100644 --- a/vp8/encoder/denoising.h +++ b/vp8/encoder/denoising.h @@ -108,7 +108,8 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, loop_filter_info_n *lfi_n, int mb_row, int mb_col, - int block_index); + int block_index, + int consec_zero_last); #ifdef __cplusplus } // extern "C" diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c index 51fbe541c..0708d65eb 100644 --- a/vp8/encoder/pickinter.c +++ b/vp8/encoder/pickinter.c @@ -36,7 +36,7 @@ extern unsigned int cnt_pm; #endif -#define MODEL_MODE 0 +#define MODEL_MODE 1 extern const int vp8_ref_frame_order[MAX_MODES]; extern const MB_PREDICTION_MODE vp8_mode_order[MAX_MODES]; @@ -1477,7 +1477,8 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, vp8_denoiser_denoise_mb(&cpi->denoiser, x, best_sse, zero_mv_sse, recon_yoffset, recon_uvoffset, &cpi->common.lf_info, mb_row, mb_col, - block_index); + block_index, + cpi->consec_zero_last_mvbias[block_index]); // Reevaluate ZEROMV after denoising: for large noise content // (i.e., cpi->mse_source_denoised is above threshold), do this for all diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index ab0ad1599..9063cea76 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -2530,7 +2530,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, vp8_denoiser_denoise_mb(&cpi->denoiser, x, best_sse, zero_mv_sse, recon_yoffset, recon_uvoffset, &cpi->common.lf_info, mb_row, mb_col, - block_index); + block_index, 0); /* Reevaluate ZEROMV after denoising. */ if (best_mode.mbmode.ref_frame == INTRA_FRAME && |