beamformer_parameters.h (4971B)
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 DAS_ID_UFORCES 0 21 #define DAS_ID_HERCULES 1 22 #define DAS_ID_RCA 2 23 24 #define MAX_BEAMFORMED_SAVED_FRAMES 16 25 #define MAX_MULTI_XDC_COUNT 4 26 /* NOTE: This struct follows the OpenGL std140 layout. DO NOT modify unless you have 27 * read and understood the rules, particulary with regards to _member alignment_ */ 28 typedef struct { 29 u16 channel_mapping[512]; /* Transducer Channel to Verasonics Channel */ 30 u32 uforces_channels[128]; /* Channels used for virtual UFORCES elements */ 31 f32 focal_depths[128]; /* [m] Focal Depths for each transmit of a RCA imaging scheme*/ 32 f32 transmit_angles[128]; /* [radians] Transmit Angles for each transmit of a RCA imaging scheme*/ 33 f32 xdc_origin[4 * MAX_MULTI_XDC_COUNT]; /* [m] Corner of transducer being treated as origin */ 34 f32 xdc_corner1[4 * MAX_MULTI_XDC_COUNT]; /* [m] Corner of transducer along first axis */ 35 f32 xdc_corner2[4 * MAX_MULTI_XDC_COUNT]; /* [m] Corner of transducer along second axis */ 36 uv4 dec_data_dim; /* Samples * Channels * Acquisitions; last element ignored */ 37 uv4 output_points; /* Width * Height * Depth * (Frame Average Count) */ 38 v4 output_min_coordinate; /* [m] Back-Top-Left corner of output region (w ignored) */ 39 v4 output_max_coordinate; /* [m] Front-Bottom-Right corner of output region (w ignored)*/ 40 uv2 rf_raw_dim; /* Raw Data Dimensions */ 41 u32 decode; /* Decode or just reshape data */ 42 u32 xdc_count; /* Number of Transducer Arrays (4 max) */ 43 u32 channel_offset; /* Offset into channel_mapping: 0 or 128 (rows or columns) */ 44 f32 speed_of_sound; /* [m/s] */ 45 f32 sampling_frequency; /* [Hz] */ 46 f32 center_frequency; /* [Hz] */ 47 f32 time_offset; /* pulse length correction time [s] */ 48 f32 off_axis_pos; /* [m] Position on screen normal to beamform in 2D HERCULES */ 49 i32 beamform_plane; /* Plane to Beamform in 2D HERCULES */ 50 f32 f_number; /* F# (set to 0 to disable) */ 51 u32 das_shader_id; 52 f32 _pad[3]; 53 } BeamformerParameters; 54 55 /* NOTE: garbage to get the prepocessor to properly stringize the value of a macro */ 56 #define str_(x) #x 57 #define str(x) str_(x) 58 59 #define COMPUTE_SHADER_HEADER "\ 60 #version 460 core\n\ 61 \n\ 62 layout(std140, binding = 0) uniform parameters {\n\ 63 uvec4 channel_mapping[64]; /* Transducer Channel to Verasonics Channel */\n\ 64 uvec4 uforces_channels[32]; /* Channels used for virtual UFORCES elements */\n\ 65 vec4 focal_depths[32]; /* [m] Focal Depths for each transmit of a RCA imaging scheme*/\n\ 66 vec4 transmit_angles[32]; /* [radians] Transmit Angles for each transmit of a RCA imaging scheme*/\n\ 67 vec4 xdc_origin[" str(MAX_MULTI_XDC_COUNT) "]; /* [m] Corner of transducer being treated as origin */\n\ 68 vec4 xdc_corner1[" str(MAX_MULTI_XDC_COUNT) "]; /* [m] Corner of transducer along first axis (arbitrary) */\n\ 69 vec4 xdc_corner2[" str(MAX_MULTI_XDC_COUNT) "]; /* [m] Corner of transducer along second axis (arbitrary) */\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 uvec2 rf_raw_dim; /* Raw Data Dimensions */\n\ 75 uint decode; /* Decode or just reshape data */\n\ 76 uint xdc_count; /* Number of Transducer Arrays (4 max) */\n\ 77 uint channel_offset; /* Offset into channel_mapping: 0 or 128 (rows or columns) */\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 DAS_ID_UFORCES " str(DAS_ID_UFORCES) "\n\ 89 #define DAS_ID_HERCULES " str(DAS_ID_HERCULES) "\n\ 90 #define DAS_ID_RCA " str(DAS_ID_RCA) "\n\n\ 91 #line 0\n"