beautypg.com

Grayscale look-up tables, 1 grayscale table example, An269 7. grayscale look-up tables – Cirrus Logic AN269 User Manual

Page 42

background image

42

AN269REV1

AN269

7. GRAYSCALE LOOK-UP TABLES

Each of the Red, Green, and Blue outputs from either the color look-up table (LUT) or data directly from memory
can be used as indices into the Grayscale LUT. The purpose of the Grayscale LUTs is to provide a means to dither
the output to low-color and monochrome displays based on X- or Y-coordinate (spatial) or frame number (temporal).
In all, 8 shades (2 of which are always full off and full on) are available for each pixel’s Red, Green, and Blue com-
ponents.

Here are some example grayscale LUTs and an example 4-bit-per-pixel color LUT, in reference code form, as well
as a few simple functions and example function calls (in the “C” language) for programming those tables into mem-
ory. These tables support 0%, 25%, 50%, 75%, and 100% output brightness. Note that some entries are repeated,
and could be used for other settings. Since 3 bits of data are taken as input to the grayscale LUTs, up to 8 shades
may be chosen (2 are always used for full on and full off).

7.1

Grayscale Table Example

const unsigned long rgb_gs_lut_r[32] =

{

// ALL 0 , 25% , 25% , 50% , 50% , 75% , 75% , 100%

0x00070000,0x00071842,0x00071842,0x00075c53,0x00075c53,0x0007e7bd,0x0007e7bd,0x0007ffff,

0x00070000,0x00074218,0x00074218,0x0007a3ac,0x0007a3ac,0x0007bde7,0x0007bde7,0x0007ffff,

0x00070000,0x00078124,0x00078124,0x0007c535,0x0007c535,0x00077edb,0x00077edb,0x0007ffff,

0x00070000,0x00072481,0x00072481,0x00073aca,0x00073aca,0x0007db7e,0x0007db7e,0x0007ffff

};

const unsigned long rgb_gs_lut_g[32] =

{

// ALL 0 , 25% , 25% , 50% , 50% , 75% , 75% , 100%

0x00070000,0x00071842,0x00071842,0x00075c53,0x00075c53,0x0007e7bd,0x0007e7bd,0x0007ffff,

0x00070000,0x00074218,0x00074218,0x0007a3ac,0x0007a3ac,0x0007bde7,0x0007bde7,0x0007ffff,

0x00070000,0x00078124,0x00078124,0x0007c535,0x0007c535,0x00077edb,0x00077edb,0x0007ffff,

0x00070000,0x00072481,0x00072481,0x00073aca,0x00073aca,0x0007db7e,0x0007db7e,0x0007ffff

};

const unsigned long rgb_gs_lut_b[32] =

{

// ALL 0 , 25% , 25% , 50% , 50% , 75% , 75% , 100%

0x00070000,0x00071842,0x00071842,0x00075c53,0x00075c53,0x0007e7bd,0x0007e7bd,0x0007ffff,

0x00070000,0x00074218,0x00074218,0x0007a3ac,0x0007a3ac,0x0007bde7,0x0007bde7,0x0007ffff,

0x00070000,0x00078124,0x00078124,0x0007c535,0x0007c535,0x00077edb,0x00077edb,0x0007ffff,

0x00070000,0x00072481,0x00072481,0x00073aca,0x00073aca,0x0007db7e,0x0007db7e,0x0007ffff

};

void RASTER_FillGreyLUT(INT32 data[], int iLUT)

/* Description:

* Fill the Gray scale LUT.

*

*

* Exception Handling (if any):

* none

*

* Garbage Collection (if any):

* none