From 9dcd97772d0228e292f7ee1b92c02bf39bde3ae5 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jan 2022 13:56:38 +0000 Subject: [PATCH 01/43] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering From c1ccd8cc9f8ee76fb8fea4a2c370a359515cca96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Sun, 19 Jun 2022 16:07:07 +0200 Subject: [PATCH 02/43] Update to prerelease 0.7.0 --- .gitignore | 2 ++ jpegxl.spec | 39 ++++++++++++++++++++++++--------------- sources | 4 ++-- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 031836e..eedaabf 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ /third_party-0.5.tar.gz /jpegxl-0.6.1.tar.gz /third_party-0.6.1.tar.gz +/jpegxl-c426256.tar.gz +/third_party-c426256.tar.gz diff --git a/jpegxl.spec b/jpegxl.spec index dab0cd3..e194d8f 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -1,7 +1,11 @@ # Uncomment for special build to rebuild aom on bumped soname. -#global new_soname 1 +%global new_soname 1 %global sover_old 0.6 -%global sover 0.6 +%global sover 0.7 + +%global commit c4262565e8de611f593bf2c6f4a24aeb55d38afb +%global snapshotdate 20220619 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) %global gdk_pixbuf_moduledir $(pkgconf gdk-pixbuf-2.0 --variable=gdk_pixbuf_moduledir) @@ -15,7 +19,7 @@ This package contains a reference implementation of JPEG XL (encoder and decoder).} Name: jpegxl -Version: 0.6.1 +Version: 0.7.0~pre1 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation @@ -26,18 +30,18 @@ Summary: JPEG XL image format reference implementation License: BSD and ASL 2.0 and zlib URL: https://jpeg.org/jpegxl/ VCS: https://github.com/libjxl/libjxl -Source0: %vcs/archive/v%{version}/%{name}-%{version}.tar.gz +Source0: %vcs/archive/%{commit}/%{name}-%{shortcommit}.tar.gz # git clone https://github.com/libjxl/libjxl # cd libjxl/ -# git checkout v%%{version} +# git checkout %%{shortcommit} # git submodule init ; git submodule update -# rm -r third_party/brotli/ third_party/difftest_ng/ third_party/googletest/ +# rm -r third_party/brotli/ third_party/googletest/ # rm -r third_party/HEVCSoftware/ third_party/highway/ -# rm -r third_party/IQA-optimization/ third_party/lcms/ -# rm -r third_party/skcms/profiles/ third_party/vmaf/ third_party/testdata/ -# tar -zcvf ../third_party-%%{version}.tar.gz third_party/ -Source1: third_party-%{version}.tar.gz +# rm -r third_party/lcms/ third_party/libpng/ third_party/gflags/ +# rm -r third_party/skcms/profiles/ third_party/zlib +# tar -zcvf ../third_party-%%{shortcommit}.tar.gz third_party/ +Source1: third_party-%{shortcommit}.tar.gz BuildRequires: asciidoc BuildRequires: cmake @@ -54,6 +58,7 @@ BuildRequires: pkgconfig(gimp-2.0) %endif BuildRequires: (pkgconfig(glut) or pkgconfig(freeglut)) BuildRequires: gtest-devel +BuildRequires: pkgconfig(gflags) BuildRequires: pkgconfig(libhwy) BuildRequires: pkgconfig(libbrotlicommon) BuildRequires: pkgconfig(libjpeg) @@ -67,8 +72,6 @@ BuildRequires: pkgconfig(zlib) BuildRequires: libjxl < %{version} %endif -# Header-only library to be directly included in the project's source tree -Provides: bundled(lodepng) = 0-0.1.20210522git48e5364 # No official release Provides: bundled(sjpeg) = 0-0.1.20210522git868ab55 # Build system is Bazel, which is not packaged by Fedora @@ -137,9 +140,9 @@ This is a GIMP plugin for loading and saving JPEG-XL images. %endif %prep -%autosetup -p1 -n libjxl-%{version} +%autosetup -p1 -n libjxl-%{commit} rm -rf third_party/ -%setup -q -T -D -a 1 -n libjxl-%{version} +%setup -q -T -D -a 1 -n libjxl-%{commit} %build %cmake -DENABLE_CCACHE=1 \ @@ -151,7 +154,9 @@ rm -rf third_party/ -DJPEGXL_FORCE_SYSTEM_GTEST:BOOL=ON \ -DJPEGXL_FORCE_SYSTEM_HWY:BOOL=ON \ -DJPEGXL_WARNINGS_AS_ERRORS:BOOL=OFF \ - -DBUILD_SHARED_LIBS:BOOL=OFF + -DBUILD_SHARED_LIBS:BOOL=ON \ + -DBUNDLE_LIBPNG_DEFAULT:BOOL=OFF \ + -DBUNDLE_GFLAGS_DEFAULT:BOOL=OFF %cmake_build -- all doc %install @@ -168,6 +173,10 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %doc CONTRIBUTING.md CONTRIBUTORS README.md %{_bindir}/cjxl %{_bindir}/djxl +%{_bindir}/cjpeg_hdr +%{_bindir}/cjxl_ng +%{_bindir}/djxl_ng +%{_bindir}/jxlinfo %{_mandir}/man1/cjxl.1* %{_mandir}/man1/djxl.1* diff --git a/sources b/sources index 75007c0..5cf4c07 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (jpegxl-0.6.1.tar.gz) = 302935d722160b0b288ac63301f9e95caf82eccf6ad76c4f4da6316a0314ee3562115932b1ceacb0d02708de0a07788992d3478cae73af0b90193f5769f9fb52 -SHA512 (third_party-0.6.1.tar.gz) = 7e416daf97e1cc54da00ec9b58636151308371d223fe29fcc22f6e9087852fd6fe9784a4e2f3e191a85a6f907a2732520ee7c8fd387292e19b5cc0b8a9d9392b +SHA512 (jpegxl-c426256.tar.gz) = 3b80116ec4f9d672fe63791408caa4518b16072644875e61774549b4cb7417579fba8c2671cf5a3e4102137f2083f8cdee7c6da306aca231c2cab21ee63f416b +SHA512 (third_party-c426256.tar.gz) = 6f114ce4882ac1162f567e4d61bbe34c4cf14c23665a154211b42fe4259c29c7c0717dd3c8d50ab1285ecdd40c97b21bf4667536404d93a96e36c139c48de42c From b3c23e4da95b3b93b721a3478e391370686c1618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Sat, 9 Jul 2022 19:24:43 +0200 Subject: [PATCH 03/43] Unbootstrap --- jpegxl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jpegxl.spec b/jpegxl.spec index e194d8f..d69bc45 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -1,5 +1,5 @@ # Uncomment for special build to rebuild aom on bumped soname. -%global new_soname 1 +%global new_soname 0 %global sover_old 0.6 %global sover 0.7 From 8e888947efef5ffc4bba29a65042f6138b6a4309 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 21 Jul 2022 15:23:01 +0000 Subject: [PATCH 04/43] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering From 1ee24d18db20c6f27746df74034994bf17f192a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Sun, 18 Sep 2022 15:47:43 +0200 Subject: [PATCH 05/43] Update to 0.7.0rc --- .gitignore | 2 ++ jpegxl.spec | 25 ++++++++++++------------- sources | 4 ++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index eedaabf..132c573 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ /third_party-0.6.1.tar.gz /jpegxl-c426256.tar.gz /third_party-c426256.tar.gz +/jpegxl-0.7rc.tar.gz +/third_party-0.7rc.tar.gz diff --git a/jpegxl.spec b/jpegxl.spec index d69bc45..ee3af1e 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -1,11 +1,11 @@ # Uncomment for special build to rebuild aom on bumped soname. -%global new_soname 0 +# %%global new_soname 0 %global sover_old 0.6 %global sover 0.7 -%global commit c4262565e8de611f593bf2c6f4a24aeb55d38afb -%global snapshotdate 20220619 -%global shortcommit %(c=%{commit}; echo ${c:0:7}) +# %%global commit 980c90f65f41066cc4959b4eb80eba906867103b +# %%global snapshotdate 20220918 +# %%global shortcommit %%(c=%%{commit}; echo ${c:0:7}) %global gdk_pixbuf_moduledir $(pkgconf gdk-pixbuf-2.0 --variable=gdk_pixbuf_moduledir) @@ -19,7 +19,8 @@ This package contains a reference implementation of JPEG XL (encoder and decoder).} Name: jpegxl -Version: 0.7.0~pre1 +Version: 0.7.0rc +%global tag 0.7rc Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation @@ -30,7 +31,7 @@ Summary: JPEG XL image format reference implementation License: BSD and ASL 2.0 and zlib URL: https://jpeg.org/jpegxl/ VCS: https://github.com/libjxl/libjxl -Source0: %vcs/archive/%{commit}/%{name}-%{shortcommit}.tar.gz +Source0: %vcs/archive/v%{tag}/%{name}-%{tag}.tar.gz # git clone https://github.com/libjxl/libjxl # cd libjxl/ @@ -38,10 +39,10 @@ Source0: %vcs/archive/%{commit}/%{name}-%{shortcommit}.tar.gz # git submodule init ; git submodule update # rm -r third_party/brotli/ third_party/googletest/ # rm -r third_party/HEVCSoftware/ third_party/highway/ -# rm -r third_party/lcms/ third_party/libpng/ third_party/gflags/ +# rm -r third_party/lcms/ third_party/libpng/ # rm -r third_party/skcms/profiles/ third_party/zlib -# tar -zcvf ../third_party-%%{shortcommit}.tar.gz third_party/ -Source1: third_party-%{shortcommit}.tar.gz +# tar -zcvf ../third_party-%%{tag}.tar.gz third_party/ +Source1: third_party-0.7rc.tar.gz BuildRequires: asciidoc BuildRequires: cmake @@ -140,9 +141,9 @@ This is a GIMP plugin for loading and saving JPEG-XL images. %endif %prep -%autosetup -p1 -n libjxl-%{commit} +%autosetup -p1 -n libjxl-%{tag} rm -rf third_party/ -%setup -q -T -D -a 1 -n libjxl-%{commit} +%setup -q -T -D -a 1 -n libjxl-%{tag} %build %cmake -DENABLE_CCACHE=1 \ @@ -174,8 +175,6 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %{_bindir}/cjxl %{_bindir}/djxl %{_bindir}/cjpeg_hdr -%{_bindir}/cjxl_ng -%{_bindir}/djxl_ng %{_bindir}/jxlinfo %{_mandir}/man1/cjxl.1* %{_mandir}/man1/djxl.1* diff --git a/sources b/sources index 5cf4c07..db62922 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (jpegxl-c426256.tar.gz) = 3b80116ec4f9d672fe63791408caa4518b16072644875e61774549b4cb7417579fba8c2671cf5a3e4102137f2083f8cdee7c6da306aca231c2cab21ee63f416b -SHA512 (third_party-c426256.tar.gz) = 6f114ce4882ac1162f567e4d61bbe34c4cf14c23665a154211b42fe4259c29c7c0717dd3c8d50ab1285ecdd40c97b21bf4667536404d93a96e36c139c48de42c +SHA512 (jpegxl-0.7rc.tar.gz) = fa7967d2add2314edc257ffb069bbde516451535669ff2bdaa8ad309de71080ab257acf1089f96ec1ad3adb3a5abc2d5fe2086127f0891016fc27090b8de910d +SHA512 (third_party-0.7rc.tar.gz) = 078ad2c8fde6f66f4b182994e32b8232dd2b1d87ccaf2f4402266baf7ee9a954a83744c9990c4a99e8136bda688a1efdd6dd870b09ef6f0678341471e22ed829 From 87c1389a3c1d6a16a41a9781079a8766c28c33be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Sat, 24 Sep 2022 11:35:08 +0200 Subject: [PATCH 06/43] Update to 0.7.0 Close: rhbz#2128835 --- .gitignore | 2 ++ jpegxl.spec | 15 +++++++-------- sources | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 132c573..3737109 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ /third_party-c426256.tar.gz /jpegxl-0.7rc.tar.gz /third_party-0.7rc.tar.gz +/jpegxl-0.7.0.tar.gz +/third_party-0.7.0.tar.gz diff --git a/jpegxl.spec b/jpegxl.spec index ee3af1e..6f0d415 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -19,8 +19,7 @@ This package contains a reference implementation of JPEG XL (encoder and decoder).} Name: jpegxl -Version: 0.7.0rc -%global tag 0.7rc +Version: 0.7.0 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation @@ -31,18 +30,18 @@ Summary: JPEG XL image format reference implementation License: BSD and ASL 2.0 and zlib URL: https://jpeg.org/jpegxl/ VCS: https://github.com/libjxl/libjxl -Source0: %vcs/archive/v%{tag}/%{name}-%{tag}.tar.gz +Source0: %vcs/archive/v%{version}/%{name}-%{version}.tar.gz # git clone https://github.com/libjxl/libjxl # cd libjxl/ -# git checkout %%{shortcommit} +# git checkout v%%{version} # git submodule init ; git submodule update # rm -r third_party/brotli/ third_party/googletest/ # rm -r third_party/HEVCSoftware/ third_party/highway/ # rm -r third_party/lcms/ third_party/libpng/ # rm -r third_party/skcms/profiles/ third_party/zlib -# tar -zcvf ../third_party-%%{tag}.tar.gz third_party/ -Source1: third_party-0.7rc.tar.gz +# tar -zcvf ../third_party-%%{version}.tar.gz third_party/ +Source1: third_party-%{version}.tar.gz BuildRequires: asciidoc BuildRequires: cmake @@ -141,9 +140,9 @@ This is a GIMP plugin for loading and saving JPEG-XL images. %endif %prep -%autosetup -p1 -n libjxl-%{tag} +%autosetup -p1 -n libjxl-%{version} rm -rf third_party/ -%setup -q -T -D -a 1 -n libjxl-%{tag} +%setup -q -T -D -a 1 -n libjxl-%{version} %build %cmake -DENABLE_CCACHE=1 \ diff --git a/sources b/sources index db62922..83d42db 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (jpegxl-0.7rc.tar.gz) = fa7967d2add2314edc257ffb069bbde516451535669ff2bdaa8ad309de71080ab257acf1089f96ec1ad3adb3a5abc2d5fe2086127f0891016fc27090b8de910d -SHA512 (third_party-0.7rc.tar.gz) = 078ad2c8fde6f66f4b182994e32b8232dd2b1d87ccaf2f4402266baf7ee9a954a83744c9990c4a99e8136bda688a1efdd6dd870b09ef6f0678341471e22ed829 +SHA512 (jpegxl-0.7.0.tar.gz) = c73039606acf7b2cbc331c6787af5167d711fd1af22bc616e1f478c531b087da82c98f2cb7e88c4d1f8bcfdc4e053ae0dc99cc9a811545b7f9658041489ed04b +SHA512 (third_party-0.7.0.tar.gz) = 9aeace0c7252e75fcd17bb8f00c28bfda893aa3e59c4b3dbdb43b95bd3ca7eea3f2e465fe09469c2528ca4efa4e6f8f0884c6c028442f091105b17afded620e6 From 2227db0c676e7550f2644f032516c849a7660fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Sun, 25 Sep 2022 09:55:16 +0200 Subject: [PATCH 07/43] Fix update path (bump Epoch). Close: rhbz#2129592 Add development tools package --- ...363120bbcfdbb2e2e4fa85146ac6d385137d.patch | 579 ++++++++++++++++++ ...90998bb151ba54a865cdbd61df22af29774c.patch | 234 +++++++ jpegxl.spec | 37 +- 3 files changed, 849 insertions(+), 1 deletion(-) create mode 100644 795b363120bbcfdbb2e2e4fa85146ac6d385137d.patch create mode 100644 873890998bb151ba54a865cdbd61df22af29774c.patch diff --git a/795b363120bbcfdbb2e2e4fa85146ac6d385137d.patch b/795b363120bbcfdbb2e2e4fa85146ac6d385137d.patch new file mode 100644 index 0000000..24261e3 --- /dev/null +++ b/795b363120bbcfdbb2e2e4fa85146ac6d385137d.patch @@ -0,0 +1,579 @@ +From 795b363120bbcfdbb2e2e4fa85146ac6d385137d Mon Sep 17 00:00:00 2001 +From: Jon Sneyers +Date: Mon, 29 Aug 2022 08:37:24 +0200 +Subject: [PATCH] SSIMULACRA 2 (#1646) + +--- + tools/CMakeLists.txt | 2 + + tools/ssimulacra2.cc | 424 ++++++++++++++++++++++++++++++++++++++ + tools/ssimulacra2.h | 32 +++ + tools/ssimulacra2_main.cc | 70 +++++++ + 4 files changed, 528 insertions(+) + create mode 100644 tools/ssimulacra2.cc + create mode 100644 tools/ssimulacra2.h + create mode 100644 tools/ssimulacra2_main.cc + +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt +index 739d4bcede..0d6a28f55a 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -171,6 +171,7 @@ if(JPEGXL_ENABLE_DEVTOOLS) + texture_to_cube + generate_lut_template + ssimulacra_main ++ ssimulacra2 + xyb_range + jxl_from_tree + ) +@@ -178,6 +179,7 @@ if(JPEGXL_ENABLE_DEVTOOLS) + add_executable(fuzzer_corpus fuzzer_corpus.cc) + + add_executable(ssimulacra_main ssimulacra_main.cc ssimulacra.cc) ++ add_executable(ssimulacra2 ssimulacra2_main.cc ssimulacra2.cc) + add_executable(butteraugli_main butteraugli_main.cc) + add_executable(decode_and_encode decode_and_encode.cc) + add_executable(display_to_hlg hdr/display_to_hlg.cc) +diff --git a/tools/ssimulacra2.cc b/tools/ssimulacra2.cc +new file mode 100644 +index 0000000000..8bc31b87e7 +--- /dev/null ++++ b/tools/ssimulacra2.cc +@@ -0,0 +1,424 @@ ++// Copyright (c) the JPEG XL Project Authors. All rights reserved. ++// ++// Use of this source code is governed by a BSD-style ++// license that can be found in the LICENSE file. ++ ++/* ++SSIMULACRA 2 - Structural SIMilarity Unveiling Local And Compression Related ++Artifacts ++ ++Perceptual metric developed by Jon Sneyers (Cloudinary) in July 2022. ++Design: ++- XYB color space (X+0.5, Y, Y-B+1.0) ++- SSIM map ++- 'blockiness/ringing' map (distorted has edges where original is smooth) ++- 'smoothing' map (distorted is smooth where original has edges) ++- error maps are computed at 6 scales (1:1 to 1:32) for each component (X,Y,B) ++- for all 6*3*3=54 maps, two norms are computed: 1-norm (mean) and 4-norm ++- a weighted sum of these 54*2=108 norms leads to the final score ++- weights were tuned based on a large set of subjective scores for images ++ compressed with JPEG, JPEG 2000, JPEG XL, WebP, AVIF, and HEIC. ++*/ ++ ++#include "tools/ssimulacra2.h" ++ ++#include ++ ++#include ++ ++#include "lib/jxl/enc_color_management.h" ++#include "lib/jxl/enc_xyb.h" ++#include "lib/jxl/gauss_blur.h" ++#include "lib/jxl/image_ops.h" ++ ++namespace { ++ ++using jxl::Image3F; ++using jxl::ImageF; ++ ++static const float kC1 = 0.0001f; ++static const float kC2 = 0.0003f; ++static const int kNumScales = 6; ++ ++Image3F Downsample(const Image3F& in, size_t fx, size_t fy) { ++ const size_t out_xsize = (in.xsize() + fx - 1) / fx; ++ const size_t out_ysize = (in.ysize() + fy - 1) / fy; ++ Image3F out(out_xsize, out_ysize); ++ const float normalize = 1.0f / (fx * fy); ++ for (size_t c = 0; c < 3; ++c) { ++ for (size_t oy = 0; oy < out_ysize; ++oy) { ++ float* JXL_RESTRICT row_out = out.PlaneRow(c, oy); ++ for (size_t ox = 0; ox < out_xsize; ++ox) { ++ float sum = 0.0f; ++ for (size_t iy = 0; iy < fy; ++iy) { ++ for (size_t ix = 0; ix < fx; ++ix) { ++ const size_t x = std::min(ox * fx + ix, in.xsize() - 1); ++ const size_t y = std::min(oy * fy + iy, in.ysize() - 1); ++ sum += in.PlaneRow(c, y)[x]; ++ } ++ } ++ row_out[ox] = sum * normalize; ++ } ++ } ++ } ++ return out; ++} ++ ++void Multiply(const Image3F& a, const Image3F& b, Image3F* mul) { ++ for (size_t c = 0; c < 3; ++c) { ++ for (size_t y = 0; y < a.ysize(); ++y) { ++ const float* JXL_RESTRICT in1 = a.PlaneRow(c, y); ++ const float* JXL_RESTRICT in2 = b.PlaneRow(c, y); ++ float* JXL_RESTRICT out = mul->PlaneRow(c, y); ++ for (size_t x = 0; x < a.xsize(); ++x) { ++ out[x] = in1[x] * in2[x]; ++ } ++ } ++ } ++} ++ ++// Temporary storage for Gaussian blur, reused for multiple images. ++class Blur { ++ public: ++ Blur(const size_t xsize, const size_t ysize) ++ : rg_(jxl::CreateRecursiveGaussian(1.5)), temp_(xsize, ysize) {} ++ ++ void operator()(const ImageF& in, ImageF* JXL_RESTRICT out) { ++ jxl::ThreadPool* null_pool = nullptr; ++ FastGaussian(rg_, in, null_pool, &temp_, out); ++ } ++ ++ Image3F operator()(const Image3F& in) { ++ Image3F out(in.xsize(), in.ysize()); ++ operator()(in.Plane(0), &out.Plane(0)); ++ operator()(in.Plane(1), &out.Plane(1)); ++ operator()(in.Plane(2), &out.Plane(2)); ++ return out; ++ } ++ ++ // Allows reusing across scales. ++ void ShrinkTo(const size_t xsize, const size_t ysize) { ++ temp_.ShrinkTo(xsize, ysize); ++ } ++ ++ private: ++ hwy::AlignedUniquePtr rg_; ++ ImageF temp_; ++}; ++ ++double tothe4th(double x) { ++ x *= x; ++ x *= x; ++ return x; ++} ++void SSIMMap(const Image3F& m1, const Image3F& m2, const Image3F& s11, ++ const Image3F& s22, const Image3F& s12, double* plane_averages) { ++ const double onePerPixels = 1.0 / (m1.ysize() * m1.xsize()); ++ for (size_t c = 0; c < 3; ++c) { ++ double sum1[2] = {0.0}; ++ for (size_t y = 0; y < m1.ysize(); ++y) { ++ const float* JXL_RESTRICT row_m1 = m1.PlaneRow(c, y); ++ const float* JXL_RESTRICT row_m2 = m2.PlaneRow(c, y); ++ const float* JXL_RESTRICT row_s11 = s11.PlaneRow(c, y); ++ const float* JXL_RESTRICT row_s22 = s22.PlaneRow(c, y); ++ const float* JXL_RESTRICT row_s12 = s12.PlaneRow(c, y); ++ for (size_t x = 0; x < m1.xsize(); ++x) { ++ float mu1 = row_m1[x]; ++ float mu2 = row_m2[x]; ++ float mu11 = mu1 * mu1; ++ float mu22 = mu2 * mu2; ++ float mu12 = mu1 * mu2; ++ float num_m = 2 * mu12 + kC1; ++ float num_s = 2 * (row_s12[x] - mu12) + kC2; ++ float denom_m = mu11 + mu22 + kC1; ++ float denom_s = (row_s11[x] - mu11) + (row_s22[x] - mu22) + kC2; ++ double d = 1.0 - ((num_m * num_s) / (denom_m * denom_s)); ++ d = std::max(d, 0.0); ++ sum1[0] += d; ++ sum1[1] += tothe4th(d); ++ } ++ } ++ plane_averages[c * 2] = onePerPixels * sum1[0]; ++ plane_averages[c * 2 + 1] = sqrt(sqrt(onePerPixels * sum1[1])); ++ } ++} ++ ++void EdgeDiffMap(const Image3F& img1, const Image3F& mu1, const Image3F& img2, ++ const Image3F& mu2, double* plane_averages) { ++ const double onePerPixels = 1.0 / (img1.ysize() * img1.xsize()); ++ for (size_t c = 0; c < 3; ++c) { ++ double sum1[4] = {0.0}; ++ for (size_t y = 0; y < img1.ysize(); ++y) { ++ const float* JXL_RESTRICT row1 = img1.PlaneRow(c, y); ++ const float* JXL_RESTRICT row2 = img2.PlaneRow(c, y); ++ const float* JXL_RESTRICT rowm1 = mu1.PlaneRow(c, y); ++ const float* JXL_RESTRICT rowm2 = mu2.PlaneRow(c, y); ++ for (size_t x = 0; x < img1.xsize(); ++x) { ++ double d1 = (1.0 + std::abs(row2[x] - rowm2[x])) / ++ (1.0 + std::abs(row1[x] - rowm1[x])) - ++ 1.0; ++ // d1 > 0: distorted has an edge where original is smooth ++ // (indicating ringing, color banding, blockiness, etc) ++ // d1 < 0: original has an edge where distorted is smooth ++ // (indicating smoothing, blurring, smearing, etc) ++ double artifact = std::max(d1, 0.0); ++ sum1[0] += artifact; ++ sum1[1] += tothe4th(artifact); ++ double detail_lost = std::max(-d1, 0.0); ++ sum1[2] += detail_lost; ++ sum1[3] += tothe4th(detail_lost); ++ } ++ } ++ plane_averages[c * 4] = onePerPixels * sum1[0]; ++ plane_averages[c * 4 + 1] = sqrt(sqrt(onePerPixels * sum1[1])); ++ plane_averages[c * 4 + 2] = onePerPixels * sum1[2]; ++ plane_averages[c * 4 + 3] = sqrt(sqrt(onePerPixels * sum1[3])); ++ } ++} ++ ++// Add 0.5 to X and turn B into 1 + B-Y ++// (SSIM expects non-negative ranges) ++void MakePositiveXYB(jxl::Image3F& img) { ++ for (size_t y = 0; y < img.ysize(); ++y) { ++ const float* JXL_RESTRICT rowY = img.PlaneRow(1, y); ++ float* JXL_RESTRICT rowB = img.PlaneRow(2, y); ++ float* JXL_RESTRICT rowX = img.PlaneRow(0, y); ++ for (size_t x = 0; x < img.xsize(); ++x) { ++ rowB[x] += 1.0f - rowY[x]; ++ rowX[x] += 0.5f; ++ } ++ } ++} ++ ++void AlphaBlend(jxl::ImageBundle& img, float bg) { ++ for (size_t y = 0; y < img.ysize(); ++y) { ++ float* JXL_RESTRICT r = img.color()->PlaneRow(0, y); ++ float* JXL_RESTRICT g = img.color()->PlaneRow(1, y); ++ float* JXL_RESTRICT b = img.color()->PlaneRow(2, y); ++ const float* JXL_RESTRICT a = img.alpha()->Row(y); ++ for (size_t x = 0; x < img.xsize(); ++x) { ++ r[x] = a[x] * r[x] + (1.f - a[x]) * bg; ++ g[x] = a[x] * g[x] + (1.f - a[x]) * bg; ++ b[x] = a[x] * b[x] + (1.f - a[x]) * bg; ++ } ++ } ++} ++ ++} // namespace ++ ++/* ++The final score is based on a weighted sum of 108 sub-scores: ++- for 6 scales (1:1 to 1:32) ++- for 3 components (X + 0.5, Y, B - Y + 1.0) ++- using 2 norms (the 1-norm and the 4-norm) ++- over 3 error maps: ++ - SSIM ++ - "ringing" (distorted edges where there are no orig edges) ++ - "blurring" (orig edges where there are no distorted edges) ++ ++The weights were obtained by running Nelder-Mead simplex search, ++optimizing to minimize MSE and maximize Kendall and Pearson correlation ++for training data consisting of 17611 subjective quality scores, ++validated on separate validation data consisting of 4292 scores. ++*/ ++double Msssim::Score() const { ++ double ssim = 0.0; ++ ++ constexpr double weight[108] = {-0.4887721343447775, ++ 0.023424809409418046, ++ -2.030114616889109, ++ 0.09295054976135864, ++ -0.6104037165108389, ++ -1.5043796645843681, ++ 0.7157171902116809, ++ 0.021100488642748494, ++ 0.020230927541050825, ++ 0.2133671136286971, ++ 2.907924945735136, ++ 0.022228357764969564, ++ -0.5071214811492599, ++ 0.02509144129036578, ++ 0.022718837619484678, ++ 0.06120691522596422, ++ 0.30589062196252637, ++ 1.0329845093332668, ++ 0.014860334913185502, ++ 0.01765439482987108, ++ 0.015223496420421201, ++ 0.3352969449271075, ++ 0.022351073746802674, ++ 4.920455953428159, ++ 0.024538210211043743, ++ 0.019983582316880577, ++ 0.03292085152661295, ++ 0.030445280321387935, ++ 10.0, ++ 0.018398131276209817, ++ 0.01980139702737216, ++ 0.01896441623922851, ++ 0.022574971070788208, ++ 0.01961469275632899, ++ 0.017925070068654958, ++ 0.022549199991725777, ++ 0.042694824314348456, ++ -1.1040485020844724, ++ -0.8328856967713545, ++ 0.010486287554451912, ++ -0.15815014109963288, ++ 0.5276802305511856, ++ -0.16586473934630663, ++ -1.6713862869185236, ++ -0.5685528568072895, ++ 0.015496263249374809, ++ 0.3313776030981479, ++ 0.5841917745193543, ++ 0.9532541813860999, ++ 1.6364826627594853, ++ -1.4297400383069743, ++ 0.054491944876914444, ++ 0.17913906220820508, ++ 0.44577334447914807, ++ 0.5681719372906395, ++ 3.32951901196007, ++ 0.020829537529045927, ++ -0.5816250842771562, ++ -0.45135245825393433, ++ -0.7025952973955096, ++ 0.4838975315421883, ++ 8.711509549878194, ++ 0.791270929375639, ++ 0.581356024160242, ++ 0.3922969596921355, ++ -0.7387562349132657, ++ -1.2614352370812663, ++ -0.8858225265098523, ++ 0.019758617519097244, ++ 0.14685779225447715, ++ -1.8664586782764085, ++ 0.17359675572073996, ++ 0.03043962244431553, ++ 1.68973994737285, ++ 0.14241547168885893, ++ -0.006681229849861969, ++ 0.035286585384673774, ++ -0.1867844252373887, ++ -0.05325949297845933, ++ -0.6188421202762768, ++ 0.019256498690954693, ++ 0.011261488314097567, ++ -0.8734726170866911, ++ 0.2611408152583321, ++ 0.018228313151663178, ++ 0.9920747746816749, ++ -1.9939450259663953, ++ -0.010909816645386039, ++ 0.8744010916528506, ++ 0.3484037761057752, ++ 0.01700115030331162, ++ 0.0200509230497925, ++ 0.9049230270226147, ++ -0.03502086486907441, ++ -0.13860433328031307, ++ -0.5008190311548453, ++ 0.13113827477880657, ++ 3.814948743048878, ++ 3.369522386056538, ++ 0.002328237048341175, ++ 0.9372362537216947, ++ 0.9359420764223362, ++ -1.0601842054652018, ++ 0.01621181769404767, ++ -0.4876602083027073, ++ 0.1933464422710256, ++ -2.10812470816676, ++ 0.018569908820821213}; ++ size_t i = 0; ++ for (size_t c = 0; c < 3; ++c) { ++ for (size_t scale = 0; scale < scales.size(); ++scale) { ++ for (size_t n = 0; n < 2; n++) { ++#ifdef SSIMULACRA2_OUTPUT_RAW_SCORES_FOR_WEIGHT_TUNING ++ printf("%.12f,%.12f,%.12f,", scales[scale].avg_ssim[c * 2 + n], ++ scales[scale].avg_edgediff[c * 4 + n], ++ scales[scale].avg_edgediff[c * 4 + 2 + n]); ++#endif ++ ssim += weight[i++] * std::abs(scales[scale].avg_ssim[c * 2 + n]); ++ ssim += weight[i++] * std::abs(scales[scale].avg_edgediff[c * 4 + n]); ++ ssim += ++ weight[i++] * std::abs(scales[scale].avg_edgediff[c * 4 + n + 2]); ++ } ++ } ++ } ++ ++ ssim *= 272.58355078216107; ++ ssim += -0.12953872587232876; ++ ++ if (ssim > 0) { ++ ssim = 100.0 - 10.0 * pow(ssim, 0.6940375837127916); ++ } else { ++ ssim = 100.0; ++ } ++ return ssim; ++} ++ ++Msssim ComputeSSIMULACRA2(const jxl::ImageBundle& orig, ++ const jxl::ImageBundle& dist, float bg) { ++ Msssim msssim; ++ ++ jxl::Image3F img1(orig.xsize(), orig.ysize()); ++ jxl::Image3F img2(img1.xsize(), img1.ysize()); ++ ++ if (orig.HasAlpha()) { ++ jxl::ImageBundle orig2 = orig.Copy(); ++ AlphaBlend(orig2, bg); ++ jxl::ToXYB(orig2, nullptr, &img1, jxl::GetJxlCms(), nullptr); ++ } else { ++ jxl::ToXYB(orig, nullptr, &img1, jxl::GetJxlCms(), nullptr); ++ } ++ if (dist.HasAlpha()) { ++ jxl::ImageBundle dist2 = dist.Copy(); ++ AlphaBlend(dist2, bg); ++ jxl::ToXYB(dist2, nullptr, &img2, jxl::GetJxlCms(), nullptr); ++ } else { ++ jxl::ToXYB(dist, nullptr, &img2, jxl::GetJxlCms(), nullptr); ++ } ++ MakePositiveXYB(img1); ++ MakePositiveXYB(img2); ++ ++ Image3F mul(img1.xsize(), img1.ysize()); ++ Blur blur(img1.xsize(), img1.ysize()); ++ ++ for (int scale = 0; scale < kNumScales; scale++) { ++ if (img1.xsize() < 8 || img1.ysize() < 8) { ++ break; ++ } ++ if (scale) { ++ img1 = Downsample(img1, 2, 2); ++ img2 = Downsample(img2, 2, 2); ++ } ++ mul.ShrinkTo(img1.xsize(), img2.ysize()); ++ blur.ShrinkTo(img1.xsize(), img2.ysize()); ++ ++ Multiply(img1, img1, &mul); ++ Image3F sigma1_sq = blur(mul); ++ ++ Multiply(img2, img2, &mul); ++ Image3F sigma2_sq = blur(mul); ++ ++ Multiply(img1, img2, &mul); ++ Image3F sigma12 = blur(mul); ++ ++ Image3F mu1 = blur(img1); ++ Image3F mu2 = blur(img2); ++ ++ MsssimScale sscale; ++ SSIMMap(mu1, mu2, sigma1_sq, sigma2_sq, sigma12, sscale.avg_ssim); ++ EdgeDiffMap(img1, mu1, img2, mu2, sscale.avg_edgediff); ++ msssim.scales.push_back(sscale); ++ } ++ return msssim; ++} ++ ++Msssim ComputeSSIMULACRA2(const jxl::ImageBundle& orig, ++ const jxl::ImageBundle& distorted) { ++ return ComputeSSIMULACRA2(orig, distorted, 0.5f); ++} +diff --git a/tools/ssimulacra2.h b/tools/ssimulacra2.h +new file mode 100644 +index 0000000000..36d1193112 +--- /dev/null ++++ b/tools/ssimulacra2.h +@@ -0,0 +1,32 @@ ++// Copyright (c) the JPEG XL Project Authors. All rights reserved. ++// ++// Use of this source code is governed by a BSD-style ++// license that can be found in the LICENSE file. ++ ++#ifndef TOOLS_SSIMULACRA2_H_ ++#define TOOLS_SSIMULACRA2_H_ ++ ++#include ++ ++#include "lib/jxl/image_bundle.h" ++ ++struct MsssimScale { ++ double avg_ssim[3 * 2]; ++ double avg_edgediff[3 * 4]; ++}; ++ ++struct Msssim { ++ std::vector scales; ++ ++ double Score() const; ++}; ++ ++// Computes the SSIMULACRA 2 score between reference image 'orig' and ++// distorted image 'distorted'. In case of alpha transparency, assume ++// a gray background if intensity 'bg' (in range 0..1). ++Msssim ComputeSSIMULACRA2(const jxl::ImageBundle &orig, ++ const jxl::ImageBundle &distorted, float bg); ++Msssim ComputeSSIMULACRA2(const jxl::ImageBundle &orig, ++ const jxl::ImageBundle &distorted); ++ ++#endif // TOOLS_SSIMULACRA2_H_ +diff --git a/tools/ssimulacra2_main.cc b/tools/ssimulacra2_main.cc +new file mode 100644 +index 0000000000..35e284b5dc +--- /dev/null ++++ b/tools/ssimulacra2_main.cc +@@ -0,0 +1,70 @@ ++// Copyright (c) the JPEG XL Project Authors. All rights reserved. ++// ++// Use of this source code is governed by a BSD-style ++// license that can be found in the LICENSE file. ++ ++#include ++ ++#include "lib/extras/codec.h" ++#include "lib/jxl/color_management.h" ++#include "lib/jxl/enc_color_management.h" ++#include "tools/ssimulacra2.h" ++ ++int PrintUsage(char** argv) { ++ fprintf(stderr, "Usage: %s orig.png distorted.png\n", argv[0]); ++ fprintf(stderr, ++ "Returns a score in range -inf..100, which correlates to subjective " ++ "visual quality:\n"); ++ fprintf(stderr, ++ " 30 = low quality (p10 worst output of mozjpeg -quality 30)\n"); ++ fprintf(stderr, ++ " 50 = medium quality (average output of cjxl -q 40 or mozjpeg " ++ "-quality 40,\n"); ++ fprintf(stderr, ++ " p10 output of cjxl -q 50 or mozjpeg " ++ "-quality 60)\n"); ++ fprintf(stderr, ++ " 70 = high quality (average output of cjxl -q 70 or mozjpeg " ++ "-quality 70,\n"); ++ fprintf(stderr, ++ " p10 output of cjxl -q 75 or mozjpeg " ++ "-quality 80)\n"); ++ fprintf(stderr, ++ " 90 = very high quality (impossible to distinguish from " ++ "original at 1:1,\n"); ++ fprintf(stderr, ++ " average output of cjxl -q 90 or " ++ "mozjpeg -quality 90)\n"); ++ return 1; ++} ++ ++int main(int argc, char** argv) { ++ if (argc != 3) return PrintUsage(argv); ++ ++ jxl::CodecInOut io1; ++ jxl::CodecInOut io2; ++ JXL_CHECK(SetFromFile(argv[1], jxl::extras::ColorHints(), &io1)); ++ ++ if (io1.xsize() < 8 || io1.ysize() < 8) { ++ fprintf(stderr, "Minimum image size is 8x8 pixels\n"); ++ return 1; ++ } ++ ++ JXL_CHECK(SetFromFile(argv[2], jxl::extras::ColorHints(), &io2)); ++ if (io1.xsize() != io2.xsize() || io1.ysize() != io2.ysize()) { ++ fprintf(stderr, "Image size mismatch\n"); ++ return 1; ++ } ++ ++ if (!io1.Main().HasAlpha()) { ++ Msssim msssim = ComputeSSIMULACRA2(io1.Main(), io2.Main()); ++ printf("%.8f\n", msssim.Score()); ++ } else { ++ // in case of alpha transparency: blend against dark and bright backgrounds ++ // and return the worst of both scores ++ Msssim msssim0 = ComputeSSIMULACRA2(io1.Main(), io2.Main(), 0.1f); ++ Msssim msssim1 = ComputeSSIMULACRA2(io1.Main(), io2.Main(), 0.9f); ++ printf("%.8f\n", std::min(msssim0.Score(), msssim1.Score())); ++ } ++ return 0; ++} diff --git a/873890998bb151ba54a865cdbd61df22af29774c.patch b/873890998bb151ba54a865cdbd61df22af29774c.patch new file mode 100644 index 0000000..c98dce9 --- /dev/null +++ b/873890998bb151ba54a865cdbd61df22af29774c.patch @@ -0,0 +1,234 @@ +From 873890998bb151ba54a865cdbd61df22af29774c Mon Sep 17 00:00:00 2001 +From: Sami Boukortt +Date: Mon, 22 Aug 2022 16:08:20 +0200 +Subject: [PATCH] Tool for converting EXR images to PQ PNGs + +--- + lib/extras/dec/exr.cc | 2 +- + tools/CMakeLists.txt | 2 + + tools/hdr/README.md | 16 +++++ + tools/hdr/exr_to_pq.cc | 155 +++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 174 insertions(+), 1 deletion(-) + create mode 100644 tools/hdr/exr_to_pq.cc + +diff --git a/lib/extras/dec/exr.cc b/lib/extras/dec/exr.cc +index ddb6d534e5..e63c005628 100644 +--- a/lib/extras/dec/exr.cc ++++ b/lib/extras/dec/exr.cc +@@ -87,7 +87,7 @@ Status DecodeImageEXR(Span bytes, const ColorHints& color_hints, + + const float intensity_target = OpenEXR::hasWhiteLuminance(input.header()) + ? OpenEXR::whiteLuminance(input.header()) +- : kDefaultIntensityTarget; ++ : 0; + + auto image_size = input.displayWindow().size(); + // Size is computed as max - min, but both bounds are inclusive. +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt +index ed773190ec..739d4bcede 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -164,6 +164,7 @@ if(JPEGXL_ENABLE_DEVTOOLS) + butteraugli_main + decode_and_encode + display_to_hlg ++ exr_to_pq + pq_to_hlg + render_hlg + tone_map +@@ -180,6 +181,7 @@ if(JPEGXL_ENABLE_DEVTOOLS) + add_executable(butteraugli_main butteraugli_main.cc) + add_executable(decode_and_encode decode_and_encode.cc) + add_executable(display_to_hlg hdr/display_to_hlg.cc) ++ add_executable(exr_to_pq hdr/exr_to_pq.cc) + add_executable(pq_to_hlg hdr/pq_to_hlg.cc) + add_executable(render_hlg hdr/render_hlg.cc) + add_executable(tone_map hdr/tone_map.cc) +diff --git a/tools/hdr/README.md b/tools/hdr/README.md +index 227b22b3e4..85eb1bd774 100644 +--- a/tools/hdr/README.md ++++ b/tools/hdr/README.md +@@ -99,6 +99,22 @@ This is the mathematical inverse of `tools/render_hlg`. Furthermore, + `tools/pq_to_hlg` is equivalent to `tools/tone_map -t 1000` followed by + `tools/display_to_hlg -m 1000`. + ++## OpenEXR to PQ ++ ++`tools/exr_to_pq` converts an OpenEXR image into a Rec. 2020 + PQ image, which ++can be saved as a PNG or PPM file. Luminance information is taken from the ++`whiteLuminance` tag if the input has it, and otherwise defaults to treating ++(1, 1, 1) as 100 cd/m². It is also possible to override this using the ++`--luminance` (`-l`) flag, in two different ways: ++ ++```shell ++# Specifies that the brightest pixel in the image happens to be 1500 cd/m². ++$ tools/exr_to_pq --luminance='max=1500' input.exr output.png ++ ++# Specifies that (1, 1, 1) in the input file is 203 cd/m². ++$ tools/exr_to_pq --luminance='white=203' input.exr output.png ++``` ++ + # LUT generation + + There are additionally two tools that can be used to generate look-up tables +diff --git a/tools/hdr/exr_to_pq.cc b/tools/hdr/exr_to_pq.cc +new file mode 100644 +index 0000000000..6162b72221 +--- /dev/null ++++ b/tools/hdr/exr_to_pq.cc +@@ -0,0 +1,155 @@ ++// Copyright (c) the JPEG XL Project Authors. All rights reserved. ++// ++// Use of this source code is governed by a BSD-style ++// license that can be found in the LICENSE file. ++ ++#include ++#include ++ ++#include "lib/extras/codec.h" ++#include "lib/extras/dec/decode.h" ++#include "lib/extras/packed_image_convert.h" ++#include "lib/jxl/base/file_io.h" ++#include "lib/jxl/base/thread_pool_internal.h" ++#include "lib/jxl/enc_color_management.h" ++#include "tools/cmdline.h" ++ ++namespace { ++ ++struct LuminanceInfo { ++ enum class Kind { kWhite, kMaximum }; ++ Kind kind = Kind::kWhite; ++ float luminance = 100.f; ++}; ++ ++bool ParseLuminanceInfo(const char* argument, LuminanceInfo* luminance_info) { ++ if (strncmp(argument, "white=", 6) == 0) { ++ luminance_info->kind = LuminanceInfo::Kind::kWhite; ++ argument += 6; ++ } else if (strncmp(argument, "max=", 4) == 0) { ++ luminance_info->kind = LuminanceInfo::Kind::kMaximum; ++ argument += 4; ++ } else { ++ fprintf(stderr, ++ "Invalid prefix for luminance info, expected white= or max=\n"); ++ return false; ++ } ++ return jpegxl::tools::ParseFloat(argument, &luminance_info->luminance); ++} ++ ++} // namespace ++ ++int main(int argc, const char** argv) { ++ jxl::ThreadPoolInternal pool; ++ ++ jpegxl::tools::CommandLineParser parser; ++ LuminanceInfo luminance_info; ++ auto luminance_option = ++ parser.AddOptionValue('l', "luminance", "", ++ "luminance information (defaults to whiteLuminance " ++ "header if present, otherwise to white=100)", ++ &luminance_info, &ParseLuminanceInfo, 0); ++ const char* input_filename = nullptr; ++ auto input_filename_option = parser.AddPositionalOption( ++ "input", true, "input image", &input_filename, 0); ++ const char* output_filename = nullptr; ++ auto output_filename_option = parser.AddPositionalOption( ++ "output", true, "output image", &output_filename, 0); ++ ++ if (!parser.Parse(argc, argv)) { ++ fprintf(stderr, "See -h for help.\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if (parser.HelpFlagPassed()) { ++ parser.PrintHelp(); ++ return EXIT_SUCCESS; ++ } ++ ++ if (!parser.GetOption(input_filename_option)->matched()) { ++ fprintf(stderr, "Missing input filename.\nSee -h for help.\n"); ++ return EXIT_FAILURE; ++ } ++ if (!parser.GetOption(output_filename_option)->matched()) { ++ fprintf(stderr, "Missing output filename.\nSee -h for help.\n"); ++ return EXIT_FAILURE; ++ } ++ ++ jxl::extras::PackedPixelFile ppf; ++ std::vector input_bytes; ++ JXL_CHECK(jxl::ReadFile(input_filename, &input_bytes)); ++ JXL_CHECK(jxl::extras::DecodeBytes(jxl::Span(input_bytes), ++ jxl::extras::ColorHints(), ++ jxl::SizeConstraints(), &ppf)); ++ ++ jxl::CodecInOut image; ++ JXL_CHECK( ++ jxl::extras::ConvertPackedPixelFileToCodecInOut(ppf, &pool, &image)); ++ image.metadata.m.bit_depth.exponent_bits_per_sample = 0; ++ jxl::ColorEncoding linear_rec_2020 = image.Main().c_current(); ++ linear_rec_2020.primaries = jxl::Primaries::k2100; ++ linear_rec_2020.tf.SetTransferFunction(jxl::TransferFunction::kLinear); ++ JXL_CHECK(linear_rec_2020.CreateICC()); ++ JXL_CHECK(image.TransformTo(linear_rec_2020, jxl::GetJxlCms(), &pool)); ++ ++ float primaries_xyz[9]; ++ const jxl::PrimariesCIExy primaries = image.Main().c_current().GetPrimaries(); ++ const jxl::CIExy white_point = image.Main().c_current().GetWhitePoint(); ++ JXL_CHECK(jxl::PrimariesToXYZ(primaries.r.x, primaries.r.y, primaries.g.x, ++ primaries.g.y, primaries.b.x, primaries.b.y, ++ white_point.x, white_point.y, primaries_xyz)); ++ ++ float max_value = 0.f; ++ float max_relative_luminance = 0.f; ++ float white_luminance = ppf.info.intensity_target != 0 && ++ !parser.GetOption(luminance_option)->matched() ++ ? ppf.info.intensity_target ++ : luminance_info.kind == LuminanceInfo::Kind::kWhite ++ ? luminance_info.luminance ++ : 0.f; ++ bool out_of_gamut = false; ++ for (size_t y = 0; y < image.ysize(); ++y) { ++ const float* const rows[3] = {image.Main().color()->ConstPlaneRow(0, y), ++ image.Main().color()->ConstPlaneRow(1, y), ++ image.Main().color()->ConstPlaneRow(2, y)}; ++ for (size_t x = 0; x < image.xsize(); ++x) { ++ if (!out_of_gamut && ++ (rows[0][x] < 0 || rows[1][x] < 0 || rows[2][x] < 0)) { ++ out_of_gamut = true; ++ fprintf(stderr, ++ "WARNING: found colors outside of the Rec. 2020 gamut.\n"); ++ } ++ max_value = std::max( ++ max_value, std::max(rows[0][x], std::max(rows[1][x], rows[2][x]))); ++ const float luminance = primaries_xyz[1] * rows[0][x] + ++ primaries_xyz[4] * rows[1][x] + ++ primaries_xyz[7] * rows[2][x]; ++ if (luminance_info.kind == LuminanceInfo::Kind::kMaximum && ++ luminance > max_relative_luminance) { ++ max_relative_luminance = luminance; ++ white_luminance = luminance_info.luminance / luminance; ++ } ++ } ++ } ++ jxl::ScaleImage(1.f / max_value, image.Main().color()); ++ white_luminance *= max_value; ++ image.metadata.m.SetIntensityTarget(white_luminance); ++ if (white_luminance > 10000) { ++ fprintf(stderr, ++ "WARNING: the image is too bright for PQ (would need (1, 1, 1) to " ++ "be %g cd/m^2).\n", ++ white_luminance); ++ } else { ++ fprintf(stderr, ++ "The resulting image should be compressed with " ++ "--intensity_target=%g.\n", ++ white_luminance); ++ } ++ ++ jxl::ColorEncoding pq = image.Main().c_current(); ++ pq.tf.SetTransferFunction(jxl::TransferFunction::kPQ); ++ JXL_CHECK(pq.CreateICC()); ++ JXL_CHECK(image.TransformTo(pq, jxl::GetJxlCms(), &pool)); ++ image.metadata.m.color_encoding = pq; ++ JXL_CHECK(jxl::EncodeToFile(image, output_filename, &pool)); ++} diff --git a/jpegxl.spec b/jpegxl.spec index 6f0d415..165edf3 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -19,6 +19,7 @@ This package contains a reference implementation of JPEG XL (encoder and decoder).} Name: jpegxl +Epoch: 1 Version: 0.7.0 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation @@ -31,6 +32,10 @@ License: BSD and ASL 2.0 and zlib URL: https://jpeg.org/jpegxl/ VCS: https://github.com/libjxl/libjxl Source0: %vcs/archive/v%{version}/%{name}-%{version}.tar.gz +# exr_to_pq +Patch0: https://github.com/libjxl/libjxl/commit/873890998bb151ba54a865cdbd61df22af29774c.patch +# Ssimulacra 2 +Patch1: https://github.com/libjxl/libjxl/commit/795b363120bbcfdbb2e2e4fa85146ac6d385137d.patch # git clone https://github.com/libjxl/libjxl # cd libjxl/ @@ -90,6 +95,17 @@ Obsoletes: jpegxl-utils < 0.3.7-5 %description -n libjxl-utils %{common_description} +%package -n libjxl-devtools +Summary: Development tools for JPEG-XL +Requires: libjxl%{?_isa} = %{version}-%{release} + +%description -n libjxl-devtools +%{common_description} + +Development tools for JPEG-XL + + + %package doc Summary: Documentation for JPEG-XL BuildArch: noarch @@ -122,6 +138,8 @@ Obsoletes: jpegxl-devel < 0.3.7-5 Development files for JPEG-XL. +Development files for JPEG-XL. + %package -n jxl-pixbuf-loader Summary: JPEG-XL image loader for GTK+ applications BuildRequires: pkgconfig(gdk-pixbuf-2.0) @@ -156,7 +174,8 @@ rm -rf third_party/ -DJPEGXL_WARNINGS_AS_ERRORS:BOOL=OFF \ -DBUILD_SHARED_LIBS:BOOL=ON \ -DBUNDLE_LIBPNG_DEFAULT:BOOL=OFF \ - -DBUNDLE_GFLAGS_DEFAULT:BOOL=OFF + -DBUNDLE_GFLAGS_DEFAULT:BOOL=OFF \ + -DJPEGXL_ENABLE_DEVTOOLS=ON %cmake_build -- all doc %install @@ -178,6 +197,22 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %{_mandir}/man1/cjxl.1* %{_mandir}/man1/djxl.1* +%files -n libjxl-devtools +%{_bindir}/fuzzer_corpus +%{_bindir}/butteraugli_main +%{_bindir}/decode_and_encode +%{_bindir}/display_to_hlg +%{_bindir}/exr_to_pq +%{_bindir}/pq_to_hlg +%{_bindir}/render_hlg +%{_bindir}/tone_map +%{_bindir}/texture_to_cube +%{_bindir}/generate_lut_template +%{_bindir}/ssimulacra_main +%{_bindir}/ssimulacra2 +%{_bindir}/xyb_range +%{_bindir}/jxl_from_tree + %files doc %doc doc/*.md %doc %{_vpath_builddir}/html From 2dedc270ee49c0ab9d61ced5f592f381a384a2d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Sun, 25 Sep 2022 10:06:47 +0200 Subject: [PATCH 08/43] Add Epoch to Provides. Close: rhbz#2129592 --- jpegxl.spec | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/jpegxl.spec b/jpegxl.spec index 165edf3..1062915 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -85,11 +85,11 @@ Provides: bundled(skcms) = 0-0.1.20210522git6437475 %description %common_description -%package -n libjxl-utils +%package -n libjxl-utilss Summary: Utilities for manipulating JPEG XL images -Recommends: jxl-pixbuf-loader = %{version}-%{release} -Recommends: gimp-jxl-plugin = %{version}-%{release} -Provides: jpegxl-utils = %{version}-%{release} +Recommends: jxl-pixbuf-loader = %{epoch}:%{version}-%{release} +Recommends: gimp-jxl-plugin = %{epoch}:%{version}-%{release} +Provides: jpegxl-utils = %{epoch}:%{version}-%{release} Obsoletes: jpegxl-utils < 0.3.7-5 %description -n libjxl-utils @@ -97,7 +97,7 @@ Obsoletes: jpegxl-utils < 0.3.7-5 %package -n libjxl-devtools Summary: Development tools for JPEG-XL -Requires: libjxl%{?_isa} = %{version}-%{release} +Requires: libjxl%{?_isa} = %{epoch}:%{version}-%{release} %description -n libjxl-devtools %{common_description} @@ -118,8 +118,8 @@ Documentation for JPEG-XL. %package -n libjxl Summary: Library files for JPEG-XL Requires: shared-mime-info -Recommends: jxl-pixbuf-loader = %{version}-%{release} -Provides: jpegxl-libs = %{version}-%{release} +Recommends: jxl-pixbuf-loader = %{epoch}:%{version}-%{release} +Provides: jpegxl-libs = %{epoch}:%{version}-%{release} Obsoletes: jpegxl-libs < 0.3.7-5 %description -n libjxl @@ -129,8 +129,8 @@ Library files for JPEG-XL. %package -n libjxl-devel Summary: Development files for JPEG-XL -Requires: libjxl%{?_isa} = %{version}-%{release} -Provides: jpegxl-devel = %{version}-%{release} +Requires: libjxl%{?_isa} = %{epoch}:%{version}-%{release} +Provides: jpegxl-devel = %{epoch}:%{version}-%{release} Obsoletes: jpegxl-devel < 0.3.7-5 %description -n libjxl-devel From fc8e7056f8e30b9b304091ff22ee6288e7560e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Sun, 25 Sep 2022 10:07:49 +0200 Subject: [PATCH 09/43] Fix typo --- jpegxl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jpegxl.spec b/jpegxl.spec index 1062915..cc88d8c 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -85,7 +85,7 @@ Provides: bundled(skcms) = 0-0.1.20210522git6437475 %description %common_description -%package -n libjxl-utilss +%package -n libjxl-utils Summary: Utilities for manipulating JPEG XL images Recommends: jxl-pixbuf-loader = %{epoch}:%{version}-%{release} Recommends: gimp-jxl-plugin = %{epoch}:%{version}-%{release} From b907c00f322960c2b4ab1d135ccde50684d14bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Sat, 19 Nov 2022 22:00:09 +0100 Subject: [PATCH 10/43] Convert to SPDX --- jpegxl.spec | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/jpegxl.spec b/jpegxl.spec index cc88d8c..c7d70b7 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -3,10 +3,6 @@ %global sover_old 0.6 %global sover 0.7 -# %%global commit 980c90f65f41066cc4959b4eb80eba906867103b -# %%global snapshotdate 20220918 -# %%global shortcommit %%(c=%%{commit}; echo ${c:0:7}) - %global gdk_pixbuf_moduledir $(pkgconf gdk-pixbuf-2.0 --variable=gdk_pixbuf_moduledir) %if 0%{?fedora} @@ -19,7 +15,6 @@ This package contains a reference implementation of JPEG XL (encoder and decoder).} Name: jpegxl -Epoch: 1 Version: 0.7.0 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation @@ -28,7 +23,7 @@ Summary: JPEG XL image format reference implementation # lodepng: zlib # sjpeg: ASL 2.0 # skcms: BSD -License: BSD and ASL 2.0 and zlib +License: BSD-3-Clause AND Apache-2.0 AND Zlib URL: https://jpeg.org/jpegxl/ VCS: https://github.com/libjxl/libjxl Source0: %vcs/archive/v%{version}/%{name}-%{version}.tar.gz @@ -104,8 +99,6 @@ Requires: libjxl%{?_isa} = %{epoch}:%{version}-%{release} Development tools for JPEG-XL - - %package doc Summary: Documentation for JPEG-XL BuildArch: noarch @@ -138,8 +131,6 @@ Obsoletes: jpegxl-devel < 0.3.7-5 Development files for JPEG-XL. -Development files for JPEG-XL. - %package -n jxl-pixbuf-loader Summary: JPEG-XL image loader for GTK+ applications BuildRequires: pkgconfig(gdk-pixbuf-2.0) From c20ec23f31b0be2e9f10e2d6ec7ec5ddc9f55421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Such=C3=BD?= Date: Tue, 27 Dec 2022 10:39:41 +0000 Subject: [PATCH 11/43] add epoch back This seems to be removed by accident in https://src.fedoraproject.org/rpms/jpegxl/c/b907c00f322960c2b4ab1d135ccde50684d14bb9?branch=rawhide This makes the package not upgradeable. And the macro in Recommends: jxl-pixbuf-loader = %{epoch}:%{version}-%{release} Recommends: gimp-jxl-plugin = %{epoch}:%{version}-%{release} is not correctly expanded. --- jpegxl.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/jpegxl.spec b/jpegxl.spec index c7d70b7..18270c9 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -15,6 +15,7 @@ This package contains a reference implementation of JPEG XL (encoder and decoder).} Name: jpegxl +Epoch: 1 Version: 0.7.0 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation From 3b31ff8895fe7b15a7af6c89162fc96feaa71d48 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 13:52:26 +0000 Subject: [PATCH 12/43] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering From f4f14a869a3d0869015dfeab1911f11f43a3e629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Mon, 20 Mar 2023 16:28:14 +0000 Subject: [PATCH 13/43] fix epel8 builds --- jpegxl.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jpegxl.spec b/jpegxl.spec index 18270c9..aca784a 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -1,3 +1,7 @@ +# epel 8 need this other already have it +%undefine __cmake_in_source_build + + # Uncomment for special build to rebuild aom on bumped soname. # %%global new_soname 0 %global sover_old 0.6 @@ -59,7 +63,7 @@ BuildRequires: pkgconfig(gimp-2.0) %endif BuildRequires: (pkgconfig(glut) or pkgconfig(freeglut)) BuildRequires: gtest-devel -BuildRequires: pkgconfig(gflags) +BuildRequires: gflags-devel BuildRequires: pkgconfig(libhwy) BuildRequires: pkgconfig(libbrotlicommon) BuildRequires: pkgconfig(libjpeg) @@ -69,6 +73,8 @@ BuildRequires: pkgconfig(OpenEXR) BuildRequires: pkgconfig(Qt5) BuildRequires: pkgconfig(Qt5X11Extras) BuildRequires: pkgconfig(zlib) +# epel 8 need this other already have it +BuildRequires: python3-devel %if 0%{?new_soname} BuildRequires: libjxl < %{version} %endif From 572b55ef72d0c1ab50b504fa4f96f81fe2c93b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Mon, 3 Apr 2023 10:48:41 +0100 Subject: [PATCH 14/43] Update to 0.8.1 with new soname - Drop patches because they are already in the code - Add update_third_party.sh helper script --- .gitignore | 2 + ...363120bbcfdbb2e2e4fa85146ac6d385137d.patch | 579 ------------------ ...90998bb151ba54a865cdbd61df22af29774c.patch | 234 ------- jpegxl.spec | 14 +- sources | 4 +- update_third_party.sh | 15 + 6 files changed, 24 insertions(+), 824 deletions(-) delete mode 100644 795b363120bbcfdbb2e2e4fa85146ac6d385137d.patch delete mode 100644 873890998bb151ba54a865cdbd61df22af29774c.patch create mode 100755 update_third_party.sh diff --git a/.gitignore b/.gitignore index 3737109..eb6c37c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ /third_party-0.7rc.tar.gz /jpegxl-0.7.0.tar.gz /third_party-0.7.0.tar.gz +/jpegxl-0.8.1.tar.gz +/third_party-0.8.1.tar.gz diff --git a/795b363120bbcfdbb2e2e4fa85146ac6d385137d.patch b/795b363120bbcfdbb2e2e4fa85146ac6d385137d.patch deleted file mode 100644 index 24261e3..0000000 --- a/795b363120bbcfdbb2e2e4fa85146ac6d385137d.patch +++ /dev/null @@ -1,579 +0,0 @@ -From 795b363120bbcfdbb2e2e4fa85146ac6d385137d Mon Sep 17 00:00:00 2001 -From: Jon Sneyers -Date: Mon, 29 Aug 2022 08:37:24 +0200 -Subject: [PATCH] SSIMULACRA 2 (#1646) - ---- - tools/CMakeLists.txt | 2 + - tools/ssimulacra2.cc | 424 ++++++++++++++++++++++++++++++++++++++ - tools/ssimulacra2.h | 32 +++ - tools/ssimulacra2_main.cc | 70 +++++++ - 4 files changed, 528 insertions(+) - create mode 100644 tools/ssimulacra2.cc - create mode 100644 tools/ssimulacra2.h - create mode 100644 tools/ssimulacra2_main.cc - -diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt -index 739d4bcede..0d6a28f55a 100644 ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -171,6 +171,7 @@ if(JPEGXL_ENABLE_DEVTOOLS) - texture_to_cube - generate_lut_template - ssimulacra_main -+ ssimulacra2 - xyb_range - jxl_from_tree - ) -@@ -178,6 +179,7 @@ if(JPEGXL_ENABLE_DEVTOOLS) - add_executable(fuzzer_corpus fuzzer_corpus.cc) - - add_executable(ssimulacra_main ssimulacra_main.cc ssimulacra.cc) -+ add_executable(ssimulacra2 ssimulacra2_main.cc ssimulacra2.cc) - add_executable(butteraugli_main butteraugli_main.cc) - add_executable(decode_and_encode decode_and_encode.cc) - add_executable(display_to_hlg hdr/display_to_hlg.cc) -diff --git a/tools/ssimulacra2.cc b/tools/ssimulacra2.cc -new file mode 100644 -index 0000000000..8bc31b87e7 ---- /dev/null -+++ b/tools/ssimulacra2.cc -@@ -0,0 +1,424 @@ -+// Copyright (c) the JPEG XL Project Authors. All rights reserved. -+// -+// Use of this source code is governed by a BSD-style -+// license that can be found in the LICENSE file. -+ -+/* -+SSIMULACRA 2 - Structural SIMilarity Unveiling Local And Compression Related -+Artifacts -+ -+Perceptual metric developed by Jon Sneyers (Cloudinary) in July 2022. -+Design: -+- XYB color space (X+0.5, Y, Y-B+1.0) -+- SSIM map -+- 'blockiness/ringing' map (distorted has edges where original is smooth) -+- 'smoothing' map (distorted is smooth where original has edges) -+- error maps are computed at 6 scales (1:1 to 1:32) for each component (X,Y,B) -+- for all 6*3*3=54 maps, two norms are computed: 1-norm (mean) and 4-norm -+- a weighted sum of these 54*2=108 norms leads to the final score -+- weights were tuned based on a large set of subjective scores for images -+ compressed with JPEG, JPEG 2000, JPEG XL, WebP, AVIF, and HEIC. -+*/ -+ -+#include "tools/ssimulacra2.h" -+ -+#include -+ -+#include -+ -+#include "lib/jxl/enc_color_management.h" -+#include "lib/jxl/enc_xyb.h" -+#include "lib/jxl/gauss_blur.h" -+#include "lib/jxl/image_ops.h" -+ -+namespace { -+ -+using jxl::Image3F; -+using jxl::ImageF; -+ -+static const float kC1 = 0.0001f; -+static const float kC2 = 0.0003f; -+static const int kNumScales = 6; -+ -+Image3F Downsample(const Image3F& in, size_t fx, size_t fy) { -+ const size_t out_xsize = (in.xsize() + fx - 1) / fx; -+ const size_t out_ysize = (in.ysize() + fy - 1) / fy; -+ Image3F out(out_xsize, out_ysize); -+ const float normalize = 1.0f / (fx * fy); -+ for (size_t c = 0; c < 3; ++c) { -+ for (size_t oy = 0; oy < out_ysize; ++oy) { -+ float* JXL_RESTRICT row_out = out.PlaneRow(c, oy); -+ for (size_t ox = 0; ox < out_xsize; ++ox) { -+ float sum = 0.0f; -+ for (size_t iy = 0; iy < fy; ++iy) { -+ for (size_t ix = 0; ix < fx; ++ix) { -+ const size_t x = std::min(ox * fx + ix, in.xsize() - 1); -+ const size_t y = std::min(oy * fy + iy, in.ysize() - 1); -+ sum += in.PlaneRow(c, y)[x]; -+ } -+ } -+ row_out[ox] = sum * normalize; -+ } -+ } -+ } -+ return out; -+} -+ -+void Multiply(const Image3F& a, const Image3F& b, Image3F* mul) { -+ for (size_t c = 0; c < 3; ++c) { -+ for (size_t y = 0; y < a.ysize(); ++y) { -+ const float* JXL_RESTRICT in1 = a.PlaneRow(c, y); -+ const float* JXL_RESTRICT in2 = b.PlaneRow(c, y); -+ float* JXL_RESTRICT out = mul->PlaneRow(c, y); -+ for (size_t x = 0; x < a.xsize(); ++x) { -+ out[x] = in1[x] * in2[x]; -+ } -+ } -+ } -+} -+ -+// Temporary storage for Gaussian blur, reused for multiple images. -+class Blur { -+ public: -+ Blur(const size_t xsize, const size_t ysize) -+ : rg_(jxl::CreateRecursiveGaussian(1.5)), temp_(xsize, ysize) {} -+ -+ void operator()(const ImageF& in, ImageF* JXL_RESTRICT out) { -+ jxl::ThreadPool* null_pool = nullptr; -+ FastGaussian(rg_, in, null_pool, &temp_, out); -+ } -+ -+ Image3F operator()(const Image3F& in) { -+ Image3F out(in.xsize(), in.ysize()); -+ operator()(in.Plane(0), &out.Plane(0)); -+ operator()(in.Plane(1), &out.Plane(1)); -+ operator()(in.Plane(2), &out.Plane(2)); -+ return out; -+ } -+ -+ // Allows reusing across scales. -+ void ShrinkTo(const size_t xsize, const size_t ysize) { -+ temp_.ShrinkTo(xsize, ysize); -+ } -+ -+ private: -+ hwy::AlignedUniquePtr rg_; -+ ImageF temp_; -+}; -+ -+double tothe4th(double x) { -+ x *= x; -+ x *= x; -+ return x; -+} -+void SSIMMap(const Image3F& m1, const Image3F& m2, const Image3F& s11, -+ const Image3F& s22, const Image3F& s12, double* plane_averages) { -+ const double onePerPixels = 1.0 / (m1.ysize() * m1.xsize()); -+ for (size_t c = 0; c < 3; ++c) { -+ double sum1[2] = {0.0}; -+ for (size_t y = 0; y < m1.ysize(); ++y) { -+ const float* JXL_RESTRICT row_m1 = m1.PlaneRow(c, y); -+ const float* JXL_RESTRICT row_m2 = m2.PlaneRow(c, y); -+ const float* JXL_RESTRICT row_s11 = s11.PlaneRow(c, y); -+ const float* JXL_RESTRICT row_s22 = s22.PlaneRow(c, y); -+ const float* JXL_RESTRICT row_s12 = s12.PlaneRow(c, y); -+ for (size_t x = 0; x < m1.xsize(); ++x) { -+ float mu1 = row_m1[x]; -+ float mu2 = row_m2[x]; -+ float mu11 = mu1 * mu1; -+ float mu22 = mu2 * mu2; -+ float mu12 = mu1 * mu2; -+ float num_m = 2 * mu12 + kC1; -+ float num_s = 2 * (row_s12[x] - mu12) + kC2; -+ float denom_m = mu11 + mu22 + kC1; -+ float denom_s = (row_s11[x] - mu11) + (row_s22[x] - mu22) + kC2; -+ double d = 1.0 - ((num_m * num_s) / (denom_m * denom_s)); -+ d = std::max(d, 0.0); -+ sum1[0] += d; -+ sum1[1] += tothe4th(d); -+ } -+ } -+ plane_averages[c * 2] = onePerPixels * sum1[0]; -+ plane_averages[c * 2 + 1] = sqrt(sqrt(onePerPixels * sum1[1])); -+ } -+} -+ -+void EdgeDiffMap(const Image3F& img1, const Image3F& mu1, const Image3F& img2, -+ const Image3F& mu2, double* plane_averages) { -+ const double onePerPixels = 1.0 / (img1.ysize() * img1.xsize()); -+ for (size_t c = 0; c < 3; ++c) { -+ double sum1[4] = {0.0}; -+ for (size_t y = 0; y < img1.ysize(); ++y) { -+ const float* JXL_RESTRICT row1 = img1.PlaneRow(c, y); -+ const float* JXL_RESTRICT row2 = img2.PlaneRow(c, y); -+ const float* JXL_RESTRICT rowm1 = mu1.PlaneRow(c, y); -+ const float* JXL_RESTRICT rowm2 = mu2.PlaneRow(c, y); -+ for (size_t x = 0; x < img1.xsize(); ++x) { -+ double d1 = (1.0 + std::abs(row2[x] - rowm2[x])) / -+ (1.0 + std::abs(row1[x] - rowm1[x])) - -+ 1.0; -+ // d1 > 0: distorted has an edge where original is smooth -+ // (indicating ringing, color banding, blockiness, etc) -+ // d1 < 0: original has an edge where distorted is smooth -+ // (indicating smoothing, blurring, smearing, etc) -+ double artifact = std::max(d1, 0.0); -+ sum1[0] += artifact; -+ sum1[1] += tothe4th(artifact); -+ double detail_lost = std::max(-d1, 0.0); -+ sum1[2] += detail_lost; -+ sum1[3] += tothe4th(detail_lost); -+ } -+ } -+ plane_averages[c * 4] = onePerPixels * sum1[0]; -+ plane_averages[c * 4 + 1] = sqrt(sqrt(onePerPixels * sum1[1])); -+ plane_averages[c * 4 + 2] = onePerPixels * sum1[2]; -+ plane_averages[c * 4 + 3] = sqrt(sqrt(onePerPixels * sum1[3])); -+ } -+} -+ -+// Add 0.5 to X and turn B into 1 + B-Y -+// (SSIM expects non-negative ranges) -+void MakePositiveXYB(jxl::Image3F& img) { -+ for (size_t y = 0; y < img.ysize(); ++y) { -+ const float* JXL_RESTRICT rowY = img.PlaneRow(1, y); -+ float* JXL_RESTRICT rowB = img.PlaneRow(2, y); -+ float* JXL_RESTRICT rowX = img.PlaneRow(0, y); -+ for (size_t x = 0; x < img.xsize(); ++x) { -+ rowB[x] += 1.0f - rowY[x]; -+ rowX[x] += 0.5f; -+ } -+ } -+} -+ -+void AlphaBlend(jxl::ImageBundle& img, float bg) { -+ for (size_t y = 0; y < img.ysize(); ++y) { -+ float* JXL_RESTRICT r = img.color()->PlaneRow(0, y); -+ float* JXL_RESTRICT g = img.color()->PlaneRow(1, y); -+ float* JXL_RESTRICT b = img.color()->PlaneRow(2, y); -+ const float* JXL_RESTRICT a = img.alpha()->Row(y); -+ for (size_t x = 0; x < img.xsize(); ++x) { -+ r[x] = a[x] * r[x] + (1.f - a[x]) * bg; -+ g[x] = a[x] * g[x] + (1.f - a[x]) * bg; -+ b[x] = a[x] * b[x] + (1.f - a[x]) * bg; -+ } -+ } -+} -+ -+} // namespace -+ -+/* -+The final score is based on a weighted sum of 108 sub-scores: -+- for 6 scales (1:1 to 1:32) -+- for 3 components (X + 0.5, Y, B - Y + 1.0) -+- using 2 norms (the 1-norm and the 4-norm) -+- over 3 error maps: -+ - SSIM -+ - "ringing" (distorted edges where there are no orig edges) -+ - "blurring" (orig edges where there are no distorted edges) -+ -+The weights were obtained by running Nelder-Mead simplex search, -+optimizing to minimize MSE and maximize Kendall and Pearson correlation -+for training data consisting of 17611 subjective quality scores, -+validated on separate validation data consisting of 4292 scores. -+*/ -+double Msssim::Score() const { -+ double ssim = 0.0; -+ -+ constexpr double weight[108] = {-0.4887721343447775, -+ 0.023424809409418046, -+ -2.030114616889109, -+ 0.09295054976135864, -+ -0.6104037165108389, -+ -1.5043796645843681, -+ 0.7157171902116809, -+ 0.021100488642748494, -+ 0.020230927541050825, -+ 0.2133671136286971, -+ 2.907924945735136, -+ 0.022228357764969564, -+ -0.5071214811492599, -+ 0.02509144129036578, -+ 0.022718837619484678, -+ 0.06120691522596422, -+ 0.30589062196252637, -+ 1.0329845093332668, -+ 0.014860334913185502, -+ 0.01765439482987108, -+ 0.015223496420421201, -+ 0.3352969449271075, -+ 0.022351073746802674, -+ 4.920455953428159, -+ 0.024538210211043743, -+ 0.019983582316880577, -+ 0.03292085152661295, -+ 0.030445280321387935, -+ 10.0, -+ 0.018398131276209817, -+ 0.01980139702737216, -+ 0.01896441623922851, -+ 0.022574971070788208, -+ 0.01961469275632899, -+ 0.017925070068654958, -+ 0.022549199991725777, -+ 0.042694824314348456, -+ -1.1040485020844724, -+ -0.8328856967713545, -+ 0.010486287554451912, -+ -0.15815014109963288, -+ 0.5276802305511856, -+ -0.16586473934630663, -+ -1.6713862869185236, -+ -0.5685528568072895, -+ 0.015496263249374809, -+ 0.3313776030981479, -+ 0.5841917745193543, -+ 0.9532541813860999, -+ 1.6364826627594853, -+ -1.4297400383069743, -+ 0.054491944876914444, -+ 0.17913906220820508, -+ 0.44577334447914807, -+ 0.5681719372906395, -+ 3.32951901196007, -+ 0.020829537529045927, -+ -0.5816250842771562, -+ -0.45135245825393433, -+ -0.7025952973955096, -+ 0.4838975315421883, -+ 8.711509549878194, -+ 0.791270929375639, -+ 0.581356024160242, -+ 0.3922969596921355, -+ -0.7387562349132657, -+ -1.2614352370812663, -+ -0.8858225265098523, -+ 0.019758617519097244, -+ 0.14685779225447715, -+ -1.8664586782764085, -+ 0.17359675572073996, -+ 0.03043962244431553, -+ 1.68973994737285, -+ 0.14241547168885893, -+ -0.006681229849861969, -+ 0.035286585384673774, -+ -0.1867844252373887, -+ -0.05325949297845933, -+ -0.6188421202762768, -+ 0.019256498690954693, -+ 0.011261488314097567, -+ -0.8734726170866911, -+ 0.2611408152583321, -+ 0.018228313151663178, -+ 0.9920747746816749, -+ -1.9939450259663953, -+ -0.010909816645386039, -+ 0.8744010916528506, -+ 0.3484037761057752, -+ 0.01700115030331162, -+ 0.0200509230497925, -+ 0.9049230270226147, -+ -0.03502086486907441, -+ -0.13860433328031307, -+ -0.5008190311548453, -+ 0.13113827477880657, -+ 3.814948743048878, -+ 3.369522386056538, -+ 0.002328237048341175, -+ 0.9372362537216947, -+ 0.9359420764223362, -+ -1.0601842054652018, -+ 0.01621181769404767, -+ -0.4876602083027073, -+ 0.1933464422710256, -+ -2.10812470816676, -+ 0.018569908820821213}; -+ size_t i = 0; -+ for (size_t c = 0; c < 3; ++c) { -+ for (size_t scale = 0; scale < scales.size(); ++scale) { -+ for (size_t n = 0; n < 2; n++) { -+#ifdef SSIMULACRA2_OUTPUT_RAW_SCORES_FOR_WEIGHT_TUNING -+ printf("%.12f,%.12f,%.12f,", scales[scale].avg_ssim[c * 2 + n], -+ scales[scale].avg_edgediff[c * 4 + n], -+ scales[scale].avg_edgediff[c * 4 + 2 + n]); -+#endif -+ ssim += weight[i++] * std::abs(scales[scale].avg_ssim[c * 2 + n]); -+ ssim += weight[i++] * std::abs(scales[scale].avg_edgediff[c * 4 + n]); -+ ssim += -+ weight[i++] * std::abs(scales[scale].avg_edgediff[c * 4 + n + 2]); -+ } -+ } -+ } -+ -+ ssim *= 272.58355078216107; -+ ssim += -0.12953872587232876; -+ -+ if (ssim > 0) { -+ ssim = 100.0 - 10.0 * pow(ssim, 0.6940375837127916); -+ } else { -+ ssim = 100.0; -+ } -+ return ssim; -+} -+ -+Msssim ComputeSSIMULACRA2(const jxl::ImageBundle& orig, -+ const jxl::ImageBundle& dist, float bg) { -+ Msssim msssim; -+ -+ jxl::Image3F img1(orig.xsize(), orig.ysize()); -+ jxl::Image3F img2(img1.xsize(), img1.ysize()); -+ -+ if (orig.HasAlpha()) { -+ jxl::ImageBundle orig2 = orig.Copy(); -+ AlphaBlend(orig2, bg); -+ jxl::ToXYB(orig2, nullptr, &img1, jxl::GetJxlCms(), nullptr); -+ } else { -+ jxl::ToXYB(orig, nullptr, &img1, jxl::GetJxlCms(), nullptr); -+ } -+ if (dist.HasAlpha()) { -+ jxl::ImageBundle dist2 = dist.Copy(); -+ AlphaBlend(dist2, bg); -+ jxl::ToXYB(dist2, nullptr, &img2, jxl::GetJxlCms(), nullptr); -+ } else { -+ jxl::ToXYB(dist, nullptr, &img2, jxl::GetJxlCms(), nullptr); -+ } -+ MakePositiveXYB(img1); -+ MakePositiveXYB(img2); -+ -+ Image3F mul(img1.xsize(), img1.ysize()); -+ Blur blur(img1.xsize(), img1.ysize()); -+ -+ for (int scale = 0; scale < kNumScales; scale++) { -+ if (img1.xsize() < 8 || img1.ysize() < 8) { -+ break; -+ } -+ if (scale) { -+ img1 = Downsample(img1, 2, 2); -+ img2 = Downsample(img2, 2, 2); -+ } -+ mul.ShrinkTo(img1.xsize(), img2.ysize()); -+ blur.ShrinkTo(img1.xsize(), img2.ysize()); -+ -+ Multiply(img1, img1, &mul); -+ Image3F sigma1_sq = blur(mul); -+ -+ Multiply(img2, img2, &mul); -+ Image3F sigma2_sq = blur(mul); -+ -+ Multiply(img1, img2, &mul); -+ Image3F sigma12 = blur(mul); -+ -+ Image3F mu1 = blur(img1); -+ Image3F mu2 = blur(img2); -+ -+ MsssimScale sscale; -+ SSIMMap(mu1, mu2, sigma1_sq, sigma2_sq, sigma12, sscale.avg_ssim); -+ EdgeDiffMap(img1, mu1, img2, mu2, sscale.avg_edgediff); -+ msssim.scales.push_back(sscale); -+ } -+ return msssim; -+} -+ -+Msssim ComputeSSIMULACRA2(const jxl::ImageBundle& orig, -+ const jxl::ImageBundle& distorted) { -+ return ComputeSSIMULACRA2(orig, distorted, 0.5f); -+} -diff --git a/tools/ssimulacra2.h b/tools/ssimulacra2.h -new file mode 100644 -index 0000000000..36d1193112 ---- /dev/null -+++ b/tools/ssimulacra2.h -@@ -0,0 +1,32 @@ -+// Copyright (c) the JPEG XL Project Authors. All rights reserved. -+// -+// Use of this source code is governed by a BSD-style -+// license that can be found in the LICENSE file. -+ -+#ifndef TOOLS_SSIMULACRA2_H_ -+#define TOOLS_SSIMULACRA2_H_ -+ -+#include -+ -+#include "lib/jxl/image_bundle.h" -+ -+struct MsssimScale { -+ double avg_ssim[3 * 2]; -+ double avg_edgediff[3 * 4]; -+}; -+ -+struct Msssim { -+ std::vector scales; -+ -+ double Score() const; -+}; -+ -+// Computes the SSIMULACRA 2 score between reference image 'orig' and -+// distorted image 'distorted'. In case of alpha transparency, assume -+// a gray background if intensity 'bg' (in range 0..1). -+Msssim ComputeSSIMULACRA2(const jxl::ImageBundle &orig, -+ const jxl::ImageBundle &distorted, float bg); -+Msssim ComputeSSIMULACRA2(const jxl::ImageBundle &orig, -+ const jxl::ImageBundle &distorted); -+ -+#endif // TOOLS_SSIMULACRA2_H_ -diff --git a/tools/ssimulacra2_main.cc b/tools/ssimulacra2_main.cc -new file mode 100644 -index 0000000000..35e284b5dc ---- /dev/null -+++ b/tools/ssimulacra2_main.cc -@@ -0,0 +1,70 @@ -+// Copyright (c) the JPEG XL Project Authors. All rights reserved. -+// -+// Use of this source code is governed by a BSD-style -+// license that can be found in the LICENSE file. -+ -+#include -+ -+#include "lib/extras/codec.h" -+#include "lib/jxl/color_management.h" -+#include "lib/jxl/enc_color_management.h" -+#include "tools/ssimulacra2.h" -+ -+int PrintUsage(char** argv) { -+ fprintf(stderr, "Usage: %s orig.png distorted.png\n", argv[0]); -+ fprintf(stderr, -+ "Returns a score in range -inf..100, which correlates to subjective " -+ "visual quality:\n"); -+ fprintf(stderr, -+ " 30 = low quality (p10 worst output of mozjpeg -quality 30)\n"); -+ fprintf(stderr, -+ " 50 = medium quality (average output of cjxl -q 40 or mozjpeg " -+ "-quality 40,\n"); -+ fprintf(stderr, -+ " p10 output of cjxl -q 50 or mozjpeg " -+ "-quality 60)\n"); -+ fprintf(stderr, -+ " 70 = high quality (average output of cjxl -q 70 or mozjpeg " -+ "-quality 70,\n"); -+ fprintf(stderr, -+ " p10 output of cjxl -q 75 or mozjpeg " -+ "-quality 80)\n"); -+ fprintf(stderr, -+ " 90 = very high quality (impossible to distinguish from " -+ "original at 1:1,\n"); -+ fprintf(stderr, -+ " average output of cjxl -q 90 or " -+ "mozjpeg -quality 90)\n"); -+ return 1; -+} -+ -+int main(int argc, char** argv) { -+ if (argc != 3) return PrintUsage(argv); -+ -+ jxl::CodecInOut io1; -+ jxl::CodecInOut io2; -+ JXL_CHECK(SetFromFile(argv[1], jxl::extras::ColorHints(), &io1)); -+ -+ if (io1.xsize() < 8 || io1.ysize() < 8) { -+ fprintf(stderr, "Minimum image size is 8x8 pixels\n"); -+ return 1; -+ } -+ -+ JXL_CHECK(SetFromFile(argv[2], jxl::extras::ColorHints(), &io2)); -+ if (io1.xsize() != io2.xsize() || io1.ysize() != io2.ysize()) { -+ fprintf(stderr, "Image size mismatch\n"); -+ return 1; -+ } -+ -+ if (!io1.Main().HasAlpha()) { -+ Msssim msssim = ComputeSSIMULACRA2(io1.Main(), io2.Main()); -+ printf("%.8f\n", msssim.Score()); -+ } else { -+ // in case of alpha transparency: blend against dark and bright backgrounds -+ // and return the worst of both scores -+ Msssim msssim0 = ComputeSSIMULACRA2(io1.Main(), io2.Main(), 0.1f); -+ Msssim msssim1 = ComputeSSIMULACRA2(io1.Main(), io2.Main(), 0.9f); -+ printf("%.8f\n", std::min(msssim0.Score(), msssim1.Score())); -+ } -+ return 0; -+} diff --git a/873890998bb151ba54a865cdbd61df22af29774c.patch b/873890998bb151ba54a865cdbd61df22af29774c.patch deleted file mode 100644 index c98dce9..0000000 --- a/873890998bb151ba54a865cdbd61df22af29774c.patch +++ /dev/null @@ -1,234 +0,0 @@ -From 873890998bb151ba54a865cdbd61df22af29774c Mon Sep 17 00:00:00 2001 -From: Sami Boukortt -Date: Mon, 22 Aug 2022 16:08:20 +0200 -Subject: [PATCH] Tool for converting EXR images to PQ PNGs - ---- - lib/extras/dec/exr.cc | 2 +- - tools/CMakeLists.txt | 2 + - tools/hdr/README.md | 16 +++++ - tools/hdr/exr_to_pq.cc | 155 +++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 174 insertions(+), 1 deletion(-) - create mode 100644 tools/hdr/exr_to_pq.cc - -diff --git a/lib/extras/dec/exr.cc b/lib/extras/dec/exr.cc -index ddb6d534e5..e63c005628 100644 ---- a/lib/extras/dec/exr.cc -+++ b/lib/extras/dec/exr.cc -@@ -87,7 +87,7 @@ Status DecodeImageEXR(Span bytes, const ColorHints& color_hints, - - const float intensity_target = OpenEXR::hasWhiteLuminance(input.header()) - ? OpenEXR::whiteLuminance(input.header()) -- : kDefaultIntensityTarget; -+ : 0; - - auto image_size = input.displayWindow().size(); - // Size is computed as max - min, but both bounds are inclusive. -diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt -index ed773190ec..739d4bcede 100644 ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -164,6 +164,7 @@ if(JPEGXL_ENABLE_DEVTOOLS) - butteraugli_main - decode_and_encode - display_to_hlg -+ exr_to_pq - pq_to_hlg - render_hlg - tone_map -@@ -180,6 +181,7 @@ if(JPEGXL_ENABLE_DEVTOOLS) - add_executable(butteraugli_main butteraugli_main.cc) - add_executable(decode_and_encode decode_and_encode.cc) - add_executable(display_to_hlg hdr/display_to_hlg.cc) -+ add_executable(exr_to_pq hdr/exr_to_pq.cc) - add_executable(pq_to_hlg hdr/pq_to_hlg.cc) - add_executable(render_hlg hdr/render_hlg.cc) - add_executable(tone_map hdr/tone_map.cc) -diff --git a/tools/hdr/README.md b/tools/hdr/README.md -index 227b22b3e4..85eb1bd774 100644 ---- a/tools/hdr/README.md -+++ b/tools/hdr/README.md -@@ -99,6 +99,22 @@ This is the mathematical inverse of `tools/render_hlg`. Furthermore, - `tools/pq_to_hlg` is equivalent to `tools/tone_map -t 1000` followed by - `tools/display_to_hlg -m 1000`. - -+## OpenEXR to PQ -+ -+`tools/exr_to_pq` converts an OpenEXR image into a Rec. 2020 + PQ image, which -+can be saved as a PNG or PPM file. Luminance information is taken from the -+`whiteLuminance` tag if the input has it, and otherwise defaults to treating -+(1, 1, 1) as 100 cd/m². It is also possible to override this using the -+`--luminance` (`-l`) flag, in two different ways: -+ -+```shell -+# Specifies that the brightest pixel in the image happens to be 1500 cd/m². -+$ tools/exr_to_pq --luminance='max=1500' input.exr output.png -+ -+# Specifies that (1, 1, 1) in the input file is 203 cd/m². -+$ tools/exr_to_pq --luminance='white=203' input.exr output.png -+``` -+ - # LUT generation - - There are additionally two tools that can be used to generate look-up tables -diff --git a/tools/hdr/exr_to_pq.cc b/tools/hdr/exr_to_pq.cc -new file mode 100644 -index 0000000000..6162b72221 ---- /dev/null -+++ b/tools/hdr/exr_to_pq.cc -@@ -0,0 +1,155 @@ -+// Copyright (c) the JPEG XL Project Authors. All rights reserved. -+// -+// Use of this source code is governed by a BSD-style -+// license that can be found in the LICENSE file. -+ -+#include -+#include -+ -+#include "lib/extras/codec.h" -+#include "lib/extras/dec/decode.h" -+#include "lib/extras/packed_image_convert.h" -+#include "lib/jxl/base/file_io.h" -+#include "lib/jxl/base/thread_pool_internal.h" -+#include "lib/jxl/enc_color_management.h" -+#include "tools/cmdline.h" -+ -+namespace { -+ -+struct LuminanceInfo { -+ enum class Kind { kWhite, kMaximum }; -+ Kind kind = Kind::kWhite; -+ float luminance = 100.f; -+}; -+ -+bool ParseLuminanceInfo(const char* argument, LuminanceInfo* luminance_info) { -+ if (strncmp(argument, "white=", 6) == 0) { -+ luminance_info->kind = LuminanceInfo::Kind::kWhite; -+ argument += 6; -+ } else if (strncmp(argument, "max=", 4) == 0) { -+ luminance_info->kind = LuminanceInfo::Kind::kMaximum; -+ argument += 4; -+ } else { -+ fprintf(stderr, -+ "Invalid prefix for luminance info, expected white= or max=\n"); -+ return false; -+ } -+ return jpegxl::tools::ParseFloat(argument, &luminance_info->luminance); -+} -+ -+} // namespace -+ -+int main(int argc, const char** argv) { -+ jxl::ThreadPoolInternal pool; -+ -+ jpegxl::tools::CommandLineParser parser; -+ LuminanceInfo luminance_info; -+ auto luminance_option = -+ parser.AddOptionValue('l', "luminance", "", -+ "luminance information (defaults to whiteLuminance " -+ "header if present, otherwise to white=100)", -+ &luminance_info, &ParseLuminanceInfo, 0); -+ const char* input_filename = nullptr; -+ auto input_filename_option = parser.AddPositionalOption( -+ "input", true, "input image", &input_filename, 0); -+ const char* output_filename = nullptr; -+ auto output_filename_option = parser.AddPositionalOption( -+ "output", true, "output image", &output_filename, 0); -+ -+ if (!parser.Parse(argc, argv)) { -+ fprintf(stderr, "See -h for help.\n"); -+ return EXIT_FAILURE; -+ } -+ -+ if (parser.HelpFlagPassed()) { -+ parser.PrintHelp(); -+ return EXIT_SUCCESS; -+ } -+ -+ if (!parser.GetOption(input_filename_option)->matched()) { -+ fprintf(stderr, "Missing input filename.\nSee -h for help.\n"); -+ return EXIT_FAILURE; -+ } -+ if (!parser.GetOption(output_filename_option)->matched()) { -+ fprintf(stderr, "Missing output filename.\nSee -h for help.\n"); -+ return EXIT_FAILURE; -+ } -+ -+ jxl::extras::PackedPixelFile ppf; -+ std::vector input_bytes; -+ JXL_CHECK(jxl::ReadFile(input_filename, &input_bytes)); -+ JXL_CHECK(jxl::extras::DecodeBytes(jxl::Span(input_bytes), -+ jxl::extras::ColorHints(), -+ jxl::SizeConstraints(), &ppf)); -+ -+ jxl::CodecInOut image; -+ JXL_CHECK( -+ jxl::extras::ConvertPackedPixelFileToCodecInOut(ppf, &pool, &image)); -+ image.metadata.m.bit_depth.exponent_bits_per_sample = 0; -+ jxl::ColorEncoding linear_rec_2020 = image.Main().c_current(); -+ linear_rec_2020.primaries = jxl::Primaries::k2100; -+ linear_rec_2020.tf.SetTransferFunction(jxl::TransferFunction::kLinear); -+ JXL_CHECK(linear_rec_2020.CreateICC()); -+ JXL_CHECK(image.TransformTo(linear_rec_2020, jxl::GetJxlCms(), &pool)); -+ -+ float primaries_xyz[9]; -+ const jxl::PrimariesCIExy primaries = image.Main().c_current().GetPrimaries(); -+ const jxl::CIExy white_point = image.Main().c_current().GetWhitePoint(); -+ JXL_CHECK(jxl::PrimariesToXYZ(primaries.r.x, primaries.r.y, primaries.g.x, -+ primaries.g.y, primaries.b.x, primaries.b.y, -+ white_point.x, white_point.y, primaries_xyz)); -+ -+ float max_value = 0.f; -+ float max_relative_luminance = 0.f; -+ float white_luminance = ppf.info.intensity_target != 0 && -+ !parser.GetOption(luminance_option)->matched() -+ ? ppf.info.intensity_target -+ : luminance_info.kind == LuminanceInfo::Kind::kWhite -+ ? luminance_info.luminance -+ : 0.f; -+ bool out_of_gamut = false; -+ for (size_t y = 0; y < image.ysize(); ++y) { -+ const float* const rows[3] = {image.Main().color()->ConstPlaneRow(0, y), -+ image.Main().color()->ConstPlaneRow(1, y), -+ image.Main().color()->ConstPlaneRow(2, y)}; -+ for (size_t x = 0; x < image.xsize(); ++x) { -+ if (!out_of_gamut && -+ (rows[0][x] < 0 || rows[1][x] < 0 || rows[2][x] < 0)) { -+ out_of_gamut = true; -+ fprintf(stderr, -+ "WARNING: found colors outside of the Rec. 2020 gamut.\n"); -+ } -+ max_value = std::max( -+ max_value, std::max(rows[0][x], std::max(rows[1][x], rows[2][x]))); -+ const float luminance = primaries_xyz[1] * rows[0][x] + -+ primaries_xyz[4] * rows[1][x] + -+ primaries_xyz[7] * rows[2][x]; -+ if (luminance_info.kind == LuminanceInfo::Kind::kMaximum && -+ luminance > max_relative_luminance) { -+ max_relative_luminance = luminance; -+ white_luminance = luminance_info.luminance / luminance; -+ } -+ } -+ } -+ jxl::ScaleImage(1.f / max_value, image.Main().color()); -+ white_luminance *= max_value; -+ image.metadata.m.SetIntensityTarget(white_luminance); -+ if (white_luminance > 10000) { -+ fprintf(stderr, -+ "WARNING: the image is too bright for PQ (would need (1, 1, 1) to " -+ "be %g cd/m^2).\n", -+ white_luminance); -+ } else { -+ fprintf(stderr, -+ "The resulting image should be compressed with " -+ "--intensity_target=%g.\n", -+ white_luminance); -+ } -+ -+ jxl::ColorEncoding pq = image.Main().c_current(); -+ pq.tf.SetTransferFunction(jxl::TransferFunction::kPQ); -+ JXL_CHECK(pq.CreateICC()); -+ JXL_CHECK(image.TransformTo(pq, jxl::GetJxlCms(), &pool)); -+ image.metadata.m.color_encoding = pq; -+ JXL_CHECK(jxl::EncodeToFile(image, output_filename, &pool)); -+} diff --git a/jpegxl.spec b/jpegxl.spec index aca784a..fe257f7 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -3,9 +3,9 @@ # Uncomment for special build to rebuild aom on bumped soname. -# %%global new_soname 0 -%global sover_old 0.6 -%global sover 0.7 +%global new_soname 1 +%global sover_old 0.7 +%global sover 0.8 %global gdk_pixbuf_moduledir $(pkgconf gdk-pixbuf-2.0 --variable=gdk_pixbuf_moduledir) @@ -20,7 +20,7 @@ decoder).} Name: jpegxl Epoch: 1 -Version: 0.7.0 +Version: 0.8.1 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation @@ -32,10 +32,6 @@ License: BSD-3-Clause AND Apache-2.0 AND Zlib URL: https://jpeg.org/jpegxl/ VCS: https://github.com/libjxl/libjxl Source0: %vcs/archive/v%{version}/%{name}-%{version}.tar.gz -# exr_to_pq -Patch0: https://github.com/libjxl/libjxl/commit/873890998bb151ba54a865cdbd61df22af29774c.patch -# Ssimulacra 2 -Patch1: https://github.com/libjxl/libjxl/commit/795b363120bbcfdbb2e2e4fa85146ac6d385137d.patch # git clone https://github.com/libjxl/libjxl # cd libjxl/ @@ -76,7 +72,7 @@ BuildRequires: pkgconfig(zlib) # epel 8 need this other already have it BuildRequires: python3-devel %if 0%{?new_soname} -BuildRequires: libjxl < %{version} +BuildRequires: libjxl < %{epoch}:%{version} %endif # No official release diff --git a/sources b/sources index 83d42db..ab27358 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (jpegxl-0.7.0.tar.gz) = c73039606acf7b2cbc331c6787af5167d711fd1af22bc616e1f478c531b087da82c98f2cb7e88c4d1f8bcfdc4e053ae0dc99cc9a811545b7f9658041489ed04b -SHA512 (third_party-0.7.0.tar.gz) = 9aeace0c7252e75fcd17bb8f00c28bfda893aa3e59c4b3dbdb43b95bd3ca7eea3f2e465fe09469c2528ca4efa4e6f8f0884c6c028442f091105b17afded620e6 +SHA512 (jpegxl-0.8.1.tar.gz) = 8011f2181cb627c2b516c7e1b8ecec78a201f357f3be6e568f7814a6a9c42d5979f4bb4ed040a67d68f6649d1f5c564f3cb2fac7e52702f755749084d903a737 +SHA512 (third_party-0.8.1.tar.gz) = d0328643296aaa3bb7d10589f9ec23fce4b54b00285a86b55e83a8939c16207e59acbf0591f7deedf364c2fb4cad93f47c65b995a41edc9916afba6f19033a79 diff --git a/update_third_party.sh b/update_third_party.sh new file mode 100755 index 0000000..d1454ae --- /dev/null +++ b/update_third_party.sh @@ -0,0 +1,15 @@ +VERSION=0.8.1 + +if [ ! -d libjxl ]; then +git clone https://github.com/libjxl/libjxl +fi +cd libjxl/ +git checkout . +git checkout v${VERSION} +git submodule init ; git submodule update +git pull +rm -r third_party/brotli/ third_party/googletest/ +rm -r third_party/HEVCSoftware/ third_party/highway/ +rm -r third_party/lcms/ third_party/libpng/ +rm -r third_party/skcms/profiles/ third_party/zlib +tar -zcvf ../third_party-${VERSION}.tar.gz third_party/ From ab2f57e8882635f3345d112f7849d666c9661cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Sun, 18 Jun 2023 21:29:03 +0100 Subject: [PATCH 15/43] unbootrap soname --- jpegxl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jpegxl.spec b/jpegxl.spec index fe257f7..b005a3c 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -3,7 +3,7 @@ # Uncomment for special build to rebuild aom on bumped soname. -%global new_soname 1 +#global new_soname 1 %global sover_old 0.7 %global sover 0.8 From c16b67d62253d9621308e01fba24367c065dd18b Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 19 Jun 2023 22:52:54 -0400 Subject: [PATCH 16/43] Disable unused Qt5 build dependencies Qt5 is only used to build the viewers, which are not enabled in the cmake command line. --- jpegxl.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jpegxl.spec b/jpegxl.spec index b005a3c..8fe34f0 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -66,8 +66,11 @@ BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(libpng) BuildRequires: pkgconfig(libwebp) BuildRequires: pkgconfig(OpenEXR) +%if 0 +# viewers are not built BuildRequires: pkgconfig(Qt5) BuildRequires: pkgconfig(Qt5X11Extras) +%endif BuildRequires: pkgconfig(zlib) # epel 8 need this other already have it BuildRequires: python3-devel From 6a5bd4a235c79a5c9ce851260bc09c3841d9d248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Thu, 22 Jun 2023 20:44:09 +0100 Subject: [PATCH 17/43] Update jpegxl to 0.8.2 --- .gitignore | 2 ++ jpegxl.spec | 12 ++---------- sources | 4 ++-- update_third_party.sh | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index eb6c37c..cac3f58 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ /third_party-0.7.0.tar.gz /jpegxl-0.8.1.tar.gz /third_party-0.8.1.tar.gz +/jpegxl-0.8.2.tar.gz +/third_party-0.8.2.tar.gz diff --git a/jpegxl.spec b/jpegxl.spec index 8fe34f0..c0ddbbb 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -20,7 +20,7 @@ decoder).} Name: jpegxl Epoch: 1 -Version: 0.8.1 +Version: 0.8.2 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation @@ -33,15 +33,7 @@ URL: https://jpeg.org/jpegxl/ VCS: https://github.com/libjxl/libjxl Source0: %vcs/archive/v%{version}/%{name}-%{version}.tar.gz -# git clone https://github.com/libjxl/libjxl -# cd libjxl/ -# git checkout v%%{version} -# git submodule init ; git submodule update -# rm -r third_party/brotli/ third_party/googletest/ -# rm -r third_party/HEVCSoftware/ third_party/highway/ -# rm -r third_party/lcms/ third_party/libpng/ -# rm -r third_party/skcms/profiles/ third_party/zlib -# tar -zcvf ../third_party-%%{version}.tar.gz third_party/ +# set VERSION and run ./update_third_party.sh to get Source1 Source1: third_party-%{version}.tar.gz BuildRequires: asciidoc diff --git a/sources b/sources index ab27358..91cd511 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (jpegxl-0.8.1.tar.gz) = 8011f2181cb627c2b516c7e1b8ecec78a201f357f3be6e568f7814a6a9c42d5979f4bb4ed040a67d68f6649d1f5c564f3cb2fac7e52702f755749084d903a737 -SHA512 (third_party-0.8.1.tar.gz) = d0328643296aaa3bb7d10589f9ec23fce4b54b00285a86b55e83a8939c16207e59acbf0591f7deedf364c2fb4cad93f47c65b995a41edc9916afba6f19033a79 +SHA512 (jpegxl-0.8.2.tar.gz) = 769f102c46755d11a705ce47ae9e2ef49627ae708f416693bf1293aeeb713934baf4466e45b9c70b04ec1fc8b4a00d5ca7688c8ca03f0a91c9a15252c522a887 +SHA512 (third_party-0.8.2.tar.gz) = 74f536c19d38b413bbca0988d8b36aae73110af3b19b78932309fa1892f99f0cc4984cbc4d96dde0716ee993c62f14464a639f8f0a4907c0e6f5ad37b1228816 diff --git a/update_third_party.sh b/update_third_party.sh index d1454ae..23411ab 100755 --- a/update_third_party.sh +++ b/update_third_party.sh @@ -1,4 +1,4 @@ -VERSION=0.8.1 +VERSION=0.8.2 if [ ! -d libjxl ]; then git clone https://github.com/libjxl/libjxl From eb58e81e200bc600336dede5568525b98a1c7a3f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jul 2023 08:10:40 +0000 Subject: [PATCH 18/43] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering From abc05881f43a5980daaf6e5524ad6253fcf6ad9e Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 2 Aug 2023 23:36:58 -0400 Subject: [PATCH 19/43] Drop unused build dependencies ECM is only needed in conjunction with Qt5 for the viewers, (free)glut is needed only for sjpeg examples, and libwebp only for jpegxl benchmark tools, none of which are built. --- jpegxl.spec | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/jpegxl.spec b/jpegxl.spec index c0ddbbb..2617bf7 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -39,7 +39,6 @@ Source1: third_party-%{version}.tar.gz BuildRequires: asciidoc BuildRequires: cmake BuildRequires: doxygen -BuildRequires: extra-cmake-modules BuildRequires: gcc-c++ BuildRequires: giflib-devel %if %{with tcmalloc} @@ -49,20 +48,21 @@ BuildRequires: ninja-build %if %{with gimp_plugin} BuildRequires: pkgconfig(gimp-2.0) %endif -BuildRequires: (pkgconfig(glut) or pkgconfig(freeglut)) +## sjpeg examples are not built +#BuildRequires: (pkgconfig(glut) or pkgconfig(freeglut)) BuildRequires: gtest-devel BuildRequires: gflags-devel BuildRequires: pkgconfig(libhwy) BuildRequires: pkgconfig(libbrotlicommon) BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(libpng) -BuildRequires: pkgconfig(libwebp) +## benchmark tools are not built +#BuildRequires: pkgconfig(libwebp) BuildRequires: pkgconfig(OpenEXR) -%if 0 -# viewers are not built -BuildRequires: pkgconfig(Qt5) -BuildRequires: pkgconfig(Qt5X11Extras) -%endif +## viewers are not built +#BuildRequires: extra-cmake-modules +#BuildRequires: pkgconfig(Qt5) +#BuildRequires: pkgconfig(Qt5X11Extras) BuildRequires: pkgconfig(zlib) # epel 8 need this other already have it BuildRequires: python3-devel From 6909d270e10284d9002d5394e8b3c42f215a695f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 20 Jan 2024 23:46:05 +0000 Subject: [PATCH 20/43] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From bf363763c4a00645a5a23ba2d39bad49ae6af77b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 24 Jan 2024 23:26:00 +0000 Subject: [PATCH 21/43] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 9072eb333c440b558edb3ffdddc5261c8429e1df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Wed, 14 Feb 2024 00:57:16 +0000 Subject: [PATCH 22/43] bootstrap 0.9.2 to build aom --- .gitignore | 2 ++ jpegxl.spec | 25 ++++++++++++++++--------- sources | 4 ++-- update_third_party.sh | 2 +- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index cac3f58..3228965 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ /third_party-0.8.1.tar.gz /jpegxl-0.8.2.tar.gz /third_party-0.8.2.tar.gz +/jpegxl-0.9.2.tar.gz +/third_party-0.9.2.tar.gz diff --git a/jpegxl.spec b/jpegxl.spec index 2617bf7..67d9f98 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -3,9 +3,9 @@ # Uncomment for special build to rebuild aom on bumped soname. -#global new_soname 1 -%global sover_old 0.7 -%global sover 0.8 +%global new_soname 1 +%global sover_old 0.8 +%global sover 0.9 %global gdk_pixbuf_moduledir $(pkgconf gdk-pixbuf-2.0 --variable=gdk_pixbuf_moduledir) @@ -20,7 +20,7 @@ decoder).} Name: jpegxl Epoch: 1 -Version: 0.8.2 +Version: 0.9.2 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation @@ -30,8 +30,7 @@ Summary: JPEG XL image format reference implementation # skcms: BSD License: BSD-3-Clause AND Apache-2.0 AND Zlib URL: https://jpeg.org/jpegxl/ -VCS: https://github.com/libjxl/libjxl -Source0: %vcs/archive/v%{version}/%{name}-%{version}.tar.gz +Source0: https://github.com/libjxl/libjxl/archive/v%{version}/%{name}-%{version}.tar.gz # set VERSION and run ./update_third_party.sh to get Source1 Source1: third_party-%{version}.tar.gz @@ -169,7 +168,7 @@ rm -rf third_party/ %install %cmake_install -rm -v %{buildroot}%{_libdir}/*.a +#rm -v %{buildroot}%{_libdir}/*.a %if 0%{?new_soname} cp -p %{_libdir}/libjxl.so.%{sover_old}* \ @@ -181,13 +180,15 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %doc CONTRIBUTING.md CONTRIBUTORS README.md %{_bindir}/cjxl %{_bindir}/djxl -%{_bindir}/cjpeg_hdr +%{_bindir}/cjpegli +%{_bindir}/djpegli %{_bindir}/jxlinfo %{_mandir}/man1/cjxl.1* %{_mandir}/man1/djxl.1* %files -n libjxl-devtools -%{_bindir}/fuzzer_corpus +%{_bindir}/djxl_fuzzer_corpus +%{_bindir}/jpegli_dec_fuzzer_corpus %{_bindir}/butteraugli_main %{_bindir}/decode_and_encode %{_bindir}/display_to_hlg @@ -201,6 +202,7 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %{_bindir}/ssimulacra2 %{_bindir}/xyb_range %{_bindir}/jxl_from_tree +%{_bindir}/local_tone_map %files doc %doc doc/*.md @@ -211,6 +213,8 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %license LICENSE %{_libdir}/libjxl.so.%{sover}* %{_libdir}/libjxl_threads.so.%{sover}* +%{_libdir}/libjxl_cms.so.%{sover}* +%{_libdir}/libjxl_extras_codec.so.%{sover}* %if 0%{?new_soname} %{_libdir}/libjxl.so.%{sover_old}* %{_libdir}/libjxl_threads.so.%{sover_old}* @@ -224,8 +228,11 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %{_includedir}/jxl/ %{_libdir}/libjxl.so %{_libdir}/libjxl_threads.so +%{_libdir}/libjxl_cms.so +%{_libdir}/libjxl_extras_codec.so %{_libdir}/pkgconfig/libjxl.pc %{_libdir}/pkgconfig/libjxl_threads.pc +%{_libdir}/pkgconfig/libjxl_cms.pc %files -n jxl-pixbuf-loader %license LICENSE diff --git a/sources b/sources index 91cd511..c223f54 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (jpegxl-0.8.2.tar.gz) = 769f102c46755d11a705ce47ae9e2ef49627ae708f416693bf1293aeeb713934baf4466e45b9c70b04ec1fc8b4a00d5ca7688c8ca03f0a91c9a15252c522a887 -SHA512 (third_party-0.8.2.tar.gz) = 74f536c19d38b413bbca0988d8b36aae73110af3b19b78932309fa1892f99f0cc4984cbc4d96dde0716ee993c62f14464a639f8f0a4907c0e6f5ad37b1228816 +SHA512 (jpegxl-0.9.2.tar.gz) = 97bc0ccd249fe0fa6d0f52c470a0d0bd181e3f00cd9820dda5ca437dff260e6c9e2c95dceec4bd9354c3adc4fc6724228cb027c537af6df7d3f90ab8ee61653f +SHA512 (third_party-0.9.2.tar.gz) = 756047cd8146e26f52ec002cdf49f335a62fd7df95ffc32bd0c1be03c24aebcef1c42b83a26144cadd3b51494ed620656cd9af356904275e3c234385972b32b9 diff --git a/update_third_party.sh b/update_third_party.sh index 23411ab..bf81fac 100755 --- a/update_third_party.sh +++ b/update_third_party.sh @@ -1,4 +1,4 @@ -VERSION=0.8.2 +VERSION=0.9.2 if [ ! -d libjxl ]; then git clone https://github.com/libjxl/libjxl From 4eb04f897e40e0b6048d7224071de0f5e6f4fe2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Wed, 14 Feb 2024 02:09:43 +0000 Subject: [PATCH 23/43] un-bootstrap jpegxl --- jpegxl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jpegxl.spec b/jpegxl.spec index 67d9f98..bf1abae 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -3,7 +3,7 @@ # Uncomment for special build to rebuild aom on bumped soname. -%global new_soname 1 +#global new_soname 1 %global sover_old 0.8 %global sover 0.9 From 0c6ab9af7dd6533660958eed0340f39db620518d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Wed, 13 Mar 2024 00:33:00 +0000 Subject: [PATCH 24/43] bootstrap 0.10.2 to start soname bump of jpegxl --- .gitignore | 2 ++ jpegxl.spec | 8 ++++---- sources | 4 ++-- update_third_party.sh | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 3228965..6d66d1a 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ /third_party-0.8.2.tar.gz /jpegxl-0.9.2.tar.gz /third_party-0.9.2.tar.gz +/jpegxl-0.10.2.tar.gz +/third_party-0.10.2.tar.gz diff --git a/jpegxl.spec b/jpegxl.spec index bf1abae..9f996dc 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -3,9 +3,9 @@ # Uncomment for special build to rebuild aom on bumped soname. -#global new_soname 1 +%global new_soname 1 %global sover_old 0.8 -%global sover 0.9 +%global sover 0.10 %global gdk_pixbuf_moduledir $(pkgconf gdk-pixbuf-2.0 --variable=gdk_pixbuf_moduledir) @@ -20,7 +20,7 @@ decoder).} Name: jpegxl Epoch: 1 -Version: 0.9.2 +Version: 0.10.2 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation @@ -221,7 +221,7 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %endif %dir %{_datadir}/thumbnailers %{_datadir}/thumbnailers/jxl.thumbnailer -%{_datadir}/mime/packages/image-jxl.xml +#%%{_datadir}/mime/packages/image-jxl.xml %files -n libjxl-devel %doc CONTRIBUTING.md diff --git a/sources b/sources index c223f54..eb943d5 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (jpegxl-0.9.2.tar.gz) = 97bc0ccd249fe0fa6d0f52c470a0d0bd181e3f00cd9820dda5ca437dff260e6c9e2c95dceec4bd9354c3adc4fc6724228cb027c537af6df7d3f90ab8ee61653f -SHA512 (third_party-0.9.2.tar.gz) = 756047cd8146e26f52ec002cdf49f335a62fd7df95ffc32bd0c1be03c24aebcef1c42b83a26144cadd3b51494ed620656cd9af356904275e3c234385972b32b9 +SHA512 (jpegxl-0.10.2.tar.gz) = 1d19f30c0ae94e212326a15dc128612bce207e619c55c2a020401a27d01a933de71bb35e907521dc8fd853dd5578d74d74f7a5a282f0083fd22cf9cb07ccb96e +SHA512 (third_party-0.10.2.tar.gz) = 88abdacdd39ed0442c86d59e44b6a3aa154ee7e559a3c5cb390f2851c876621c6fc4d1ff3ad300c4d04f89e972c2adb598bf45f90bd9851c6760fdc7497d71d7 diff --git a/update_third_party.sh b/update_third_party.sh index bf81fac..197ed19 100755 --- a/update_third_party.sh +++ b/update_third_party.sh @@ -1,4 +1,4 @@ -VERSION=0.9.2 +VERSION=0.10.2 if [ ! -d libjxl ]; then git clone https://github.com/libjxl/libjxl From 31a7d99680d6b9298039a1f9ffb7becd86cd91d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Wed, 13 Mar 2024 01:12:53 +0000 Subject: [PATCH 25/43] fix the build --- jpegxl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jpegxl.spec b/jpegxl.spec index 9f996dc..3c70f24 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -221,7 +221,7 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %endif %dir %{_datadir}/thumbnailers %{_datadir}/thumbnailers/jxl.thumbnailer -#%%{_datadir}/mime/packages/image-jxl.xml +%{_datadir}/mime/packages/image-jxl.xml %files -n libjxl-devel %doc CONTRIBUTING.md From a0530bedafc13a7c24cf15ccaf882fbb06698b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Mon, 25 Mar 2024 16:34:14 +0000 Subject: [PATCH 26/43] un-bootstrap --- jpegxl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jpegxl.spec b/jpegxl.spec index 3c70f24..d710aae 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -3,7 +3,7 @@ # Uncomment for special build to rebuild aom on bumped soname. -%global new_soname 1 +#%%global new_soname 1 %global sover_old 0.8 %global sover 0.10 From 2a68871b2c4c60f85f3886c62e05bb62b2e6835f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Thu, 18 Apr 2024 00:16:05 +0100 Subject: [PATCH 27/43] BR pkgconfig(lcms2) directly to fix build on eln --- jpegxl.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/jpegxl.spec b/jpegxl.spec index d710aae..5436d3f 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -53,6 +53,7 @@ BuildRequires: gtest-devel BuildRequires: gflags-devel BuildRequires: pkgconfig(libhwy) BuildRequires: pkgconfig(libbrotlicommon) +BuildRequires: pkgconfig(lcms2) BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(libpng) ## benchmark tools are not built From a0c453281b74672b36405b6107f25137d5b8af89 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Tue, 23 Apr 2024 08:00:07 -0600 Subject: [PATCH 28/43] Rebuild for openexr 3.2.4 From 1def8f6932bb3775dbdbf18781a50a91a81ca407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Sat, 6 Jul 2024 16:18:34 +0100 Subject: [PATCH 29/43] Configure Packit for release automation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using same logic of https://src.fedoraproject.org/rpms/opencv/pull-request/28 by Laura Barcziová --- .packit.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .packit.yaml diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 0000000..cd9ebce --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,17 @@ +# See the documentation for more information: +# https://packit.dev/docs/configuration/ + +upstream_project_url: https://github.com/libjxl/libjxl +upstream_tag_template: v{version} + +# run opencv-clean.sh +# the sed currently hacks the script so that the version is correctly set and the sources upload is handled by Packit +actions: + pre-sync: + - bash -c "cd ${PACKIT_DOWNSTREAM_REPO}; sed '1d' ./update_third_party.sh | VERSION=${PACKIT_PROJECT_VERSION} bash" + +jobs: + - job: pull_from_upstream + trigger: release + dist_git_branches: + - fedora-rawhide From 58fa8f975837dd29044517ed0ce5c6c8c74202c9 Mon Sep 17 00:00:00 2001 From: Packit Date: Sun, 7 Jul 2024 01:01:33 +0000 Subject: [PATCH 30/43] Update to 0.10.3 upstream release - Resolves: rhbz#2295526 Upstream tag: v0.10.3 Upstream commit: 4a3b22d2 Commit authored by Packit automation (https://packit.dev/) --- .gitignore | 2 ++ README.packit | 3 +++ jpegxl.spec | 2 +- sources | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 README.packit diff --git a/.gitignore b/.gitignore index 6d66d1a..8fa24e7 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ /third_party-0.9.2.tar.gz /jpegxl-0.10.2.tar.gz /third_party-0.10.2.tar.gz +/jpegxl-0.10.3.tar.gz +/third_party-0.10.3.tar.gz diff --git a/README.packit b/README.packit new file mode 100644 index 0000000..f2be23e --- /dev/null +++ b/README.packit @@ -0,0 +1,3 @@ +This repository is maintained by packit. +https://packit.dev/ +The file was generated using packit 0.97.3.post1.dev7+g1954e49a. diff --git a/jpegxl.spec b/jpegxl.spec index 5436d3f..9741c07 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -20,7 +20,7 @@ decoder).} Name: jpegxl Epoch: 1 -Version: 0.10.2 +Version: 0.10.3 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation diff --git a/sources b/sources index eb943d5..c47dbc9 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (jpegxl-0.10.2.tar.gz) = 1d19f30c0ae94e212326a15dc128612bce207e619c55c2a020401a27d01a933de71bb35e907521dc8fd853dd5578d74d74f7a5a282f0083fd22cf9cb07ccb96e -SHA512 (third_party-0.10.2.tar.gz) = 88abdacdd39ed0442c86d59e44b6a3aa154ee7e559a3c5cb390f2851c876621c6fc4d1ff3ad300c4d04f89e972c2adb598bf45f90bd9851c6760fdc7497d71d7 +SHA512 (jpegxl-0.10.3.tar.gz) = 5ece482f4c5f0312e87e020f921525622a6d3f1a3834f3cd8666638fc8d0fba8cd072ef58f7b153dc17ca19071ebae2fbad7b08e6d440c2669f4f1b35888a7d4 +SHA512 (third_party-0.10.3.tar.gz) = 94786cd2a535bd9da816b7155414c512228b7a8f70b5d52dc74b7e0d41de6b3d88cd1c99b2859ebb55fd237156edbb7f8a9bf3969b368f982f1037a24b613db5 From 194e176568e982ee7b10e3121b467893e8b0aae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Sun, 7 Jul 2024 04:11:05 +0100 Subject: [PATCH 31/43] Fix generation of third_party sources --- sources | 2 +- update_third_party.sh | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sources b/sources index c47dbc9..ca7d7e1 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ SHA512 (jpegxl-0.10.3.tar.gz) = 5ece482f4c5f0312e87e020f921525622a6d3f1a3834f3cd8666638fc8d0fba8cd072ef58f7b153dc17ca19071ebae2fbad7b08e6d440c2669f4f1b35888a7d4 -SHA512 (third_party-0.10.3.tar.gz) = 94786cd2a535bd9da816b7155414c512228b7a8f70b5d52dc74b7e0d41de6b3d88cd1c99b2859ebb55fd237156edbb7f8a9bf3969b368f982f1037a24b613db5 +SHA512 (third_party-0.10.3.tar.gz) = 4f7e22ab2240c49bece7056fc2216662d70c3cbc7eca5b60684eafee68a3fd0f9bdf1dddaaff0eb1c095c545f55fbfd294e49adde2b5846c47661c5b9f86db6d diff --git a/update_third_party.sh b/update_third_party.sh index 197ed19..40af41b 100755 --- a/update_third_party.sh +++ b/update_third_party.sh @@ -1,15 +1,18 @@ -VERSION=0.10.2 +VERSION=0.10.3 -if [ ! -d libjxl ]; then git clone https://github.com/libjxl/libjxl -fi cd libjxl/ git checkout . git checkout v${VERSION} -git submodule init ; git submodule update -git pull -rm -r third_party/brotli/ third_party/googletest/ -rm -r third_party/HEVCSoftware/ third_party/highway/ -rm -r third_party/lcms/ third_party/libpng/ -rm -r third_party/skcms/profiles/ third_party/zlib -tar -zcvf ../third_party-${VERSION}.tar.gz third_party/ +./deps.sh +rm -r third_party/brotli/ +rm -r third_party/googletest/ +rm -r third_party/HEVCSoftware/ +rm -r third_party/highway/ +rm -r third_party/lcms/ +rm -r third_party/libpng/ +rm -r third_party/skcms/profiles/ +rm -r third_party/zlib +tar -zcf ../third_party-${VERSION}.tar.gz third_party/ +cd .. +rm -rf libjxl/ From 19f643135c6ca39617c1f5fbd89b2f4b7bc100b2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 18 Jul 2024 11:07:33 +0000 Subject: [PATCH 32/43] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From e87d18bbd6054e7190ce9a6db25aa8dbd3c99563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Thu, 19 Sep 2024 01:15:02 +0100 Subject: [PATCH 33/43] Disable gimp_plugin, jpegxl don't support Gimp 3 yet --- jpegxl.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jpegxl.spec b/jpegxl.spec index 9741c07..6786895 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -9,8 +9,8 @@ %global gdk_pixbuf_moduledir $(pkgconf gdk-pixbuf-2.0 --variable=gdk_pixbuf_moduledir) +%bcond_with gimp_plugin %if 0%{?fedora} -%bcond_without gimp_plugin %bcond_without tcmalloc %endif @@ -45,7 +45,7 @@ BuildRequires: gperftools-devel %endif BuildRequires: ninja-build %if %{with gimp_plugin} -BuildRequires: pkgconfig(gimp-2.0) +BuildRequires: pkgconfig(gimp-3.0) %endif ## sjpeg examples are not built #BuildRequires: (pkgconfig(glut) or pkgconfig(freeglut)) From 33965822fb52c8e6565a4c6a20b141c326f80312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Tue, 29 Oct 2024 22:57:23 +0000 Subject: [PATCH 34/43] Fix upgrade path Resolves: rhbz#2322528 --- jpegxl.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jpegxl.spec b/jpegxl.spec index 6786895..4f32399 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -112,6 +112,9 @@ Requires: shared-mime-info Recommends: jxl-pixbuf-loader = %{epoch}:%{version}-%{release} Provides: jpegxl-libs = %{epoch}:%{version}-%{release} Obsoletes: jpegxl-libs < 0.3.7-5 +%if %{without gimp_plugin} +Obsoletes: gimp-jxl-plugin < 1:0.10.3-4 +%endif %description -n libjxl %{common_description} From 88ff0faff837d347d985db210833727230c2688b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jan 2025 08:00:14 +0000 Subject: [PATCH 35/43] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 94959b88d34f054bc335e7ad70ab1d71f9a21546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Thu, 30 Jan 2025 23:12:19 +0000 Subject: [PATCH 36/43] Update jpegxl to 0.10.4 --- .gitignore | 2 ++ jpegxl.spec | 2 +- sources | 4 ++-- update_third_party.sh | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 8fa24e7..ef88f15 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ /third_party-0.10.2.tar.gz /jpegxl-0.10.3.tar.gz /third_party-0.10.3.tar.gz +/jpegxl-0.10.4.tar.gz +/third_party-0.10.4.tar.gz diff --git a/jpegxl.spec b/jpegxl.spec index 4f32399..459c5a8 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -20,7 +20,7 @@ decoder).} Name: jpegxl Epoch: 1 -Version: 0.10.3 +Version: 0.10.4 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation diff --git a/sources b/sources index ca7d7e1..0c559aa 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (jpegxl-0.10.3.tar.gz) = 5ece482f4c5f0312e87e020f921525622a6d3f1a3834f3cd8666638fc8d0fba8cd072ef58f7b153dc17ca19071ebae2fbad7b08e6d440c2669f4f1b35888a7d4 -SHA512 (third_party-0.10.3.tar.gz) = 4f7e22ab2240c49bece7056fc2216662d70c3cbc7eca5b60684eafee68a3fd0f9bdf1dddaaff0eb1c095c545f55fbfd294e49adde2b5846c47661c5b9f86db6d +SHA512 (jpegxl-0.10.4.tar.gz) = db713ec5627ce66750209b7a62345ba0fa74568bbf43627fe86053aa70295a9b7ba738dac34c5449bb258c99909a19416465a971447ebb28c69514c65f0b9295 +SHA512 (third_party-0.10.4.tar.gz) = f8e4d1f26182244943e3735f650670caf00bf6c58709658f642004cc27632d585c6988816ac1eb455bbb86a6c80235fbc3273a61018f85b4bc65382972ef07ad diff --git a/update_third_party.sh b/update_third_party.sh index 40af41b..a9bfd32 100755 --- a/update_third_party.sh +++ b/update_third_party.sh @@ -1,4 +1,4 @@ -VERSION=0.10.3 +VERSION=0.10.4 git clone https://github.com/libjxl/libjxl cd libjxl/ From 2e24065015889667c48d8df0412adf23aaa5fb9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Sun, 2 Feb 2025 16:39:23 +0000 Subject: [PATCH 37/43] Update to 0.11.1 upstream release - Resolves: rhbz#2312322 Upstream tag: v0.11.1 Upstream commit: 794a5dcf Commit authored by Packit automation (https://packit.dev/) --- .gitignore | 4 ++-- README.packit | 2 +- jpegxl.spec | 21 ++++++++++----------- sources | 4 ++-- update_third_party.sh | 19 ++++++++++--------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index ef88f15..f95e8ed 100644 --- a/.gitignore +++ b/.gitignore @@ -20,5 +20,5 @@ /third_party-0.10.2.tar.gz /jpegxl-0.10.3.tar.gz /third_party-0.10.3.tar.gz -/jpegxl-0.10.4.tar.gz -/third_party-0.10.4.tar.gz +/jpegxl-0.11.1.tar.gz +/third_party-0.11.1.tar.gz diff --git a/README.packit b/README.packit index f2be23e..fafa6eb 100644 --- a/README.packit +++ b/README.packit @@ -1,3 +1,3 @@ This repository is maintained by packit. https://packit.dev/ -The file was generated using packit 0.97.3.post1.dev7+g1954e49a. +The file was generated using packit 0.104.1. diff --git a/jpegxl.spec b/jpegxl.spec index 459c5a8..0ae018d 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -3,9 +3,9 @@ # Uncomment for special build to rebuild aom on bumped soname. -#%%global new_soname 1 -%global sover_old 0.8 -%global sover 0.10 +%global new_soname 1 +%global sover_old 0.10 +%global sover 0.11 %global gdk_pixbuf_moduledir $(pkgconf gdk-pixbuf-2.0 --variable=gdk_pixbuf_moduledir) @@ -20,7 +20,7 @@ decoder).} Name: jpegxl Epoch: 1 -Version: 0.10.4 +Version: 0.11.1 Release: %autorelease %{?new_soname:-p -e 0~sonamebump} Summary: JPEG XL image format reference implementation @@ -71,9 +71,9 @@ BuildRequires: libjxl < %{epoch}:%{version} %endif # No official release -Provides: bundled(sjpeg) = 0-0.1.20210522git868ab55 +Provides: bundled(sjpeg) = 0-0.1.20230608gite5ab130 # Build system is Bazel, which is not packaged by Fedora -Provides: bundled(skcms) = 0-0.1.20210522git6437475 +Provides: bundled(skcms) = 0-0.1.20240122git51b7f2a %description %common_description @@ -177,6 +177,7 @@ rm -rf third_party/ %if 0%{?new_soname} cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %{_libdir}/libjxl_threads.so.%{sover_old}* \ + %{_libdir}/libjxl_cms.so.%{sover_old}* \ %{buildroot}%{_libdir} %endif @@ -184,19 +185,17 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %doc CONTRIBUTING.md CONTRIBUTORS README.md %{_bindir}/cjxl %{_bindir}/djxl -%{_bindir}/cjpegli -%{_bindir}/djpegli %{_bindir}/jxlinfo %{_mandir}/man1/cjxl.1* %{_mandir}/man1/djxl.1* %files -n libjxl-devtools %{_bindir}/djxl_fuzzer_corpus -%{_bindir}/jpegli_dec_fuzzer_corpus %{_bindir}/butteraugli_main %{_bindir}/decode_and_encode %{_bindir}/display_to_hlg %{_bindir}/exr_to_pq +%{_bindir}/icc_simplify %{_bindir}/pq_to_hlg %{_bindir}/render_hlg %{_bindir}/tone_map @@ -218,10 +217,10 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %{_libdir}/libjxl.so.%{sover}* %{_libdir}/libjxl_threads.so.%{sover}* %{_libdir}/libjxl_cms.so.%{sover}* -%{_libdir}/libjxl_extras_codec.so.%{sover}* %if 0%{?new_soname} %{_libdir}/libjxl.so.%{sover_old}* %{_libdir}/libjxl_threads.so.%{sover_old}* +%{_libdir}/libjxl_cms.so.%{sover_old}* %endif %dir %{_datadir}/thumbnailers %{_datadir}/thumbnailers/jxl.thumbnailer @@ -233,7 +232,7 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %{_libdir}/libjxl.so %{_libdir}/libjxl_threads.so %{_libdir}/libjxl_cms.so -%{_libdir}/libjxl_extras_codec.so +%{_libdir}/libjxl_extras_codec.a %{_libdir}/pkgconfig/libjxl.pc %{_libdir}/pkgconfig/libjxl_threads.pc %{_libdir}/pkgconfig/libjxl_cms.pc diff --git a/sources b/sources index 0c559aa..7d1c479 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (jpegxl-0.10.4.tar.gz) = db713ec5627ce66750209b7a62345ba0fa74568bbf43627fe86053aa70295a9b7ba738dac34c5449bb258c99909a19416465a971447ebb28c69514c65f0b9295 -SHA512 (third_party-0.10.4.tar.gz) = f8e4d1f26182244943e3735f650670caf00bf6c58709658f642004cc27632d585c6988816ac1eb455bbb86a6c80235fbc3273a61018f85b4bc65382972ef07ad +SHA512 (jpegxl-0.11.1.tar.gz) = 0cfd81d9d3b783f96bd04f244d73ffbc12186c89993d46064a2751bef0a446a5e86be05add5c10f60d4482d39333d9bf3f9a866d6eb84f8fa0d4e8b5828fd74c +SHA512 (third_party-0.11.1.tar.gz) = f76e20360594e010f1a04e5522e879f65d0360bc31cda21a724f8f4d65668eed276890f6187acef43fafe939c67a080251f1d4bdcb05f21c3ac9957afdef0a7b diff --git a/update_third_party.sh b/update_third_party.sh index a9bfd32..ab8f567 100755 --- a/update_third_party.sh +++ b/update_third_party.sh @@ -1,18 +1,19 @@ -VERSION=0.10.4 +VERSION=0.11.1 git clone https://github.com/libjxl/libjxl cd libjxl/ git checkout . git checkout v${VERSION} ./deps.sh -rm -r third_party/brotli/ -rm -r third_party/googletest/ -rm -r third_party/HEVCSoftware/ -rm -r third_party/highway/ -rm -r third_party/lcms/ -rm -r third_party/libpng/ -rm -r third_party/skcms/profiles/ -rm -r third_party/zlib +rm -rvf third_party/brotli/ +rm -rvf third_party/googletest/ +rm -rvf third_party/HEVCSoftware/ +rm -rvf third_party/highway/ +rm -rvf third_party/lcms/ +rm -rvf third_party/libjpeg-turbo +rm -rvf third_party/libpng/ +rm -rvf third_party/skcms/profiles/ +rm -rvf third_party/zlib tar -zcf ../third_party-${VERSION}.tar.gz third_party/ cd .. rm -rf libjxl/ From 37e9aa2a6115639f84784599ebe7afdf154108e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Tue, 4 Feb 2025 03:56:47 +0000 Subject: [PATCH 38/43] un-bootstrap --- jpegxl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jpegxl.spec b/jpegxl.spec index 0ae018d..416c2fd 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -3,7 +3,7 @@ # Uncomment for special build to rebuild aom on bumped soname. -%global new_soname 1 +#global new_soname 1 %global sover_old 0.10 %global sover 0.11 From 832e061db2d07b077fb0f2403241d4e2242a1368 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 18:04:40 +0000 Subject: [PATCH 39/43] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From 5e4a034b684f39844aa566d9576d585c32c2083d Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Tue, 12 Aug 2025 19:43:58 +0200 Subject: [PATCH 40/43] enable tests skip tests failing on s390x --- .gitignore | 1 + jpegxl.spec | 18 ++++++++++++++---- sources | 1 + update_third_party.sh | 1 + 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index f95e8ed..7a5cfa7 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ /third_party-0.10.3.tar.gz /jpegxl-0.11.1.tar.gz /third_party-0.11.1.tar.gz +/testdata-0.11.1.tar.gz diff --git a/jpegxl.spec b/jpegxl.spec index 416c2fd..25877c3 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -32,8 +32,9 @@ License: BSD-3-Clause AND Apache-2.0 AND Zlib URL: https://jpeg.org/jpegxl/ Source0: https://github.com/libjxl/libjxl/archive/v%{version}/%{name}-%{version}.tar.gz -# set VERSION and run ./update_third_party.sh to get Source1 +# set VERSION and run ./update_third_party.sh to get Source1 and Source2 Source1: third_party-%{version}.tar.gz +Source2: testdata-%{version}.tar.gz BuildRequires: asciidoc BuildRequires: cmake @@ -51,6 +52,7 @@ BuildRequires: pkgconfig(gimp-3.0) #BuildRequires: (pkgconfig(glut) or pkgconfig(freeglut)) BuildRequires: gtest-devel BuildRequires: gflags-devel +BuildRequires: gmock-devel BuildRequires: pkgconfig(libhwy) BuildRequires: pkgconfig(libbrotlicommon) BuildRequires: pkgconfig(lcms2) @@ -151,12 +153,12 @@ This is a GIMP plugin for loading and saving JPEG-XL images. %prep %autosetup -p1 -n libjxl-%{version} -rm -rf third_party/ -%setup -q -T -D -a 1 -n libjxl-%{version} +rm -rf testdata/ third_party/ +%setup -q -T -D -a 1 -a 2 -n libjxl-%{version} %build %cmake -DENABLE_CCACHE=1 \ - -DBUILD_TESTING=OFF \ + -DBUILD_TESTING=ON \ -DINSTALL_GTEST:BOOL=OFF \ -DJPEGXL_ENABLE_BENCHMARK:BOOL=OFF \ -DJPEGXL_ENABLE_PLUGINS:BOOL=ON \ @@ -181,6 +183,14 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %{buildroot}%{_libdir} %endif +%check +%ifarch s390x +# https://github.com/libjxl/libjxl/issues/3629 +%ctest -E 'DecodeTest\.(ProgressionTestLosslessAlpha|FlushTestLosslessProgressiveAlpha)|EncodeTest\.FrameSettingsTest|JxlTest\.RoundtripAlpha(Resampling(OnlyAlpha)?|16)|JxlTest\.RoundtripProgressive(Level2Slow)?|ModularTest\.RoundtripLossy(DeltaPalette|16)?|RoundtripLossless/ModularTestParam\.RoundtripLossless/1bitSqueeze|RoundtripLossless/ModularTestParam\.RoundtripLossless/(1|2[01467]|30)bitSqueeze|PassesTest\.ProgressiveDownsample2DegradesCorrectly(Grayscale)?' +%else +%ctest +%endif + %files -n libjxl-utils %doc CONTRIBUTING.md CONTRIBUTORS README.md %{_bindir}/cjxl diff --git a/sources b/sources index 7d1c479..30cd74c 100644 --- a/sources +++ b/sources @@ -1,2 +1,3 @@ SHA512 (jpegxl-0.11.1.tar.gz) = 0cfd81d9d3b783f96bd04f244d73ffbc12186c89993d46064a2751bef0a446a5e86be05add5c10f60d4482d39333d9bf3f9a866d6eb84f8fa0d4e8b5828fd74c SHA512 (third_party-0.11.1.tar.gz) = f76e20360594e010f1a04e5522e879f65d0360bc31cda21a724f8f4d65668eed276890f6187acef43fafe939c67a080251f1d4bdcb05f21c3ac9957afdef0a7b +SHA512 (testdata-0.11.1.tar.gz) = e775be0e8a56a828a4b70a174c841b3d474dbd170d899c50343896b21e46c6ae20f017f905ad7b83e097031e8add2788a00b1c452aa22e159b1f3a4e72a47155 diff --git a/update_third_party.sh b/update_third_party.sh index ab8f567..70ba696 100755 --- a/update_third_party.sh +++ b/update_third_party.sh @@ -15,5 +15,6 @@ rm -rvf third_party/libpng/ rm -rvf third_party/skcms/profiles/ rm -rvf third_party/zlib tar -zcf ../third_party-${VERSION}.tar.gz third_party/ +tar -zcf ../testdata-${VERSION}.tar.gz testdata/ cd .. rm -rf libjxl/ From 4aa1c6f773479fe611266b6d61fb7b6ea88f5306 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Thu, 4 Sep 2025 16:58:52 -0500 Subject: [PATCH 41/43] Disable the pixbuf loader and thumbnailer Due to changes in gdk-pixbuf, the jpegxl pixbuf loader now has lower precedence than glycin and will no longer ever be used. Also, the gdk-pixbuf-thumbnailer no longer exists, so this thumbnailer is guaranteed to fail. For more information, see: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/7FTIVJJM5CJSJ6GIX4FV6JDUCT2NW5FY/ https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/229 --- jpegxl.spec | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/jpegxl.spec b/jpegxl.spec index 25877c3..f15e902 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -7,8 +7,6 @@ %global sover_old 0.10 %global sover 0.11 -%global gdk_pixbuf_moduledir $(pkgconf gdk-pixbuf-2.0 --variable=gdk_pixbuf_moduledir) - %bcond_with gimp_plugin %if 0%{?fedora} %bcond_without tcmalloc @@ -77,12 +75,13 @@ Provides: bundled(sjpeg) = 0-0.1.20230608gite5ab130 # Build system is Bazel, which is not packaged by Fedora Provides: bundled(skcms) = 0-0.1.20240122git51b7f2a +Obsoletes: jxl-pixbuf-loader < %{epoch}:%{version}-%{release} + %description %common_description %package -n libjxl-utils Summary: Utilities for manipulating JPEG XL images -Recommends: jxl-pixbuf-loader = %{epoch}:%{version}-%{release} Recommends: gimp-jxl-plugin = %{epoch}:%{version}-%{release} Provides: jpegxl-utils = %{epoch}:%{version}-%{release} Obsoletes: jpegxl-utils < 0.3.7-5 @@ -111,7 +110,6 @@ Documentation for JPEG-XL. %package -n libjxl Summary: Library files for JPEG-XL Requires: shared-mime-info -Recommends: jxl-pixbuf-loader = %{epoch}:%{version}-%{release} Provides: jpegxl-libs = %{epoch}:%{version}-%{release} Obsoletes: jpegxl-libs < 0.3.7-5 %if %{without gimp_plugin} @@ -134,14 +132,6 @@ Obsoletes: jpegxl-devel < 0.3.7-5 Development files for JPEG-XL. -%package -n jxl-pixbuf-loader -Summary: JPEG-XL image loader for GTK+ applications -BuildRequires: pkgconfig(gdk-pixbuf-2.0) -Requires: gdk-pixbuf2 - -%description -n jxl-pixbuf-loader -Jxl-pixbuf-loader contains a plugin to load JPEG-XL images in GTK+ applications. - %if %{with gimp_plugin} %package -n gimp-jxl-plugin Summary: A plugin for loading and saving JPEG-XL images @@ -162,6 +152,7 @@ rm -rf testdata/ third_party/ -DINSTALL_GTEST:BOOL=OFF \ -DJPEGXL_ENABLE_BENCHMARK:BOOL=OFF \ -DJPEGXL_ENABLE_PLUGINS:BOOL=ON \ + -DJPEGXL_ENABLE_PLUGIN_GDKPIXBUF:BOOL=OFF \ -DJPEGXL_FORCE_SYSTEM_BROTLI:BOOL=ON \ -DJPEGXL_FORCE_SYSTEM_GTEST:BOOL=ON \ -DJPEGXL_FORCE_SYSTEM_HWY:BOOL=ON \ @@ -232,8 +223,6 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %{_libdir}/libjxl_threads.so.%{sover_old}* %{_libdir}/libjxl_cms.so.%{sover_old}* %endif -%dir %{_datadir}/thumbnailers -%{_datadir}/thumbnailers/jxl.thumbnailer %{_datadir}/mime/packages/image-jxl.xml %files -n libjxl-devel @@ -247,10 +236,6 @@ cp -p %{_libdir}/libjxl.so.%{sover_old}* \ %{_libdir}/pkgconfig/libjxl_threads.pc %{_libdir}/pkgconfig/libjxl_cms.pc -%files -n jxl-pixbuf-loader -%license LICENSE -%{_libdir}/gdk-pixbuf-2.0/*/loaders/libpixbufloader-jxl.so - %if %{with gimp_plugin} %files -n gimp-jxl-plugin %license LICENSE From fbe00f38463fe57c21d2f379bad4f9a0bc62b55f Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Mon, 13 Oct 2025 11:06:02 +0200 Subject: [PATCH 42/43] Move jxl-pixbuf-loader Obsoletes to the correct subpackage --- jpegxl.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jpegxl.spec b/jpegxl.spec index f15e902..6c58c88 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -75,8 +75,6 @@ Provides: bundled(sjpeg) = 0-0.1.20230608gite5ab130 # Build system is Bazel, which is not packaged by Fedora Provides: bundled(skcms) = 0-0.1.20240122git51b7f2a -Obsoletes: jxl-pixbuf-loader < %{epoch}:%{version}-%{release} - %description %common_description @@ -112,6 +110,7 @@ Summary: Library files for JPEG-XL Requires: shared-mime-info Provides: jpegxl-libs = %{epoch}:%{version}-%{release} Obsoletes: jpegxl-libs < 0.3.7-5 +Obsoletes: jxl-pixbuf-loader < %{epoch}:%{version}-%{release} %if %{without gimp_plugin} Obsoletes: gimp-jxl-plugin < 1:0.10.3-4 %endif From ec1bcb6edd4635bd18be2b7969b2092b6cf39fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Sun, 7 Dec 2025 16:42:13 +0100 Subject: [PATCH 43/43] Fix FTBFS with Clang 22 --- jpegxl.spec | 5 ++++- sources | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jpegxl.spec b/jpegxl.spec index 6c58c88..f17a415 100644 --- a/jpegxl.spec +++ b/jpegxl.spec @@ -1,6 +1,8 @@ # epel 8 need this other already have it %undefine __cmake_in_source_build +# developper recommendation +%global toolchain clang # Uncomment for special build to rebuild aom on bumped soname. #global new_soname 1 @@ -37,7 +39,7 @@ Source2: testdata-%{version}.tar.gz BuildRequires: asciidoc BuildRequires: cmake BuildRequires: doxygen -BuildRequires: gcc-c++ +BuildRequires: clang BuildRequires: giflib-devel %if %{with tcmalloc} BuildRequires: gperftools-devel @@ -146,6 +148,7 @@ rm -rf testdata/ third_party/ %setup -q -T -D -a 1 -a 2 -n libjxl-%{version} %build +export CC=clang CXX=clang++ %cmake -DENABLE_CCACHE=1 \ -DBUILD_TESTING=ON \ -DINSTALL_GTEST:BOOL=OFF \ diff --git a/sources b/sources index 30cd74c..f7d352f 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (jpegxl-0.11.1.tar.gz) = 0cfd81d9d3b783f96bd04f244d73ffbc12186c89993d46064a2751bef0a446a5e86be05add5c10f60d4482d39333d9bf3f9a866d6eb84f8fa0d4e8b5828fd74c -SHA512 (third_party-0.11.1.tar.gz) = f76e20360594e010f1a04e5522e879f65d0360bc31cda21a724f8f4d65668eed276890f6187acef43fafe939c67a080251f1d4bdcb05f21c3ac9957afdef0a7b SHA512 (testdata-0.11.1.tar.gz) = e775be0e8a56a828a4b70a174c841b3d474dbd170d899c50343896b21e46c6ae20f017f905ad7b83e097031e8add2788a00b1c452aa22e159b1f3a4e72a47155 +SHA512 (third_party-0.11.1.tar.gz) = 720544bd722cbc6ef81db660786e4b022f156d05672b7d7ee6110d367272dcf22a35458f51e0d850df2f6fb368978c43fa4fff99763010360a8b5673d2e556ca