ffmpeg | branch: master | Andreas Rheinhardt <[email protected]> | 
Fri Sep 23 17:37:41 2022 +0200| [793282adc2afe962a1bd97828468e499f247be3a] | 
committer: Andreas Rheinhardt

avcodec/jpeg2000dec: Implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM

This could be improved further by not allocating the buffers
that won't be needed lateron in the first place.

Reviewed-by: Tomas Härdin <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=793282adc2afe962a1bd97828468e499f247be3a
---

 libavcodec/jpeg2000dec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index c3f2a7aa03..c2b81ec103 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2523,6 +2523,11 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, 
AVFrame *picture,
         avctx->sample_aspect_ratio = s->sar;
     s->sar.num = s->sar.den = 0;
 
+    if (avctx->skip_frame >= AVDISCARD_ALL) {
+        jpeg2000_dec_cleanup(s);
+        return avpkt->size;
+    }
+
     /* get picture buffer */
     if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0)
         goto end;
@@ -2587,4 +2592,5 @@ const FFCodec ff_jpeg2000_decoder = {
     .p.priv_class     = &jpeg2000_class,
     .p.max_lowres     = 5,
     .p.profiles       = NULL_IF_CONFIG_SMALL(ff_jpeg2000_profiles),
+    .caps_internal    = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
 };

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to