diff --git a/components/vision/port/maixcam/maix_camera_mmf.cpp b/components/vision/port/maixcam/maix_camera_mmf.cpp index 2c59f765..9a59bfeb 100644 --- a/components/vision/port/maixcam/maix_camera_mmf.cpp +++ b/components/vision/port/maixcam/maix_camera_mmf.cpp @@ -358,16 +358,14 @@ namespace maix::camera sys_cfg.vb_pool[0].count = 3; sys_cfg.vb_pool[0].map = 2; sys_cfg.max_pool_cnt = 1; + + stIniCfg.enSnsType[0] = GCORE_GC4653_MIPI_720P_60FPS_10BIT; } else { sys_cfg.vb_pool[0].size = 2560 * 1440 * 3 / 2; sys_cfg.vb_pool[0].count = 2; sys_cfg.vb_pool[0].map = 2; sys_cfg.max_pool_cnt = 1; - } - if (width <= 1280 && height <= 720 && fps > 30) { - stIniCfg.enSnsType[0] = GCORE_GC4653_MIPI_720P_60FPS_10BIT; - } else { stIniCfg.enSnsType[0] = GCORE_GC4653_MIPI_4M_30FPS_10BIT; } stIniCfg.as8PNSwap[0][0] = 0; @@ -452,7 +450,7 @@ namespace maix::camera // mmf init err::check_bool_raise(!_mmf_vi_init(_width, _height, _fps), "mmf vi init failed"); err::check_bool_raise((_ch = mmf_get_vi_unused_channel()) >= 0, "mmf get vi channel failed"); - if (0 != mmf_add_vi_channel_v2(_ch, _width, _height, mmf_invert_format_to_mmf(_format_impl), _fps, 2, -1, -1, 2, 3)) { + if (0 != mmf_add_vi_channel_v2(_ch, _width, _height, mmf_invert_format_to_mmf(_format_impl), _fps, _buff_num, -1, -1, 2, _buff_num)) { mmf_vi_deinit(); mmf_deinit_v2(false); err::check_raise(err::ERR_RUNTIME, "mmf add vi channel failed"); diff --git a/examples/jpg_stream_demo/main/src/main.cpp b/examples/jpg_stream_demo/main/src/main.cpp index 65339f4a..aee7fdfc 100644 --- a/examples/jpg_stream_demo/main/src/main.cpp +++ b/examples/jpg_stream_demo/main/src/main.cpp @@ -9,7 +9,27 @@ extern std::string html; int _main(int argc, char* argv[]) { - camera::Camera cam = camera::Camera(320, 240); + int cam_w = -1; + int cam_h = -1; + image::Format cam_fmt = image::Format::FMT_RGB888; + int cam_fps = -1; + int cam_buffer_num = 3; + if (argc > 1) { + if (!strcmp(argv[1], "-h")) { + log::info("./camera_display "); + log::info("example: ./camera_display 640 480 0 60 2"); + exit(0); + } else { + cam_w = atoi(argv[1]); + } + } + if (argc > 2) cam_h = atoi(argv[2]); + if (argc > 3) cam_fmt = (image::Format)atoi(argv[3]); + if (argc > 4) cam_fps = atoi(argv[4]); + if (argc > 5) cam_buffer_num = atoi(argv[5]); + log::info("Camera width:%d height:%d format:%s fps:%d buffer_num:%d", cam_w, cam_h, image::fmt_names[cam_fmt].c_str(), cam_fps, cam_buffer_num); + + camera::Camera cam = camera::Camera(cam_w, cam_h, cam_fmt, "", cam_fps, cam_buffer_num); display::Display disp = display::Display(); log::info("camera and display open success\n"); log::info("camera size: %dx%d\n", cam.width(), cam.height());