Mercurial > hg > qm-dsp
comparison tests/TestResampler.cpp @ 156:edb86e0d850c
Lower filter cutoff to below target Nyquist when downsampling
author | Chris Cannam |
---|---|
date | Fri, 01 Nov 2013 12:07:08 +0000 |
parents | 23558405a7d1 |
children | 17a7d6bb9af6 |
comparison
equal
deleted
inserted
replaced
155:529f42b50d81 | 156:edb86e0d850c |
---|---|
195 FFTReal(outrate).forwardMagnitude(maybeSquare.data(), outSpectrum.data()); | 195 FFTReal(outrate).forwardMagnitude(maybeSquare.data(), outSpectrum.data()); |
196 for (int i = 0; i < (int)outSpectrum.size(); ++i) { | 196 for (int i = 0; i < (int)outSpectrum.size(); ++i) { |
197 outSpectrum[i] /= outrate; | 197 outSpectrum[i] /= outrate; |
198 } | 198 } |
199 | 199 |
200 // Don't compare bins any higher than 99% of Nyquist freq of lower sr | 200 // Don't compare bins any higher than 96% of Nyquist freq of lower sr |
201 int lengthOfInterest = (inrate < outrate ? inrate : outrate) / 2; | 201 int lengthOfInterest = (inrate < outrate ? inrate : outrate) / 2; |
202 lengthOfInterest = lengthOfInterest - (lengthOfInterest / 100); | 202 lengthOfInterest = lengthOfInterest - (lengthOfInterest / 25); |
203 | 203 |
204 for (int i = 0; i < lengthOfInterest; ++i) { | 204 for (int i = 0; i < lengthOfInterest; ++i) { |
205 BOOST_CHECK_SMALL(inSpectrum[i] - outSpectrum[i], 1e-7); | 205 BOOST_CHECK_SMALL(inSpectrum[i] - outSpectrum[i], 1e-7); |
206 } | 206 } |
207 } | 207 } |