4

I know that the 12 bit RGB color pallette format , has 4 bit for each color R,G,B. But how is the structure of the raw data i.e.

1.) Does each color have a byte corresponding to it which in turn has 4 padding bits , and 4 data bits for color data

or

2.) Its a packed format , i.e. Byte-1= (padding bits + 4-Rbits) Byte-2 = (4-Gbits+4Bits)

How is the packing done?

Thank You.

-AD

Jon Cage
  • 36,366
  • 38
  • 137
  • 215
goldenmean
  • 18,376
  • 54
  • 154
  • 211
  • Are you using a specific library or bit of hardware? It's likely that whatever you're interfacing with will set this information. Can you give us any more clues? – Jon Cage May 07 '09 at 09:19

4 Answers4

1

Where?

In memory, it can be anything---most likely it could be held in a 3-char array or struct...

In disk, since space is such a big deal, it'd likely be held in an even tighter format: 3 bytes representing two adjacent pixels: [RG][BR][GB], and packed/unpacked on write/read.

Still, it all depends on the specs of your format/platform.

Tordek
  • 10,628
  • 3
  • 36
  • 67
0

On the Amiga the system is very simple:

$0fff = white... in decimal that is 0 (unused), 15 (max red), 15 (max green), 15 (max blue).

$0a04 = red with a hint of blue means it's Red-violet, a mix of Red with strength 10 and Blue strength 4 while Green isn't added at all.

R-G-B are each 8-bit numbers and $FFF = 4095 (+ black) Each colour is 4 bits. Three times 4 bits = 12 bits, hence 12-bit color range.

Link to 12-bit RGB on Wiki listing systems using 12-bit RGB

Community
  • 1
  • 1
Scyphe
  • 1
0

On a CD+G, each twelve bit palette entry is stored using the six lsb's of two consecutive bytes; there is no wasted space because the upper two bits are used for storing timing information. I think the Amiga just used three of the four nybbles in a 16-bit word. I'm not sure what other formats you might be thinking of.

supercat
  • 77,689
  • 9
  • 166
  • 211
0

I know that the 12 bit RGB color pallette format , has 4 bit for each color R,G,B.

Are you sure it's a palette format?

Generally, a palette format is made up of two distinct parts: The palette itself and the image. The palette is a look-up table of colour values, the format of which is implementation specific. The image is then a list of index-values for the pallet.

Palette formats are normally used to save memory, or sometimes to do neon-style animation (like the Windows95 loading screen had that blue strip at the bottom: the image was written to the screen once, and then some of the colours in the palette were rotated every few ms).

RobM
  • 8,373
  • 3
  • 45
  • 37