ogl_beamforming

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

ogl_beamformer_lib.h (1440B)


      1 /* See LICENSE for license details. */
      2 #include <stddef.h>
      3 #include <stdint.h>
      4 
      5 typedef char      c8;
      6 typedef uint8_t   u8;
      7 typedef int16_t   i16;
      8 typedef uint16_t  u16;
      9 typedef int32_t   i32;
     10 typedef uint32_t  u32;
     11 typedef uint32_t  b32;
     12 typedef uint64_t  u64;
     13 typedef float     f32;
     14 typedef double    f64;
     15 typedef ptrdiff_t size;
     16 typedef ptrdiff_t iptr;
     17 
     18 #define ARRAY_COUNT(a) (sizeof(a) / sizeof(*a))
     19 typedef struct { size len; u8 *data; } s8;
     20 #define s8(s) (s8){.len = ARRAY_COUNT(s) - 1, .data = (u8 *)s}
     21 
     22 #if defined(_WIN32)
     23 #define LIB_FN __declspec(dllexport)
     24 #else
     25 #define LIB_FN
     26 #endif
     27 
     28 typedef struct { f32 x, y; }       v2;
     29 typedef struct { f32 x, y, z, w; } v4;
     30 typedef struct { u32 x, y; }       uv2;
     31 typedef struct { u32 x, y, z; }    uv3;
     32 typedef struct { u32 x, y, z, w; } uv4;
     33 
     34 #include "../beamformer_parameters.h"
     35 
     36 LIB_FN b32 set_beamformer_parameters(char *shm_name, BeamformerParameters *);
     37 LIB_FN b32 set_beamformer_pipeline(char *shm_name, i32 *stages, i32 stages_count);
     38 LIB_FN b32 send_data(char *pipe_name, char *shm_name, i16 *data, uv2 data_dim);
     39 
     40 /* NOTE: sends data and waits for (complex) beamformed data to be returned.
     41  * out_data: must be allocated by the caller as 2 f32s per output point. */
     42 LIB_FN void beamform_data_synchronized(char *pipe_name, char *shm_name,
     43                                        i16 *data, uv2 data_dim,
     44                                        uv3 output_points, f32 *out_data);