[comp.windows.x] COLOR image sequences under X

gilge@ICSI.Berkeley.EDU (Michael Gilge) (02/23/91)

I am currently writing a program that displays moving video in a
X-window. For black and white everything works fine: Using a SPARC-
station with 8-bit screen, I can display a typical videophone 
sequence (352 pixel/line, 288 lines) in real-time (30 frames/sec.).

Now I am extending the program to support color. Thanks to the colormap
and a clustering scheme, 24bit RGB images can be compressed to the 
256 or less most prominent colors for each frame. In order to animate
the images on the screen, not only the pixels but now also the colormap
has to be updated 30 times a second.

So far I followed two approaches:
- I updated the colormap and the actual image sequencially. During the
  interval after the colormap has been updated but the new frame is not
  yet copied, one can see a very annoying flash on the screen. This is 
  caused by the limited speed of the hardware and the fact that the image
  is displayed in false colors for a moment.

- For the second approach, I used only half of the available colors (<128)
  for each frame in order to exploit kind of a double buffering technique:
  The colors for the next frame to be displayed are written to an area
  of the colormap, which is not used by the current image. After that the
  image is updated and immediately displayed in correct colors. Unexpectedly
  there is still a flickering effect, especially in the upper half of the
  image beeing displayed.

Has anybody experience with dynamically changing colormaps or color animation
on 8-bit displays? I tried all tricks I know of, e.g. XFlush, XSync. I can 
stop the animation at any time and all colors are right. The effect is strictly dynamic and changes when I vary the frame rates. I have a feeling that there
is some kind of conflict between the screen refresh and the X-server update
of the colormap.

Your suggestions are greatly appreciated.......

Michael Gilge,  International Computer Science Institute, Berkeley, Sunny Calif.

bpendlet@es.com (Bob Pendleton) (02/27/91)

In article <11371@pasteur.Berkeley.EDU>, gilge@ICSI.Berkeley.EDU (Michael Gilge) writes:
|> 
|> Has anybody experience with dynamically changing colormaps or color animation
|> on 8-bit displays? I tried all tricks I know of, e.g. XFlush, XSync. I can 
|> stop the animation at any time and all colors are right. The effect is strictly dynamic and changes when I vary the frame rates. I have a feeling that there
|> is some kind of conflict between the screen refresh and the X-server update
|> of the colormap.

I would guess that the color map is only being loaded during vertical
retrace. This would cause a considerable pause, 1/60 of a second,
every time you change the color table. This might cause the effect you
are seeing.

|> Your suggestions are greatly appreciated.......

Instead of reloading the color table for each image try coming up with
an 8 bit true color color table and load it only once. A good approach
is to allocate 3 bits for red, 3 bits for green, and 2 bits for blue
in each of your 8 bit pixels. If the color table is set up correctly
you will get the effect of a true color display.

I'd hope that this would get rid of your flashing problem and speed up
your conversion from 24 bit RGB to your displayed images.



-- 
              Bob Pendleton, speaking only for myself.
   bpendlet@dsd.es.com or decwrl!esunix!bpendlet or utah-cs!esunix!bpendlet

                         Tools, not rules.