[FFmpeg-cvslog] avcodec/hqx: add support for frame threads

Paul B Mahol git at videolan.org
Sun Apr 9 11:50:58 EEST 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Apr  8 12:11:39 2017 +0200| [20f7872d9903120ca3609a1e3ad973132bd686cc] | committer: Paul B Mahol

avcodec/hqx: add support for frame threads

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=20f7872d9903120ca3609a1e3ad973132bd686cc
---

 libavcodec/hqx.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c
index 1bc123e659..bc24ba91d1 100644
--- a/libavcodec/hqx.c
+++ b/libavcodec/hqx.c
@@ -27,6 +27,7 @@
 #include "canopus.h"
 #include "get_bits.h"
 #include "internal.h"
+#include "thread.h"
 
 #include "hqx.h"
 #include "hqxdsp.h"
@@ -405,6 +406,7 @@ static int hqx_decode_frame(AVCodecContext *avctx, void *data,
                             int *got_picture_ptr, AVPacket *avpkt)
 {
     HQXContext *ctx = avctx->priv_data;
+    ThreadFrame frame = { .f = data };
     uint8_t *src = avpkt->data;
     uint32_t info_tag;
     int data_start;
@@ -491,7 +493,7 @@ static int hqx_decode_frame(AVCodecContext *avctx, void *data,
         return AVERROR_INVALIDDATA;
     }
 
-    ret = ff_get_buffer(avctx, ctx->pic, 0);
+    ret = ff_thread_get_buffer(avctx, &frame, 0);
     if (ret < 0)
         return ret;
 
@@ -510,6 +512,9 @@ static av_cold int hqx_decode_close(AVCodecContext *avctx)
     int i;
     HQXContext *ctx = avctx->priv_data;
 
+    if (avctx->internal->is_copy)
+        return 0;
+
     ff_free_vlc(&ctx->cbp_vlc);
     for (i = 0; i < 3; i++) {
         ff_free_vlc(&ctx->dc_vlc[i]);
@@ -536,7 +541,8 @@ AVCodec ff_hqx_decoder = {
     .init           = hqx_decode_init,
     .decode         = hqx_decode_frame,
     .close          = hqx_decode_close,
-    .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS,
+    .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS |
+                      AV_CODEC_CAP_FRAME_THREADS,
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE |
                       FF_CODEC_CAP_INIT_CLEANUP,
 };



More information about the ffmpeg-cvslog mailing list