Hi Laurent, as much as I would like to see cheap USB webcam based stereo vision, I have to agree with you that adherence to standard is crucial. In general case we have to assume different values in device and host SOF counters. Do you have means (bus analyzer) to test some UVC cameras to find out if these counters have the same values? Maybe all of them or most of them do. In such a case, it would be worthwhile to pursue it further. UVC driver could use time stamps only for these devices. I can provide you with at least one new UVC camera, which is not on official list yet (V-Gear TalkCam MX6) for testing.
There seems to be a way to get host system time at SOF Token generation. Chapter 6.3 of Open Host Controller Interface Specification for USB describes StartOfFrame interrupt event, which could be used for this purpose. Best Regards, Paul Jurczak. ----- Original Message ---- From: Laurent Pinchart <[EMAIL PROTECTED]> To: Paul Jurczak <[EMAIL PROTECTED]> Cc: linux-uvc-devel@lists.berlios.de Sent: Monday, March 5, 2007 3:28:18 AM Subject: Re: [Linux-uvc-devel] The source clock Hi Paul, > I see two fields in v4l2_buffer, which are used for time stamps: timecode > and timestamp. The timecode field lacks sufficient resolution for our > purpose, because it was designed with analog video standards in mind. > Besides, it seems that something similar to timecode is already being > embedded in MPEG stream by the camera. The timestamp field looks almost > perfect for our purpose - resolution could be better, but a microsecond is > good enough. Agreed. Let's use the timestamp field. > The most comprehensive solution, following the spirit of V4L2 > specs, would involve camera and PC clock synchronization. In practical > terms, it would mean finding the system time (Tn) of creation of SOF packet > number n and using SOF counter value (m) and System Time Clock (Tm) from > scrSourceClock and dwPresentationTime (Tp) to calculate frame creation time > (t) in PC system time: > > t = Tn + (m-n)*125us + ((Tm-Tp)%dwClockFrequency)/dwClockFrequency > (sketchy) > > Before I go any further, it would help to find out the following: > > 1) Are we getting both dwPresentationTime and scrSourceClock in the Payload > Header (controlled by bits 2 and 3 of bmHeaderInfo)? It seems that cameras > without microphone may not provide them (page 34 of USB Class Definition > for Video Devices). I tested various webcams. One of them didn't include the PTS and SCR fields in any packet. All others did. > 2) More importantly, is the camera SOF counter the same as host SOF > counter? Possibility of different counting is mentioned on page 33 of USB > Class Definition for Video Devices. If counters are different, finding the > offset may be very difficult. The specification doesn't call for a single counter, so we unfortunately can't rely on that. As the device SOF counter and the host SOF counter have different values, the above formula will be very difficult to use. The PTS and SCR fields have been designed to synchronise multiple video and audio streams from a single device. Synchronising video streams from separate devices seem to be outside the scope of the UVC specification :-/ On the other hand, some webcams might synchronise their SOF counter with the host SOF counter. For those devices, the driver might be able to synchronise multiple webcams. I had a look at the USB stack source code, and found no way to get the host time at which a SOF packet is issued. That could be a problem. Chapter 5.12 in the USB 2.0 specification discuss clock synchronisation issues, you might find some help there. Best regards, Laurent Pinchart ____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front ____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front _______________________________________________ Linux-uvc-devel mailing list Linux-uvc-devel@lists.berlios.de https://lists.berlios.de/mailman/listinfo/linux-uvc-devel