ref: bc6c19978508116effeb972aaf24e8f4d461f775
parent: a2a97b869f0f4a8dec2a9d8d0c0dcdd56e5a0477
author: Marco <[email protected]>
date: Tue Jan 19 07:57:29 EST 2016
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
--- a/vp8/encoder/denoising.c
+++ b/vp8/encoder/denoising.c
@@ -497,7 +497,8 @@
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 @@
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;
@@ -622,6 +618,15 @@
sse_thresh = denoiser->denoise_pars.scale_sse_thresh * SSE_THRESHOLD_HIGH;
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)
--- a/vp8/encoder/denoising.h
+++ b/vp8/encoder/denoising.h
@@ -108,7 +108,8 @@
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"
--- 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 @@
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
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -2530,7 +2530,7 @@
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 &&