From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id A46E942FD1 for ; Sat, 14 Jan 2023 20:05:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 25A6A68B96D; Sat, 14 Jan 2023 22:05:01 +0200 (EET) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 365B768B0A7 for ; Sat, 14 Jan 2023 22:04:54 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 51E69240002 for ; Sat, 14 Jan 2023 20:04:52 +0000 (UTC) Date: Sat, 14 Jan 2023 21:04:52 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230114200452.GQ1949656@pb2> References: <0af7e930-9ec7-dc81-95bc-939eb21e2da0@mediaarea.net> MIME-Version: 1.0 In-Reply-To: <0af7e930-9ec7-dc81-95bc-939eb21e2da0@mediaarea.net> Subject: Re: [FFmpeg-devel] avformat/mxfenc: fix stored/sampled/displayed width/height X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: multipart/mixed; boundary="===============1575135489178191959==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1575135489178191959== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lG9v85r552aFjg4G" Content-Disposition: inline --lG9v85r552aFjg4G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 14, 2023 at 04:48:10PM +0100, Jerome Martinez wrote: > Before the patch: > - stored values were rounded to upper 16 multiple also for formats not us= ing > macroblocks (should be st->codecpar->width and st->codecpar->height when = not > MPEG formats; note that I found no other muxer doing the rounding for AVC, > only for MPEG-2 Video, but I find no reason in specs for doing the > difference so I kept the rounding for AVC) > - sampled and displayed widths were stored width (should be > st->codecpar->width like it is already done for height, with the DV50/100 > exception) >=20 > Could be tested with e.g. > - fixed stored width (1912 instead of 1920) and height (1080 instead of > 1088) not multiple of 16 : > ffmpeg -f lavfi -i testsrc=3Dduration=3D1:size=3D1912x1080 -c:v jpeg2000 > test_prores.mxf > - fixed sampled/displayed width (1912 instead of 1920): > ffmpeg -f lavfi -i testsrc=3Dduration=3D1:size=3D1912x1080 -c:v mpeg2video > test_mpeg2video.mxf > mxfenc.c | 28 ++++++++++++++++++++++------ > 1 file changed, 22 insertions(+), 6 deletions(-) > ff6497b7983ccb5ec7555b55ad0040a2c065d6d3 0001-avformat-mxfenc-fix-stored= -sampled-displayed-width-h.patch > From cda353059886182aab2e258023c4d027c448344b Mon Sep 17 00:00:00 2001 > From: Jerome Martinez > Date: Sat, 14 Jan 2023 13:32:36 +0100 > Subject: [PATCH] avformat/mxfenc: fix stored/sampled/displayed width/heig= ht >=20 > Stored values are rounded to upper 16 multiple only for MPEG related form= ats > Sampled and displayed widths are codecpar ones (with DV exception) > --- > libavformat/mxfenc.c | 28 ++++++++++++++++++++++------ > 1 file changed, 22 insertions(+), 6 deletions(-) >=20 > diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c > index 58c551c83c..0b7e83ba4d 100644 > --- a/libavformat/mxfenc.c > +++ b/libavformat/mxfenc.c > @@ -1109,8 +1109,9 @@ static int64_t mxf_write_cdci_common(AVFormatContex= t *s, AVStream *st, const UID > { > MXFStreamContext *sc =3D st->priv_data; > AVIOContext *pb =3D s->pb; > - int stored_width =3D 0; > - int stored_height =3D (st->codecpar->height+15)/16*16; > + int stored_width =3D st->codecpar->width; > + int stored_height =3D st->codecpar->height; > + int display_width; > int display_height; > int f1, f2; > const MXFCodecUL *color_primaries_ul; > @@ -1129,12 +1130,25 @@ static int64_t mxf_write_cdci_common(AVFormatCont= ext *s, AVStream *st, const UID > else if (st->codecpar->height =3D=3D 720) > stored_width =3D 1280; > } > - if (!stored_width) > - stored_width =3D (st->codecpar->width+15)/16*16; > + display_width =3D stored_width; > =20 > + switch (st->codecpar->codec_id) { > + case AV_CODEC_ID_MPEG2VIDEO: > + case AV_CODEC_ID_DVVIDEO: > + case AV_CODEC_ID_H264: > + //Based on 16x16 macroblocks > + stored_width =3D (stored_width+15)/16*16; > + stored_height =3D (stored_height+15)/16*16; If this is supposed to match the actual macroblocks, then this would have to consider field pictures and interlacing as it differs from progressive thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin --lG9v85r552aFjg4G Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCY8MK2wAKCRBhHseHBAsP q9UVAJ461MK3Yzj5cxXLmjq5R5L20VEahACcDx/LD9SYsvK6b35qKTuz8mZQyEI= =7qF/ -----END PGP SIGNATURE----- --lG9v85r552aFjg4G-- --===============1575135489178191959== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============1575135489178191959==--