Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v6 2/2] avcodec/mjpegenc: support writing ICC profiles
Date: Thu, 24 Mar 2022 19:12:23 +0100
Message-ID: <20220324181223.GU2829255@pb2> (raw)
In-Reply-To: <20220324151959.57992-2-ffmpeg@haasn.xyz>


[-- Attachment #1.1: Type: text/plain, Size: 2634 bytes --]

On Thu, Mar 24, 2022 at 04:20:01PM +0100, Niklas Haas wrote:
> From: Niklas Haas <git@haasn.dev>
> 
> 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.
> 
> 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.
> 
> 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.
> 
> Signed-off-by: Niklas Haas <git@haasn.dev>
> ---
> 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);
>  }
>  
> -static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p)
> +static const uint8_t icc_hdr_size = 16; /* ICC_PROFILE\0 tag + 4 bytes */

> +static const uint16_t icc_chunk_size = UINT16_MAX - icc_hdr_size;

libavcodec/mjpegenc_common.c:135:40: error: initializer element is not constant
 static const uint16_t icc_chunk_size = UINT16_MAX - icc_hdr_size;
                                        ^
CC	libavcodec/mp3_header_decompress_bsf.o


[...]
-- 
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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: 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".

      reply	other threads:[~2022-03-24 18:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 15:19 [FFmpeg-devel] [PATCH v6 1/2] avcodec/pngenc: support writing iCCP chunks Niklas Haas
2022-03-24 15:20 ` [FFmpeg-devel] [PATCH v6 2/2] avcodec/mjpegenc: support writing ICC profiles Niklas Haas
2022-03-24 18:12   ` Michael Niedermayer [this message]

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=20220324181223.GU2829255@pb2 \
    --to=michael@niedermayer.cc \
    --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