[FFmpeg-cvslog] avcodec/hdrdec: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
Paul B Mahol
git at videolan.org
Sat Sep 24 13:27:47 EEST 2022
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Sep 24 11:40:07 2022 +0200| [eb9045455d7f4d5696320c92ae378c8221d26f79] | committer: Paul B Mahol
avcodec/hdrdec: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eb9045455d7f4d5696320c92ae378c8221d26f79
---
libavcodec/hdrdec.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/libavcodec/hdrdec.c b/libavcodec/hdrdec.c
index 7727826e2a..21d3e7f693 100644
--- a/libavcodec/hdrdec.c
+++ b/libavcodec/hdrdec.c
@@ -88,14 +88,13 @@ static int decompress(uint8_t *scanline, int w, GetByteContext *gb, const uint8_
static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p,
int *got_frame, AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
- int ret, buf_size = avpkt->size;
int width = 0, height = 0;
GetByteContext gb;
uint8_t line[512];
float sar;
+ int ret;
- bytestream2_init(&gb, buf, buf_size);
+ bytestream2_init(&gb, avpkt->data, avpkt->size);
hdr_get_line(&gb, line, sizeof(line));
if (memcmp("#?RADIANCE\n", line, 11))
return AVERROR_INVALIDDATA;
@@ -129,6 +128,10 @@ static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p,
return ret;
avctx->pix_fmt = AV_PIX_FMT_GBRPF32;
+
+ if (avctx->skip_frame >= AVDISCARD_ALL)
+ return avpkt->size;
+
if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0)
return ret;
@@ -206,7 +209,7 @@ convert:
*got_frame = 1;
- return buf_size;
+ return avpkt->size;
}
const FFCodec ff_hdr_decoder = {
@@ -215,5 +218,6 @@ const FFCodec ff_hdr_decoder = {
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_RADIANCE_HDR,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
+ .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
FF_CODEC_DECODE_CB(hdr_decode_frame),
};
More information about the ffmpeg-cvslog
mailing list