Skip to content

Commit

Permalink
Introduce anti-flicking parameter on Ingenic for now
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed Jun 3, 2024
1 parent 77b908f commit 14b3f5d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/app_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ enum ConfigError parse_app_config(void) {

app_config.mirror = false;
app_config.flip = false;
app_config.antiflicker = 0;

app_config.night_mode_enable = false;
app_config.ir_sensor_pin = 999;
Expand Down Expand Up @@ -123,6 +124,7 @@ enum ConfigError parse_app_config(void) {
err = parse_bool(&ini, "isp", "flip", &app_config.flip);
if (err != CONFIG_OK)
goto RET_ERR;
parse_int(&ini, "isp", "antiflicker", -1, 60, &app_config.antiflicker);

err = parse_bool(&ini, "rtsp", "enable", &app_config.rtsp_enable);
if (err != CONFIG_OK)
Expand Down
1 change: 1 addition & 0 deletions src/app_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct AppConfig {
// [isp]
bool mirror;
bool flip;
int antiflicker;

// [night_mode]
bool night_mode_enable;
Expand Down
13 changes: 10 additions & 3 deletions src/hal/inge/t31_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int t31_config_load(char *path)
return t31_isp.fnLoadConfig(path);
}

int t31_pipeline_create(char mirror, char flip, char framerate)
int t31_pipeline_create(char mirror, char flip, char antiflicker, char framerate)
{
int ret;

Expand Down Expand Up @@ -193,8 +193,15 @@ int t31_pipeline_create(char mirror, char flip, char framerate)
return ret;
if (ret = t31_isp.fnSetRunningMode(0))
return ret;
if (ret = t31_isp.fnSetAntiFlicker(T31_ISP_FLICK_60HZ))
return ret;
{
t31_isp_flick mode = T31_ISP_FLICK_OFF;
if (antiflicker >= 60)
mode = T31_ISP_FLICK_60HZ;
else if (antiflicker >= 50)
mode = T31_ISP_FLICK_50HZ;
if (ret = t31_isp.fnSetAntiFlicker(mode))
return ret;
}
if (ret = t31_isp.fnSetFlip((mirror ? 1 : 0) | (flip ? 2 : 0)))
return ret;
if (ret = t31_isp.fnSetFramerate(framerate, 1))
Expand Down
4 changes: 2 additions & 2 deletions src/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ int start_sdk() {
height, framerate); break;
case HAL_PLATFORM_I6F: ret = i6f_pipeline_create(0, width,
height, framerate); break;
case HAL_PLATFORM_T31: ret = t31_pipeline_create(
app_config.mirror, app_config.flip, framerate); break;
case HAL_PLATFORM_T31: ret = t31_pipeline_create(app_config.mirror,
app_config.flip, app_config.antiflicker, framerate); break;
case HAL_PLATFORM_V3: ret = v3_pipeline_create(); break;
case HAL_PLATFORM_V4: ret = v4_pipeline_create(); break;
}
Expand Down

0 comments on commit 14b3f5d

Please sign in to comment.