ogl_beamforming

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

Commit: f6c70b1210ab66f57dc3de8317a44c5cc66acfc8
Parent: 33039379c13734a7357355762157fc1da3f49320
Author: Randy Palamar
Date:   Wed, 14 Jan 2026 11:04:54 -0700

lib: simple API: make data return optional

Diffstat:
Mlib/ogl_beamformer_lib.c | 17++++++++++-------
Mlib/ogl_beamformer_lib_base.h | 5+++--
2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/lib/ogl_beamformer_lib.c b/lib/ogl_beamformer_lib.c @@ -574,13 +574,16 @@ beamformer_beamform_data(BeamformerSimpleParameters *bp, void *data, uint32_t da if (complex) output_size *= 2; Arena scratch = beamformer_shared_memory_scratch_arena(g_beamformer_library_context.bp); - if (result && lib_error_check(output_size <= arena_capacity(&scratch, u8), ExportSpaceOverflow) - && beamformer_push_data_with_compute(data, data_size, 0, 0)) - { - BeamformerExportContext export; - export.kind = BeamformerExportKind_BeamformedData; - export.size = (u32)output_size; - result = beamformer_export(export, out_data, timeout_ms); + if (out_data) result = lib_error_check(output_size <= arena_capacity(&scratch, u8), ExportSpaceOverflow); + + if (result) { + result = beamformer_push_data_with_compute(data, data_size, 0, 0); + if (result && out_data) { + BeamformerExportContext export; + export.kind = BeamformerExportKind_BeamformedData; + export.size = (u32)output_size; + result = beamformer_export(export, out_data, timeout_ms); + } } } return result; diff --git a/lib/ogl_beamformer_lib_base.h b/lib/ogl_beamformer_lib_base.h @@ -43,8 +43,9 @@ BEAMFORMER_LIB_EXPORT const char *beamformer_error_string(BeamformerLibErrorKind * - fill out a BeamformerSimpleParameters * - filters need to be created with beamformer_create_filter, and the slot * needs to be assigned in compute_stage_parameters - * - allocate a buffer with enough space for all Float32 or Float32Complex output points - * - pass the buffer along with the data and parameters to beamformer_beamform_data() + * - (Optional) allocate a buffer with enough space for all Float32 or Float32Complex output points + * - pass the data and parameters to beamformer_beamform_data() + * - pass 0 for out_data if you do not need the beamformed data returned * - if the function was unsuccessful you can check the error with beamformer_get_last_error() * or beamformer_get_last_error_string() */