shithub: libvpx

Download patch

ref: e66cd132f09e6303c1746a7c071fb742c3cca637
parent: 3a98508775b1cf3c6b4dea3af45e1f1bf5e31549
parent: b6a5f6f740d476f15c083fce022c06eff14731a4
author: Marco Paniconi <marpan@google.com>
date: Mon Aug 29 01:52:39 EDT 2016

Merge "vp8: Move loopfilter synchronization to end of encode_frame call."

--- a/vp8/encoder/ethreading.c
+++ b/vp8/encoder/ethreading.c
@@ -492,6 +492,7 @@
 
   cpi->b_multi_threaded = 0;
   cpi->encoding_thread_count = 0;
+  cpi->b_lpf_running = 0;
 
   if (cm->processor_core_count > 1 && cpi->oxcf.multi_threaded > 1) {
     int ithread;
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -4349,6 +4349,7 @@
   if (cpi->b_multi_threaded) {
     /* start loopfilter in separate thread */
     sem_post(&cpi->h_event_start_lpf);
+    cpi->b_lpf_running = 1;
   } else
 #endif
   {
@@ -4377,13 +4378,6 @@
   /* build the bitstream */
   vp8_pack_bitstream(cpi, dest, dest_end, size);
 
-#if CONFIG_MULTITHREAD
-  /* wait for the lpf thread done */
-  if (cpi->b_multi_threaded) {
-    sem_wait(&cpi->h_event_end_lpf);
-  }
-#endif
-
   /* Move storing frame_type out of the above loop since it is also
    * needed in motion search besides loopfilter */
   cm->last_frame_type = cm->frame_type;
@@ -5219,6 +5213,14 @@
 #endif
 
   cpi->common.error.setjmp = 0;
+
+#if CONFIG_MULTITHREAD
+  /* wait for the lpf thread done */
+  if (cpi->b_multi_threaded && cpi->b_lpf_running) {
+    sem_wait(&cpi->h_event_end_lpf);
+    cpi->b_lpf_running = 0;
+  }
+#endif
 
   return 0;
 }
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -509,6 +509,7 @@
   int mt_sync_range;
   int b_multi_threaded;
   int encoding_thread_count;
+  int b_lpf_running;
 
   pthread_t *h_encoding_thread;
   pthread_t h_filter_thread;