Skip to content

Commit

Permalink
* fix camera bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Aug 8, 2024
1 parent 3b23d56 commit bd8c25c
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions components/vision/port/maixcam/maix_camera_mmf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bd8c25c

Please sign in to comment.