summaryrefslogtreecommitdiff
path: root/vp8/encoder
diff options
context:
space:
mode:
authorMarco Paniconi <marpan@google.com>2016-08-29 05:52:39 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-08-29 05:52:40 +0000
commite66cd132f09e6303c1746a7c071fb742c3cca637 (patch)
tree1abac9936594c87f69c720813b9333e32ca7915a /vp8/encoder
parent3a98508775b1cf3c6b4dea3af45e1f1bf5e31549 (diff)
parentb6a5f6f740d476f15c083fce022c06eff14731a4 (diff)
downloadlibvpx-e66cd132f09e6303c1746a7c071fb742c3cca637.tar
libvpx-e66cd132f09e6303c1746a7c071fb742c3cca637.tar.gz
libvpx-e66cd132f09e6303c1746a7c071fb742c3cca637.tar.bz2
libvpx-e66cd132f09e6303c1746a7c071fb742c3cca637.zip
Merge "vp8: Move loopfilter synchronization to end of encode_frame call."
Diffstat (limited to 'vp8/encoder')
-rw-r--r--vp8/encoder/ethreading.c1
-rw-r--r--vp8/encoder/onyx_if.c16
-rw-r--r--vp8/encoder/onyx_int.h1
3 files changed, 11 insertions, 7 deletions
diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c
index d019d13ef..ba05776a3 100644
--- a/vp8/encoder/ethreading.c
+++ b/vp8/encoder/ethreading.c
@@ -492,6 +492,7 @@ int vp8cx_create_encoder_threads(VP8_COMP *cpi) {
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;
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index e61509da8..61bc64d23 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -4349,6 +4349,7 @@ static void encode_frame_to_data_rate(VP8_COMP *cpi, unsigned long *size,
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 @@ static void encode_frame_to_data_rate(VP8_COMP *cpi, unsigned long *size,
/* 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;
@@ -5220,6 +5214,14 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags,
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;
}
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index 034a450e9..b07494b62 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -509,6 +509,7 @@ typedef struct VP8_COMP {
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;