DSPRelated.com
Forums

interpolator

Started by mishrask March 28, 2012
>On 4/2/12 2:16 AM, Randy Yates wrote: >> robert bristow-johnson<rbj@audioimagination.com> writes: >> >>> On 4/2/12 12:28 AM, Randy Yates wrote: >>>> >>>> If you think, limiting our discussion to interpolation, that my >>>> answer was misleading or otherwise not i-dotted or t-crossed, I >>>> would like to hear why. >>> >>> Randy, i was only trying to respond to the OP's original question in >>> my first post of 3/28/12 11:22 PM (EDT). i wasn't trying to say you >>> or anyone was wrong or misleading, only to offer two different >>> explanations for why, for a sample rate converter that upsamples by a >>> factor of 64, why it may have to compute 64 new output samples (per >>> input sample) rather than 63. for either of two different reasons >>> (and there may be other reasons, i dunno), it might not simply pass >>> that one value while computing 63 more. it might very well have to >>> compute 64. and i can think of two reasons why. >> >> Do you know of any instances of actual sample rate converters that,
when
>> interpolating by 64, operate this way? > >yes, i believe that the *majority* of audio sample rate converters, have >polyphase filter kernels that are designed using something like >Parks-McClellan (firpm() in MATLAB) or least squares (firls() in >MATLAB), *not* a Kaiser (or any other) windowed sinc. maybe all of them. > >what this means is (setting aside the issue of constant delay), that >even if the output sampling instance lands directly on top of an input >sampling instance, you will *not* get a set of coefficients that look
like:
> > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > >in the polyphase filter. it's only when you come upon a set of >coefficients that look like that that you are able to just pass the >input sample over to the output unprocessed. > >now you *will* get a coefficient set that looks like that (for only one >phase, of course) if your design technique for that ideal brickwall LPF >is done with a Kaiser windowed sinc() or if you are using Lagrange or >Hermite (not B-spline) polynomial interpolation. but, i am quite sure >that, to get the same stopband performance, your Kaiser windowed impulse >response will have to be longer than either P-McC or LS. > >now, the one case where i think (from my limited experience) a >windowed-sinc will do you better, from a computational POV, is (usually >in a software DSP block, i don't think anyone makes a hardware device >that is so simple and specific) in a simple doubling of the sample rate: >one sample goes in, two samples come out. now, even if the impulse >response has to be a little longer, if it's windowed-sinc, that longer >set of coefficients only matters for the one output sample that lies >halfway between two input samples, and (only for windowed-sinc) the >other output sample may simply be an input sample (delayed in the >buffer) copied over. so then you are computing N-1 samples in between >the input samples. you get, say, 40% more coefficients to calculate >that one sample but you needed *no* computation for the other. i have >seen and done this myself for software products where we needed to >upsample right away, do a little processing at the higher rate, and then >decimate right back in the output. but even if the upsampling ratio is >as low as 4, it's not worth it to go with windowed sinc(), because 3 out >of 4 output samples have a 40% longer FIR than they would need if it was >P-McC or LS. > >now that's reason #1. > >reason #2 might be useful for a chip design because if you can cut the >chip area for holding the coefficients in half. we know there is a >symmetry in the coefficient set that can be taken advantage of. in this >case where the fractional times are: > > n/64 for 0 <= n < 64 > >we know that the coefficient set for n=1 is just like the set for n=63 >except reversed in order. same for n=31 and n=33. and that symmetry >can be taken advantage of with a little code. but the set for n=0 and >n=32 do not have any other sets that are simple reflections. now, in >any case the n=32 set would have perfect symmetry about the center and, >if you are doing windowed-sinc(), the n=0 set would be all 0s except for >one 1. > >but if you define your 64 output fractional times to be: > > (2*n + 1)/128 for 0 <= n < 64 > >the n=0 set is a reflection of the n=63 set. the n=1 set is a >reflection of the n=62 set, and the n=31 set is a reflection of the n=32 >set. each polyphase coefficient set has an exact reflection of another >set that can be easily determined. it cuts the number of coefficients >stored in ROM in half and the indexing scheme is simpler (no exceptions >for n=0 and n=32). > >that's reason #2. now, i don't *know* that any SRC chip manufacturer is >doing that (like Cirrus or ADI), but i think saving real estate on >silicon would be a useful thing for them to do. and i can't believe >that someone like Bob Adams (dunno his counterpart at Crystal/Cirrus) >wouldn't also have seen this. i wouldn't mind if Bob might comment >about that. > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > > >
Hi All , This is not a public document but still I will try to put as much details as i can here .But my focus was on something else ..I have to implement it in hardware (Verilog,it's part of an ASIC).I request you and others also to please try to answer my ignored Qs ---- "and one more question --- can someone please elaborate on the clock requirements in a sample rate converter with a suitable example [sampling rate and clock rates say for SRC by factor of 1.3564] (I didn't get any reference about this ,so please give if you know.The books I have referred to are dsp books and they don't at all talk about the clock rates) .... Lets' say I have a single clock in my design ,then do I need to divide the clock and use different clocks for i/p and o/p(in this case how to go about for like SRC by 1.765 factor)...or some other way is there ." Regards, SKm
robert bristow-johnson <rbj@audioimagination.com> writes:
> [...]
Thanks for that Robert. Truly. I had not seen that the 2n + 1 trick results in symmetry. And I do agree that PM or FIRLS is going to give you a better stopband response than windowed-sinc for a given filter length. In fact I should be correcting our system engineers' filters (which are <guess what?> windowed sincs), but I'm so busy cranking out code I don't have time! So it appears that I must retract my blanket assertion to mishrask - there are common cases where all 64 phases are interpolated for a x64 upsampler. -- Randy Yates DSP/Firmware Engineer 919-577-9882 (H) 919-720-2916 (C)
On Sun, 01 Apr 2012 23:28:00 -0500, Randy Yates
<yates@digitalsignallabs.com> wrote:

   [Snipped by Lyons]
> >So we now have 5 terms on the table: > > interpolation > resampling > sample rate conversion > upsampling > reconstruction >
Hi Randy, I haven't carefully followed the details of this thread, but I'll support you in saying that the terminology of "sample rate change" has caused troubles for both practitioners and readers. So many words, terms, mean one thing to one person and another thing to another person. Because of this confusion and misunderstandings abound. [-Rick-]
Rick Lyons <R.Lyons@_BOGUS_ieee.org> writes:

> On Sun, 01 Apr 2012 23:28:00 -0500, Randy Yates > <yates@digitalsignallabs.com> wrote: > > [Snipped by Lyons] >> >>So we now have 5 terms on the table: >> >> interpolation >> resampling >> sample rate conversion >> upsampling >> reconstruction >> > > Hi Randy, > I haven't carefully followed the details of this > thread, but I'll support you in saying that the > terminology of "sample rate change" has caused troubles > for both practitioners and readers. So many words, > terms, mean one thing to one person and another > thing to another person. Because of this confusion > and misunderstandings abound.
Hey Rick, Ayup. I still feel a bit uneasy when I try to discern the difference between "upsampler" and "interpolator." Isn't upsampling by M just inserting M-1 zeros between samples? And yet we throw it around as if it were synonymous with "interpolator." (Or at least I do...) -- Randy Yates DSP/Firmware Engineer 919-577-9882 (H) 919-720-2916 (C)
On Wed, 04 Apr 2012 14:21:06 -0500, Randy Yates
<yates@digitalsignallabs.com> wrote:

>Rick Lyons <R.Lyons@_BOGUS_ieee.org> writes: > >> On Sun, 01 Apr 2012 23:28:00 -0500, Randy Yates >> <yates@digitalsignallabs.com> wrote: >> >> [Snipped by Lyons] >>> >>>So we now have 5 terms on the table: >>> >>> interpolation >>> resampling >>> sample rate conversion >>> upsampling >>> reconstruction >>> >> >> Hi Randy, >> I haven't carefully followed the details of this >> thread, but I'll support you in saying that the >> terminology of "sample rate change" has caused troubles >> for both practitioners and readers. So many words, >> terms, mean one thing to one person and another >> thing to another person. Because of this confusion >> and misunderstandings abound. > >Hey Rick, > >Ayup. I still feel a bit uneasy when I try to discern the difference >between "upsampler" and "interpolator." Isn't upsampling by M just >inserting M-1 zeros between samples? And yet we throw it around >as if it were synonymous with "interpolator." (Or at least I do...) >-- >Randy Yates >DSP/Firmware Engineer >919-577-9882 (H) >919-720-2916 (C)
It's also been discussed here previously that a decimator can "interpolate", too, if the output samples are between input samples, which is a very practical case (e.g., an even number of taps in a symmetric decimating FIR filter). Personally, I kind of like that the industry is not super-anal and/or legalistic about terminology, as it encourages people to talk about concepts just to ensure clarity. Eric Jacobsen Anchor Hill Communications www.anchorhill.com
On 4/4/2012 3:21 PM, Randy Yates wrote:
> Rick Lyons<R.Lyons@_BOGUS_ieee.org> writes: > >> On Sun, 01 Apr 2012 23:28:00 -0500, Randy Yates >> <yates@digitalsignallabs.com> wrote: >> >> [Snipped by Lyons] >>> >>> So we now have 5 terms on the table: >>> >>> interpolation >>> resampling >>> sample rate conversion >>> upsampling >>> reconstruction >>> >> >> Hi Randy, >> I haven't carefully followed the details of this >> thread, but I'll support you in saying that the >> terminology of "sample rate change" has caused troubles >> for both practitioners and readers. So many words, >> terms, mean one thing to one person and another >> thing to another person. Because of this confusion >> and misunderstandings abound. > > Hey Rick, > > Ayup. I still feel a bit uneasy when I try to discern the difference > between "upsampler" and "interpolator." Isn't upsampling by M just > inserting M-1 zeros between samples? And yet we throw it around > as if it were synonymous with "interpolator." (Or at least I do...)
I'd be willing to wager that it's only part of what you do. First you insert the zeros, but I can't imagine that you leave it at that. Don't you filter afterward? The filter interpolates for sure. Have you ever checked that it doesn't alter the original sample? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Jerry Avins <jya@ieee.org> writes:

> On 4/4/2012 3:21 PM, Randy Yates wrote: >> Rick Lyons<R.Lyons@_BOGUS_ieee.org> writes: >> >>> On Sun, 01 Apr 2012 23:28:00 -0500, Randy Yates >>> <yates@digitalsignallabs.com> wrote: >>> >>> [Snipped by Lyons] >>>> >>>> So we now have 5 terms on the table: >>>> >>>> interpolation >>>> resampling >>>> sample rate conversion >>>> upsampling >>>> reconstruction >>>> >>> >>> Hi Randy, >>> I haven't carefully followed the details of this >>> thread, but I'll support you in saying that the >>> terminology of "sample rate change" has caused troubles >>> for both practitioners and readers. So many words, >>> terms, mean one thing to one person and another >>> thing to another person. Because of this confusion >>> and misunderstandings abound. >> >> Hey Rick, >> >> Ayup. I still feel a bit uneasy when I try to discern the difference >> between "upsampler" and "interpolator." Isn't upsampling by M just >> inserting M-1 zeros between samples? And yet we throw it around >> as if it were synonymous with "interpolator." (Or at least I do...) > > I'd be willing to wager that it's only part of what you do.
Hi Jerry, You're making my (and I think Rick's) point. What is the definition of "upsample?" In Rick's third edition , he defines it as simply the zero insertion step (i.e., without filtering). The old chestnut "Multirate Digital Signal Processing" (Crochiere and Rabiner) calls it "sample rate expansion." Etc., etc., etc. I see Eric's point about talking it out, but can't we have the best of both worlds? Define them AND talk about it?!? --Randy -- Randy Yates DSP/Firmware Engineer 919-577-9882 (H) 919-720-2916 (C)
On Thu, 05 Apr 2012 18:02:37 -0500, Randy Yates
<yates@digitalsignallabs.com> wrote:

>Jerry Avins <jya@ieee.org> writes: > >> On 4/4/2012 3:21 PM, Randy Yates wrote: >>> Rick Lyons<R.Lyons@_BOGUS_ieee.org> writes: >>> >>>> On Sun, 01 Apr 2012 23:28:00 -0500, Randy Yates >>>> <yates@digitalsignallabs.com> wrote: >>>> >>>> [Snipped by Lyons] >>>>> >>>>> So we now have 5 terms on the table: >>>>> >>>>> interpolation >>>>> resampling >>>>> sample rate conversion >>>>> upsampling >>>>> reconstruction >>>>> >>>> >>>> Hi Randy, >>>> I haven't carefully followed the details of this >>>> thread, but I'll support you in saying that the >>>> terminology of "sample rate change" has caused troubles >>>> for both practitioners and readers. So many words, >>>> terms, mean one thing to one person and another >>>> thing to another person. Because of this confusion >>>> and misunderstandings abound. >>> >>> Hey Rick, >>> >>> Ayup. I still feel a bit uneasy when I try to discern the difference >>> between "upsampler" and "interpolator." Isn't upsampling by M just >>> inserting M-1 zeros between samples? And yet we throw it around >>> as if it were synonymous with "interpolator." (Or at least I do...) >> >> I'd be willing to wager that it's only part of what you do. > >Hi Jerry, > >You're making my (and I think Rick's) point. What is the definition of >"upsample?" In Rick's third edition , he defines it as simply the >zero insertion step (i.e., without filtering). The old chestnut >"Multirate Digital Signal Processing" (Crochiere and Rabiner) calls >it "sample rate expansion." Etc., etc., etc. > >I see Eric's point about talking it out, but can't we have the >best of both worlds? Define them AND talk about it?!?
I think not practically, because there's no central authority to define it and too many people use the terms differently. In other words, I don't see how it can happen practically. Eric Jacobsen Anchor Hill Communications www.anchorhill.com
On 4/5/12 7:42 PM, Eric Jacobsen wrote:
> On Thu, 05 Apr 2012 18:02:37 -0500, Randy Yates > <yates@digitalsignallabs.com> wrote: > >> Jerry Avins<jya@ieee.org> writes: >> >>> On 4/4/2012 3:21 PM, Randy Yates wrote: >>>> Rick Lyons<R.Lyons@_BOGUS_ieee.org> writes: >>>> >>>>> On Sun, 01 Apr 2012 23:28:00 -0500, Randy Yates >>>>> <yates@digitalsignallabs.com> wrote: >>>>> >>>>> [Snipped by Lyons] >>>>>> >>>>>> So we now have 5 terms on the table: >>>>>> >>>>>> interpolation >>>>>> resampling >>>>>> sample rate conversion >>>>>> upsampling >>>>>> reconstruction >>>>>> >>>>>
>>>>> I haven't carefully followed the details of this >>>>> thread, but I'll support you in saying that the >>>>> terminology of "sample rate change" has caused troubles >>>>> for both practitioners and readers. So many words, >>>>> terms, mean one thing to one person and another >>>>> thing to another person. Because of this confusion >>>>> and misunderstandings abound. >>>>
>>>> Ayup. I still feel a bit uneasy when I try to discern the difference >>>> between "upsampler" and "interpolator." Isn't upsampling by M just >>>> inserting M-1 zeros between samples? And yet we throw it around >>>> as if it were synonymous with "interpolator." (Or at least I do...) >>> >>> I'd be willing to wager that it's only part of what you do.
i'm with Jerry. equating zero-stuffing with "upsampling" is, in my intolerant opinion, a misuse of semantic. zero-stuffing is really just a conceptual step. nobody actually does that. (you could if you were using an IIR LPF for reconstruction, but any efficient code would not do that. you would send the IIR one sample, then you would just let the feedback portion of the IIR do its thing for N-1 more samples assuming zero input.)
>> >> You're making my (and I think Rick's) point. What is the definition of >> "upsample?" In Rick's third edition , he defines it as simply the >> zero insertion step (i.e., without filtering). The old chestnut >> "Multirate Digital Signal Processing" (Crochiere and Rabiner) calls >> it "sample rate expansion." Etc., etc., etc. >> >> I see Eric's point about talking it out, but can't we have the >> best of both worlds? Define them AND talk about it?!? > > I think not practically, because there's no central authority to > define it and too many people use the terms differently. In other > words, I don't see how it can happen practically. >
for me, it's like the meaning of "Nyquist frequency". even though it is not used by everyone, there really is only one correct definition. how'zat for tossing fuel on the flame? the constant reference here is the bandlimited signal, x(t), that is adequately represented by the original samples, x[n]: +inf x(t) = SUM{ x[n] * sinc(t-n) } n=-inf that's different from saying that it's the samples themselves (which is what the zero-stuffing meaning of "upsampling" says). "upsampling", "downsampling", "resampling", "sample rate conversion" are about the same thing that you do to those original samples. samples go in and samples come out. "downsampling" might imply low-pass filtering or suffering the consequences of aliasing. "decimation" is simply picking out 1 sample out of every N. "reconstruction" or "interpolation" means discrete samples, x[n], going in and continuous-time signal, y(t), coming out. because "interpolation" had meaning before digital signal processing existed, i might grant that the word means a particular kind of reconstruction that implies the c.t. signal goes through the original sample points. more general practical reconstruction would not necessarily do that. i think, for linear reconstruction, that "interpolation" with that extra meaning would imply that your reconstruction impulse response has to be some kinda windowed sinc(). and Lagrange and Hermite polynomial interpolation can be put into a form of a windowed sinc(). another application of all this (besides SRC) is a precision delay for whatever reason: y(t - tau) tau > 0 where y(t) = x(t) + error +inf = SUM{ x[m] * h(t-m) } m=-inf if h(t) has finite length (as it does for polyphase FIR), then that summation is finite. the output of the precision delay is y[n] = y(n-tau) = SUM{ x[n-m] * h(tau+m) } with whatever finite limits on the summation. (lot'sa fun making comb filters outa a precision delay.) so then you still have the windowed-sinc() vs. more general reconstruction issues underneath, but it's one thing to resample at the same rate a reconstructed signal (but at a precisely delayed time) and it's another thing to resample that at a different rate (which is SRC). for the former, it's just a filter and you don't get aliasing noise, but the variation of phase linearity and amplitude may be issues to quantify if your delay is slowly modulated. for the latter (SRC), then the precision delay is wildly modulated all over the place and you have to model what's going on differently to quantify how well it's working. when i think of it, i want to quantify how well beaten down the images are and i assume they are all folded back into the passband. i'm just saying this to spell out where i might use the terms "reconstruction" and "interpolation" in a context other than sample rate conversion. but those are about the only two broad applications i'm aware of about the whole Nyquist/Shannon bandlimited interpolation filtering polyphase resampling thing. (any other buzzwords to toss at it?) -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On 4/2/12 11:00 PM, Randy Yates wrote:
> robert bristow-johnson<rbj@audioimagination.com> writes: >> [...] > > Thanks for that Robert. Truly.
yer welcome Randy. i was hoping that Bob Adams (who sometimes visits these parts) might see his name in the subject header and pipe in on this. i really don't know fer sure what he did with coefficients, but i seem to remember he had 64-tap polyphase FIRs in the AD1890. how many phases he used, i dunno. i usually say you need 512 phases if you linearly interpolate and 512K phases if you don't interpolate at all (to get 130 dB S/N). -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."