Add JPEG XL plug-in

This commit is contained in:
Daniel Novomesky 2021-08-26 14:24:21 +02:00
parent d4733e5b21
commit 7ce0f2d60e
7 changed files with 1207 additions and 0 deletions

View file

@ -75,6 +75,7 @@ m4_define([json_glib_required_version], [1.2.6])
m4_define([lcms_required_version], [2.8])
m4_define([libgudev_required_version], [167])
m4_define([libheif_required_version], [1.3.2])
m4_define([libjxl_required_version], [0.5.0])
m4_define([liblzma_required_version], [5.0.0])
m4_define([libmypaint_required_version], [1.3.0])
m4_define([libpng_required_version], [1.6.25])
@ -176,6 +177,7 @@ HARFBUZZ_REQUIRED_VERSION=harfbuzz_required_version
INTLTOOL_REQUIRED_VERSION=intltool_required_version
LCMS_REQUIRED_VERSION=lcms_required_version
LIBHEIF_REQUIRED_VERSION=libheif_required_version
LIBJXL_REQUIRED_VERSION=libjxl_required_version
LIBLZMA_REQUIRED_VERSION=liblzma_required_version
LIBMYPAINT_REQUIRED_VERSION=libmypaint_required_version
LIBPNG_REQUIRED_VERSION=libpng_required_version
@ -211,6 +213,7 @@ AC_SUBST(HARFBUZZ_REQUIRED_VERSION)
AC_SUBST(INTLTOOL_REQUIRED_VERSION)
AC_SUBST(LCMS_REQUIRED_VERSION)
AC_SUBST(LIBHEIF_REQUIRED_VERSION)
AC_SUBST(LIBJXL_REQUIRED_VERSION)
AC_SUBST(LIBLZMA_REQUIRED_VERSION)
AC_SUBST(LIBMYPAINT_REQUIRED_VERSION)
AC_SUBST(LIBPNG_REQUIRED_VERSION)
@ -1846,6 +1849,30 @@ if test "x$have_libheif_1_4_0" = xyes; then
fi
fi
###################
# Check for JPEG XL
###################
AC_ARG_WITH(jpegxl, [ --without-jpegxl build without JPEG XL support])
have_jpegxl=no
if test "x$with_jpegxl" != xno; then
PKG_CHECK_MODULES(JXL, libjxl >= libjxl_required_version,
[
PKG_CHECK_MODULES(JXL_THREADS, libjxl_threads >= libjxl_required_version,
[have_jpegxl=yes],
[have_jpegxl="no (libjxl_threads not found)"])
],
[have_jpegxl="no (libjxl not found)"])
fi
if test "x$have_jpegxl" = xyes; then
MIME_TYPES="$MIME_TYPES;image/jxl"
FILE_JPEGXL='file-jpegxl$(EXEEXT)'
fi
AM_CONDITIONAL(HAVE_JPEGXL, test "x$have_jpegxl" = xyes)
AC_SUBST(FILE_JPEGXL)
########################
# Check for libbacktrace
@ -3213,6 +3240,7 @@ Optional Plug-Ins:
Ghostscript: $have_gs
Help Browser: $have_webkit
JPEG 2000: $have_openjpeg
JPEG XL: $have_jpegxl
MNG: $have_libmng
OpenEXR: $have_openexr
WebP: $have_webp

View file

@ -802,6 +802,18 @@ if openjpeg.found()
MIMEtypes += [ 'image/jp2', 'image/jpeg2000', 'image/jpx', ]
endif
jpegxl_minver = '0.5.0'
libjxl = dependency('libjxl',
version: '>='+jpegxl_minver,
required: get_option('jpeg-xl')
)
libjxl_threads = dependency('libjxl_threads',
version: '>='+jpegxl_minver,
required: get_option('jpeg-xl')
)
if libjxl.found() and libjxl_threads.found()
MIMEtypes += 'image/jxl'
endif
xmc = dependency('xcursor', required: get_option('xcursor'))
if xmc.found()
@ -1774,6 +1786,7 @@ final_message = [
''' Ghostscript: @0@'''.format(ghostscript.found()),
''' Help Browser: @0@'''.format(webkit.found()),
''' JPEG 2000: @0@'''.format(openjpeg.found()),
''' JPEG XL: @0@'''.format(libjxl.found()),
''' MNG: @0@'''.format(libmng.found()),
''' OpenEXR: @0@'''.format(openexr.found()),
''' WebP: @0@'''.format(webp_found),

View file

@ -40,6 +40,7 @@ option('ghostscript', type: 'feature', value: 'auto', description: 'Ghosts
option('gudev', type: 'feature', value: 'auto', description: 'Gudev support')
option('heif', type: 'feature', value: 'auto', description: 'HEIF support')
option('jpeg2000', type: 'feature', value: 'auto', description: 'Jpeg-2000 support')
option('jpeg-xl', type: 'feature', value: 'auto', description: 'JPEG XL support')
option('mng', type: 'feature', value: 'auto', description: 'Mng support')
option('openexr', type: 'feature', value: 'auto', description: 'Openexr support')
option('png', type: 'feature', value: 'auto', description: 'PNG support')

View file

@ -79,6 +79,7 @@ file_header_libexecdir = $(gimpplugindir)/plug-ins/file-header
file_heif_libexecdir = $(gimpplugindir)/plug-ins/file-heif
file_html_table_libexecdir = $(gimpplugindir)/plug-ins/file-html-table
file_jp2_load_libexecdir = $(gimpplugindir)/plug-ins/file-jp2-load
file_jpegxl_libexecdir = $(gimpplugindir)/plug-ins/file-jpegxl
file_mng_libexecdir = $(gimpplugindir)/plug-ins/file-mng
file_pat_libexecdir = $(gimpplugindir)/plug-ins/file-pat
file_pcx_libexecdir = $(gimpplugindir)/plug-ins/file-pcx
@ -156,6 +157,7 @@ file_header_libexec_PROGRAMS = file-header
file_heif_libexec_PROGRAMS = $(FILE_HEIF)
file_html_table_libexec_PROGRAMS = file-html-table
file_jp2_load_libexec_PROGRAMS = $(FILE_JP2_LOAD)
file_jpegxl_libexec_PROGRAMS = $(FILE_JPEGXL)
file_mng_libexec_PROGRAMS = $(FILE_MNG)
file_pat_libexec_PROGRAMS = file-pat
file_pcx_libexec_PROGRAMS = file-pcx
@ -204,6 +206,7 @@ EXTRA_PROGRAMS = \
file-aa \
file-heif \
file-jp2-load \
file-jpegxl \
file-mng \
file-pdf-save \
file-ps \
@ -821,6 +824,28 @@ file_jp2_load_LDADD = \
$(INTLLIBS) \
$(file_jp2_load_RC)
file_jpegxl_CFLAGS = $(JXL_CFLAGS)
file_jpegxl_SOURCES = \
file-jpegxl.c
file_jpegxl_LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimpmodule) \
$(libgimp) \
$(libgimpmath) \
$(libgimpconfig) \
$(libgimpcolor) \
$(libgimpbase) \
$(GTK_LIBS) \
$(GEGL_LIBS) \
$(JXL_THREADS_LIBS) \
$(JXL_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
$(file_jpegxl_RC)
file_mng_CFLAGS = $(MNG_CFLAGS)
file_mng_SOURCES = \

File diff suppressed because it is too large Load diff

View file

@ -103,6 +103,13 @@ if openjpeg.found()
}
endif
if libjxl.found() and libjxl_threads.found()
common_plugins_list += {
'name': 'file-jpegxl',
'deps': [ gtk3, gegl, libjxl, libjxl_threads, ],
}
endif
if libmng.found()
common_plugins_list += { 'name': 'file-mng',
'deps': [ gtk3, gegl, libmng, libpng, ],

View file

@ -32,6 +32,7 @@
'file-heif' => { ui => 1, optional => 1, gegl => 1, libdep => 'GEXIV2:LCMS', libs => 'LIBHEIF_LIBS', cflags => 'LIBHEIF_CFLAGS' },
'file-html-table' => { ui => 1, gegl => 1 },
'file-jp2-load' => { ui => 1, optional => 1, gegl => 1, libs => 'OPENJPEG_LIBS', cflags => 'OPENJPEG_CFLAGS' },
'file-jpegxl' => { ui => 1, optional => 1, gegl => 1, libdep => 'JXL:JXL_THREADS', cflags => 'JXL_CFLAGS' },
'file-mng' => { ui => 1, gegl => 1, optional => 1, libs => 'MNG_LIBS', cflags => 'MNG_CFLAGS' },
'file-pat' => { ui => 1, gegl => 1 },
'file-pcx' => { ui => 1, gegl => 1 },