ogl_beamforming

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

Commit: 9b0d67e1560e0a5c961192be8aea75bb72060585
Parent: 6345cb8bd192a5f2d5022420001f4aa2bb088276
Author: Randy Palamar
Date:   Mon, 16 Sep 2024 08:46:49 -0600

store channel_mapping in u16s instead of u32

sizes in the shaders weren't changed so now we support 512 channel mappings

Diffstat:
Mbeamformer.h | 2+-
Mbeamformer_parameters.h | 2+-
Mhelpers/ogl_beamformer_lib.h | 1+
Mshaders/hadamard.glsl | 8+++++---
Mutil.h | 1+
5 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/beamformer.h b/beamformer.h @@ -139,7 +139,7 @@ typedef struct { #define MAX_FRAMES_IN_FLIGHT 3 -#define INIT_CUDA_CONFIGURATION_FN(name) void name(u32 *input_dims, u32 *decoded_dims, u32 *channel_mapping, b32 rx_cols) +#define INIT_CUDA_CONFIGURATION_FN(name) void name(u32 *input_dims, u32 *decoded_dims, u16 *channel_mapping, b32 rx_cols) typedef INIT_CUDA_CONFIGURATION_FN(init_cuda_configuration_fn); #define REGISTER_CUDA_BUFFERS_FN(name) void name(u32 *rf_data_ssbos, u32 rf_buffer_count, u32 raw_data_ssbo) typedef REGISTER_CUDA_BUFFERS_FN(register_cuda_buffers_fn); diff --git a/beamformer_parameters.h b/beamformer_parameters.h @@ -13,7 +13,7 @@ enum compute_shaders { /* NOTE: This struct follows the OpenGL std140 layout. DO NOT modify unless you have * read and understood the rules, particulary with regards to _member alignment_ */ typedef struct { - u32 channel_mapping[256]; /* Transducer Channel to Verasonics Channel */ + u16 channel_mapping[512]; /* Transducer Channel to Verasonics Channel */ u32 uforces_channels[128]; /* Channels used for virtual UFORCES elements */ f32 lpf_coefficients[64]; /* Low Pass Filter Cofficients */ v4 xdc_origin; /* [m] Corner of transducer being treated as origin */ diff --git a/helpers/ogl_beamformer_lib.h b/helpers/ogl_beamformer_lib.h @@ -6,6 +6,7 @@ typedef uint8_t u8; typedef int16_t i16; +typedef uint16_t u16; typedef int32_t i32; typedef uint32_t u32; typedef uint32_t b32; diff --git a/shaders/hadamard.glsl b/shaders/hadamard.glsl @@ -55,9 +55,11 @@ void main() /* NOTE: offsets for storing the results in the output data */ uint out_off = dec_data_dim.x * dec_data_dim.y * acq + dec_data_dim.x * channel + time_sample; - uint ch_base_idx = (channel + channel_offset) / 4; - uint ch_sub_idx = (channel + channel_offset) - ch_base_idx * 4; - uint rf_channel = channel_mapping[ch_base_idx][ch_sub_idx]; + /* NOTE: channel mapping is stored as u16s so we must do this to extract the final value */ + uint ch_array_idx = ((channel + channel_offset) / 8); + uint ch_vec_idx = ((channel + channel_offset) % 8) / 2; + uint ch_elem_lfs = ((channel + channel_offset) & 1u) * 16; + uint rf_channel = (channel_mapping[ch_array_idx][ch_vec_idx] << ch_elem_lfs) >> 16; /* NOTE: stride is the number of samples between acquistions; off is the * index of the first acquisition for this channel and time sample */ diff --git a/util.h b/util.h @@ -33,6 +33,7 @@ typedef uint8_t u8; typedef int16_t i16; +typedef uint16_t u16; typedef int32_t i32; typedef uint32_t u32; typedef uint64_t u64;