]> granicus.if.org Git - libvpx/commitdiff
Moved denoiser frame copy/updates out of loopfilter thread
authorScott LaVarnway <slavarnway@google.com>
Fri, 7 Dec 2012 20:19:52 +0000 (12:19 -0800)
committerScott LaVarnway <slavarnway@google.com>
Fri, 7 Dec 2012 20:19:52 +0000 (12:19 -0800)
The loopfilter thread from the previous frame can be running while
starting the current frame.  cpi->Source will change during this time causing
the wrong data to be copied.  The refresh_x_frame flags also change, which
will cause incorrect updates of the denoised buffers.

Change-Id: I7d982b4fcb40a0610801332aa85f3b792c64e4c3

vp8/encoder/onyx_if.c

index 3847c1e12887e39a666850d26101d6272afdb862..3421e6f81aa5088b9cd4ce019bbd2e652b67ccc9 100644 (file)
@@ -3131,49 +3131,7 @@ static void update_reference_frames(VP8_COMP *cpi)
         cpi->current_ref_frames[LAST_FRAME] = cm->current_video_frame;
 #endif
     }
-}
-
-void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm)
-{
-    const FRAME_TYPE frame_type = cm->frame_type;
-
-    if (cm->no_lpf)
-    {
-        cm->filter_level = 0;
-    }
-    else
-    {
-        struct vpx_usec_timer timer;
-
-        vp8_clear_system_state();
-
-        vpx_usec_timer_start(&timer);
-        if (cpi->sf.auto_filter == 0)
-            vp8cx_pick_filter_level_fast(cpi->Source, cpi);
-
-        else
-            vp8cx_pick_filter_level(cpi->Source, cpi);
 
-        if (cm->filter_level > 0)
-        {
-            vp8cx_set_alt_lf_level(cpi, cm->filter_level);
-        }
-
-        vpx_usec_timer_mark(&timer);
-        cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer);
-    }
-
-#if CONFIG_MULTITHREAD
-    if (cpi->b_multi_threaded)
-        sem_post(&cpi->h_event_end_lpf); /* signal that we have set filter_level */
-#endif
-
-    if (cm->filter_level > 0)
-    {
-        vp8_loop_filter_frame(cm, &cpi->mb.e_mbd, frame_type);
-    }
-
-    vp8_yv12_extend_frame_borders(cm->frame_to_show);
 #if CONFIG_TEMPORAL_DENOISING
     if (cpi->oxcf.noise_sensitivity)
     {
@@ -3226,6 +3184,50 @@ void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm)
 
 }
 
+void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm)
+{
+    const FRAME_TYPE frame_type = cm->frame_type;
+
+    if (cm->no_lpf)
+    {
+        cm->filter_level = 0;
+    }
+    else
+    {
+        struct vpx_usec_timer timer;
+
+        vp8_clear_system_state();
+
+        vpx_usec_timer_start(&timer);
+        if (cpi->sf.auto_filter == 0)
+            vp8cx_pick_filter_level_fast(cpi->Source, cpi);
+
+        else
+            vp8cx_pick_filter_level(cpi->Source, cpi);
+
+        if (cm->filter_level > 0)
+        {
+            vp8cx_set_alt_lf_level(cpi, cm->filter_level);
+        }
+
+        vpx_usec_timer_mark(&timer);
+        cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer);
+    }
+
+#if CONFIG_MULTITHREAD
+    if (cpi->b_multi_threaded)
+        sem_post(&cpi->h_event_end_lpf); /* signal that we have set filter_level */
+#endif
+
+    if (cm->filter_level > 0)
+    {
+        vp8_loop_filter_frame(cm, &cpi->mb.e_mbd, frame_type);
+    }
+
+    vp8_yv12_extend_frame_borders(cm->frame_to_show);
+
+}
+
 static void encode_frame_to_data_rate
 (
     VP8_COMP *cpi,