| Commit message (Collapse) | Author | Age |
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Add missing lcms dependencies. That's needed when lcms is a subproject
otherwise those targets does not find its headers.
- Add lcms2 wrap so meson can build it as subproject in case the
dependency is not found on system.
- Fix couple meson warnings
- Use meson.override_dependency() so babl can be used as subproject
without hardcoding "babl_dep" variable name in main project.
|
|
|
|
|
| |
This is testing D50 XYZ to D50 CIE Lab the use of D50 for all XYZ and
Lab is currently implicit in all babl code.
|
| |
|
| |
|
|
|
|
| |
- add build path variables for library and extensions
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Provide symmetric, color data preserving conversions between associated and
separate alpha for alpha values near and equal to 0.0 at single precision
floating point. Thus these symmetric conversions also augment associated alpha
to always maintain color information.
This is achieved by clamping the alpha used when computing the color
components when multiplying/dividing components between separate and
associated alpha to BABL_ALPHA_FLOOR and -BABL_ALPHA_FLOOR for values
near 0.0, the alpha value is copied unmodified between pixels; the main
improvement of this commit.
In the implementation BABL_ALPHA_FLOOR is 1/65536 = 0.00001526.. small
enough that it vanishing in rounding for 16bit integer alpha but large
enough to retain color data.
The following table illustrates what corresponding values are between the
two alpha encodings supported. We here usea BABL_ALPHA_FLOOR of 0.01 instead
of 0.00001526 to make it easier to see what happens.
```
"RGBA float" "RaGaBaA float"
separate alpha associated alpha
non-premultiplied pre-multiplied alpha
R G B A Ra Ga Ba A
10.000 1.000 0.100 0.000 0.100 0.010 0.001 0.000
10.000 1.000 0.100 0.005 0.100 0.010 0.001 0.005
__10.000___1.000__0.100__0.010_____0.100__0.010__0.001__0.010__
10.000 1.000 0.100 0.020 0.200 0.020 0.002 0.020
10.000 1.000 0.100 0.200 2.000 0.200 0.020 0.200
10.000 1.000 0.100 0.400 4.000 0.400 0.040 0.400
1000.000 100.000 10.000 0.000 10.000 1.000 0.100 0.000
1000.000 100.000 10.000 0.005 10.000 1.000 0.100 0.005
1000.000_100.000_10.000__0.010____10.000__1.000__0.100__0.010___
500.000 50.000 5.000 0.020 10.000 1.000 0.100 0.020
50.000 5.000 0.500 0.200 10.000 1.000 0.100 0.200
25.000 2.500 0.250 0.400 10.000 1.000 0.100 0.400
```
GEGL lets each operation compute with it's preferred encoding - for some
operations like blurs this is associated alpha, for others like color
adjustments it is separate alpha, perhaps even in CIE Lab based encodings
rather than RGB. An earlier iteration of this approach was already in use in
babl making un-erase mode and similar features in GIMP-2.10 work correctly
after blurring, the previous implementation did not preserve the
alpha value.
Just the core of the implementation follows:
```
#define BABL_ALPHA_FLOOR_F (1.0f/65536.0f)
static inline float
babl_epsilon_for_zero_float (float value)
{
if (value <= BABL_ALPHA_FLOOR_F)
{
/* for performance one could directly retun BABL_ALPHA_FLOOR_F here
and dropping handling negative values consistently. */
if (value >= 0.0f)
return BABL_ALPHA_FLOOR_F;
else if (value >= -BABL_ALPHA_FLOOR_F)
return -BABL_ALPHA_FLOOR_F;
}
return value; /* most common case, return input value */
}
static inline void
separate_to_associated_rgba (const float *separate_rgba,
float *associated_rgba)
{
float alpha = babl_epsilon_for_zero_float (separate_rgba[3]);
associated_rgba[0] = separate_rgba[0] * alpha;
associated_rgba[1] = separate_rgba[1] * alpha;
associated_rgba[2] = separate_rgba[2] * alpha;
associated_rgba[3] = separate_rgba[3]; /* direct copy */
}
static inline void
associated_to_separate_rgba (const float *associated_rgba,
float *separate_rgba)
{
float alpha = babl_epsilon_for_zero_float (associated_rgba[3]);
float reciprocal_alpha = 1.0f / alpha; /* the conditional normally in
this conversion to avoid
division by zero is handled by
epsilon_for_zero */
separate_rgba[0] = associated_rgba[0] * reciprocal_alpha;
separate_rgba[1] = associated_rgba[1] * reciprocal_alpha;
separate_rgba[2] = associated_rgba[2] * reciprocal_alpha;
separate_rgba[3] = associated_rgba[3]; /* direct copy */
}
```
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Update to use R'G'B' u8 formats, which is what is now used internally
as well well, along with updating to use the current way of creating
formats with/without transparency.
|
| |
|
| |
|
|
|
|
|
| |
Since babl-space.h includes lcms2.h, we need to include LCMS_CFLAGS
everywhere that includes babl-internal.h.
|
| |
|
| |
|
|
|
|
|
| |
Testing that both R'G'B' formats and CIE Lab float keep the space they have
been created with.
|
|
|
|
|
|
|
|
|
|
| |
Fix palette-concurrency-stress-test to accommodate the change to a
gamma-corrected 8-bit format (commit
fabcc6729ed453fb5c5affc565d0e837a78afc5c), and to little-endian
hash indices (commit 55ca45c8233af138d3fd388587b203d802b8396c).
The test should pass regardless, it simply didn't actually test for
the intended issue previously.
|
| |
|
|
|
|
|
|
|
| |
A correctness correction related to bug #763581 the formats wanted
by GIMP and expected are gamma corrected not linear, I expect this
fix either does not much for GIMP or fixes an unknown 8bit linear
vs gamma quantization problem that has been lurking in INDEXED mode.
|
| |
|
|
|
|
|
|
|
| |
In particular Android systems don't need to link with -lpthread
(actually the link would fail with "ld: cannot find -lpthread").
Use the $(THREAD_LIB) variable which is set correctly during configure
since commit c02af82.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Using -lphtread instead of -pthread in Makefile.am fixes the build when using
gcc-x86 under haiku, figured out by schumaml.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Conversion from RGBA u8 to an 8-bit palette format caches conversion
results in a hash table, belonging to the palette model. Currently,
manipulation of the hash table is not thread safe -- when multiple
threads convert to the same palette format concurrently, the result
may be wrong. In particular, there is a race condition when two
different colors that share the same hash are converted concurrently.
Fix this by changing the hash table layout, so that it can be
modified atomically. We assume that aligned 32-bit writes are
atomic.
Note that the new layout is only suitable for palettes with up to
256 colors, but this is all we use the hash table for ATM anyway.
Add a regression test.
|
|
|
|
|
|
| |
"rgba to hsva" -> "hsva to rgba"; got swapped by commit
c8b5eee3f86a49bd093929f0bd16ef780de88c67. Thanks to Edward_E for
catching that.
|
|
|
|
|
|
|
|
|
|
|
| |
.. may pass through a premultiplied format, losing color information
of fully transparent pixels
Add a few pixels with zero alpha to the test pixels array, to penalize
such paths. 16 pixels seem to be enough for the conversions tested,
using the default tolerance.
Add a regression test.
|
|
|
|
|
|
|
| |
Like CHECK_CONV, but for floating point destination types.
Use CHECK_CONV_FLOAT in hsva.c and hsl.c, instead of custom
CHECK_CONV implementations. To be used by another test soon.
|
| |
|
| |
|
|
|
|
| |
This reverts commit 1457ff4d59f1e2fccdf7e09e5725a698afbc5d22.
|
|
|
|
|
|
|
| |
See https://live.gnome.org/GnomeGoals/InstalledTests for more information.
Those tests will also be executed on http://build.gnome.org
It's still possible to run `make check` with locally uninstalled tests.
|