commit ef6ba251acc2021bb54ab156e027a6660940fffe
parent 6f042bf7133b9289888fe3d4a704e46e2b4ecf8a
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date: Mon, 26 Jun 2023 04:29:49 +0100
Fix zero-padding in SRC
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/kfr/dsp/sample_rate_conversion.hpp b/include/kfr/dsp/sample_rate_conversion.hpp
@@ -207,14 +207,16 @@ public:
else if (input_start >= input_position)
{
output[i] =
- dotproduct(input.slice(input_start - input_position, depth), tap_ptr.truncate(depth));
+ dotproduct(truncate(padded(input.slice(input_start - input_position, depth)), depth),
+ tap_ptr.truncate(depth));
}
else
{
const itype prev_count = input_position - input_start;
output[i] =
dotproduct(delay.slice(size_t(depth - prev_count)), tap_ptr.truncate(prev_count)) +
- dotproduct(input.truncate(size_t(depth - prev_count)),
+ dotproduct(truncate(padded(input.truncate(size_t(depth - prev_count))),
+ size_t(depth - prev_count)),
tap_ptr.slice(size_t(prev_count), size_t(depth - prev_count)));
}
}