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


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