summaryrefslogtreecommitdiff
path: root/vp8/decoder
diff options
context:
space:
mode:
authorYunqing Wang <yunqingwang@google.com>2010-09-23 13:53:09 -0400
committerYunqing Wang <yunqingwang@google.com>2010-09-23 13:53:09 -0400
commit8db5da2906a6a75dd5b8aba7147e73214a306d24 (patch)
tree5b21f77a846d46478a97b9c5fc5354e32090a3ba /vp8/decoder
parent7fed3832e7703628cd5ac595c4cb1f9c0ee5c7ce (diff)
downloadlibvpx-8db5da2906a6a75dd5b8aba7147e73214a306d24.tar
libvpx-8db5da2906a6a75dd5b8aba7147e73214a306d24.tar.gz
libvpx-8db5da2906a6a75dd5b8aba7147e73214a306d24.tar.bz2
libvpx-8db5da2906a6a75dd5b8aba7147e73214a306d24.zip
Adjust multi-thread sync ranges according to image sizes
In multi-threaded decoder, set different sync ranges for different video resolutions. Change-Id: Iea48fd36f51919e0152c8ed3b1f10e1b723c0ca7
Diffstat (limited to 'vp8/decoder')
-rw-r--r--vp8/decoder/onyxd_int.h1
-rw-r--r--vp8/decoder/threading.c15
2 files changed, 12 insertions, 4 deletions
diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h
index ab926e61d..522ac22d2 100644
--- a/vp8/decoder/onyxd_int.h
+++ b/vp8/decoder/onyxd_int.h
@@ -96,6 +96,7 @@ typedef struct VP8Decompressor
// variable for threading
#if CONFIG_MULTITHREAD
int mt_baseline_filter_level[MAX_MB_SEGMENTS];
+ int sync_range;
int *mt_current_mb_col; // Each row remembers its already decoded column.
unsigned char **mt_yabove_row; // mb_rows x width
diff --git a/vp8/decoder/threading.c b/vp8/decoder/threading.c
index 93bc69e72..56dd5ef8e 100644
--- a/vp8/decoder/threading.c
+++ b/vp8/decoder/threading.c
@@ -257,6 +257,7 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data)
int mb_row;
int num_part = 1 << pbi->common.multi_token_partition;
volatile int *last_row_current_mb_col;
+ int nsync = pbi->sync_range;
for (mb_row = ithread+1; mb_row < pc->mb_rows; mb_row += (pbi->decoding_thread_count + 1))
{
@@ -292,9 +293,9 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data)
for (mb_col = 0; mb_col < pc->mb_cols; mb_col++)
{
- if ((mb_col & 7) == 0)
+ if ((mb_col & (nsync-1)) == 0)
{
- while (mb_col > (*last_row_current_mb_col - 8) && *last_row_current_mb_col != pc->mb_cols - 1)
+ while (mb_col > (*last_row_current_mb_col - nsync) && *last_row_current_mb_col != pc->mb_cols - 1)
{
x86_pause_hint();
thread_sleep(0);
@@ -608,6 +609,11 @@ int vp8mt_alloc_temp_buffers(VP8D_COMP *pbi, int width, int prev_mb_rows)
if ((width & 0xf) != 0)
width += 16 - (width & 0xf);
+ if (width < 640) pbi->sync_range = 1;
+ else if (width <= 1280) pbi->sync_range = 8;
+ else if (width <= 2560) pbi->sync_range =16;
+ else pbi->sync_range = 32;
+
uv_width = width >>1;
// Allocate an int for each mb row.
@@ -764,6 +770,7 @@ void vp8mt_decode_mb_rows( VP8D_COMP *pbi, MACROBLOCKD *xd)
int num_part = 1 << pbi->common.multi_token_partition;
int i, j;
volatile int *last_row_current_mb_col = NULL;
+ int nsync = pbi->sync_range;
int filter_level;
loop_filter_info *lfi = pc->lf_info;
@@ -832,8 +839,8 @@ void vp8mt_decode_mb_rows( VP8D_COMP *pbi, MACROBLOCKD *xd)
for (mb_col = 0; mb_col < pc->mb_cols; mb_col++)
{
- if ( mb_row > 0 && (mb_col & 7) == 0){
- while (mb_col > (*last_row_current_mb_col - 8) && *last_row_current_mb_col != pc->mb_cols - 1)
+ if ( mb_row > 0 && (mb_col & (nsync-1)) == 0){
+ while (mb_col > (*last_row_current_mb_col - nsync) && *last_row_current_mb_col != pc->mb_cols - 1)
{
x86_pause_hint();
thread_sleep(0);