diff options
author | Chris Robinson <[email protected]> | 2017-08-18 02:48:32 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-08-18 02:48:32 -0700 |
commit | fdd5070c3b1945eec3553e5395faf1a99c5883f3 (patch) | |
tree | 586ab37375720faf112a065cb182899819fccfb1 | |
parent | 5048956ff02ec6d84aed2f79c65e4c130adf6e43 (diff) |
"Unfix" the filter length calculation
Partially reverts 3f3a3ac4f1d069542ca2399a8b5e63d9d1a4df3b. The l*2 + 1 is
correct when you want an odd number of sample points, which avoids an
unnecessary phase offset in the fitler. However, the rounding is still needed
to calculating the left offset (l), or else the transition width can increase
with an odd-numbered order.
-rw-r--r-- | utils/makehrtf.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/utils/makehrtf.c b/utils/makehrtf.c index c9c2d10c..1447e9ee 100644 --- a/utils/makehrtf.c +++ b/utils/makehrtf.c @@ -1296,11 +1296,11 @@ static void ResamplerSetup(ResamplerT *rs, const uint srcRate, const uint dstRat cutoff = 0.475 / rs->mQ; width = 0.05 / rs->mQ; } - // A rejection of -180 dB is used for the stop band. Round up the order to - // keep the transition width from growing. + // A rejection of -180 dB is used for the stop band. Round up when + // calculating the left offset to avoid increasing the transition width. l = (CalcKaiserOrder(180.0, width)+1) / 2; beta = CalcKaiserBeta(180.0); - rs->mM = (l+1) * 2; + rs->mM = l*2 + 1; rs->mL = l; rs->mF = CreateArray(rs->mM); for(i = 0;i < ((int)rs->mM);i++) |