Microchip Technology AC164127-9 Data Sheet

Page of 34
 2011 Microchip Technology Inc.
DS01368A-page 29
AN1368
 shows a pixel which has RGB and it is
represented by a value of 21. The value, 21, in a look-up
table, indexes the 24-bit RGB value for that pixel.
 represents the image using indexes instead
of RGB values from the palette table, as shown in
TABLE A-1:
CONTENTS OF AN EXAMPLE IMAGE USING INDEXES INSTEAD OF RGB VALUES
TABLE A-2:
PALETTE TABLE (24 BPP)
A simple color changing type of animation process is
possible by changing the CLUT in the above method.
This is also known as palette animation. 
In the above explanation, we saw a simple way to
cluster the image and device a CLUT, but clustering is
a slow process. 
The other way to device a CLUT is to scale the RGB
ranges to generate the 16-bit codes. However, since
the human eye is more sensitive to Green, we can give
Red and Blue 5 bits each, with 6 bits for Green, and
each cell in the image gets replaced by its index. This
may lead to edge artifacts in the image. Therefore, this
is not suitable for natural images but may be suitable
for artificially created images.
PIC24FJ256DA210 supports up to a 256-entry CLUT
with 16 BPP per entry. 
Median Cut Algorithm
It is an adaptive method that tries to put most bits where
colors are most clustered, so that they can be discrim-
inated. This is the most general algorithm used while
converting a RGB image to a CLUT-based color image,
such as PC applications (e.g., GIMP).
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
2
2
2
2
3
3
3
3
2
2
2
2
3
3
3
3
2
2
2
2
3
3
3
3
2
2
2
2
3
3
3
3
Color Index
R
G
B
0
0
255
0
1
255
0
0
2
0
0
255
3
0
255
255
.
.
.
.
.
.
.
.
255
219
200
198
Note:
A color index refers to one row of CLUT.