hi_isp_shading_lut_attr

Description

Defines the attribute of the mesh shading gain LUT.

Definition

typedef struct {    
    hi_u8   mesh_scale;     
    hi_u16  x_grid_width[HI_ISP_MLSC_X_HALF_GRID_NUM];     
    hi_u16  y_grid_width[HI_ISP_MLSC_Y_HALF_GRID_NUM];  
    hi_isp_shading_gain_lut lsc_gain_lut[HI_ISP_MLSC_GAIN_LUT_NUM];     
    hi_isp_bnr_lsc_gain_lut bnr_lsc_gain_lut;
} hi_isp_shading_lut_attr;

Members

Member

Description

mesh_scale

Parameter used for controlling the gain precision in a gain table. If the selected precision is low (for example, mesh_scale is 3), the image attenuation is large and grids may appear. You can increase the precision (for example, set mesh_scale to 7) and perform the calibration again.

Value range: [0, 7]

x_grid_width[HI_ISP_MLSC_X_HALF_GRID_NUM]

Member used to store the width of each grid partition. The minimum value of each component in this interface is 4, and the sum of all components is 1/4 of the width of the original image. For example, if the original image size is 1080p, the sum of all parameter values in this interface is 480.

Value range: [4, width/4 – 60], where width is the width of the original image

#define HI_ISP_LSC_GRID_COL             33
#define HI_ISP_MLSC_X_HALF_GRID_NUM       ((HI_ISP_LSC_GRID_COL - 1) / 2)

y_grid_width[HI_ISP _MLSC_Y_HALF_GRID_NUM]

Member used to store the height of each grid partition. The minimum value of each component in this interface is 4, and the sum of all components is 1/4 of the height of the original image. For example, if the original image size is 1080p, the sum of all parameter values in this interface is 270.

Value range: [4, height /4 – 60], where height is the height of the original image

#define HI_ISP_LSC_GRID_ROW             33
#define HI_ISP_MLSC_Y_HALF_GRID_NUM       ((HI_ISP_LSC_GRID_ROW - 1) / 2)

lsc_gain_lut[HI_ISP_MLSC_GAIN_LUT_NUM]

Gain table configuration at two color temperatures. The correction gain table is calculated on the hardware under the current color temperature based on these two tables and blend_ratio.

Value range: [0, 1023]

#define HI_ISP_MLSC_GAIN_LUT_NUM          2

bnr_lsc_gain_lut

Gain table referenced by BNR LSC.

Value range: [0, 65535]

Restrictions

  • Adjusting the value of x_grid_width or y_grid_width is actually adjusting the partition width or height. As the entire image is horizontally and vertically symmetrical, when the width or height of a partition is configured, the width or height of the symmetrical partition will change accordingly. The total sum of the partition widths or heights after adjustment needs to be 1/4 of the width or height of the original image. It is not recommended to manually adjust the values, because the adjustment is complex and may cause color shading. When the resolution is switched, x_grid_width and y_grid_width are automatically reconfigured.
  • The hardware uses interpolation to calculate the correction gain table at the current color temperature based on the gain tables configured at two color temperatures and the blend_ratio value, and corrects shading of the entire image based on the calculation result. Wherein, blend_ratio indicates the corresponding weight of lsc_gain_lut[0].
  • In single illuminant mode, lsc_gain_lut needs to be configured to be consistent. That is, you need to set it to the first illuminant that is calibrated.
  • The gain bit width is 10 bits, that is, the maximum value is 1023.

    − When mesh_scale is set to 0 to 3, the gain representation is the same as that of other algorithms. The gain precision is in descending order, the value range increases, and the 1x gain is not 0.

    − When mesh_scale is set to 4 to 7, the precision is in descending order, and the gain representation is slightly different. The gain calculation method is as follows: general gain – 1x gain of the corresponding precision. For example, when mesh_scale is 5, the gain precision is 1.9. If the general gain is 886 and the 1x gain is 512, the actual gain is 374 (886 – 512). In this case, the minimum gain is 1x, but the value range it can represent is wider than that of the previous representation.

  • In the case of complete correction, the gain precision mesh_scale should be as high as possible to improve the correction accuracy. For example, if the correction can be performed when mesh_scale is 0 or 4, set mesh_scale to 4. In the extreme case of serious lens shading, the lens shading may not be completely corrected. If a large gain multiple (for example, mesh_scale is 3) is selected for correction, dark stripes may appear at the edges. In this case, you need to decrease the gain multiple to improve the precision (set mesh_scale to 2 or 7) and perform calibration again until the dark stripes disappear.
Table 1 Mapping between configured values of mesh_scale and gain precisions

mesh_scale

Data Format of the Gain Table

Gain Value Range

Gain Configuration Value Mapping 1x Gain

0

1.9

[0, 2)

512

1

2.8

[0, 4)

256

2

3.7

[0, 8)

128

3

4.6

[0, 16)

64

4

0.10

[1, 2)

0

5

1.9

[1, 3)

0

6

2.8

[1, 5)

0

7

3.7

[1, 9)

0