From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 1/2] avcodec/jpeg2000dec: Set sample aspect ratio before getting buffer
Date: Fri, 23 Sep 2022 20:48:17 +0200
Message-ID: <GV1P250MB0737D9092011DE7BDF75B4D98F519@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <f8dfec2ae9e827dc62ed64aeeeacf7fdb2234d86.camel@acc.umu.se>
Tomas Härdin:
> fre 2022-09-23 klockan 17:40 +0200 skrev Andreas Rheinhardt:
>> That way the SAR will be automatically set on the AVFrame.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>> If I am not mistaken, then the earlier code would set the sar
>> with a delay of one frame on the returned frames in case
>> there is a sar change mid-stream. But I don't have a sample
>> for this.
>>
>> 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;
>
> I suspect not doing this is what caused my simple hack to not work when
> ff_thread_get_buffer() was skipped. Looks OK, passes FATE.
>
FYI: Patch two passes FATE even without patch one. In what way did your
simple hack not work when ff_thread_get_buffer() is skipped?
- Andreas
_______________________________________________
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 18:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-23 15:40 Andreas Rheinhardt
2022-09-23 15:41 ` [FFmpeg-devel] [PATCH 2/2] avcodec/jpeg2000dec: Implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM Andreas Rheinhardt
2022-09-23 18:24 ` 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 [this message]
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=GV1P250MB0737D9092011DE7BDF75B4D98F519@GV1P250MB0737.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