> situation is i am running a multithreaded program that captures
> continuously from my FlyVideo98 tuner using read() then draws to a window
> using XShmPutImage(). this loops infinitely while another thread copies
> the data and performs some analysis on it. 

I was getting around 4 fps with a Webcam 3 until I enabled compression
through the driver.

I'm using ioctl(VIDIOCGMBUF) and mmap to implement shared memory and then
ioctl(VIDIOCMCAPTURE) and ioctl(VIDIOCMSYNC) to read frames.  I use two
frames in the following sequence:

// initialize
ioctl(VIDIOCMCAPTURE, frame0);

while {
  ioctl(VIDIOCMCAPTURE, frame1);
  ioctl(VIDIOCMSYNC, frame0);
  ioctl(VIDIOCMCAPTURE, frame1);
  ioctl(VIDIOCMSYNC, frame0);
}

Thus I alternate frames, sending a capture request to one and syncing to
the other.

The above pseudo-code is the "server" thread.  The "client" thread copies
from the appropriate buffer into malloced memory for the application.  As
a further optimization, the client thread does a pthread_cond_wait on the
condition that a new frame has arrived, instead of busy waiting in a loop.  
I believe this saves a significant amount of processing, because the
thread is not scheduled until a new frame actually arrives.

Best regards,
Stephen



_______________________________________________
Video4linux-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/video4linux-list

Reply via email to