[FFmpeg-devel] [PATCH] PC Paintbrush PCX decoder

Ivo ivop
Sun Dec 30 00:49:50 CET 2007

On Saturday 29 December 2007 22:21, Mike Melanson wrote:
> Ivo wrote:
> > No, CGA paletted images were the only ones I could not find.
> Here you go:
>   http://samples.mplayerhq.hu/pcx/cga/
> >From my contact: "These all load perfectly under *REAL* PC Paintbrush
> >4.0 in DOS on a CGA card, so if your decoder screws it up, it's the
> >fault of your decoder!"
> 2008 is almost here-- we need CGA PCX support in FFmpeg fast! :)

Thanks! Alas, there's a problem. From ZSoft's specs:

> CGA Color Palette Information
> NOTE: This is no longer supported for PC Paintbrush IV/IV Plus.

The sample files:

CGA_BW.PCX	- Renders correctly with the current code (contains 2 RGB
		  triplets in the header)

CGA_FSD.PCX	- Renders correctly with the current code (contains 4 RGB
		  triplets in the header specifying the most common palette)

The other two do not render correctly, either without or with added code to 
handle the CGA palette according to the spec (4 bits of byte 16 determine 
the background color and 3 bits of byte 19 determine foreground palette).

For example, the intensity bit is set in both files, but the text in the 
images clearly states that one has it on and the other has it off. The 
choice of 4-color CGA palette seems to go well, but that might just be pure 
luck. And both files have the color_burst bit set, which should have been 

All in all, I can't make it work for all cases. Perhaps it would be possible 
to write exactly the same image (preferably CGA_TST1.PCX) in all eight 
formats? color_burst color/monochrome, intensity dim/bright and palette 
yellow/white makes eight combinations. Maybe I can find out how PC 
Paintbrush >= 4 stores that information.

If possible, it would also be nice to have the same images written by 
Paintbrush < 4 :-)


More information about the ffmpeg-devel mailing list