| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
| |
‘int’ and ‘long unsigned int’ [-Wsign-compare]
|
|
|
|
|
|
|
|
|
|
| |
Fix alignment of vector of floats in babl-rgb-converter.c
Downstream Bug (Gentoo): https://bugs.gentoo.org/857708
Bug: https://gitlab.gnome.org/GNOME/babl/-/issues/76
Thanks-to: Alexander Bezrukov <phmagic@mail.ru>
Signed-off-by: Alexander Bezrukov <phmagic@mail.ru>
Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
|
| |
|
| |
|
|
|
|
|
|
|
| |
This reverts commit b3e884edf3b5c58fb4c2cede1346bd8a9d9c4a1e.
benchmarking on x86_64 saw no effect, and as a surprise on arm
it pessimises performance.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This is relevant for ARM, on modern x86_64 at least it is cheaper to
convert to/from float with external loops.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Some extensions have their own separate build, so does the
RGB color space conversions, trc computations and base
set of conversions.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This reverts commit 84128d538aa4f189c31d296d04084762ce062107.
after having set global cflags opting out of unsafe math see issue #49.
|
|
|
|
|
|
| |
This makes the reference code paths used for verifying conversions in
extensions not involve for instance fast reciprocal approximations, see issue
#49. The extensions are still compiled with full optimizations.
|
|
|
|
|
|
|
| |
We do not need to treate positive/negative avoided infinities differently,
the result is the same as long as we are consistent, and only using the
positive epsilon value leads to slightly simpler per-pixel conversion code
in both directions.
|
| |
|
|
|
|
|
| |
When registering types, models, formats and components one can now
specify override "doc" strings that end up in this reference.
|
| |
|
|
|
|
|
| |
The terminology that babl has settled for - for the different types
of alpha is associated- and separate- alpha.
|
| |
|
|
|
|
|
| |
Use multiplication by the inverse instead of division in
premultiplied to non-premultiplied alpha conversion functions.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 */
}
```
|
|
|
|
| |
Really resolving merge request !12 this time.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
In order for higher level code to be abstracted across all available
permutations we need this. This fixes gegl issue no 151
|
| |
|
|
|
|
| |
fixed style of function headers in the babl/base folder
|
|
|
|
|
| |
Fix meson build.
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
|
| |
|
| |
|
|
|
|
|
| |
Since babl-space.h includes lcms2.h, we need to include LCMS_CFLAGS
everywhere that includes babl-internal.h.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
Refactored from new API needed internally for knowing if a model is CMYK based
or not, this permits adding meta-data that can be quickly figured out in
possible fast code paths. The API is not complete, and it probably doesn't harm
to include as many features from different models as possible that fit in a
bitmask, adding the most important ones first and maintaining the order of the
enum will ensure API compatibility once it is in a release.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
This reverts commit 18dea5104f3de79af5e9641a0ef47435b112d44b.
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.
|
| |
|
| |
|