[color correction] Add 3D LUT correction

  • Hello,
    Currently, the color correction proposed by hyperion is a 1D correction by matrix transformation.
    Matrix transformation is ideal for transforming a linear space into another linear space. For example, to transform a video from the Rec. 2020 space (4K) to the Rec. 709 space (HD).
    However, the matrix transformation for color correction is really not suitable:
    - when the gamma must be corrected (this is a curve)
    - when the RGB channels are not independent (eg. asking for red will also lower the blue)
    For these reasons, lookup tables (LUT) are used to correct screens and projectors. LEDs have the same problems... worse.

    I have just coded this type of correction for FastLED. The result is quite satisfactory (15ms to correct 300leds by an arduino nano) but it's still quite expensive for such a small machine. That is why I think it would be interesting to propose this type of correction in hyperion.

    Autodesk 3DLUT to C 3D array (html)
    3DLUT color correction on GitHub:

  • I finally have a little time to look at the dev. I'm not usualy work on cpp projects so I just finished preparing my dev environment (vm linux, IDE etc). I have some questions about RgbTransform before begin:

    • Can you explain the differences between each variable/transformation brightness?
    • Can you tell me in what order the different transformations are applied?
    • I believe that some transformations (backlight, minBrightness and maxBrightness) can be applied to your 1D LUT (_mappingR/G/B) rather than being calculated on the fly. What do you think?
    • Can we consider a 'Chain of responsibility' pattern for RgbTransform. it will allow to separate well each type of transformation and to add new ones more easily (hue, saturation, etc)?
  • Brindosch
    Hello and sorry I haven't heard from you in a long time.
    I just wanted to let you know that I haven't given up even though I can't free up any time right now and take stock.

    I decided to create an external library. This is motivated by:
    - the problem is not specific to hyperion. for example, FastLED users will probably be interested in color correction for other projects.
    - the classic benefits of modularization: easier to test, develop, reuse, maintain, replace etc.

    My design choices are based on a paper from spectralcal (which is a specialist in color correction): http://www.spectracal.com/Documents/White Papers/Best Practices - 3D LUT Implementation for Manufacturers.pdf

    I decided to create a library of color processing components that can be arbitrarily chained. The code is available on my spike branch
    I spent most of my time on gtests, CMake and Travis (quality is paramount to me) but the general idea still emerges.

    I hope I can get back to work on it.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!