• 0

Indexed vs direct color


Question

Not sure where to ask this question, it's supposedly basic computer science.

I'm taking a course in computer graphics and there's a question on the advantages of "decomposing the index into three components in codifying RGB color". This has something to do with direct vs indexed color mode. I checked my notes and here is all I can find:

"The number of possible colors is function of the number of bits used to specify each intensity.

The number of simultaneously available colors is function of the number of memory frames.

In direct mode, these two quantities are the same: example 24 frames => 2^24 simultaneously available colors; 3x8bits (2^(8*3)) possible colors.

In indexed mode, they can be different: example 8 frames => 256 addressable colors => 256 simultaneous colors; but with a color table with 8-bit intensities => 2^(8*3) possible colors.

Why separate an index into three components?

With 24 frames, we'd a need a 16-million cells color table! If each cell is 3-bit each, this is 48 MB.

Separating the index into three 8-bit segments, the table will only contain 256 cells but just as much colors available simultaneously."

I just don't get it. Can someone explain? Thanks.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

From what I can make sense of your notes and my vague recollection of graphics:

A color is a combination of red, green, and blue intensity values ranging from 0-255 (256 possible values). 256 needs 8 bits to represent. So in this case, you have 3*8 = 24 bits to represent one color.

direct mode = 1 segment where each cell has the entire R,G,B color value. You are directly representing a color and hence need a table for each color.

indexed mode = 3 segments of 256 cells for each R,G,B value. Combining an R cell and a G cell and a B cell will give you a complete color. You are representing a color by an R,G,B combined index.

Because of this, direct mode is slightly faster since you have one cell per color and don't have to look up 3 different places. Indexed mode, however, has an incredibly smaller memory footprint allowing for more bandwidth/memory for pushing out data.

Hope that helps and I make any sense. :p

Edited by Xilo
Link to comment
Share on other sites

  • 0

Oooooooooooooooo I think I just got it. Not because of your reply, sorry. :p Just read Wikipedia's article Indexed Color. http://en.wikipedia.org/wiki/Indexed_color

Really the question here is NOT about Indexed vs Direct color, it's all about Indexed color. So just to clarify my own thoughts and allowing you to correct me if I'm wrong:

Direct color is when each pixel encodes its own color information. So for instance a pixel would contain the information 0.5Red, 0.2Green, 0.1Blue on 3x8bit typically. This is how we typically store picture information today.

Indexed color is when each pixel does not store color information, but rather an index into a color table. The color table can contain any colors. For encoding a predominantly pink picture, for instance, we can use a color palette containing mainly just shades of pink which will give a pretty good result without using much color information at all. This can save a lot of memory and was practical in the early days of hardware.

But using indexed color, we can use three different indexes per pixel instead of just one, and use three color tables. So now we can have a color table for shades of red, one for shades of green, and one for shades of blue. And now we have something where we store information very similar to what we store per-pixel in Direct color, instead that it's interpreted as indexes into memory-intensive color tables instead of directly as color information. Hence, indexed color doesn't make much sense for an RGB scheme and was largely dropped in favor of direct color.

Just talking out loud. Does any of that make sense?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.