[FFmpeg-devel] [PATCH] webp: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
Alex Xu (Hello71)
alex_y_xu at yahoo.ca
Thu Nov 25 21:45:26 EET 2021
Roughly doubles webp performance for common applications (ffmpeg,
ffprobe, mpv) due to speeding up avformat_find_stream_info.
Lossy needs no patches since vp8.c already implements skip_frame.
Lossless needs hook to understand skip_frame. Also the "image data not
found" message is fixed, which was already broken with manual
-skip_frame but would now be exposed in default operation.
---
libavcodec/webp.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index d5a81fd527..f24aa979ac 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1126,6 +1126,9 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p,
h = s->height;
}
+ if (avctx->skip_frame == AVDISCARD_ALL)
+ return data_size;
+
/* parse transformations */
s->nb_transforms = 0;
s->reduced_width = s->width;
@@ -1524,7 +1527,7 @@ exif_end:
}
}
- if (!*got_frame) {
+ if (!*got_frame && avctx->skip_frame < 0) {
av_log(avctx, AV_LOG_ERROR, "image data not found\n");
return AVERROR_INVALIDDATA;
}
@@ -1565,5 +1568,5 @@ const AVCodec ff_webp_decoder = {
.decode = webp_decode_frame,
.close = webp_decode_close,
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
- .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
};
--
2.34.0
More information about the ffmpeg-devel
mailing list