[FFmpeg-cvslog] avcodec/jpeg2000dec: Set sample aspect ratio before getting buffer
Andreas Rheinhardt
git at videolan.org
Fri Sep 23 23:27:46 EEST 2022
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Fri Sep 23 17:27:34 2022 +0200| [d5a0dc037df48f53cb4dbe37cfae1724f11c8a58] | committer: Andreas Rheinhardt
avcodec/jpeg2000dec: Set sample aspect ratio before getting buffer
That way the SAR will be automatically set on the AVFrame.
Reviewed-by: Tomas Härdin <tjoppen at acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d5a0dc037df48f53cb4dbe37cfae1724f11c8a58
---
libavcodec/jpeg2000dec.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 7d9661f29f..c3f2a7aa03 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2519,6 +2519,10 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, AVFrame *picture,
if (ret = jpeg2000_read_main_headers(s))
goto end;
+ if (s->sar.num && s->sar.den)
+ avctx->sample_aspect_ratio = s->sar;
+ s->sar.num = s->sar.den = 0;
+
/* get picture buffer */
if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0)
goto end;
@@ -2547,9 +2551,6 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, AVFrame *picture,
if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8)
memcpy(picture->data[1], s->palette, 256 * sizeof(uint32_t));
- if (s->sar.num && s->sar.den)
- avctx->sample_aspect_ratio = s->sar;
- s->sar.num = s->sar.den = 0;
return bytestream2_tell(&s->g);
More information about the ffmpeg-cvslog
mailing list