hi_isp_clut_lut

Description

Defines the LUT of the CLUT.

Definition

typedef struct {
     hi_u32 lut[HI_ISP_CLUT_LUT_LENGTH];
} hi_isp_clut_lut;

Members

Member

Description

lut

Value range of the LUT: [0, 1073741823]

Note: The valid range of each element in the LUT is 30 bits. If the value exceeds the value range, the actual range is still 30 bits.

#define HI_ISP_CLUT_LUT_LENGTH                    5508

Restrictions

You need to generate a 3D LUT, place the 17 x 17 x 17 x 3 LUT in the 8 x 3 LUT, and then fill the LUT with the length of 5508 with the 8 x 3 LUT.

The range of each element in the 17 x 17 x 17 x 3 LUT is [–511, 511], which is represented by 10-bit signed numbers. The following shows how to place the 17 x 17 x 17 x 3 LUT into the 8 x 3 LUT:

If the index in the 3D LUT is an even number, the value is defined as 0. If the index is an odd number, the value is defined as 1. In R[i][j][k], G[i][j][k], B[i][j][k], i represents a grid of r, j represents a grid of b, and k represents a grid of g. That is, ijk represents address coordinates of the 3D table, and corresponds to an arrangement sequence of rbg. The values of R[i][j][k], G[i][j][k], B[i][j][k] are the values of deltaR, deltaG, and deltaB. When we use C to represent RGB, we can obtain the following truth table.

The pseudo codes of the preceding table are as follows:
for(k = 0; k < 17; k++) {
    for(j = 0; j < 17; j++) {
        for(i = 0; i < 17; i++) {
            switch((i&1) + ((j&1)<<1) + ((k&1)<<2)) {
                case 0:
                    R0[n0]=R[i][j][k];
                    G0[n0]=G[i][j][k];
                    B0[n0]=B[i][j][k];
                case 1:
                    R1[n1]=R[i][j][k];
                    G1[n1]=G[i][j][k];
                    B1[n1]=B[i][j][k];
                case 2:
                    R2[n2]=R[i][j][k];
                    G2[n2]=G[i][j][k];
                    B2[n2]=B[i][j][k];
                case 3:
                    R3[n3]=R[i][j][k];
                    G3[n3]=G[i][j][k];
                    B3[n3]=B[i][j][k];
                case 4:
                    R4[n4]=R[i][j][k];
                    G4[n4]=G[i][j][k];
                    B4[n4]=B[i][j][k];
                case 5:
                    R5[n5]=R[i][j][k];
                    G5[n5]=G[i][j][k];
                    B5[n5]=B[i][j][k];
                case 6:
                    R6[n6]=R[i][j][k];
                    G6[n6]=G[i][j][k];
                    B6[n6]=B[i][j][k];
                case 7:
                    R7[n7]=R[i][j][k];
                    G7[n7]=G[i][j][k];
                    B7[n7]=B[i][j][k];
            }
        }
    }
}

The generated eight LUTs are c0[729], c1[648], c2[648], c3[576], c4[648], c5[576], c6[576], and c7[512], when C is used to represent RGB.

In the following description, _0 represents the 0th data in the 1D array c0[729], and _1 represents the 1st data in the 1D array c0[729].

The 8 x 3 LUT is arranged by 8 x 3 data and forms one 32-bit data segment. The format is defined as follows:

{2'b00,B0_0,G0_0,R0_0},

{2'b00,B1_0,G1_0,R1_0},

{2'b00,B2_0,G2_0,R2_0},

{2'b00,B3_0,G3_0,R3_0},

{2'b00,B0_1,G0_1,R0_1},

{2'b00,B1_1,G1_1,R1_1},

{2'b00,B2_1,G2_1,R2_1},

{2'b00,B3_1,G3_1,R3_1},

{......},

The preceding format can be shown in the following figure:

The overall format is as follows:

The 8 x 3 LUT is continuously stored as a 1D array with the length of 5508 based on the space occupied by c0[729] (729 x 4 = 2916) and c4[648] (648 x 4 = 2592).