From: Leo Izen <leo.izen@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:18:15 -0400
Message-ID: <9e43c287-97b8-7f5c-d141-8fe44afda64f@gmail.com> (raw)
In-Reply-To: <1d674214-f2cc-7722-7867-0219eb404353@gmail.com>
On 6/27/23 18:58, James Almer wrote:
> 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?
It's not actually ISOBMFF, it just uses the same style of box layout.
This is also how j2k works.
>
>> + 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.
> _______________________________________________
If I don't fill this, the CLI will not show the pixel format without the
external decoder library enabled. Should I consider this an ffmpeg.c bug?
- Leo Izen
_______________________________________________
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".
next prev parent reply other threads:[~2023-06-27 23:18 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
2023-06-27 23:18 ` Leo Izen [this message]
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=9e43c287-97b8-7f5c-d141-8fe44afda64f@gmail.com \
--to=leo.izen@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