DSPRelated.com
Forums

interpolator

Started by mishrask March 28, 2012
>On 3/29/12 9:40 AM, mishrask wrote: >> Hi All, >> thanks for the reply ..but my focus while asking the question was
on
>> the meaning of Phases ....Thanks Eric for the reply but still I don't
feel
>> the use of phase word here ...can someone please elaborate on this for >> example earlier I didn't understand the meaning of Phase in polyphase >> filter but now i am clear .... >> >> 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 . >> > >are you making a chip or something? this is running real time? > >are you supplying the clock for the output samples? if yes, then you're >doing synchronous sample rate conversion and your SRC ratio can be a >constant of your chosing. > >but *if* someone *else* supplies the clock for the samples going out, >then you have *asynchronous* SRC and that's a whole 'nother problem. > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." >
It's related to a sample converter design .Ya it is running real time .. I have only one clock in my design running @ say,400KHz..but I can divide the clock (making a clock divider circuit) to use different clocks(of different frequencies) for input sampling and output sampling My design has to be such that it will do a sample rate conversion by a fractional factor of the input sampling rate(which can be anything) Skm
>"mishrask" <sujeet.ismu@n_o_s_p_a_m.gmail.com> writes: > >> Hi All, >> thanks for the reply ..but my focus while asking the question was
on
>> the meaning of Phases ....Thanks Eric for the reply but still I don't
feel
>> the use of phase word here ...can someone please elaborate on this for >> example earlier I didn't understand the meaning of Phase in polyphase >> filter but now i am clear .... > >Fractional sample is often used (as in this case) synonymously with >phase in this context. If you consider the original sequence >corresponding to the integers ... -2, -1, 0, 1, 2, ..., then when you >interpolate (e.g., by two) you produce new values ... -1.5, -0.5, 0.5, >1.5, ... . > >Those are necessarily "fractional samples" since the original >sequence occupies all the integer samples. So we refer to them >as "fractional samples" or "phases" or "sample phases." > >--Randy > > >> >> 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 >> Sujeet >> >> >> >> >>>robert bristow-johnson <rbj@audioimagination.com> writes: >>> >>>> On 3/28/12 10:16 PM, Randy Yates wrote: >>>>> "mishrask"<sujeet.ismu@n_o_s_p_a_m.gmail.com> writes: >>>>> >>>>>> Hi , >>>>>> I was reading a document describing a sample rate converter
.It
>> can >>>>>> do a interpolation by a factor 64x(max)...and says that "it can >> generate up >>>>>> to 64 interpolated phases between input samples"..I understand that
it
>> can >>>>>> put 63 new values (max-interpolation by 64) but what is this phases >> b/w >>>>>> samples??and why it is 64 rather than 63... >>>>> >>>>> Hi michrask, >>>>> >>>>> You are correct. It should say 63, if it's interpolating by a
maximum
>> of >>>>> 64. Marketing got ahold of the write-up... >>>> >>>> or it could be 64 if the fractional times are >>>> >>>> (2*n + 1)/128 for 0 <= n < 64 >>>> >>>> if could also be that the interpolation is not equivalent to a >>>> windowed-sinc function where for when the fractional part of the time >>>> is 0, the output sample is identical to the input sample. if it was >>>> some other interpolation kernel (like what you might get out of a >>>> Parks-McClellan designed brickwall LPF), the you have to compute
every
>>>> output sample, not just the ones that are at "in between" times. >>> >>>Not really. Think about the meaning of the word interpolate; in >>>both the cases you state, you are no longer interpolating. >>>-- >>>Randy Yates >>>DSP/Firmware Engineer >>>919-577-9882 (H) >>>919-720-2916 (C) >> > >-- >Randy Yates >DSP/Firmware Engineer >919-577-9882 (H) >919-720-2916 (C) >
Hi Randy, thanks for clarifying the first part ..plase through some light on the second part ...[and one more question --- can someone please elaborate ----] Regards, Skm
On 3/29/12 12:17 PM, Randy Yates wrote:
> robert bristow-johnson<rbj@audioimagination.com> writes: > >> On 3/29/12 3:52 AM, Randy Yates wrote: >>> robert bristow-johnson<rbj@audioimagination.com> writes: >>> >>>> On 3/28/12 10:16 PM, Randy Yates wrote: >>>>> "mishrask"<sujeet.ismu@n_o_s_p_a_m.gmail.com> writes: >>>>> >>>>>> Hi , >>>>>> I was reading a document describing a sample rate converter .It can >>>>>> do a interpolation by a factor 64x(max)...and says that "it can generate up >>>>>> to 64 interpolated phases between input samples"..I understand that it can >>>>>> put 63 new values (max-interpolation by 64) but what is this phases b/w >>>>>> samples??and why it is 64 rather than 63... >>>>> >>>>> Hi michrask, >>>>> >>>>> You are correct. It should say 63, if it's interpolating by a maximum of >>>>> 64. Marketing got ahold of the write-up... >>>> >>>> or it could be 64 if the fractional times are >>>> >>>> (2*n + 1)/128 for 0<= n< 64 >>>> >>>> if could also be that the interpolation is not equivalent to a >>>> windowed-sinc function where for when the fractional part of the time >>>> is 0, the output sample is identical to the input sample. if it was >>>> some other interpolation kernel (like what you might get out of a >>>> Parks-McClellan designed brickwall LPF), the you have to compute every >>>> output sample, not just the ones that are at "in between" times. >>> >>> Not really. Think about the meaning of the word interpolate; in >>> both the cases you state, you are no longer interpolating. >> >> i think that semantically, sampling at fractional times >> >> (2*n + 1)/128 for 0<= n< 64 >> >> *is* considered "interpolation" if the function you are sampling >> *does* go through the original points at 0 fractional offset (what >> would happen if n = -1/2). but if n is an integer from 0 to 63, you >> have to compute all 64 points. that's the "windowed sinc" design. >> >> if it's resampling something that does not (like if the kernel came >> from some optimal filter design), *then* maybe you can make a semantic >> case that there is no interpolation since the "interpolated" function >> does not go through the original points. not exactly. > > I've written a few so I think I understand all the varieties anbd > possibilities - this is just arguing semantics and pretty much a waste > IMO. Perhaps you're sore about the preamble / synchronization issue we > discussed earlier, which I noticed you never responded to? I'm not sure > why you'd be sore, but your lack of response there, and tone here, lead > me to think you are.
i'm not sore about anything. just trying to cross the i's and dot the t's. if upsampling by a factor of 2, you can have half of your new output samples lie directly on top of the input samples or you can offset it, maybe by a 1/4 sample. if the latter, you must compute 2 output samples for each input sample. if the former, then you have to decide if your interpolation kernel has that output sample exactly equal the input sample or not. if the former, *then* you need only compute one sample and simply pass the other one. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
robert bristow-johnson <rbj@audioimagination.com> writes:
> [...] > i'm not sore about anything. just trying to cross the i's and dot the t's. > > if upsampling by a factor of 2, you can have half of your new output > samples lie directly on top of the input samples or you can offset it, > maybe by a 1/4 sample.
You can, yes, but then I wouldn't call this an interpolator but rather a resampler. Show me one instance of a design that does this, or example of a DSP textbook that defines it this way, while referring to the process as an interpolator. Interpolator, in my dictionary and experience, necessarily means the original input samples are intact. -- Randy Yates DSP/Firmware Engineer 919-577-9882 (H) 919-720-2916 (C)
On 4/1/12 4:46 AM, Randy Yates wrote:
> robert bristow-johnson<rbj@audioimagination.com> writes: >> [...] >> i'm not sore about anything. just trying to cross the i's and dot the t's. >> >> if upsampling by a factor of 2, you can have half of your new output >> samples lie directly on top of the input samples or you can offset it, >> maybe by a 1/4 sample. > > You can, yes, but then I wouldn't call this an interpolator but rather > a resampler.
well, the semantics that i am working with is that "resampler" is the same as "sample rate converter" (even if the SRC ratio approaches 1/1). the OP posted using the word "interpolator" in the Subject: header, but the content is about upsampling by a factor of 64. so perhaps where the semantic difference really lies is "reconstruction" vs. "interpolation". in the context of resampling, reconstruction of the continuous-time signal and interpolation of the discrete samples to define a continuous-time signal is *about* the same thing. i would say the *both* mean the same thing, they both interpolate except that "interpolation" *might* mean additionally that the continuous-time function goes through the original sample points whereas more general "reconstruction" would not insist on that.
> Show me one instance of a design that does this, or example of a DSP > textbook that defines it this way, while referring to the process as an > interpolator. Interpolator, in my dictionary and experience, necessarily > means the original input samples are intact.
okay, i can live with that semantic. then with that semantic, "interpolation" is equivalent to "practical bandlimited reconstruction" where the reconstruction kernel *can* be expressed as a windowed sinc function h(t/T) = sinc(t/T) * w(t) where the value at t=0 is 1 and the value at all other integer multiples of T is 0. even polynomial interpolation will fit this definition. you take whatever impulse response you get and divide by sinc(t/T) for all non-integer t/T and do a 0/0 limit for the instances of t = n*T. now, in that windowed-sinc case, the 64 phase upsampler would need 63 new points calculated to go in between the original samples. whereas if the interpolation kernel was designed, say, by Parks-McClellan, then you will have to compute all 64 points. this difference doesn't really matter when using polyphase interpolation with a factor of 64, but it might make a difference in computational load when upsampling only by 2. i suppose i could dust off an old MATLAB program to illustrate an example. as for the offset by 1/2 of the upsampled sampling period, that may happen more often than you think, Randy. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
robert bristow-johnson <rbj@audioimagination.com> writes:

> On 4/1/12 4:46 AM, Randy Yates wrote: >> robert bristow-johnson<rbj@audioimagination.com> writes: >>> [...] >>> i'm not sore about anything. just trying to cross the i's and dot the t's. >>> >>> if upsampling by a factor of 2, you can have half of your new output >>> samples lie directly on top of the input samples or you can offset it, >>> maybe by a 1/4 sample. >> >> You can, yes, but then I wouldn't call this an interpolator but rather >> a resampler. > > well, the semantics that i am working with is that "resampler" is the > same as "sample rate converter" (even if the SRC ratio approaches > 1/1). > > the OP posted using the word "interpolator" in the Subject: header, > but the content is about upsampling by a factor of 64. > > so perhaps where the semantic difference really lies is > "reconstruction" vs. "interpolation".
Robert, So we now have 5 terms on the table: interpolation resampling sample rate conversion upsampling reconstruction I'm going to resist jumping into a protracted discussion about these terms and simply state that I believe the OP was asking about interpolation, and I believe I answered correctly. 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 Yates DSP/Firmware Engineer 919-577-9882 (H) 919-720-2916 (C)
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. and i like to cross my i's and dot my t's. even on Apr 1. :-) bestest, -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
"mishrask" <sujeet.ismu@n_o_s_p_a_m.gmail.com> writes:

> Hi , > I was reading a document describing a sample rate converter .
What document was that? Is it a public document that we all can see? If not, can you post it to a website somewhere? -- Randy Yates DSP/Firmware Engineer 919-577-9882 (H) 919-720-2916 (C)
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? -- Randy Yates DSP/Firmware Engineer 919-577-9882 (H) 919-720-2916 (C)
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."