Filter "CLUT from After - Before Layers" @ full coloured dupe

I’ve to admit in advance that I haven’t read the article’s details
how that algorithm is realized.

My observation is about generating an identity HCLUT.

This should simply be accomplished by taking a (lossless) image
with all colors different and its duplicate.
“Influence of Color Samples” shouldn’t have any effect,
as long as the CLUT Resoltion is large enough:
there will be no interpolation necessary as all colors are used.
(Make it 100% anyway).

So, why not take an identity Hald CLUT for the test,
say level 8 from https://im.snibgo.com/edithald.htm
Choose 64 as CLUT resolution.

My expectation:
Output should be identical to the input.

Result:
But the pointwise arith. difference counts 8 different colors occuring
(each color component +/-1).
In about kind of regular patterns for R und G channel,
and mostly in the bottom half for B channel.
Still the generated CLUT has same (full) color count as the input,
which means the colors have been “exchanged” (???).

A bug?
Rounding errors?
Wrong understanding/ expectation?

G’MIC v.3.3.2 PlugIn @ GIMP 2.10.32 @ Win7-64
Arithm. @ PSP7

Some thoughts about this:

  • For details about the algorithm used for CLUT reconstruction, see Section 4 of this paper.
  • This algorithm involves a lot of different steps, some of them requiring 3D interpolation (multi-scale CLUT reconstruction).
  • So, yes, I’m not really surprised by the differences you get.

I think the only way you can get an exact identity CLUT in your case is to have an image that has the 2^24 different RGB colors. Having all colors as known keypoints for the CLUT should render an identity CLUT (not tested though).

Exactly that was my idea when using an input whose pixels are all different,
and their number smaller than the maximal possible number of keypoints.
All input’s colors should be taken as keypoints then…
Well, that doesn’t seem to be right.
Using an all-color 2^24 input and to downsize to an n-level HCLUT… hmm…
(Maybe have to generate the HCLUT manually point by point…?)