The JSON file is called workingspaces.json, it can be either in the global iccprofiles directory, or in the user's ICC profiles dir (set in preferences).
The format is the following:
{"working_spaces": [
{
"name" : "ACES",
"file" : "/path/to/ACES.icc"
},
{
"name" : "ACEScg",
"matrix" : [0.7184354, 0.16578523, 0.09882643, 0.29728935, 0.66958117, 0.03571544, -0.00647622, 0.01469771, 0.66732561]
}
]}
if "matrix" is present, "file" is ignored. If only "file" is present, the matrix is extracted from the ICC profile. For this, we look only at the R, G, and B matrix columns and the white point set in the profile. Bradford adaptation is used to convert the matrix to D50. Anything else (LUT, TRC, ...) in the profile is ignored.
It is the user's responsibility to ensure that the profile is suitable to be used as a working space.
User jgschaefer [reported an error on pixls.us](https://discuss.pixls.us/t/rt-build-from-git-crash-on-launch-debian-testing-64-bit/1425)
which could be traced down to an empty basename for a HaldCLUT. The
original implementation did not throw an exception due to the use of
`std::string::substr()` instead of `std::string::erase()`, but silently
assigned the first working profile to `profile_name`.
Ingo has provided a solution for the strange Windows crash with
`_mm_cvtpu16_ps()`: It was not an alignment problem, but the use of
MMX instructions which led to the SEGV.
Now Ingo's solutions omits MMX instructions altogether and is
nevertheless faster than the `_mm_set_ps()` workaround.
Many thanks to @heckflosse!
Ingo had some cleanup suggestions in #3154 which I tried to realize with
this commit. Although switching to `vfloat2` is a clever idea, I can see
no further speedup.
Instead of using an `Image16`, which is organized in planes, store the
HaldCLUT in an `AlignedBuffer<std::uint16_t>` with sequential RGBx
values. This gives a speedup of roughly 23% here.
This commit adds a true LRU cache to `rtengine` which is used in the new
`CLUTStore` class. The code in `clutstore.*` was cleaned up with C++11
features and small optimizations taken from my `clutbench` project.
The `CLUTStore` class was converted to a true singleton.