ngscopeclient v0.2.2
Loading...
Searching...
No Matches
ConstellationFilter.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopeprotocols *
4* *
5* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
6* All rights reserved. *
7* *
8* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
9* following conditions are met: *
10* *
11* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
12* following disclaimer. *
13* *
14* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
15* following disclaimer in the documentation and/or other materials provided with the distribution. *
16* *
17* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
18* derived from this software without specific prior written permission. *
19* *
20* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
22* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
26* POSSIBILITY OF SUCH DAMAGE. *
27* *
28***********************************************************************************************************************/
29
36#ifndef ConstellationFilter_h
37#define ConstellationFilter_h
38
39#include "../scopehal/ConstellationWaveform.h"
40#include "../scopehal/ActionProvider.h"
41
43{
44public:
45 uint32_t width;
46 uint32_t height;
47 uint32_t inlen;
48 uint32_t samplesPerThread;
49 uint32_t nConstellationPoints;
50 float xmid;
51 float ymid;
52 float xscale;
53 float yscale;
54};
55
57{
58public:
59 ConstellationPoint(int64_t x, float y, float xn, float yn)
60 : m_xval(x)
61 , m_yval(y)
62 , m_xnorm(xn)
63 , m_ynorm(yn)
64 {}
65
68
70 float m_yval;
71
73 float m_xnorm;
74
76 float m_ynorm;
77};
78
80 : public Filter
81 , public ActionProvider
82{
83public:
84 ConstellationFilter(const std::string& color);
85
86 virtual void Refresh(vk::raii::CommandBuffer& cmdBuf, std::shared_ptr<QueueHandle> queue) override;
87 virtual uint32_t GetExecutionCapabilitiesMask() override;
88
89 static std::string GetProtocolName();
90
91 virtual float GetVoltageRange(size_t stream) override;
92 virtual float GetOffset(size_t stream) override;
93
94 virtual void ClearSweeps() override;
95
96 virtual std::vector<std::string> EnumActions() override;
97 virtual bool PerformAction(const std::string& id) override;
98
99 ConstellationWaveform* ReallocateWaveform();
100
101 void SetWidth(size_t width)
102 {
103 if(m_width != width)
104 {
105 SetData(nullptr, 0);
106 m_width = width;
107 }
108 }
109
110 void SetHeight(size_t height)
111 {
112 if(m_height != height)
113 {
114 SetData(nullptr, 0);
115 m_height = height;
116 }
117 }
118
119 int64_t GetXOffset()
120 { return 0; }
121
122 float GetXScale()
123 { return m_xscale; }
124
125 size_t GetWidth() const
126 { return m_width; }
127
128 size_t GetHeight() const
129 { return m_height; }
130
131 PROTOCOL_DECODER_INITPROC(ConstellationFilter)
132
133 enum modulation_t
134 {
135 MOD_NONE,
136 MOD_QAM4,
137 MOD_QAM9,
138 MOD_QAM16,
139 MOD_QAM32,
140 MOD_QAM64,
141 MOD_PSK8
142 };
143
144 const std::vector<ConstellationPoint>& GetNominalPoints()
145 { return m_points; }
146
147protected:
148 void RecomputeNominalPoints();
149 void GetMinMaxSymbols(
150 std::vector<size_t>& hist,
151 float vmin,
152 float& vmin_out,
153 float& vmax_out,
154 float binsize,
155 size_t order,
156 ssize_t nbins);
157
158 size_t m_height;
159 size_t m_width;
160
161 float m_xscale;
162
163 FilterParameter& m_modulation;
164 FilterParameter& m_nomci;
165 FilterParameter& m_nomcq;
166 FilterParameter& m_nomr;
167
168 double m_evmSum;
169 int64_t m_evmCount;
170
172 std::vector<ConstellationPoint> m_points;
173
176
179
182
185
187 std::shared_ptr<ComputePipeline> m_constellationComputePipeline;
188
190 std::shared_ptr<ComputePipeline> m_normalizeReduceComputePipeline;
191
193 std::shared_ptr<ComputePipeline> m_normalizeScaleComputePipeline;
194};
195
196#endif
Definition AcceleratorBuffer.h:204
Abstract base for objects (usually filters) which provide a series of actions a user can perform.
Definition ActionProvider.h:48
Definition ConstellationFilter.h:82
virtual bool PerformAction(const std::string &id) override
Perform a specific action.
Definition ConstellationFilter.cpp:467
AcceleratorBuffer< float > m_xvpoints
X position, in volts, of each constellation point.
Definition ConstellationFilter.h:175
virtual uint32_t GetExecutionCapabilitiesMask() override
Returns a bitmask of ExecutionCapabilities fields.
Definition ConstellationFilter.cpp:133
virtual void ClearSweeps() override
Clears any integrated data from past triggers (e.g. eye patterns).
Definition ConstellationFilter.cpp:126
std::shared_ptr< ComputePipeline > m_constellationComputePipeline
Compute pipeline for the main constellation integration.
Definition ConstellationFilter.h:187
std::shared_ptr< ComputePipeline > m_normalizeScaleComputePipeline
Compute pipeline for normalizing the constellation.
Definition ConstellationFilter.h:193
std::shared_ptr< ComputePipeline > m_normalizeReduceComputePipeline
Compute pipeline for finding the maximum amplitude of the constellation.
Definition ConstellationFilter.h:190
std::vector< ConstellationPoint > m_points
Nominal locations of each constellation point (host-side metadata)
Definition ConstellationFilter.h:172
AcceleratorBuffer< float > m_yvpoints
Y position, in volts, of each constellation point.
Definition ConstellationFilter.h:178
AcceleratorBuffer< float > m_evmScratchpad
EVM calculation scratchpad buffer.
Definition ConstellationFilter.h:181
virtual std::vector< std::string > EnumActions() override
Return a list of all actions which may be performed on the object.
Definition ConstellationFilter.cpp:460
AcceleratorBuffer< int64_t > m_normalizeMaxBuf
Max amplitude of the constellation.
Definition ConstellationFilter.h:184
Definition ConstellationFilter.h:57
int64_t m_xval
Nominal X coordinate.
Definition ConstellationFilter.h:67
float m_ynorm
Normalized Y coordinate.
Definition ConstellationFilter.h:76
float m_xnorm
Normalized X coordinate.
Definition ConstellationFilter.h:73
float m_yval
Nominal Y coordinate.
Definition ConstellationFilter.h:70
Definition ConstellationFilter.h:43
A constellation diagram.
Definition ConstellationWaveform.h:48
A parameter to a filter.
Definition FilterParameter.h:86
Abstract base class for all filter graph blocks which are not physical instrument channels.
Definition Filter.h:105
void SetData(WaveformBase *pNew, size_t stream)
Sets the waveform data for a given stream, replacing any previous waveform.
Definition InstrumentChannel.cpp:144