diff mbox series

[FFmpeg-devel,4/5] avcodec/bitpacked_dec: support for frame thread decode

Message ID 1638365954-29420-4-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/5] avformat/rtsp: make use of avio_get_str() to load the sdp | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Lance Wang Dec. 1, 2021, 1:39 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/bitpacked_dec.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/bitpacked_dec.c b/libavcodec/bitpacked_dec.c
index a2edccc..90e5bcc 100644
--- a/libavcodec/bitpacked_dec.c
+++ b/libavcodec/bitpacked_dec.c
@@ -30,6 +30,7 @@ 
 #include "internal.h"
 #include "get_bits.h"
 #include "libavutil/imgutils.h"
+#include "thread.h"
 
 struct BitpackedContext {
     int (*decode)(AVCodecContext *avctx, AVFrame *frame,
@@ -64,11 +65,12 @@  static int bitpacked_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame,
 {
     uint64_t frame_size = (uint64_t)avctx->width * (uint64_t)avctx->height * 20;
     uint64_t packet_size = (uint64_t)avpkt->size * 8;
+    ThreadFrame tframe = { .f = frame };
     GetBitContext bc;
     uint16_t *y, *u, *v;
     int ret, i, j;
 
-    ret = ff_get_buffer(avctx, frame, 0);
+    ret = ff_thread_get_buffer(avctx, &tframe, 0);
     if (ret < 0)
         return ret;
 
@@ -126,10 +128,10 @@  static int bitpacked_decode(AVCodecContext *avctx, void *data, int *got_frame,
 {
     struct BitpackedContext *bc = avctx->priv_data;
     int buf_size = avpkt->size;
-    AVFrame *frame = data;
     int res;
+    AVFrame *frame = data;
 
-    res = bc->decode(avctx, frame, avpkt);
+    res = bc->decode(avctx, data, avpkt);
     if (res)
         return res;
 
@@ -149,6 +151,7 @@  const AVCodec ff_bitpacked_decoder = {
     .priv_data_size        = sizeof(struct BitpackedContext),
     .init = bitpacked_init_decoder,
     .decode = bitpacked_decode,
+    .capabilities   = AV_CODEC_CAP_FRAME_THREADS,
     .codec_tags     = (const uint32_t []){
         MKTAG('U', 'Y', 'V', 'Y'),
         FF_CODEC_TAGS_END,