]> granicus.if.org Git - libvpx/commitdiff
vp8: Suppress denoising with respect to old reference frames.
authorMarco <marpan@google.com>
Tue, 7 Oct 2014 23:15:32 +0000 (16:15 -0700)
committerMarco <marpan@google.com>
Wed, 8 Oct 2014 19:54:39 +0000 (12:54 -0700)
If the GOLDEN or ALTREF frame was last updated > x frames in the past,
don't use them for denoising (only consider LAST). Using an old reference
frame for denoising, e.g., if it is a long-term reference or the last key frame,
can cause some visible artifacts, in particular in the aggressive denoising mode.

Change-Id: I239c9fbb092c36cba7e95328f1fa67a58d6a7ed9

vp8/encoder/denoising.h
vp8/encoder/pickinter.c

index fb7930b6b211efb11ce5b0c2a2762fdf8e379f58..6c1f9e22baa6f8d848cd390ca1aa491e54939abc 100644 (file)
@@ -27,6 +27,8 @@ extern "C" {
 #define SUM_DIFF_FROM_AVG_THRESH_UV (8 * 8 * 8)
 #define MOTION_MAGNITUDE_THRESHOLD_UV (8*3)
 
+#define MAX_GF_ARF_DENOISE_RANGE (16)
+
 enum vp8_denoiser_decision
 {
   COPY_BLOCK,
index 43f8957d14172d96fb2b46aea4603a9d2ad7aa69..ea3b46edac3be14228c01c84322862735c602da9 100644 (file)
@@ -1083,7 +1083,14 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
         {
 
             /* Store for later use by denoiser. */
-            if (this_mode == ZEROMV && sse < zero_mv_sse )
+            // Dont' denoise with GOLDEN OR ALTREF is they are old reference
+            // frames (greater than MAX_GF_ARF_DENOISE_RANGE frames in past).
+            int skip_old_reference = ((this_ref_frame != LAST_FRAME) &&
+                (cpi->common.current_video_frame -
+                 cpi->current_ref_frames[this_ref_frame] >
+                 MAX_GF_ARF_DENOISE_RANGE)) ? 1 : 0;
+            if (this_mode == ZEROMV && sse < zero_mv_sse &&
+                !skip_old_reference)
             {
                 zero_mv_sse = sse;
                 x->best_zeromv_reference_frame =
@@ -1092,7 +1099,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
 
             /* Store the best NEWMV in x for later use in the denoiser. */
             if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV &&
-                    sse < best_sse)
+                sse < best_sse && !skip_old_reference)
             {
                 best_sse = sse;
                 x->best_sse_inter_mode = NEWMV;