[libdc1394-devel] possible bug in filltime field
Capture and control API for IIDC compliant cameras
Brought to you by:
ddouxchamps,
gordp
From: James S. Jr. <she...@um...> - 2006-03-30 23:02:39
|
Hello, So I was originally using the filltime field in the camera structure to time how fast we were getting the images, and we kept getting instances where the the time would actually jump backwards so we tried looking at the system time as well as the fill time field. So, we ran the code attached in timetrial.c. Of importance, the particular part of the code that measures the time when the image is written, struct timeval t0, t2; gettimeofday(&t0, NULL); for (uint_t frameNum = 0; frameNum < options.num_frames; frameNum++){ //fprintf(stderr,"capturing frame %d\n", frameNum); //fflush(stderr); /* capture data */ err=dc1394_dma_capture(cameras, numCameras, DC1394_VIDEO1394_WAIT); DC1394_ERR_CHK(err,"failed to capture\n"); gettimeofday(&t2, NULL); t2seconds = t2.tv_sec - t0.tv_sec; t2microseconds = t2.tv_usec; struct timeval *t1 = dc1394_video_get_filltime(cameras[0]); t1seconds = t1->tv_sec - t0.tv_sec; t1microseconds = t1->tv_usec; fprintf(stdout, "p:%ld.%06ld:%ld.%06ld\n", t2seconds, t2microseconds, t1seconds, t1microseconds); // free buffers for next frame for (uint_t i = 0; i < numCameras; i++) { dc1394_dma_done_with_buffer(cameras[i]); } } So for the first 20 frames the time difference between system time(systime) and filltime are the same, but then afterward the filltime jumps back in time to the first time instant, and continues at the same rate (see figure time.jpg). Note that I also used frame buffer size of 20, so it seems that the filltime buffer is looking at the time that the frame was captured on the last buffer place. (i.e. if frame 1 was captured at time 0, then then frame 21 captured at time t is stored in the same memory location at time 0, but the filltime field would still use time 0). Has anyone used the filltime buffers and had the same problem? Thanks, James Sherman P.S. The .c file was compiled using the Feb. 06, 2007 libdc version, g++ -g -O2 -Wall -I/opt/libdc1394-2.0.0-20060207/include/dc1394 -o timetrial timetrial.c -lm -lstdc++ -L/opt/libdc1394-2.0.0-20060207/lib/ -L/usr/local/lib -lraw1394 -ldc1394 and the output from timetrial was redirected to a file, and these commands will extract the relevant times cat tmp.time | grep ^p: | awk -F: '{print $3}' > tmp.filltime cat tmp.time | grep ^p: | awk -F: '{print $2}' > tmp.systime Yesterday (though I can't replicate the results today), showed that even in the first 20 frames, the value in filltime for frame i was actually the time when frame i+1 was captured. I don't understand how this is happening, since filltime is only modified in setup_capture function. |