Video and Vision Processing Suite Intel® FPGA IP User Guide

ID 683329
Date 8/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

10.3. Chroma Resampler IP Functional Description

Chroma resampler algorithms

The chroma resampler implements four basic resampling operations:

  • Horizontal upsampling: 4:2:2 -> 4:4:4
  • Horizontal downsampling: 4:4:4 -> 4:2:2
  • Vertical upsampling: 4:2:0 -> 4:2:2
  • Vertical downsampling: 4:2:2 -> 4:2:0

For conversions between 4:4:4 and 4:2:0 the relevant horizontal and vertical sampling operations chain automatically to achieve the correct end result. The chroma resampler supports three different algorithms for each resampling operation; nearest neighbor, bilinear and filtered. The three algorithms vary in the level of visual quality provided, the chroma siting, and the resources for implementation.

Nearest Neighbor

Nearest neighbor is the lowest quality resampling algorithm, with the lowest device resource usage. For horizontal downsampling (4:4:4 -> 4:2:2) it drops every other Cb and Cr sample within the video line. For horizontal upsampling (4:2:2 -> 4:4:4) it repeats each Cb and Cr sample. The nearest neighbor algorithm uses left siting (co-siting) for the 4:2:2 chroma samples – both the Cb and Cr samples from the even indexed Y samples are retained during downsampling.

Figure 18. Nearest Neighbor

The nearest neighbor algorithm works in the same way for vertical resampling. For vertical downsampling (4:2:2 -> 4:2:0) the IP discards the chroma data from every other video line. For upsampling (4:2:0 -> 4:2:2) the IP repeats the chroma data for two lines of luma data. The nearest neighbor algorithm uses top siting (cositing) for both the Cb and Cr planes. The IP preserves chroma data from lines 0, 2, 4, etc in downsampling. The IP discards the data from lines 1, 3, 5, etc.

Figure 19. Nearest Neighbor
Bilinear

The bilinear algorithm offers a midpoint between visual image quality and device resource cost. The figure and equations show how the IP calculates the bilinear resampled chroma for horizontal upsampling (4:2:4 -> 4:4:4) and downsampling (4:4:4 -> 4:2:2). The bilinear algorithm uses center chroma siting for both the Cb and Cr samples in 4:2:2 format.

Figure 20. Bilinear

The bilinear algorithm works in the same way for vertical upsampling (4:2:0 -> 4:2:2) and downsampling (4:2:2 -> 4:2:0), using center siting for the chroma samples just as with the horizontal resampling.

Filtered

The filtered algorithm is the most computationally expensive and device resource intense algorithm, but it offers increased visual quality. You can parameterize the filtered algorithm to use either left or center horizontal siting of the chroma data, and top or center vertical siting of the chroma data.

For downsampling conversions (4:2:2 -> 4:2:0 and 4:4:4 -> 4:2:2) the filtered algorithm applies an 8-tap Lanczos2 resampling filter to generate the downsampled data. The IP applies different phase shifts to the Lanczos2 function when generating the coefficients. It depends on the siting and whether the pixel index is even or odd. For top and left chroma siting, the IP applies phase shifts of 0 and 0.5 pixels to the Lanczos2 coefficients for the even and odd indexed chroma samples respectively. For center chroma siting the phases shifts are -0.25 and +0.25 pixels.

For upsampling conversions (4:2:0 -> 4:2:2 and 4:2:2 -> 4:4:4) the filtered algorithm applies a 4-tap Lanczos2 resampling filter to generate the upsampled data. For top/left chroma siting, phase shifts of 0 and 0.5 pixels are applied to the Lanczos2 coefficients for the even and odd indexed chroma samples respectively. For center chroma siting the phases shifts are -0.25 and +0.25 pixels.

You can also turn on luma adaption for upsampling conversions. This feature further increases device resource usage but may reduce color bleed around edges when compared to the default filtered algorithm. The feature is the only chroma resampler to implement some logic in DSP blocks. When you turn on luma adaption, the IP compares differences between successive luma samples to an edge threshold to detect significant edges. In areas where the IP detects edges, you can shift the phase of the Lanczos-2 filter by up to 0.25 pixels to the left or right. This shift weights the resulting chroma samples more intensely towards the more appropriate side of the edge.

Color planes per pixel

Most Video and Vision Processing IPs allow you to select the number of color planes per pixel, but the chroma resampler does not have that parameter and sets the value automatically. The number of color planes per pixel is a function of the chroma resampling conversions that you select, which determine the chroma sampling formats that are supported at the input and output interfaces. 4:4:4 and 4:2:0 chroma samplings both require three color panes per pixel. 4:2:2 only requires 2 color planes. 4:2:2 can be transmitted through a link with 3 color planes, with the planes in the most significant bits of each pixel unused.

If you select any of the following chroma sampling conversions, the input interface uses three color planes per pixel, otherwise it uses two color planes:

  • 4:2:0 passthrough
  • 4:2:0 to 4:4:4
  • 4:2:0 to 4:2:2
  • 4:4:4 passthrough
  • 4:4:4 to 4:2:2
  • 4:4:4 to 4:2:0

If you select any of the following chroma sampling conversions, the output interface uses three color planes per pixel, otherwise it uses two color planes:

  • 4:2:0 passthrough
  • 4:2:0 to 4:4:4
  • 4:4:4 passthrough
  • 4:4:4 to 4:2:0
  • 4:2:2 to 4:4:4
  • 4:2:2 to 4:2:0