beamformer_parameters.h (4803B)
1 /* See LICENSE for license details. */ 2 3 /* X(enumarant, number, shader file name, needs header, pretty name) */ 4 #define COMPUTE_SHADERS \ 5 X(CUDA_DECODE, 0, "", 0, "CUDA Decoding") \ 6 X(CUDA_HILBERT, 1, "", 0, "CUDA Hilbert") \ 7 X(DAS, 2, "das", 1, "DAS") \ 8 X(DEMOD, 3, "demod", 1, "Demodulation") \ 9 X(HADAMARD, 4, "hadamard", 1, "Decoding") \ 10 X(MIN_MAX, 5, "min_max", 0, "Min/Max") \ 11 X(SUM, 6, "sum", 0, "Sum") 12 13 enum compute_shaders { 14 #define X(e, n, s, h, pn) CS_ ##e = n, 15 COMPUTE_SHADERS 16 #undef X 17 CS_LAST 18 }; 19 20 #define DECODE_MODE_NONE 0 21 #define DECODE_MODE_HADAMARD 1 22 23 #define DAS_ID_FORCES 0 24 #define DAS_ID_UFORCES 1 25 #define DAS_ID_HERCULES 2 26 #define DAS_ID_RCA_VLS 3 27 #define DAS_ID_RCA_TPW 4 28 29 #define MAX_BEAMFORMED_SAVED_FRAMES 16 30 /* NOTE: This struct follows the OpenGL std140 layout. DO NOT modify unless you have 31 * read and understood the rules, particulary with regards to _member alignment_ */ 32 typedef struct { 33 u16 channel_mapping[256]; /* Transducer Channel to Verasonics Channel */ 34 u16 uforces_channels[256]; /* Channels used for virtual UFORCES elements */ 35 f32 focal_depths[256]; /* [m] Focal Depths for each transmit of a RCA imaging scheme*/ 36 f32 transmit_angles[256]; /* [radians] Transmit Angles for each transmit of a RCA imaging scheme*/ 37 f32 xdc_transform[16]; /* IMPORTANT: column major order */ 38 uv4 dec_data_dim; /* Samples * Channels * Acquisitions; last element ignored */ 39 uv4 output_points; /* Width * Height * Depth * (Frame Average Count) */ 40 v4 output_min_coordinate; /* [m] Back-Top-Left corner of output region (w ignored) */ 41 v4 output_max_coordinate; /* [m] Front-Bottom-Right corner of output region (w ignored)*/ 42 f32 xdc_element_pitch[2]; /* [m] Transducer Element Pitch {row, col} */ 43 uv2 rf_raw_dim; /* Raw Data Dimensions */ 44 i32 transmit_mode; /* Method/Orientation of Transmit */ 45 u32 decode; /* Decode or just reshape data */ 46 f32 speed_of_sound; /* [m/s] */ 47 f32 sampling_frequency; /* [Hz] */ 48 f32 center_frequency; /* [Hz] */ 49 f32 time_offset; /* pulse length correction time [s] */ 50 f32 off_axis_pos; /* [m] Position on screen normal to beamform in 2D HERCULES */ 51 i32 beamform_plane; /* Plane to Beamform in 2D HERCULES */ 52 f32 f_number; /* F# (set to 0 to disable) */ 53 u32 das_shader_id; 54 f32 _pad[2]; 55 } BeamformerParameters; 56 57 /* NOTE: garbage to get the prepocessor to properly stringize the value of a macro */ 58 #define str_(x) #x 59 #define str(x) str_(x) 60 61 #define COMPUTE_SHADER_HEADER "\ 62 #version 460 core\n\ 63 \n\ 64 layout(std140, binding = 0) uniform parameters {\n\ 65 uvec4 channel_mapping[32]; /* Transducer Channel to Verasonics Channel */\n\ 66 uvec4 uforces_channels[32]; /* Channels used for virtual UFORCES elements */\n\ 67 vec4 focal_depths[64]; /* [m] Focal Depths for each transmit of a RCA imaging scheme*/\n\ 68 vec4 transmit_angles[64]; /* [radians] Transmit Angles for each transmit of a RCA imaging scheme*/\n\ 69 mat4 xdc_transform; /* IMPORTANT: column major order */\n\ 70 uvec4 dec_data_dim; /* Samples * Channels * Acquisitions; last element ignored */\n\ 71 uvec4 output_points; /* Width * Height * Depth * (Frame Average Count) */\n\ 72 vec4 output_min_coord; /* [m] Top left corner of output region */\n\ 73 vec4 output_max_coord; /* [m] Bottom right corner of output region */\n\ 74 vec2 xdc_element_pitch; /* [m] Transducer Element Pitch {row, col} */\n\ 75 uvec2 rf_raw_dim; /* Raw Data Dimensions */\n\ 76 int transmit_mode; /* Method/Orientation of Transmit */\n\ 77 uint decode; /* Decode or just reshape data */\n\ 78 float speed_of_sound; /* [m/s] */\n\ 79 float sampling_frequency; /* [Hz] */\n\ 80 float center_frequency; /* [Hz] */\n\ 81 float time_offset; /* pulse length correction time [s] */\n\ 82 float off_axis_pos; /* [m] Position on screen normal to beamform in 2D HERCULES */\n\ 83 int beamform_plane; /* Plane to Beamform in 2D HERCULES */\n\ 84 float f_number; /* F# (set to 0 to disable) */\n\ 85 uint das_shader_id;\n\ 86 };\n\ 87 \n\ 88 #define DECODE_MODE_NONE " str(DECODE_MODE_NONE) "\n\ 89 #define DECODE_MODE_HADAMARD " str(DECODE_MODE_HADAMARD) "\n\ 90 \n\ 91 #define DAS_ID_FORCES " str(DAS_ID_FORCES) "\n\ 92 #define DAS_ID_UFORCES " str(DAS_ID_UFORCES) "\n\ 93 #define DAS_ID_HERCULES " str(DAS_ID_HERCULES) "\n\ 94 #define DAS_ID_RCA_VLS " str(DAS_ID_RCA_VLS) "\n\ 95 #define DAS_ID_RCA_TPW " str(DAS_ID_RCA_TPW) "\n\ 96 \n\ 97 #line 0\n"