ogl_beamforming

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

zemp_bp.h (5458B)


      1 /*
      2  * ISC License (ISC)
      3  *
      4  * © 2024-2026 Randy Palamar <randy@rnpnr.xyz>
      5  *
      6  * Permission to use, copy, modify, and distribute this software for any
      7  * purpose with or without fee is hereby granted, provided that the above
      8  * copyright notice and this permission notice appear in all copies.
      9  *
     10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     17  */
     18 
     19 // GENERATED CODE
     20 
     21 #include <stdint.h>
     22 
     23 #define ZBP_HeaderMagic (0x5042504d455afecaULL)
     24 #define ZBP_OffsetAlignment (0x04U)
     25 
     26 typedef enum {
     27 	ZBP_RCAOrientation_None    = 0,
     28 	ZBP_RCAOrientation_Rows    = 1,
     29 	ZBP_RCAOrientation_Columns = 2,
     30 	ZBP_RCAOrientation_Count,
     31 } ZBP_RCAOrientation;
     32 
     33 typedef enum {
     34 	ZBP_DecodeMode_None     = 0,
     35 	ZBP_DecodeMode_Hadamard = 1,
     36 	ZBP_DecodeMode_Walsh    = 2,
     37 	ZBP_DecodeMode_Count,
     38 } ZBP_DecodeMode;
     39 
     40 typedef enum {
     41 	ZBP_SamplingMode_Standard = 0,
     42 	ZBP_SamplingMode_Bandpass = 1,
     43 	ZBP_SamplingMode_Count,
     44 } ZBP_SamplingMode;
     45 
     46 typedef enum {
     47 	ZBP_AcquisitionKind_FORCES         = 0,
     48 	ZBP_AcquisitionKind_UFORCES        = 1,
     49 	ZBP_AcquisitionKind_HERCULES       = 2,
     50 	ZBP_AcquisitionKind_RCA_VLS        = 3,
     51 	ZBP_AcquisitionKind_RCA_TPW        = 4,
     52 	ZBP_AcquisitionKind_UHERCULES      = 5,
     53 	ZBP_AcquisitionKind_RACES          = 6,
     54 	ZBP_AcquisitionKind_EPIC_FORCES    = 7,
     55 	ZBP_AcquisitionKind_EPIC_UFORCES   = 8,
     56 	ZBP_AcquisitionKind_EPIC_UHERCULES = 9,
     57 	ZBP_AcquisitionKind_Flash          = 10,
     58 	ZBP_AcquisitionKind_HERO_PA        = 11,
     59 	ZBP_AcquisitionKind_Count,
     60 } ZBP_AcquisitionKind;
     61 
     62 typedef enum {
     63 	ZBP_ContrastMode_None = 0,
     64 	ZBP_ContrastMode_Count,
     65 } ZBP_ContrastMode;
     66 
     67 typedef enum {
     68 	ZBP_EmissionKind_Sine  = 0,
     69 	ZBP_EmissionKind_Chirp = 1,
     70 	ZBP_EmissionKind_Count,
     71 } ZBP_EmissionKind;
     72 
     73 typedef enum {
     74 	ZBP_DataKind_Int16          = 0,
     75 	ZBP_DataKind_Int16Complex   = 1,
     76 	ZBP_DataKind_Float32        = 2,
     77 	ZBP_DataKind_Float32Complex = 3,
     78 	ZBP_DataKind_Float16        = 4,
     79 	ZBP_DataKind_Float16Complex = 5,
     80 	ZBP_DataKind_Count,
     81 } ZBP_DataKind;
     82 
     83 typedef enum {
     84 	ZBP_DataCompressionKind_None = 0,
     85 	ZBP_DataCompressionKind_ZSTD = 1,
     86 	ZBP_DataCompressionKind_Count,
     87 } ZBP_DataCompressionKind;
     88 
     89 typedef struct ZBP_BaseHeader {
     90 	uint64_t magic;
     91 	uint32_t major;
     92 	uint32_t minor;
     93 } ZBP_BaseHeader;
     94 
     95 typedef struct ZBP_HeaderV1 {
     96 	uint64_t magic;
     97 	uint32_t version;
     98 	int16_t  decode_mode;
     99 	int16_t  beamform_mode;
    100 	uint32_t raw_data_dimension[4];
    101 	uint32_t sample_count;
    102 	uint32_t channel_count;
    103 	uint32_t receive_event_count;
    104 	uint32_t frame_count;
    105 	float    transducer_element_pitch[2];
    106 	float    transducer_transform_matrix[16];
    107 	int16_t  channel_mapping[256];
    108 	float    steering_angles[256];
    109 	float    focal_depths[256];
    110 	int16_t  sparse_elements[256];
    111 	int16_t  hadamard_rows[256];
    112 	float    speed_of_sound;
    113 	float    demodulation_frequency;
    114 	float    sampling_frequency;
    115 	float    time_offset;
    116 	uint32_t transmit_mode;
    117 } ZBP_HeaderV1;
    118 
    119 typedef struct ZBP_HeaderV2 {
    120 	uint64_t magic;
    121 	uint32_t major;
    122 	uint32_t minor;
    123 	uint32_t raw_data_dimension[4];
    124 	int32_t  raw_data_kind;
    125 	int32_t  raw_data_offset;
    126 	int32_t  raw_data_compression_kind;
    127 	int32_t  decode_mode;
    128 	int32_t  sampling_mode;
    129 	float    sampling_frequency;
    130 	float    demodulation_frequency;
    131 	float    speed_of_sound;
    132 	int32_t  channel_mapping_offset;
    133 	uint32_t sample_count;
    134 	uint32_t channel_count;
    135 	uint32_t receive_event_count;
    136 	float    transducer_transform_matrix[16];
    137 	float    transducer_element_pitch[2];
    138 	float    time_offset;
    139 	float    group_acquisition_time;
    140 	float    ensemble_repitition_interval;
    141 	int32_t  acquisition_mode;
    142 	int32_t  acquisition_parameters_offset;
    143 	int32_t  contrast_mode;
    144 	int32_t  contrast_parameters_offset;
    145 	int32_t  emission_descriptors_offset;
    146 } ZBP_HeaderV2;
    147 
    148 typedef struct ZBP_EmissionDescriptor {
    149 	int32_t emission_kind;
    150 	int32_t parameters_offset;
    151 } ZBP_EmissionDescriptor;
    152 
    153 typedef struct ZBP_EmissionSineParameters {
    154 	float cycles;
    155 	float frequency;
    156 } ZBP_EmissionSineParameters;
    157 
    158 typedef struct ZBP_EmissionChirpParameters {
    159 	float duration;
    160 	float min_frequency;
    161 	float max_frequency;
    162 } ZBP_EmissionChirpParameters;
    163 
    164 typedef struct ZBP_RCATransmitFocus {
    165 	float    focal_depth;
    166 	float    steering_angle;
    167 	float    origin_offset;
    168 	uint32_t transmit_receive_orientation;
    169 } ZBP_RCATransmitFocus;
    170 
    171 typedef struct ZBP_FORCESParameters {
    172 	ZBP_RCATransmitFocus transmit_focus;
    173 } ZBP_FORCESParameters;
    174 
    175 typedef struct ZBP_uFORCESParameters {
    176 	ZBP_RCATransmitFocus transmit_focus;
    177 	int32_t              sparse_elements_offset;
    178 } ZBP_uFORCESParameters;
    179 
    180 typedef struct ZBP_HERCULESParameters {
    181 	ZBP_RCATransmitFocus transmit_focus;
    182 } ZBP_HERCULESParameters;
    183 
    184 typedef struct ZBP_uHERCULESParameters {
    185 	ZBP_RCATransmitFocus transmit_focus;
    186 	int32_t              sparse_elements_offset;
    187 } ZBP_uHERCULESParameters;
    188 
    189 typedef struct ZBP_TPWParameters {
    190 	int32_t tilting_angles_offset;
    191 	int32_t transmit_receive_orientations_offset;
    192 } ZBP_TPWParameters;
    193 
    194 typedef struct ZBP_VLSParameters {
    195 	int32_t focal_depths_offset;
    196 	int32_t origin_offsets_offset;
    197 	int32_t transmit_receive_orientations_offset;
    198 } ZBP_VLSParameters;