ogl_beamforming

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

Commit: b43c2936d5df2d6cdf3a2e605a3defd3dbd58ce7
Parent: dd5c899bbbb6b5932a856c66a992b0dbe8a5ca15
Author: Randy Palamar
Date:   Tue, 24 Mar 2026 07:39:42 -0600

tests/throughput: small corrections for HeaderV2

* data_size for throughput measurement was incorrect.
  I'm not sure why sizeof(*data) is valid when data is
  a void * but the compiler doesn't seem to complain.
* demodulation frequency should not be set to 0 based on
  the data type. This needs to be stored in the saved parameters
  if it is the expected usage. The file may have data saved at
  baseband in which case the demodulation frequency is still
  needed for beamforming.
* Kaiser filter was supposed to have the commented out cutoff

Diffstat:
Mtests/throughput.c | 12++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/tests/throughput.c b/tests/throughput.c @@ -238,15 +238,10 @@ beamformer_simple_parameters_from_zbp_file(BeamformerSimpleParameters *bp, char bp->acquisition_kind = header->acquisition_mode; bp->decode_mode = header->decode_mode; bp->sampling_frequency = header->sampling_frequency; + bp->demodulation_frequency = header->demodulation_frequency; bp->speed_of_sound = header->speed_of_sound; bp->time_offset = header->time_offset; - bp->demodulation_frequency = header->demodulation_frequency; - if (header->raw_data_kind == ZBP_DataKind_Float32Complex || - header->raw_data_kind == ZBP_DataKind_Float16Complex || - header->raw_data_kind == ZBP_DataKind_Int16Complex) - bp->demodulation_frequency = 0; - if (header->channel_mapping_offset != -1) { mem_copy(bp->channel_mapping, raw.data + header->channel_mapping_offset, sizeof(*bp->channel_mapping) * bp->channel_count); @@ -484,7 +479,7 @@ execute_study(s8 study, Arena arena, Stream path, Options *options) case BeamformerEmissionKind_Sine:{ filter_kind = BeamformerFilterKind_Kaiser; filter.kaiser.beta = 5.65f; - filter.kaiser.cutoff_frequency = 2.0e6; //0.5 * ep->sine.frequency; + filter.kaiser.cutoff_frequency = 0.5f * ep->sine.frequency; filter.kaiser.length = 36; size = sizeof(filter.kaiser); }break; @@ -546,7 +541,8 @@ execute_study(s8 study, Arena arena, Stream path, Options *options) u32 frame = 0; f32 times[32] = {0}; - f32 data_size = (f32)(bp.raw_data_dimensions.E[0] * bp.raw_data_dimensions.E[1] * sizeof(*data)); + f32 data_size = (f32)(bp.raw_data_dimensions.E[0] * bp.raw_data_dimensions.E[1] + * beamformer_data_kind_byte_size[bp.data_kind]); u64 start = os_timer_count(); f64 frequency = os_timer_frequency(); for (;!g_should_exit;) {