Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v4 2/4] avcodec/jpegxl_parser: add JPEG XL parser
Date: Tue, 27 Jun 2023 19:58:56 -0300
Message-ID: <1d674214-f2cc-7722-7867-0219eb404353@gmail.com> (raw)
In-Reply-To: <20230626154922.66550-3-leo.izen@gmail.com>

On 6/26/2023 12:49 PM, Leo Izen wrote:
> +/*
> + * copies as much of the codestream into the buffer as possible
> + * pass a shorter buflen to request less
> + * returns the number of bytes consumed from input, may be greater than input_len
> + * if the input doesn't end on an ISOBMFF-box boundary
> + */
> +int ff_jpegxl_collect_codestream_header(const uint8_t *input_buffer, int input_len,
> +                                        uint8_t *buffer, int buflen, int *copied)
> +{
> +    GetByteContext gb;
> +    int pos = 0;
> +    bytestream2_init(&gb, input_buffer, input_len);
> +
> +    while (1) {
> +        uint64_t size;
> +        uint32_t tag;
> +        int head_size = 8;
> +
> +        if (bytestream2_get_bytes_left(&gb) < 16)
> +            break;
> +
> +        size = bytestream2_get_be32(&gb);
> +        if (size == 1) {
> +            size = bytestream2_get_be64(&gb);
> +            head_size = 16;
> +        }
> +        /* invalid ISOBMFF size */
> +        if (size && size <= head_size)
> +            return AVERROR_INVALIDDATA;

ISOBMFF? Are you propagating container bytes as if they were part of the 
bitstream from image2? Why is it not being handled by the mov/mp4 
demuxer instead?

> +    if (ctx->meta.csp == JPEGXL_CS_GRAY) {
> +        if (ctx->meta.bit_depth <= 8)
> +            avctx->pix_fmt = s->format = ctx->meta.have_alpha ? AV_PIX_FMT_YA8 : AV_PIX_FMT_GRAY8;
> +        else if (ctx->meta.bit_depth <= 16)
> +            avctx->pix_fmt = s->format = ctx->meta.have_alpha ? AV_PIX_FMT_YA16 : AV_PIX_FMT_GRAY16;
> +        else
> +            avctx->pix_fmt = s->format = ctx->meta.have_alpha ? AV_PIX_FMT_NONE : AV_PIX_FMT_GRAYF32;
> +    } else {
> +        if (ctx->meta.bit_depth <= 8)
> +            avctx->pix_fmt = s->format = ctx->meta.have_alpha ? AV_PIX_FMT_RGBA : AV_PIX_FMT_RGB24;
> +        else if (ctx->meta.bit_depth <= 16)
> +            avctx->pix_fmt = s->format = ctx->meta.have_alpha ? AV_PIX_FMT_RGBA64 : AV_PIX_FMT_RGB48;
> +        else
> +            avctx->pix_fmt = s->format = ctx->meta.have_alpha ? AV_PIX_FMT_RGBAF32 : AV_PIX_FMT_RGBF32;

Again, don't fill avctx->pix_fmt, fill s->format.
_______________________________________________
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:[~2023-06-27 22:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 15:49 [FFmpeg-devel] [PATCH v4 0/4] JPEG XL Parser Leo Izen
2023-06-26 15:49 ` [FFmpeg-devel] [PATCH v4 1/4] avcodec/libjxldec: use internal AVFrame as buffered space Leo Izen
2023-06-27 20:08   ` Andreas Rheinhardt
2023-06-26 15:49 ` [FFmpeg-devel] [PATCH v4 2/4] avcodec/jpegxl_parser: add JPEG XL parser Leo Izen
2023-06-27 22:58   ` James Almer [this message]
2023-06-27 23:18     ` Leo Izen
2023-06-27 23:20       ` James Almer
2023-06-26 15:49 ` [FFmpeg-devel] [PATCH v4 3/4] avformat/jpegxl: remove jpegxl_probe, instead call avcodec/jpegxl_parse Leo Izen
2023-06-26 15:49 ` [FFmpeg-devel] [PATCH v4 4/4] fate/jpegxl_anim: add demuxer fate test for jpegxl_anim Leo Izen
2023-06-27 23:25   ` James Almer
2023-06-27 23:32     ` Leo Izen
2023-06-27 23:46       ` James Almer
2023-06-28  0:33         ` 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=1d674214-f2cc-7722-7867-0219eb404353@gmail.com \
    --to=jamrial@gmail.com \
    --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