Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Leo Izen <leo.izen@gmail.com>
Subject: Re: [FFmpeg-devel] [PATCH v12 2/4] avcodec/libjxl: add Jpeg XL decoding via libjxl
Date: Tue, 05 Apr 2022 12:50:04 +0200
Message-ID: <164915580478.21047.15063529421341494996@lain.red.khirnov.net> (raw)
In-Reply-To: <20220402201210.86308-3-leo.izen@gmail.com>

Quoting Leo Izen (2022-04-02 22:12:08)
> +        case JXL_DEC_COLOR_ENCODING:
> +            av_log(avctx, AV_LOG_DEBUG, "COLOR_ENCODING event emitted\n");
> +            jret = JxlDecoderGetICCProfileSize(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_ORIGINAL, &ctx->iccp_len);

Does iccp_len need to be a context variable? Seems to me it's only used
in this block.

> +            if (jret == JXL_DEC_SUCCESS && ctx->iccp_len > 0) {
> +                av_buffer_unref(&ctx->iccp);
> +                av_assert2(!ctx->iccp);

Useless assert, you can rely on basic functions to do what they should.

> +                ctx->iccp = av_buffer_alloc(ctx->iccp_len);
> +                if (!ctx->iccp)
> +                    return AVERROR(ENOMEM);
> +                jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_ORIGINAL, ctx->iccp->data, ctx->iccp_len);
> +                if (jret != JXL_DEC_SUCCESS)
> +                    av_freep(&ctx->iccp);

av_buffer_unref?
> +            }
> +            continue;
> +        case JXL_DEC_FRAME:
> +        case JXL_DEC_NEED_IMAGE_OUT_BUFFER:
> +            /*
> +             * We don't do this at basic info time
> +             * because it will happen again when we
> +             * rewind anyway
> +             */
> +            av_log(avctx, AV_LOG_DEBUG, "%s event emitted\n", jret == JXL_DEC_FRAME ? "FRAME" : "NEED_IMAGE_OUT_BUFFER");
> +            ret = ff_get_buffer(avctx, frame, 0);

Is it absolutely guaranteed that this will always happen before
JXL_DEC_FULL_IMAGE in the same libjxl_decode_frame() invocation?

Can it happen that you get JXL_DEC_NEED_IMAGE_OUT_BUFFER/JXL_DEC_FRAME,
then JXL_DEC_NEED_MORE_INPUT, which causes you to return, then
JXL_DEC_FULL_IMAGE on the next libjxl_decode_frame() call?

> +        case JXL_DEC_SUCCESS:
> +            av_log(avctx, AV_LOG_DEBUG, "SUCCESS event emitted\n");
> +            /*
> +             * The file has finished decoding
> +             * reset the decoder to let us
> +             * reuse it again for the next image
> +             */
> +            JxlDecoderReset(ctx->decoder);
> +            libjxl_init_jxl_decoder(avctx);
> +            buf = avpkt->data;
> +            remaining = avpkt->size;

Why reset buf? The same data is not going to be decoded again, is it?

-- 
Anton Khirnov
_______________________________________________
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-04-05 10:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-02 20:12 [FFmpeg-devel] [PATCH v12 0/4] Jpeg XL Patch Set Leo Izen
2022-04-02 20:12 ` [FFmpeg-devel] [PATCH v12 1/4] avcodec/jpegxl: add Jpeg XL image codec Leo Izen
2022-04-02 20:12 ` [FFmpeg-devel] [PATCH v12 2/4] avcodec/libjxl: add Jpeg XL decoding via libjxl Leo Izen
2022-04-05 10:50   ` Anton Khirnov [this message]
2022-04-05 14:06     ` Leo Izen
2022-04-02 20:12 ` [FFmpeg-devel] [PATCH v12 3/4] avcodec/libjxl: add Jpeg XL encoding " Leo Izen
2022-04-02 20:12 ` [FFmpeg-devel] [PATCH v12 4/4] avformat/image2: add Jpeg XL as image2 format Leo Izen

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=164915580478.21047.15063529421341494996@lain.red.khirnov.net \
    --to=anton@khirnov.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=leo.izen@gmail.com \
    /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