 |
 |
 |
|
3.6 Look-up-tables Look-up
tables or LUTs form a basic technique of visual stimulus generation. The
idea is simple: one number is converted to another by using it as an index
into a table of other numbers. Imagine a set of pigeon-holes each consecutively
numbered and spanning the range of the input set, 0 to 255 for example.
Into each of these boxes place a piece of paper on which is printed another
number selected from an output set. To use the look-up table and convert
one number to another, just go to the box whose address is the number you
currently have and extract the new number on the paper and use that one
instead. Note that the numbers in the look-up table (or the paper in the
boxes) need have no relation to the address of the box nor the numbers
in the other boxes nor need they be unique. Indeed it is quite possible,
and useful, for all the numbers in the look-up table to be the same as
each other.
A look-up table can be implemented easily both in hardware and software.
A software LUT is just an indexable array of numbers, the index being the
input set and the contents of the array the output set while a hardware
LUT is just a random access memory (RAM) where the address lines are driven
by the input number and the data lines provide the output number. Some
method has to be found of writing data in the RAM in the first place but
this is usually easy.

Fig 6. Palette and LUT operation
A perfect use for a LUT is as a method for correcting non-linearities
in a display device, often called gamma correction. The input set is the
desired luminance expressed on a linear scale from 0 to 255 while the output
set are the numbers that must be sent to the digital to analog converters
(DACs) to provide the voltage that will cause the display to generate that
luminance. In this case, the contents of the LUT is usually derived from
prior measurements of the display transfer function. Of course, there is
no reason why the LUT contents need to span the available dynamic range
of the display so if the user needs to reduce the contrast of the stimulus
or change the mean- luminance then this can be done just by changing the
contents of the LUT and without change to the original stimulus at all.
In many cases a stimulus is presented to an observer using a defined temporal
envelope such that the display is initially blank, the contrast is increased
slowly to the desired maximum and then decreased again until the stimulus
has been removed. This is done to reduce artefacts caused by transient
responses and can be implemented entirely using LUTs. Before the experiment
begins, a sequence of LUTs, one for every frame of the stimulus, is pre-calculated
and loaded on to the visual stimulus generator. Then on receipt of a start
command the look-up table is loaded from the pre-calculated values on a
frame by frame basis.
LUTs are also commonly used in the generation of the stimulus itself.
Consider the problem of trying to generate a dynamic noise field on a CRT
display. One technique that can be employed is to draw a complete noise
field into the framebuffer of the stimulus generator. Then after a predetermined
time (say one frame) to draw a completely new field and display that instead,
repeating the procedure for as long as required. The drawback of this scheme
is that it is rarely possible using conventional equipment to achieve both
the recalculation and drawing of the new frame in the time available. A
better technique is to draw a noise field where each little spot of noise
is given a value from the available range of pixel values (normally 0 to
255). The pixel values are then converted to real luminances using a look-up
table. Simply by changing the contents of the look-up table between frames,
which may only involve rewriting 256 numbers, a completely new field can
be created. If binary noise is desired i.e. the pixels are either black
or white, then different combinations of pixel value can be mapped to one
of two luminances in the LUT.
Another example of this kind of technique is the generation of a drifting
sinusoidal grating. As with the noise example above this could in theory
be generated by either pre-computing successive frames of the stimulus
and showing them sequentially, which needs a lot of memory, or by drawing
each new frame on the fly, which needs a lot of processing power. A neater
method involves drawing a saw-tooth waveform into the framebuffer with
the desired orientation and spatial frequency in such a way that the numbers
from the framebuffer form the input set of a look-up table. If the look-up
table is filled with luminances taken from a table of sines then the resulting
output will also have a sinusoidal function. If, in addition, the look-up
table is also reloaded between frames with numbers from the same sine table
but in a different phase then the grating will appear to drift. Figure
7 illustrates the idea.

Fig 7. Generating a gamma corrected signal using ramps and LUTs
|
Previous |
Next |
|
^ Back to top
|