Sei sulla pagina 1di 30

ELECTRONOTES 203

Newsletter of the Musical Engineering Group



1016 Hanshaw Rd

Ithaca, NY 14850

Volume 21, No .. 203

January 2004

GROUP ANNOUNCEMENTS

Contents of EN#203

Page 1

Bittersweet

Page 3

An Intuitive Approach to Polyphase Rate Changing

We have discontinued the Electronotes phone at607-257-B010 (not paying its keep!).

To contact us by phone, please call and leave a message at 607-219~4261 and we will call you back, or call 607-266:.8492 late in the evening (Easternjime).,

BITTERSWEET

American bittersweet (Celastrusscandens) is a vine that produces attractive orange berries in the fall. If you cuta few sprigs and bring them inside, the orange covers peel back like flower petals about a red center, and you have an attractive addition to a dried flower arrangement, Many accounts suggest that bittersweet is invasive, but on the farm where I grew up, it was rare,and could be found in a few hedgerows and along some

roadsides" We always cut it sparingly" .

But in the fall, those persons who were not so fortunate as tolive in a rural area often

.: drove out "to seethefaU colors." Upon seeing bittersweet along the roadside, they would often stop and help themselves, often tearing out every clump in sight If confronted,the universal excuse was that "they did not know this was your land," Since you never saw them before, nor they you, is it any surprise that they did not know it was your land. But they did see the bittersweet, out in what they j-~garded as wide open no-man's land, and their act of spotting it apparently bestowed possession right

EN#203(1)

These were barbarians, or worse, "city slickers." We were of course "yokels" to them. But no country person would have made the mistake over real or personal property .. The bittersweet belonged, ultimately, to nature, but temporarily to whomever held title to the soil on which it was growing.. It was not just "out there."

Country folks often had legitimate business on other folks land (real property), but before one entered another's property, one asked permission and informed the landowner of the specifics" This was done first out of courtesy, and out of respect, and almost always out of true friendship" Sure, often it was ali excuse to stop and chat.

And no country person would be confused about personal property" Tools were leant and returned. If someone wanted to collect hickory nuts from under another's tree, no matter how remote the tree, one would ask for them. If someone wanted to search a creek for fossils, one would ask permission to search, would show the owner what had been found, arid ask to take them home" But no one would assume that even a dead limb fallen from a tree was not something that still belonged, in total, to the landowner"

Neither would a country person make a mistake about intellectual property" Any retelling of a story began with the name of the person who oriqinally told it: Often this was essential of course, so that the listener knew how many grains of salt to apply" Any good idea, perhaps about how to get tractor wheels up out of the mud, was related

first by stating who (at least in general terms) thoughtof it. often this was "namedropping," but knowing a good idea and its source was considered equally as highminded as having the idea in the first place"

Continued on Pg" 28

Country people did not trespass, they did not steal personal property, and they related the source of intellectual property as a reflex, Routine dealings between individuals were on the basis of a fair exchange. But, in the case of emergency or misfortune, one either gives or receives as was appropriate.

Way back then there were no cell phones, no touch-tone or even dial phones. Two wire supported by insulators ran between poles between houses (I.. e" , a party line). When one needed to make a call, one turned the crank ofa magneto which put about 100 volts AC on these wires, ringing everyone's bell. (People went days without feeling the need to disturb everyone else,,) If you wanted long distance, you turned for a second or two, and "central" picked up and began further connections. But if you wanted someone down the street, you cranked their local code" We were twoshorts (Morse I) while the neighbors to the south were Morse Nand those to the north, Morse S! The phone seldom rang" But when it did in the middle of the night, it was not considered rude to pick up and listen, just long enough, to determine if your neighbors were in trouble and needed your immediate help. Otherwise, one minded one's own business"

EN#203 (2)

AN INTUITIVE APPROACH TO POLYPHASE RATE CHANGING

-by Bernie Hutchins

1" INTRODUCTION

Back about 1986, we noted in this newsletter [1] that certain digital filter techniques were extremely useful for the related processes of interpolation and sample-rate conversion; and that proper "bookkeepinq'' procedures could result in huge saving of computational effort .. These ideas essentially related to the general notions of multirate digital signal processing, and to the specific approach known as polyphase [2], which was well-studied, and which is now a standard textbook topic [3,4]., Over the years these polyphase ideas have been expanded and, to a large degree, mathematically formalized" Here we want to show a more intuitive approach where we concentrate on what we are trying to achieve: what do we need to calculate, and how can we do this most efficiently?

2. BEFORE POLYPHASE - A BRUTE FORCE EXAMPLE

To see why a large saving of computation is possible, consider the specific case of changing from a 30 kHz sampling rate to a 40 kHz rate, an increase of 4/3" In the conventional non-polyphaseview, we envision an intermediate rate of 120 kl-lz That is, we interpolate up (by 4) to a 120 kHz rate, and then decimate down (by 3) to 40 kHz (Fig" 1 ),,' Fig .. 2 shows the time-domain view of this procedure, while Fig" 3 shows the corresponding frequency-domain view,

(a)

30kHz' 'Inte, (P018ter 20kHz,

..,....----'-...,.-.'4 by 4 to

120 kHz "

-Becim" at~f' 40, kHz

by3to -_ ..

40 kHz

(b)

120kHz ~ __ ~ __ ~4_0_kHZ

30 kHz_r-;L_k~

--·~~·~~~r·~T

Fig. 1 Rate change by lnterpoattion/decimatlon. (a) The basic block diagram" (b) The conventional diagram shows an "upsampler" (zero padder - putting three zeros between each original sample here) followed by a filter as the interpolator, and a "downsampler" (discard 2 of

" 3-sampleshereYas thedecimator. See also Fig" 2"

EN#~03(3)

In Fig .. 2 we compare an original sequence (a) at a 30 kHz sampling rate to an interpolated sequence (c) at a 120 kHz sampling rate. Note that at the higher rate, the samples really are four times denser in time (separated by 8-1/3 usee instead of 33-1/3 usee) .. This is what must happen in real engineering work of course, in contrast to a mathematical point of view where all sampling rates are often "normalized" to unity .. Accordingly, the so-called "zero-padded" sequence, seen in Fig .. 2b, is probably quite useful.. It's sampling rate really is 120 kHz, and samples with value zero have been inserted between original samples, effectively serving as "placeholders" until a suitable interpolation scheme is used to obtains more realistic intermediate values as in Fig .. 2c.. In Fig .. 2d, two of three samples are discarded, and the spacing is now 25 usee, for the desired 40 kHz sampling rate ..

EN#203 (4)

Here we immediately note the potential for computational savings.. We see that two things are working for us .. First, we need not bother to calculate (interpolate) samples which we are only going to discard, Fig .. 2c to Fig .. 2d.. Less obvious, the interpolation is a digital filtering of the zero-padded sequence, Fig .. 2b to Fig .. 2c, and we know exactly where the zeros are in the filter input (we put them there), and we need not do filter multiplies if we know the sample value is zero. Accordingly, only one of four multiplies during the interpolation process is actually necessary, and only one of three output samples need be calculated .. The saving seems to be (and is) down to 1/(4x3) = 1/12 of the multiplies for the brute force approach, if we do things right.

Fig .. 3 shows the exact same rate changing process in the frequency domain. Here we start with (a) which IS the spectrum of the original (original sampled) signal. Since it is sampled at 30 kHz, we will assume that the sampling theorem is obeyed, but that the bandwidth may actually approach the 15 kHz limit. For convenience of drawing, we choose a triangular-shaped spectrum from ··15 kHz to +15 kHz .. Thus Fig .. 3a' shows the normal sampling replicas about multiples of 30 kHz.. The spectrum in Fig .. 3b corresponds exactly to the signal of Fig .. 2b.. The added zeros in the time domain contribute nothing to the physical spectrum, and indeed, Fig .. 3a and Fig .. 3b are identical, with the exception that in Fig .. 3a the sampling rate is considered to be 30 kHz while in Fig .. 3b, it is considered to be 110 kl-lz ..

We note that the spectrum of Fig .. 3b is not the spectrum of the unsampled signal (from -15 kHz to +15 kHz) sampled at 120 kHz: this we actually find in Fig .. 3d .. The spectrum of Fig .. 3b is in fact cluttered with three extra images between 15 kHz and 105 kHz.. These extra images (a repeat of the original information) correspond to the fact that mere zeropadding of the original sequence adds no new information. If we do not insist on these intermediate samples being zero, something new can happen between 15 kHz and 105 kHz .. In fact, we would like to see this middle region of the spectrum become zero everywhere (by replacing the padded zeros with appropriate samples), so that we do geta spectrum as in Fig .. 3d ..

At this point, the interpolation process we are proposing is clearly seen to be a lowpass filtering, Fig .. 3c .. Intuitively, some sort of low-passfiltering seemed appropriate, because we wanted to replace the somewhat jagged signal (the imposed zero-padding)

Fig. 2 Time domain view of a 4:3 rate changer (30kHz ~ 40kHz by use of interpolation/decimation)

"

~ I

11 ~.I'

" . I· I 1 . "'._

" .-t .: . I 1 ~ .....

a»~"",,"","~~.-~~~~~

-15 kHz 0 +15 kHz 3QIil1z 60 kHz' 90 kHz· 120 kHz

: fs I

"'~/'~~~/"'"

b) 9 I 1Zo.kHz

I ~

,)L~l. . - ~r=h-:--, -.1..... [ __

o ; . 120kHz

.'

d) LX:.

o



'~I

.e)~'

o I

~

40kHz f.

·120 kHz

Fig. 3 Frequency domain view of a 4:3 rate changer (30kHz ~ 40kHz by use of low-pass interpolation followed by decimation)

EN#203 (5)

r

EN#203 (6)

with replacement samples more generally representative of what we expect for the nonzero points. Here we see that the ideal low-pass filter of Fig .. 3c is ideal for our purpose. In practice, practical filter approximations or signal models will be necessary. Not~ that the cutoff frequency of the ideal filter is 15 kl4z in this case, or 1/8 (1/4 of 112) of the 120 kHz sampling rate here.. We will look for practical interpolations to approximate this cutoff ..

The decimation (downsampling) step, Fiq. 3d to Fig .. 3e is not too exeitfng.. The interpolated case of Fig. 3d looks exactly like what we would have gotten if we had sampled the signal at 120 kHz in the first place - replicas of the -15 kHz to +15 kHz spectrum about multiples of 120 kHz.. This is what we intended to achieve with interpolation" When we discard two out of three samples, we end up with exactly the samples we would have had if we sampled at 40 kHz, and the spectrum is now replicas 'of the -15 kHz to +15 kHz original spaced about multiples of 40 kHz.. Because there was so much extra empty space prior to decimation, no-aliasing (overlap of spectra/ images) occurs, but in general, this is something we need to pay attention to ..

3. LINEAR INTERPOLATION

What we have done to this point is more-or-Iess review, conventional, and we have barely touched on the nature of the interpolation filter, let alone its polyphase form. At this point it will be useful to choose a specific interpolation filter, We do know that the filter should be low-pass, and have a cutoff of approximately 15 kHz for our example" There are many ways to design suitable filters for this application [51, most (but not all) of which start with a frequency-domain description" In fact, interpolation is perhaps intuitively easiest to understand in the time domain, and it is this time domain approach, applied to linear interpolation, that we will use as a first route to understanding polyphase ..

Fig .. 4 shows an implementation of a 4/3 rate changer based on time-domain linear interpolation (Fig" 5).. That is, the method we wi/I use to determine intermediate points is to assume that they all lie on 'straight lines between consecutive points (also called piecewise linear) .. ' Compare the samples in (a), (b), (c), and (d) of Fig .. 4 with the correspondirig cases in Fig .. 2 .. The interpolation in Fig .. 2 is apparently "smoother" but it is not specltledwe just drew something that looked good.. Here we have made a specific choice Which mayor may not be satisfactory ..

It may not be obvious that the seven-tap FIR filter shown in Fig .. 4 is the correct filter for a piecewise linear interpolation. One way to see this is to first derive the polyphase filters and interleave them .. But here we want to start with a known brute-force interpolation filter and break it into its polyphases.. Accordingly, we can ask a simple question: "What is the impulse response of a linear interpolator?" The answer is: "The response of a linear interpolator to an impulse!" Trick question .. Actually, this tells us everything .. An impulse is a sample equal to 1 at sampling time zero,and zero at all other sampling times (solid

f dots in Fig 5c).. We intend to linearly interpolate this, putting three new samples between existing samples. Accordingly we get a three step ramp up to the left of the impulse, and a

b

b

d (a) I_" __ ...L.C __ --L.. __ __J____..:j

112

114

(b)

(c)

--·~0·-

Fig. 4 "Brute Force "linear interpolation" for a- 4/3 rate changer

n n+e

n

General Point

x(n+t) = (1..,;) x(n) +1: x(n+1}

Interpolation by 4

x(n+114) '" (314)x{n) +- (114)x(n+1) x(n+1/2) :: (1/2)x(n) + (1/2)x(n+1) x(n+3/4) = (1f4)x(n) + (3/4}x(n+1)

Fig. 5 Linear Interpolation Basics

n+1

Impulse R~sponse of

c) Llrrear Interpolation by 4

... -q--o--<. J:-. ----4.~. ;;......L"'--..J.....;~ ... --"L.._.....J..;..._!.;....._~-4I~O':".-o~

-7 ··6 '9 0·2 4 "~ 6: 7

d) " _. __ ,.

I Magnitude Response of

: Linear Interpolation by 4 .

I •.

t ,.,=-:: _ I-===- .....

118 1/1 . .- 1/2

fifs

Six~Zeros • in ·:f~P·lane f6ilinear lnterpolatloh by4 .

EN#203 (7)

three step ramp down to the right. All the interpolated samples between consecutive zeros are zero. This is how a linear interpolator responds to an impulse ..

Knowing the impulse response tells us everything else about the filter. The magnitude of the frequency response is shown in Fig 5d .. We recall that ideally in the frequency domain we wanted a low-pass filter with a cutoff of 1/8 the sampling frequency, Thus, 'even though we are using a time-domain approach to linear interpolation, we note that filter is basically a humble low-pass: it has a cutoff in the vicinity of 1/8, and is not a bad filter for length 7., We can gues~ that reasonable interpolation methods are going to turn out low-pass to some degree, and low-pass filters are going to interpolated zero-padded sequences to some degree.

4. POLYPHASE FOR THE EXAMPLE

Based on our example, as presented in Fig,. 4, we can derive a simplified structure for our rate changer based on polyphase components" In simplified form, this is shown in Fig" 6, while Fig .. 7 gives some more details of the actual implementation. Going back to Fig" 4; we note that the signal of Fig., 4d consists of five samples shown, a, a3, b2, C1, and d .. These samples are seen to be a subset (one of every three) of Fig,. 4c., Because we are usinq a piecewise linear model, we can write down equations for the signal values in Fig .. 4d:

as = (314) b + (1/4) a b2 = (1/2) c + (1/2) b C1 = (1/4) d + (3/4) c

equation set (1)

a=a

We could actually write down eight more equations to include additional samples in Fig" 4c:

a1 = (1/4) b + (3/4) a a2 :::: (1/2) b + (1/2) a b=b

b1 = (1/4) c + (3/4) b b3 = (3/4) c + (1/4) b

equation set (2)

c=c

C2= (1/2) d + (1/2) c GJ- = (3/4) d + (1/4) c

EN#203 (8)

We could keep going further if we were so inclined:

d=d

d1 = (1/4) e + (3/4) d

etc"

equation set (3)

We can easily see that the equations included in set (3) offer us nothing new, and are just shiftedverstons of the equations in set (1) and set (2)"Accordingly we will include repeated cases only when they add useful perspective to ourstudy The 12 equations of set(1) and set(2) in fact comprise what we can call a full "rate-change computation cycle." Note that this cycle includes 12 samples, and that 12 is the product of the factors in the rate change fraction (12 = 3 x 4).. In the full interpolation process, we would needto calculate all sample values: a, a-, a2, a3, b, b-. b2, b3, C, C1, C2, and C3, But we are only keeping every third sample, so we only need to calculate a, a3, b2, and C1" Note that obtaining all four required values does involve the full rate-change computation cycle.

Fig" 6 simply corresponds to a realization of the equations of set (1)" The summers and delay lines there are the polyphase filters" Each of the polyphase filters is seen to be a computational device that calculates the piecewise linear value at a particular point: a, a3,

b2, or c-based on the original samples a, b, c, and d.. If we think of the time offsets as .

phases, and we note that there are multiple filters, we can guess at the origin of the term "polyphase."

We notice that each of the polyphase filters needs new inputs only for every third instance of time. Accordingly we look for the d6wnsamplers to appear on the left (input)

dr 1~

~_3 /4 ---'

a

EN#203 (9)

Fig. 6 Basic idea of a.

polyphase implementation ls

to identify the computational structures which compute'

only the samples which are actually needed: equation set (1)

side now .. The rotating switch is called a "commutator" and can be seen to output only those interpolated samples that are to be kept, and in proper order. In actually implementing this commutator, we will see that the upsamplers will be Involved, and this time they will be on the right (output) side. This means that the actual computations are being done at a lower rate ..

How much are we saving? Well we note that in Fig .. 6 there are seven multipliers (we will count multiplication by 1 as a multiply). Thus seven multiplies are required for what we will call a full "rate-change computation-cycle" (RCCC)., Contrast this with with the bruteforce interpolation (Fig,. 4) where we needed seven multiplies for each interpolated point, or 12 x 7 = 84 multiplies for a full RCCC,. The polyphase approach thus does cut the computations by a factor of 12,. In general, the computations are cut by a factor equal to the RCCC"

c

T

~d4.-€::)---,

, I

, I I

I 1

·1

Fig. 7 Delays

and downsamplers on the left feed the proper input samples to the computing networks of Fig" 6,

. while the commutating switch is realized by the upsamplers and delays on the right

Fig,. '7 does look more complicated that Fig" 6 .. Compare Fig., 7 to Fig. 1 b and you will note that what we have accomplished overall is that we have moved the downsamplers to the left (throuqh the filter) and the upsamplers to the right (through the filter). The portion of Fig, 7 that is to the right of the polyphase filters (to the right of the summers) is actually just the realization of the commutator switch of Fig,. 6" At the output of the summers, the samples a, a3, b2, and C1 are all available simultaneously" Thus the upsamplers by 4 zero pad these with three extra zeros, and the delays spread them apart so that all we need to do is sum them, and we get one of the four samples (plus three zeros which make no difference). So much for the commutator switch.

9

d

r

b

t---'--0--!.-f __._I_-+

,

I I

t I

1 I a

I : 11

~ ~ .. ~- -

1/4

EN#203 (10)

The left portion of Fig .. 7 looks a lot like the left portion of Fig .. 6 _. we have just connected the delay lines together, and added downsamplers by 3.. Why downsamplers? Well note (for example) the sample b2, which is obtained as the average of b and c. If the downsamplers were not there, when the delay clocks, we would have the average of c and d, the sample C2.. Yet another clocking would give us the average of d and e, the sample d2. Finally, one more clocking would give the average of e and f, the sample e2 ..

Extending the signal (c) of Fig .. 4, we note that we do need the sample b2, but not C2 or d2. The next sample needed is e2. Because we do not need C2 or d2, we db not need their generating samples at the input of the polyphase filter. Note from Fig .. 7 that it is indeed the samples e and f that are waiting right behind band c ... Our goal was to not compute samples that we do not use, so the downsamplers avoid feeding in the inputs for such useless cases .. The polyphase filters are needed only for every third clocking of the delay line. That's about all there is to it

5. ADDITIONAL EXAMPLES

5a .. UP BY 7/2

Fig .. 8 and Fig .. 9 show a second example - a rate change of 7/2 .. Fig .. 8 corresponds to Fig .. 4 for the fitst example, and Fig .. 9 corresponds to Fig .. 7 for the first example .. The diagram for the separate polyphase filter with commutator switch, Which corresponds to Fig .. 6, is left for the reader to draw .. Fig .. 8 thus shows us the brute-force interpolation, and it is a good idea to always draw this out to remind ourselves what we are doing.. Here we are again using piecewise linear interpolation.. Note that here, in contrast to the first example (Fig .. 4) we have three samples and not just one between input samples .. This complicates things a bit when we do our drawings ..

Nonetheless Fig .. 9 shows the polyphase structure with the downsamplers by 2 on the left and the upsamplers following the polyphase filters on the right. Again we can compute the savinqs. From Fig .. 8 we see that the RCCC is length ~4 (interpolated samples a, a1 ,a2·, a3, a4, a5, aSr b, b-, b2, b3,. b4, b5, bs).. Each of these interpolated

-. samples requires 13 multiplies (tosummerof Fig .. 8) .. That's 182 multiplies for the RCCC ..

Afld there are in fact just the 13 mu Itiplies in Fig .. 9 for the same RCCC. Again, these are just the interpolator coefficients, used just once ..

5b. TWO APPROACHES TO A 2/3 RATE CHANGER

The rate change of 2/3 seems pretty simple since the numbers are small, The difference is that the rate goes down, and this may require us to be more clever. But let's start by pretehding that we know what we are doing.; We can try linear interpolation, goIng

EN#203 (11)

b

....,_._., .. I .. .._., .. I f.

b

117

Fig.8 Up by 7, Down by 2 by brute-force linear interpolation

, .

f

317

317

217

I I , ' I I Ta

Fig. 9 Up by 7, Down by 2 by efficient polyphase decomposition

EN#203 (12)

d c

if

b b

Lf~fJ.r.f.

112

Fig. 10a Here we use linear interpolation exactly as we have above, but we are going to a lower rate (2/3}.._ Thus the usual bandlimiting assumption (that the bandwidth is 1/2 the sampling frequency) is probably not good enough.. Here we rely on the piecewise linear model to be correct, by assumption ..

Fig:10h The expected piecewise-linear computational networks.

t·f

~l '¢.~ "lEJ1-'-' --,--_1,-- ___

r

1/2

a-. _.~.~_~ra_._.. a __ ~

Fig. 1 Dc The expected piecewise-linear polyphase implementation ..

EN#2D3 (13)

up by 2 and down by 3" Fig 10 (a, b, and c) follow easily, mimicking the first two examples" Here the RCCC would be 6 (interpalatedsampies a, a1, b, b., c, C1) and would require 18 multiplies" And we see that the polyphase structure (Fig" 10 c) has onlythree multiplies" So everything warks?

Yes everything is correct if we insist that our interpolatian model is piecewise linear.

But often (perhaps more often) we are looking far a bandlimited model" In the case of upsampling, we have seen that piecewise linear does represent an approximation to. an interpolation filter far the band limited case" However, in this example, the required filter is nat to be judged solely on the basis of interpolatian, but also on the basis of its function as' a pre-decimation filter" hi this regard, the cutoff is too. high"

First note that what we are filtering is a sequence that has twice the original sampling , rate, since it was zero padded with one zero between existing samples" Now, we need to interpolate and pre-decimate at the same time" An interpolatian filter wauld have a cutoff at 1/4 the sampling rate, but the predecimation filter should have a cutoff of 1/6, since we are decimating by three" For a more concrete example, let's suppose we have a signal sampled at 10kHz" We have to assume its bandwidth might be as high as 5 kl-lz. We interpolate this to. 20 kHz, and this would still have a bandwidth of 5 kHz of course. If we then decimate by 3, the final sampling rate is (the desired) 6667 Hz, and this would cause the 5 kHz signal to alias" Thus, we see that the interpolatian filter must low-pass andreduce the bandwidth to 3333 Hz prior to .declmatlon. The cutoff of 3333 Hz is relative to.

, the sampling rate of the filter, which is 20 kHz (not 10 kl-lz): That is, the cutoff is 1i6 of the sampling rate"

EN#203 (14)

Now we are not canfined to. any signal madel (such as piecewise linear) but rather are laaking for a suitable law-pass filter, for which there are many design methods [5].. Fig" 12a shows a possible filter, a length 11 filter based an the inverse DTFT approach (truncated to. length 11)" Pretty simple" Fig .. 11 compares the response of this filter to the linear interpolator, and to a length 61 bandlimited filter. We see that aur length 11 filter is superior to the linear interpalation filter for band limiting" If we had enaugh resources available, we can of course use a better bandJimiting filter (such as the length 61 shown)"

Now that we have chosen our filter, the rest is pretty much automatic, and follows our mold" Fig" 12b shows the polyphase filters with commutator, and Fig, 12c shows the full palyphase structure" Note from Fig" 12a that in the band limited case the original input signals are not preserved" Thus a substitute sample ao is faund instead of a (presumably they are close). Once again, the RCCC is six. We would have 11 multiplies per interpolated sample (again, think of multiplication by 0 as a multiply, when it is a filter tap weight) so there are 66 multiplies" Again, we have 11 multiplies in Fig" 12c, so ance again, the total number of multiplies is the same as the number of tap weights, and the saving factor is the RCCC.,

14~--~----~----~----~----~----~----.-----.-----.----.

0,8

length 11

J

Fig. 11 Ideally we hope for an actual low-pass filter with a cutoff at 1/6=0,,1667.. The length 5 linear interpolator h=[O 0,,5 1,0 0,,5 0] is not too good at this (although it does have a realistic cutoff

at 1/4)" The length 11, inverse DTFT is somewhat better,

and we use this in Fig" 12a,

In this figure, we also show

a length 61 inverse DTFT

. for comparison"

1 2

I length 61

-: ,,(1\

1 _',,", /-..~ / -. \ i

"L_ .. y __ ">:~ ~/ \ V ,

/' <, \

" I

,,~ \

~ \

r-, \

~,

\~

06

04

~ length 5 linear interpolator

02

5c. PURE,INTERPOLATIONl PURE DECIMATION

.Educ~tors recognize that students often become experts at handling regular full-sized problems.and that if you want to throw them a curve, just leave something out Accordingly; what could' be more.simple than doing a rate change where one of the numbers in the fraction is1? That is, pure interpolation, or pure decimation, Wouldn't you just do half the oriqinalproblern?

. Fig .. 13 shows a case of an upsamplingby4, a pure interpolation based on piecewise

constant. The result is familiar, and weglance'back to Fig, 7., The polyphase filters are the same and they are! unloaded by the commutator in the same way, but the input structure. isdifferent (simpler)"It lsnotclearhow one would change Fig" 7to Fig" 13" We might takeout.thedownsamplers Butwhatthen: how do we handle the three delays going t<;> just one, Andthe polyphase filters are in reverse direction (the 4/3 rate changer took a firstsarripte 3/4 of the way across), The reader looking for a way to convert should be dissuadedat this point - and welJ so.. Yet, Fig" 13 is not at aI/ difficult..

EN#203 (15)

b

..(l0551

-00551

b6' al

~ t1iHrr lr~_._.

do b1 ao

.~.~ .. __,__1 .. ----!-f _1_. _~

EN#203 (16)

Fig.12a Up by 2, Down by 3 based on a bandlimited model (the filter is of course a real rather than an [deal low-pass). The filter serves for both pre-decimation and for interpolation ..

Fig. 12b The two polyphase filters for Up by 2, Down by 3 ..

-&{a-_t·~.l'--'r- -II.P---,

I I I I



I

-00689

T

0.137(1

Fig. 12c The efficient polyphase 3:2 rate converter (bandllmited case)

b

t--9----7---~

. I I I I

Fig. 13 Pure Interpolation by 4

Fig. 14 Pure Decimation by 3

EN#203 (17)

A pure decimation (by 3) case is shown in Fig" 14" Here, as in our second example of the 2/3 rate change (band limited) we are using a bandlimiting low-pass filter, Here for simplicity we show a length S filter instead of length 11 (see again Fig" 11)" But otherwise this filter is the same filter that we used in the 2/3 rate chanqe case, and it might seem strange" However, keep in mind that we are predecimating for a downsampling by 3" To again put in real numbers, suppose we had data sampled at 10kHz (a S kHz bandwidth) and we wanted to change the rate to 3333 Hz" We would of course need to reduce the bandwidth to 1667 Hz (1/6 of 10 kl-lz). So it's the same filter,

6. DOES THE STANDARD FORMALISM GIVE THE SAMERESUL TS?

EN#203 (18)

There is a standard way of developing polyphase rate changers, which involves ideas that are more mathematical than those we have used above" This approach we can review briefly and give a very detailed example to show that it is consistent with the more intuitive approach above"

6a" THE STANDARD TOOLS

1. ORDERING UPSAMPLlNG/DOWNSAMPLlNG: The order of upsamplinq and downsampling can be interchanged if the upsampling and downsampling factors are relatively prime" This means that they have no common factor.. Cases where they can be interchanged include fractions such as 3/2 (Fig" 14), S/3, and 7/9, but not 4/2 or 9/6 to give some examples" This can be proven, although a few sketches will probably convince most readers" In fact, since anyone problem will likely only involve one potential interchange,

. you would likely test it anyway just to see what is going on.

2. NOBLE IDENTITY 1: If a downsampler by M moves through a filter G(ZM) from right to left, the, filter becomes just G(z) (see Fig" 1Sa, 15c)" This applies of course to a delay (Fig" 1Sb, 1Sd)., This is easy to see"

3. NOBLE IDENTITY 2: If an upsampler by L. moves through a filter G(ZL) from left to right, the filter becomes G(z) (see Fig" 16a, 16c)" This also applies to a delay (Fig" 16b, 16d)" Again, this iseasyto see"

4. THE GREAT TRICK - BREAK A DELAY INTO PIECES: Suppose you are moving an upsarnpler by 4 to the right and a downsampler by 3 to the left" By Tool 1, you can interchange these and continue" But suppose there is a delay of Z-2 in between them (see Fig" 17)1 You can't then use Tool 2 or Tool 3 becauseyou would have fractional delays" The trick is to write Z-2 as Z-8Z6, Now the up-by-e can pass to the right through the Z-8 leaving a Z,·2 to its left Then the down-by-3 passes to the left through the Z6, leaving a Z2 to its right.. The down-by-3 and up-by-e thencan be interchanged (Tool 1).,

.uu . i~Lf .. t j__l

o 112 3 _ .. 0 3 J 6' 9. 0 J 3 ~4a

-_ -~ 13]- .. ---[:}--.-

iill-· II LL

"4, " -G- 'J' -'-0-' J 14'

Fig. 14 Example of interchanging an upsarnpler by 3 and

a downsampler by 2" Note same input (left) and same output (right), while middle is different.

f<ZM+_-_- _ '-E-~~}---'---'- 15a

b 9 b 9 9

II If i [l f If LiiL jjj_

.~ _ l 3.. 0 1 a '. 01 2 15b

-.-'---{f}- . ._--'--8---------'

Fig. 15 Noble Identity 1 is shown as (a) and (C) while an example using a delay is seen in (b) and (d)" Compare inputs and output of (b)and (d)"

-'. ~8- .. ~,-,--·-----·~}~-. ---' 15c

ill f 1 If 1Lt_ ff f.

-3 O! 3... ·1 0 1 . . . _ . 0 1 2 15d

.~---E}----~ --'B--t -

-,--[~. -~----.-----[~~:q--,---, 16a

a rb c a br c a Jb

Ul_. L~ __ ._J_~ r ,'~

--j_-' -8-' f --' ---[~6 t'

c

,L

6

Fig. 16 Noble Identity 2 is shown as. (a) and (c) while an example using a delay is seen in (b) and (d)" Compare inputs and output of

(b) and (d)..

16b

ill

'-1 0 1

~.. r=;-l_

'. -----L~~J-

'----§----___,,--16C

abc a fb

JJ1._ _L~~~

o 1 2,._ &_. t_~9d

~-

EN#203(19)

Fig. 17a Steps for the "Great Trick.." The Z-2 (top) is changed to Z-8Z6 (second line).. Noble identities 1

and 2 allow the upsampler and

the downsampler to move (third line), Then Tool 1 allows the upsampler and the downsampler

to interchange (bottom line) ..

----f8--0~-. G,_

·--~}---5l_[!~--{~J---·-""'-

. Fig. 17b Illustration of signal

samples for Fig .. 17a, top and

y . ~ j.b c (j Ie bottom lines ..

';) '1' -:

Lt- . - .~- - .......-- . .., .. -._---.........,._-- .. -- -+ ..... ..,.;.;_.~--- .. ......,.-

(~. I· d !

.::_L- .• l_-.-.-i J__.j

Jb Ie -4----

...... ", -. -- ... .,.~., -' _.-----_._------

. .

EN#203 (20)

top line of Fig .. 17 a

bottom line of Fig. 17a

ee APPLYING THE TOOLS - DOING AN EXAMPLE AGAIN

In general, the composition of the polyphase rate changer by the standard formalism is either quite mysterious or highly tedious" That is, the only truly clear way of showing it is to make many, many drawings, with each drawing in the series illustrating only one (or very few) changes from the previous one in the series. Here we are placing clarity in paramount importance, so we will use a series of 10 iterative drawings from Fig" 18a (same as Fig" 4) to Fig. 18j (arriving at Fig" 7 again)" Thus we do a pervious example by a different (the standard) method ..

As mentioned, Fig., 18a is the 4/3linear~interpolation rate changer of Fig., 4 (with fewer details shown).. OUf goal is to divide it into a polyphase structure, move the upsamplers to the right, and the downsamples to the left" This should mean that the actual computations are being done at the minimum possible rate, as in Fig" 7.,

v'

In Fig" 18b, we have divided the interpolation filter into its four polyphases., (Note that there are now five summers in all that are showing, although it is still clearly just one grand summer..) This we have done to initiate the polyphase transformations -, nothing is more efficient at this point(probably the opposite)" Fig" 18c is a further development, and the parallel polyphase channels are now more clearly separated and parallelized, Note that each of the filters is a two-tap F[R, and the delay between the taps is four (not one).. Thus we see the delays as z-4 instead of Z-1,. We have also chosen to carry along the multiply by zero in the lowest filter to keep everything as balanced-looking as possible" (This we will discard at the end.) Note also that the original horizontal delay line chain of Fig" 18a has been replaced by separate delays of Z-1, zC2, and Z-3, This we do because we are about to move (in Fig., 18d) the delays" In total, not much has changed" (Many readers will note that Fig" 18c could have been drawn directly from Fig,. 188" Again, we are being deliberate for clarity.) .. Fig,. 18d is the same as Fig" 18c, exceptthat we have

interchanged the order of the filters and the delays" Two Linear Time-lnvariant (L TI) systems can always be interchanged of course"

In Fig,. 18e we actually do something interesting - we move the upsarnplers through the filter (Noble Identity 2 from our Tools)" Of course, there are now four upsamplers and not just one, but after all, these are only things we draw" The filter delays changed from z-4 to z" as the upsamplers passed through" We want the upsamplers to continue further to the riqht.and notethat we have also moved the downsamplers to the left, through the summer" ryve now have four downsarnplers). Butwe are stuck because of the delays

(the Z-1, Z-2, and Z-3) between the upsamplers and the downsamplers In the top filter where there is no delay, we can of course interchange the upsampler and downsampler whenever we want (first '1'001), but let's wait until we can move them all at once"

Moving on the Fig,. 18f, we are setting up the "Great Trick." The Z-1 becomes Z-4Z3, the Z-2 becomes Z-8Z6, and the Z-3 becomes Z-12Z9" lt is always possible to do this [3].. This will permit us to pass the upsamplers through the deJ_ays to the right and the downsarnplers

EN#20~ (21)

~! -

Lr~l--

~4 1--~--1-/4-"--I

EN#263, (22)

Fig. 18a The original 4/3 linear-interpolation

rate changer

Fig. 18b This is not really different from Fig" 18a, except that we have shown the four polyphase filters as separate summations"

Fig.18c Here we have further parallelized the structure by using individual delays for each filter, Note that each filter uses a

delay of four unlts

here (z") , _

3/4

112

1~§""

3{ . 114

',~ .

.. - ." ,

:z'2 ;.

~[~- ...

3/4

.. F:-·l~_r ., ~ .. ~.} -r..!!.re~-J1~· •. '

EN#203(23)

Fig. 18d This is just Fig,. 18c with the orders of the filters and delays interchanged (both are

LTI)"

Fig. 18e The filters in

Fig" 18d used delays of

z", and thus the . upsampler can be moved through them, and the 9.~lays become Z-1 (Noble Identity 2)., Now there are four upsamplers. At the same time, the downsampler has been moved through the output summer to the left, and there are now four downsamplers, But the delays (Z-1, Z·2,

and Z-3 seem to block further progress,

1/2

EN#203(24)

Fig. 18f We now set up the "Great Trick" by replacing the delays by a combination ofa delay and an advance"

Fig. 189 The delays move

to the left, through the upsamplers and the advances move to the rightthrough the downsamplers; and the upsamplers and downsamplers are interchanged, This key step illustrates the use of all four of the Standard Tools"

EN#263 (25)

Fig.18h The delays tothe left of the downsamplers are interchanged with the filters (both are LTI), and are rep/aced by the downward chain of unit delays on the left The downsamplers can not be moved through the filters,

Fig. 18i While the downsamplers can't be moved through the filters, they can

be moved through the summers and multipliers of the filters" This is a mess, until we note thatwe have redundant

',

network points as indicated by

the dashed lines"

Fig. 18j Removing the redundancies, the structure is much simplified" We also (finally!) remove the multiply

by zero" We also multiply the output paths by Z-3 to make the system causal. This is the same as Fig: 7, which was obtained

by the intuitive method"

through the advances to the left, so that they are directly in series, and $0 that they can now be interchanged (first Tool): Fig 18g shows the result. Now what? The next step is to interchange the delays and the filters on the left side (both being LTI)" We did not draw this, but went directly to the equivalent downward chain of delays on the left (Fig" 18h) ..

At this point, things get tricky" Clearly we can't move the downsamplers through the filters (which use Z-1), Noble identity 1 might be attempted, but this would require us to come up with a delay of 1/3, or Z-1/3, However, we can move the upsamplers through the summers and the multipliers of the filters (not the delay)" Doing this, we have Fig, 18i, which looks like a real mess" We have eight downsarnplers now" The key is now to recognize that we also have considerable redundancy in the structure" In Fig" 18i, we show with three dashed lines, network points that are equivalent, having come from a previous point through delays anddownsarnplers. It will be convenient to think of the lower input of the filter summers as coming from the path below Um. the dashed lines)"

Fig .. 18j is our final result (equivalent to Fig" 7)" (Note that the output of each downsarnpler is fed to different summers, through different multlpliers.) We did two other things here" We dropped (finallyl) the multiply by zero, and we multiplied the output paths (following the upsamplers) by Z-3 to make the whole system causal.

EN#203 (26)

7. WHAT HAVE WE ACCOMPLISHED?

n ~ - • ~ _ •• •

A~ this point, we have made a lot of diagrams and have developed considerable insight into the mechanisms used in our efficient polyphase rate changing schemes" But have we done much- really? No .. We began with the observation that you could save a lot of number-crunching if you arejust a bit smart and don't do computations you don't need" That's really all we have at the end.

However, it may appear that we have obtained networks (such as Fig" 7) for actually doing the rate changes" Indeed, these networks resemble familiar digital filters in that they use delays, multiplies, and summers" But the problem is they also contain upsamplers and downsamplers, and these are not physically realizable in real time" Thus networks such as Fig" 7 are still only recipes for doing things the right way, and not actual mechanisms" Note, in contrast, that we could fairly easily realize the "brute force" rate changer in Fig" 4, as long as the whole thing clocks at 120 kHz, and hold mechanisms were used to achieve the lower rates of 30 kHz and 40 kl-lz, We could, for example, program this on a DSP evaluation system, but it would be mainly a "demonstration" and not something practical. What we are up against is the usual problem of trying to do rnultlrate signal processing at just one rate!

In fact we might have thought of the polyphase structure as representing the contents of the "box" we suppose might sit between two digital devices operating at different rates" For example, we might suppose such a box would sit between a CD player (44" 1 kHz) and a OAT (48 kHz), The rate change would be 48,0144,1 = 1601147 = (5 x 2 x2 x 2 x 2 x 2) I (3 x 7 x 7)" Try this with polyphase and you will see that it is extremely efficient relative to brute force. However, the filters would also need to be extremely long., The usual ploy would be to break the ratio into smaller factor that are close to one (say from 112 to 2) and such that no intermediate rate is less than 44" 1 kHz., For example, 817 followed by 5/3

. followed by 417 would work" But, there's still a problem,

EN#203 (27)

Clearly no particular CD player works at 44,,1 kHz (it might by 44" 1 0734"" kHz) and no particular OAT works at 48 kHz (it might by 47.,998319,,,,,, kl-lz), Thus the actual ratio would be one of very large numbers, which are not known ahead of time, and which may drift with time" This forces us to consider a "box" where one of the devices somehow is the master clock for both., OUf box is getting very complicated, and we know that it is only

approximate in its interpolation anyway, In actual practice, simply going to analog .

between the devices is simple, and works well. Generally it is thought (for audio at least) that going to analog once does not produce a perceptible degradation, relative to any practical implementation of a diqital-to-diqltal scheme, which probably has distortions of its own,

More and more in recent years we can think of the rate change not as a machine-tomachine operation but as a file-to-file conversion" Substantial portions of digital signals (or even all) can be stored in a computer file (or similar memory buffer), and it is easy to see that we could write a program, based on Fig" 7 for example, to write a new file, out of teal tim~" It is in this sense at least, that polyphase structure is practical.

Above we have presented two ways of obtaining the same polyphase structures: one based on intuition, and the other on formal procedures" I th ink it is clear that the intuitive approach is easier, and we have described the formal approach as tedious (and we have demonstrated its tedious naturel), Both these approaches have been graphical rather than mathematical: we have drawn pictures rather than written equations" We need to recognize (and admire) that some people are able to write down equations, manipulate then, understand them, and then arrive at the correct answer. I don't know how they do this because I can't look at the equations and actually understand much without drawing a picture" Ihis equation approach is a third approach for obtaining polyphase networks", There are always "picture people" and "equation people" in DSP" If you look back at the presentation above, you will be able to tell which type or person the current author is

*

*

*

*

*'

*

*

*

*

*

*

REFERENCES

[1J B" Hutchins "Interpolation, Decimation, and Prediction of Digital Signals," Electronotes, Vol" 15, No" 164-167 (Special Issue F), July 1986 (see especially pp 26-30)

[2] M" Bellanger, G" Bonnerot, and M" Condreuse, "Digital filtering in polyphase networks: applications to sample rate alterations and filter banks," IEEE Trans. Acoustices, Speech, and Signal Processing, ASSP-24, pp 109-114, April 1976

[3] p" p" Vaidyanathan, Multirate Systems and Filter Banks, Prentice-Hall (1993) [4J N,J" Fliege, Multirate Digital Signal Processing, Wiley (1994)

[5] B" Hutchins, "Basic Elements of Digital Signal Processing: Filter Element" Electronotes, Vol.. 20, No" 197, April 2001 (Part 1); Vol.. 20, No" 198, June 2001 (Part 2); Vol.. 20, No" 199, Sept 2001 (Part 3)"

BITTERSWEET - Continued from Page 2

Those were times and places" Today it is not all the same"

Trespass on real property is the same, except now the neighbors do it too. A few weeks ago, a person waltzed through my modest "backyard" saying that he did not know it was my land! He thought it was his father's land ~,despite the fact that he had left a mowed lawn, crossed a brook, and managed to cross through an electric fence" (Here was a young man who did not have the advantage of seeing wires strung on insulators.)

Thievery is much better organized, more efficient, and thought of on a grander scale" Witness the various Internet scams that only require one sucker in a million" No one could have done that door-to-door in the past

We have previously mentioned our own difficulties with getting people who publish material on the web to acknowledge the sources, and to observe copyright. Great care with respect to intellectual property is among the very top priorities and proudest traditions in the academic world, As with the country folks relating a story, knowing and relating the academic contributions of others is worthy of the highest marks" We expect, assume, that sources are acknowledged" We may not begin reading by looking at the references, but we notice when they are not there"

The writing ofa text book is somewhat different from the writing of a journal paper, For the most part, the material in a text is not new research (although the presentation and

EN#203(28)

perspective offered may be just as creative)" Any text that is not on the most elementary level should be loaded with references" This is first of all because the author has used materials from other sources to write the text" Few authors could write a text at the level of a college, senior-level course without looking things up, or at least verifying material"

You are obliged to acknowledge" But references do much more than that: in a text book they add additional "dimensions" to the presentation" There is the dimension of "community." It's not just you (the reader) and I (the author) involved here - there are a lot of other folks having fun while better understanding the subject. There is also the dimension of "hlstory" One thing was figured out in 1982 and something additional in 1986" Further, the reference list removes any false perception of boundaries .. The author acknowledges that he/she was not able to tell you everything in one book" There is more to it. We know this because here is this whole list of additional. reading" The reference list even tells the reader what the author recommends"

It would be a surprise to find a text book with no references" It WAS a surprise!

Recently I received a free examination copy of a new DSP text (more on free copies later)" This is not a review of that text, and I am not identifying it here (look for the textbook with no reference if you are really curious). Somehow, very quickly I noticed the lack of any references" The whole book then had a feeling of claustrophobia" What was in the text was now apparently all there is to DSP" The reader is in a trap" There is no community" There was no history" And, just what is the author trying to tell us - that he developed all these ideas? Almost certainly not. While the instructors probably know the origins of the material, the students probably don't (why should they?)" What the author seems to be saying is that he just didn't CARE enough to go to the trouble of doing things right Apparentiy if you want to find the sources, you are expected to get another book" Well-

exactly" .

What about free books? Instructors often get free text books" Some publishers just send sample copies to instructors who just might like it and make it a required text in a course" Other publishers send announcements of new texts and invite instructors to request a free "examination copy." When an instructor does choose a text and a bookstore places an order, the publisher may send the instructor several "desk copies." (These are useful perhaps as home/office copies, or often, to be given to the Teaching Assistants in the course.) What does happen to all these free books?

Many do get put to good use" Many more end up on shelves barely looked at. Would you believe that some instructors (apparently) sell these free books for cash in their own packets! I say that this must happen because there are individuals and companies who solicit these excess books by mailings, web sites, and personal visits to offices" They mention how "discreet" they are, They must be getting some business" One individual comes by my office a couple of times a year, hand cart in tow, and presumably, cash in pocket.. I throw him out of course, and he apologizes and promises never to return" He always comes back" It is encouraging that he conies back, because it must mean that getting thrown out is not a unique or memorable event for him, Presumably, my

EN#203 (29)

colleagues are offering him the same courtesy I am.. My view is that it is never ethical for an instructor to sell a book that he or she got for free ..

EN#203 (30)

Before ending this tirade, many or you have certainly noted that, for the first time since 1972, someone has been using the Electronotes name, and has not been dissuaded by our protests" That "someone" is the TVA (Tennessee Valley Authority), a US government agency, who is using it for some sort of bond or security I believe (I guess their pockets are a bit light!).. I could go on for pages telling you about the battle we have had with them,

but you would think I was making it all up. Their explanations and positions were total nonsense, and they lost the debate" But they won by being lowlife bullies" Actually, they were courteous in conversation; but disdainful in deed" They stole my name" They kept saying things that just kept getting more and more stupid. In some sense, government agencies are usually entertaining in this way, They were fun in a way.. I even gave them

a better name to use: "Damnotes," in recognition of their hydro-power operations" One guy at TVA loved it, and said he wished they had thought of that name,

When the citizen is being trampled on by a government agency, one asks for help from elected officials.. Among others, I wrote four US Senators (Lieberman and Frist as ranking members of the committee that oversees the TVA, and my own NYS senators, Schumer and Clinton)" I only heard from Lieberman and Clinton. The TVA sent Lieberman the same basic nonsense they sent me, and no one at his office followed up, (In fact, his office first sent me two copies of my own letter!) At the very least, we expect that our elected officials will be "messengers" that the bureaucrats have to respond to, But The TVA ignored Clinton" They did not answer her letter!' Well that did it - you know you're toast when your adversary isn't afraid of Hillary!

At one point, I thought I would win, easily, not through any sort of coercion, but just through the requirements of a polite society" A retired professor and friend, himself from Tennessee, upon hearing my story, said that he was sure I would prevail because Southerners are ladies and gehtlemen.. This made sense to me because I knew that country folks do not invade another person's bailiwick, For example, back on the farm Charlie up the road sharpened all the chain saws in the neighborhood.. Yes, he did it better than the rest of us could, and I supposed he liked the extra few bucks he charged, and some wags noted that as he "tested" each of the saws he had sharpened, his woodpile came along accordingly! Sharpening saws was Charlie's bailiwick" He earned the right to have it for himself, You are supposed to respect the work of others .. If you should blunder into someone else's house, apologize and leave quietly.

**************************************'**

ELECTRONOTES, Vol. 21, No" 203, January 2004

Published by B" Hutchins, 1016 Hanshaw Rd, Ithaca, NY 14850

Potrebbero piacerti anche