Colormaps?



I have a question about colormaps... To convince myself that I
understand the JPEG library, I wrote a small GTK+ JPEG viewer. It
works, but speed is a huge problem. Decoding the JPEGs is almost
instantaneous, but displaying them is like a peaceful hour of being
stretched on a rack. I don't usually use 24-bit color (don't have a
decent video card), and thus I used color mapping code (as described
in the FAQ). Without the code, displaying the JPEG takes a few seconds
(still _way_ too long, but I didn't optimize any of the display
routines yet). With the code, it takes anywhere from 40 seconds to
over a minute for a fairly small image.

How can this be speeded up? Mapping the entire image in one shot seems
attractive, but gtk_color_alloc() requires a GC as an argument, and
IIRC GCs can only store two colors: background and foreground. Because
of the nature of bitmaps like JPEGs, each pixel has to be accessed
individually. That means that each has to be individually colormapped,
yes?

GIMP displays JPEGs (and other bitmap formats) instantaneously. How is
this done? (Yeah, I know---I should read the source code.)


Regards,
Constantine Vetoshev



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]