feat(maixcam2): support explicit OS04D10 120fps output sizes

This commit is contained in:
lxowalle
2026-08-07 10:43:36 +08:00
parent 0cbb1946c3
commit fd4b8d2311
3 changed files with 39 additions and 13 deletions

View File

@@ -1515,7 +1515,7 @@ namespace maix::middleware::maixcam2 {
}
if (fps > 30 || fps <= 0) {
if (fps == 120 && w == 640 && h == 360) {
if (fps == 120) {
w = 640;
h = 360;
fps = 120;

View File

@@ -1,20 +1,28 @@
# OS04D10 120 FPS test
This MaixCAM2-only test requests the OS04D10 native 640x360@120 sensor mode. It
does not open the display by default. It counts successful camera reads and prints AXERA
VIN device, pipe, and channel frame rates and loss counters. It also reports the
actual AE shutter, gain, FPS and measured image luma once per second. AI-ISP is disabled;
the regular ISP remains enabled because OS04D10 outputs RAW10 and RGB/YUV frames
need the regular ISP pipeline.
This MaixCAM2-only test requests the OS04D10 native 640x360@120 sensor mode by
default. It does not open the display by default. It counts successful camera
reads and prints AXERA VIN device, pipe, and channel frame rates and loss
counters. It also reports the actual AE shutter, gain, FPS and measured image
luma once per second. AI-ISP is disabled; the regular ISP remains enabled
because OS04D10 outputs RAW10 and RGB/YUV frames need the regular ISP pipeline.
The new sensor mode is selected only for an exact `640x360@120` request. All
other OS04D10 resolution and frame-rate requests keep the original MaixCDK mode
selection behavior.
An explicit `fps=120` request selects the native 640x360@120 sensor mode for any
requested output size. A 640x360 output preserves the full 16:9 sensor frame.
Other aspect ratios, such as 640x480, use the existing `fit=2` center-crop and
scale path, so they keep the requested output dimensions but lose some field of
view and detail. For output sizes up to 1280x720, automatic FPS (`fps=-1`)
remains 60 FPS and does not select the 120 FPS mode, including for a 640x360
output. Larger automatic-FPS requests retain the existing 1440p30 selection.
Build:
maixcdk build -p maixcam2 --toolchain-id default
The complete positional interface is:
./os04d10_120_test [seconds [format [display [exposure_us [again_u22_10 [width [height [fps]]]]]]]]
Run NV21 for the default 10 seconds, or pass a duration in seconds:
./os04d10_120_test
@@ -43,6 +51,20 @@ Pass `0 0`, or omit both values, to use automatic exposure:
./os04d10_120_test 10 nv21 display 0 0
Optional sixth, seventh, and eighth arguments set the requested output width,
height, and FPS. Specify the earlier optional arguments as placeholders when
setting them. Use `headless` as the third argument to keep the display closed:
# Full 16:9 frame at an explicit 120 FPS
./os04d10_120_test 10 nv21 headless 0 0 640 360 120
# 4:3 output through the center-crop/scale path at an explicit 120 FPS
./os04d10_120_test 10 nv21 headless 0 0 640 480 120
# Automatic FPS remains 60 FPS for both output sizes
./os04d10_120_test 10 nv21 headless 0 0 640 360 -1
./os04d10_120_test 10 nv21 headless 0 0 640 480 -1
On the tested MaixCAM2, `Display::show()` accepts about 120 input frames per
second without blocking the camera loop to the panel refresh rate. The built-in
panel runs at about 59.27 Hz, so VO replaces intermediate frames and physically

View File

@@ -143,10 +143,14 @@ static int run_test(int argc, char *argv[])
bool use_display = argc > 3 && std::string(argv[3]) == "display";
int manual_exposure_us = argc > 4 ? std::strtol(argv[4], nullptr, 10) : 0;
int manual_again = argc > 5 ? std::strtol(argv[5], nullptr, 10) : 0;
int width = argc > 6 ? std::strtol(argv[6], nullptr, 10) : 640;
int height = argc > 7 ? std::strtol(argv[7], nullptr, 10) : 360;
int fps = argc > 8 ? std::strtol(argv[8], nullptr, 10) : 120;
image::Format format = rgb888 ? image::Format::FMT_RGB888 : image::Format::FMT_YVU420SP;
log::info("Opening OS04D10 test mode: 640x360 %s @ 120 FPS, display=%s, AI-ISP disabled",
rgb888 ? "RGB888" : "NV21", use_display ? "on" : "off");
camera::Camera cam(640, 360, format, "", 120, 4, true, false);
log::info("Opening OS04D10 test: requested=%dx%d %s @ %d FPS, display=%s, AI-ISP disabled",
width, height, rgb888 ? "RGB888" : "NV21", fps,
use_display ? "on" : "off");
camera::Camera cam(width, height, format, "", fps, 4, true, false);
display::Display *disp = use_display ? new display::Display() : nullptr;
log::info("Camera accepted: %dx%d @ %.2f FPS, channel=%d, buffers=%d",
cam.width(), cam.height(), cam.fps(), cam.get_channel(), cam.buff_num());