ogl_beamforming

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

Commit: 9b8f6157ec59ab7877cee2bef9538c8161682a28
Parent: 9959704e88e5abbfa34476e41a1304808bcff4af
Author: Randy Palamar
Date:   Sun, 18 May 2025 17:22:43 -0600

das: make cubic equation read closer to linked reference

ours still looks different simply because we are doing 2
interpolations in parallel (one for the real data (in-phase) and
one for the complex data (quadrature))

also this is consistently faster by ~8ms per frame on my desktop.
I'm guessing the driver is better able to optimize this when it is
properly stated as a series of matrix multiplications instead of
decomposed dot products.

Diffstat:
Mshaders/das.glsl | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/shaders/das.glsl b/shaders/das.glsl @@ -26,7 +26,7 @@ vec2 cubic(int ridx, float x) ); int xk = int(floor(x)); - float t = (x - float(xk)); + float t = x - floor(x); vec4 S = vec4(t * t * t, t * t, t, 1); vec2 P1 = rf_data[ridx + xk]; @@ -34,9 +34,8 @@ vec2 cubic(int ridx, float x) vec2 T1 = C_SPLINE * (P2 - rf_data[ridx + xk - 1]); vec2 T2 = C_SPLINE * (rf_data[ridx + xk + 2] - P1); - vec4 C1 = vec4(P1.x, P2.x, T1.x, T2.x); - vec4 C2 = vec4(P1.y, P2.y, T1.y, T2.y); - return vec2(dot(S, h * C1), dot(S, h * C2)); + mat2x4 C = mat2x4(vec4(P1.x, P2.x, T1.x, T2.x), vec4(P1.y, P2.y, T1.y, T2.y)); + return S * h * C; } vec2 sample_rf(int ridx, float t)