No-Light-Sensor Quick Convergence of the AE

Overview

This function enables the sensor to quickly converge to the target luminance range after startup of the AE algorithm when no light sensor reports the current luminance.

Currently, this function can converge to the target luminance range within 10 frames in most scenarios. The target luminance range is [Target luminanceTarget luminance × 10%, Target luminance + Target luminance × 10%]. For example, when the target luminance is 50, the target luminance range is [45, 55].

Development Workflow

  1. Adapt the register write mode of the sensor.

    No-light-sensor quick convergence requires that the delay for the exposure parameters configured for the sensor to take effect must be three frames. That is, if the exposure parameters for the sensor are configured in the AE algorithm during the first frame, the luminance statistics (raw data) for the effective exposure parameters can be obtained in the fourth frame. If the delay is not three frames, the sensor driver needs to be modified and adapted.

    Generally, for most sensors on the AI processor platform, the delay is four frames. You can configure the sensor driver so that it can directly set the exposure parameters (including the number of exposure lines, sensor analog gain, and sensor digital gain) by calling the I2C interface in sensor register write mode. In this way, the exposure parameters for the sensor can take effect one frame in advance.

    After the sensor is changed to the mode of directly writing to the register by using the I2C interface, the number of exposure lines, sensor analog gain, sensor digital gain, and number of delayed frames for the ISP digital gain to take effect must be synchronized to ensure exposure synchronization.

  2. Configure the pfn_cmos_ae_quick_start_status_set callback function.

    After no-light-sensor quick convergence is implemented, this callback function is called, with quick_start_status set to HI_TRUE. This configuration changes the mode of configuring the register over the I2C interface in 1 back to normal mode.

  3. Set the following parameters related to no-light-sensor quick convergence:
    1. ae_sns_dft->quick_start.quick_start_enable: Set it to HI_TRUE to enable no-light-sensor quick convergence.
    2. ae_sns_dft->quick_start.black_frame_num: number of initial bad frames. Some sensors output several bad frames upon startup. To ensure that the AE algorithm can obtain valid statistics in a timely manner, type the correct number of bad frames. If there is no bad frame, type 0.
    3. ae_sns_dft->quick_start.ir_mode_en: whether the infrared (IR) mode is supported for no-light-sensor quick convergence. This setting is required to support IR Cut and IR LED for no-light-sensor quick convergence.
    4. ae_sns_dft->quick_start.init_exposure_ir: initial exposure for no-light-sensor quick convergence in IR mode.
    5. ae_sns_dft->quick_start.iso_thr_ir: ISO threshold for switching from the normal mode to the IR mode for no-light-sensor quick convergence.

      The upper layer determines whether to enter the IR mode based on whether the obtained ISO value is greater than iso_thr_ir. In addition, the AE quick convergence algorithm determines whether to switch to the quick convergence IR mode based on this parameter.

    6. ae_sns_dft->quick_start.ir_cut_delay_time:physical time required for enabling the IR CUT of no-light-sensor quick convergence. The unit is ms.

      The preceding parameters can be flexibly set by using the pfn_set_init() function in the sensor driver.

  4. Calibrate the initial exposure. Different sensors have different optoelectronic sensitivities, even under the same exposure parameters. In addition, the final exposure luminance of the sensor varies according to the iris size and the optical filter.

    You must calibrate the initial exposure of no-light-sensor quick convergence. The calibration procedure is as follows:

    1. Set the light level of the light source box to EV8.
    2. Set max_hist_offset to 0 and set the AE algorithm to manual mode.
    3. Face the camera lens to the light source box to adjust the exposure. When the value of OriAve is 80, the corresponding exposure is used as the initial exposure.
  5. Fine-tune the initial exposure. The luminance range varies according to the product form. You can fine-tune the initial exposure obtained in 4 to speed up no-light-sensor quick convergence.

Constraints

  • In 2, configure the sensor to set the exposure by writing the sensor register over the I2C interface. After no-light-sensor quick convergence is complete, you must change the sensor configuration mode back to normal mode.
  • The initial luminance value 80 is recommended. You can adjust the luminance based on the product form and the luminance range to achieve the optimal quick convergence speed. If there is no light source box, you can adjust the initial exposure by using the exposure parameters corresponding to the 24 ms exposure time, ISO100, and iris 1.6.