The FXScript Reference

For Final Cut Pro created by Joe Maller

LevelMap

LevelMap(src, dest, alphaMap[256], redMap[256], greenMap[256], blueMap[256])

The LevelMap function is used to apply tonal and color corrections to images by adjusting the sequence of values in each channel.

Each color channel is processed individually based on the contents of the four adjustment arrays. These 256-index arrays contain a set of values ranging between 0 and 1. Src is the original image, dest is where the resulting image will go. The FXScript Predeclared Variable LinearRamp can be used to pass a channel through LevelMap without any changes.

When working in YUV, the channels map in order: Red = Y, Green = U and Blue = V.

Additional Notes

Able to process in place

LevelMap can process an image buffer in place, so the following works without corrupting the image:

LevelMap(dest, dest, LinearRamp, rMap, gMap, bMap);

I seem remember this not being the case in earlier versions of FCP, but it does work now.

Single channel is fastest

LevelMap's processing cost sort of scales with the number of channels processed. Passing LinearRamp to any channel will reduce the overhead of the operation (unlike ChannelCopy, which is fastest targeting all four channels).

In my testing, processing only one channel was nearly 200% faster than processing two, three or all four channels.