Commit: 56cfd92930f9e8a5da3e5cf6fa372d5b7ba326e7
Parent: 5db505adf3ecf2b8c0d760fe18b86a1ce6433925
Author: Randy Palamar
Date: Sat, 17 Jan 2026 14:21:27 -0700
lib: cleanup data moving
This was meant as a reminder of what might be needed for contrast
mode data compression on the CPU but that can just be rewritten.
Diffstat:
1 file changed, 5 insertions(+), 17 deletions(-)
diff --git a/lib/ogl_beamformer_lib.c b/lib/ogl_beamformer_lib.c
@@ -389,28 +389,16 @@ beamformer_push_data_base(void *data, u32 data_size, i32 timeout_ms, u32 block)
if (lib_try_lock(BeamformerSharedMemoryLockKind_UploadRF, timeout_ms)) {
if (lib_try_lock(BeamformerSharedMemoryLockKind_ScratchSpace, 0)) {
u32 channel_count = bp->channel_count;
- u32 out_channel_stride = beamformer_data_kind_element_count[data_kind] * bp->sample_count * bp->acquisition_count;
- u32 in_channel_stride = beamformer_data_kind_element_count[data_kind] * bp->raw_data_dimensions.x;
+ u32 out_channel_stride = beamformer_data_kind_byte_size[data_kind] * bp->sample_count * bp->acquisition_count;
+ u32 in_channel_stride = beamformer_data_kind_byte_size[data_kind] * bp->raw_data_dimensions.x;
for (u32 channel = 0; channel < channel_count; channel++) {
u16 data_channel = (u16)b->channel_mapping[channel];
u32 out_off = out_channel_stride * channel;
u32 in_off = in_channel_stride * data_channel;
- for (u32 sample = 0; sample < out_channel_stride; sample++, out_off++, in_off++) {
- switch (data_kind) {
- case BeamformerDataKind_Int16:
- case BeamformerDataKind_Int16Complex:
- {
- ((i16 *)scratch.beg)[out_off] = ((i16 *)data)[in_off];
- }break;
- case BeamformerDataKind_Float32:
- case BeamformerDataKind_Float32Complex:
- {
- ((f32 *)scratch.beg)[out_off] = ((f32 *)data)[in_off];
- }break;
- InvalidDefaultCase;
- }
- }
+ /* TODO(rnp): it would be better to do non temporal copy here, but we can't ensure
+ * 64 byte boundaries. */
+ mem_copy(scratch.beg + out_off, (u8 *)data + in_off, out_channel_stride);
}
lib_release_lock(BeamformerSharedMemoryLockKind_ScratchSpace);