* live video / optimiztion help needed
@ 1993-09-15 1:17 Bob Palermo
1993-09-17 16:55 ` Dierick Dominique
0 siblings, 1 reply; 2+ messages in thread
From: Bob Palermo @ 1993-09-15 1:17 UTC (permalink / raw)
I'm trying to simulate live video on a Alpha AXP 3000/400 with 64 meg
of RAM and running OSF 1.2 (soon to be OSF 1.3) and X11R5. I am
running with my DISPLAY set to local:0, since I read in the
OSF news group that this causes the client/server communications
to be performed using shared memory. I am trying to display the
video in a 512x512 motif drawing area widget.
To achieve "live video" I would ideally need to display about 30
frames/sec(fps). I Would be happy with 15 to 20 fps. Currently
I am only getting about 5 fps so any improvement would be welcome.
One of the problems I am having is that the data I receive from
the camera contains 256 gray levels and my colormap only has 128
gray levels (I can't use all 256 colormap entries because I
need to maintain other colors on the display). As a result, I
need to map each frame into my colormap. I am currently doing
this using a lookup table.
The other source of slowness is that the data I am getting is
in ZPixmap format and the only way I know of to get that into
a window is by using XCreateImage/XPutImage. I'm not sure how
efficient the X Image routines are. The O'Reilly Xlib Volume 1
suggests that these routines may be a bit slow because they pay
attention to bit/byte ordering.
The routine which calls the loadImage routine below is invoked
as an Xt Timer Callback Proc, every update interval. Currently
the smallest update interval I can maintain is 200 ms.
There is one other limitation. I cannot use a "hardware solution"
such as a graphics card. The goal of the software is to support
an open system.
Below is the chunk of code in question. If anyone has any ideas
for optimizations I would appreciate a response. Responses
can either be posted to this group or preferably mailed to
me at lazlo@netcom.com.
Thanks
Bob Palermo (lazlo@netcom.com)
------------------------------------------------------------------------------
/*
* zpix is a pointer to the data returned by the camera. It
* is a 512x512 buffer containing pixel values ranging from
* 0-255.
*/
loadImage(zpix)
register unsigned char *zpix;
{
register int x;
XImage *ximage = NULL;
register int imageSize = 512*512;
/*
* tmpZpix is a pointer to a previously allocated 512x512
* chunk of memory.
*/
register unsigned char *tmpZpix = 512x512 chunk of memory
/*
* gsLut is a pointer to a 256 element array which maps
* 0-255 gray levels into 0-127 gray levels. For example
* gsLut[0] and gsLut[1] correspond to the pixel value
* for gray level 0 and gsLut[254] and gsLut[255] correspond
* to the pixel value for gray level 127
*/
register unsigned long *gsLut = colormap lookup table
/*
* map the image from the 0-255 to 0-127
*/
for (x = 0; x < imageSize; x++) {
tmpZpix[x] = gsLut[zpix[x]];
}
ximage = XCreateImage(_dpy,_visual,_depth,ZPixmap,0,
(char *)tmpZpix, _width, _height, 8, 0);
XPutImage(_dpy, _daWin, _gc, ximage, 0, 0, 0, 0, _width, _height);
}
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: live video / optimiztion help needed
1993-09-15 1:17 live video / optimiztion help needed Bob Palermo
@ 1993-09-17 16:55 ` Dierick Dominique
0 siblings, 0 replies; 2+ messages in thread
From: Dierick Dominique @ 1993-09-17 16:55 UTC (permalink / raw)
In article <lazloCDDFLp.87A@netcom.com>, lazlo@netcom.com (Bob Palermo) writes:
>Newsgroups: comp.unix.osf.osf1
>From: lazlo@netcom.com (Bob Palermo)
>Subject: live video / optimiztion help needed
>
>
> I'm trying to simulate live video on a Alpha AXP 3000/400 with 64 meg
> of RAM and running OSF 1.2 (soon to be OSF 1.3) and X11R5. I am
> running with my DISPLAY set to local:0, since I read in the
> OSF news group that this causes the client/server communications
> to be performed using shared memory. I am trying to display the
> video in a 512x512 motif drawing area widget.
>
> To achieve "live video" I would ideally need to display about 30
> frames/sec(fps). I Would be happy with 15 to 20 fps. Currently
> I am only getting about 5 fps so any improvement would be welcome.
>
> One of the problems I am having is that the data I receive from
> the camera contains 256 gray levels and my colormap only has 128
> gray levels (I can't use all 256 colormap entries because I
> need to maintain other colors on the display). As a result, I
> need to map each frame into my colormap. I am currently doing
> this using a lookup table.
>
> The other source of slowness is that the data I am getting is
> in ZPixmap format and the only way I know of to get that into
Have you tried using the MITSHM extensions of the X Server ? I don't
know your application but maybe you can avoid GetImage/PutImage and rely
on CopyArea from a MITSHM Pixmap. This would accelerate things.
Dominique Dierick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1993-09-17 16:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-09-15 1:17 live video / optimiztion help needed Bob Palermo
1993-09-17 16:55 ` Dierick Dominique
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox