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 4B43840D94 for ; Thu, 30 Dec 2021 19:11:37 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BDAD768AEE7; Thu, 30 Dec 2021 21:11:19 +0200 (EET) Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B436868AE9C for ; Thu, 30 Dec 2021 21:11:13 +0200 (EET) Received: by mail-qk1-f177.google.com with SMTP id 202so19726229qkg.13 for ; Thu, 30 Dec 2021 11:11:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qzhgsGplTd7VPTQDT4X62UcSwZAo/evDoj2eplVKzOs=; b=oHO4AslygRfiJrRWYYs9WgFidRNbf6sPjnYao6NSb3Ts9aOXRSnBNHyeCHV1GGDTnV EBPhn7Xy2qKlb7IrTLErd7X5FRpORlQhx2O/lEvP9Ny37BC2JpJn1PDTQJAmhd7JyyMm DBh0pxNrrg3sSApcYEN6PYoTbMw2BGg+BCnfCLzA1o9KX1k9IhQ5x0oV4y29nzM0ZS7x Ao/x3gOZXUiqPFcdCkGfC7D2ZiGpz1TUbV6XXnxEBAP+0EkDpK8FP45MHqzv5iZvF4PB QHgQOyi4ZEOt+l7BFIQfSyrI3ql5mwLAeCFOwd2CTLIU9kQ1MGsJrTwUAFm99szS1chW clzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qzhgsGplTd7VPTQDT4X62UcSwZAo/evDoj2eplVKzOs=; b=jlvSDdyrR62B4tID+n4ZyIe4xsPUa8M0DDT1qmAuFSZ5wJu8JAC6/EVsrVnrKOrsLf iy1da3XKuYj7Z4cqT87dkm9fJX5iPHiMHjZBQLRVU+1iWKLWe74G2GxoNIOjE54QlBAB h4F60xlXAcTNbWnTHHEdiXFdNA36xNE03ixB3IERgGZ3QkR663/2vx2GzKBtvIHzox24 vE/gWYwWxTUCWfUSc4ZVHYujVcSr73vQxUoM0aLXmW9/hvVMbR5h94IFmWis1+Ch+yWN +vA5UuBCGB0+HVm/AgBndROnlZWYTTyohLvxsuae9h/uPYmoZ0yutJzoop3oiLWfDSFn eb5A== X-Gm-Message-State: AOAM531Col5Gf+T3QYOPjHoJISCmFLgXtq4HBjzKXgZjDKNh871yKZGx MYSrxyWx9Q3gFJ8jOvi2K9xEwhmNxoDNpg== X-Google-Smtp-Source: ABdhPJyTnaLhAYaRlJQ6er/VwuL0EC8XiMfgEXRsZDC6NlZ3lGEo6ZrgN0pkxgdut/Y2j7vDoJT2Yg== X-Received: by 2002:ae9:e809:: with SMTP id a9mr21197495qkg.771.1640891472372; Thu, 30 Dec 2021 11:11:12 -0800 (PST) Received: from localhost.localdomain (64-233-244-163.static.clv.wideopenwest.com. [64.233.244.163]) by smtp.gmail.com with ESMTPSA id h9sm20608490qkp.106.2021.12.30.11.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Dec 2021 11:11:11 -0800 (PST) From: Leo Izen To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Dec 2021 14:10:46 -0500 Message-Id: <20211230191046.8927-4-leo.izen@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211230191046.8927-1-leo.izen@gmail.com> References: <20211230191046.8927-1-leo.izen@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] 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: 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 | 19 +++++++++++++++++++ libavformat/img2enc.c | 6 +++--- libavformat/mov.c | 1 + libavformat/version.h | 2 +- 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 1054ac9667..0fa1c82ddb 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -506,6 +506,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 a6084ceef0..44336d812d 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -30,6 +30,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" @@ -834,6 +835,23 @@ 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; + /* 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, 5) == 0) + return AVPROBE_SCORE_MAX - 2; + else + return 0; +} + static int pcx_probe(const AVProbeData *p) { const uint8_t *b = p->buf; @@ -1153,6 +1171,7 @@ IMAGEAUTO_DEMUXER(gif, AV_CODEC_ID_GIF) IMAGEAUTO_DEMUXER(j2k, AV_CODEC_ID_JPEG2000) IMAGEAUTO_DEMUXER(jpeg, AV_CODEC_ID_MJPEG) IMAGEAUTO_DEMUXER(jpegls, AV_CODEC_ID_JPEGLS) +IMAGEAUTO_DEMUXER(jpegxl, AV_CODEC_ID_JPEGXL) IMAGEAUTO_DEMUXER(pam, AV_CODEC_ID_PAM) IMAGEAUTO_DEMUXER(pbm, AV_CODEC_ID_PBM) IMAGEAUTO_DEMUXER(pcx, AV_CODEC_ID_PCX) diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c index ded91d6b98..6ac430c6dd 100644 --- a/libavformat/img2enc.c +++ b/libavformat/img2enc.c @@ -261,9 +261,9 @@ static const AVClass img2mux_class = { const AVOutputFormat ff_image2_muxer = { .name = "image2", .long_name = NULL_IF_CONFIG_SMALL("image2 sequence"), - .extensions = "bmp,dpx,exr,jls,jpeg,jpg,ljpg,pam,pbm,pcx,pfm,pgm,pgmyuv,png," - "ppm,sgi,tga,tif,tiff,jp2,j2c,j2k,xwd,sun,ras,rs,im1,im8,im24," - "sunras,xbm,xface,pix,y", + .extensions = "bmp,dpx,exr,jls,jpeg,jpg,jxl,ljpg,pam,pbm,pcx,pfm,pgm,pgmyuv," + "png,ppm,sgi,tga,tif,tiff,jp2,j2c,j2k,xwd,sun,ras,rs,im1,im8," + "im24,sunras,xbm,xface,pix,y", .priv_data_size = sizeof(VideoMuxData), .video_codec = AV_CODEC_ID_MJPEG, .write_header = write_header, diff --git a/libavformat/mov.c b/libavformat/mov.c index 2aed6e80ef..4dcae73c3b 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -7463,6 +7463,7 @@ static int mov_probe(const AVProbeData *p) if (tag == MKTAG('f','t','y','p') && ( AV_RL32(p->buf + offset + 8) == MKTAG('j','p','2',' ') || AV_RL32(p->buf + offset + 8) == MKTAG('j','p','x',' ') + || AV_RL32(p->buf + offset + 8) == MKTAG('j','x','l',' ') )) { score = FFMAX(score, 5); } else { diff --git a/libavformat/version.h b/libavformat/version.h index 379a68cc7c..9b90bbf156 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 59 -#define LIBAVFORMAT_VERSION_MINOR 10 +#define LIBAVFORMAT_VERSION_MINOR 11 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ -- 2.34.1 _______________________________________________ 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".