Skip to content

Commit

Permalink
* default supports 80 fps
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Jul 19, 2024
1 parent ab54f0e commit d7f4b5a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion components/maixcam_lib/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ config SOPHGO_MIDDLEWARE_VERSION_MINOR

config SOPHGO_MIDDLEWARE_VERSION_PATCH
int "sophgo middleware package patch version"
default 5
default 6
help
sophgo middleware package patch version
endmenu
7 changes: 4 additions & 3 deletions components/maixcam_lib/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ def add_file_downloads(confs : dict) -> list:
@return list type, items is dict type
'''
version = f"{confs['CONFIG_SOPHGO_MIDDLEWARE_VERSION_MAJOR']}.{confs['CONFIG_SOPHGO_MIDDLEWARE_VERSION_MINOR']}.{confs['CONFIG_SOPHGO_MIDDLEWARE_VERSION_PATCH']}"
url = f"https://github.com/sipeed/MaixCDK/releases/download/v0.0.0/sophgo-middleware-{version}.tar.xz"
if version == "0.0.4":
url = "https://github.com/sipeed/MaixCDK/releases/download/v0.0.0/sophgo-middleware-0.0.4.tar.xz"
sha256sum = "e239b4be072c3835962a8f73d24dcc88f9258ae9d90edae94419b39823dc4c14"
elif version == "0.0.5":
url = "https://github.com/sipeed/MaixCDK/releases/download/v0.0.0/sophgo-middleware-0.0.5.tar.xz"
sha256sum = "484dd9199f7d8d5d2af34bf76fd2b9e5feb3d47691308e491c68270844adffb9"
elif version == "0.0.6":
sha256sum = "e7a9f4fb6e3eeb791c8ebf0a19bbf660151deeffa977e99e1835fe1cbeb2aa0b"
else:
raise Exception(f"version {version} not support")
filename = f"sophgo-middleware-${version}.tar.xz"
filename = f"sophgo-middleware-{version}.tar.xz"

return [
{
Expand Down
10 changes: 9 additions & 1 deletion components/vision/port/maixcam/maix_camera_mmf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static __attribute__((constructor)) void maix_vision_register_signal(void)
maix::util::register_exit_function(try_deinit_mmf);
}

#define MAIX_SENSOR_FPS "MAIX_SENSOR_FPS"
namespace maix::camera
{
class CameraCviMmf final : public CameraBase
Expand All @@ -75,16 +76,23 @@ namespace maix::camera
this->ch = -1;

mmf_sys_cfg_t sys_cfg = {0};
if (width <= 1280 && height <= 720 && fps == 60) {
if (width <= 1280 && height <= 720 && fps > 30) {
sys_cfg.vb_pool[0].size = 1280 * 720 * 3 / 2;
sys_cfg.vb_pool[0].count = 5;
sys_cfg.vb_pool[0].map = 2;
sys_cfg.max_pool_cnt = 1;

if (fps > 30 && fps <= 60) {
err::check_bool_raise(!setenv(MAIX_SENSOR_FPS, "60", 1), "setenv MAIX_SENSOR_FPS failed");
} else {
err::check_bool_raise(!setenv(MAIX_SENSOR_FPS, "80", 1), "setenv MAIX_SENSOR_FPS failed");
}
} else {
sys_cfg.vb_pool[0].size = 2560 * 1440 * 3 / 2;
sys_cfg.vb_pool[0].count = 4;
sys_cfg.vb_pool[0].map = 2;
sys_cfg.max_pool_cnt = 1;
err::check_bool_raise(!setenv(MAIX_SENSOR_FPS, "30", 1), "setenv MAIX_SENSOR_FPS failed");
}
mmf_pre_config_sys(&sys_cfg);

Expand Down
9 changes: 6 additions & 3 deletions components/vision/src/maix_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace maix::camera

#ifdef PLATFORM_MAIXCAM
if (fps == -1 && _width <= 1280 && _height <= 720) {
_fps = 60;
_fps = 80;
} else if (fps == -1) {
_fps = 30;
} else {
Expand All @@ -139,8 +139,11 @@ namespace maix::camera
if ((_width > 1280 || _height > 720) && _fps > 30) {
log::warn("Current fps is too high, will be be updated to 30fps! Currently only supported up to 720p 60fps or 1440p 30fps.\r\n");
_fps = 30;
} else if (_width <= 1280 && _height <= 720 && _fps > 30 && _fps != 60) {
log::warn("Currently only supports fixed 30fps and 60fps in 720p configuration, current configuration will be updated to 60fps.\r\n");
} else if (_width <= 1280 && _height <= 720 && _fps > 60 && _fps != 80) {
log::warn("Currently only supports fixed 30,60 and 80fps in 720p configuration, current configuration will be updated to 80fps.\r\n");
_fps = 80;
} else if (_width <= 1280 && _height <= 720 && _fps < 80 && _fps > 30 && _fps != 60) {
log::warn("Currently only supports fixed 30,60 and 80fps in 720p configuration, current configuration will be updated to 60fps.\r\n");
_fps = 60;
}
_device = "";
Expand Down

0 comments on commit d7f4b5a

Please sign in to comment.