|
From: | Marcus Müller |
Subject: | Re: [Discuss-gnuradio] resample ratio for fractional_resampler |
Date: | Mon, 23 Oct 2017 20:10:23 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
Hi Yang, in the case of your resampling ratio being 1/f, with 128/f ∈ ℕ, you end up in a case where you only iterate over a subset of the filters in the MMSE filter bank. That probably has large advantages when it comes to L1 caching on your CPU – there's no need to constantly load new filter coefficients from RAM for every new sample. Speaking in terms of group theory, if you represent your resampling rate rᵣₑₛₐₘₚₗₑ = p/q, with p,q ∈ℕ₀ as rational number, then you can look at two special cases
So, the case where q is a (large) integer factor of 128 and p is small is highly advantageous – and your p=1, q=64 is pretty optimal in that respect (r=1/64): You only alternate between two of the filters. Your second case, r=1/67.5 = 2/135 is the special case "A.", so you go through a very long sequence of filters, thrashing your CPU caches on your way. However, chances are: If you're resampling by a rate of 1/64,
using the "rational resampler" would lead to a better signal,
whilst possibly keeping the computational intensity very much at
bay. So, if you ask me, try whether designing a FIR low pass filter
and using it in a "Decimating FIR Filter" or even "FFT Filter"
with decimation=64 doesn't yield faster results than using the
MMSE resampler with 1/64. For a quick comparison, I came up with
this quick Jupyter notebook: from scipy import signal
import numpy
from matplotlib import pyplot
f=pyplot.figure(figsize=(15,10), dpi=150)
legend = []
for taps_to_decim_ratio in (1, 2, 3, 4, 8, 12, 16):
taps = signal.fir_filter_design.firwin(taps_to_decim_ratio*64, 1./64)
omega, h = signal.freqz(taps, worN=numpy.linspace(0, numpy.pi/31, 1000))
pyplot.plot(omega/numpy.pi*64, 10*numpy.log10(numpy.abs(h)**2))
legend.append("taps/decim {:3d}".format(taps_to_decim_ratio))
pyplot.grid(True)
pyplot.xlabel("$\\frac{f}{f_s} 64$")
pyplot.ylabel("$|\\cdot|^2_{dB}$")
pyplot.ylim((-70,1))
pyplot.legend(legend)
pyplot.tight_layout()
pyplot.show()
On 2017-10-23 17:47, Yang Liu wrote:
|
smime.p7s
Description: S/MIME Cryptographic Signature
[Prev in Thread] | Current Thread | [Next in Thread] |