ogl_beamforming

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

Commit: 856af6bf55ff5fffee540fcdff7d8d0c93f88531
Parent: d21449038388d9fc081277619aa6b506af6f8194
Author: Randy Palamar
Date:   Wed, 26 Aug 2026 06:39:28 -0700

lib: actually move all acquisitions in contrast mode reduction

this was dumb, we were only copying the first acquisition. This
explains why the results were so dim and why we needed to clear
the output memory before copying in contrast data.

Diffstat:
Mbeamformer_shared_memory.c | 2+-
Mlib/ogl_beamformer_lib.c | 16+++++++---------
2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/beamformer_shared_memory.c b/beamformer_shared_memory.c @@ -1,5 +1,5 @@ /* See LICENSE for license details. */ -#define BEAMFORMER_SHARED_MEMORY_VERSION (34UL) +#define BEAMFORMER_SHARED_MEMORY_VERSION (35UL) typedef enum { BeamformerWorkKind_Compute, diff --git a/lib/ogl_beamformer_lib.c b/lib/ogl_beamformer_lib.c @@ -541,15 +541,13 @@ beamformer_push_data_base(void *data, u32 data_size, i32 timeout_ms, u32 block) #undef X }; - // TODO(rnp): HACK: for some unknown reason loading contrast data after loading - // non-contrast data causes the dataset to not be stored correctly (it looks - // like mix of the old and new dataset). Putting this here fixes the issue. - // Counter-intuitively this improves throughput on my zen4 test computer, - // however it obviously should not be needed. - memory_clear(memory, 0, out_channel_stride); - - u32 sample_count = bp->sample_count * beamformer_data_kind_element_count[data_kind]; - reduce_a1s2_fn_table[reduce_a1s2_index_map[data_kind]](memory, (u8 *)data + in_off, sample_count); + u32 sample_count = bp->sample_count * beamformer_data_kind_element_count[data_kind]; + u32 acquisition_stride = sample_count * beamformer_data_kind_element_size[data_kind]; + for (u32 acquisition = 0; acquisition < bp->acquisition_count; acquisition++) { + void *out = memory + acquisition * acquisition_stride; + void *in = (u8 *)data + in_off + 3 * acquisition * acquisition_stride; + reduce_a1s2_fn_table[reduce_a1s2_index_map[data_kind]](out, in, sample_count); + } }break; } }