Measure Kiyo KS cadence

This commit is contained in:
Meta Vens 2026-05-21 20:19:41 +01:00
commit fb586f81b9
6 changed files with 116 additions and 23 deletions

View file

@ -67,7 +67,7 @@ Probe path:
Probe source:
- `native/probes/leap_ks_cadence`
- `native/probes/ks_camera_cadence`
Advertised modes and measured queued KS pull rates:
@ -120,3 +120,41 @@ measurement window. Once the Leap is hot, the useful stereo mode is close to its
advertised cadence through the current KS path. The half-height mode can beat
the PS3 Eyes on raw frame rate, but the PS3 Eyes still win when comparing their
full 320x240 frames against Leap's useful 640x240 stereo stream.
## 2026-05-21: Razer Kiyo Kernel Streaming Probe
Installed device state:
- `Razer Kiyo` camera: `VID_1532&PID_0E03&MI_00`;
- `Razer Kiyo Pro` camera: `VID_1532&PID_0E05&MI_00`;
- both expose UVC camera interfaces through the Windows Kernel Streaming
capture category.
Probe path:
- Windows Kernel Streaming capture interface for `KSCATEGORY_CAPTURE`;
- no Media Foundation;
- no DirectShow graph;
- no OpenCV;
- eight queued asynchronous reads;
- two-second warm-up discarded before each five-second measurement.
Kiyo Pro advertised `MJPG` modes and measured cadence:
| Device | Mode | Advertised FPS | Best Measured FPS | Note |
| --- | --- | ---: | ---: | --- |
| Kiyo Pro | 1280x720 MJPG | 60.00 | 25.20 | manual exposure did not improve cadence |
| Kiyo Pro | 1920x1080 MJPG | 60.00 | 25.18 | manual exposure did not improve cadence |
Plain Kiyo advertised `MJPG` modes and measured cadence:
| Device | Mode | Advertised FPS | Best Measured FPS | Best Setting |
| --- | --- | ---: | ---: | --- |
| Kiyo | 1920x1080 MJPG | 30.00 | 30.27 | manual exposure `-9` or `-10` |
| Kiyo | 1280x720 MJPG | 60.00 | 51.51 | gain minimum after manual exposure sweep |
Conclusion: plain Kiyo is exposure-limited by default and becomes usable once
manual exposure is forced shorter. Kiyo Pro advertises 60 fps modes but the
current KS path delivers about 25 fps regardless of manual exposure, so it needs
a separate driver/control investigation before it should be trusted for high
cadence capture.

View file

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.20)
project(ks_camera_cadence LANGUAGES CXX)
add_executable(ks_camera_cadence
ks_camera_cadence.cpp)
target_compile_features(ks_camera_cadence PRIVATE cxx_std_20)
target_compile_definitions(ks_camera_cadence PRIVATE
WIN32_LEAN_AND_MEAN
NOMINMAX)
target_link_libraries(ks_camera_cadence PRIVATE
setupapi
ksuser)

View file

@ -839,19 +839,21 @@ bool measureScenario(HANDLE filter, const PinCandidate& candidate, const Control
}
}
int main()
int main(int argc, char** argv)
{
const std::string targetVid = argc > 1 ? argv[1] : "vid_f182";
const bool leapMode = targetVid == "vid_f182" || targetVid == "VID_F182";
const auto paths = enumerateCapturePaths();
std::printf("capture interfaces: %zu\n", paths.size());
for (const auto& path : paths)
{
if (path.find("vid_f182") == std::string::npos && path.find("VID_F182") == std::string::npos)
if (path.find(targetVid) == std::string::npos)
{
continue;
}
std::printf("Leap KS interface: %s\n", path.c_str());
std::printf("KS interface: %s\n", path.c_str());
Handle filter(CreateFileA(
path.c_str(),
GENERIC_READ | GENERIC_WRITE,
@ -870,7 +872,54 @@ int main()
if (candidates.empty())
{
std::printf("No capture pin candidate found.\n");
return 3;
continue;
}
if (!leapMode)
{
printKnownControls(filter.value);
const ULONG camManual = KSPROPERTY_CAMERACONTROL_FLAGS_MANUAL;
const ULONG procManual = KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL;
const std::vector<ControlScenario> webcamScenarios = {
{"baseline", {}},
{"manual exposure -5", {{"camera.exposure", ControlSet::Camera, KSPROPERTY_CAMERACONTROL_EXPOSURE, -5, camManual}}},
{"manual exposure -6", {{"camera.exposure", ControlSet::Camera, KSPROPERTY_CAMERACONTROL_EXPOSURE, -6, camManual}}},
{"manual exposure -7", {{"camera.exposure", ControlSet::Camera, KSPROPERTY_CAMERACONTROL_EXPOSURE, -7, camManual}}},
{"manual exposure -8", {{"camera.exposure", ControlSet::Camera, KSPROPERTY_CAMERACONTROL_EXPOSURE, -8, camManual}}},
{"manual exposure -9", {{"camera.exposure", ControlSet::Camera, KSPROPERTY_CAMERACONTROL_EXPOSURE, -9, camManual}}},
{"manual exposure -10", {{"camera.exposure", ControlSet::Camera, KSPROPERTY_CAMERACONTROL_EXPOSURE, -10, camManual}}},
{"gain minimum", {{"procamp.gain", ControlSet::VideoProcAmp, KSPROPERTY_VIDEOPROCAMP_GAIN, 0, procManual}}},
};
bool measuredAny = false;
for (const auto& candidate : candidates)
{
const double targetFps = candidate.interval100ns > 0
? 10000000.0 / static_cast<double>(candidate.interval100ns)
: 0.0;
const bool interesting =
((candidate.width == 1920 && candidate.height == 1080) ||
(candidate.width == 1280 && candidate.height == 720)) &&
targetFps >= 25.0 &&
fourccOrGuid(candidate.subtype) == "MJPG";
if (!interesting)
{
continue;
}
std::printf(
"measuring pin %lu %ldx%ld %ld-bit %s target %.2f fps\n",
static_cast<unsigned long>(candidate.pinId),
candidate.width,
candidate.height,
candidate.bitCount,
fourccOrGuid(candidate.subtype).c_str(),
targetFps);
for (const auto& scenario : webcamScenarios)
{
measuredAny = measureScenario(filter.value, candidate, scenario) || measuredAny;
}
}
return measuredAny ? 0 : 5;
}
printKnownControls(filter.value);
@ -954,6 +1003,6 @@ int main()
return measuredAny ? 0 : 5;
}
std::printf("Leap VID_F182 capture interface not found.\n");
std::printf("target capture interface not found for %s.\n", targetVid.c_str());
return 1;
}

View file

@ -1,14 +0,0 @@
cmake_minimum_required(VERSION 3.20)
project(leap_ks_cadence LANGUAGES CXX)
add_executable(leap_ks_cadence
leap_ks_cadence.cpp)
target_compile_features(leap_ks_cadence PRIVATE cxx_std_20)
target_compile_definitions(leap_ks_cadence PRIVATE
WIN32_LEAN_AND_MEAN
NOMINMAX)
target_link_libraries(leap_ks_cadence PRIVATE
setupapi
ksuser)

View file

@ -6,3 +6,4 @@
{"ts":"2026-05-21T20:05:00+00:00","type":"verification","status":"ok","note":"Native LeapUVC Kernel Streaming probe measured VID_F182 through usbvideo.sys without Media Foundation, DirectShow, OpenCV, or frame processing. Advertised 640x240 YUY2 stereo IR mode is 115 fps; the minimal one-buffer blocking KS read loop delivered 415 frames in 5.003s (82.95 fps). 640x120 delivered 155.40 fps against a 214 fps advertised mode. Next driver cut needs queued KS/AVStream streaming, or an explicit WinUSB/libusb UVC driver rebind decision if usbvideo.sys remains the bottleneck."}
{"ts":"2026-05-21T20:25:00+00:00","type":"verification","status":"ok","note":"LeapUVC KS probe now keeps eight asynchronous NtDeviceIoControlFile reads queued. The path reports async=yes but cadence stays effectively unchanged: 640x240 YUY2 delivered 415 frames in 5.004s (82.93 fps), and 640x120 delivered 777 frames in 5.000s (155.39 fps). The limiting factor is not simply an empty user-mode read queue."}
{"ts":"2026-05-21T20:55:00+00:00","type":"verification","status":"ok","note":"LeapUVC KS control sweep showed the short-window 83 fps result was mostly startup drag. With two seconds of warm-up discarded and eight queued async KS reads, 640x240 YUY2 delivered about 110.7 fps against 115 fps advertised; 640x120 YUY2 delivered 1030 frames in 5.003s (205.87 fps) against 214 fps advertised. Exposure, gamma, HDR/LED, gain, and dark-frame controls are reachable through KS; digital gain=0 and the old FPS-ratio selector are rejected with ERROR_INVALID_PARAMETER."}
{"ts":"2026-05-21T21:25:00+00:00","type":"verification","status":"ok","note":"Razer Kiyo direct KS probe measured VID_1532 PID_0E03 and PID_0E05 camera interfaces with eight queued async reads and two-second warm-up discard. Plain Kiyo is exposure-limited by default: 1920x1080 MJPG reaches 30.27 fps with manual exposure -9/-10, and 1280x720 MJPG reaches 51.51 fps after manual exposure/gain sweep against 60 fps advertised. Kiyo Pro advertises 60 fps at 1280x720 and 1920x1080 MJPG, but the current KS path delivers only about 25 fps regardless of manual exposure; it needs separate control/driver investigation before high-cadence use."}

View file

@ -85,8 +85,13 @@ current_status:
frame processing; after discarding a two-second warm-up, the useful 640x240
stereo IR mode advertises 115 fps and currently measures about 110.8 fps
with eight queued asynchronous KS reads. The half-height 640x120 mode
advertises 214 fps and currently measures about 205.9 fps.
advertises 214 fps and currently measures about 205.9 fps. Plain Kiyo is
usable through KS when manual exposure is forced shorter: 1080p MJPG reaches
about 30 fps and 720p MJPG reaches about 51.5 fps. Kiyo Pro advertises 60
fps MJPG at 720p/1080p but currently delivers only about 25 fps through the
same KS path even with manual exposure tuning.
next_action: >
Turn the warmed, queued Leap KS path into an `IMimirVideoCaptureDriver`,
preserving the direct control hooks for exposure, gamma, HDR/LED, gain, and
dark-frame settings so Aquarium can inspect and tune timing-camera state.
preserve direct control hooks for timing-camera state, and decide whether
Kiyo Pro needs a separate UVC/control path before it joins the six-camera
capture set.