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@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
0d8f43c74d
commit
d5a0dc037d
@ -2519,6 +2519,10 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
|||||||
if (ret = jpeg2000_read_main_headers(s))
|
if (ret = jpeg2000_read_main_headers(s))
|
||||||
goto end;
|
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 */
|
/* get picture buffer */
|
||||||
if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0)
|
if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0)
|
||||||
goto end;
|
goto end;
|
||||||
@ -2547,9 +2551,6 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
|||||||
|
|
||||||
if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8)
|
if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8)
|
||||||
memcpy(picture->data[1], s->palette, 256 * sizeof(uint32_t));
|
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);
|
return bytestream2_tell(&s->g);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user