5x5Filter - 2020.2 English

Vivado Design Suite Reference Guide: Model-Based DSP Design Using System Generator (UG958)

Document ID
UG958
Release Date
2020-11-18
Version
2020.2 English

The Xilinx 5x5 Filter reference block is implemented using 5 n-tap MAC FIR Filters. The filters can be found in the Imaging library of the Xilinx Reference Blockset.

Nine different 2-D filters have been provided to filter grayscale images. The filter can be selected by changing the mask parameter on the 5x5 Filter block. The 2-D filter coefficients are stored in a block RAM, and the model makes no specific optimizations for these coefficients. You can substitute your own coefficients and scale factor by modifying the mask of the 5x5 filter block, under the Initialization tab.

The coefficients used are shown below for the 9 filters. The output of the filter is multiplied by the scale factor named <filter name>Div.


edge = [ 0  0  0  0 0; ... 
0 -1 -1 -1 0; ... 
0 -1 -1 -1 0; ... 
0  0  0  0 0]; 
edgeDiv = 1; 

sobelX = [ 0  0  0  0 0; ... 
0 -1  0  1 0; ... 
0 -2  0  2 0; ... 
0 -1  0  1 0; ... 
0  0  0  0 0]; 
sobelXDiv = 1; 

sobelY = [ 0  0  0  0 0; ... 
0  1  2  1 0; ... 
0  0  0  0 0; ... 
0 -1 -2 -1 0; ... 
0  0  0  0 0]; 
sobelYDiv = 1; 

  

sobelXY = [ 0  0  0  0 0; ... 
0  0 -1 -1 0; ... 
0  1  0 -1 0; ... 
0  1  1  0 0; ... 
0  0  0  0 0]; 
sobelXYDiv = 1; 

blur = [ 1  1  1  1 1; ... 
1  0  0  0 1; ... 
1  0  0  0 1; ... 
1  0  0  0 1; ... 
1  1  1  1 1]; 
blurDiv = 1/16; 

smooth = [ 1  1  1  1 1; ... 
1  5  5  5 1; ... 
1  5 44  5 1; ... 
1  5  5  5 1; ... 
1  1  1  1 1]; 
smoothDiv = 1/100; 

sharpen = [ 0  0  0  0 0; ... 
0 -2 -2 -2 0; ... 
0 -2 32 -2 0; ... 
0 -2 -2 -2 0; ... 
0  0  0  0 0]; 
sharpenDiv = 1/16; 

gaussian = [1 1 2 1 1; ... 
1 2 4 2 1; ... 
2 4 8 4 2; ... 
1 2 4 2 1; ... 
1 1 2 1 1]; 
gaussianDiv = 1/52; 

identity = [ 0  0  0  0 0; ... 
0  0  0  0 0; ... 
0  0  1  0 0; ... 
0  0  0  0 0; ... 
0  0  0  0 0]; 
identityDiv = 1; 

The underlying 5-tap MAC FIR filters are clocked 5 times faster than the input rate. Therefore the throughput of the design is 213 MHz / 5 = 42.6 million pixels/ second. For a 64x64 image, this is 42.6x10^6/(64x64) = 10,400 frames/sec. For a 256x256 image the throughput would be 650 frames /sec, and for a 512x512 image it would be 162 frames/sec.

Block Parameters

The block parameters dialog box can be invoked by double-clicking the icon in your Simulink model.

Parameters specific to this reference block are as follows:

  • 5x5 Mask: The coefficients for an Edge, Sobel X, Sobel Y, Sobel X-Y, Blur, Smooth, Sharpen, Gaussian, or Identity filter can be selected.
  • Sample Period: The sample period at which the input signal runs at is required