From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id ED9AF4033D for ; Wed, 23 Mar 2022 11:38:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B51F968B1D4; Wed, 23 Mar 2022 13:38:20 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1FDD368A466 for ; Wed, 23 Mar 2022 13:38:14 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id B021B240179; Wed, 23 Mar 2022 12:38:13 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id ejU1niBUxayX; Wed, 23 Mar 2022 12:38:13 +0100 (CET) Received: from lain.red.khirnov.net (lain.red.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.red.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 245852400F5; Wed, 23 Mar 2022 12:38:13 +0100 (CET) Received: by lain.red.khirnov.net (Postfix, from userid 1000) id 4B2F31601AD; Wed, 23 Mar 2022 12:38:13 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20220319172645.82718-4-leo.izen@gmail.com> References: <20220319172645.82718-1-leo.izen@gmail.com> <20220319172645.82718-4-leo.izen@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches , Leo Izen Date: Wed, 23 Mar 2022 12:38:13 +0100 Message-ID: <164803549327.19727.8745159787254664205@lain.red.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v7 4/5] avformat/image2: add Jpeg XL as image2 format X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Leo Izen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Quoting Leo Izen (2022-03-19 18:26:44) > This commit adds support to libavformat for muxing > and demuxing Jpeg XL images as image2 streams. > --- > libavformat/allformats.c | 1 + > libavformat/img2.c | 1 + > libavformat/img2dec.c | 21 +++++++++++++++++++++ > libavformat/img2enc.c | 6 +++--- > libavformat/mov.c | 1 + > libavformat/version.h | 4 ++-- > 6 files changed, 29 insertions(+), 5 deletions(-) > > diff --git a/libavformat/allformats.c b/libavformat/allformats.c > index 587ad59b3c..941f3643f8 100644 > --- a/libavformat/allformats.c > +++ b/libavformat/allformats.c > @@ -510,6 +510,7 @@ extern const AVInputFormat ff_image_gif_pipe_demuxer; > extern const AVInputFormat ff_image_j2k_pipe_demuxer; > extern const AVInputFormat ff_image_jpeg_pipe_demuxer; > extern const AVInputFormat ff_image_jpegls_pipe_demuxer; > +extern const AVInputFormat ff_image_jpegxl_pipe_demuxer; > extern const AVInputFormat ff_image_pam_pipe_demuxer; > extern const AVInputFormat ff_image_pbm_pipe_demuxer; > extern const AVInputFormat ff_image_pcx_pipe_demuxer; > diff --git a/libavformat/img2.c b/libavformat/img2.c > index 4153102c92..13b1b997b8 100644 > --- a/libavformat/img2.c > +++ b/libavformat/img2.c > @@ -87,6 +87,7 @@ const IdStrMap ff_img_tags[] = { > { AV_CODEC_ID_GEM, "img" }, > { AV_CODEC_ID_GEM, "ximg" }, > { AV_CODEC_ID_GEM, "timg" }, > + { AV_CODEC_ID_JPEGXL, "jxl" }, > { AV_CODEC_ID_NONE, NULL } > }; > > diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c > index b9c06c5b54..32cadacb9d 100644 > --- a/libavformat/img2dec.c > +++ b/libavformat/img2dec.c > @@ -32,6 +32,7 @@ > #include "libavutil/parseutils.h" > #include "libavutil/intreadwrite.h" > #include "libavcodec/gif.h" > +#include "libavcodec/jpegxl.h" > #include "avformat.h" > #include "avio_internal.h" > #include "internal.h" > @@ -836,6 +837,25 @@ static int jpegls_probe(const AVProbeData *p) > return 0; > } > > +static int jpegxl_probe(const AVProbeData *p) > +{ > + const uint8_t *b = p->buf; > + > + /* ISOBMFF-based container */ > + /* 0x4a584c20 == "JXL " */ > + if (AV_RL64(b) == FF_JPEGXL_CONTAINER_SIGNATURE_LE) > + return AVPROBE_SCORE_EXTENSION + 1; > +#if CONFIG_JPEGXL_PARSER > + /* Raw codestreams all start with 0xff0a */ > + if (AV_RL16(b) != FF_JPEGXL_CODESTREAM_SIGNATURE_LE) > + return 0; > + if (avpriv_jpegxl_verify_codestream_header(NULL, p->buf, p->buf_size) == 0) This function is way too complicated for a probe function. Can you think of something simpler? -- 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".