# LUT

LUT is the shortened description of the term ‘Look-Up-Table’. In its simplest form it consists of a finite number of  positive integer input values which map to new output values. Typically a LUT will take 2n (64, 128, 256…) input values from 0 to 2n – 1 and map the input to the new output. Although they can be any size required. For example, a small LUT of size 16 might look like this when describing a math function where the output = input2 :

InputOutput
00
11
24
39
416
525
636
749

etc.

The example shows positive integer address (input) producing an integer Output. This need not be the case; the output could be floating point or any number form needed.

Although the sample LUT above is a mathematical model this does not have to be the case as the input can refer to any value the user desires so LUTs are very convenient where there may be no distinct or a very complex connection between the input values and the output.

LUTs are very common in hardware based systems as they can be used to simplify a mathematical process to map Input address to Output very efficiently. With today’s high performance GPU math processes the developer needs to consider whether the LUT is as efficient as just doing the math on each value.

Inputs to LUTs are typically positive integers. It is possible to engineer a more complex form of LUT which takes a floating point input. Here the LUT is used to look up integer values above and below the Input value and the final result is interpolated from there. For example:

Input value = 3.4

For LUT Input value 3 the Output = 27.5 (these values come from some other complex process)

For LUT Input value 4 the Output  = 29.5

The final output will be 27.5 + (29.5 – 27.5) * 0.4 = 28.3.

Thus a complicated math process can be approximated by a LUT and a simple interpolation.

This process can be expanded further into multi-dimensional LUTs where the Output is a result of multiple Input values.

In image processing systems LUTs can be used for gamma correction, color space conversion (rgb to XYZ, yuv to rgb) and color correction for example.