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 v2 1/3] avcodec/jpegxl_parser: add JPEG XL parser
Date: Thu, 22 Jun 2023 11:19:57 -0300
Message-ID: <77d7cc53-4047-fc9a-d0c0-6ad165b68fb1@gmail.com> (raw)
In-Reply-To: <20230622004313.69697-2-leo.izen@gmail.com>

On 6/21/2023 9:43 PM, Leo Izen wrote:
> +static int jpegxl_parse(AVCodecParserContext *s, AVCodecContext *avctx,
> +                        const uint8_t **poutbuf, int *poutbuf_size,
> +                        const uint8_t *buf, int buf_size)
> +{
> +    JXLParseContext *ctx = s->priv_data;
> +    int ret;
> +
> +    *poutbuf_size = 0;
> +    *poutbuf = NULL;
> +
> +    if (!ctx->parsed_header) {
> +        if (AV_RL64(buf) == FF_JPEGXL_CONTAINER_SIGNATURE_LE) {
> +            int copied;
> +            uint8_t codestream_header[4096];
> +            ret = ff_jpegxl_collect_codestream_header(buf, buf_size, codestream_header,
> +                                                      sizeof(codestream_header), &copied);
> +            if (ret < 0)
> +                return ret;
> +            /* copied may be larger than the bufsize if stuff was skipped */
> +            copied = FFMIN(copied, sizeof(codestream_header));
> +            ret = ff_jpegxl_parse_codestream_header(codestream_header, copied, 0, &ctx->meta);
> +            if (ret < 0)
> +                return ret;
> +        } else {
> +            ret = ff_jpegxl_parse_codestream_header(buf, buf_size, 1, &ctx->meta);
> +            if (ret < 0)
> +                return ret;
> +        }
> +        avctx->width = ctx->meta.width;
> +        avctx->height = ctx->meta.height;

Set s->width and s->height instead. The generic code will set the avctx 
fields if required.
_______________________________________________
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".

  parent reply	other threads:[~2023-06-22 14:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22  0:43 [FFmpeg-devel] [PATCH v2 0/3] JXL Parser and FATE tests Leo Izen
2023-06-22  0:43 ` [FFmpeg-devel] [PATCH v2 1/3] avcodec/jpegxl_parser: add JPEG XL parser Leo Izen
2023-06-22  0:59   ` James Almer
2023-06-22  1:06     ` Leo Izen
2023-06-22  1:21       ` James Almer
2023-06-22 14:19   ` James Almer [this message]
2023-06-22  0:43 ` [FFmpeg-devel] [PATCH v2 2/3] avformat/jpegxl: remove jpegxl_probe, instead call avcodec/jpegxl_parse Leo Izen
2023-06-22  0:43 ` [FFmpeg-devel] [PATCH v2 3/3] fate/jpegxl_anim: add demuxer fate test for jpegxl_anim 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=77d7cc53-4047-fc9a-d0c0-6ad165b68fb1@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