ogl_beamforming

Ultrasound Beamforming Implemented with OpenGL
git clone anongit@rnpnr.xyz:ogl_beamforming.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

Commit: 0fd7940791ef6adb20d1d20cfaf793466da9910b
Parent: f17aaa4d896dc496e4f84f8d5f0494565fe57261
Author: Randy Palamar
Date:   Sat, 26 Jul 2025 15:22:42 -0600

math: fix sharp edge in low pass filter for even lengths

grug knows that sin(x)/x = 1 @ x = 0 but sin(ax)/x = a @ x = 0.

This is on signal processing textbooks for being sloppy about sinc(x).

Diffstat:
Mmath.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/math.c b/math.c @@ -132,7 +132,7 @@ kaiser_low_pass_filter(Arena *arena, f32 cutoff_frequency, f32 sampling_frequenc for (i32 n = 0; n < length; n++) { f32 t = (f32)n - a; - f32 impulse = !f32_cmp(t, 0) ? sin_f32(wc * t) / t : 1; + f32 impulse = !f32_cmp(t, 0) ? sin_f32(wc * t) / t : wc; t = t / a; f32 window = (f32)cephes_i0(beta * sqrt_f32(1 - t * t)) / pi_i0_b; result[n] = impulse * window;