beamformer_parameters.h (7664B)
1 /* See LICENSE for license details. */ 2 #include <stdint.h> 3 4 /* TODO(rnp): 5 * [ ]: Have a method for the library caller to take ownership of a "compute context" 6 * [ ]: Upload previously exported data for display. maybe this is a UI thing but doing it 7 * programatically would be nice. 8 */ 9 10 #define BEAMFORMER_PARAMETERS_VERSION (1UL) 11 12 /* X(enumarant, number, shader file name, needs header, pretty name) */ 13 #define COMPUTE_SHADERS \ 14 X(CUDA_DECODE, 0, "", 0, "CUDA Decoding") \ 15 X(CUDA_HILBERT, 1, "", 0, "CUDA Hilbert") \ 16 X(DAS, 2, "das", 1, "DAS") \ 17 X(DECODE, 3, "decode", 1, "Decoding") \ 18 X(DECODE_FLOAT, 4, "", 1, "Decoding (F32)") \ 19 X(DECODE_FLOAT_COMPLEX, 5, "", 1, "Decoding (F32C)") \ 20 X(DEMOD, 6, "demod", 1, "Demodulation") \ 21 X(MIN_MAX, 7, "min_max", 0, "Min/Max") \ 22 X(SUM, 8, "sum", 0, "Sum") 23 24 typedef enum { 25 #define X(e, n, s, h, pn) CS_ ##e = n, 26 COMPUTE_SHADERS 27 #undef X 28 CS_LAST 29 } ComputeShaderID; 30 31 /* X(type, id, pretty name) */ 32 #define DECODE_TYPES \ 33 X(NONE, 0, "None") \ 34 X(HADAMARD, 1, "Hadamard") 35 36 /* X(type, id, pretty name) */ 37 #define IMAGE_PLANE_TAGS \ 38 X(XZ, 0, "XZ") \ 39 X(YZ, 1, "YZ") \ 40 X(XY, 2, "XY") \ 41 X(ARBITRARY, 3, "Arbitrary") 42 43 typedef enum { 44 #define X(type, id, pretty) IPT_ ##type = id, 45 IMAGE_PLANE_TAGS 46 #undef X 47 IPT_LAST 48 } ImagePlaneTag; 49 50 /* X(type, id, pretty name, fixed transmits) */ 51 #define DAS_TYPES \ 52 X(FORCES, 0, "FORCES", 1) \ 53 X(UFORCES, 1, "UFORCES", 0) \ 54 X(HERCULES, 2, "HERCULES", 1) \ 55 X(RCA_VLS, 3, "VLS", 0) \ 56 X(RCA_TPW, 4, "TPW", 0) \ 57 X(UHERCULES, 5, "UHERCULES", 0) \ 58 X(RACES, 6, "RACES", 1) \ 59 X(EPIC_FORCES, 7, "EPIC-FORCES", 1) \ 60 X(EPIC_UFORCES, 8, "EPIC-UFORCES", 0) \ 61 X(EPIC_UHERCULES, 9, "EPIC-UHERCULES", 0) \ 62 X(FLASH, 10, "Flash", 0) 63 64 #define DAS_LOCAL_SIZE_X 32 65 #define DAS_LOCAL_SIZE_Y 1 66 #define DAS_LOCAL_SIZE_Z 32 67 68 #define DAS_VOXEL_OFFSET_UNIFORM_LOC 2 69 #define DAS_CYCLE_T_UNIFORM_LOC 3 70 71 #define MAX_BEAMFORMED_SAVED_FRAMES 16 72 #define MAX_COMPUTE_SHADER_STAGES 16 73 74 /* TODO(rnp): actually use a substruct but generate a header compatible with MATLAB */ 75 /* X(name, type, size, gltype, glsize, comment) */ 76 #define BEAMFORMER_UI_PARAMS \ 77 X(output_min_coordinate, float, [4], vec4, , "/* [m] Back-Top-Left corner of output region */") \ 78 X(output_max_coordinate, float, [4], vec4, , "/* [m] Front-Bottom-Right corner of output region */") \ 79 X(output_points, uint32_t, [4], uvec4, , "/* Width * Height * Depth * (Frame Average Count) */") \ 80 X(sampling_frequency, float, , float, , "/* [Hz] */") \ 81 X(center_frequency, float, , float, , "/* [Hz] */") \ 82 X(speed_of_sound, float, , float, , "/* [m/s] */") \ 83 X(off_axis_pos, float, , float, , "/* [m] Position on screen normal to beamform in TPW/VLSHERCULES */") \ 84 X(beamform_plane, int32_t, , int, , "/* Plane to Beamform in TPW/VLS/HERCULES */") \ 85 X(f_number, float, , float, , "/* F# (set to 0 to disable) */") \ 86 X(interpolate, uint32_t, , bool, , "/* Perform Cubic Interpolation of RF Samples */") 87 88 #define BEAMFORMER_PARAMS_HEAD_V0 \ 89 X(channel_mapping, uint16_t, [256], uvec4, [32], "/* Transducer Channel to Verasonics Channel */") \ 90 X(uforces_channels, uint16_t, [256], uvec4, [32], "/* Channels used for virtual UFORCES elements */") \ 91 X(focal_depths, float, [256], vec4, [64], "/* [m] Focal Depths for each transmit of a RCA imaging scheme*/") \ 92 X(transmit_angles, float, [256], vec4, [64], "/* [degrees] Transmit Angles for each transmit of a RCA imaging scheme*/") \ 93 X(xdc_transform, float, [16] , mat4, , "/* IMPORTANT: column major order */") \ 94 X(dec_data_dim, uint32_t, [4] , uvec4, , "/* Samples * Channels * Acquisitions; last element ignored */") \ 95 X(xdc_element_pitch, float, [2] , vec2, , "/* [m] Transducer Element Pitch {row, col} */") \ 96 X(rf_raw_dim, uint32_t, [2] , uvec2, , "/* Raw Data Dimensions */") \ 97 X(transmit_mode, int32_t, , int, , "/* Method/Orientation of Transmit */") \ 98 X(decode, uint32_t, , uint, , "/* Decode or just reshape data */") \ 99 X(das_shader_id, uint32_t, , uint, , "") \ 100 X(time_offset, float, , float, , "/* pulse length correction time [s] */") 101 102 #define BEAMFORMER_PARAMS_HEAD \ 103 X(xdc_transform, float, [16], mat4, , "/* IMPORTANT: column major order */") \ 104 X(dec_data_dim, uint32_t, [4] , uvec4, , "/* Samples * Channels * Acquisitions; last element ignored */") \ 105 X(xdc_element_pitch, float, [2] , vec2, , "/* [m] Transducer Element Pitch {row, col} */") \ 106 X(rf_raw_dim, uint32_t, [2] , uvec2, , "/* Raw Data Dimensions */") \ 107 X(transmit_mode, int32_t, , int, , "/* Method/Orientation of Transmit */") \ 108 X(decode, uint32_t, , uint, , "/* Decode or just reshape data */") \ 109 X(das_shader_id, uint32_t, , uint, , "") \ 110 X(time_offset, float, , float, , "/* pulse length correction time [s] */") 111 112 #define BEAMFORMER_PARAMS_TAIL \ 113 X(readi_group_id, uint32_t, , uint, , "/* Which readi group this data is from */") \ 114 X(readi_group_size, uint32_t, , uint, , "/* Size of readi transmit group */") 115 116 #define X(name, type, size, gltype, glsize, comment) type name size; 117 typedef struct { BEAMFORMER_UI_PARAMS } BeamformerUIParameters; 118 typedef struct { BEAMFORMER_PARAMS_HEAD } BeamformerParametersHead; 119 typedef struct { BEAMFORMER_PARAMS_TAIL } BeamformerParametersTail; 120 121 typedef struct { 122 BEAMFORMER_PARAMS_HEAD_V0 123 BEAMFORMER_UI_PARAMS 124 BEAMFORMER_PARAMS_TAIL 125 float _pad[3]; 126 } BeamformerParametersV0; 127 128 /* NOTE: This struct follows the OpenGL std140 layout. DO NOT modify unless you have 129 * read and understood the rules, particulary with regards to _member alignment_ */ 130 typedef struct { 131 BEAMFORMER_PARAMS_HEAD 132 BEAMFORMER_UI_PARAMS 133 BEAMFORMER_PARAMS_TAIL 134 float _pad[3]; 135 } BeamformerParameters; 136 #undef X 137 138 /* NOTE(rnp): keep this header importable for old C versions */ 139 #if __STDC_VERSION__ >= 201112L 140 _Static_assert((offsetof(BeamformerParameters, output_min_coordinate) & 15) == 0, 141 "BeamformerParameters.output_min_coordinate must lie on a 16 byte boundary"); 142 _Static_assert((sizeof(BeamformerParameters) & 15) == 0, 143 "sizeof(BeamformerParameters) must be a multiple of 16"); 144 #endif