Re: fast frame grab

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



Andrew Wilson (a_wilson@xxxxxxx):

> I'm using the code from
> http://www.cse.msu.edu/~minutsil/linux/evi_grab/
> files
> 
> grab.C
> grab.H
> grab_main.C
> 
> pretty simple and straight forward,

  this isn't your code, it's setup for 400x400 capture, and
it doesn't include your timing stuff.  it was a little difficult
for me to figure out what was going on.

  your code currently does not check how many buffers are used by 
the driver.  your driver likely has like 2 gbuffers or 4 or something.
basically, when you go to capture a frame, you say 'hey card, capture to
this buffer right here', then you have to wait for the card to get told
to write there, and this whole process wastes two frames of time, then
the 33ms waiting for the capture to finish.

  i took the code and hacked it quickly to use double buffering, and now
the call to SYNC only takes 33ms, and you correctly get the last frame
captured.  of course my hack is ridiculous and stupid but if you run the
test you'll see the numbers are acceptable:

  http://vektor.theorem.ca/tmp/

  Grabbing 640x480 images
  took 92 us for vidiocmcapture
  took 80012 us for vidiocsync( 0)
  took 96 us for vidiocmcapture
  ioctl VIDIOCSYNC: Invalid argument
  took 3519 us for vidiocsync( 1)
  took 105 us for vidiocmcapture
  took 84422 us for vidiocsync( 0)
  took 102 us for vidiocmcapture
  took 29091 us for vidiocsync( 1)
  took 101 us for vidiocmcapture
  took 29152 us for vidiocsync( 0)
  took 101 us for vidiocmcapture

  ignore te start part it's because it doesn't first free both of the
frames.  i highly recommend you rewrite the V4L capturing code in there,
it's nasty.

  -Billy





[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