On 8/24/15 11:18 AM, Sampo Syreeni wrote:
On 2015-08-19, Ethan Duni wrote:
and it doesn't require a table of coefficients, like doing
higher-order Lagrange or Hermite would.
Robert I think this is where you lost me. Wasn't the premise that memory
was cheap, so we can store a big prototype FIR for high quality 512x
oversampling?
that was my premise for using linear interpolation *between* adjacent
oversampled (by 512x) samples. if you can, with optimal coefficients
designed with the tool of your choice, so i am ignoring any images
between B and Nyquist-B, upsample by 512x and then do linear
interpolation between adjacent samples for continuous-time
interpolation, you can show that it's something like 12 dB S/N per
octave of oversampling plus another 12 dB. that's 120 dB. that's how i
got to 512x. some apps where you might care less about inharmonic
energy from images folding over (a.k.a. "aliasing"), you might not need
to go that high of whatever-x.
but the difference in price in memory only, *not* in computational
burden. whether it's 64x or 512x, the computational cost is separating
the index into integer and fractional parts, using the integer part to
select the N samples to combine and the fractional part to tell you how
to combine them. if it's 512x, the fractional part is broken up into
the top 9 bits to select your N coefficients (and the neighboring set of
N coefficients) and the rest of the bits are for the linear
interpolation. with only the cost of a few K of words (i remember the
days when 4K was a lotta memory :-), you can get to arbitrarily good
with the cost of 2N+1 MAC instructions.
with drop-sample interpolation between fractional delays (6 dB per
octave of oversampling), then you need another 10 octaves of
oversampling, 512K*N words of memory, but only N MAC instructions per
output sample.
when it's using Hermite or Lagrange then the S/N is 24 dB per octave of
oversampling, i don't think it's worth it that you need only 16x or 32x
oversampling (that saves only memory and the cost of computation becomes
4 times worse or worser). maybe in an ASIC or an FPGA, but in DSP code
or regular-old software, i don't see the advantage of cubic or
higher-order interpolation unless memory is *really* tight and you gotta
lotta MIPs to burn.
In my (admittedly limited) experience these sorts of tradeoffs come
when you need to resample generally, so not just downwards from the
original sample rate but upwards as well, and you're doing it all on a
dedicated DSP chip.
In that case, when your interpolator approaches and goes beyond the
Nyquist frequency of the original sample, you need longer and longer
approximations of the sinc(x) response,
you need that to get sharper and sharper brick-wall LPFs to whack those
511 images in between the baseband and 512x.
then the sinc^2 function in the linear interpolation blasts the hell
outa all them images that are at multiples of 512x (except the 0th
multiple of course). drop-sample interpolation would have only a sinc
function doing it whereas and Mth-order B-spline would have a sinc^(M+1)
function really blasting the hell outa them images.
with wonkier and wonkier recursion formulas for online calculation of
the coefficients of the interpolating polynomial. Simply because of
aliasing suppression, and because you'd like to calculate the
coefficients on the fly to save on memory bandwidth.
However, if you suitably resample both in the output sampling
frequency and in the incoming one, you're left with some margin as far
as the interpolator goes, and it's always working downwards, so that
it doesn't actually have to do aliasing suppression. An arbitrary low
order polynomial is easier to calculate on the fly, then.
The crucial part on dedicated DSP chips is that they can generate
radix-2 FFT coefficients basically for free, with no table lookup
yeah, but you get accumulated errors as you compute the twiddle factors
on-the-fly. either in linear or bit-reversed order.
and severely accelerated inline computation as well. That means that
you can implement both the input and the output side
anti-aliasing/anti-imaging filters via polyphase Fourier methods,
the way that Bob Adams did it, with a single side (the input side) was
to step through the sinc-like LPF impulse response at smaller steps (and
interpolate) to LPF the input further for down-sampling.
admittedly, i haven't worried about the natural foldover from
downsampling and just assume there wasn't stuff below the original
Nyquist that you had to worry about. or maybe my optimal filter kernel
started to whack stuff at a frequency below 20 kHz. but i didn't change
it for downsampling. i guess i was lazy.
for much less effort than the intervening arbitrary interpolation step
would ever require. When you do that right, the code is still rather
complex since it needs to dynamically "mipmap" the input sample for
larger shifts in frequency, but when done right, you can also get
essentially perfect and perfectly flexible results from a signal chain
with perhaps 3x the computational load of a baseband third order
interpolation polynomial, absent hardware acceleration.
--
r b-j r...@audioimagination.com
"Imagination is more important than knowledge."
_______________________________________________
music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp