On Tue, 2003-01-21 at 10:27, James Su wrote: > I'm sure the compiler options are same, both use -O3 optimization. > > According to the manual of StrongARM SA1100 the 4bpp format is indexed, > so I use indexed format. If I use grayscale instead, how can I convert > rgb color into grayscale? And where should I initialize the system > palette within DirectFB? > It's impractical to use 4bpp for RGB formats without loss of information, much more so, if you're going to emulate grayscale. Plus, using 4bpp in truecolor or directcolor assumes that your hardware can support it.
Drivers usually emulate grayscale by converting RGB to YUV and using the computed Y for R, G, and B. Of course, you need to place the computed R, G, B in the hardware palette (this rules out truecolor and static pseudocolor mode). As far as I know, the fb driver for StrongARM supports truecolor (16bpp), pseudocolor (8bpp) and static pseudocolor (4bpp). So if you need to convert RGB to grayscale, your only choice is 8-bit pseudocolor (LUT8 in DirectFB parlance). Currently, indexed modes in DirectFB is slow without hardware support. Anyway, if you want to explore this possibility: Convert to grayscale: red = green = blue = (19595 * red + 38470 * green + 7471 * blue) >> 16; Then you need to construct your colormap with the above values and load it to fbdev using FBIOPUTCMAP. You need to add this part in src/core/fbdev/fbdev.c. Of course, if you just simply set fb_var_screeninfo.grayscale to a nonzero value, most fbdev drivers will convert RGB to grayscale for you. Tony -- Info: To unsubscribe send a mail to [EMAIL PROTECTED] with "unsubscribe directfb-dev" as subject.
