In Bayer chromatic aberration mode, the red and blue image planes are warped to align with the green image. The radial back-mapping is the main utility for this, although the affine transform can also be used.
- Check and wait for the LDC_PCR[2] BUSY bit to become IDLE (0x0).
- Set the LDC_PCR[4:3] MODE bit field for Bayer (0x1).
- Set the LDC_PCR[6:5] BMODE bit field according to the Bayer format (3: 8-bit A-Law, 2: Packed 8-bit, 1: Packed 12-bit, or 0: Unpacked 12-bit).
- Set the LDC_CONFIG[5:4] INITC bit field to the initial Bayer color (3: B, 2: Gb, 1: Gr, or 0: R).
- If lens distortion correction is performed at the same time as the affine transform, set the LDC_PCR[2] LDMAPEN bit to 1. Otherwise, set the LDC_PCR[1] LDMAPEN bit to 0.
- Set the input frame base address in the LDC_RD_BASE[31:0] RBASE bit field. The frame base address must be aligned on a 16-byte boundary.
- Set the input frame line offset in the LDC_RD_OFST[15:0] ROFST bit field.
- If reading the input image from a circular buffer:
- LDC_PCR[9] CIRCEN = 1
- LDC computes the row number and applies a modulo operation. The absolute address in the buffer is computed from this wrap-around row and the column number and then data is fetched from the circular buffer. Set the circular buffer size in LDC_RD_OFST.MOD. In Bayer mode, the number of rows in the buffer is LDC_RD_OFST.MOD.
- Set the tile size in the LDC_BLOCK[15:8] OBH and LDC_BLOCK[7:0] OBW bit fields. See constraints on OBW in Table 9-2739.
- Set the pixel pad in the LDC_BLOCK[19:16] PIXPAD bit field.
- Set the input frame size in LDC_INPUT_FRAME_SIZE[29:16] H and LDC_INPUT_FRAME_SIZE[13:0] W.
- Set the output frame size in the LDC_FRAME_SIZE[29:16] H and LDC_FRAME_SIZE[13:0] W bit fields. H and W values must be multiples of OBH and OBW, respectively.
- Set the starting output point in the LDC_INITXY[13:0] INITX and LDC_INITXY[29:16] INITY bit fields.
- Set the output frame starting address in the LDC_WR_BASE[31:0] WBASE bit field. The output frame must be 16-byte aligned.
- Set the output frame line offset in the LDC_WR_OFST[15:0] WOFST bit field.
- Set the mesh offset table pointer to the correct address ( LDC_MESHTABLE_BASE[31:0] BASE and LDC_MESHTABLE_OFST[15:0] OFST). Set the table downsampling factor for MxM downsampling in LDC_MESHTABLE_CONFIG[2:0] M.
- If the LDC is connected to image buffers where the output address is not updated for each tile, set the constant mode to 0x1 in the LDC_CONFIG[7] CNST_MD bit field.
- If also using affine transform, set the six affine transform parameters in the following bit fields:
If affine transform is not used, these must be set to the following values:
- Set the LDC_PCR[0] EN bit to 1 to start the LDC operation.
- Wait for the LDC_PCR[2] BUSY bit to become IDLE (0x0) or wait for the end of frame completion interrupt.