babl: make LUT from 2bpp to 4bpp totally generic.
authorJehan <jehan@girinstud.io>
Fri, 17 Feb 2023 21:45:11 +0000 (22:45 +0100)
committerJehan <jehan@girinstud.io>
Fri, 17 Feb 2023 22:36:42 +0000 (23:36 +0100)
commit8bae33d8127e18d4a1312ec590bfa26a85ca8bd2
tree3eabb9f31380497700a525d9026c4dc77d45a4cd
parent920aee0b73805cf8f3acb57ff7975c07b004452f
babl: make LUT from 2bpp to 4bpp totally generic.

The deleting of the first byte when creating the LUT, then copying the
first byte from source to destination, worked for cases such as "YA u8" to
"RGBA u8" but it would not work for say:

* "Y half" to anything: in such a case, deleting the first byte in LUT's
  content, when creating it, we are basically deleting source's color
  information!
* "YA u8" to "Y float": in such a case, when copying the first byte, at
  conversion time, we are destroying the result color (which didn't need
  any copying of alpha channel as there is no alpha channel in the
  result).
* And so on.

In such cases, it's just better to include everything in the LUT, in a
totally model-agnostic way. In some cases, the alpha channel will be
stored in the LUT, in others, not. But it's not really a problem. It
doesn't even make the LUT bigger; if anything, it makes the LUT creation
and the conversion calculus simpler, hence faster.
babl/babl-fish-path.c