babl: use _aligned_malloc() instead of aligned_alloc() on Win32.
Thanks to Lionel N. for raising the issue. It was failing to build for
Windows with:
> babl/babl-space.c:503: undefined reference to `aligned_alloc'
Windows has apparently a similar API, except that the size and alignment
parameters are inverted.
See https://msdn.microsoft.com/library/8z34s9c6.aspx
Many of the code paths are now duplicated, the duplication should decrease as
the SSE2/SIMD versions evolve further and stop resembling the code they were
cloned from.
Øyvind Kolås [Thu, 31 Aug 2017 22:02:32 +0000 (00:02 +0200)]
babl: change MAX_BUFFER_SIZE to 512
This is the value that determins the smaller size big buffers are broken up in
and processed chunk-by chunk for multi-path conversions.
With tools/babl-benchmark for a particular workload and machine the following
results were attained, all values are in mb/s. There seem to be two sweet-spots
one around 128 and one around 512. Now using 512 which probably has better
cache behavior on most cpus than the old value 2048.
Øyvind Kolås [Wed, 30 Aug 2017 15:09:28 +0000 (17:09 +0200)]
babl: speed up trc dispatch
By splitting the core computation done by the TRC down to callbacks of
different types, that all optionally can use the provided trc object. This way
we can move the conditional for the polymorphism out of loops. The higher level
API of using the TRC still works - and is also accelerated by this change.
Øyvind Kolås [Tue, 29 Aug 2017 09:51:17 +0000 (11:51 +0200)]
babl: on demand clone sRGB conversions
When a new RGB space is encountered clone all sRGB space to sRGB space
conversions, under the assumption that they are implemented respecting/using
the customizable TRCs of babl.
Øyvind Kolås [Tue, 29 Aug 2017 18:21:32 +0000 (20:21 +0200)]
tools/babl-benchmark: exclude conversions to self from average
The fast path the checks for source == dst, and replace with memcpy works,
including these memcpy aliases makes the barchart harder to read and the
average further from the median.
Øyvind Kolås [Sun, 20 Aug 2017 23:40:25 +0000 (01:40 +0200)]
babl: use typedefs and structs for fixed point numbers
also adds code to print exact decimal representations of numbers found in icc
files, can be useful for tuning constants fed in - our observing differences,
it turns out that ~6digits of precision is enough for double float and fixed point 32bit to differ in values in icc profiles.
Øyvind Kolås [Sun, 20 Aug 2017 20:39:04 +0000 (22:39 +0200)]
tools: add babl-icc-dump
This commandline tool contains code to parse the v4 elements babl-icc currently
doesn't make use of. It loads data from the ICC profile directly into double
precision floats.
Ell [Fri, 23 Jun 2017 11:30:40 +0000 (07:30 -0400)]
palette: make the conversion hash table volatile
... to avoid the theoretical possiblity of hash table entires being
read more than once during conversion, defying atomicity. Very,
*very* paranoid, but what the hell :P
Ell [Wed, 21 Jun 2017 17:53:08 +0000 (13:53 -0400)]
palette: make palette conversion thread safe
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.
Ell [Thu, 8 Jun 2017 13:20:29 +0000 (09:20 -0400)]
Bug 780016 - Conversion path between nonpremultiplied formats ...
.. 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.