From: Leo Izen <leo.izen@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH v14 2/4] avcodec/libjxl: add Jpeg XL decoding via libjxl Date: Fri, 15 Apr 2022 15:31:36 -0400 Message-ID: <7faa7db9-e40b-60c2-2ea8-35c7860b7790@gmail.com> (raw) In-Reply-To: <AS8PR01MB7944826A94F96850DFD4B18D8FEE9@AS8PR01MB7944.eurprd01.prod.exchangelabs.com> On 4/15/22 07:08, Andreas Rheinhardt wrote: > Leo Izen: > >> + return avpkt->size - remaining; > If this decoder is supposed to produce multiple frames from one packet > of input, it needs to use the receive_frame-callback. For video > decoders, it is only checked whether the return value is >= 0 or not > (see lines 451-456 in decode.c). It isn't, because I've chosen not to support animated JXL at this time. As far as I'm aware an animated JXL file will just decode to its first frame with this decoder. >> + 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); > You are only resetting the decoder on success. What happens if any of > the errors happened? Would the decoder need to be reset before decoding > the next picture? This was already brought up by Anton. The JXL_DEC_SUCCESS event isn't fired until the start of the next packet (if there is one). It is the "finished decoding" event which we never actually get to for single images because JXL_DEC_FULL_IMAGE is always fired first. If this is fired it means we're in an image2 sequence and this is the next frame, at which point the data will have been swapped out. Resetting the decoder is necessary here to make the library re-read the header info and not whine. I agree that it's a bit confusing and I should probably add a block comment explaining this. >> + buf = avpkt->data; >> + remaining = avpkt->size; >> + continue; > Didn't you already feed this data to the decoder? This somehow looks > like a recipe for an infinite loop. No, see up. - Leo Izen (thebombzen) _______________________________________________ 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:[~2022-04-15 19:31 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-12 5:53 [FFmpeg-devel] [PATCH v14 0/4] Jpeg XL Patch Set Leo Izen 2022-04-12 5:53 ` [FFmpeg-devel] [PATCH v14 1/4] avcodec/jpegxl: add Jpeg XL image codec Leo Izen 2022-04-12 5:53 ` [FFmpeg-devel] [PATCH v14 2/4] avcodec/libjxl: add Jpeg XL decoding via libjxl Leo Izen 2022-04-15 11:08 ` Andreas Rheinhardt 2022-04-15 19:31 ` Leo Izen [this message] 2022-04-12 5:53 ` [FFmpeg-devel] [PATCH v14 3/4] avcodec/libjxl: add Jpeg XL encoding " Leo Izen 2022-04-14 17:49 ` Anton Khirnov 2022-04-15 1:37 ` Leo Izen 2022-04-15 10:39 ` Anton Khirnov 2022-04-15 19:32 ` Leo Izen 2022-04-12 5:53 ` [FFmpeg-devel] [PATCH v14 4/4] avformat/image2: add Jpeg XL as image2 format Leo Izen 2022-04-15 11:34 ` Andreas Rheinhardt 2022-04-15 19:38 ` Leo Izen 2022-04-15 19:41 ` Andreas Rheinhardt
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=7faa7db9-e40b-60c2-2ea8-35c7860b7790@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