SPRUIE9D May 2017 – May 2024 DRA74P , DRA75P , DRA76P , DRA77P
The LDC processes a block of LDC_BLOCK[7:0] OBW x LDC_BLOCK[15:8] OBH (output block width by output block height) pixels at a time in a raster-scan order throughout the image. OBW is constrained to be a multiple of a base width, depending on the operating mode. This is described in Table 9-2739. OBH should be even. The LDC uses four corners of the output block plus some padding to fetch the input block. Software must supply OBW, OBH, and LDC_BLOCK[19:16] PIXPAD, the amount of padding in input pixels. Software must guarantee that, for EVERY output pixel in the OBW x OBH output block, the input pixels required are bounded by back mapping of the four corners plus/minus the padding. More precisely, the input block is determined by:
where corner1, corner2, corner3, and corner4 are upper-left, upper-right, lower-left, and lower-right corners of the OBW x OBH output block, and distortx(.), distorty(.) are X and Y distorted coordinates of the corners. Distorted coordinates computed by the back-mapping process described in Section 9.4.5.3.4, ISS SIMCOP Lens Distortion Back-Mapping. Figure 9-215 shows the input block bound calculation. Table 9-2739 lists the OBW requirements.
Data Format | OBW must be a multiple of |
---|---|
YCbCr4:2:2 | 8 |
YCbCr4:2:0 | 16 |
Bayer unpack | 8 |
Bayer 8-bit | 16 |
Bayer A-Law | 16 |
Bayer 12-bit | 32 |
Typically for geometric distortion, the LDC_BLOCK[19:16] PIXPAD bit field must be 4 to accommodate neighbor sets for all colors. Chromatic aberration, where the back-mapping depends on the color of output pixel, incurs additional levels in PIXPAD. For example, to correct 3 pixels of chromatic aberration, specify PIXPAD = 4 + 3 = 7. Software must set the PIXPAD bit field correctly.
A tool is available to calculate PIXPAD for a given frame size and distortion mapping. Another utility is provided with the functional C model that computes the minimum PixelPad given a configuration and the processing block size: OBW, OBHT. To obtain these tools, contact your TI representative.
OBH and OBW must be large enough for efficient operation of the lens distortion operation. As shown in Table 9-2739, OBW is constrained to ensure efficient external memory write. Another constraint is that input block size, (IBX_end – IBX_start + 1) x (IBY_end - IBY_start + 1), for EVERY input block of the image, must fit the allocated input buffer. These parameters must not be specified pessimistically (OBH, OBW too small, or PixelPad too large). Pessimistic parameter setting degrades performance and incurs unnecessary external memory transfer.
The LDC can process a portion of the image, rather than the entire image. This saves time by letting an image process through multiple software/LDC interactions to correct only a portion of the image.
An intermediate interrupt can occur after processing each macroblock. This lets the LDC operation be pipelined with other tasks.
To process only a portion of the image, the following parameters are required:
LDC_FRAME_SIZE[13:0] W must be a multiple of LDC_BLOCK[7:0] OBW, LDC_FRAME_SIZE[29:16] H a multiple of LDC_BLOCK[15:8] OBH, and LDC_WR_BASE[31:0] WBASE a multiple of 32 (byte address)
Figure 9-216 is an example of multiple-pass processing with middle-of-the-image skipped.
The LDC does not copy skipped blocks from the input frame to the output frame (necessary task unless output frame = input frame); software must set up and initiate this memory copy.
A note on in-place operation to conserve external memory: Depending on the offset table and configuration parameters, it may not be feasible to point the output image at the input image and have corrected pixels overwriting the source image. Software must determine whether it is feasible to overwrite, and allocate a separate frame buffer when it is not feasible. The LDC does not care if the input and output image pointers coincide, nor does it check any dependency violations.
The starting address of the input frame, corresponding to input coordinate (0, 0), is specified in the LDC_RD_BASE[31:0] RBASE bit field and offset in the LDC_RD_OFST[15:0] ROFST bit field ((Y and Cb/Cr base required for YCbCr4:2:0: LDC_420C_RD_BASE[31:0] RBASE)). The LDC does not check whether any of the input block falls outside the input frame. Software must pad the input frame with zeros or borders, if an input block falls outside the input frame, so that there is no adverse effect in the corrected image.