hi_mpi_isp_set_exposure_attr

Description

Sets AE exposure attributes.

Prototype

hi_s32 hi_mpi_isp_set_exposure_attr(hi_vi_pipe vi_pipe, const hi_isp_exposure_attr *exp_attr)

Constraints

  • When the exposure control mode is automatic mode, the exposure time and exposure gain are automatically controlled by the AE algorithm. The exposure effect can be customized by configuring the parameters in the AE attribute data structure auto_attr.
  • If the exposure control mode is manual mode, enable parameters (including exposure time enable, sensor analog gain enable, sensor digital gain enable, and ISP digital gain enable) and exposure parameters (including the exposure time, sensor analog gain, sensor digital gain, and ISP digital gain) can be set by configuring the manual exposure (ME) attribute data structure manual_attr.
  • When the exposure control mode is automatic mode, configuring ME attribute parameters has no effect. When the exposure control mode is manual mode, configuring automatic attribute parameters has no effect.
  • When the exposure control mode is manual mode, if the value of an exposure parameter is greater than the maximum value or less than the minimum value, the maximum value or the minimum value supported by the sensor is used.
  • In both automatic and manual exposure control modes, the unit of the exposure time is μs, and the exposure gain is a multiple of the 10-bit precision. For example, the value 1024 indicates 1x gain, and the value 2048 indicates 2x gain.
  • In WDR mode, when the long frame is set as the priority frame: Exposure is performed preferentially based on the exposure route of the long frames. In 2-to-1 WDR mode, when the gains are configured separately, the short frame exposure route is adjusted according to the exposure parameters of the long frames, and vice versa.
  • In 2-to-1 WDR mode, when the gains are configured separately: If the sensor supports different gains for long and short frames, different analog sensor gains, digital sensor gains, and WDR gains can be set for long and short frames respectively. If the sensor does not support different gains for long and short frames, different WDR gains can be set for long and short frames.
  • When importing images from the BE using the API, you must set the AE control mode to manual.

Parameters

Parameter

Input/Output

Description

vi_pipe

Input

VI pipe ID

Value range: [0, 8)

exp_attr

Input

Pointer to the AE attributes

Returns

  • 0: success
  • Other values: failure. For details, see Error Codes.

Example

Configure AE attributes:

hi_vi_pipe vi_pipe = 0; 
hi_isp_exposure_attr exp_attr;

hi_mpi_isp_get_exposure_attr(vi_pipe, &exp_attr);
 
exp_attr.bypass = HI_FALSE;    
exp_attr.prior_frame = HI_ISP_LONG_FRAME; 
exp_attr.ae_gain_sep_cfg = HI_FALSE;
exp_attr.op_type = HI_OP_MODE_AUTO;        
exp_attr.auto_attr.exp_time_range.max = 40000; 
exp_attr.auto_attr.exp_time_range.min = 10;
hi_mpi_isp_set_exposure_attr(vi_pipe, &exp_attr); 

exp_attr.auto_attr.speed = 0x80;
hi_mpi_isp_set_exposure_attr(vi_pipe, &exp_attr); 

exp_attr.auto_attr.exp_attr = HI_ISP_AE_EXP_HIGHLIGHT_PRIOR;    
exp_attr.auto_attr.hist_ratio_slope = 0x100; 
exp_attr.auto_attr.max_hist_offset = 0x40; 
hi_mpi_isp_set_exposure_attr(vi_pipe, &exp_attr); 

exp_attr.auto_attr.antiflicker.enable = HI_TRUE; 
exp_attr.auto_attr.antiflicker.frequency = 50; 
exp_attr.auto_attr.antiflicker.mode = HI_ISP_ANTIFLICKER_NORMAL_MODE; hi_mpi_isp_set_exposure_attr(vi_pipe, &exp_attr); 

exp_attr.auto_attr.ae_delay_attr.black_delay_frame = 10; 
exp_attr.auto_attr.ae_delay_attr.white_delay_frame = 0; hi_mpi_isp_set_exposure_attr(vi_pipe, &exp_attr);

Configure ME attributes:

hi_vi_pipe vi_pipe = 0; 
hi_isp_exposure_attr exp_attr;

hi_mpi_isp_get_exposure_attr(vi_pipe, &exp_attr);
exp_attr.bypass = HI_FALSE;    
exp_attr.op_type = HI_OP_MODE_MANUAL;
exp_attr.manual_attr.a_gain_op_type = HI_OP_MODE_MANUAL; 
exp_attr.manual_attr.d_gain_op_type = HI_OP_MODE_MANUAL;
exp_attr.manual_attr.ispd_gain_op_type = HI_OP_MODE_MANUAL; 
exp_attr.manual_attr.exp_time_op_type = HI_OP_MODE_MANUAL; 
exp_attr.manual_attr.a_gain = 0x400; 
exp_attr.manual_attr.d_gain = 0x400; 
exp_attr.manual_attr.isp_d_gain = 0x400; 
exp_attr.manual_attr.exp_time = 0x40000;
hi_mpi_isp_get_exposure_attr(vi_pipe, &exp_attr);