From: Yunqing Wang Date: Mon, 30 Aug 2010 22:16:04 +0000 (-0400) Subject: Replace sleep(0) calls in multi-threaded decoder X-Git-Tag: 1.0_branch~910^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e78efad0be73d293880d1b71053c0d70a50a080;p=profile%2Fivi%2Flibvpx.git Replace sleep(0) calls in multi-threaded decoder This is a workaround for gLucid problem. Change-Id: I188a016a07e4c2ea212444c5a6284ff3c48a5caa --- diff --git a/vp8/common/threading.h b/vp8/common/threading.h index 96be710..cd22361 100644 --- a/vp8/common/threading.h +++ b/vp8/common/threading.h @@ -75,7 +75,8 @@ #define thread_sleep(nms) // { struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} #else #include -#define thread_sleep(nms) usleep(nms*1000);// {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} +#include +#define thread_sleep(nms) sched_yield();// {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} #endif /* Not Windows. Assume pthreads */ diff --git a/vp8/decoder/threading.c b/vp8/decoder/threading.c index ba84395..10e72ce 100644 --- a/vp8/decoder/threading.c +++ b/vp8/decoder/threading.c @@ -611,15 +611,12 @@ void vp8_mtdecode_mb_rows(VP8D_COMP *pbi, for (mb_col = 0; mb_col < pc->mb_cols; mb_col++) { - if ( mb_row > 0 && (mb_col & 7) == 0){ - //if ( mb_row > 0 ){ - while (mb_col > (*last_row_current_mb_col - 8) && *last_row_current_mb_col != pc->mb_cols - 1) - { - x86_pause_hint(); - thread_sleep(0); - } - + while (mb_col > (*last_row_current_mb_col - 8) && *last_row_current_mb_col != pc->mb_cols - 1) + { + x86_pause_hint(); + thread_sleep(0); + } } if (xd->mode_info_context->mbmi.mode == SPLITMV || xd->mode_info_context->mbmi.mode == B_PRED) @@ -763,7 +760,6 @@ void vp8_mt_loop_filter_frame( VP8D_COMP *pbi) { int Segment = (alt_flt_enabled) ? mbd->mode_info_context->mbmi.segment_id : 0; - if ( mb_row > 0 && (mb_col & 7) == 0){ // if ( mb_row > 0 ){ while (mb_col > (*last_row_current_mb_col-8) && *last_row_current_mb_col != cm->mb_cols - 1)