ogl_beamforming

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

beamformer.meta.c (12571B)


      1 /* See LICENSE for license details. */
      2 
      3 // GENERATED CODE
      4 
      5 typedef enum {
      6 	BeamformerDecodeMode_None     = 0,
      7 	BeamformerDecodeMode_Hadamard = 1,
      8 	BeamformerDecodeMode_Count,
      9 } BeamformerDecodeMode;
     10 
     11 typedef enum {
     12 	BeamformerRCAOrientation_None    = 0,
     13 	BeamformerRCAOrientation_Rows    = 1,
     14 	BeamformerRCAOrientation_Columns = 2,
     15 	BeamformerRCAOrientation_Count,
     16 } BeamformerRCAOrientation;
     17 
     18 typedef enum {
     19 	BeamformerSamplingMode_2X = 0,
     20 	BeamformerSamplingMode_4X = 1,
     21 	BeamformerSamplingMode_Count,
     22 } BeamformerSamplingMode;
     23 
     24 typedef enum {
     25 	BeamformerEmissionKind_Sine   = 0,
     26 	BeamformerEmissionKind_SineAM = 1,
     27 	BeamformerEmissionKind_Chirp  = 2,
     28 	BeamformerEmissionKind_Count,
     29 } BeamformerEmissionKind;
     30 
     31 typedef enum {
     32 	BeamformerAcquisitionKind_FORCES         = 0,
     33 	BeamformerAcquisitionKind_UFORCES        = 1,
     34 	BeamformerAcquisitionKind_HERCULES       = 2,
     35 	BeamformerAcquisitionKind_RCA_VLS        = 3,
     36 	BeamformerAcquisitionKind_RCA_TPW        = 4,
     37 	BeamformerAcquisitionKind_UHERCULES      = 5,
     38 	BeamformerAcquisitionKind_RACES          = 6,
     39 	BeamformerAcquisitionKind_EPIC_FORCES    = 7,
     40 	BeamformerAcquisitionKind_EPIC_UFORCES   = 8,
     41 	BeamformerAcquisitionKind_EPIC_UHERCULES = 9,
     42 	BeamformerAcquisitionKind_Flash          = 10,
     43 	BeamformerAcquisitionKind_HERO_PA        = 11,
     44 	BeamformerAcquisitionKind_Count,
     45 } BeamformerAcquisitionKind;
     46 
     47 typedef enum {
     48 	BeamformerDataKind_Int16          = 0,
     49 	BeamformerDataKind_Int16Complex   = 1,
     50 	BeamformerDataKind_Float32        = 2,
     51 	BeamformerDataKind_Float32Complex = 3,
     52 	BeamformerDataKind_Count,
     53 } BeamformerDataKind;
     54 
     55 typedef enum {
     56 	BeamformerFilterKind_Kaiser       = 0,
     57 	BeamformerFilterKind_MatchedChirp = 1,
     58 	BeamformerFilterKind_Count,
     59 } BeamformerFilterKind;
     60 
     61 typedef enum {
     62 	BeamformerInterpolationMode_Nearest = 0,
     63 	BeamformerInterpolationMode_Linear  = 1,
     64 	BeamformerInterpolationMode_Cubic   = 2,
     65 	BeamformerInterpolationMode_Count,
     66 } BeamformerInterpolationMode;
     67 
     68 typedef enum {
     69 	BeamformerShaderDecodeFlags_DilateOutput    = (1 << 0),
     70 	BeamformerShaderDecodeFlags_UseSharedMemory = (1 << 1),
     71 } BeamformerShaderDecodeFlags;
     72 
     73 typedef enum {
     74 	BeamformerShaderFilterFlags_ComplexFilter = (1 << 0),
     75 	BeamformerShaderFilterFlags_OutputFloats  = (1 << 1),
     76 	BeamformerShaderFilterFlags_Demodulate    = (1 << 2),
     77 } BeamformerShaderFilterFlags;
     78 
     79 typedef enum {
     80 	BeamformerShaderDASFlags_Fast               = (1 << 0),
     81 	BeamformerShaderDASFlags_Sparse             = (1 << 1),
     82 	BeamformerShaderDASFlags_CoherencyWeighting = (1 << 2),
     83 	BeamformerShaderDASFlags_SingleFocus        = (1 << 3),
     84 	BeamformerShaderDASFlags_SingleOrientation  = (1 << 4),
     85 } BeamformerShaderDASFlags;
     86 
     87 typedef enum {
     88 	BeamformerShaderKind_CudaDecode  = 0,
     89 	BeamformerShaderKind_CudaHilbert = 1,
     90 	BeamformerShaderKind_Decode      = 2,
     91 	BeamformerShaderKind_Filter      = 3,
     92 	BeamformerShaderKind_Demodulate  = 4,
     93 	BeamformerShaderKind_DAS         = 5,
     94 	BeamformerShaderKind_MinMax      = 6,
     95 	BeamformerShaderKind_Sum         = 7,
     96 	BeamformerShaderKind_Render3D    = 8,
     97 	BeamformerShaderKind_Count,
     98 
     99 	BeamformerShaderKind_ComputeFirst = BeamformerShaderKind_CudaDecode,
    100 	BeamformerShaderKind_ComputeLast  = BeamformerShaderKind_Sum,
    101 	BeamformerShaderKind_ComputeCount = 8,
    102 	BeamformerShaderKind_RenderFirst  = BeamformerShaderKind_Render3D,
    103 	BeamformerShaderKind_RenderLast   = BeamformerShaderKind_Render3D,
    104 	BeamformerShaderKind_RenderCount  = 1,
    105 } BeamformerShaderKind;
    106 
    107 typedef struct {
    108 	u32 decode_mode;
    109 	u32 input_channel_stride;
    110 	u32 input_sample_stride;
    111 	u32 input_transmit_stride;
    112 	u32 output_channel_stride;
    113 	u32 output_sample_stride;
    114 	u32 output_transmit_stride;
    115 	u32 to_process;
    116 	u32 transmit_count;
    117 } BeamformerShaderDecodeBakeParameters;
    118 
    119 typedef struct {
    120 	u32 decimation_rate;
    121 	u32 filter_length;
    122 	u32 input_channel_stride;
    123 	u32 input_sample_stride;
    124 	u32 input_transmit_stride;
    125 	u32 output_channel_stride;
    126 	u32 output_sample_stride;
    127 	u32 output_transmit_stride;
    128 	u32 sample_count;
    129 	f32 demodulation_frequency;
    130 	f32 sampling_frequency;
    131 } BeamformerShaderFilterBakeParameters;
    132 
    133 typedef struct {
    134 	u32 acquisition_count;
    135 	u32 acquisition_kind;
    136 	u32 channel_count;
    137 	u32 interpolation_mode;
    138 	u32 sample_count;
    139 	u32 transmit_receive_orientation;
    140 	f32 demodulation_frequency;
    141 	f32 f_number;
    142 	f32 focus_depth;
    143 	f32 sampling_frequency;
    144 	f32 speed_of_sound;
    145 	f32 time_offset;
    146 	f32 transmit_angle;
    147 } BeamformerShaderDASBakeParameters;
    148 
    149 typedef struct {
    150 	union {
    151 		BeamformerShaderDecodeBakeParameters Decode;
    152 		BeamformerShaderFilterBakeParameters Filter;
    153 		BeamformerShaderDASBakeParameters    DAS;
    154 	};
    155 	u32 data_kind;
    156 	u32 flags;
    157 } BeamformerShaderBakeParameters;
    158 
    159 typedef union {
    160 	struct {
    161 		f32 cycles;
    162 		f32 frequency;
    163 	} sine;
    164 	struct {
    165 		f32 cycles;
    166 		f32 frequency;
    167 		u32 emissions;
    168 	} sine_am;
    169 	struct {
    170 		f32 duration;
    171 		f32 min_frequency;
    172 		f32 max_frequency;
    173 	} chirp;
    174 } BeamformerEmissionParameters;
    175 
    176 typedef struct {
    177 	m4  das_voxel_transform;
    178 	m4  xdc_transform;
    179 	v2  xdc_element_pitch;
    180 	uv2 raw_data_dimensions;
    181 	v2  focal_vector;
    182 	u32 transmit_receive_orientation;
    183 	u32 sample_count;
    184 	u32 channel_count;
    185 	u32 acquisition_count;
    186 	u32 acquisition_kind;
    187 	f32 time_offset;
    188 	u8  single_focus;
    189 	u8  single_orientation;
    190 	u8  decode_mode;
    191 	u8  sampling_mode;
    192 	iv4 output_points;
    193 	f32 sampling_frequency;
    194 	f32 demodulation_frequency;
    195 	f32 speed_of_sound;
    196 	f32 f_number;
    197 	u32 interpolation_mode;
    198 	u32 coherency_weighting;
    199 	u32 decimation_rate;
    200 	BeamformerEmissionKind       emission_kind;
    201 	BeamformerEmissionParameters emission_parameters;
    202 } BeamformerParameters;
    203 
    204 typedef struct {
    205 	m4  das_voxel_transform;
    206 	m4  xdc_transform;
    207 	v2  xdc_element_pitch;
    208 	uv2 raw_data_dimensions;
    209 	v2  focal_vector;
    210 	u32 transmit_receive_orientation;
    211 	u32 sample_count;
    212 	u32 channel_count;
    213 	u32 acquisition_count;
    214 	u32 acquisition_kind;
    215 	f32 time_offset;
    216 	u8  single_focus;
    217 	u8  single_orientation;
    218 	u8  decode_mode;
    219 	u8  sampling_mode;
    220 } BeamformerParametersHead;
    221 
    222 typedef struct {
    223 	iv4 output_points;
    224 	f32 sampling_frequency;
    225 	f32 demodulation_frequency;
    226 	f32 speed_of_sound;
    227 	f32 f_number;
    228 	u32 interpolation_mode;
    229 	u32 coherency_weighting;
    230 	u32 decimation_rate;
    231 } BeamformerUIParameters;
    232 
    233 typedef struct {
    234 	m4  das_voxel_transform;
    235 	m4  xdc_transform;
    236 	v2  xdc_element_pitch;
    237 	uv2 raw_data_dimensions;
    238 	v2  focal_vector;
    239 	u32 transmit_receive_orientation;
    240 	u32 sample_count;
    241 	u32 channel_count;
    242 	u32 acquisition_count;
    243 	u32 acquisition_kind;
    244 	f32 time_offset;
    245 	u8  single_focus;
    246 	u8  single_orientation;
    247 	u8  decode_mode;
    248 	u8  sampling_mode;
    249 	iv4 output_points;
    250 	f32 sampling_frequency;
    251 	f32 demodulation_frequency;
    252 	f32 speed_of_sound;
    253 	f32 f_number;
    254 	u32 interpolation_mode;
    255 	u32 coherency_weighting;
    256 	u32 decimation_rate;
    257 	BeamformerEmissionKind       emission_kind;
    258 	BeamformerEmissionParameters emission_parameters;
    259 	i16 channel_mapping[256];
    260 	i16 sparse_elements[256];
    261 	u8  transmit_receive_orientations[256];
    262 	f32 steering_angles[256];
    263 	f32 focal_depths[256];
    264 	i32 compute_stages[16];
    265 	i32 compute_stage_parameters[16];
    266 	u32 compute_stages_count;
    267 	i32 data_kind;
    268 } BeamformerSimpleParameters;
    269 
    270 typedef struct {
    271 	BeamformerFilterKind kind;
    272 	union {
    273 		struct {
    274 			f32 cutoff_frequency;
    275 			f32 beta;
    276 			u32 length;
    277 		} kaiser;
    278 		struct {
    279 			f32 duration;
    280 			f32 min_frequency;
    281 			f32 max_frequency;
    282 		} matched_chirp;
    283 	};
    284 	f32 sampling_frequency;
    285 	b16 complex;
    286 } BeamformerFilterParameters;
    287 
    288 read_only global u8 beamformer_data_kind_element_size[] = {
    289 	2,
    290 	2,
    291 	4,
    292 	4,
    293 };
    294 
    295 read_only global u8 beamformer_data_kind_element_count[] = {
    296 	1,
    297 	2,
    298 	1,
    299 	2,
    300 };
    301 
    302 read_only global u8 beamformer_data_kind_byte_size[] = {
    303 	2 * 1,
    304 	2 * 2,
    305 	4 * 1,
    306 	4 * 2,
    307 };
    308 
    309 read_only global u8 beamformer_acquisition_kind_has_fixed_transmits[] = {
    310 	1,
    311 	0,
    312 	1,
    313 	0,
    314 	0,
    315 	0,
    316 	1,
    317 	1,
    318 	0,
    319 	0,
    320 	0,
    321 	0,
    322 };
    323 
    324 read_only global s8 beamformer_acquisition_kind_strings[] = {
    325 	s8_comp("FORCES"),
    326 	s8_comp("UFORCES"),
    327 	s8_comp("HERCULES"),
    328 	s8_comp("VLS"),
    329 	s8_comp("TPW"),
    330 	s8_comp("UHERCULES"),
    331 	s8_comp("RACES"),
    332 	s8_comp("EPIC-FORCES"),
    333 	s8_comp("EPIC-UFORCES"),
    334 	s8_comp("EPIC-UHERCULES"),
    335 	s8_comp("Flash"),
    336 	s8_comp("HERO-PA"),
    337 };
    338 
    339 read_only global s8 beamformer_filter_kind_strings[] = {
    340 	s8_comp("Kaiser"),
    341 	s8_comp("MatchedChirp"),
    342 };
    343 
    344 read_only global s8 beamformer_interpolation_mode_strings[] = {
    345 	s8_comp("Nearest"),
    346 	s8_comp("Linear"),
    347 	s8_comp("Cubic"),
    348 };
    349 
    350 read_only global s8 beamformer_shader_names[] = {
    351 	s8_comp("CudaDecode"),
    352 	s8_comp("CudaHilbert"),
    353 	s8_comp("Decode"),
    354 	s8_comp("Filter"),
    355 	s8_comp("Demodulate"),
    356 	s8_comp("DAS"),
    357 	s8_comp("MinMax"),
    358 	s8_comp("Sum"),
    359 	s8_comp("Render3D"),
    360 };
    361 
    362 read_only global BeamformerShaderKind beamformer_reloadable_shader_kinds[] = {
    363 	BeamformerShaderKind_Decode,
    364 	BeamformerShaderKind_Filter,
    365 	BeamformerShaderKind_DAS,
    366 	BeamformerShaderKind_MinMax,
    367 	BeamformerShaderKind_Sum,
    368 	BeamformerShaderKind_Render3D,
    369 };
    370 
    371 read_only global s8 beamformer_reloadable_shader_files[] = {
    372 	s8_comp("decode.glsl"),
    373 	s8_comp("filter.glsl"),
    374 	s8_comp("das.glsl"),
    375 	s8_comp("min_max.glsl"),
    376 	s8_comp("sum.glsl"),
    377 	s8_comp("render_3d.frag.glsl"),
    378 };
    379 
    380 read_only global i32 beamformer_shader_reloadable_index_by_shader[] = {
    381 	-1,
    382 	-1,
    383 	0,
    384 	1,
    385 	1,
    386 	2,
    387 	3,
    388 	4,
    389 	5,
    390 };
    391 
    392 read_only global i32 beamformer_reloadable_compute_shader_info_indices[] = {
    393 	0,
    394 	1,
    395 	2,
    396 	3,
    397 	4,
    398 };
    399 
    400 read_only global i32 beamformer_reloadable_render_shader_info_indices[] = {
    401 	5,
    402 };
    403 
    404 read_only global s8 beamformer_shader_global_header_strings[] = {
    405 	s8_comp(""
    406 	"#define DataKind_Int16          0\n"
    407 	"#define DataKind_Int16Complex   1\n"
    408 	"#define DataKind_Float32        2\n"
    409 	"#define DataKind_Float32Complex 3\n"
    410 	"\n"),
    411 	s8_comp(""
    412 	"#define DecodeMode_None     0\n"
    413 	"#define DecodeMode_Hadamard 1\n"
    414 	"\n"),
    415 	s8_comp(""
    416 	"#define AcquisitionKind_FORCES         0\n"
    417 	"#define AcquisitionKind_UFORCES        1\n"
    418 	"#define AcquisitionKind_HERCULES       2\n"
    419 	"#define AcquisitionKind_RCA_VLS        3\n"
    420 	"#define AcquisitionKind_RCA_TPW        4\n"
    421 	"#define AcquisitionKind_UHERCULES      5\n"
    422 	"#define AcquisitionKind_RACES          6\n"
    423 	"#define AcquisitionKind_EPIC_FORCES    7\n"
    424 	"#define AcquisitionKind_EPIC_UFORCES   8\n"
    425 	"#define AcquisitionKind_EPIC_UHERCULES 9\n"
    426 	"#define AcquisitionKind_Flash          10\n"
    427 	"#define AcquisitionKind_HERO_PA        11\n"
    428 	"\n"),
    429 	s8_comp(""
    430 	"#define InterpolationMode_Nearest 0\n"
    431 	"#define InterpolationMode_Linear  1\n"
    432 	"#define InterpolationMode_Cubic   2\n"
    433 	"\n"),
    434 	s8_comp(""
    435 	"#define RCAOrientation_None    0\n"
    436 	"#define RCAOrientation_Rows    1\n"
    437 	"#define RCAOrientation_Columns 2\n"
    438 	"\n"),
    439 };
    440 
    441 read_only global s8 *beamformer_shader_flag_strings[] = {
    442 	(s8 []){
    443 		s8_comp("DilateOutput"),
    444 		s8_comp("UseSharedMemory"),
    445 	},
    446 	(s8 []){
    447 		s8_comp("ComplexFilter"),
    448 		s8_comp("OutputFloats"),
    449 		s8_comp("Demodulate"),
    450 	},
    451 	(s8 []){
    452 		s8_comp("Fast"),
    453 		s8_comp("Sparse"),
    454 		s8_comp("CoherencyWeighting"),
    455 		s8_comp("SingleFocus"),
    456 		s8_comp("SingleOrientation"),
    457 	},
    458 	0,
    459 	0,
    460 	0,
    461 };
    462 
    463 read_only global u8 beamformer_shader_flag_strings_count[] = {
    464 	2,
    465 	3,
    466 	5,
    467 	0,
    468 	0,
    469 	0,
    470 };
    471 
    472 read_only global i32 *beamformer_shader_header_vectors[] = {
    473 	(i32 []){0, 1},
    474 	(i32 []){0},
    475 	(i32 []){2, 0, 3, 4},
    476 	0,
    477 	0,
    478 	0,
    479 };
    480 
    481 read_only global i32 beamformer_shader_header_vector_lengths[] = {
    482 	2,
    483 	1,
    484 	4,
    485 	0,
    486 	0,
    487 	0,
    488 };
    489 
    490 read_only global s8 *beamformer_shader_bake_parameter_names[] = {
    491 	(s8 []){
    492 		s8_comp("DecodeMode"),
    493 		s8_comp("InputChannelStride"),
    494 		s8_comp("InputSampleStride"),
    495 		s8_comp("InputTransmitStride"),
    496 		s8_comp("OutputChannelStride"),
    497 		s8_comp("OutputSampleStride"),
    498 		s8_comp("OutputTransmitStride"),
    499 		s8_comp("ToProcess"),
    500 		s8_comp("TransmitCount"),
    501 	},
    502 	(s8 []){
    503 		s8_comp("DecimationRate"),
    504 		s8_comp("FilterLength"),
    505 		s8_comp("InputChannelStride"),
    506 		s8_comp("InputSampleStride"),
    507 		s8_comp("InputTransmitStride"),
    508 		s8_comp("OutputChannelStride"),
    509 		s8_comp("OutputSampleStride"),
    510 		s8_comp("OutputTransmitStride"),
    511 		s8_comp("SampleCount"),
    512 		s8_comp("DemodulationFrequency"),
    513 		s8_comp("SamplingFrequency"),
    514 	},
    515 	(s8 []){
    516 		s8_comp("AcquisitionCount"),
    517 		s8_comp("AcquisitionKind"),
    518 		s8_comp("ChannelCount"),
    519 		s8_comp("InterpolationMode"),
    520 		s8_comp("SampleCount"),
    521 		s8_comp("TransmitReceiveOrientation"),
    522 		s8_comp("DemodulationFrequency"),
    523 		s8_comp("FNumber"),
    524 		s8_comp("FocusDepth"),
    525 		s8_comp("SamplingFrequency"),
    526 		s8_comp("SpeedOfSound"),
    527 		s8_comp("TimeOffset"),
    528 		s8_comp("TransmitAngle"),
    529 	},
    530 	0,
    531 	0,
    532 	0,
    533 };
    534 
    535 read_only global u32 beamformer_shader_bake_parameter_float_bits[] = {
    536 	0x00000000UL,
    537 	0x00000600UL,
    538 	0x00001fc0UL,
    539 	0x00000000UL,
    540 	0x00000000UL,
    541 	0x00000000UL,
    542 };
    543 
    544 read_only global i32 beamformer_shader_bake_parameter_counts[] = {
    545 	9,
    546 	11,
    547 	13,
    548 	0,
    549 	0,
    550 	0,
    551 };
    552