Browse Source

vp8: Enclose pthread function calls in ifdefs

This fixes building with threads disabled.

Signed-off-by: Martin Storsjö <martin@martin.st>
tags/n1.0
Martin Storsjö 13 years ago
parent
commit
25f056e6d4
2 changed files with 9 additions and 0 deletions
  1. +7
    -0
      libavcodec/vp8.c
  2. +2
    -0
      libavcodec/vp8.h

+ 7
- 0
libavcodec/vp8.c View File

@@ -143,8 +143,10 @@ static int update_dimensions(VP8Context *s, int width, int height)


for (i = 0; i < MAX_THREADS; i++) { for (i = 0; i < MAX_THREADS; i++) {
s->thread_data[i].filter_strength = av_mallocz(s->mb_width*sizeof(*s->thread_data[0].filter_strength)); s->thread_data[i].filter_strength = av_mallocz(s->mb_width*sizeof(*s->thread_data[0].filter_strength));
#if HAVE_THREADS
pthread_mutex_init(&s->thread_data[i].lock, NULL); pthread_mutex_init(&s->thread_data[i].lock, NULL);
pthread_cond_init(&s->thread_data[i].cond, NULL); pthread_cond_init(&s->thread_data[i].cond, NULL);
#endif
} }


if (!s->macroblocks_base || !s->top_nnz || !s->top_border || if (!s->macroblocks_base || !s->top_nnz || !s->top_border ||
@@ -1623,6 +1625,7 @@ static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, AVFrame *curframe,
} }
} }


#if HAVE_THREADS
#define check_thread_pos(td, otd, mb_x_check, mb_y_check)\ #define check_thread_pos(td, otd, mb_x_check, mb_y_check)\
do {\ do {\
int tmp = (mb_y_check << 16) | (mb_x_check & 0xFFFF);\ int tmp = (mb_y_check << 16) | (mb_x_check & 0xFFFF);\
@@ -1654,6 +1657,10 @@ static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, AVFrame *curframe,
pthread_mutex_unlock(&td->lock);\ pthread_mutex_unlock(&td->lock);\
}\ }\
} while(0); } while(0);
#else
#define check_thread_pos(td, otd, mb_x_check, mb_y_check)
#define update_pos(td, mb_y, mb_x)
#endif


static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
int jobnr, int threadnr) int jobnr, int threadnr)


+ 2
- 0
libavcodec/vp8.h View File

@@ -94,8 +94,10 @@ typedef struct {
} VP8Macroblock; } VP8Macroblock;


typedef struct { typedef struct {
#if HAVE_THREADS
pthread_mutex_t lock; pthread_mutex_t lock;
pthread_cond_t cond; pthread_cond_t cond;
#endif
int thread_nr; int thread_nr;
int thread_mb_pos; // (mb_y << 16) | (mb_x & 0xFFFF) int thread_mb_pos; // (mb_y << 16) | (mb_x & 0xFFFF)
int wait_mb_pos; // What the current thread is waiting on. int wait_mb_pos; // What the current thread is waiting on.


Loading…
Cancel
Save