a lowpass filter and downsampling the image (decimation part) which results in the low frequency coefficients. Based on this coarse version, the original imageΒ ...
Submitted to the 18th Iranian Conference on Electrical Engineering (ICEE)
Low Computational Complexity Hardware Implementation of Laplacian Pyramid Seyed Mohammad Ali Zeinolabedin, Nader Karimi, Shadrokh Samavi Department of Electrical and Computer Engineering Isfahan University of Technology, Isfahan, Iran.
Abstract: In this paper a new implementation of the Laplacian Pyramid (LP) algorithm is proposed which uses the polyphase representation and noble identities to facilitate a new pipeline architecture. Our approach saves a large number of mathematical operations which results in the reduction of power consumption. Furthermore, the proposed architecture decreases the number of employed resources as compared with the existing designs. The implementation results reveal the correct functionality of the proposed architecture.
Keywords: realization.
Laplacian 1.
Pyramid,
FPGA,
hardware
Introduction
Multiresolution data representation is a powerful tool in many signal processing applications. An example of such a representation is the Laplacian pyramid (LP) presented by Burt et al [1]. The LP is initially used for image coding which removes image correlation by combining features of predictive and transform methods. The LP can be summarized as the following. It produces a coarse approximation of the original signal by applying a lowpass filter and downsampling the image (decimation part) which results in the low frequency coefficients. Based on this coarse version, the original image is predicted by upsampling and filtering (interpolation part) which produces the high frequency coefficients. Then the difference is calculated as the prediction error [2]. The LP has been used in various algorithms such as compression [1, 3], SIFT (ScaleInvariant Feature Transform) [4], image fusion routines [5], and video communication [6]. The LP plays an important role in all of the mentioned algorithms. Some of these algorithms are also implemented on hardware devices [59]. Reference [12] is totally dedicated to the implementation of the LP. In [5] a method is proposed to implement the Laplacian pyramid image fusion by FPGA. The first part of that work is devoted to implement the LP. A 3 Γ 3 decimation filter is used while the interpolation filter performs the averaging function. The two previously processed rows are preserved in the FPGA and with the arrival of the third row the decimation filter starts its operation. These results are delivered to the interpolation
filter in this part two different strategies are observed. The column interleaving operation, on the even lines, is used while the row interleaving operation, on the odd lines, is applied. The specified 3tap filter in the interpolation part results in loss of generality. They realize realtime image fusion for dual channels 640Γ480 images at a rate of 25 frames per second (fps). In [6] an FPGAbased implementation is presented for a computationally complex stereo disparity algorithm. The design consists of four stages. One of them is the ScaleOrientation Decomposition (SOD) stage. In this stage a 3level decimation is performed. Each level of this pyramid is built by lowpass filtering using a 3tap FIR and decimating by a factor of two. The system outputs 8bit, subpixel disparity estimates for 256Γ360 pixel images at 30 fps. In this work only the low frequency coefficients are produced and there is no part devoted to the interpolation. In [7] the implementation of the Laplacian pyramid is considered by using a reconfigurable attached processor, called SPLASH 2. This design consists of a number of FPGAs. One of the FPGAs performs a row convolution and resamples to eliminate half of the pixels of a row. It then passes the results to a second FPGA. Then the column convolution is performed. Each of these computations requires five image pixels from five successive rows. Hence, four previous rows need to be stored and accessed simultaneously. This requires storing of image rows in a memory. Finally the image is resampled in the vertical dimension and the complete image is stored in the memory. In [8] a pipeline is proposed for the implementation of the LP. In that work the legacy implementation of the LP is converted into a pipeline by inserting buffers within the structure. In [9] an ASIC chip, called PYR, is developed to perform the standard filter and resampling operations required in the LP and the inverse pyramid transforms. The mentioned chip simultaneously constructs the decimation and interpolation parts from a 512 by 480 image with a speed of 44 fps. Image samples pass through the chip sequentially, in raster scan order. The
Page 1
PYR chip computes the filter operations on images in a pipeline fashion, as samples are transferred from one memory region to another. Resampleing is performed as samples are read from and then written into memory. In all of the mentioned papers, there are some major drawbacks. All of these designs are based on the idea that resampling should be applied after the convolution is performed and the decimation part should be before the convolution in the interpolation part. Firstly, the above mentioned strategy causes substantial redundancy in the arithmetic operations that are performed during the convolution stage. When the low frequency coefficients are extracted we see that 50% of the additions and multiplications are redundant. While we are calculating the high frequency coefficients half of the multiplications multiply a number by zero and more than 50% of the additions are adding a number with a zero. Secondly, in the interpolation part half of the FIFO's that are required, for processing of the columns, can be eliminated. Furthermore, for an π Γ π input image, half of the entries of each FIFO with the length of π are filled with zeros. Thirdly, there is a delay between the production of the last coefficient of any row and the start of the production of the coefficients of the next row. This delay π is equal to 2 for an π Γ π image. To sum up, the mentioned drawbacks cause an increase in the output delay and a waste in the allocation of the resources and power. In this paper a new solution is discussed to solve the quoted shortcomings by offering a pipeline architecture. In our implementations we have used the noble identities [10] and polyphase representation [10] to achieve results that are same as the results that other implementations of the LP produce but lack the above mentioned shortcomings. We show that when the results for one row are produced the arrival of the results of the next row is started without any latency. This is unlike the above mentioned implementations and causes a utilization of 100%. The proposed architecture eliminates a number of computational steps which can result in lower power usage. The organization of paper is as follows. In section 2 some preliminaries about the LP are discussed. Section 3 describes the proposed method, while section 4 presents the implementation results. In section 5 computational complexity of the proposed architecture is analyzed and section 6 concludes the paper. 2.
where π = 1, 2, β¦ , π‘ which shows that there is a maximum of π‘ levels. Also, πΆ0 is the input image, and r indicates the length of the h filter. The high frequency coefficients of the LP, denoted by π·π , are defined by (2) and (3) based on g filter [1]: π·π = πΆπ β π·β² π+1
, π·π‘ = πΆπ‘
π
π
π·β²π π, π = 4
π π, π π·β²π π =βπ π=βπ
C Decimation Part
h
C0
β π, π πΆπβ1 2π + π, 2π + π
Interpolation Part
2
2
g
Dβ
D
Fig. 1: The general structure of the Laplacian pyramid.
By using noble identities we could simplify multirate systems. In construction of separable filters, such as β and π of Fig. 1, noble identities can be applied to obtain polyphase representation [10]. An important advancement in the multirate signal processing is the polyphase representation. This permits great simplification and also leads to computationally efficient implementations of decimation and interpolation filters. There are two kinds of polyphase representations as are denoted by Equations (4) and (6). In these equations π»(π§) and πΊ(π§) are the ztransforms of a given filter where π and L are the decimation and Interpolation values [10]: πβ1
πΈπ π§ π π§ βπ
H z =
4
π=0 β
β ππ + π π§ βππ
πΈπ π§ =
Laplacian Pyramid
π
π =βπ π=βπ
3
where π·β²π = πΆπ‘ and π = 1, 2, β¦ , π‘. Let us assume that the image is represented by πΆ0 . This image becomes the zero level of the LP. Pyramid level 1 contains image πΆ1 , which is a lowpass filtered version of πΆ0 . Each value within level 1 is computed as a weighted average of the values in level 0 within the β filter. Each value within level 2, represented by πΆ2 , is then obtained from values within level 1 by applying the same pattern of weights. If we apply (2) once to image πΆ1 , within a π filter, we obtain π·β²1 which has the same size as the original image πΆ0 . We will use it to obtain the high frequency coefficients.
(5)
πΏβ1
π
π π§ π π§β(πΏβ1βπ)
G z = π=0
1
6
β
π πΏπ + πΏ β 1 β π π βπ
π
π π§ = πΈπβ1βπ π§ = π=ββ
πΆπ π, π =
πβπ πβπ , 2 2
π=ββ
The general structure of the LP scheme is shown in Fig. 1. The low frequency coefficients are denoted as πΆπ and are defined in (1) in which i, j signify the pixel position [1]. π
(2)
(7)
In Equations (4) and (6), πΈπ and π
π are called polyphase components which decompose filters into π and L parts. Using these equations and noble identities can facilitate the switching of the position of the
Page 2
decimator with that of its filter. The same switching phenomenon can be applied to the interpolator and its corresponding filter. In the next section more details about the LP simplification are presented. 3.
Proposed Method
In this section we go over the details of the proposed structure. With the application of polyphase representations of Equations (4) and (6), and the application of the noble identities block diagram of Fig. 2 is proposed for the implementation of the LP. Delay
hx Row2i1
2
E0(Z)
2
E1(Z)
1
hy
LFCi
E0(Z)
Z
R0(Z)
2
R0(Z)
HFC2i1
Z1 Row2i
2
E0(Z)
2
E1(Z)
Z1
R1(Z)
E1(Z)
gx
2
R1(Z)
HFC2i
gy
hx Delay
Fig. 2: Proposed structure for Laplacian Pyramid
In Fig. 2, two rows of the image, Row2i1 and Row2i π where π varies from 1 to 2 for an π Γ π image, are processed concurrently. Therefore, high frequency coefficients of the two mentioned rows (HFC2i1, HFC2i), are produced concurrently, too. In the other hand the low frequency coefficients ( πΏπΉπΆπ ) are produced by the proposed structure of Fig. 2. To reduce the number of computational steps we applied one dimensional filter rather than a two dimensional version. It leads to separable strategy of convolution in which rows are processed by βπ₯ and βπ¦ filters and the results of them are processed by ππ₯ and ππ¦ filters. We decompose π» and πΊ , for the LP, with Equations (4) and (6), given that both π and πΏ are taken equal to 2 by which πΈ0 , πΈ1 , π
0 and π
1 are produced. To start a valid convolution, from each row of the image two pixels are needed. Afterwards, results from the horizontal convolution are produced consecutively. In Fig. 2 βπ₯ , shown by a dotted rectangle, sequentially calculates the horizontal convolution. For the vertical convolution we should analyze the evenindexed results by πΈ0 and the oddindexed results by πΈ1 . Then the results are added together to produce the low frequency coefficients of the input image which is shown in Fig. 1 simultaneously convolved by π
0 and π
1 and then the results are interleaved. The interleaved results are the outcome of the horizontal convolution in the interpolation stage of the LP. These results are processed again by π
0 and π
1 but there is no interleaving of the outcomes and the outputs of the two filters are the high frequency responses. In the proposed method, two pixels of two adjacent rows are processed simultaneously and therefore two similar hardware units for the row convolution (βπ₯ ) are used in the decimation part. The results from the row convolutions are combined in the column convolution (βπ¦ ) in the decimation part. This policy, in contrast to
the traditional designs, produces the output without any timelapse and the low and high frequency coefficients are generated consecutively. In Fig. 2 the "Delay" block denotes that synchronization is required between the input pixels and the output of the interpolation part. These Delay blocks are realized by very short FIFOs that deliver the pixels to the subtraction unit at the correct time. It is also worth mentioning that in Fig. 2 considering two inputs form two rows is a kind of decimation and hence, rowdecimation is implicitly performed. The pipeline implementation of the proposed method is shown in Fig. 3. In stage 1 two consecutive pixels of a row are stored in block 1 and both of them are sent simultaneously to the next stage of the pipeline. Same thing happens for the pixels of the other row. This requires two separate clocks for this hardware where arrival of the pixels are controlled by a clock (clk1) and the dispatch of the two pixels are triggered by a second clock (clk2) with half the frequency of clk1. In stage2 horizontal convolution is performed. In stage3 sufficient number of data, produced in previous stages, is stored by FIFOs. In stage4 the vertical convolution is applied and the low frequency coefficients are calculated. These stages belong to the decimation part of the LP. In stage5 the horizontal convolution is done and sufficient number of data, which is needed to performing the vertical convolution, is stored in FIFOs of stage6. Finally the vertical convolution is being done in stage7 and the high frequency coefficients of two adjacent rows are simultaneously produced. 4.
Implementation Results
For implementing the LP algorithm, we used the 9/7 filter that is introduced in [11] and some standard images for evaluation of proposed method. All of the arithmetic operations are done in fixedpoint mode; therefore, we quantized our results in three different places. The quantization was applied to the input data, coefficients of the filters, and the results of the arithmetic operations. Input data are constrained to 8 bits but for the filter coefficients, the selection of sufficient number of bits is more complicated. Two important parameters should be considered. Firstly, the frequency response of the quantized filter should be preserved. Hence, the sensitivity function [12] can be used to evaluate the effects of the quantization. Secondly, the quality of the outputs should be acceptable. For this reason, we start with the quantization of the filter coefficients of the decimation part and keep the rest of the stages in an ideal form. Under these circumstances we use MSE, as shown in Fig. 4, to test the quantization of the low frequency coefficients. Then the proper number of bits for a desired MSE can be figured out. After the quantization of the decimation coefficients, we can go to the interpolation part. MSE for the high frequency coefficients and PSNR between ideal and quantized reconstructed images are shown respectively in Figs. 5 and 6 for various amount of
Page 3
Decimation Part Stage1
Stage2
Interpolation Part
Stage3
Stage4
Stage5
Stage6
Stage7
LFCi
E0
R0
E0
FIFO

HFC2i1

HFC2i
R0
+
1
Row2i1
FIFO
E1
+
Mux
FIFO
E0 2
Row2i
+
FIFO
E0
R1
E1
Control Unit1
R1
Control Unit2
Clk2
Clk1
Fig. 3: Implemented architecture of the proposed method.
quantizations. The required number of bits that produce best MSE and PSNR can be figured out. It is evident in Fig. 4, that for a number of bits that exceed 6, MSE of low frequency coefficients are lower than 10 and we hence choose 8bit quantization. To achieve more precise selection for number of the required bits we go through the interpolation part. Based on Fig. 5, it is clear that for 8 bits MSE of the high frequency coefficients is less than 5. Therefore, we select 8 bits for the interpolation part. For this case, if we were to choose 6 bits, MSE would be greater than 10. As a result, by selecting 8 bits, where 1 bit is for the sign, for all of the filters, resulted PSNR is higher than 40 dB. In table I, some of the standard images are evaluated. In Fig. 7, the 8bit and 6bit quantization effect on the frequency response of 9 filter is shown. It shows that 8bit quantized 9 filter approximately satisfies the ideal frequency response. Hardware realization of πΈ0 , πΈ1 , π
0 and π
1 blocks are in direct form [13]. Since β and π are linear phase filters, the reduced direct form is applicable which leads to lower number of multipliers.
Fig. 4: Fixedpoint analysis for the E0 and E1 filters coefficients.
TABLE I : MSE of low frequency coefficients (LFC), high frequency coefficients (HFC) and PSNR of the reconstructed images
Image Cameraman Barbara Lena Baboon
MSE(LFC) 6.4354 6.4063 6.2835 6.4563
MSE(HFC) 3.2741 2.7167 2.1329 2.4270
PSNR(R) 40.5050 40.9748 44.8239 40.7610
Fig. 5: MSE analysis for the R0 and R1 filters coefficients.
Another point that should be considered in quantization is that each FIFO requires large resources. The strategy of finding the proper number of bits helps the reduction of the number of bits that are needed in FIFOs. By considering the 8 bits for '97' filter, we reach the width of 10 and 12 for the FIFOs in Fig. 3. Fig. 6: PSNR analysis for the R0 and R1 filters coefficients.
Page 4
Fig 7. Quantization effects on 9 filter frequency response
The results of the interpolation part should be subtracted from the pixels of the input image. For this purpose we need to know the delay between the arrival of the first pixel and the production of the first output to synchronize them as the inputs of a subtractor. The mentioned delay is equal to 10 clock cycles. Therefore, FIFOs of length 10 are deployed for this purpose in stage 6 of the pipeline. We implement this design on a EP3C120F780I7 chip from the Cyclone III family, manufactured by Altera. This FPGA is a costoptimized, memoryrich chip. The implementation results are gathered in Table II. We see that there is a total of 61477 logic elements are consumed that is about 51.6% of the resources. The logic cells that are devoted to FIFOs are 46972 which is about 77% of the total involved logic cells. Fig. 8. shows the floorplan of the chip. The blocks that are numbered belong to FIFOs. Blocks that are numbered as 1 are related to FIFOs in the decimation part, and the ones indicated by 2 are related to FIFOs in the interpolation part. About 0.3% of the used logic cells are in the control units. This indicates that the design is straight forward. The maximum frequency that is applicable is 1GHZ. It is critical that if anyone desires to perform the LP in a πΓπ hierarchical method, one memory module is needed 4 and therefore read and write delays of the memory should also be considered. TABLE II: Results of implementation
Part # of LC % of LC
πΈ0 , πΈ1 π
0 , π
1
FIFO
Control unit1
Control unit2
Others
14259
46972
94
110
42
11.97
39.44
0.07
0.09
0.03
Our design is not platform dependent. But we tried to use the specific capabilities of this chip to further improve the performance of the implementation. Implementation results lead us to this fact that a vast area of chip is devoted to FIFOs which is about 77%. This value shows that making any kind of memory devices consumes many useful building blocks that are logic elements. By using this chip, it is possible to use a memoryrich capability to decrease the misuse of logic cells. This family of FPGAs contains memory blocks that are called M9K, which provide up to a total of 3.98 M bits of RAM at a maximum 0f 315 MHZ for synchronous operation [14]. In this chip there are 432 of such memory blocks and each block has 9216 bits. A simple calculation shows that with this amount of memory blocks we could implement all of the FIFOs and also make one 256*256 memory for applying the hierarchical LP. Hence, we need only 119 M9k blocks. This means that 32% of the memory blocks are consumed and the total frequency of the design using the memory blocks is 315MHZ. Other improvements are possible by choosing a different multiplier from possible options of this chip. There are 288 embedded multiplier blocks available that have high speed interfaces to external memory [14]. If memory blocks are exploited then the allocated logic cells will be 12.16% of the total logic elements while previous design required 51.6% of the resources. Considering a clock frequency of 300 MHZ, it will take 0.44msec to analyze a single 512x512 image. 5.
Computational Complexity Analysis
For an π Γ π input image, the decimation filter size is πΎ Γ 1 and the interpolation filter size is π Γ 1. we could calculate the number of required additions and multiplications throughout the whole process. Using separable filters the aggregated total reduction of the arithmetic operations (addition, multiplication) is in 4πΎβ1 the order of 2πΎ 2 β1. For example if πΎ = 9 the mentioned reduction is about 20%. On the other hand, in our method the numbers of additions and multiplications in the 3 3 decimation part are respectively 4 π 2 (πΎ β 1) and 4 πΎπ 2 . While the numbers of additions and multiplications in decimation part in the traditional method are 3 2 3 π (πΎ β 1) and 2 πΎπ 2 . These values reveal that half of 2 the arithmetic operations are redundant. The numbers of additions and multiplications in the 3 3 interpolation part are π 2 (π β 2) and ππ 2 while the 4 4 corresponding values in the traditional method are 3 2 3 π π β 2 and 2 ππ 2 . This means that the percentage 2 of the redundant additions and multiplications is π Γ 100%. For example if π = 7 the ratio of the 2(πβ1) redundant multiplications is about 58%. Further results using the same justifications are presented in Table III. These values ascertain the mentioned reductions in the number of the arithmetic operations.
Page 5
In the proposed method, we need 3πΎ + 2π β 5 adders, 3(πΎ+π) + 3 number of multipliers. Also πΎ β 1 number of 2 π
πβ1
FIFOs of the length of 2 and 2 FIFOs with the length of π are required. The main employed assets for the pipeline implementation are the registers and FIFOs. An important consideration is the number of elements. Convolving the πβ1 input data by βπ₯ and ππ₯ requires πΎ β 1 and registers. 2 Also convolving the output of the horizontal analysis requires storage in a FIFO to calculate the results. This πβ1 imply that πΎ β 1 and FIFOs are required for this 2 purpose. In the traditional method the same number of registers and FIFOs are required in the decimation part but twice the registers and FIFOs are required in the interpolation part. This shows a 50% improvement in the interpolation part. The whole process requires some clock pulses to finish the analysis of an π Γ π image.
6.
π2
References
2
[1] P. J. Burt and E. H. Adelson, βThe Laplacian pyramid as a compact image code,β IEEE Trans. Commun., vol. COM31, pp. 532β540, Apr.1983. [2]
TABLE III :
Interpolation
Decimation
Comparison of Number of + and β in decimation and interpolation parts
Operation
Traditional Method
Addition
1.5 Γ π 2 (πΎ β 1)
Multiplication
Addition
Multiplication
2
1.5 Γ π πΎ 1.5 Γ π 2 (π β 1)
1.5 Γ π 2 π
Proposed Method 0.75 Γ π 2 (πΎ β 1)
Conclusion
In this paper, we have presented a new approach to the hardware implementation of the Laplacian Pyramid. The presented architecture utilizes the hardware more efficiently by reducing the number of arithmetic operations in comparison to the methods of previous papers [59]. This architecture also reduces the number of logic blocks such as FIFOs and registers. The outputs are produce with no latency, i.e. the output from the second row of the image arrives right after the first row is finished. If the ASIC implementation of the circuit is realized then the 50% reduction in the number of the arithmetic operations is translated into substantial reduction of the chip area and reduction of the power consumption of the chip.
M. N. Do and M. Vetterli, βFraming Pyramids,β IEEE Transaction on Signal Processing, VOL. 51, NO. 9, SEPTEMBER 2003.
[3] D. Tzovaras, M.G. Strintzis, βOptimal construction of reduced pyramids for lossless and progressive image codingβ, IEEE Transactions on Circuits and Systems II: Analog and Digital Signal Processing, Vol. 47., pp. 332348, 2000.
0.75 Γ π πΎ
[4] D. J. Lowe, "Distinctive Image Features from ScaleInvariant Keypoints," International Journal of Computer Vision 60 (2): 91β 110.
0.75 Γ π 2 (π β 2)
[5] Y. Song, K. Gao, G. Ni, R. Lu, " Implementation of realtime Laplacian pyramid image fusion processing based on FPGA," Proc. Of SPIE Vol. 6833, 683316, 2007.
0.75 Γ π 2 π
[6] A. Darabiha, W. J. MacLean, J. Rose, "Reconfigurable hardware implementation of a phasecorrelation stereo algorithm," Machine Vision and Applications, 7 March 2006.
2
[7] A. L. Abbott, P. M. Athanas, L. Chen, R. L. Elliott, "Finding Lines and Building Pyramids with Splash2," in IEEE Proc. 1994 FPGAs for Custom Computing Machines, pp. 155163. [8] P. J. Burt, "Multiresolution Pyramid Architectutres for RealTime Motion Analysis," IAPR Workshop on Machine Vision Applications Nov. 2830,1990. [9] G. S. V. D. Wal, P. J. Burt, "A VLSI Pyramid Chip for Multiresolution Image Analysis," international Journal of computer vision,177189, 1992. [10] P. P. Vaidyanathan. Multirate Systems and Filter Banks. PrenticeHall,Englewood Cliffs, NJ, 1993. [11] M. Antonini, M. Barlaud, P. Mathieu, and I. Daubechies, βImage coding using wavelet transform,β IEEE Trans. Image Processing, vol. 1, pp. 205β220, Apr. 1992. [12] X. Hu, L. S. Debrunner, V. Debrunner, βAn efficient design for FIR filters with variable Precision,β in IEEE International Symposium on Circuits and Systems, Volume 4, 2629 May 2002. [13] S. K. Mitra. Digital Signal Processing: A ComputerBased Approach New York, McGrawHill, 2001.
Fig. 8: Floor plan of implemented method and area that is occupied by FIFOs
[14] Cyclone III Device handbook, October 2008. Available: http://www.altera.com.
Page 6