1
0
Fork 0

Fix normalization in biquad->LP FIR conversion

This commit is contained in:
Robbert van der Helm 2022-06-07 01:29:53 +02:00
parent dd18c7a08a
commit 50317baba2

View file

@ -379,7 +379,7 @@ impl FirCoefficients {
// Since this final filter will be symmetrical around `impulse_response[CENTER_IDX]`, we // Since this final filter will be symmetrical around `impulse_response[CENTER_IDX]`, we
// can simply normalize based on that fact: // can simply normalize based on that fact:
let would_be_impulse_response_sum = let would_be_impulse_response_sum =
impulse_response.iter().skip(CENTER_IDX - 1).sum::<f32x2>() * f32x2::splat(2.0) (impulse_response.iter().skip(CENTER_IDX).sum::<f32x2>() * f32x2::splat(2.0))
- impulse_response[CENTER_IDX]; - impulse_response[CENTER_IDX];
let would_be_impulse_response_recip = would_be_impulse_response_sum.recip(); let would_be_impulse_response_recip = would_be_impulse_response_sum.recip();
for sample in &mut impulse_response { for sample in &mut impulse_response {