diff options
author | Chris Robinson <[email protected]> | 2017-08-17 17:47:35 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-08-17 23:21:41 -0700 |
commit | 5048956ff02ec6d84aed2f79c65e4c130adf6e43 (patch) | |
tree | 188709d68d547232665a1fd66ec4e27f7dbb82ea /utils/bsincgen.c | |
parent | 080c0766431f088f83a0ec1463422c6dd208a1f0 (diff) |
Keep bsinc filter quality more consistent between scales
This generates the filters using the proper size and scale. The 'a' divisor
should represent the +/- sample range (and thus be a whole number), with the
number of sample points being double that. Increasing the filter size to a
multiple of 4 (for SIMD) can be done by padding in 0s afterward.
Diffstat (limited to 'utils/bsincgen.c')
-rw-r--r-- | utils/bsincgen.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/utils/bsincgen.c b/utils/bsincgen.c index 87bdd662..138f7a68 100644 --- a/utils/bsincgen.c +++ b/utils/bsincgen.c @@ -161,11 +161,9 @@ static void BsiGenerateTables() for(si = 0; si < BSINC_SCALE_COUNT; si++)
{
const double scale = scaleBase + (scaleRange * si / (BSINC_SCALE_COUNT - 1));
- const double a = MinDouble(BSINC_POINTS_MIN, BSINC_POINTS_MIN / (2.0 * scale));
- int m = 2 * (int)floor(a);
-
- // Make sure the number of points is a multiple of 4 (for SSE).
- m += ~(m - 1) & 3;
+ const double a = MinDouble(floor(BSINC_POINTS_MIN / (2.0 * scale)),
+ BSINC_POINTS_MIN);
+ int m = 2 * (int)a;
mt[si] = m;
at[si] = a;
@@ -241,6 +239,10 @@ static void BsiGenerateTables() }
}
+ // Make sure the number of points is a multiple of 4 (for SIMD).
+ for(si = 0; si < BSINC_SCALE_COUNT; si++)
+ mt[si] = (mt[si]+3) & ~3;
+
// Calculate the table size.
i = 0;
for(si = 0; si < BSINC_SCALE_COUNT; si++)
@@ -331,8 +333,8 @@ static void Sinc4GenerateTables(void) const double scaleBase = width / 2.0;
const double scaleRange = 1.0 - scaleBase;
const double scale = scaleBase + scaleRange;
- const double a = MinDouble(4.0, 4.0 / (2.0*scale));
- const int m = 2 * (int)floor(a);
+ const double a = MinDouble(4.0, floor(4.0 / (2.0*scale)));
+ const int m = 2 * (int)a;
const int l = (m/2) - 1;
int pi;
for(pi = 0;pi < FRACTIONONE;pi++)
|