summaryrefslogtreecommitdiff
path: root/libavcodec/dxtory.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2020-09-05 10:31:03 +0200
committerPaul B Mahol <onemda@gmail.com>2020-09-05 10:32:30 +0200
commit1d1411822a3d888e5e2bfcc73c69e7e6eb9a63b3 (patch)
tree80890e946e56a20e8c17e02f7ae15f157ba9d0b1 /libavcodec/dxtory.c
parenta198b508e327a9a9705fb3eb5e366d7ed098ac67 (diff)
downloadffmpeg-1d1411822a3d888e5e2bfcc73c69e7e6eb9a63b3.tar.gz
avcodec/dxtory: add frame threads support
Diffstat (limited to 'libavcodec/dxtory.c')
-rw-r--r--libavcodec/dxtory.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libavcodec/dxtory.c b/libavcodec/dxtory.c
index e239abe233..3f3c23ff2a 100644
--- a/libavcodec/dxtory.c
+++ b/libavcodec/dxtory.c
@@ -31,6 +31,7 @@
#include "get_bits.h"
#include "internal.h"
#include "unary.h"
+#include "thread.h"
static int64_t get_raw_size(enum AVPixelFormat fmt, int width, int height)
{
@@ -92,6 +93,7 @@ static int dxtory_decode_v1_rgb(AVCodecContext *avctx, AVFrame *pic,
const uint8_t *src, int src_size,
int id, int bpp, uint32_t vflipped)
{
+ ThreadFrame frame = { .f = pic };
int h;
uint8_t *dst;
int ret;
@@ -102,7 +104,7 @@ static int dxtory_decode_v1_rgb(AVCodecContext *avctx, AVFrame *pic,
}
avctx->pix_fmt = id;
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
do_vflip(avctx, pic, vflipped);
@@ -123,6 +125,7 @@ static int dxtory_decode_v1_410(AVCodecContext *avctx, AVFrame *pic,
const uint8_t *src, int src_size,
uint32_t vflipped)
{
+ ThreadFrame frame = { .f = pic };
int h, w;
uint8_t *Y1, *Y2, *Y3, *Y4, *U, *V;
int height, width, hmargin, vmargin;
@@ -135,7 +138,7 @@ static int dxtory_decode_v1_410(AVCodecContext *avctx, AVFrame *pic,
}
avctx->pix_fmt = AV_PIX_FMT_YUV410P;
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
do_vflip(avctx, pic, vflipped);
@@ -218,6 +221,7 @@ static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic,
const uint8_t *src, int src_size,
uint32_t vflipped)
{
+ ThreadFrame frame = { .f = pic };
int h, w;
uint8_t *Y1, *Y2, *U, *V;
int height, width, hmargin, vmargin;
@@ -230,7 +234,7 @@ static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic,
}
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
do_vflip(avctx, pic, vflipped);
@@ -290,6 +294,7 @@ static int dxtory_decode_v1_444(AVCodecContext *avctx, AVFrame *pic,
const uint8_t *src, int src_size,
uint32_t vflipped)
{
+ ThreadFrame frame = { .f = pic };
int h, w;
uint8_t *Y, *U, *V;
int ret;
@@ -300,7 +305,7 @@ static int dxtory_decode_v1_444(AVCodecContext *avctx, AVFrame *pic,
}
avctx->pix_fmt = AV_PIX_FMT_YUV444P;
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
do_vflip(avctx, pic, vflipped);
@@ -425,6 +430,7 @@ static int dxtory_decode_v2(AVCodecContext *avctx, AVFrame *pic,
enum AVPixelFormat fmt,
uint32_t vflipped)
{
+ ThreadFrame frame = { .f = pic };
GetByteContext gb, gb_check;
GetBitContext gb2;
int nslices, slice, line = 0;
@@ -451,7 +457,7 @@ static int dxtory_decode_v2(AVCodecContext *avctx, AVFrame *pic,
return AVERROR_INVALIDDATA;
avctx->pix_fmt = fmt;
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
do_vflip(avctx, pic, vflipped);
@@ -876,5 +882,5 @@ AVCodec ff_dxtory_decoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_DXTORY,
.decode = decode_frame,
- .capabilities = AV_CODEC_CAP_DR1,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
};