summaryrefslogtreecommitdiff
path: root/vp8/encoder/onyx_int.h
diff options
context:
space:
mode:
authorYunqing Wang <yunqingwang@google.com>2016-01-06 18:27:37 -0800
committerYunqing Wang <yunqingwang@google.com>2016-01-08 11:59:49 -0800
commitff0107f60dbddec82d7d7feacd1c9a3ff9ab4a51 (patch)
tree0590f67ac2b1e9266a6b0cf4fbc144d3f9f69b00 /vp8/encoder/onyx_int.h
parentb8c2a4eb0c47b633096f5c428b70607e7bf8d570 (diff)
downloadlibvpx-ff0107f60dbddec82d7d7feacd1c9a3ff9ab4a51.tar
libvpx-ff0107f60dbddec82d7d7feacd1c9a3ff9ab4a51.tar.gz
libvpx-ff0107f60dbddec82d7d7feacd1c9a3ff9ab4a51.tar.bz2
libvpx-ff0107f60dbddec82d7d7feacd1c9a3ff9ab4a51.zip
Amend and improve VP8 multithreading implementation
There are flaws in current implementation of VP8 multithreading encoder and decoder as reported in the following issue: https://code.google.com/p/chromium/issues/detail?id=158922 Although the data race warnings are harmless, and wouldn't cause real problems while encoding and decoding videos, it is better to fix the warnings so that VP8 code could pass the TSan test. To synchronize the thread-shared data access and maintain the speed (i.e. decoding speed), use multiple mutexes based on mb_rows to reduce the number of synchronizations needed, make the reads and writes of the shared data protected, and reduce the number of mb_col writes by nsync times. The decoder speed tests showed < 3% speed loss while using 2 ~ 4 threads. Change-Id: Ie296defffcd86a693188b668270d811964227882
Diffstat (limited to 'vp8/encoder/onyx_int.h')
-rw-r--r--vp8/encoder/onyx_int.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index 317e4b9e4..2b2f7a0a9 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -530,6 +530,8 @@ typedef struct VP8_COMP
#if CONFIG_MULTITHREAD
/* multithread data */
+ pthread_mutex_t *pmutex;
+ pthread_mutex_t mt_mutex; /* mutex for b_multi_threaded */
int * mt_current_mb_col;
int mt_sync_range;
int b_multi_threaded;