38.6.9.3 Image Rotation And Mirroring

Image rotation or mirroring is produced by combining pixel and line striding to read image pixels in a different order, as shown in the figure below.

Figure 38-7. Rotation and Mirroring

The Configuration tables below show how to configure registers according to image transformation. The following notations are used:

  • FPA = original image First Pixel Address
  • Xs = original image horizontal number of pixels
  • Ys = original image vertical number of pixels
  • Ps = original image Pixel size expressed in byte (see Pixel Size Values)
  • HXs = floor{(Xs+1)/2} , the rounded half of Xs
  • HYs = floor{(Ys+1)/2} , the rounded half of Ys
    Table 38-46. Pixel Size Values
    Input Mode Ps Value (in bytes)
    12BPP_RGB_444 2
    16BPP_ARGB_4444 2
    16BPP_RGBA_4444 2
    16BPP_RGB_565 2
    16BPP_ARGB_1555 2
    18BPP_RGB_666 4
    18BPP_RGB_666PACKED 3
    19BPP_ARGB_1666 4
    19BPP_ARGB_PACKED 3
    24BPP_RGB_888 4
    24BPP_RGB_888_PACKED 3
    25BPP_ARGB_1888 4
    32BPP_ARGB_8888 4
    32BPP_RGBA_8888 4
    32BPP_AYCBCR 4
    16BPP_YCBCR_MODE0 1
    16BPP_YCBCR_MODE1
    16BPP_YCBCR_MODE2
    16BPP_YCBCR_MODE3
    16BPP_YCBCR_SEMIPLANAR
    16BPP_YCBCR_PLANAR
    12BPP_YCBCR_SEMIPLANAR
    12BPP_YCBCR_PLANAR
    Table 38-47. Rotation Configuration (All Input Modes, All Overlays)
    Rotation Angle 90° 180° 270°
    FBA FPA FPA + (Xs-1)*Ps FPA + (Xs*Ys - 1)*Ps FPA + Xs*(Ys-1)*Ps
    XSIZE/XMEMSIZE Xs-1 Ys-1 Xs-1 Ys-1
    YSIZE/YMEMSIZE Ys-1 Xs-1 Ys-1 Xs-1
    XSTRIDE 0 -((Ys-1)*Xs + 2)*Ps -2*Ps Xs*(Ys-1)*Ps
    PSTRIDE 0 (Xs-1)*Ps -2*Ps -(Xs+1)*Ps

For rotation transformation in High-End Overlay with YCbCr planar and semi-planar modes, additional registers must be configured, as shown in the following tables.

Table 38-48. YCbCr 4:2:2 Semi-planar Specific Rotation Configuration
Rotation Angle 90° 180° 270°
HEOCFG1.YCC422ROT 0 1 0 1
HEOCBFBA0 FPA FPA + 2*HXs - 2 FPA + 2*HXs*Ys - 2 FPA + 2*HXs*(Ys-1)
HEOCFG7.CCXSTRIDE 0 -2*HXs*(Ys-1) - 4 -4 2*HXs*(Ys-1)
HEOCFG8.CCPSTRIDE 0 2*HXs - 2 -4 -2*HXs - 2
Table 38-49. YCbCr 4:2:2 Planar Specific Rotation Configuration
Rotation Angle 90° 180° 270°
HEOCFG1.YCC422ROT 0 1 0 1
HEOCBFBA0 FPA FPA + HXs - 1 FPA + HXs*Ys - 1 FPA + HXs*(Ys-1)
HEOCRFBA0 FPA FPA + HXs - 1 FPA + HXs*Ys - 1 FPA + HXs*(Ys-1)
HEOCFG7.CCXSTRIDE 0 -HXs*(Ys-1) - 2 -2 HXs*(Ys-1)
HEOCFG8.CCPSTRIDE 0 HXs - 1 -2 -HXs - 1
Table 38-50. YCbCr 4:2:0 Semi-planar Specific Rotation Configuration
Rotation Angle 90° 180° 270°
HEOCBFBA0 FPA FPA + 2*HXs - 2 FPA + 2*HXs*HYs - 2 FPA + 2*HXs*(HYs-1)
HEOCFG7.CCXSTRIDE 0 -2*HXs*(HYs-1) - 4 -4 2*HXs*(HYs-1)
HEOCFG8.CCPSTRIDE 0 2*HXs - 2 -4 -2*HXs - 2
Table 38-51. YCbCr 4:2:0 Planar Specific Rotation Configuration
Rotation Angle 90° 180° 270°
HEOCBFBA0 FPA FPA + HXs - 1 FPA + HXs*Ys - 1 FPA + HXs*(HYs-1)
HEOCRFBA0 FPA FPA + HXs - 1 FPA + HXs*Ys - 1 FPA + HXs*(HYs-1)
HEOCFG7.CCXSTRIDE 0 -HXs*(HYs-1) - 2 -2 HXs*(HYs-1)
HEOCFG8.CCPSTRIDE 0 HXs - 1 -2 -HXs - 1
Table 38-52. Mirroring Configuration (All Input Modes, All Overlays)
Mirroring Axis Vertical Horizontal
FBA FPA + (Xs-1)*Ps FPA + Xs*(Ys-1)*Ps
XSIZE/XMEMSIZE Xs-1 Xs-1
YSIZE/YMEMSIZE Ys-1 Ys-1
XSTRIDE 2*(Xs-1)*Ps -2*Xs*Ps
PSTRIDE -2*Ps 0

For mirroring transformation in High-End Overlay with YCbCr planar and semi-planar modes, additional registers have to be configured, as shown in the following tables.

Table 38-53. YCbCr 4:2:2 Semi-planar Specific Mirroring Configuration
Mirroring Axis Vertical Horizontal
HEOCBFBA0 FPA + 2*HXs - 2 FPA + 2*HXs*(Ys-1)
HEOCFG7.CCXSTRIDE 4*HXs - 4 -4*HXs
HEOCFG8.CCPSTRIDE -4 0
Table 38-54. YCbCr 4:2:2 Planar Specific Mirroring Configuration
Mirroring Axis Vertical Horizontal
HEOCBFBA0 FPA + HXs - 1 FPA + HXs*(Ys-1)
HEOCRFBA0 FPA + HXs - 1 FPA + HXs*(Ys-1)
HEOCFG7.CCXSTRIDE 2*HXs - 2 -2HXs
HEOCFG8.CCPSTRIDE -2 0
Table 38-55. YCbCr 4:2:0 Semi-planar Specific Mirroring Configuration
Mirroring Axis Vertical Horizontal
HEOCBFBA0 FPA + 2*HXs - 2 FPA + 2*HXs*(HYs-1)
HEOCFG7.CCXSTRIDE 4*HXs - 4 -4*HXs
HEOCFG8.CCPSTRIDE -4 0
Table 38-56. YCbCr 4:2:0 Planar Specific Mirroring Configuration
Mirroring Axis Vertical Horizontal
HEOCBFBA0 FPA + HXs - 1 FPA + HXs*(HYs-1)
HEOCRFBA0 FPA + HXs - 1 FPA + HXs*(HYs-1)
HEOCFG7.CCXSTRIDE 2*HXs - 2 -2HXs
HEOCFG8.CCPSTRIDE -2 0