mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-09-19 21:06:42 +00:00
avcodec/bitpacked_dec: support for frame thread decode
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
parent
17b434f1ce
commit
d39f667da1
@ -30,6 +30,7 @@
|
|||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
#include "libavutil/imgutils.h"
|
#include "libavutil/imgutils.h"
|
||||||
|
#include "thread.h"
|
||||||
|
|
||||||
struct BitpackedContext {
|
struct BitpackedContext {
|
||||||
int (*decode)(AVCodecContext *avctx, AVFrame *frame,
|
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 frame_size = (uint64_t)avctx->width * (uint64_t)avctx->height * 20;
|
||||||
uint64_t packet_size = (uint64_t)avpkt->size * 8;
|
uint64_t packet_size = (uint64_t)avpkt->size * 8;
|
||||||
|
ThreadFrame tframe = { .f = frame };
|
||||||
GetBitContext bc;
|
GetBitContext bc;
|
||||||
uint16_t *y, *u, *v;
|
uint16_t *y, *u, *v;
|
||||||
int ret, i, j;
|
int ret, i, j;
|
||||||
|
|
||||||
ret = ff_get_buffer(avctx, frame, 0);
|
ret = ff_thread_get_buffer(avctx, &tframe, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -149,6 +151,7 @@ const AVCodec ff_bitpacked_decoder = {
|
|||||||
.priv_data_size = sizeof(struct BitpackedContext),
|
.priv_data_size = sizeof(struct BitpackedContext),
|
||||||
.init = bitpacked_init_decoder,
|
.init = bitpacked_init_decoder,
|
||||||
.decode = bitpacked_decode,
|
.decode = bitpacked_decode,
|
||||||
|
.capabilities = AV_CODEC_CAP_FRAME_THREADS,
|
||||||
.codec_tags = (const uint32_t []){
|
.codec_tags = (const uint32_t []){
|
||||||
MKTAG('U', 'Y', 'V', 'Y'),
|
MKTAG('U', 'Y', 'V', 'Y'),
|
||||||
FF_CODEC_TAGS_END,
|
FF_CODEC_TAGS_END,
|
||||||
|
Loading…
Reference in New Issue
Block a user