Skip to content

Commit

Permalink
Set the input framerate and handle T31 chips that only support a sing…
Browse files Browse the repository at this point in the history
…le video buffer
  • Loading branch information
wberube committed Jun 3, 2024
1 parent 4017841 commit 77b908f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/hal/inge/t31_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ int t31_channel_create(char index, short width, short height, char framerate)
.dest = { .width = width, .height = height }, .pixFmt = T31_PIXFMT_NV12,
.scale = { .enable = (_t31_snr_dim.width != width || _t31_snr_dim.height != height)
? 1 : 0, .width = width, .height = height },
.fpsNum = framerate, .fpsDen = 1, .bufCount = 2, .phyOrExtChn = 0,
.fpsNum = framerate, .fpsDen = 1,
.bufCount = _t31_snr_dim.width > 1920 ? 2 : 1, .phyOrExtChn = 0,
};

if (ret = t31_fs.fnCreateChannel(index, &channel))
Expand Down Expand Up @@ -162,7 +163,7 @@ int t31_config_load(char *path)
return t31_isp.fnLoadConfig(path);
}

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

Expand Down Expand Up @@ -192,10 +193,12 @@ int t31_pipeline_create(char mirror, char flip)
return ret;
if (ret = t31_isp.fnSetRunningMode(0))
return ret;
if (ret = t31_isp.fnSetAntiFlicker(T31_ISP_FLICK_50HZ))
if (ret = t31_isp.fnSetAntiFlicker(T31_ISP_FLICK_60HZ))
return ret;
if (ret = t31_isp.fnSetFlip((mirror ? 1 : 0) | (flip ? 2 : 0)))
return ret;
if (ret = t31_isp.fnSetFramerate(framerate, 1))
return ret;

if (ret = t31_osd.fnCreateGroup(_t31_osd_grp))
return ret;
Expand Down
4 changes: 2 additions & 2 deletions src/hal/inge/t31_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int t31_channel_unbind(char index);

int t31_config_load(char *path);

int t31_pipeline_create(char mirror, char flip);
int t31_pipeline_create(char mirror, char flip, char framerate);
void t31_pipeline_destroy(void);

int t31_region_create(int *handle, hal_rect rect);
Expand All @@ -42,4 +42,4 @@ int t31_video_destroy_all(void);
void *t31_video_thread(void);

void t31_system_deinit(void);
int t31_system_init(void);
int t31_system_init(void);
9 changes: 8 additions & 1 deletion src/hal/inge/t31_isp.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ typedef struct {
int (*fnLoadConfig)(char *path);
int (*fnSetAntiFlicker)(t31_isp_flick mode);
int (*fnSetFlip)(int mode);
int (*fnSetFramerate)(unsigned int fpsNum, unsigned int fpsDen);
int (*fnSetRunningMode)(int nightOn);

int (*fnAddSensor)(t31_isp_snr *sensor);
Expand Down Expand Up @@ -157,6 +158,12 @@ static int t31_isp_load(t31_isp_impl *isp_lib) {
return EXIT_FAILURE;
}

if (!(isp_lib->fnSetFramerate = (int(*)(unsigned int fpsNum, unsigned int fpsDen))
dlsym(isp_lib->handle, "IMP_ISP_Tuning_SetSensorFPS"))) {
fprintf(stderr, "[t31_isp] Failed to acquire symbol IMP_ISP_Tuning_SetSensorFPS!\n");
return EXIT_FAILURE;
}

if (!(isp_lib->fnSetRunningMode = (int(*)(int nightOn))
dlsym(isp_lib->handle, "IMP_ISP_Tuning_SetISPRunningMode"))) {
fprintf(stderr, "[t31_isp] Failed to acquire symbol IMP_ISP_Tuning_SetISPRunningMode!\n");
Expand Down Expand Up @@ -194,4 +201,4 @@ static void t31_isp_unload(t31_isp_impl *isp_lib) {
if (isp_lib->handle) dlclose(isp_lib->handle);
isp_lib->handle = NULL;
memset(isp_lib, 0, sizeof(*isp_lib));
}
}
2 changes: 1 addition & 1 deletion src/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ int start_sdk() {
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); break;
app_config.mirror, app_config.flip, 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 77b908f

Please sign in to comment.