Skip to content

Commit

Permalink
avcodec/jpeg2000dec: Implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mkver committed Sep 23, 2022
1 parent d5a0dc0 commit 793282a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libavcodec/jpeg2000dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
};

0 comments on commit 793282a

Please sign in to comment.