beamformer_parameters.h (8444B)
1 /* See LICENSE for license details. */ 2 #include <stdint.h> 3 4 /* TODO(rnp): 5 * [ ]: shader kinds have ballooned; shader stats table needs to be compressed 6 * [ ]: Upload previously exported data for display. maybe this is a UI thing but doing it 7 * programatically would be nice. 8 * [ ]: Add interface for multi frame upload. RF upload already uses an offset into SM so 9 * that part works fine. We just need a way of specify a multi frame upload. (Data must 10 * be organized for simple offset access per frame). 11 */ 12 13 typedef struct { 14 /* NOTE(rnp): this wants to be iterated on both dimensions. it depends entirely on which 15 * visualization method you want to use. the coalescing function wants both directions */ 16 float times[32][BeamformerShaderKind_ComputeCount]; 17 float rf_time_deltas[32]; 18 } BeamformerComputeStatsTable; 19 20 /* TODO(rnp): this is an absolute abuse of the preprocessor, but now is 21 * not a good time to write a full metaprogram */ 22 #define BEAMFORMER_FILTER_KIND_LIST(type, _) \ 23 X(Invalid, type unused) \ 24 X(Kaiser, type cutoff_frequency _ type beta _ type length) \ 25 X(MatchedChirp, type duration _ type min_frequency _ type max_frequency) 26 27 #define X(kind, ...) BeamformerFilterKind_##kind, 28 typedef enum {BEAMFORMER_FILTER_KIND_LIST(,) BeamformerFilterKind_Count} BeamformerFilterKind; 29 #undef X 30 31 /* X(type, id, pretty name) */ 32 #define BEAMFORMER_VIEW_PLANE_TAG_LIST \ 33 X(XZ, 0, "XZ") \ 34 X(YZ, 1, "YZ") \ 35 X(XY, 2, "XY") \ 36 X(Arbitrary, 3, "Arbitrary") 37 38 typedef enum { 39 #define X(type, id, pretty) BeamformerViewPlaneTag_##type = id, 40 BEAMFORMER_VIEW_PLANE_TAG_LIST 41 #undef X 42 BeamformerViewPlaneTag_Count, 43 } BeamformerViewPlaneTag; 44 45 /* X(type, id, pretty name, fixed transmits) */ 46 #define DAS_SHADER_KIND_LIST \ 47 X(FORCES, 0, "FORCES", 1) \ 48 X(UFORCES, 1, "UFORCES", 0) \ 49 X(HERCULES, 2, "HERCULES", 1) \ 50 X(RCA_VLS, 3, "VLS", 0) \ 51 X(RCA_TPW, 4, "TPW", 0) \ 52 X(UHERCULES, 5, "UHERCULES", 0) \ 53 X(RACES, 6, "RACES", 1) \ 54 X(EPIC_FORCES, 7, "EPIC-FORCES", 1) \ 55 X(EPIC_UFORCES, 8, "EPIC-UFORCES", 0) \ 56 X(EPIC_UHERCULES, 9, "EPIC-UHERCULES", 0) \ 57 X(Flash, 10, "Flash", 0) 58 59 typedef enum { 60 #define X(type, id, ...) BeamformerDASKind_##type = id, 61 DAS_SHADER_KIND_LIST 62 #undef X 63 BeamformerDASKind_Count 64 } BeamformerDASKind; 65 66 #define FILTER_LOCAL_SIZE_X 64 67 #define FILTER_LOCAL_SIZE_Y 1 68 #define FILTER_LOCAL_SIZE_Z 1 69 70 #define DECODE_LOCAL_SIZE_X 4 71 #define DECODE_LOCAL_SIZE_Y 1 72 #define DECODE_LOCAL_SIZE_Z 16 73 74 #define DECODE_FIRST_PASS_UNIFORM_LOC 1 75 76 #define DAS_LOCAL_SIZE_X 16 77 #define DAS_LOCAL_SIZE_Y 1 78 #define DAS_LOCAL_SIZE_Z 16 79 80 #define DAS_VOXEL_OFFSET_UNIFORM_LOC 2 81 #define DAS_CYCLE_T_UNIFORM_LOC 3 82 #define DAS_FAST_CHANNEL_UNIFORM_LOC 4 83 84 #define MIN_MAX_MIPS_LEVEL_UNIFORM_LOC 1 85 #define SUM_PRESCALE_UNIFORM_LOC 1 86 87 #define BEAMFORMER_CONSTANTS_LIST \ 88 X(FilterSlots, 4) \ 89 X(MaxChannelCount, 256) \ 90 X(MaxComputeShaderStages, 16) \ 91 X(MaxParameterBlockSlots, 16) \ 92 X(MaxRawDataFramesInFlight, 3) \ 93 X(MaxSavedFrames, 16) 94 #define X(k, v, ...) Beamformer##k = v, 95 typedef enum {BEAMFORMER_CONSTANTS_LIST} BeamformerConstants; 96 #undef X 97 98 /* X(name, type, size, matlab_type, elements, comment) */ 99 #define BEAMFORMER_PARAMS_HEAD \ 100 X(xdc_transform, float, [16], single, 16, "IMPORTANT: column major order") \ 101 X(xdc_element_pitch, float, [2], single, 2, "[m] Transducer Element Pitch {row, col}") \ 102 X(raw_data_dimensions, uint32_t, [2], uint32, 2, "Raw Data Dimensions") \ 103 X(sample_count, uint32_t, , uint32, 1, "") \ 104 X(channel_count, uint32_t, , uint32, 1, "") \ 105 X(acquisition_count, uint32_t, , uint32, 1, "") \ 106 X(das_shader_id, uint32_t, , uint32, 1, "") \ 107 X(time_offset, float, , single, 1, "pulse length correction time [s]") \ 108 X(decode, uint8_t, , uint8, 1, "Decode or just reshape data") \ 109 X(transmit_mode, uint8_t, , uint8, 1, "Method/Orientation of Transmit") \ 110 X(receive_mode, uint8_t, , uint8, 1, "Method/Orientation of Receive") \ 111 X(sampling_mode, uint8_t, , uint8, 1, "") 112 113 #define BEAMFORMER_UI_PARAMS \ 114 X(output_min_coordinate, float, [3], single, 3, "[m] Back-Top-Left corner of output region") \ 115 X(output_max_coordinate, float, [3], single, 3, "[m] Front-Bottom-Right corner of output region") \ 116 X(output_points, int32_t, [4], int32, 4, "Width * Height * Depth * (Frame Average Count)") \ 117 X(sampling_frequency, float, , single, 1, "[Hz]") \ 118 X(demodulation_frequency, float, , single, 1, "[Hz]") \ 119 X(speed_of_sound, float, , single, 1, "[m/s]") \ 120 X(f_number, float, , single, 1, "F# (set to 0 to disable)") \ 121 X(off_axis_pos, float, , single, 1, "[m] Position on screen normal to beamform in TPW/VLS/HERCULES") \ 122 X(interpolate, uint32_t, , uint32, 1, "Perform Cubic Interpolation of RF Samples") \ 123 X(coherency_weighting, uint32_t, , uint32, 1, "Apply coherency weighting to output data") \ 124 X(beamform_plane, uint32_t, , uint32, 1, "Plane to Beamform in TPW/VLS/HERCULES") \ 125 X(decimation_rate, uint32_t, , uint32, 1, "Number of times to decimate") 126 127 #define BEAMFORMER_SIMPLE_PARAMS \ 128 X(channel_mapping, int16_t, [BeamformerMaxChannelCount], int16, BeamformerMaxChannelCount) \ 129 X(sparse_elements, int16_t, [BeamformerMaxChannelCount], int16, BeamformerMaxChannelCount) \ 130 X(steering_angles, float, [BeamformerMaxChannelCount], single, BeamformerMaxChannelCount) \ 131 X(focal_depths, float, [BeamformerMaxChannelCount], single, BeamformerMaxChannelCount) \ 132 X(compute_stages, int32_t, [BeamformerMaxComputeShaderStages], int32, BeamformerMaxComputeShaderStages) \ 133 X(compute_stage_parameters, int16_t, [BeamformerMaxComputeShaderStages], int16, BeamformerMaxComputeShaderStages) \ 134 X(compute_stages_count, uint32_t, , uint32, 1) \ 135 X(data_kind, int32_t, , int32, 1) 136 137 #define X(name, type, size, ...) type name size; 138 typedef struct {BEAMFORMER_PARAMS_HEAD} BeamformerParametersHead; 139 typedef struct {BEAMFORMER_UI_PARAMS} BeamformerUIParameters; 140 141 typedef struct { 142 BEAMFORMER_PARAMS_HEAD 143 BEAMFORMER_UI_PARAMS 144 } BeamformerParameters; 145 146 typedef struct { 147 BEAMFORMER_PARAMS_HEAD 148 BEAMFORMER_UI_PARAMS 149 BEAMFORMER_SIMPLE_PARAMS 150 } BeamformerSimpleParameters; 151 #undef X 152 153 #define BEAMFORMER_LIVE_IMAGING_DIRTY_FLAG_LIST \ 154 X(ImagePlaneOffsets, 0) \ 155 X(TransmitPower, 1) \ 156 X(TGCControlPoints, 2) \ 157 X(SaveData, 3) \ 158 X(SaveNameTag, 4) \ 159 X(StopImaging, 5) 160 /* NOTE(rnp): if this exceeds 32 you need to fix the flag handling code */ 161 162 #define BEAMFORMER_LIVE_IMAGING_PARAMETERS_LIST \ 163 X(active, uint32_t, , 1) \ 164 X(save_enabled, uint32_t, , 1) \ 165 X(save_active, uint32_t, , 1) \ 166 X(transmit_power, float, , 1) \ 167 X(image_plane_offsets, float, [BeamformerViewPlaneTag_Count], BeamformerViewPlaneTag_Count) \ 168 X(tgc_control_points, float, [8], 8) \ 169 X(save_name_tag_length, int32_t, , 1) \ 170 X(save_name_tag, char, [128], 128) 171 172 #define X(name, type, size, ...) type name size; 173 typedef struct {BEAMFORMER_LIVE_IMAGING_PARAMETERS_LIST} BeamformerLiveImagingParameters; 174 #undef X