The clamp value for horizontal direction is calculated using the pixel values at the upper OB region.
The maximum pixel value to be used for the clamp value calculation can be limited to 1023 if the pixel value limitation is enabled (ISIF_CLHWIN0[6] CLHLMT = 1).
Clamp value calculation for horizontal direction can be disabled if there is no upper OB region. The operating modes are:
- The horizontal clamp value calculation is enabled. The calculated horizontal clamp value is subtracted from the image data along with the vertical clamp value (ISIF_CLAMPCFG[2:1] CLHMD = 0x1).
- The horizontal clamp value is not updated. The horizontal clamp value used for the previous image is subtracted from the image data along with the vertical clamp value (ISIF_CLAMPCFG[2:1] CLHMD = 0x2).
- The horizontal clamp value is not updated. Only the vertical clamp value is subtracted from the image data (ISIF_CLAMPCFG[2:1] CLHMD = 0x0).
The number of windows in a row is set with the ISIF_CLHWIN0[4:0] CLHWC bit field.
Up to 32 windows in a row can be set for clamp value calculation. All the windows have the same size in a format [2(ISIF_CLHWIN0[9:8] CLHWM+5)] pixels by [2(ISIF_CLHWIN0[13:12] CLHWN+1)] lines.
The ISIF_CLHWIN2[12:0] CLHSV and ISIF_CLHWIN1[12:0] CLHSH bit fields enable setting the position of the first optical black clamp window in the frame. The pixel and line offset are in a range 0 to 8191. The ISIF_HDW register sets the width of the HD.
Figure 9-148 shows the ISS ISP ISIF clamp value for the horizontal direction.
The clamp value for horizontal direction calculation steps is:
- Calculate the average of the pixel value in each window (ave_win0 to ave_winN).
Calculation Steps | win0 | win1 | win2 | ... | wini | wini + 1 | ... | winN |
---|
Average of the pixel value | ave_win0 | ave_win1 | ave_win2 | | ave_wini | ave_wini + 1 | | ave_winN |
- Set the average of the left-most window or the right-most window as the base value B_V:
- Subtract the base value from the average of each window. Use this value as a clamp value for each window.
Calculation Steps | win0 | ... | wini | wini+1 | ... | winN |
---|
Clamp value for each window | clamp_win0 = ave_win0 – B_V | | clamp_wini = ave_wini – B_V | clamp_wini + 1 = ave_wini + 1 – B_V | | clamp_winN = ave_winN – B_V |
- Acquire the horizontal distance (X and CLHWM – X) from the valid pixel to be processed to the center of the closest two windows.
- Calculate the clamp value of the valid pixel by linear interpolation, using the clamp value of the closest two windows (i and i + 1).
- Case 1: interpolated_clamp_winX = (clamp_wini + 1 – clamp_wini) × X / CLHWM
- Case 2: interpolated_clamp_winX = (clamp_wini – clamp_winN) × (CLHWM – X) / CLHWM + (clamp_wini + 1 – clamp_winN) × X / CLHWM
- If the valid pixel is on the left of the center of the left-most window, the clamp value of the left-most window is applied. If the valid pixel is on the right of the center of the right-most window, the clamp value of the right-most window is applied.
The clamp values calculated (A), (B), and (C) are:
- Case1: Base is win0 (Left-most window: ISIF_CLHWIN0[5] CLHWBS = 0x0)
- (A): zero
- (B): (clamp_wini + 1 – clamp_wini) × X / CLHWM
- (C): (clamp_winN – clamp_win0)
- Case2: Base is winN (Right-most window: ISIF_CLHWIN0[5] CLHWBS = 0x1)
- (A): (clamp_win0 – clamp_winN)
- (B): (clamp_wini – clamp_winN) × (CLHWM – X) / CLHWM + (clamp_wini + 1 – clamp_winN) × X / CLHWM
- (C): zero
Each interpolated value interpolated_clamp_winX is then subtracted to the associated column.