package/libjxl: new package

libjxl is the reference implementation of JPEG XL (encoder and decoder).

https://github.com/libjxl/libjxl

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2023.02.x
Julien Olivain 2022-11-24 23:05:52 +01:00 committed by Thomas Petazzoni
parent 4733f9bd57
commit e648d399d8
7 changed files with 123 additions and 0 deletions

View File

@ -1688,6 +1688,7 @@ F: package/fluidsynth/
F: package/glslsandbox-player/
F: package/gnupg2/
F: package/highway/
F: package/libjxl/
F: package/octave/
F: package/ola/
F: package/perftest/
@ -1712,6 +1713,7 @@ F: support/testing/tests/package/sample_python_spake2.py
F: support/testing/tests/package/test_gnupg2.py
F: support/testing/tests/package/test_highway.py
F: support/testing/tests/package/test_hwloc.py
F: support/testing/tests/package/test_libjxl.py
F: support/testing/tests/package/test_ncdu.py
F: support/testing/tests/package/test_octave.py
F: support/testing/tests/package/test_ola.py

View File

@ -1603,6 +1603,7 @@ menu "Graphics"
source "package/libgta/Config.in"
source "package/libgtk2/Config.in"
source "package/libgtk3/Config.in"
source "package/libjxl/Config.in"
source "package/libmediaart/Config.in"
source "package/libmng/Config.in"
source "package/libpng/Config.in"

View File

@ -0,0 +1,25 @@
config BR2_PACKAGE_LIBJXL
bool "libjxl"
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7 # highway
depends on BR2_TOOLCHAIN_HAS_ATOMIC # highway
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_INSTALL_LIBSTDCPP # highway
# libjxl fail to link statically due to libatomic issue
depends on !BR2_STATIC_LIBS
depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_81426
select BR2_PACKAGE_BROTLI
select BR2_PACKAGE_HIGHWAY
select BR2_PACKAGE_LCMS2
help
libjxl is the reference implementation of JPEG XL (encoder
and decoder).
https://github.com/libjxl/libjxl
comment "libjxl needs a toolchain with C++, threads, gcc >= 7, dynamic library"
depends on BR2_TOOLCHAIN_HAS_ATOMIC
depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_81426
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_7 || \
!BR2_INSTALL_LIBSTDCPP || \
!BR2_TOOLCHAIN_HAS_THREADS || \
BR2_STATIC_LIBS

View File

@ -0,0 +1,4 @@
# Locally computed:
sha256 3114bba1fabb36f6f4adc2632717209aa6f84077bc4e93b420e0d63fa0455c5e libjxl-0.7.0.tar.gz
sha256 8405932022a556380c2d8c272eff154a923feb197233f348ce5f7334fb0a5ede LICENSE
sha256 91915f8ae056a68a3c5bdf05d9f6f78bb6903e27a8ca3a8434c9e4ac87300575 PATENTS

View File

@ -0,0 +1,33 @@
################################################################################
#
# libjxl
#
################################################################################
LIBJXL_VERSION = 0.7.0
LIBJXL_SITE = $(call github,libjxl,libjxl,v$(LIBJXL_VERSION))
LIBJXL_LICENSE = BSD-3-Clause
LIBJXL_LICENSE_FILES = LICENSE PATENTS
LIBJXL_CPE_ID_VENDOR = libjxl_project
LIBJXL_INSTALL_STAGING = YES
LIBJXL_DEPENDENCIES = \
brotli \
lcms2 \
highway
ifeq ($(BR2_PACKAGE_LIBPNG),y)
LIBJXL_DEPENDENCIES += libpng
endif
LIBJXL_CONF_OPTS = \
-DJPEGXL_BUNDLE_LIBPNG=OFF \
-DJPEGXL_BUNDLE_SKCMS=OFF \
-DJPEGXL_ENABLE_DOXYGEN=OFF \
-DJPEGXL_ENABLE_JNI=OFF \
-DJPEGXL_ENABLE_MANPAGES=OFF \
-DJPEGXL_ENABLE_OPENEXR=OFF \
-DJPEGXL_ENABLE_SJPEG=OFF \
-DJPEGXL_ENABLE_SKCMS=OFF
$(eval $(cmake-package))

View File

@ -0,0 +1,53 @@
import os
import infra.basetest
class TestLibJXL(infra.basetest.BRTest):
# infra.basetest.BASIC_TOOLCHAIN_CONFIG is not used as it is armv5
# and the image encoding would take too long (several minutes).
# We also add GraphicsMagick to generate and compare images for
# the test.
config = \
"""
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.79"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_CPIO_GZIP=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_GRAPHICSMAGICK=y
BR2_PACKAGE_LIBJXL=y
"""
def test_run(self):
img = os.path.join(self.builddir, "images", "rootfs.cpio.gz")
kern = os.path.join(self.builddir, "images", "Image")
self.emulator.boot(arch="aarch64",
kernel=kern,
kernel_cmdline=["console=ttyAMA0"],
options=["-M", "virt", "-cpu", "cortex-a57", "-m", "256M", "-initrd", img])
self.emulator.login()
ref = "/var/tmp/reference.ppm"
jxl = "/var/tmp/encoded.jxl"
dec = "/var/tmp/decoded.ppm"
cmd = "gm convert IMAGE:LOGO {}".format(ref)
self.assertRunOk(cmd)
cmd = "cjxl {} {}".format(ref, jxl)
self.assertRunOk(cmd, timeout=30)
cmd = "djxl {} {}".format(jxl, dec)
self.assertRunOk(cmd)
cmd = "gm compare -metric mse -maximum-error 1e-3 {} {}".format(
ref, dec)
self.assertRunOk(cmd)

View File

@ -141,6 +141,11 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_68485
bool
default y if BR2_microblaze
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81426
config BR2_TOOLCHAIN_HAS_GCC_BUG_81426
bool
default y if BR2_sh
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
# Error: invalid operands (*UND* and .text sections) for `-' on sh4.
# This bug no longer exists in gcc 10.x but reappeared on gcc 11.x and