Sync from SUSE:ALP:Source:Standard:1.0 libjxl revision 534411b08273bbc6d75d4cb151415cb3

This commit is contained in:
Adrian Schröter 2023-06-07 08:02:26 +02:00
commit db9c938ddc
6 changed files with 316 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,117 @@
From 057cd06c19875bcf8b5d34d41d92a8abdb856b7c Mon Sep 17 00:00:00 2001
From: Kleis Auke Wolthuizen <github@kleisauke.nl>
Date: Fri, 11 Mar 2022 21:11:24 +0100
Subject: [PATCH] Remove LCMS mutex (#112)
* Remove LCMS mutex
Requires mm2/Little-CMS@a35bacd, which is released in LCMS v2.11.
* Use a threadsafe alternative of gmtime in LCMS
Requires mm2/Little-CMS@68ee2ff, which is released in LCMS v2.13.
LCMS submodule was updated to version 2.13.1 instead.
---
lib/jxl/enc_color_management.cc | 15 +++++++++++++++
third_party/CMakeLists.txt | 2 +-
third_party/lcms2.cmake | 14 --------------
3 files changed, 16 insertions(+), 15 deletions(-)
Index: libjxl-0.8.1/lib/jxl/enc_color_management.cc
===================================================================
--- libjxl-0.8.1.orig/lib/jxl/enc_color_management.cc
+++ libjxl-0.8.1/lib/jxl/enc_color_management.cc
@@ -18,6 +18,7 @@
#include <array>
#include <atomic>
#include <memory>
+#include <mutex>
#include <string>
#include <utility>
@@ -308,6 +309,14 @@ int DoColorSpaceTransform(void* t, size_
// Define to 1 on OS X as a workaround for older LCMS lacking MD5.
#define JXL_CMS_OLD_VERSION 0
+// cms functions (even *THR) are not thread-safe, except cmsDoTransform.
+// To ensure all functions are covered without frequent lock-taking nor risk of
+// recursive lock, we lock in the top-level APIs.
+static std::mutex& LcmsMutex() {
+ static std::mutex m;
+ return m;
+}
+
#if JPEGXL_ENABLE_SKCMS
JXL_MUST_USE_RESULT CIExy CIExyFromXYZ(const float XYZ[3]) {
@@ -871,6 +880,9 @@ bool ApplyCICP(const uint8_t color_prima
} // namespace
+// All functions that call lcms directly (except ColorSpaceTransform::Run) must
+// lock LcmsMutex().
+
Status ColorEncoding::SetFieldsFromICC() {
// In case parsing fails, mark the ColorEncoding as invalid.
SetColorSpace(ColorSpace::kUnknown);
@@ -917,6 +929,7 @@ Status ColorEncoding::SetFieldsFromICC()
DetectTransferFunction(profile, this);
#else // JPEGXL_ENABLE_SKCMS
+ std::lock_guard<std::mutex> guard(LcmsMutex());
const cmsContext context = GetContext();
Profile profile;
@@ -984,6 +997,7 @@ void JxlCmsDestroy(void* cms_data) {
if (cms_data == nullptr) return;
JxlCms* t = reinterpret_cast<JxlCms*>(cms_data);
#if !JPEGXL_ENABLE_SKCMS
+ std::lock_guard<std::mutex> guard(LcmsMutex());
TransformDeleter()(t->lcms_transform);
#endif
delete t;
@@ -1020,6 +1034,7 @@ void* JxlCmsInit(void* init_data, size_t
return nullptr;
}
#else // JPEGXL_ENABLE_SKCMS
+ std::lock_guard<std::mutex> guard(LcmsMutex());
const cmsContext context = GetContext();
Profile profile_src, profile_dst;
if (!DecodeProfile(context, c_src.ICC(), &profile_src)) {
Index: libjxl-0.8.1/third_party/CMakeLists.txt
===================================================================
--- libjxl-0.8.1.orig/third_party/CMakeLists.txt
+++ libjxl-0.8.1/third_party/CMakeLists.txt
@@ -111,7 +111,7 @@ if (JPEGXL_ENABLE_SKCMS OR JPEGXL_ENABLE
endif ()
if (JPEGXL_ENABLE_VIEWERS OR NOT JPEGXL_ENABLE_SKCMS)
if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lcms/.git" OR JPEGXL_FORCE_SYSTEM_LCMS2 )
- find_package(LCMS2 2.13)
+ find_package(LCMS2 2.10)
if ( NOT LCMS2_FOUND )
message(FATAL_ERROR "Please install lcms2 or run git submodule update --init")
endif ()
Index: libjxl-0.8.1/third_party/lcms2.cmake
===================================================================
--- libjxl-0.8.1.orig/third_party/lcms2.cmake
+++ libjxl-0.8.1/third_party/lcms2.cmake
@@ -60,18 +60,4 @@ target_compile_definitions(lcms2
target_compile_definitions(lcms2
PUBLIC "-DCMS_NO_REGISTER_KEYWORD=1")
-# Ensure that a thread safe alternative of gmtime is used in LCMS
-include(CheckSymbolExists)
-check_symbol_exists(gmtime_r "time.h" HAVE_GMTIME_R)
-if (HAVE_GMTIME_R)
- target_compile_definitions(lcms2
- PUBLIC "-DHAVE_GMTIME_R=1")
-else()
- check_symbol_exists(gmtime_s "time.h" HAVE_GMTIME_S)
- if (HAVE_GMTIME_S)
- target_compile_definitions(lcms2
- PUBLIC "-DHAVE_GMTIME_S=1")
- endif()
-endif()
-
set_property(TARGET lcms2 PROPERTY POSITION_INDEPENDENT_CODE ON)

1
baselibs.conf Normal file
View File

@ -0,0 +1 @@
libjxl0_8

61
libjxl.changes Normal file
View File

@ -0,0 +1,61 @@
-------------------------------------------------------------------
Mon Apr 17 07:36:23 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
- Refresh 0001-Remove-LCMS-mutex.patch
-------------------------------------------------------------------
Fri Feb 10 08:14:35 UTC 2023 - Dirk Müller <dmueller@suse.com>
- build glibc hwcaps optimized overlay
-------------------------------------------------------------------
Sun Feb 5 14:16:53 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
- Update to release 0.8.1
* Allow fast-lossless for 16-bit float input
* Fix OOB read in exif.h
-------------------------------------------------------------------
Wed Jan 18 15:13:51 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
- Update to release 0.8
* API: new function JxlDecoderSetImageBitDepth and
JxlEncoderSetFrameBitDepth to set the bit depth of buffers.
* encoder API: add an effort 10 option for lossless
compression; using this setting requires calling
JxlEncoderAllowExpertOptions.
- Enable PNG utilities [boo#1205107]
-------------------------------------------------------------------
Mon Dec 19 12:35:30 UTC 2022 - Antonio Larrosa <alarrosa@suse.com>
- Add patch (applied reversed) to revert the requirement for an
updated liblcms2 library when we have an older one. This allows
libjxl to build in SLE15 SP4/SP5 (and Leap 15.4/15.5):
* 0001-Remove-LCMS-mutex.patch
-------------------------------------------------------------------
Thu Dec 15 11:32:45 UTC 2022 - Simon Vogl <simon.vogl@gmx.net>
- Added missing baselibs.conf so that 32bit library packages
become available
-------------------------------------------------------------------
Thu Sep 22 07:03:57 UTC 2022 - Enrico Belleri <idesmi@protonmail.com>
- Update to 0.7.0:
* new functions for retrieving associated alpha channel with
premultiplied or unpremultiplied colors, for blending
information for extra channels in the non-coalesced case, for
getting the intended downsampling ratio of progressive steps,
for disabling rendering of spot colors.
* Added ability to add metadata boxes, to set several encoder
options, to check required codestream compatibility level,
for force-emitting the box-based container format, to store
JPEG metadata for lossless reconstruction, to encode
arbitrary extra channels.
-------------------------------------------------------------------
Sat Jul 23 14:33:36 UTC 2022 - Jan Engelhardt <jengelh@inai.de>
- Initial package (version 0.7~779.f5d6e29) build.opensuse.org

111
libjxl.spec Normal file
View File

@ -0,0 +1,111 @@
#
# spec file for package libjxl
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: libjxl
%define lname libjxl0_8
Version: 0.8.1
Release: 0
Summary: JPEG XL reference implementation
License: BSD-3-Clause
URL: https://jpegxl.info/
#Git-Clone: https://github.com/libjxl/libjxl
Source: https://github.com/libjxl/libjxl/archive/refs/tags/v%version.tar.gz
Source1: baselibs.conf
Patch0: 0001-Remove-LCMS-mutex.patch
BuildRequires: c++_compiler
BuildRequires: cmake
BuildRequires: pkg-config
BuildRequires: pkgconfig(lcms2) >= 2.10
BuildRequires: pkgconfig(libbrotlicommon)
BuildRequires: pkgconfig(libbrotlidec)
BuildRequires: pkgconfig(libbrotlienc)
BuildRequires: pkgconfig(libhwy) >= 1.0
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libpng)
%{?suse_build_hwcaps_libs}
%description
JPEG XL is a raster-graphics file format that supports both lossy and
lossless compression.
This is the reference implementation of JPEG XL, with encoder and decoder.
%package -n %lname
Summary: Library for encoding and decoding JPEG XL raster graphic images
%description -n %lname
JPEG XL is a raster-graphics file format that supports both lossy and
lossless compression.
%package devel
Summary: Development for libjxl, an en-/decoder for JPEG XL
Requires: %lname = %version
%description devel
JPEG XL is a raster-graphics file format that supports both lossy and
lossless compression.
This is the reference implementation of JPEG XL, with encoder and decoder.
%package tools
Summary: Command-line utilities to convert from/to JPEG XL
%description tools
Command-line utilities to convert from/to JPEG XL.
%prep
%setup -q
%if %{pkg_vcmp liblcms2-2 < 2.13}
# libjxl 0.7.0 requires lcms2 >= 2.13, so if we have an older version
# (as in SLE15/Leap) just reverse the patch that adds that dependency
%patch0 -p1
%else
# Make sure patch at least applies
%patch0 -p1
%patch0 -p1 -R
%endif
%build
%cmake -DJPEGXL_FORCE_SYSTEM_HWY=ON -DJPEGXL_FORCE_SYSTEM_BROTLI=ON \
-DJPEGXL_FORCE_SYSTEM_LCMS2=ON -DBUILD_TESTING=OFF \
-DJPEGXL_ENABLE_PLUGINS=OFF -DJPEGXL_ENABLE_SKCMS=OFF \
-DJPEGXL_ENABLE_SJPEG=OFF
%install
%cmake_install
rm -fv %buildroot/%_libdir/*.a
%post -n %lname -p /sbin/ldconfig
%postun -n %lname -p /sbin/ldconfig
%files -n %lname
%license LICENSE
%_libdir/libjxl*.so.*
%files tools
%_bindir/cjpeg_hdr
%_bindir/*xl*
%files devel
%_includedir/jxl/
%_libdir/libjxl.so
%_libdir/libjxl_threads.so
%_libdir/pkgconfig/*.pc
%changelog

BIN
v0.8.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.