38.6.13.4 Input/Output Pixel Alignment
Depending on application requirements, output pixel alignment according to input pixels can be tuned for the horizontal and vertical scaler. This tuning modifies the position of the output image within the range of the filter length. Two different types of configuration fields are used, Filter Taps Shift and Filter Init Phase Offset. Each of them produces a filter spatial response shift as described below.
Filter Taps Shift determines which set of input pixels is used at filter input to process a given output pixel. The following equation shows how the output pixel is calculated through the filter:
With :
- Pin—input pixel component value (any A, R, G or B in ARGB mode, and A, Y, Cb or Cr in YCbCr mode)
- N—the filter number of taps (N=16)
- Tshift—Filter taps shift
- h(k, p)—Filter taps value depending on tap number k, and phase index p
- Pout—output pixel component value (A, R, G or B in ARGB mode, and A, Y, Cb or Cr in YCbCr mode)
The output image is shifted by the value Tshift/FACT. Figure 38-12 and Figure 38-13 illustrate an upsampling by 4 use case (FACT=0.25x220):
Filter taps shift Tshift is controlled by LCDC_HEOCFG30.HXSYCFG and LCDC_HEOCFG30.VXSCCFG for the horizontal scaler, and LCDC_HEOCFG30.VXSYCFG and LCDC_HEOCFG30.VXSCCFG for the vertical scaler.
LCDC_HEOCFG30.VXSYCFG1 and LCDC_HEOCFG30.VXSCCFG1 should also be considered in case of interlaced content.
During the resampling process, a filter tap phase is selected for each output pixel, representing the fractional part of the output pixel spatial position, according to the input pixel width. An input pixel width is subsampled in 16 phases values, each corresponding to a subset of filter taps p. Phase 0 corresponds to 0 fractional shift. Incrementing the phase index by 1 corresponds to a spatial shift of 1/16 pixel width.
The figure below illustrates an upsampling by 4 use case (4 output pixels for one input pixel), with a fixed Tshift value.
An additional phase offset can be configured in HEO_CFG28 and HEO_CFG29 and adds a fractional shift to all pixels of the frame. This is illustrated in the figure below for the use case when upsizing by 4.
The initial phase offset is controlled by LCDC_HEOCFG29.HXSCOFF and LCDC_HEOCFG29.HXSYOFF for the horizontal scaler, and LCDC_HEOCFG28.VXSYOFF and LCDC_HEOCFG28.VXSCOFF for the vertical scaler.
LCDC_HEOCFG28.VXSYOFF1 and LCDC_HEOCFG28.VXSCOFF1 should also be considered in case of interlaced content.