iridas_logo   Home  |   Products  |   Shop  |   IRIDAS Magazine  |   Community  |   Documentation  |   Support  |   About IRIDAS
     
 

ILUT Script Syntax

From IRIDAS Online Documentation

Jump to: navigation, search

Contents

Overview

The ILUT script format allows you to generate 1D integer LUTs on the fly, using a simple C-like script language.

Instead of using an external application to output a table of values based on a formula, you can provide the algorithm directly in the ILUT script.

The moment the ILUT is first used, the IRIDAS Script Engine will run your algorithm at the currently used bitdepth and generate a 1D LUT table for each color channel which is then cached to memory and re-used whenever it is referenced again.

Limitations

The ILUT format is a 1D LUT format. So you can modify each of the three color channels individually, but you cannot work across channel boundaries.

The table that is generated as a result of your script is integer based. So you cannot access values below 0 or above 1.0 and after the LUT is applied, all color values will be clipped to the 0 .. 1.0 range.

Example

This ILUT script will apply a simple gamma operation to all three color channels.

Note the four magic variables that are always present in a ILUT Script:

in Represents the input value for one of the color channels
red Output value for the red channel
green Output value for the green channel
blue Output value for the blue channel
<IRIDAScript>
 //Gamma conversion LUT script
 SourceGamma = 2.2; //Gamma of the source material
 TargetGamma = 1.0; //Gamma of the display device
 // The magic variable "in" is always present and represents the input color channel value
 // in floating point (0.0 is black, 1.0 is primary color)

 out = pow(in, SourceGamma / TargetGamma); //common value for all output channels

 // The three magic variables red, green, blue will receive the output value out, which
 // will be used for building the LUT
 red = out;
 green = out;
 blue = out; 
</IRIDAScript> 

Here's what happens when the ILUT is first referenced. The bit depth of the display cache is determined, for example 16 bit integer.

A 1D table for the red channel is built by executing the script for each in value from 0..4095. The output value red is used as a replacement value for in. The same process is repeated for green and blue, using the green and blue output variables. The resulting table is cached to RAM for further reference.

Function Reference

The following built-in functions can be used with the ILUT script format:

abs

acos

arccos

arcsin

arctan

arctan2

asin

atan

atan2

bool

ceil

clamp

cos

cosh

exp

floor

inrange

int

ldexp

log

log10

max

min

pow

round

sin

sinh

sqrt

tan

tanh

trunc

Views
Personal tools