magnitude
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
normalized M11 (red), M12 (green), M22 (blu)
0
0 2 4 6
R
1
8 10 12
Figure 7 – Normalized coefficients along R1 parameter of the speckle noise reduction filter
function [out] = synth_frost3x3(inp) % inp is a vector of 9 samples
mu1=0; mu2=0;
for k = 1 : 9
mu1 = mu1 + inp(k); % first order momentum (or mean value)
mu2 = mu2 + inp(k)^2; % second order momentum
end
R1 = mu2 / (mu1^2 +1); if (tmp_R1<0) R1=0; end % since R1>=0 always
% in MATLAB array indexing goes from 1 to 1024 (not from 0 to 1023 as in HW)
if (R1 >=1024) addr=1024; elseif (R1==0) addr=1; else addr=R1+1; end
% the ILUT functions are not shown here
M11 = M11_ILUT(addr); M12 = M12_ILUT(addr); M22 = M22_ILUT(addr);
reg11 = inp(1) + inp(3) + inp(7) + inp(9); % pre-add pixels of index 11, 13,
31, 33
reg12 = inp(2) + inp(4) + inp(6) + inp(8); % pre-add pixels of index 12, 21,
23, 32
out11 = M11 * reg11; % sum of filtered pixels index 11, 13, 31, 33
out12 = M12 * reg12; % sum of filtered pixels index 12, 21, 23, 32
out22 = M22 * inp(5); % central pixel of index 22 in the 3x3 block
out = out11 + out12 + out22; % filter output pixel
In short, these examples show that interpolated lookup tables are a simple yet powerful
method for implementing DSP functions in Xilinx FPGAs. They can help you
achieve very good numerical accuracy (SNR) and high data rates while keeping area
occupation relatively low.
Acknowledgements
I would like to thank my colleague Michel Pecot, who first introduced me to the interpolated lookup
table approach with his Gamma Correction design in System Generator for DSP, when I joined Xilinx
three years ago.
Daniele Bagni is a DSP Specialist FAE in the Xilinx Milan sales office in Italy. What Daniele enjoys
most about his job is providing customers with feasibility studies and facing a large variety of DSP applications
and problems. In his spare time, he likes to play tennis. At home he loves biking or playing table
tennis with his wife and two sons.
ASK FAE-X
Third Quarter 2009 Xcell Journal 59