Re: Low performance with FlyVideo98/bttv/v4l2

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



> 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





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux