diff mbox

[FFmpeg-devel] vp9: fix compilation with threading disabled.

Message ID 1505013879-13022-1-git-send-email-rsbultje@gmail.com
State Accepted
Commit 9bab39dee52a44ff97975aafc70b8b428d8ca7b6
Headers show

Commit Message

Ronald S. Bultje Sept. 10, 2017, 3:24 a.m. UTC
---
 libavcodec/vp9.c    | 15 +++++++++------
 libavcodec/vp9dec.h |  2 ++
 2 files changed, 11 insertions(+), 6 deletions(-)

Comments

Michael Niedermayer Sept. 10, 2017, 2:22 p.m. UTC | #1
On Sat, Sep 09, 2017 at 11:24:39PM -0400, Ronald S. Bultje wrote:
> ---
>  libavcodec/vp9.c    | 15 +++++++++------
>  libavcodec/vp9dec.h |  2 ++
>  2 files changed, 11 insertions(+), 6 deletions(-)

builds fine too

thanks!

[...]
Ronald S. Bultje Sept. 11, 2017, 12:10 p.m. UTC | #2
Hi,

On Sun, Sep 10, 2017 at 10:22 AM, Michael Niedermayer <
michael@niedermayer.cc> wrote:

> On Sat, Sep 09, 2017 at 11:24:39PM -0400, Ronald S. Bultje wrote:
> > ---
> >  libavcodec/vp9.c    | 15 +++++++++------
> >  libavcodec/vp9dec.h |  2 ++
> >  2 files changed, 11 insertions(+), 6 deletions(-)
>
> builds fine too
>
> thanks!


Pushed.

Ronald
diff mbox

Patch

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index a71045e..f626f81 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -88,10 +88,8 @@  static void vp9_await_tile_progress(VP9Context *s, int field, int n) {
     pthread_mutex_unlock(&s->progress_mutex);
 }
 #else
-static void vp9_free_entries(VP9Context *s) {}
+static void vp9_free_entries(AVCodecContext *avctx) {}
 static int vp9_alloc_entries(AVCodecContext *avctx, int n) { return 0; }
-static void vp9_report_tile_progress(VP9Context *s, int field, int n) {}
-static void vp9_await_tile_progress(VP9Context *s, int field, int n) {}
 #endif
 
 static void vp9_frame_unref(AVCodecContext *avctx, VP9Frame *f)
@@ -1343,7 +1341,7 @@  static int decode_tiles(AVCodecContext *avctx,
     return 0;
 }
 
-
+#if HAVE_THREADS
 static av_always_inline
 int decode_tiles_mt(AVCodecContext *avctx, void *tdata, int jobnr,
                               int threadnr)
@@ -1451,7 +1449,7 @@  int loopfilter_proc(AVCodecContext *avctx)
     }
     return 0;
 }
-
+#endif
 
 static int vp9_decode_frame(AVCodecContext *avctx, void *frame,
                             int *got_frame, AVPacket *pkt)
@@ -1583,10 +1581,12 @@  FF_ENABLE_DEPRECATION_WARNINGS
         ff_thread_finish_setup(avctx);
     }
 
+#if HAVE_THREADS
     if (avctx->active_thread_type & FF_THREAD_SLICE) {
         for (i = 0; i < s->sb_rows; i++)
             atomic_store(&s->entries[i], 0);
     }
+#endif
 
     do {
         for (i = 0; i < s->active_tile_cols; i++) {
@@ -1599,6 +1599,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
             s->td[i].uveob[1] = s->td[i].uveob_base[1];
         }
 
+#if HAVE_THREADS
         if (avctx->active_thread_type == FF_THREAD_SLICE) {
             int tile_row, tile_col;
 
@@ -1629,7 +1630,9 @@  FF_ENABLE_DEPRECATION_WARNINGS
             }
 
             ff_slice_thread_execute_with_mainfunc(avctx, decode_tiles_mt, loopfilter_proc, s->td, NULL, s->s.h.tiling.tile_cols);
-        } else {
+        } else
+#endif
+        {
             ret = decode_tiles(avctx, data, size);
             if (ret < 0)
                 return ret;
diff --git a/libavcodec/vp9dec.h b/libavcodec/vp9dec.h
index 15e0122..96c0e43 100644
--- a/libavcodec/vp9dec.h
+++ b/libavcodec/vp9dec.h
@@ -98,9 +98,11 @@  typedef struct VP9Context {
     VP56RangeCoder c;
     int pass, active_tile_cols;
 
+#if HAVE_THREADS
     pthread_mutex_t progress_mutex;
     pthread_cond_t progress_cond;
     atomic_int *entries;
+#endif
 
     uint8_t ss_h, ss_v;
     uint8_t last_bpp, bpp_index, bytesperpixel;