Øyvind Kolås [Mon, 12 Nov 2018 22:35:31 +0000 (23:35 +0100)]
babl: implement CMYK color model in reference and base
This commit adds support to the reference fishes of babl to deal
with CMYK based pixel format encodings, backed by babl spaces with
ICC CMYK ICC profiles.
Øyvind Kolås [Fri, 16 Nov 2018 17:27:32 +0000 (18:27 +0100)]
babl: properly cache runtime inserted conversions
The old behavior of avoiding colliding names used in the conversion database
is still used during loading of extension permitting multiple conversions
to be registered for runtime profiling.
Accelerate the R'G'B'A u8 -> cairo-ARGB32 conversion by processing
the entire RGBA tuple in parallel (or, on 32-bit machines, in two
parts), instead of component-by-component, using wide integer
arithmetic/logic. This speeds the conversion up by ~25%.
babl-fish-reference: add lock to part of float reference
This fixes problems that occur during GEGLs documentation gallery build
when multiple threads are in use (the default). The critical section has
experimentally been made as short as possible to avoid babl memory
inconsistencies - without identifing the core race.
Øyvind Kolås [Fri, 31 Aug 2018 10:54:10 +0000 (12:54 +0200)]
babl: remove more missing fast path warnings
We no longer want to warn, since warnings are also triggered when the
fast path is better than the best path found, something that happens
when we-re finding long paths and the reference is better.
Maybe we should still print warnings according to better heuristics to be able
to warn and encourage complete fast path coverage, fast paths should still be
able to beat the reference in a few steps.
Øyvind Kolås [Fri, 31 Aug 2018 09:18:30 +0000 (11:18 +0200)]
babl-fish-reference: factor out separate function for float/double
babl_fish_reference_process now only contains the dispatch tree that
tries various fast paths first before ending up in the float or double
synthetic references.
We want to be able to do component by component average/weighting of
remultiplied values, by breaking the floor for black alpha zero we
break the consistency of such arithmetic.
Øyvind Kolås [Thu, 30 Aug 2018 00:50:38 +0000 (02:50 +0200)]
tools: fix utf8 mode of diagram, change gradient unit in html
The gradient in the html mode is now pixels per time, not bytes
read+written per time, which seem to be more fair in assessing
the reference conversions of
different pixel sizes.
Øyvind Kolås [Wed, 29 Aug 2018 13:28:41 +0000 (15:28 +0200)]
babl-fish-reference: implement floating point version of reference path
This relies on conversions, linear or planar, being registered to and from
RGBA float, similar to the already existing reference conversions in double.
To enable use of it set the environment variable BABL_REFERENCE_FLOAT to any
value, babl will crash if the above requirement is not met for a requested
conversion - permitting adding it - fallback code could be added that implements
it using the double versions when missing - but not having a full coverage at
least for the commonly used formats defeats the purpose.
Øyvind Kolås [Mon, 27 Aug 2018 20:57:54 +0000 (22:57 +0200)]
babl-fish-reference: do some conversions in single precision float
This permits these conversions to go through floating point instead of double
precision when non of the involved format have more than 32bit precision,
this might be determinetal to u32 but is right for u8 and u16 which we rely
most on.
We also disable the missing fast path messages, since now many references;
through internal shortcuts are faster than some long chains, perhaps some
of these reference fast paths should be split out as new categories of fishes.
Øyvind Kolås [Fri, 24 Aug 2018 17:16:34 +0000 (19:16 +0200)]
base: preserve color in premutiplied alpha
Alpha values below BABL_ALPHA_FLOOR gets stored in the components
as BABL_ALPHA_FLOOR with alpha also set to BABL_ALPHA_FLOOR,
recovery from pre-multiplied to non-premultiplied is done as normal.
BABL_FLOOR is set to be 1/65536.0 with a hope that this gives us
approximately 8bit of color data preserved when using half-float.
Upon encountering exactly BABL_ALPHA_FLOOR in premultiplied conversion
to non-premultiplied interprets this as 0.0, making pure 0.0 values
round trip correctly from RGBA to RaGaBaA back to RGBA.
This makes a lot of extensions invalid - as expected but it already
allows testing the behavior of GEGL and GIMP with this additional
feature from babl.
Øyvind Kolås [Tue, 21 Aug 2018 16:08:47 +0000 (18:08 +0200)]
babl: add performance flag to intent, issue #21
Add BABL_ICC_INTENT_PERFORMANCE which can be ored into the intente
num when requesting that babl constructs a space using
babl_space_from_icc, when PERFORMANCE is requested babl will permit
matrix+trc over cLUT, and when it is an intent without a performance
modifier this does not apply.
The default behavior for Agryll when creating cLUT profiles seem to be
embedding an obviously incorrect XYZ matrix, meaning that for now we cannot use
the matrix for our relative colorimetric transform, and in the future the
profile will be incapable of doing dynamic trade-offs between performance and
accuracy by using matrix over cLUT during interactive operations.
We detect the swapped primaries in combination with presence of cLUTs and then
bail on constructing a valid babl space, as well as provide debug information
about why the profile cannot be used by babl.
Ell [Sat, 4 Aug 2018 06:18:37 +0000 (02:18 -0400)]
babl-cache: store reference fishes in the cache
When we only have a reference fish for a given conversion, and not
a path fish, store a corresponding entry in the cache, marked by a
"[reference]" tag in the fish's attributes line, and containing no
conversion list. When reloading the cache, make sure a reference
fish is created for the conversion without trying to construct a
path fish, so that we don't waste time trying to search for a
conversion path.
Note that we still show a "missing fast path" warning, even for
cached reference fishes.
Rely on any format string containing the substring "-space" that this
substring is the marker for the end of the encoding part of the format
name - which is what we want replicated in our new format with a different
color space.
We now do two iterations of +1 and +2 path lengths that take much longer than
the configured path lengths - and now complain with a debug output listing the
set of conversions taken to satisfy the request - giving hints on what parts
could possibly be shortened to fewer steps.
With this commit the first level of searching deeper also gets a debug message
which would cause GIMP to print a message in some places where it earlier
wouldnt have warned about missing fast paths.
babl: allow querying chromaticities for spaces made with matrix
Do this by computing the chromaticities coordinates of the colors
.. #ff0000 #00ff00 and #0000ff, this also harmonizes the serialized
name to always be chromaticities, white point and trcs.