Commit bc6c1997 authored by Marco's avatar Marco

vp8 denoiser: Some adjustments to usage of skin and motion.

Switch to use new skin model.

And fix condition for denoising skin block.
Previous condition did not denoise skin blocks if the selected
mode was non-zero motion in current frame. Modify condition to
also force no denoising if that mode was not selected as zero motion
now and for at least "x" past frames in a row (x = 2).

Change-Id: I00753e3fe45b9a308a7ef43c58f11868e3bfc6b0
parent a2a97b86
......@@ -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 =
......
......@@ -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"
......
......@@ -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
......
......@@ -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 &&
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment