hi_isp_ae_attr

Description

Defines the AE attribute.

Definition

typedef struct {
    hi_isp_ae_range exp_time_range; 
    hi_isp_ae_range a_gain_range;
    hi_isp_ae_range d_gain_range; 
    hi_isp_ae_range ispd_gain_range; 
    hi_isp_ae_range sys_gain_range; 
    hi_u32 gain_threshold; 
    hi_u8   speed; 
    hi_u16  black_speed_bias; 
    hi_u8   tolerance; 
    hi_u8   compensation; 
    hi_u16  ev_bias;
    hi_isp_ae_strategy ae_strategy_mode; 
    hi_u16  hist_ratio_slope; 
    hi_u8   max_hist_offset; 
    hi_isp_ae_mode     ae_mode; 
    hi_isp_antiflicker antiflicker;
    hi_isp_subflicker  subflicker; 
    hi_isp_ae_delay    ae_delay_attr; 
    hi_bool manual_exp_value; 
    hi_u32  exp_value; 
    hi_isp_fswdr_mode fswdr_mode;
    hi_bool wdr_quick;
    hi_u16  iso_cal_coef;
} hi_isp_ae_attr;

Members

Member

Description

exp_time_range

Exposure time range (in μs). The value range is [0x0, 0xFFFFFFFF], which depends on the sensor.

a_gain_range

Range of the sensor analog gain (10-bit decimal precision). The value range is [0x400, 0xFFFFFFFF], which depends on the sensor.

d_gain_range

Range of the ISP digital gain (10-bit decimal precision). The value range is [0x400, 0xFFFFFFFF], which depends on the sensor.

ispd_gain_range

Range of the ISP digital gain (10-bit decimal precision). The value range is [0x400, 0x40000].

sys_gain_range

System gain range (10-bit decimal precision).

The value range is [0x400, 0xFFFFFFFF], which depends on the sensor.

gain_threshold

System gain threshold during automatic frame rate reduction (10-bit decimal precision). The value range is [0x400, 0xFFFFFFFF].

speed

Speed during AE adjustment.

The value range is [0x0, 0xFF], and the default value is 0x40.

black_speed_bias

Bias value of the AE adjustment speed when the image is adjusted from dark to bright. A larger value indicates that the speed at which the image is adjusted from dark to bright is higher.

The value range is [0x0, 0xFFFF], and the default value is 0x90.

tolerance

Image luminance tolerance during AE adjustment. The value range is [0x0, 0xFF], and the default value is 0x2.

compensation

Target luminance for AE adjustment.

The value range is [0x0, 0xFF], and the default value is 0x38.

ev_bias

Target luminance deviation during AE adjustment (10-bit decimal precision). The value range is [0x0, 0xFFFF], and the default value is 0x400.

ae_strategy_mode

AE policy mode (highlight first or lowlight first)

hist_ratio_slope

ROI weight.

The value range is [0x0, 0xFFFF], and the default value is 0x80.

max_hist_offset

Maximum influence on the average statistics exerted by ROIs.

The value range is [0x0, 0xFF], and the default value is 0x10.

ae_mode

AE mode (automatic frame rate reduction mode or fixed frame rate mode)

antiflicker

Anti-flicker attribute. Anti-flicker is disabled by default.

subflicker

Sub-anti-flicker attribute. Sub-anti-flicker is disabled by default.

ae_delay_attr

Delay attribute. By default, black_delay_frame is set to 8 and white_delay_frame is set to 0.

manual_exp_value

Manual exposure enable. When the value is set to HI_TRUE, the AE algorithm uses exp_value as the current exposure for the allocation of exposure time and gain. When the value is set to HI_FALSE, the automatically calculated exposure is used for allocation. The default value is HI_FALSE.

exp_value

Manual exposure value (in μs), which is equal to the exposure time multiplied by the system gain.

The value range is (0x0, 0xFFFFFFFF].

fswdr_mode

FSWDR running mode. The default value is HI_ISP_FSWDR_NORMAL_MODE.

wdr_quick

In WDR mode, when the AE algorithm implements re-adjustment from the stable state (the luminance error is less than or equal to the tolerance value), temporal filtering is performed on the first 50 frames by default to ensure smoother adjustment. If the value is HI_TRUE, the temporal filtering on the first 50 frames is canceled so that the AE convergence is faster. The default value is HI_FALSE.

iso_cal_coef

ISO calibration coefficient, which is used to ensure that the ISO displayed in the DCF required for photographing is a standard value (8-bit precision).

The value range is [0x0, 0xFFFF], and the default value is 0x100.

Restrictions

  • In automatic mode, changing the ME attribute value does not take effect.
  • Maximum and minimum exposure time and gain value for AE

    You can specify the exposure time and gain value based on the application scenario. If objects move fast, you can set a short exposure time. This alleviates smearing of moving objects.

    To prevent color unsaturation in the image overexposure region, the ISP automatically corrects the value of Isp_dgain based on the sensor black level. Therefore, even if the maximum value of Isp_dgain is limited to 1024, its actual value is still greater than 1024. To forcibly limit the value of Isp_dgain to 1024, use the manual mode. However, the bright region of the image may have a pink cast.

  • AE system gain

    For non-extended paths, if the product of the minimum sensor analog gain, minimum sensor digital gain, and minimum ISP digital gain is less than the minimum system gain, the minimum system gain is used for AE algorithm calculation. If the product of the maximum sensor analog gain, maximum sensor digital gain, and maximum ISP digital gain is greater than the maximum system gain, the maximum system gain is used for AE algorithm calculation. You are advised to limit the sensor analog gain, sensor digital gain, and ISP digital gain by setting the maximum and minimum system gains. If the high-precision ISP digital gain is limited to 1x, the image may flicker.

    For extended paths, the exposure range is controlled by combining the maximum or minimum system gain and the exposure time range. The sensor analog gain, sensor digital gain, and ISP digital gain are not directly affected by the system gain. The AE algorithm uses the system gain to calculate the maximum/minimum exposures internally instead of directly limiting the value of a specific gain. For example, if the maximum value of the system gain is limited to 1x but the minimum value of the sensor analog gain is limited to 2x, the actual result is subject to the limitation of the sensor analog gain. This rule applies to the limitations of the sensor digital gain and ISP digital gain. In manual mode, the system gain does not take effect, and the gain values are not limited.

  • System gain threshold during automatic frame rate reduction

    When the system gain reaches the threshold, the system enters the slow shutter mode automatically.

  • speed is used to set the AE convergence speed. A larger value indicates faster convergence but more frequent oscillation during convergence. For the Panasonic MN34220 sensor, it is recommended that the configured value of speed be less than 64 in 2-to-1 frame-based WDR mode due to the sensor performance restrictions. Otherwise, flicker may occur when the light changes significantly.
  • black_speed_bias is an offset value of the AE adjustment speed for adjusting the image from dark to bright. At the default speed, the AE adjustment speed from bright to dark is faster than that from dark to bright. To equalize the speeds in both directions, increase black_speed_bias.
  • The luminance compensation attribute parameter compensation is used to adjust the target exposure luminance. A larger compensation value indicates higher image luminance.
  • The exposure bias attribute ev_bias is used to fine-tune the target luminance of the image in special scenarios and it can be considered as high-precision luminance compensation. The actual target AE luminance is calculated as follows: compensation x ev_bias/1024. When compensation remains unchanged, a larger value indicates higher image luminance.
  • The exposure tolerance attribute is used to adjust the sensitivity to the environment during exposure. A larger exposure tolerance indicates more insensitive effect and greater luminance error that is caused by adjusting the same target luminance for multiple times. Therefore, the exposure tolerance cannot be too large. Especially when the target luminance value is relatively small and the exposure tolerance value is relatively large, the final image luminance after convergence varies greatly. When you fine-tune the target image luminance by changing the value of ev_bias, if the exposure tolerance value is too large and the change of ev_bias is too small, the adjustment effect may not be obvious.
  • The exposure policy attribute ae_strategy_mode is used to select the highlight first or lowlight first exposure policy. The highlight first exposure policy indicates sensitivity to the highlight. In this case, overexposure should be avoided. The lowlight first exposure policy indicates sensitivity to the lowlight. In this case, the dark regions are as clear as possible no matter whether overexposure occurs or not. The default exposure policy is the highlight first exposure policy. You can change the exposure policy as required.
  • hist_ratio_slope is used to set the exposure weights of the ROIs. If the highlight first exposure policy is selected, hist_ratio_slope indicates the weight of the highlight region. A larger value indicates greater sensitivity to the highlight region. If the highlight first exposure policy is selected, hist_ratio_slope indicates the weight of the lowlight region. A larger value indicates greater sensitivity to the dark region. It is recommended that the value of hist_ratio_slope be less than or equal to 0x100. If the highlight first exposure policy is selected and the value of hist_ratio_slope is too large, the AE algorithm considers that the image luminance is much greater than the target luminance as long as there is a small overexposure region in the image. Therefore, the exposure value is continuously decreased. As a result, the image becomes dark. In addition, the overexposure region in the image quickly becomes smaller and to a certain extent the AE algorithm considers that the image luminance is less than the target luminance. Therefore, the exposure value is increased. In this way, the exposure value is decreased and increased repeatedly, and image flicker occurs. Similarly, if the lowlight-first exposure policy is selected and the AE target luminance is low, the image luminance is greatly affected when black objects move back and forth in the image. You can alleviate this issue by decreasing the exposure adjustment speed and increasing the exposure tolerance.
  • In AE mode, the greatest impact (max_hist_offset) on the average statistics exerted by ROIs can be configured.

    Configuring max_hist_offset is equivalent to limiting the increased weight when hist_ratio_slope is increased. If max_hist_offset is 0, there is no special processing in the highlight or lowlight region regardless of the value of hist_ratio_slope . In this case, the average statistics are the original values. If max_hist_offset is set to an appropriate value, the average image luminance after the AE becomes stable in any application scenario can be limited to a certain range. If the highlight-first exposure policy is selected and the value of max_hist_offset is large, the luminance of the entire image may be low in the scenarios with a high contrast such as the outdoor scenario with the sky and trees in sunny days because the effect of the sky in bright regions takes priority. You can solve this issue by decreasing the value of max_hist_offset.

  • When the exposure policy is switched, it is recommended that the values of hist_ratio_slope and max_hist_offset be updated at the same time. Otherwise, the default values are used, and the effect may not be as expected.
  • When the highlight suppression solution is used, for example, in RGBIR mode, you are advised to set the highlight-first exposure policy, reduce the AE target luminance, and set hist_ratio_slope and max_hist_offset to larger values to suppress highlight. You can enable the DRC function to make the dark regions clear. The lowlight-first exposure policy can be used to implement backlight compensation in non-specified regions.
  • When the AE control mode is automatic mode, the exposure mode ae_mode can be set to slow shutter mode or fixed frame rate mode. The slow shutter mode is used to automatically decrease the frame rate to reduce noise in the low-illuminance scenario.
  • The anti-flicker attribute antiflicker can be used to set anti-flicker enable status, anti-flicker frequency, and anti-flicker mode. In FSWDR mode, anti-flicker for long frames is valid. When short frames take the priority and gains are separately configured, anti-flicker for both long frames and short frames is valid. You are advised to use the automatic anti-flicker mode in FSWDR mode. The reason is that the maximum short frame exposure time is limited according to the change of the exposure ratio.

    Note: The OV2718 sensor performs the exposure operation for only once in WDR mode, and only the exposure time is valid only for short frames. Therefore, the anti-flicker and sub-anti-flicker effect is not as expected.

  • The sub-anti-flicker attribute subflicker can be used to enable or disable the sub-anti-flicker function and set the anti-flicker level. If the auto-iris is used, you are advised to disable sub-anti-flicker.
  • When the AE control mode is automatic mode, the AE delay attribute ae_delay_attr can be configured. An appropriate delay ensures stable luminance, preventing luminance variance when objects move quickly. The delay value can be increased properly when the bit rate is low to avoid blocking artifact during AE adjustment.
  • You can set manual_exp_value to HI_TRUE and then manually configure the exposure (exp_value) to mask the adjusted exposures and use only the allocated exposures of the Ascend AE algorithm. exp_value is limited by the maximum and minimum exposure. The maximum/minimum exposure is the maximum/minimum exposure time multiplied by the gain.
  • In WDR mode, if long frames take the priority, exp_time_range is used to set the exposure time range of a long frame. If short frames take the priority, exp_time_range is used to set the exposure time range of a short frame.
  • When the FSWDR running mode is changed, the callback functions cmos_long_frame_mode_set, cmos_get_ae_default, cmos_fps_set, and cmos_get_inttime_max in cmos.c need to be modified to ensure that the exposure time of long frames and short frames falls within a reasonable range. During the switching between the normal WDR mode and long frame mode, cmos_get_ae_default is called, and parameters such as the maximum/minimum exposure time, maximum/minimum gain value, maximum/minimum iris value, and compensation value are updated. Besides, the AE internally updates hist_ratio_slope and max_hist_offset to the default values. Note that the settings related to the exposure ratio are not updated and retain the previous values. When the long frame mode is enabled, the DRC strength is gradually converged to the target value in automatic mode. You can call the corresponding MPI to change parameter values as required after switching is complete.

    The prerequisite for smooth switching is that the short frame exposure and long frame exposure are the same before and after switching. When the exposure is large, the gains are limited in the normal WDR mode. In long frame mode, to ensure the low illuminance effect, the gains are not limited. However, the short frame exposure may not be equal to the long frame exposure before/after the switching. It is normal that several frames suddenly become bright or dark. To avoid this phenomenon, loosen restrictions on the gain after switching is complete.

    • The long frame mode is valid only in line-based WDR mode. In frame-based WDR mode, the exposure ratio is set to 1:1 and motion detection is disabled. In this way, the effect is the same as that in long-frame line-based WDR mode. It is recommended that fswdr_mode be set to HI_ISP_FSWDR_NORMAL_MODE in non-line-based WDR mode.
    • The sensors that perform the exposure operation for only once in line-based WDR mode do not support the long frame mode, such as OV2718.