LUTs

LUT stands for Lookup Table.

Description

As its name suggests, it’s a simple table of values, allowing to match some input values with other output values. In computing, it’s a convenient way to replace complex mathematical functions, the result of time-consuming calculations, with a simple search in the table, which can greatly improve performance: instead of having to recalculate, the results are already available in memory.

There’s a use for them with colors; it’s a simple way to match an input color to a different output color: it’s therefore a table that allows to adjust the colors or convert color spaces, describing them, color by color.

The main advantage of a LUT is that any program can easily use them and thus convert from and to color spaces which aren’t provided natively by the program; instead of having to “know” the mathematical functions which define a color space (in particular the transfer curve), the program has only to read the results in the table without having to carry out the calculation. It’s a utility tool, for conversion.

They’re also a way to “save” any color adjustment; even if an adjustment is made using multiple effects in an application (levels, curves, saturation…), it can be described and saved as a single LUT and then reapplied easily, and in any application capable of reading a LUT. In this case, it is an artistic and practical use.

Here is an example of a few lines of values from a LUT, which really is just a text file containing such a table of values:

R G B
0 0 0
0 0 298
0 0 596
0 0 894
0 351 0
0 326 260
0 302 558
0 278 856
381 3784 0
282 3760 0
184 3736 117
85 3712 415

A LUT doen’t describe all possible color matches, but a selection of colors; to obtain a color that isn’t in the table, it’s necessary to perform interpolation. Usually, the application using the LUT allows to select different interpolations which will change the way these colors are obtained (by rounding, linear interpolation, etc.).

The quantity of values contained in a LUT is therefore very important for the quality of the output image: being only a table of limited values, there can be a loss during the conversion and the result can more or less differ from a true mathematical operation. However, the difference isn’t discernible in case of a LUT with many values, such as those used by OCIO + ACES for its conversions for example. See Chapter OCIO, ACES.

Usage

There are many different file formats for LUTs, depending on applications, developers, etc. Here are some examples (formats supported by FFmpeg):

Extension Name, publisher, application…
3dl Discreet / After Effects / Autodesk
cube Iridas / Resolve
dat DaVinci
m3d Pandora
csp cineSpace
spi1d, spi3d Sony Pictures Imageworks

It can be useful to convert between different LUT formats; OCIO includes a command line conversion tool, for which the DuME media encoder provides a graphical interface.

There are two types of LUT: 1D LUT and 3D LUT.

1D LUT

1D LUT work only on the luminance and do not modify colors. Having only one dimension, they’re lighter and simpler than 3D LUTs and are useful for gamma* conversions, e.g. between two color spaces which would have the same primaries*. See chapter Transfer curves, linear space and gamma.

3D LUT

The 3D LUT work on the three red, green and blue channels. They therefore allow detailed adjustments of both luminance and hues as well as saturation. They allow artistic effects as well as conversions from and to any color space.

Whatever the type of LUT, these conversion tables offer only a simple correspondence of value, each LUT is designed for a precise input space and colors and can’t be used indifferently on any image!

For example, a LUT that converts to the Rec.2020 color space is specifically intended to be applied to an image in another specific color space, e.g. Rec.709; in this example, it cannot be used on an sRGB image, unless it has been converted to Rec.709 first.

This is also true for LUTs that are for artistic use. It’s necessary to know on which space and which type of image each LUT is supposed to be applied. Depending on the application, the configuration of workspace is therefore important when using LUT, or you must at least be aware of it in order to make any conversions prior to using LUT (which means that they’re not as simple as they seem).


Sources & References


  1. Beware, his conclusion contains an error. In the otherwise very good article, James Ritson explains that a 1D LUT can be used to convert an image from Rec.2020 to Rec.709, which is wrong since the primaries* of the two spaces are different, not just the transfer curve*. You must then use a 3D LUT. On the other hand the conversion from Rec.709 to sRGB is well possible with a LUT 1D since only the transfer curve is different.