shithub: libvpx

Download patch

ref: 60b36abf854f906577ed500e9895b4a239f56794
parent: 061a16d96e86a08cff0cda5761b65c3f87dfb0af
parent: 3939e85b26523a1b1ff2ff8dffe86387e7133c37
author: John Koleszar <jkoleszar@google.com>
date: Thu Apr 26 12:07:20 EDT 2012

Merge "Fix loopfilter race condition in multithreaded encoder" into eider

--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1412,6 +1412,15 @@
     if (!oxcf)
         return;
 
+#if CONFIG_MULTITHREAD
+    /*  wait for the last picture loopfilter thread done */
+    if (cpi->b_lpf_running)
+    {
+        sem_wait(&cpi->h_event_end_lpf);
+        cpi->b_lpf_running = 0;
+    }
+#endif
+
     if (cm->version != oxcf->Version)
     {
         cm->version = oxcf->Version;
@@ -3194,6 +3203,15 @@
     // Clear down mmx registers to allow floating point in what follows
     vp8_clear_system_state();
 
+#if CONFIG_MULTITHREAD
+    /*  wait for the last picture loopfilter thread done */
+    if (cpi->b_lpf_running)
+    {
+        sem_wait(&cpi->h_event_end_lpf);
+        cpi->b_lpf_running = 0;
+    }
+#endif
+
     // Test code for segmentation of gf/arf (0,0)
     //segmentation_test_function( cpi);
 
@@ -3748,14 +3766,7 @@
             vp8_setup_key_frame(cpi);
         }
 
-#if CONFIG_MULTITHREAD
-        /*  wait for the last picture loopfilter thread done */
-        if (cpi->b_lpf_running)
-        {
-            sem_wait(&cpi->h_event_end_lpf);
-            cpi->b_lpf_running = 0;
-        }
-#endif
+
 
 #if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
         {