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 CB1F240B80 for ; Thu, 24 Mar 2022 18:12:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9E14E68B178; Thu, 24 Mar 2022 20:12:31 +0200 (EET) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 99862689B39 for ; Thu, 24 Mar 2022 20:12:25 +0200 (EET) Received: from localhost (213-47-68-29.cable.dynamic.surfer.at [213.47.68.29]) (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 789061C0003 for ; Thu, 24 Mar 2022 18:12:24 +0000 (UTC) Date: Thu, 24 Mar 2022 19:12:23 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20220324181223.GU2829255@pb2> References: <20220324151959.57992-1-ffmpeg@haasn.xyz> <20220324151959.57992-2-ffmpeg@haasn.xyz> MIME-Version: 1.0 In-Reply-To: <20220324151959.57992-2-ffmpeg@haasn.xyz> Subject: Re: [FFmpeg-devel] [PATCH v6 2/2] avcodec/mjpegenc: support writing ICC profiles 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="===============5186891428492148459==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============5186891428492148459== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="/kgTint8+NHVKlLB" Content-Disposition: inline --/kgTint8+NHVKlLB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 24, 2022 at 04:20:01PM +0100, Niklas Haas wrote: > From: Niklas Haas >=20 > This is mostly straightforward. The major complication is that, as a > result of the 16-bit chunk size limitation, ICC profiles may need to be > split up into multiple chunks. >=20 > We also need to make sure to allocate enough extra space in the packet > to fit the ICC profile, so modify both mpegvideo_enc.c and ljpegenc.c to > take into account this extra overhead, failing cleanly if necessary. >=20 > Also add a FATE transcode test to ensure that the ICC profile gets > written (and read) correctly. Note that this ICC profile is smaller than > 64 kB, so this doesn't test the APP2 chunk re-arranging code at all. >=20 > Signed-off-by: Niklas Haas > --- > Difference to v2: > - Added proper packet overhead size accounting > - Moved ICC-profile-too-large bailout to allocation > - Removed unnecessary `!frame` check > - Use only legal static initializers > - Use SIZE_SPECIFIER instead of %zu > - Check for overflow > - Add ffprobe dependency > - Use byte-aligned pointer writing code instead of putbit > --- > libavcodec/ljpegenc.c | 6 ++-- > libavcodec/mjpegenc.c | 3 +- > libavcodec/mjpegenc_common.c | 66 ++++++++++++++++++++++++++++++++++-- > libavcodec/mjpegenc_common.h | 4 ++- > libavcodec/mpegvideo_enc.c | 4 ++- > tests/fate/image.mak | 6 +++- > tests/ref/fate/jpg-icc | 42 +++++++++++++++++++++++ > 7 files changed, 122 insertions(+), 9 deletions(-) > create mode 100644 tests/ref/fate/jpg-icc [...] > diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c > index 7b82644763..17103051a8 100644 > --- a/libavcodec/mjpegenc_common.c > +++ b/libavcodec/mjpegenc_common.c > @@ -131,8 +131,39 @@ static void jpeg_table_header(AVCodecContext *avctx,= PutBitContext *p, > AV_WB16(ptr, size); > } > =20 > -static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p) > +static const uint8_t icc_hdr_size =3D 16; /* ICC_PROFILE\0 tag + 4 bytes= */ > +static const uint16_t icc_chunk_size =3D UINT16_MAX - icc_hdr_size; libavcodec/mjpegenc_common.c:135:40: error: initializer element is not cons= tant static const uint16_t icc_chunk_size =3D UINT16_MAX - icc_hdr_size; ^ CC libavcodec/mp3_header_decompress_bsf.o [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship naturally arises out of democracy, and the most aggravated form of tyranny and slavery out of the most extreme liberty. -- Plato --/kgTint8+NHVKlLB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYjy0gwAKCRBhHseHBAsP qxKrAKCFZ1JbmAHBJoLax31hJ3lnFmeIiACdFjUVl+OQhq9dLu4zBcgb/Jjj4Oc= =gcKW -----END PGP SIGNATURE----- --/kgTint8+NHVKlLB-- --===============5186891428492148459== 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". --===============5186891428492148459==--