[comp.windows.x] XCreateImage & XPutImage Optimization

cristy@eplrx7.uucp (John Cristy) (07/24/90)

  I am trying to determine the most optimal parameters and image format 
  to XCreateImage that minimizes the work the server must do to display 
  an image via XPutImage.  I suspect creating the image data in the bit-order
  and byte-order of the server is most efficient, but I developed doubts when
  I looked at XImUtils.c and noticed the code normalizes all data to
  LSB byte-order and bit-order.  Is it more efficient to generate the image
  data in LSBFirst byte-order and bit-order?  Also are other parameters 
  crucial in minimizing server overhead.  For example, are 32 bit scanline 
  pads more efficient than 8 bit?

  This is the last issue I need to resolve before I make my image processing
  software available on expo.lcs.mit.edu in a few days.  A prompt reply
  will be appreciated.  Please Email your suggestions to cristy@dupont.com.
  Thanks in advance.


--
The UUCP Mailer

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (07/24/90)

    I suspect creating the image data in the bit-order
    and byte-order of the server is most efficient,

You are correct.

    but I developed doubts when
    I looked at XImUtils.c and noticed the code normalizes all data to
    LSB byte-order and bit-order.

Um, the functions in that file are not used for XPutImage (at least, not
in the normal case).  You asked specifically about XPutImage.

    Also are other parameters 
    crucial in minimizing server overhead.  For example, are 32 bit scanline 
    pads more efficient than 8 bit?

The scanline pad and bits per pixel should also be chosen to match what
the server wants.

jimf@SABER.COM (07/25/90)

|    Also are other parameters 
|    crucial in minimizing server overhead.  For example, are 32 bit scanline 
|    pads more efficient than 8 bit?
|
|The scanline pad and bits per pixel should also be chosen to match what
|the server wants.

Yep, but I've found that it's not too bad to put the image in any
format your program will be comfortable with and just feed that to the
server.  Even on gross architectures like the i386 machines this works
reasonably well and it makes your imaging program a LOT simpler since
it only has to deal with one image format.

For a case study, you might look at my xloadimage program (I think I'm
starting to sound like a preacher :-).  It always builds ZPixmap
format images (except for monochrome images) in MSByte order and feeds
them to the server that way.  Works pretty well.  Xloadimage is
available by anonymous ftp from expo.lcs.mit.edu in
/contrib/xloadimage.1.06.tar.Z.

Happy hacking,

jim frost
saber software
jimf@saber.com