comparison tests/TestResampler.cpp @ 381:88971211795c

Lower filter cutoff to below target Nyquist when downsampling
author Chris Cannam <c.cannam@qmul.ac.uk>
date Fri, 01 Nov 2013 12:07:08 +0000
parents ad21307eaf99
children fd207df9432e
comparison
equal deleted inserted replaced
380:1494e18439ae 381:88971211795c
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 }