Basic ISP Function Development
First, read the sensor data sheet or contact engineers from the sensor vendor to familiarize yourself with the sensor to develop.
Learn the structure by referring to Application Software Development Guide (C&C++) and ISP Interface Reference in this document.
Generally, the driver contains the xxx_cmos.c, xxx_cmos.h, and xxx_sensor_ctl.c files, which are used for the ISP function and initialization sequence. The xxx_cmos_ex.h file is used to store the global variables (default parameters of the ISP algorithm) in the defined driver file.
The driver files have three callback functions, which are the interfaces used by the sensor driver to register functions with the firmware.
- hi_mpi_isp_sensor_reg_callback: ISP built-in callback function
- hi_mpi_ae_sensor_reg_callback: AE callback function
- hi_mpi_awb_sensor_reg_callback: AWB callback function
Development Workflow
Implement basic ISP functions in the following order:
- cmos_set_image_mode and cmos_set_wdr_mode
- cmos_set_image_mode
- This function is used to distinguish different resolutions. img_mode in hi_isp_sns_state is used to transfer the resolution mode.
- Pay attention to the return value. The return value 0 indicates that the sensor needs to be configured again, and therefore sensor_init() will be called. The return value -2 indicates that the sensor does not need to be configured again, and no operation will be performed.
- Pay attention to the difference between fl_std and fl in hi_isp_sns_state. fl_std indicates the total lines at the standard frame rate (generally 30 fps) in the current resolution and WDR mode. fl indicates the actual total lines. Its value can be changed based on fl_std and frame rate in other functions due to frame rate reduction.
- cmos_set_image_mode
- sensor_global_init
- sensor_init and sensor_exit
- cmos_get_isp_default and cmos_get_isp_black_level
- cmos_get_isp_default
This function is used to debug or correct parameters. You can change parameter values during debugging and correction.
Note that the parameters may vary in different WDR modes, such as gamma and DRC. For details, see Application Development (C&C++).
- cmos_get_isp_black_level
This function is used to configure the black level of the four channels of RAW data.
The black level of some sensors deviates with the change of the gain value. In this case, you need to correct the corresponding black level values under different ISO values with the cmos_get_isp_black_level() function.
- cmos_get_isp_default