| 1 |
/* Copyright (C) 2015-2022 Sergey V. Mikayev |
| 2 |
* |
| 3 |
* This program is free software: you can redistribute it and/or modify |
| 4 |
* it under the terms of the GNU Lesser General Public License as published by |
| 5 |
* the Free Software Foundation, either version 2.1 of the License, or |
| 6 |
* (at your option) any later version. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef SRCTOOLS_SINC_RESAMPLER_H |
| 18 |
#define SRCTOOLS_SINC_RESAMPLER_H |
| 19 |
|
| 20 |
#include "FIRResampler.h" |
| 21 |
|
| 22 |
namespace SRCTools { |
| 23 |
|
| 24 |
class ResamplerStage; |
| 25 |
|
| 26 |
namespace SincResampler { |
| 27 |
|
| 28 |
ResamplerStage *createSincResampler(const double inputFrequency, const double outputFrequency, const double passbandFrequency, const double stopbandFrequency, const double dbSNR, const unsigned int maxUpsampleFactor); |
| 29 |
|
| 30 |
namespace Utils { |
| 31 |
void computeResampleFactors(unsigned int &upsampleFactor, double &downsampleFactor, const double inputFrequency, const double outputFrequency, const unsigned int maxUpsampleFactor); |
| 32 |
unsigned int greatestCommonDivisor(unsigned int a, unsigned int b); |
| 33 |
} |
| 34 |
|
| 35 |
namespace KaizerWindow { |
| 36 |
double estimateBeta(double dbRipple); |
| 37 |
unsigned int estimateOrder(double dbRipple, double fp, double fs); |
| 38 |
double bessel(const double x); |
| 39 |
void windowedSinc(FIRCoefficient kernel[], const unsigned int order, const double fc, const double beta, const double amp); |
| 40 |
} |
| 41 |
|
| 42 |
} // namespace SincResampler |
| 43 |
|
| 44 |
} // namespace SRCTools |
| 45 |
|
| 46 |
#endif // SRCTOOLS_SINC_RESAMPLER_H |