Using color palettes

I have a question concerning the use of palettes. I have a source filter that outputs either MEDIASUBTYPE_RGB8 or MEDIASUBTYPE_RGB555 subtypes depending on the source video file. I have the RGB555 working just fine. The RGB8 video plays back correctly, except it is not displaying with the correct color palette.

In my source filter's GetMediaType() function, I fill in the VIDEOINFO.bmiColors array with the color palette from my source video file and set these settings:

Assume pvi is a VIDEOINFO*.

Code Snippet

pvi->bmiHeader.biBitCount = 8;
pvi->bmiHeader.biCompression = BI_RGB;
pvi->bmiHeader.biClrUsed = 256;
memcpy( pvi->bmiColors, myColorPaletteAddress, 256*sizeof(RGBQUAD) );

The source filter's output pin's Preferred Media Types is:

Major Type: Video - Sub Type: RGB8 - Format: RGB 1024x768, 8 bits rcSrc=(0,0,0,0) rcDst=(0,0,0,0)

When I render the output pin, I get a "Color Space Converter" filter followed by a "Video Renderer" filter. The "Color Space Converter" has an output pin that transforms the image to RGB32.

Is the "Color Space Converter" using the color palette to convert the indexed color image into a RGB32 image? If so, I must be setting up the wrong color palette.

Or am I missing something?

Thanks,

Dan Harlin

[1510 byte] By [DHarlin] at [2008-1-4]
# 1
Try messing around with the color palette to see if it changes things. set colors to black see if your video changes. That will tell you if your pallette is incorrect. The color converter uses the media connection type to transform the image to 32 rgb. So find the pin between your filter and the color converter and call ipin::connectionmedia if you are unsure about what it is using. I would just try changing your palette colors and seeing if it affects things first.
donJuan at 2007-10-11 > top of Msdn Tech,Software Development for Windows Vista,DirectShow Development...
# 2

Thanks for the reply. I will give it a try.

It may take me a couple of days to get back to this.

Dan

DHarlin at 2007-10-11 > top of Msdn Tech,Software Development for Windows Vista,DirectShow Development...
# 3
After a quick look at the displayed image, I noticed that something that was red should have been blue. I flipped RGB to BGR and the image appeared correct.

Thanks for your help.

Dan

DHarlin at 2007-10-11 > top of Msdn Tech,Software Development for Windows Vista,DirectShow Development...

Software Development for Windows Vista

Site Classified