Commit ec420ba161 for ffmpeg
commit ec420ba16172960f0009b8bdcc393688797bf8a6
Author: Lynne <dev@lynne.ee>
Date: Thu Oct 8 13:27:47 2026 +0900
avcodec/dpx: skip unpacking the frame on AVDISCARD_ALL
The decoder carries FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, so
avformat_find_stream_info() invokes it with skip_frame = AVDISCARD_ALL
just to fill the stream parameters, yet it unpacked the whole frame
regardless and discarded it, tens of megabytes for a high-resolution
scan. Return as soon as the dimensions, pixel format and color
properties are set, before allocating the buffer, like the other
decoders with the capability.
diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index f1325d2f6f..a4d9348618 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -763,6 +763,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
ff_set_sar(avctx, avctx->sample_aspect_ratio);
+ if (avctx->skip_frame >= AVDISCARD_ALL)
+ return buf_size;
+
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;