[libdc1394-devel] Re: DMA Buffers
Capture and control API for IIDC compliant cameras
Brought to you by:
ddouxchamps,
gordp
From: Dan D. <da...@de...> - 2002-07-24 02:17:07
|
On Tue, 2002-07-23 at 10:29, Andrew Hogue wrote: > Hi, > > I have another question about the DMA buffer strategy that you employ in > the dc1394 library... > > I can see how that would be beneficial if you always wanted a smooth image > sequence and are grabbing a video but in my case (realtime image > processing) the most recent frame is wanted rather than some frame in the > buffer somewhere... in my case the only place I can see the use of a Oh great, the last release 0.8.3 does exactly what you want, but its multicapture functionality does not span ports. We have since "enhanced" the lib to perform the image buffering attempting to preserve each frame. I can easily make the change, but it will change the parameter list to dc1394_dma_setup_capture() to add the option. What do others think? In the meantime, I suppose in your program you could cycle through the "extra" buffers without any processing after calling dma_multi_capture: dc1394_dma_multi_capture( cameras, numCameras ); for (i = 0; i < numCameras; i++) { /* process the frame at cameras[i].capture_buffer */ dc1394_dma_done_with_buffer( &cameras[i] ); /* discard the extra frames */ while (cameras[i].dma_extra_count > 0) { dc1394_dma_single_capture( &cameras[i] ); dc1394_dma_done_with_buffer( &cameras[i] ); } } --------- I am committing a version of dc1394_multiview.c that uses a #define DROP_FRAMES to enable this behavior. This is not optimal as is still allocates the extra memory and has some memcpy() overhead, but it might be satisfactory. The difference is quite noticeable visibly even with 2 cams on 2 ports (one per port). |