ogl_beamforming

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

Commit: 69806f2bafede0674e7469375e1267afae775608
Parent: 34fd201e170e415c0b021995bba191e2783b3938
Author: Randy Palamar
Date:   Fri, 16 Oct 2026 05:55:19 -0700

core: drop partial BeamformerParameters structs

These don't really have a purpose anymore and I don't see how the
copy in the UI is still useful so it can be dropped.

Diffstat:
Mbeamformer.meta | 69+++++++++++++++++++++++++++------------------------------------------
Mbeamformer_shared_memory.c | 9+--------
Mgenerated/beamformer.c | 36------------------------------------
Mui.c | 16++++++----------
4 files changed, 34 insertions(+), 96 deletions(-)

diff --git a/beamformer.meta b/beamformer.meta @@ -186,50 +186,35 @@ @Library @Struct FilterParameters @MATLAB(Filter) @Struct FilterParameters -@Struct ParametersHead -{ - [das_voxel_transform M4 ] - [xdc_transform M4 ] - [xdc_element_pitch V2 ] - [raw_data_dimensions UV2 ] - [focal_vector V2 ] - [transmit_receive_orientation U32 ] - [sample_count U32 ] - [channel_count U32 ] - [acquisition_count U32 ] - [acquisition_kind AcquisitionKind] - [decode_mode DecodeMode ] - [sampling_mode SamplingMode ] - [time_offset F32 ] - [single_focus B32 ] - [single_orientation B32 ] -} - -@Struct UIParameters -{ - [output_points SV4] - [sampling_frequency F32] - [demodulation_frequency F32] - [speed_of_sound F32] - [f_number F32] - [interpolation_mode InterpolationMode] - [coherency_weighting B32] - [decimation_rate U32] -} - -@Struct ExtraParameters -{ - [contrast_mode ContrastMode ] - [emission_parameters EmissionParameters] - [readi_group_count U32] - [readi_group U32] -} - @Struct Parameters { - @Expand(ParametersHead) [`$(name)` `$(type)`] - @Expand(UIParameters) [`$(name)` `$(type)`] - @Expand(ExtraParameters) [`$(name)` `$(type)`] + [das_voxel_transform M4 ] + [xdc_transform M4 ] + [xdc_element_pitch V2 ] + [raw_data_dimensions UV2 ] + [focal_vector V2 ] + [transmit_receive_orientation U32 ] + [sample_count U32 ] + [channel_count U32 ] + [acquisition_count U32 ] + [acquisition_kind AcquisitionKind ] + [decode_mode DecodeMode ] + [sampling_mode SamplingMode ] + [time_offset F32 ] + [single_focus B32 ] + [single_orientation B32 ] + [output_points SV4 ] + [sampling_frequency F32 ] + [demodulation_frequency F32 ] + [speed_of_sound F32 ] + [f_number F32 ] + [interpolation_mode InterpolationMode ] + [coherency_weighting B32 ] + [decimation_rate U32 ] + [contrast_mode ContrastMode ] + [emission_parameters EmissionParameters] + [readi_group_count U32 ] + [readi_group U32 ] } @Library @Struct Parameters @MATLAB @Struct Parameters diff --git a/beamformer_shared_memory.c b/beamformer_shared_memory.c @@ -96,14 +96,7 @@ typedef struct { } BeamformerComputePipeline; typedef struct { - alignas(16) union { - BeamformerParameters parameters; - struct { - BeamformerParametersHead parameters_head; - BeamformerUIParameters parameters_ui; - BeamformerExtraParameters parameters_extra; - }; - }; + alignas(16) BeamformerParameters parameters; /* NOTE(rnp): signals to the beamformer that a subregion of a block has been updated */ u32 region_update_flags; diff --git a/generated/beamformer.c b/generated/beamformer.c @@ -354,42 +354,6 @@ typedef struct { } BeamformerFilterParameters; typedef struct { - m4 das_voxel_transform; - m4 xdc_transform; - v2 xdc_element_pitch; - uv2 raw_data_dimensions; - v2 focal_vector; - u32 transmit_receive_orientation; - u32 sample_count; - u32 channel_count; - u32 acquisition_count; - BeamformerAcquisitionKind acquisition_kind; - BeamformerDecodeMode decode_mode; - BeamformerSamplingMode sampling_mode; - f32 time_offset; - b32 single_focus; - b32 single_orientation; -} BeamformerParametersHead; - -typedef struct { - iv4 output_points; - f32 sampling_frequency; - f32 demodulation_frequency; - f32 speed_of_sound; - f32 f_number; - BeamformerInterpolationMode interpolation_mode; - b32 coherency_weighting; - u32 decimation_rate; -} BeamformerUIParameters; - -typedef struct { - BeamformerContrastMode contrast_mode; - BeamformerEmissionParameters emission_parameters; - u32 readi_group_count; - u32 readi_group; -} BeamformerExtraParameters; - -typedef struct { m4 das_voxel_transform; m4 xdc_transform; v2 xdc_element_pitch; diff --git a/ui.c b/ui.c @@ -374,8 +374,7 @@ typedef struct { BeamformerFrame latest_plane[BeamformerViewPlaneTag_Count]; - BeamformerUIParameters parameters; - b32 flush_parameters; + b32 flush_parameters; u32 selected_parameter_block; // TODO(rnp): this should be per parameter block @@ -3411,7 +3410,11 @@ ui_build_parameters_listing(BeamformerUIPanel *panel) UIPrefWidth(ui_text_dim(1.f, 1.f)) UIPrefHeight(ui_text_dim(line_pad_pct, 1.f)) { - BeamformerUIParameters *bp = &ui_context->parameters; + u32 parameter_block = panel->u.parameter_listing.parameter_block; + BeamformerParameterBlock *pb = beamformer_parameter_block(beamformer_context->shared_memory, parameter_block); + BeamformerComputePlan *cp = beamformer_context->compute_context.compute_plans[parameter_block]; + BeamformerParameters *bp = &pb->parameters; + UIParent(label_column) ui_label(str8("Sampling Frequency")); UIParent(value_column) ui_labelf("%0.2f##sampling", bp->sampling_frequency * 1e-6); UIParent(unit_column) ui_label(str8("[MHz]##sampling")); @@ -3420,11 +3423,6 @@ ui_build_parameters_listing(BeamformerUIPanel *panel) UIParent(value_column) ui_labelf("%0.2f###demod", bp->demodulation_frequency * 1e-6); UIParent(unit_column) ui_label(str8("[MHz]##demod")); - u32 parameter_block = panel->u.parameter_listing.parameter_block; - - BeamformerParameterBlock *pb = beamformer_parameter_block(beamformer_context->shared_memory, parameter_block); - BeamformerComputePlan *cp = beamformer_context->compute_context.compute_plans[parameter_block]; - // NOTE(rnp): emission info { BeamformerEmissionParameters *ep = &pb->parameters.emission_parameters; @@ -5295,7 +5293,6 @@ beamformer_ui_frame(void) ui->flush_parameters = 0; m4 das_transform; - memory_copy(&ui->parameters, &pb->parameters_ui, sizeof(ui->parameters)); memory_copy(das_transform.E, pb->parameters.das_voxel_transform.E, sizeof(das_transform)); atomic_and_u32(&beamformer_context->ui_dirty_parameter_blocks, ~selected_mask); @@ -5333,7 +5330,6 @@ beamformer_ui_frame(void) BeamformerParameterBlock *pb = beamformer_parameter_block_lock(beamformer_context->shared_memory, selected_block, 0); if (pb) { ui->flush_parameters = 0; - memory_copy(&pb->parameters_ui, &ui->parameters, sizeof(ui->parameters)); beamformed_shared_memory_dirty_flag(beamformer_context->shared_memory, selected_block, BeamformerParameterDirtyFlag_Parameters); beamformer_parameter_block_unlock(beamformer_context->shared_memory, selected_block);