3.1.8.2 Padding the Red, Green, and Blue Color Planes

When subsampling of color planes is required, the planes MUST be padded. Padding ensures proper alignment of the image geometry and can aid significantly in the implementation of subsequent encoding algorithms.

  1. The size of a padded plane is calculated as follows (input to the calculation is the plane width and height).

     PaddedPlaneWidth = ROUND_UP_TO_NEAREST_MULTIPLE_OF_8(PlaneWidth)
     PaddedPlaneHeight = ROUND_UP_TO_NEAREST_MULTIPLE_OF_2(PlaneHeight)
    

    For example, if the original image width is 500, the padded plane width is 504. If the original image height is 200, the padded plane height is 200.

  2. Color space conversion, subsampling, and color loss reduction of the padded color planes are implemented as follows.

    Subsequent transformations applied to the color planes MUST be implemented as described in [MS-RDPEGDI] sections 3.1.9.1.2 through 3.1.9.1.4 and applied to the pixel values within the original image area.

    The pixel values contained in the padded area can have any value (depending on the implementation) and can be configured so as to maximize the run-length compression and minimize the overall compression/decompression algorithm execution time.

    The following figure demonstrates how 3x3 and 4x3 planes are padded to produce an 8x4 plane.

Examples of color plane padding

Figure 4: Examples of color plane padding