libjxl: update to 0.9.1.

This commit is contained in:
oreo639 2024-01-02 20:33:25 -08:00 committed by oreo639
parent 34af4a51d3
commit a38d2be0de
4 changed files with 202 additions and 85 deletions

View File

@ -4235,9 +4235,9 @@ libplayerctl.so.2 playerctl-2.4.1_1
libwireplumber-0.4.so.0 wireplumber-0.4.14_1
libjodycode.so.3 libjodycode-3.0.1_1
libgsoapssl++-2.8.124.so gsoap-2.8.124_1
libjxl.so.0.8 libjxl-0.8.2_1
libjxl_dec.so.0.8 libjxl-0.8.2_1
libjxl_threads.so.0.8 libjxl-0.8.2_1
libjxl.so.0.9 libjxl-0.9.0_1
libjxl_cms.so.0.9 libjxl-0.9.0_1
libjxl_threads.so.0.9 libjxl-0.9.0_1
libtext-engine-0.1.so.0 text-engine-0.1.1_1
libvmaf.so.1 vmaf-2.3.1_1
liblc3.so.1 liblc3-1.0.3_1

View File

@ -1,68 +0,0 @@
From b73a9e1e8b47fc623c3015ce40466274e4d4bb03 Mon Sep 17 00:00:00 2001
From: east <xdong181@gmail.com>
Date: Wed, 22 Feb 2023 20:12:05 +0800
Subject: [PATCH 1/3] Add missing <atomic> content to fix gcc compilation for
RISCV architecture.
---
lib/jxl/enc_xyb.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/jxl/enc_xyb.cc b/lib/jxl/enc_xyb.cc
index 1ef78877a71..1ed13da9574 100644
--- a/lib/jxl/enc_xyb.cc
+++ b/lib/jxl/enc_xyb.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include <cstdlib>
+#include <atomic>
#undef HWY_TARGET_INCLUDE
#define HWY_TARGET_INCLUDE "lib/jxl/enc_xyb.cc"
From 10a521764beb7e9dcc0dbfbe3f4dbb7e2e8d2bcc Mon Sep 17 00:00:00 2001
From: east <xdong181@gmail.com>
Date: Thu, 23 Feb 2023 00:50:02 +0800
Subject: [PATCH 2/3] add name to AUTHORS
---
AUTHORS | 1 +
1 file changed, 1 insertion(+)
diff --git a/AUTHORS b/AUTHORS
index 44dcc409949..3340422d606 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -30,6 +30,7 @@ Daniel Novomeský <dnovomesky@gmail.com>
David Burnett <vargolsoft@gmail.com>
Dirk Lemstra <dirk@lemstra.org>
Don Olmstead <don.j.olmstead@gmail.com>
+Dong Xu <xdong181@gmail.com>
Even Rouault <even.rouault@spatialys.com>
Fred Brennan <copypaste@kittens.ph>
Heiko Becker <heirecka@exherbo.org>
From fc6b5c316346475379895a6c67b6d97ab7b8c2cb Mon Sep 17 00:00:00 2001
From: Moritz Firsching <firsching@google.com>
Date: Wed, 22 Feb 2023 22:46:07 +0100
Subject: [PATCH 3/3] lint fix
---
lib/jxl/enc_xyb.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/jxl/enc_xyb.cc b/lib/jxl/enc_xyb.cc
index 1ed13da9574..2ee0abf821a 100644
--- a/lib/jxl/enc_xyb.cc
+++ b/lib/jxl/enc_xyb.cc
@@ -6,8 +6,8 @@
#include "lib/jxl/enc_xyb.h"
#include <algorithm>
-#include <cstdlib>
#include <atomic>
+#include <cstdlib>
#undef HWY_TARGET_INCLUDE
#define HWY_TARGET_INCLUDE "lib/jxl/enc_xyb.cc"

View File

@ -0,0 +1,184 @@
From 7021ada76bd1c1ee44483027c40233cd2e412637 Mon Sep 17 00:00:00 2001
From: Leo Izen <leo.izen@gmail.com>
Date: Mon, 29 Jan 2024 09:21:10 -0500
Subject: [PATCH] lib/jxl/decode.cc: deduplicate and correct min_size
calculation
Code to calculate the proper size of the buffer exists in three places
in this function - one for the standard buffer, one for the extra
channel buffer, and one for the preview buffer. However, only the code
for the preview buffer correctly took into account the last row size
possibly being slightly smaller than the remaining rows.
This commit separates the code out into a separate function to remove
duplicate code, and uses the algorithm from the prevew buffer which was
the only correct one.
Signed-off-by: Leo Izen <leo.izen@gmail.com>
---
lib/jxl/decode.cc | 63 ++++++++++++++++--------------------------
lib/jxl/decode_test.cc | 8 ++++--
2 files changed, 30 insertions(+), 41 deletions(-)
diff --git a/lib/jxl/decode.cc b/lib/jxl/decode.cc
index b674d1ba885..953342d76e1 100644
--- a/lib/jxl/decode.cc
+++ b/lib/jxl/decode.cc
@@ -2348,29 +2348,40 @@ JXL_EXPORT JxlDecoderStatus JxlDecoderSetCms(JxlDecoder* dec,
return JXL_DEC_SUCCESS;
}
-JXL_EXPORT JxlDecoderStatus JxlDecoderPreviewOutBufferSize(
- const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size) {
+static JxlDecoderStatus GetMinSize(const JxlDecoder* dec,
+ const JxlPixelFormat* format,
+ size_t num_channels, size_t* min_size,
+ bool preview) {
size_t bits;
JxlDecoderStatus status = PrepareSizeCheck(dec, format, &bits);
if (status != JXL_DEC_SUCCESS) return status;
- if (format->num_channels < 3 &&
- !dec->image_metadata.color_encoding.IsGray()) {
- return JXL_API_ERROR("Number of channels is too low for color output");
+ size_t xsize, ysize;
+ if (preview) {
+ xsize = dec->metadata.oriented_preview_xsize(dec->keep_orientation);
+ ysize = dec->metadata.oriented_preview_ysize(dec->keep_orientation);
+ } else {
+ GetCurrentDimensions(dec, xsize, ysize);
}
-
- size_t xsize = dec->metadata.oriented_preview_xsize(dec->keep_orientation);
- size_t ysize = dec->metadata.oriented_preview_ysize(dec->keep_orientation);
-
+ if (num_channels == 0) num_channels = format->num_channels;
size_t row_size =
- jxl::DivCeil(xsize * format->num_channels * bits, jxl::kBitsPerByte);
+ jxl::DivCeil(xsize * num_channels * bits, jxl::kBitsPerByte);
size_t last_row_size = row_size;
if (format->align > 1) {
row_size = jxl::DivCeil(row_size, format->align) * format->align;
}
- *size = row_size * (ysize - 1) + last_row_size;
+ *min_size = row_size * (ysize - 1) + last_row_size;
return JXL_DEC_SUCCESS;
}
+JXL_EXPORT JxlDecoderStatus JxlDecoderPreviewOutBufferSize(
+ const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size) {
+ if (format->num_channels < 3 &&
+ !dec->image_metadata.color_encoding.IsGray()) {
+ return JXL_API_ERROR("Number of channels is too low for color output");
+ }
+ return GetMinSize(dec, format, 0, size, true);
+}
+
JXL_EXPORT JxlDecoderStatus JxlDecoderSetPreviewOutBuffer(
JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size) {
if (!dec->got_basic_info || !dec->metadata.m.have_preview ||
@@ -2401,23 +2412,12 @@ JXL_EXPORT JxlDecoderStatus JxlDecoderSetPreviewOutBuffer(
JXL_EXPORT JxlDecoderStatus JxlDecoderImageOutBufferSize(
const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size) {
- size_t bits;
- JxlDecoderStatus status = PrepareSizeCheck(dec, format, &bits);
- if (status != JXL_DEC_SUCCESS) return status;
if (format->num_channels < 3 &&
!dec->image_metadata.color_encoding.IsGray()) {
return JXL_API_ERROR("Number of channels is too low for color output");
}
- size_t xsize, ysize;
- GetCurrentDimensions(dec, xsize, ysize);
- size_t row_size =
- jxl::DivCeil(xsize * format->num_channels * bits, jxl::kBitsPerByte);
- if (format->align > 1) {
- row_size = jxl::DivCeil(row_size, format->align) * format->align;
- }
- *size = row_size * ysize;
- return JXL_DEC_SUCCESS;
+ return GetMinSize(dec, format, 0, size, false);
}
JxlDecoderStatus JxlDecoderSetImageOutBuffer(JxlDecoder* dec,
@@ -2463,22 +2463,7 @@ JxlDecoderStatus JxlDecoderExtraChannelBufferSize(const JxlDecoder* dec,
return JXL_API_ERROR("Invalid extra channel index");
}
- size_t num_channels = 1; // Do not use format's num_channels
-
- size_t bits;
- JxlDecoderStatus status = PrepareSizeCheck(dec, format, &bits);
- if (status != JXL_DEC_SUCCESS) return status;
-
- size_t xsize, ysize;
- GetCurrentDimensions(dec, xsize, ysize);
- size_t row_size =
- jxl::DivCeil(xsize * num_channels * bits, jxl::kBitsPerByte);
- if (format->align > 1) {
- row_size = jxl::DivCeil(row_size, format->align) * format->align;
- }
- *size = row_size * ysize;
-
- return JXL_DEC_SUCCESS;
+ return GetMinSize(dec, format, 1, size, false);
}
JxlDecoderStatus JxlDecoderSetExtraChannelBuffer(JxlDecoder* dec,
diff --git a/lib/jxl/decode_test.cc b/lib/jxl/decode_test.cc
index caee6dbc568..310742f705f 100644
--- a/lib/jxl/decode_test.cc
+++ b/lib/jxl/decode_test.cc
@@ -2575,7 +2575,11 @@ TEST(DecodeTest, AlignTest) {
size_t align = 17;
JxlPixelFormat format = {3, JXL_TYPE_UINT8, JXL_LITTLE_ENDIAN, align};
// On purpose not using jxl::RoundUpTo to test it independently.
- size_t expected_line_bytes = (1 * 3 * xsize + align - 1) / align * align;
+ size_t expected_line_size_last = 1 * 3 * xsize;
+ size_t expected_line_size =
+ ((expected_line_size_last + align - 1) / align) * align;
+ size_t expected_pixels_size =
+ expected_line_size * (ysize - 1) + expected_line_size_last;
for (int use_callback = 0; use_callback <= 1; ++use_callback) {
std::vector<uint8_t> pixels2 = jxl::DecodeWithAPI(
@@ -2583,7 +2587,7 @@ TEST(DecodeTest, AlignTest) {
/*set_buffer_early=*/false,
/*use_resizable_runner=*/false, /*require_boxes=*/false,
/*expect_success=*/true);
- EXPECT_EQ(expected_line_bytes * ysize, pixels2.size());
+ EXPECT_EQ(expected_pixels_size, pixels2.size());
EXPECT_EQ(0u, jxl::test::ComparePixels(pixels.data(), pixels2.data(), xsize,
ysize, format_orig, format));
}
From c4ebb7e70ee09591ae0269410ebe8929f400713e Mon Sep 17 00:00:00 2001
From: Leo Izen <leo.izen@gmail.com>
Date: Mon, 29 Jan 2024 09:23:36 -0500
Subject: [PATCH] plugins/gdk-pixbuf: consider stride when passing buffer to
libjxl
This change uses gdk_pixbuf_get_pixels_with_length to get the actual
size of the buffer, with stride taken into account. The previous code
just multiplies width by height and ignores stride.
Signed-off-by: Leo Izen <leo.izen@gmail.com>
---
plugins/gdk-pixbuf/pixbufloader-jxl.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/plugins/gdk-pixbuf/pixbufloader-jxl.c b/plugins/gdk-pixbuf/pixbufloader-jxl.c
index bafa57b1674..066468a5035 100644
--- a/plugins/gdk-pixbuf/pixbufloader-jxl.c
+++ b/plugins/gdk-pixbuf/pixbufloader-jxl.c
@@ -491,9 +491,8 @@ static gboolean load_increment(gpointer context, const guchar *buf, guint size,
decoder_state->frames->len - 1)
.data;
decoder_state->pixel_format.align = gdk_pixbuf_get_rowstride(output);
- guchar *dst = gdk_pixbuf_get_pixels(output);
- size_t num_pixels = decoder_state->xsize * decoder_state->ysize;
- size_t size = num_pixels * decoder_state->pixel_format.num_channels;
+ guint size;
+ guchar *dst = gdk_pixbuf_get_pixels_with_length(output, &size);
if (JXL_DEC_SUCCESS != JxlDecoderSetImageOutBuffer(
decoder_state->decoder,
&decoder_state->pixel_format, dst, size)) {

View File

@ -1,16 +1,16 @@
# Template file for 'libjxl'
pkgname=libjxl
version=0.8.2
revision=2
_testdata_hash=d6168ffb9e1cc24007e64b65dd84d822ad1fc759
_skcms_hash=b25b07b4b07990811de121c0356155b2ba0f4318
version=0.9.1
revision=1
_testdata_hash=ff8d743aaba05b3014f17e5475e576242fa979fc
build_style=cmake
build_wrksrc="libjxl-${version}"
configure_args="-DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF
-DJPEGXL_ENABLE_SJPEG=OFF -DJPEGXL_ENABLE_PLUGINS=ON -DJPEGXL_VERSION=${version}"
-DJPEGXL_ENABLE_SJPEG=OFF -DJPEGXL_ENABLE_PLUGINS=ON -DJPEGXL_VERSION=${version}
-DJPEGXL_ENABLE_SKCMS=OFF"
hostmakedepends="tar pkg-config asciidoc"
makedepends="brotli-devel highway libpng-devel giflib-devel libjpeg-turbo-devel
libopenexr-devel libwebp-devel gdk-pixbuf-devel gimp-devel"
libopenexr-devel libwebp-devel gdk-pixbuf-devel gimp-devel lcms2-devel"
checkdepends="gtest-devel xdg-utils"
short_desc="JPEG XL image format reference implementation"
maintainer="Joshua Krämer <joshua@kraemer.link>"
@ -18,12 +18,9 @@ license="BSD-3-Clause, custom:Patent grant"
homepage="https://jpeg.org/jpegxl/"
changelog="https://raw.githubusercontent.com/libjxl/libjxl/main/CHANGELOG.md"
distfiles="https://github.com/libjxl/libjxl/archive/v${version}.tar.gz
https://github.com/libjxl/testdata/archive/${_testdata_hash}.tar.gz>testdata-${_testdata_hash}.tar.gz
https://skia.googlesource.com/skcms/+archive/${_skcms_hash}.tar.gz>skcms-${_skcms_hash}.tar.gz"
checksum="c70916fb3ed43784eb840f82f05d390053a558e2da106e40863919238fa7b420
64658d3341bff2976899cb8b140242ffa4de1cd41aed507dfec4aa9e7e05ca24
@8feb1e33c38ca13f91a0d5bd8ce25f976eb239edf38f49e6db8895ae9f1e833c"
skip_extraction="skcms-${_skcms_hash}.tar.gz"
https://github.com/libjxl/testdata/archive/${_testdata_hash}.tar.gz>testdata-${_testdata_hash}.tar.gz"
checksum="a0e72e9ece26878147069ad4888ac3382021d4bbee71c2e1b687d5bde7fd7e01
9c45a108df32a002a69465df896d33acf77d97c88fb59dffa0dff5628370e96f"
patch_args="-Np1 --directory=${build_wrksrc}"
if [ -z "$XBPS_CHECK_PKGS" ]; then
@ -32,7 +29,6 @@ fi
post_extract() {
mv "testdata-${_testdata_hash}"/* "${build_wrksrc}/testdata/"
bsdtar -xf "${XBPS_SRCDISTDIR}/${pkgname}-${version}/skcms-${_skcms_hash}.tar.gz" -C "${build_wrksrc}/third_party/skcms"
}
post_install() {
@ -40,12 +36,16 @@ post_install() {
vlicense PATENTS
}
post_install() {
# Remove devel symlink for internal library only used for tools. (headers don't get installed)
rm ${DESTDIR}/usr/lib/libjxl_extras_codec.so
}
libjxl-devel_package() {
short_desc+=" - development files"
depends="${sourcepkg}>=${version}_${revision} highway brotli-devel"
pkg_install() {
vmove usr/include
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
vmove usr/lib/pkgconfig
}
@ -54,6 +54,7 @@ libjxl-devel_package() {
libjxl-tools_package() {
short_desc+=" - tools"
pkg_install() {
vmove "usr/lib/libjxl_extras_codec*"
vmove usr/bin
vmove usr/share/man/man1
}