ogl_beamforming

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

Commit: 86c1d7e50957d620c6b2b73a5c9c564913ca5cb6
Parent: c7a78f342b205e06b80aada2871b81dce7b6f6f9
Author: Randy Palamar
Date:   Fri,  5 Jul 2024 15:51:19 -0600

update mex helper to only accept i16 data

Diffstat:
Mhelpers/ogl_beamformer_pipe.c | 17+++++++----------
Mmain.c | 3+--
2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/helpers/ogl_beamformer_pipe.c b/helpers/ogl_beamformer_pipe.c @@ -85,29 +85,26 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) return; } - /* TODO: send i16 data */ char *pipe_name = mxArrayToString(prhs[0]); const mxArray *mxdata = prhs[1]; - size data_size = 0; os_pipe p = os_open_named_pipe(pipe_name); if (p.file == OS_INVALID_FILE) { - mexPrintf("Couldn't open pipe\n"); + mexPrintf("ogl_beamformer_pipe: failed to open pipe\n"); return; } - if (mxIsInt16(mxdata)) { + if (!mxIsInt16(mxdata)) { os_close_pipe(p); - mexPrintf("Int16 is not yet supported; convert to Int32 first\n"); + mexPrintf("ogl_beamformer_pipe: invalid data type; only int16 is supported\n"); return; - } else if (mxIsInt32(mxdata)) { - data_size = mxGetNumberOfElements(mxdata) * sizeof(i32); } - void *data = mxGetPr(mxdata); - size written = os_write_to_pipe(p, data, data_size); + void *data = mxGetPr(mxdata); + size data_size = mxGetNumberOfElements(mxdata) * sizeof(i16); + size written = os_write_to_pipe(p, data, data_size); if (written != data_size) - mexPrintf("Failed to write full data to pipe: wrote: %ld\n", written); + mexPrintf("ogl_beamformer_pipe: failed to write full data to pipe: wrote: %ld\n", written); os_close_pipe(p); } diff --git a/main.c b/main.c @@ -119,8 +119,7 @@ compile_shader(Arena a, u32 type, s8 shader) static void init_compute_shader_ctx(ComputeShaderCtx *ctx, Arena a, uv3 rf_data_dim) { - ctx->rf_data_dim = rf_data_dim; - /* TODO: send i16 data and convert to i32 on GPU */ + ctx->rf_data_dim = rf_data_dim; size rf_raw_size = rf_data_dim.w * rf_data_dim.h * rf_data_dim.d * sizeof(i16); size rf_decoded_size = rf_data_dim.w * rf_data_dim.h * rf_data_dim.d * sizeof(i32);