Questions about accessing the exposure time through DirectShow
Up to Table of Contents
Technical background
UVC compatible cameras expose the exposure time to the operating system through the so-called Exposure Time (Absolute) Control on the Camera Terminal. There is a second control, the Exposure Time (Relative) Control, however it is not currently implemented by any Logitech UVC cameras. The value of the Exposure Time (Absolute) Control is expressed in units of 100 μs, i.e. 1 is 1/10,000th of a second, 100 is 1/100th of a second, 10,000 is 1 second, 100,000 is 10 seconds, and so on.
Microsoft Windows exposes the exposure time through the DirectShow IAMCameraControl interface, notably its CameraControl_Exposure control. The value of the CameraControl_Exposure control is expressed in log base 2 seconds. This means that for negative values the exposure time is 1/2|n| seconds and for positive values the exposure time is 2n seconds. For example: -10 is a 1/1024th of a second, -4 is a 1/16th of a second, -1 is half a second, 0 is one second, 1 is 2 seconds, and 4 is 16 seconds.
The problem
There are a series of problems caused by the fact that UVC cameras and DirectShow use different ranges and units.
The first one is that the limited granularity of the DirectShow property does not allow applications to take full advantage of the exposure time control that the camera actually provides.
The second one is that the mapping between the two cannot be done in an exact way. The attempt to set the DirectShow control to -10 (1/1024 s) leaves the driver with the choice whether to map this to 9 or 10 since the exact conversion of 1/1024 s to UVC units would be 9.765625 (1/1024 s = 0.0009765625 s = 976.5625 μs = 9.765625 * 100 μs).
The same problem happens the other way round. What if the camera's current internal exposure time is 0.01 s? When the driver reads the UVC control it sees 100 (0.01 s = 10,000 μs = 100 * 100 μs). The two closest DirectShow values are -7 (1/128 s = 0.0078125 s) and -6 (1/64 s = 0.015625 s), both of which are quite far apart from the actual value.
Finally, it is not possible for applications to get or set the exposure time in seconds (or decimal fractions thereof). Dealing with the exposure time often involves working with fractions.
Logitech implementation
General
The Logitech UVC generally supports the IAMCameraControl interface and the CameraControl_Exposure control. However, the implementation suffers from a series of issues that limit its usefulness in versions up to QuickCam 11.8. The next section explains these issues in more detail.Auto-exposure
The Logitech UVC driver disables auto-exposure when an application programmatically sets the exposure time.
Known issues
Wrong mapping
To make matters even more complicated than described above the Logitech UVC driver's filter property page contains an exposure time slider with values given as fractions of a second. Unfortunately, this mapping has been wrong and inconsistent for a long time. The following table summarizes the property ranges supported by the last few QuickCam releases, together with the correct values and the values that the slider on the property page takes on when a given DirectShow value is set:
| DirectShow value [2n s] |
QuickCam 11.5 [s] | QuickCam 11.7/11.8 [s] | Correct [s] |
|---|---|---|---|
| -14 |
1/15 |
n/a |
1/16384 |
| -13 |
1/5 |
1/819 |
1/8192 |
| -12 |
1/5 | 1/410 |
1/4096 |
| -11 |
1/5 | 1/205 |
1/2048 |
| -10 |
1/5 | 1/102 |
1/1024 |
| -9 |
1/5 | 1/51 |
1/512 |
| -8 |
1/5 | 1/26 |
1/256 |
| -7 |
1/8 |
1/13 |
1/128 |
| -6 |
1/16 |
1/6 |
1/64 |
| -5 |
1/31 |
1/5 |
1/32 |
| -4 |
1/63 |
1/5 | 1/16 |
| -3 |
1/125 |
1/5 | 1/8 |
| -2 |
1/250 |
1/5 | 1/4 |
| -1 |
1/500 |
1/5 | 1/2 |
| 0 |
1/5 |
1/5 | 1 |
Note that the value -14 corresponds to an exposure time that is shorter than what the UVC specification minimally allows. It is therefore not supported by newer implementations.
Return value
The Logitech UVC driver that ships as part of QuickCam 11.5 erroneously returns the HRESULT error value 0x80070032 ("The request is not supported") when attempting to set the exposure time value. In reality, the request succeeds as can be verified by simultaneously observing the filter property page.
Outlook
We are currently working on resolving the issues listed above. Most likely the next major version of our QuickCam software will include these fixes.
In order to make working with exposure times even easier for applications we are also looking into providing an additional, vendor-specific, way of directly accessing the UVC property values.
This page will be updated accordingly as soon as more information is available.