hi_isp_ae_result

Description

Defines the results returned by the AE algorithm library to the ISP for configuring registers.

Definition

typedef struct {
    hi_u32  int_time[4];
    hi_u32  isp_dgain;
    hi_u32  again;
    hi_u32  dgain;
    hi_u32  iso;
    hi_u32  isp_dgain_sf;
    hi_u32  again_sf;
    hi_u32  dgain_sf;
    hi_u32  iso_sf;
    hi_u8   ae_run_interval;
    hi_bool piris_valid;
    hi_s32  piris_pos;
    hi_u32  piris_gain;
    hi_u32  sns_lhcg_exp_ratio;
    hi_isp_fswdr_mode fswdr_mode;
    hi_u32  wdr_gain[HI_ISP_WDR_MAX_FRAME_NUM];
    hi_u32  hmax_times;
    hi_u32  vmax;
    hi_isp_ae_stat_attr stat_attr;
    hi_isp_dcf_update_info update_info;
} hi_isp_ae_result;

Members

Member

Description

int_time

Exposure time calculated by the AE (unit: 1/16 μs). When the exposure time is converted from the number of lines to μs, the offset in cmos.c needs to be considered.

In linear mode and sensor built-in WDR mode, only int_time[0] is valid. It is recommended that int_time[1:3] be set to the same value as int_time[0]. In N-frame fusion WDR mode, int_time[0:(N-1)] is valid and values are configured in ascending order, indicating the shortest exposure time to the longest exposure time. The values are used for calculating the ratio of the long frame exposure to the short frame exposure. It is recommended that int_time[(N-1):3] be set to the same value as int_time[(N-1)]. The value of int_time[0] needs to be passed to other modules for associated control related to the exposure time, which affects the SDK AWB effect. This data structure must be configured when the AWB algorithm and multi-frame WDR mode are used.

isp_dgain

ISP digital gain (8-bit precision). This member must be configured when the ISP digital gain is used and is set to 0x100 when the ISP digital gain is not used.

again

Sensor analog gain (10-bit precision). This member must be configured when the multi-frame WDR algorithm is used and is set to 0x400 when the WDR algorithm is not used.

dgain

Sensor digital gain (10-bit precision). This member must be configured when the multi-frame WDR algorithm is used and is set to 0x400 when the WDR algorithm is not used.

iso

Total gain calculated by the AE. The ISO indicates the system gain, and its unit is the multiple multiplied by 100. For example, if the system sensor gain is 2x and the ISP gain is 1x, the ISO of the entire system is 200 (2 x 1 x 100). This calculation method applies to all the ISO values in this document. This variable must be configured, because it affects the adaptive effects such as NR and sharpening of the ISP. In 2-to-1 WDR mode, the ISO calculation includes WDRGain.

isp_dgain_sf

Digital ISP gain of the short frames (8-bit precision). This member must be configured when the WDR algorithm is used and is set to 0x400 when the WDR algorithm is not used.

again_sf

Analog sensor gain of the short frames (10-bit precision). This member must be configured when the WDR algorithm is used and is set to 0x400 when the WDR algorithm is not used.

dgain_sf

Digital sensor gain of the short frames (10-bit precision). This member must be configured when the WDR algorithm is used and is set to 0x400 when the WDR algorithm is not used.

iso_sf

Total gain of the short frames calculated by the AE algorithm. In 2-to-1 WDR mode, the ISO calculation includes WDRGain.

ae_run_interval

Running interval of the AE algorithm. The value range is [1, 255].

The value 1 indicates that the AE algorithm runs for each frame.

The value 2 indicates that the AE algorithm runs once every two frames. The rest follows the same rule.

It is recommended that the configured value be less than or equal to 2. Otherwise, the AE adjustment speed is affected. In WDR mode, the recommended value is 1 for smoother AE convergence. This variable must be configured, because it determines the number of interval frames for configuring the AE calculation result to the sensor and ISP registers.

piris_valid

Whether the P-iris is valid.

  • If the value is HI_TRUE, the P-iris driver is called back in kernel mode to configure the position of the stepper motor.
  • If the value is HI_FALSE, no callback is performed.
  • When the AE algorithm and P-iris drive are used to connect to the P-iris lens, it must be set to HI_TRUE. It is set to HI_FALSE, when a non-P-iris lens is connected.

piris_pos

Position of the P-iris stepper motor. The value range depends on the specifications of the P-iris lens. This member must be configured when the P-iris driver connects to the P-iris lens.

piris_gain

Equivalent gain of the P-iris. The value range depends on the specifications of the P-iris lens. This member is used to calculate the equivalent exposure when the P-iris is working. The equivalent exposure serves as a reference for other modules. The value range is [0, 1024]. You are advised to set the value to 512 when a non-P iris lens is connected.

sns_lhcg_exp_ratio

Basic exposure ratio in LCG+HCG mode. This member is valid only when the sensor supports the LCG+HCG mode. Set it to 64 when the LCG+HCG mode is not used.

fswdr_mode

WDR fusion mode.

0: multi-frame combination WDR mode

1: long-frame mode

2: automatic long-frame mode

wdr_gain[HI_ISP_WDR_MAX_FRAME_NUM]

Digital gain of multiple channels before the WDR fusion (8-bit precision). This member must be configured for the ISP digital gain of multiple channels before the WDR fusion. Otherwise, the member is set to 0x100.

#define HI_ISP_WDR_MAX_FRAME_NUM 	4

hmax_times

Time when the sensor reads a line (unit: ns)

vmax

Total number of lines that take effect in each frame for the sensor (unit: line)

stat_attr

Results returned by the AE algorithm library to the ISP for configuring registers

update_info

DCF information related to the AE. Only the exposure parameters take effect.

Restrictions

  • The ISP basic algorithm unit adjusts the parameters such as the sharpness and NR parameters based on the total gain calculated by the AE algorithm.
  • weight_table supports the configuration of multi-channel weights for the main channel in stitching mode. You can assign a value to the weight table of each pipe subscript corresponding to each branch channel in the main channel. In non-stitching mode, only the weight tables corresponding to the pipe subscripts take effect.
  • To convert the exposure time to μs from int_time, you can use lines_per500ms in cmos.c. The conversion is as follows:

    int_time[0] = (((hi_u64)int_time_rst[0] × 1024 - offset) × 500000/ae_sns_dft->lines_per500ms) >> 10

    In the preceding formula, int_time_rst[0] indicates the exposure time in the unit of line. offset indicates the exposure time offset, and is calculated as follows: offset = offset x 1024. For details, see hi_isp_ae_accuracy.

  • To improve the accuracy of the calculated exposure ratio, the precision of exposure time in int_time is 1/16 μs. When calculating the exposure time, shift the exposure time four-bit leftward on the basis of μs. Otherwise, the calculated exposure ratio may be incorrect, and the exposure time obtained by other modules may be too short.
  • When a non-Ascend algorithm is used, int_time, isp_dgain, again, dgain, iso, hmax_times, and vmax must be configured. Otherwise, the associated control of other modules is affected. You can configure other parameters as required.