[go: up one dir, main page]

Incorrect rgb_to_xyz behaviour (for some data)

Siril version: 1.2.x, master

Siril does not correctly handle rgb to XYZ / LAB conversion and this is detrimental for some uses.

The rgb to LAB conversion uses rgb_to_xyz and xyz_to_LAB. However rgb_to_xyz should more accurately be called sRGB_to_xyz as it implements a specific conversion.

This causes a problem. Sometimes Siril works with stretched data that we consider approximately sRGB and that's fine. However several functions are optimised for use on linear data, including noise reduction and deconvolution. Both of these prefer to operate on luminance data because L has better SNR and it reduces the computation. But this function takes what should be nonlinear (gamma = 2.4) sRGB data and linearizes it - except when we're working with what start out as linear data this function incorrectly applies a gamma = 1/2.4 transform and destroys the linearity. This means deconvolution and noise reduction are currently not working optimally (and perhaps other functions where linear data is transformed using rgb_to_xyz etc.) (Edit: deconvolution uses a linear YCbCr transform and therefore actually doesn't need this fix, but denoising does.)

In 1.4 this is mostly resolved by the color management MR; for 1.2 it can be solved, it will require writing linear_rgb_to_xyz() etc and either assuming that users are following the recommendation and carrying out these operations on linear data or providing a toggle to switch between optimisation for linear or stretched data.

Edited by Adrian Knagg-Baugh