DESIGN OF 2-DMULTIPLIERLESSFILTERS USING THE GENETIC ALGORITHM R. Thamvichai Tarnal Bose & Randy L. Haupt Electrical & Computer Engineering University of Colorado Boulder, GO 80309 Electrical & Computer Engineering Utah State University Logan, UT 84322-4120 and PSV systems are given in Section 2. In Section 3, a design procedure based on the genetic algorithm is presented. A stability test is also incorporated to ensure that the designed filter is stable. An example is presented in Section 4, which is followed by the conclusion. ABSTRACT When digital filters are designed with power-of-two coefficients, the multiplications can be implemented by simple shifting operations. In this paper, the genetic algorithm (GA) is used to design 2-D multiplierless filters. The 2D filter is designed to have periodically shift variant (PSV) coefficients. This increases the degress of freedom for the multiplierless coefficients so that a better approximation can be achieved. The design involves finding the impulse response of the 2-D PSV filter in closed form and then using the GA to find the filter coefficients. Two different types of GA are used, namely, the Binary-GA and the Integer-GA. Some design examples are presented to illustrate the concepts. 2. SYSTEM DESCRIPTION Consider a causal, recursive and separable denominator 2D digital filter represented by the first model of FomasiniMarchesini [7] given by z (h - A l A z ~ ( hk)+Bu(h, , k) y ( h ,k ) = C z ( h 1,k 1) 1. INTRODUCTION + During the past decade, multiplierless digital filters have received widespread attention in the literature because of their high computational speed and low cost implementation. In the one-dimensional (I-D) case, various techniques have been proposed for designing multiplierless filters. Several design methods for multiplierless filters have also been developed for two-dimensional (2-D) filters [I] -[5]. In [l] and [2], 2-D state-space filters were designed using a genetic algorithm (GA) that optimized coefficients that were a sum of power of two elements. These coefficients do not need any multipliers but require shifiers and adders. In this paper, we present a genetic algorithm for designing 2-D separable denominator filters with single powerof-two coefficients. Thus, these coefficients can be implemented using simple shifting operations and no adders. The filters are designed directly in the state-space domain. We design both linear shift-invariant (LSIV) and periodically shift variant filters (PSV). T h e shift variant filters provide more degrees of freedom in approximating a given impulse response without increasing the filter order. The paper is organized as follows. The system descriptions for both LSIV + (1) where z(h,k) E RLxl is a state vector, u(h,k), y(h, k ) E RIX1are the input and output respectively, A1,A2 E R L x are constant real state matrices, BE R L x l ,and C E R I x L are constant vectors. The impulse response h(n1,nz) of this LSIV system is well known [SI and given by where u(n1,n2) is the 2-D unit step function. In [5], we proposed the design of 2-D multiplierless filters using the system of Fig. l. It consists of a Hold (which increases the signal rate by a factor of (P,l) ), a periodicallyshift varying (PSV) system, and a decimator (which decreases the signal rate by a factor of (P,l)) connected in cascade. The use of periodic filters increases the total number of coefficients, thereby providing the necessary degrees of freedom for obtaining power-of-two coefficients. The PSV system is simply the LSIV system of (I), with periodic coefficients, given by This work was supported in part by Raytheon and NASA Contract #NAGS3991 0-7 803-7 147-X/01/$10.0002001 IEEE + 1,k + 1)= A l ~ ( hk ,+ 1 ) + A 2 ~ (+h 1, k ) 588 The genetic algorithm begins by defining a chromosome or an array of parameter values to be optimized. In this case, the parameter values are all the elements of matrices Al(h,k) and A2, and vectors B(h,k) and C. We use two different types of GA, namely, the Binary-GA and the IntegerGA. For the Binary-GA, each coefficient is encoded to using B bits. The left most bit is the sign bit and the other B-1 bits Fig. 1. PSV system. represent the power of two. For example, consider the set S7 = ...,*1}, where 4 bits can beemployed to represent each element in the set. For instance, let any coefficient be represented by 4 bits, z =[a0 a1 a2 a3]. Then 2 ai+12('-~). x = ( ( - l ) a o ) x 2 - P where p = i=O For simplicity, we let Az(h,k) be a constant matrix A2, C(h,k) be a constant vector C, Al(h,k) and B(h,k) be periodic (P,l), i.e. Al(h+mP,k+n) = Al(h,k)andB(h+mP,k+n) = B(h,k ) for all integers (m,n). With the system and equations above, the impulse response of the LSIV-equivalent system can be obtained [5] as I For the integer GA, the coefficients are represented simply by an integer which represents the power-of-two coefficient. For example, consider the set S7 = {f2-7, f F ,...,fl,0). This represents a set of 17 integers accounting for the sign. One way to code the power-of-two coefficients is (-2-7, -2-6, ..., -20,0,20, ...,2-6,2-7} = {0,1, ...,7,8,9, ..., 15,16}. The chromosome is an array of binary (or integer) codes of all coefficients concatenated together. Each chromosome is associated with a cost value found by evaluating the fitness measure (or cost fhction) as C A T B(O,O), for nl= 0, n2 2 0 where Npop is the population size and m =I, ...,Npop. 3.1. Design Procedure The impulse responses in (4) and (2) will be useful in calculating the fitness measures (or cost functions) in the next section. The design procedure using the GA is shown in Fig 2. Step 0 (Initial population): Generate 2*NpOpchromosomes randomly, and rank the costs defined in (6) for all the chromosomes from lowest cost to highest cost. The cost evaluation is described in step 1. Only the best Npopchromosomes are kept for each iteration, while the others are discarded. 3. GA-BASED DESIGN PROCEDURE The design involves finding the elements of the matrices { Al(h,k),A2,B(h,k),C} which minimize the cost function Step 1 (Stability test and evaluation): Test the stability (described in the next subsection) of all chromosomes. If the chromosome represents an unstable filter, it is given the maximum cost (i.e. cost = 1000); otherwise its cost is evaluated using (6). Step 1 is skipped for the first iteration since the initial population is already evaluated. where (nl, n 2 ) E Rd, the region of support of the desired impulse response, hd(nl,n2). The design constraint is that Step 2 (Selection and pairing): Rank the costs from lowthe designed system must be stable. Also for a rnultiplierless realization. the elements of matrices and vectors are reest cost to highest cost and keep the best NpOp/2chromostricted to a power-of-two set S, = { 3 ~ 2 - f2-"+', ~, ..., f 1 , O ) . somes. The others are discarded. Then two-chromosomes 589 33. Stability Test II I I l Stabilii test and Testing for stability is tricky in this design process. For the separable denominator LSIV filter, there is a simple sufficient condition for stability that can be used to guarantee stability. For the PSV filter, several sufficient conditions and necessary conditions are given in [SI. The sufticient conditions given therein turn out to be too restrictive for the multiplierless filters. Therefore we use a necessary condition (given below). This will weed out a lot of the unstable candidate PSV filters, and will ensure that all the designed filters satisfj. the necessary condition. However, it does not guarantee stability. The notion we use here is that if the given (desired) impulse response is stable and we have a good approximation, then the designed filter is likely to be stable. However, once we have a designed filter, we use the sufficient conditions of [SI to assure that the filter is stable. The following conditions for stability are now incorporated in the GA algorithm. LSIV system (Sufficient condition) [2]: l I I evaluation 1-1 mini mu m solution I1 I* rninsol < = t a g e t Selection &pairing p(Ai) Fig. 2. Design procedure flowchart < 1 a n d ~ ( A 2 )< 1 where p denotes the spectral radius of a matrix. PSV system (Necessary condition) [SI: 1 are randomly selected to produce two new offsprings using the weighted random pairing scheme based on the cost of each chromosome. This is called the cost weighting scheme [6]. Pairing takes place until new offsprings are generated to replace the discarded ones. Note that the population size, NPOP, is constant for all iterations. Al(aJ9) P( < 1and P(Az) < 1 a= P 4. EXAMPLE To design a 2-D multiplierless PSV filter, one idea is to first design the LSIV system by applying an Integer-GA or Binary-GA until we obtain a satisfactory cost value (6). Then we use matrix A2 and C from this design to design the PSV system using Integer-GA. This approach reduces the length of chromosome in the PSV system design, thereby reducing the design time. Consider the impulse response of a "Gaussian filter" given by Step 3 (Crossover): Two new offspring are generated from each pair of chromosomes in Step 2 by crossover operation with probability P,. The idea of the crossover operation is that the paired chromosomes exchange a part of them at the crossover point, which is randomly selected between the first and last bits of the paired chromosomes. Step 4 (Mutation): Keep the best (lowest cost) chromosome and apply mutation to the rest of the population with probability P,. The idea of mutation is to change the value of the bit (or integer) of the chromosome at the mutation point. The mutation point is randomly selected from the (Npop- 1) x L, total number of points where L, is the length of chromosome. For the Binary-GA, changing the value of the bit is achieved by simply complementing the bit. For the Integer-GA, changing the value of the integer is done by replacing it with a new integer in the same set. h d ( i , j ) = 0.256322ezp(-O.l03203{(Z - 4)2 + ( j - 4)2}) for(0,O) <(ij)<(lO,lO). Thegoal istodesigna(4,4)thorder filter in the Fornasini-Marchesinistate-space form. The GA parameters are selected as follows: population size NpOp= 128, crossover probability P,=O. 6 , and mutation probability P, =0.15. Four binary bits are used to encode each coefficient for Binary-GA and integers 0 to 16 are used for the Integer-GA. We run the following design cases: (a) LSIV design using Binary-GA; (b) LSIV design using IntegerGA, (c) Using A2 and C from the LSIV filter and then designing the PSV filter using Integer-GA. Table l shows the Step 5: Repeat Steps 1-4. The procedure stops if the minimum solution (minsol) meets the target value. 590 error values. These results are obtained by running the GA for a total of about 400 times. Table 1. Design results The best result is obtained by using the Integer-GA for the LSIV filter and then using that design to optimize the PSV filter. The frequency responses of the ideal and designed filters are given in Fig. 3(a) and (b), for the best case example. It is conjectured that the GA parameters can be further adjusted to further improve the results. We are currently working on developing techniques to automatically tune the GA parameters for this problem. In our experiments with the proposed design method, the error values range from 0.1 to 0.2, which is very comparable to those obtained in [I] and [2]. It should be noted that in these references, the filter coefficients were not strictly power-of-two but sum of powers-of-two numbers. However, in this paper we have strictly power-of-two coefficients and yet we can achieve comparable error values. Also, we see from Fig. 3(a) and (b) that there is a clearly a good match between the two magnitude responses. hpurr -F Fig.3(b) Magnitude response of designed filter. 6. REFERENCES [l] Y.-H. Lee, M. Kawamata and T. Higuchi, ”GA-based design ofmultiplierless 2-D state-space digital filters with low roundoff noise,” IEEE Proc.-Circuits Devices Syst., vol. 145, no. 2, pp. 118-124, Apr. 1998. [2] - ” Design of Multiplierless 2-D State-space Digital filters over a Powers-of-Two Coefficient Space,” IEICE Trans. Fundamentals, vol. E79-A, 110.3, pp.374-377, Mar.1996. [3] S. Pei and S. Jaw, ” Efficient design of 2-D multiplierless FIR 5. CONCLUSION filters by transformation,” Proceedings ICASSP 87, vol. 3, pp. 1669-72, 1987. In this paper, we developed a method of designing 2-D multiplierless filters. T h e method is based on the use of periodic [4] H.K. Kwan and C.L. Chan, ”Circularly symmetric two- filters and the genetic algorithm for optimization. Two different types of genetic algorithms have been used, namely, the Binary-GA and the Integer-GA. The use of the latter decreases the chromosome size and makes the algorithm much faster. However, the Binary-GA is slower but tends to get closer to the solution, thereby yielding a lower cost function. This paper provides preliminary work on CA based 2-D filter design. Further work needs to be done in reducing the search time of the GA and also reducing the final design error. dimensional multiplierless FIR digital filter design using an enhanced McClellan transformation,” IEE Proceedings, vol. 136, no.3, pp. 129-134, June 1989. [5] R. Thamvichai, T. Bose, and D.M. Etter, “Design of multiplierless 2-D filters,” Proc. IEEE Intl. Symposium on Intelligent Signal Processing and Communication Systems, Nov. 2000. [6] R.L. Haupt and S.E. Haupt, ”Practical genetic algorithms,” John Wiley & Sons, Inc., 1998. [7] E. Fornasini and G . Marchesini, ”State-space realization theory of two-dimensional filters,” IEEE Trans. Automat. Contr., vol. AC-2 I, pp.484-492, Aug. 1976. [SI R. Thamvichai and T. Bose, ”Stability of 2-D periodically shift variant filters,” IEEE Truns. Circuit Syst.-II (submitted). 6- ., _I FC.Q-(* Fig.3(a) Magnitude response of Gaussian filter. 591