From bd8c25ca3ac7e1820d2d2fb844304ddbf2ccf3c8 Mon Sep 17 00:00:00 2001 From: lxowalle Date: Thu, 8 Aug 2024 14:24:52 +0800 Subject: [PATCH] * fix camera bug --- .../vision/port/maixcam/maix_camera_mmf.cpp | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/components/vision/port/maixcam/maix_camera_mmf.cpp b/components/vision/port/maixcam/maix_camera_mmf.cpp index 7e13fea7..2faef65b 100644 --- a/components/vision/port/maixcam/maix_camera_mmf.cpp +++ b/components/vision/port/maixcam/maix_camera_mmf.cpp @@ -324,39 +324,37 @@ namespace maix::camera _config_sensor_env(_fps); // mmf init - if (!mmf_is_init()) { - mmf_sys_cfg_t sys_cfg = {0}; - char *sensor_name = getenv(MMF_SENSOR_NAME); - err::check_null_raise(sensor_name, "sensor name not found!"); - if (!strcmp(sensor_name, "gcore_gc4653")) { - if (_width <= 1280 && _height <= 720 && _fps > 30) { - sys_cfg.vb_pool[0].size = 1280 * 720 * 3 / 2; - sys_cfg.vb_pool[0].count = 3; - sys_cfg.vb_pool[0].map = 2; - sys_cfg.max_pool_cnt = 1; - } 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; - } - } else if ((!strcmp(sensor_name, "sms_sc035gs"))) { - sys_cfg.vb_pool[0].size = 640 * 480 * 3 / 2; + mmf_sys_cfg_t sys_cfg = {0}; + char *sensor_name = getenv(MMF_SENSOR_NAME); + err::check_null_raise(sensor_name, "sensor name not found!"); + if (!strcmp(sensor_name, "gcore_gc4653")) { + if (_width <= 1280 && _height <= 720 && _fps > 30) { + sys_cfg.vb_pool[0].size = 1280 * 720 * 3 / 2; sys_cfg.vb_pool[0].count = 3; sys_cfg.vb_pool[0].map = 2; sys_cfg.max_pool_cnt = 1; - } else if ((!strcmp(sensor_name, "ov_ov2685"))) { - sys_cfg.vb_pool[0].size = 1600 * 1200 * 3 / 2; - sys_cfg.vb_pool[0].count = 3; + } 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; - } else { - log::error("sensor name not found! name:%s", sensor_name); - err::check_raise(err::ERR_RUNTIME, "sensor name not found!"); } - mmf_pre_config_sys(&sys_cfg); - err::check_bool_raise(!mmf_init(), "mmf init failed"); + } else if ((!strcmp(sensor_name, "sms_sc035gs"))) { + sys_cfg.vb_pool[0].size = 640 * 480 * 3 / 2; + sys_cfg.vb_pool[0].count = 3; + sys_cfg.vb_pool[0].map = 2; + sys_cfg.max_pool_cnt = 1; + } else if ((!strcmp(sensor_name, "ov_ov2685"))) { + sys_cfg.vb_pool[0].size = 1600 * 1200 * 3 / 2; + sys_cfg.vb_pool[0].count = 3; + sys_cfg.vb_pool[0].map = 2; + sys_cfg.max_pool_cnt = 1; + } else { + log::error("sensor name not found! name:%s", sensor_name); + err::check_raise(err::ERR_RUNTIME, "sensor name not found!"); } + mmf_pre_config_sys(&sys_cfg); + err::check_bool_raise(!mmf_init(), "mmf init failed"); mmf_vi_cfg_t cfg = {0}; cfg.w = _width;