diff options
Diffstat (limited to 'utils/bsincgen.c')
-rw-r--r-- | utils/bsincgen.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/utils/bsincgen.c b/utils/bsincgen.c index 76047968..657c78ca 100644 --- a/utils/bsincgen.c +++ b/utils/bsincgen.c @@ -47,6 +47,7 @@ #define BSINC_REJECTION (60.0)
#define BSINC_POINTS_MIN (12)
+#define BSINC_ORDER (11)
static double MinDouble(double a, double b)
{ return (a <= b) ? a : b; }
@@ -147,7 +148,7 @@ static void BsiGenerateTables() band, but it may vary due to the linear interpolation between scales
of the filter.
*/
- width = CalcKaiserWidth(BSINC_REJECTION, BSINC_POINTS_MIN);
+ width = CalcKaiserWidth(BSINC_REJECTION, BSINC_ORDER);
beta = CalcKaiserBeta(BSINC_REJECTION);
scaleBase = width / 2.0;
scaleRange = 1.0 - scaleBase;
@@ -242,19 +243,19 @@ static void BsiGenerateTables() i += 4 * BSINC_PHASE_COUNT * mt[si];
fprintf(stdout, "/* Generated by bsincgen, do not edit! */\n\n"
-"/* Table of windowed sinc coefficients and deltas. This 11th order filter\n"
-" * has a rejection of -60 dB, yielding a transition width of ~0.302\n"
+"/* Table of windowed sinc coefficients and deltas. This %dth order filter\n"
+" * has a rejection of -%gdB, yielding a transition width of ~%.3f\n"
" * (normalized frequency). Order increases when downsampling to a limit of\n"
" * one octave, after which the quality of the filter (transition width)\n"
" * suffers to reduce the CPU cost. The bandlimiting will cut all sound after\n"
-" * downsampling by ~2.73 octaves.\n"
+" * downsampling by ~%.2f octaves.\n"
" */\n"
"static const struct {\n"
" alignas(16) const float Tab[%d];\n"
" const float scaleBase, scaleRange;\n"
" const int m[BSINC_SCALE_COUNT];\n"
" const int filterOffset[BSINC_SCALE_COUNT];\n"
-"} bsinc = {\n", i);
+"} bsinc = {\n", BSINC_ORDER, BSINC_REJECTION, width, log2(1.0/scaleBase), i);
fprintf(stdout, " /* Tab */ {\n");
for(si = 0; si < BSINC_SCALE_COUNT; si++)
@@ -321,7 +322,7 @@ static void Sinc4GenerateTables(void) {
static double filter[FRACTIONONE][4];
- const double width = CalcKaiserWidth(BSINC_REJECTION, 4);
+ const double width = CalcKaiserWidth(BSINC_REJECTION, 3);
const double beta = CalcKaiserBeta(BSINC_REJECTION);
const double scaleBase = width / 2.0;
const double scaleRange = 1.0 - scaleBase;
|