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 (12772B)


      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  xdc_transform;
    178 	v2  xdc_element_pitch;
    179 	uv2 raw_data_dimensions;
    180 	v2  focal_vector;
    181 	u32 transmit_receive_orientation;
    182 	u32 sample_count;
    183 	u32 channel_count;
    184 	u32 acquisition_count;
    185 	u32 das_shader_id;
    186 	f32 time_offset;
    187 	u8  single_focus;
    188 	u8  single_orientation;
    189 	u8  decode_mode;
    190 	u8  sampling_mode;
    191 	v3  output_min_coordinate;
    192 	v3  output_max_coordinate;
    193 	iv4 output_points;
    194 	f32 sampling_frequency;
    195 	f32 demodulation_frequency;
    196 	f32 speed_of_sound;
    197 	f32 f_number;
    198 	f32 off_axis_pos;
    199 	u32 interpolation_mode;
    200 	u32 coherency_weighting;
    201 	u32 beamform_plane;
    202 	u32 decimation_rate;
    203 	BeamformerEmissionKind       emission_kind;
    204 	BeamformerEmissionParameters emission_parameters;
    205 } BeamformerParameters;
    206 
    207 typedef struct {
    208 	m4  xdc_transform;
    209 	v2  xdc_element_pitch;
    210 	uv2 raw_data_dimensions;
    211 	v2  focal_vector;
    212 	u32 transmit_receive_orientation;
    213 	u32 sample_count;
    214 	u32 channel_count;
    215 	u32 acquisition_count;
    216 	u32 das_shader_id;
    217 	f32 time_offset;
    218 	u8  single_focus;
    219 	u8  single_orientation;
    220 	u8  decode_mode;
    221 	u8  sampling_mode;
    222 } BeamformerParametersHead;
    223 
    224 typedef struct {
    225 	v3  output_min_coordinate;
    226 	v3  output_max_coordinate;
    227 	iv4 output_points;
    228 	f32 sampling_frequency;
    229 	f32 demodulation_frequency;
    230 	f32 speed_of_sound;
    231 	f32 f_number;
    232 	f32 off_axis_pos;
    233 	u32 interpolation_mode;
    234 	u32 coherency_weighting;
    235 	u32 beamform_plane;
    236 	u32 decimation_rate;
    237 } BeamformerUIParameters;
    238 
    239 typedef struct {
    240 	m4  xdc_transform;
    241 	v2  xdc_element_pitch;
    242 	uv2 raw_data_dimensions;
    243 	v2  focal_vector;
    244 	u32 transmit_receive_orientation;
    245 	u32 sample_count;
    246 	u32 channel_count;
    247 	u32 acquisition_count;
    248 	u32 das_shader_id;
    249 	f32 time_offset;
    250 	u8  single_focus;
    251 	u8  single_orientation;
    252 	u8  decode_mode;
    253 	u8  sampling_mode;
    254 	v3  output_min_coordinate;
    255 	v3  output_max_coordinate;
    256 	iv4 output_points;
    257 	f32 sampling_frequency;
    258 	f32 demodulation_frequency;
    259 	f32 speed_of_sound;
    260 	f32 f_number;
    261 	f32 off_axis_pos;
    262 	u32 interpolation_mode;
    263 	u32 coherency_weighting;
    264 	u32 beamform_plane;
    265 	u32 decimation_rate;
    266 	BeamformerEmissionKind       emission_kind;
    267 	BeamformerEmissionParameters emission_parameters;
    268 	i16 channel_mapping[256];
    269 	i16 sparse_elements[256];
    270 	u8  transmit_receive_orientations[256];
    271 	f32 steering_angles[256];
    272 	f32 focal_depths[256];
    273 	i32 compute_stages[16];
    274 	i32 compute_stage_parameters[16];
    275 	u32 compute_stages_count;
    276 	i32 data_kind;
    277 } BeamformerSimpleParameters;
    278 
    279 typedef struct {
    280 	BeamformerFilterKind kind;
    281 	union {
    282 		struct {
    283 			f32 cutoff_frequency;
    284 			f32 beta;
    285 			u32 length;
    286 		} kaiser;
    287 		struct {
    288 			f32 duration;
    289 			f32 min_frequency;
    290 			f32 max_frequency;
    291 		} matched_chirp;
    292 	};
    293 	f32 sampling_frequency;
    294 	b16 complex;
    295 } BeamformerFilterParameters;
    296 
    297 read_only global u8 beamformer_data_kind_element_size[] = {
    298 	2,
    299 	2,
    300 	4,
    301 	4,
    302 };
    303 
    304 read_only global u8 beamformer_data_kind_element_count[] = {
    305 	1,
    306 	2,
    307 	1,
    308 	2,
    309 };
    310 
    311 read_only global u8 beamformer_data_kind_byte_size[] = {
    312 	2 * 1,
    313 	2 * 2,
    314 	4 * 1,
    315 	4 * 2,
    316 };
    317 
    318 read_only global u8 beamformer_acquisition_kind_has_fixed_transmits[] = {
    319 	1,
    320 	0,
    321 	1,
    322 	0,
    323 	0,
    324 	0,
    325 	1,
    326 	1,
    327 	0,
    328 	0,
    329 	0,
    330 	0,
    331 };
    332 
    333 read_only global s8 beamformer_acquisition_kind_strings[] = {
    334 	s8_comp("FORCES"),
    335 	s8_comp("UFORCES"),
    336 	s8_comp("HERCULES"),
    337 	s8_comp("VLS"),
    338 	s8_comp("TPW"),
    339 	s8_comp("UHERCULES"),
    340 	s8_comp("RACES"),
    341 	s8_comp("EPIC-FORCES"),
    342 	s8_comp("EPIC-UFORCES"),
    343 	s8_comp("EPIC-UHERCULES"),
    344 	s8_comp("Flash"),
    345 	s8_comp("HERO-PA"),
    346 };
    347 
    348 read_only global s8 beamformer_filter_kind_strings[] = {
    349 	s8_comp("Kaiser"),
    350 	s8_comp("MatchedChirp"),
    351 };
    352 
    353 read_only global s8 beamformer_interpolation_mode_strings[] = {
    354 	s8_comp("Nearest"),
    355 	s8_comp("Linear"),
    356 	s8_comp("Cubic"),
    357 };
    358 
    359 read_only global s8 beamformer_shader_names[] = {
    360 	s8_comp("CudaDecode"),
    361 	s8_comp("CudaHilbert"),
    362 	s8_comp("Decode"),
    363 	s8_comp("Filter"),
    364 	s8_comp("Demodulate"),
    365 	s8_comp("DAS"),
    366 	s8_comp("MinMax"),
    367 	s8_comp("Sum"),
    368 	s8_comp("Render3D"),
    369 };
    370 
    371 read_only global BeamformerShaderKind beamformer_reloadable_shader_kinds[] = {
    372 	BeamformerShaderKind_Decode,
    373 	BeamformerShaderKind_Filter,
    374 	BeamformerShaderKind_DAS,
    375 	BeamformerShaderKind_MinMax,
    376 	BeamformerShaderKind_Sum,
    377 	BeamformerShaderKind_Render3D,
    378 };
    379 
    380 read_only global s8 beamformer_reloadable_shader_files[] = {
    381 	s8_comp("decode.glsl"),
    382 	s8_comp("filter.glsl"),
    383 	s8_comp("das.glsl"),
    384 	s8_comp("min_max.glsl"),
    385 	s8_comp("sum.glsl"),
    386 	s8_comp("render_3d.frag.glsl"),
    387 };
    388 
    389 read_only global i32 beamformer_shader_reloadable_index_by_shader[] = {
    390 	-1,
    391 	-1,
    392 	0,
    393 	1,
    394 	1,
    395 	2,
    396 	3,
    397 	4,
    398 	5,
    399 };
    400 
    401 read_only global i32 beamformer_reloadable_compute_shader_info_indices[] = {
    402 	0,
    403 	1,
    404 	2,
    405 	3,
    406 	4,
    407 };
    408 
    409 read_only global i32 beamformer_reloadable_render_shader_info_indices[] = {
    410 	5,
    411 };
    412 
    413 read_only global s8 beamformer_shader_global_header_strings[] = {
    414 	s8_comp(""
    415 	"#define DataKind_Int16          0\n"
    416 	"#define DataKind_Int16Complex   1\n"
    417 	"#define DataKind_Float32        2\n"
    418 	"#define DataKind_Float32Complex 3\n"
    419 	"\n"),
    420 	s8_comp(""
    421 	"#define DecodeMode_None     0\n"
    422 	"#define DecodeMode_Hadamard 1\n"
    423 	"\n"),
    424 	s8_comp(""
    425 	"#define AcquisitionKind_FORCES         0\n"
    426 	"#define AcquisitionKind_UFORCES        1\n"
    427 	"#define AcquisitionKind_HERCULES       2\n"
    428 	"#define AcquisitionKind_RCA_VLS        3\n"
    429 	"#define AcquisitionKind_RCA_TPW        4\n"
    430 	"#define AcquisitionKind_UHERCULES      5\n"
    431 	"#define AcquisitionKind_RACES          6\n"
    432 	"#define AcquisitionKind_EPIC_FORCES    7\n"
    433 	"#define AcquisitionKind_EPIC_UFORCES   8\n"
    434 	"#define AcquisitionKind_EPIC_UHERCULES 9\n"
    435 	"#define AcquisitionKind_Flash          10\n"
    436 	"#define AcquisitionKind_HERO_PA        11\n"
    437 	"\n"),
    438 	s8_comp(""
    439 	"#define InterpolationMode_Nearest 0\n"
    440 	"#define InterpolationMode_Linear  1\n"
    441 	"#define InterpolationMode_Cubic   2\n"
    442 	"\n"),
    443 	s8_comp(""
    444 	"#define RCAOrientation_None    0\n"
    445 	"#define RCAOrientation_Rows    1\n"
    446 	"#define RCAOrientation_Columns 2\n"
    447 	"\n"),
    448 };
    449 
    450 read_only global s8 *beamformer_shader_flag_strings[] = {
    451 	(s8 []){
    452 		s8_comp("DilateOutput"),
    453 		s8_comp("UseSharedMemory"),
    454 	},
    455 	(s8 []){
    456 		s8_comp("ComplexFilter"),
    457 		s8_comp("OutputFloats"),
    458 		s8_comp("Demodulate"),
    459 	},
    460 	(s8 []){
    461 		s8_comp("Fast"),
    462 		s8_comp("Sparse"),
    463 		s8_comp("CoherencyWeighting"),
    464 		s8_comp("SingleFocus"),
    465 		s8_comp("SingleOrientation"),
    466 	},
    467 	0,
    468 	0,
    469 	0,
    470 };
    471 
    472 read_only global u8 beamformer_shader_flag_strings_count[] = {
    473 	2,
    474 	3,
    475 	5,
    476 	0,
    477 	0,
    478 	0,
    479 };
    480 
    481 read_only global i32 *beamformer_shader_header_vectors[] = {
    482 	(i32 []){0, 1},
    483 	(i32 []){0},
    484 	(i32 []){2, 0, 3, 4},
    485 	0,
    486 	0,
    487 	0,
    488 };
    489 
    490 read_only global i32 beamformer_shader_header_vector_lengths[] = {
    491 	2,
    492 	1,
    493 	4,
    494 	0,
    495 	0,
    496 	0,
    497 };
    498 
    499 read_only global s8 *beamformer_shader_bake_parameter_names[] = {
    500 	(s8 []){
    501 		s8_comp("DecodeMode"),
    502 		s8_comp("InputChannelStride"),
    503 		s8_comp("InputSampleStride"),
    504 		s8_comp("InputTransmitStride"),
    505 		s8_comp("OutputChannelStride"),
    506 		s8_comp("OutputSampleStride"),
    507 		s8_comp("OutputTransmitStride"),
    508 		s8_comp("ToProcess"),
    509 		s8_comp("TransmitCount"),
    510 	},
    511 	(s8 []){
    512 		s8_comp("DecimationRate"),
    513 		s8_comp("FilterLength"),
    514 		s8_comp("InputChannelStride"),
    515 		s8_comp("InputSampleStride"),
    516 		s8_comp("InputTransmitStride"),
    517 		s8_comp("OutputChannelStride"),
    518 		s8_comp("OutputSampleStride"),
    519 		s8_comp("OutputTransmitStride"),
    520 		s8_comp("SampleCount"),
    521 		s8_comp("DemodulationFrequency"),
    522 		s8_comp("SamplingFrequency"),
    523 	},
    524 	(s8 []){
    525 		s8_comp("AcquisitionCount"),
    526 		s8_comp("AcquisitionKind"),
    527 		s8_comp("ChannelCount"),
    528 		s8_comp("InterpolationMode"),
    529 		s8_comp("SampleCount"),
    530 		s8_comp("TransmitReceiveOrientation"),
    531 		s8_comp("DemodulationFrequency"),
    532 		s8_comp("FNumber"),
    533 		s8_comp("FocusDepth"),
    534 		s8_comp("SamplingFrequency"),
    535 		s8_comp("SpeedOfSound"),
    536 		s8_comp("TimeOffset"),
    537 		s8_comp("TransmitAngle"),
    538 	},
    539 	0,
    540 	0,
    541 	0,
    542 };
    543 
    544 read_only global u32 beamformer_shader_bake_parameter_float_bits[] = {
    545 	0x00000000UL,
    546 	0x00000600UL,
    547 	0x00001fc0UL,
    548 	0x00000000UL,
    549 	0x00000000UL,
    550 	0x00000000UL,
    551 };
    552 
    553 read_only global i32 beamformer_shader_bake_parameter_counts[] = {
    554 	9,
    555 	11,
    556 	13,
    557 	0,
    558 	0,
    559 	0,
    560 };
    561