* [FFmpeg-devel] [PATCH] [MXF] - Set aspect ratio for jpeg2000 images
@ 2024-01-26 18:02 Cédric Le Barz
2024-01-26 18:12 ` Pierre-Anthony Lemieux
0 siblings, 1 reply; 4+ messages in thread
From: Cédric Le Barz @ 2024-01-26 18:02 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1: Type: text/plain, Size: 38 bytes --]
Set aspect ratio for jpeg2000 images.
[-- Attachment #2: 0001-Set-aspect-ratio-for-jpeg2000-images-and-remove-an-unu.eml --]
[-- Type: message/rfc822, Size: 1287 bytes --]
From: Cedric Le Barz <clebarz@ektacom.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [PATCH] Set aspect ratio for jpeg2000 images and remove an unused variable.
Date: Fri, 26 Jan 2024 14:29:38 +0100
Signed-off-by: Cedric Le Barz <clebarz@ektacom.com>
---
ffmpeg/libavformat/mxfenc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ffmpeg/libavformat/mxfenc.c b/ffmpeg/libavformat/mxfenc.c
index 0f13068..7ea19ca 100644
--- a/ffmpeg/libavformat/mxfenc.c
+++ b/ffmpeg/libavformat/mxfenc.c
@@ -2639,7 +2639,6 @@ static int mxf_parse_jpeg2000_frame(AVFormatContext *s, AVStream *st, AVPacket *
{
MXFContext *mxf = s->priv_data;
MXFStreamContext *sc = st->priv_data;
- AVIOContext *pb = s->pb;
int component_count = av_pix_fmt_count_planes(st->codecpar->format);
GetByteContext g;
uint32_t j2k_ncomponents;
@@ -2679,6 +2678,10 @@ static int mxf_parse_jpeg2000_frame(AVFormatContext *s, AVStream *st, AVPacket *
}
bytestream2_get_bufferu(&g, sc->j2k_info.j2k_comp_desc, 3 * j2k_ncomponents);
+ /* Set aspect ratio */
+ av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den,
+ sc->j2k_info.j2k_xsiz, sc->j2k_info.j2k_ysiz, INT32_MAX);
+
sc->frame_size = pkt->size;
return 1;
--
2.34.1
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] [MXF] - Set aspect ratio for jpeg2000 images
2024-01-26 18:02 [FFmpeg-devel] [PATCH] [MXF] - Set aspect ratio for jpeg2000 images Cédric Le Barz
@ 2024-01-26 18:12 ` Pierre-Anthony Lemieux
2024-01-30 9:47 ` Tomas Härdin
0 siblings, 1 reply; 4+ messages in thread
From: Pierre-Anthony Lemieux @ 2024-01-26 18:12 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Fri, Jan 26, 2024 at 10:02 AM Cédric Le Barz <clebarz@ektacom.com> wrote:
>
> Set aspect ratio for jpeg2000 images.
"The image area on the reference grid is defined by its upper left
hand reference grid point at location (XOsiz, YOsiz), and its lower
right hand reference grid point at location (Xsiz – 1, Ysiz – 1)"
(15444-1, 8.2)
AFAIK setting the MXF aspect ratio item to the ratio of the image
pixel dimensions only works if (a) the pixel aspect ratio is 1 and (b)
the video is not interlaced -- see 6.2.1.2 and Annex H at
https://pub.smpte.org/doc/st2067-21/20221124-pub/.
> _______________________________________________
> 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".
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] [MXF] - Set aspect ratio for jpeg2000 images
2024-01-26 18:12 ` Pierre-Anthony Lemieux
@ 2024-01-30 9:47 ` Tomas Härdin
2024-01-30 10:36 ` Tomas Härdin
0 siblings, 1 reply; 4+ messages in thread
From: Tomas Härdin @ 2024-01-30 9:47 UTC (permalink / raw)
To: FFmpeg development discussions and patches
fre 2024-01-26 klockan 10:12 -0800 skrev Pierre-Anthony Lemieux:
> On Fri, Jan 26, 2024 at 10:02 AM Cédric Le Barz <clebarz@ektacom.com>
> wrote:
> >
> > Set aspect ratio for jpeg2000 images.
>
> "The image area on the reference grid is defined by its upper left
> hand reference grid point at location (XOsiz, YOsiz), and its lower
> right hand reference grid point at location (Xsiz – 1, Ysiz – 1)"
> (15444-1, 8.2)
>
> AFAIK setting the MXF aspect ratio item to the ratio of the image
> pixel dimensions only works if (a) the pixel aspect ratio is 1 and
> (b)
> the video is not interlaced -- see 6.2.1.2 and Annex H at
> https://pub.smpte.org/doc/st2067-21/20221124-pub/.
You also need to know the display rectangle. If for example VBI lines
are present then these might also need be cropped, in addition to the
cropping done at the J2K level. Sometimes container and essence
disagree on what SAR is, which affects the DAR. Which value is the
correct one typically depends on business logic
A demuxer is the wrong place to put logic like this
/Tomas
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] [MXF] - Set aspect ratio for jpeg2000 images
2024-01-30 9:47 ` Tomas Härdin
@ 2024-01-30 10:36 ` Tomas Härdin
0 siblings, 0 replies; 4+ messages in thread
From: Tomas Härdin @ 2024-01-30 10:36 UTC (permalink / raw)
To: FFmpeg development discussions and patches
tis 2024-01-30 klockan 10:47 +0100 skrev Tomas Härdin:
> fre 2024-01-26 klockan 10:12 -0800 skrev Pierre-Anthony Lemieux:
> > On Fri, Jan 26, 2024 at 10:02 AM Cédric Le Barz
> > <clebarz@ektacom.com>
> > wrote:
> > >
> > > Set aspect ratio for jpeg2000 images.
> >
> > "The image area on the reference grid is defined by its upper left
> > hand reference grid point at location (XOsiz, YOsiz), and its lower
> > right hand reference grid point at location (Xsiz – 1, Ysiz – 1)"
> > (15444-1, 8.2)
> >
> > AFAIK setting the MXF aspect ratio item to the ratio of the image
> > pixel dimensions only works if (a) the pixel aspect ratio is 1 and
> > (b)
> > the video is not interlaced -- see 6.2.1.2 and Annex H at
> > https://pub.smpte.org/doc/st2067-21/20221124-pub/.
>
> You also need to know the display rectangle. If for example VBI lines
> are present then these might also need be cropped, in addition to the
> cropping done at the J2K level. Sometimes container and essence
> disagree on what SAR is, which affects the DAR. Which value is the
> correct one typically depends on business logic
>
> A demuxer is the wrong place to put logic like this
Wups, missed that this is a muxer patch, not a demuxer one.
Anyway, this patch is very wrong. DAR is a container level thing. We
shouldn't take it from the essence unless there is overwhelming reason
to do so. My point about VBI still stands, in modified form: if VBI
lines are present then this patch would write a bogus DAR
Much of the logic currently in mxfenc.c should probably live somewhere
higher up since MOV also supports some of these things
/Tomas
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-30 10:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-26 18:02 [FFmpeg-devel] [PATCH] [MXF] - Set aspect ratio for jpeg2000 images Cédric Le Barz
2024-01-26 18:12 ` Pierre-Anthony Lemieux
2024-01-30 9:47 ` Tomas Härdin
2024-01-30 10:36 ` Tomas Härdin
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