From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/jpeg2000dec: Implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
Date: Fri, 23 Sep 2022 17:41:41 +0200
Message-ID: <AS8P250MB074436E24B71345F40BF15318F519@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB0744DC3730843D0BD93B8D9A8F519@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>
This could be improved further by not allocating the buffers
that won't be needed lateron in the first place.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/jpeg2000dec.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index c3f2a7aa03..63a706fbf5 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 0;
+    }
+
     /* 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,
 };
-- 
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply	other threads:[~2022-09-23 15:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23 15:40 [FFmpeg-devel] [PATCH 1/2] avcodec/jpeg2000dec: Set sample aspect ratio before getting buffer Andreas Rheinhardt
2022-09-23 15:41 ` Andreas Rheinhardt [this message]
2022-09-23 18:24   ` [FFmpeg-devel] [PATCH 2/2] avcodec/jpeg2000dec: Implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM Tomas Härdin
2022-09-23 18:23 ` [FFmpeg-devel] [PATCH 1/2] avcodec/jpeg2000dec: Set sample aspect ratio before getting buffer Tomas Härdin
2022-09-23 18:48   ` Andreas Rheinhardt
2022-09-23 19:36     ` Tomas Härdin
2022-09-23 19:56       ` Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=AS8P250MB074436E24B71345F40BF15318F519@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git