Add support for the Little CMS fast float plugin
On a sample of JPEGs, it improved loading speed from ~0.26s to ~0.15s. Unfortunately, it isn't normally installed.
This commit is contained in:
parent
1c61fcc5bc
commit
338ae69121
@ -42,8 +42,9 @@ Build-only dependencies:
|
||||
Meson, pkg-config, asciidoctor or asciidoc (recommended but optional) +
|
||||
Runtime dependencies: gtk+-3.0, glib>=2.64, pixman-1, shared-mime-info,
|
||||
libturbojpeg, libwebp, librsvg-2.0 (for icons) +
|
||||
Optional dependencies: lcms2, LibRaw, librsvg-2.0, xcursor, libheif, libtiff,
|
||||
ExifTool, resvg (unstable API, needs to be requested explicitly) +
|
||||
Optional dependencies: lcms2, Little CMS fast float plugin,
|
||||
LibRaw, librsvg-2.0, xcursor, libheif, libtiff, ExifTool,
|
||||
resvg (unstable API, needs to be requested explicitly) +
|
||||
Runtime dependencies for reverse image search:
|
||||
xdg-utils, cURL, jq
|
||||
|
||||
|
10
fiv.c
10
fiv.c
@ -43,6 +43,11 @@
|
||||
#include "fiv-thumbnail.h"
|
||||
#include "fiv-view.h"
|
||||
|
||||
#ifdef HAVE_LCMS2_FAST_FLOAT
|
||||
#include <lcms2.h>
|
||||
#include <lcms2_fast_float.h>
|
||||
#endif // HAVE_LCMS2_FAST_FLOAT
|
||||
|
||||
// --- Utilities ---------------------------------------------------------------
|
||||
|
||||
static void exit_fatal(const char *format, ...) G_GNUC_PRINTF(1, 2);
|
||||
@ -2382,6 +2387,11 @@ on_app_handle_local_options(G_GNUC_UNUSED GApplication *app,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO(p): Use Little CMS with contexts instead.
|
||||
#ifdef HAVE_LCMS2_FAST_FLOAT
|
||||
cmsPlugin(cmsFastFloatExtensions());
|
||||
#endif // HAVE_LCMS2_FAST_FLOAT
|
||||
|
||||
// Normalize all arguments to URIs, and run thumbnailing modes first.
|
||||
for (gsize i = 0; o.args && o.args[i]; i++) {
|
||||
GFile *resolved = g_file_new_for_commandline_arg(o.args[i]);
|
||||
|
22
meson.build
22
meson.build
@ -25,11 +25,12 @@ libjpegqs = dependency('libjpegqs', required : get_option('libjpegqs'),
|
||||
lcms2 = dependency('lcms2', required : get_option('lcms2'))
|
||||
# Note that only libraw_r is thread-safe, but we'll just run it out-of process.
|
||||
libraw = dependency('libraw', required : get_option('libraw'))
|
||||
# This is a direct runtime dependency, but its usage may be disabled for images.
|
||||
librsvg = dependency('librsvg-2.0', required : get_option('librsvg'))
|
||||
xcursor = dependency('xcursor', required : get_option('xcursor'))
|
||||
libheif = dependency('libheif', required : get_option('libheif'))
|
||||
libtiff = dependency('libtiff-4', required : get_option('libtiff'))
|
||||
# This is a direct dependency of GTK+, but its usage may be disabled.
|
||||
# This is a direct dependency of GTK+, but its usage may be disabled for images.
|
||||
gdkpixbuf = dependency('gdk-pixbuf-2.0', required : get_option('gdk-pixbuf'))
|
||||
dependencies = [
|
||||
dependency('gtk+-3.0'),
|
||||
@ -53,6 +54,24 @@ dependencies = [
|
||||
cc.find_library('m', required : false),
|
||||
]
|
||||
|
||||
# As of writing, no pkg-config file is produced, and the plugin is not installed
|
||||
# by default. The library can be built statically, but it's a bit of a hassle.
|
||||
have_lcms2_fast_float = false
|
||||
if not get_option('lcms2fastfloat').disabled()
|
||||
lcms2ff = dependency('lcms2_fast_float', required : false)
|
||||
if not lcms2ff.found()
|
||||
lcms2ff = cc.find_library(
|
||||
'lcms2_fast_float', required : get_option('lcms2fastfloat'))
|
||||
if lcms2ff.found() and not cc.has_header('lcms2_fast_float.h')
|
||||
error('lcms2_fast_float.h not found')
|
||||
endif
|
||||
endif
|
||||
if lcms2ff.found()
|
||||
dependencies += lcms2ff
|
||||
have_lcms2_fast_float = true
|
||||
endif
|
||||
endif
|
||||
|
||||
# As of writing, the API is unstable, and no pkg-config file is produced.
|
||||
# Trying to wrap Cargo in Meson is a recipe for pain, so no version pinning.
|
||||
have_resvg = false
|
||||
@ -85,6 +104,7 @@ endif
|
||||
|
||||
conf.set('HAVE_JPEG_QS', libjpegqs.found())
|
||||
conf.set('HAVE_LCMS2', lcms2.found())
|
||||
conf.set('HAVE_LCMS2_FAST_FLOAT', have_lcms2_fast_float)
|
||||
conf.set('HAVE_LIBRAW', libraw.found())
|
||||
conf.set('HAVE_RESVG', have_resvg)
|
||||
conf.set('HAVE_LIBRSVG', librsvg.found())
|
||||
|
@ -3,6 +3,8 @@ option('tools', type : 'feature', value : 'disabled',
|
||||
|
||||
option('lcms2', type : 'feature', value : 'auto',
|
||||
description : 'Build with Little CMS colour management')
|
||||
option('lcms2fastfloat', type : 'feature', value : 'auto',
|
||||
description : 'Build with Little CMS fast float plugin support')
|
||||
option('libjpegqs', type : 'feature', value : 'auto',
|
||||
description : 'Build with JPEG Quant Smooth integration')
|
||||
option('libraw', type : 'feature', value : 'auto',
|
||||
|
Loading…
Reference in New Issue
Block a user