ngscopeclient v0.2.1
Loading...
Searching...
No Matches
ConstellationWaveform.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
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
37#ifndef ConstellationWaveform_h
38#define ConstellationWaveform_h
39
41#include "EyeWaveform.h"
42
48{
49public:
50
51 ConstellationWaveform(size_t width, size_t height);
52 virtual ~ConstellationWaveform();
53
54 //not copyable or assignable
56 ConstellationWaveform& operator=(const ConstellationWaveform&) =delete;
57
61
65
66 void Normalize();
67
68 void Normalize(
69 vk::raii::CommandBuffer& cmdBuf,
70 std::shared_ptr<ComputePipeline> normalizeReducePipe,
71 std::shared_ptr<ComputePipeline> normalizeScalePipe,
73 );
74
77 { return m_totalSymbols; }
78
86
99
100 virtual void FreeGpuMemory() override
101 { m_accumdata.FreeGpuBuffer(); }
102
103 virtual bool HasGpuBuffer() override
104 { return m_accumdata.HasGpuBuffer(); }
105
106 virtual void PrepareForCpuAccessNonblocking(vk::raii::CommandBuffer& cmdBuf) override
107 {
108 m_outdata.PrepareForCpuAccessNonblocking(cmdBuf);
109 m_accumdata.PrepareForCpuAccessNonblocking(cmdBuf);
110 }
111
112 virtual void PrepareForCpuAccess() override
113 {
114 m_outdata.PrepareForCpuAccess();
115 m_accumdata.PrepareForCpuAccess();
116 }
117
118 virtual void PrepareForGpuAccess() override
119 {
120 m_outdata.PrepareForGpuAccess();
121 m_accumdata.PrepareForGpuAccess();
122 }
123
124 virtual void MarkSamplesModifiedFromCpu() override
125 {
126 m_outdata.MarkModifiedFromCpu();
127 m_accumdata.MarkModifiedFromCpu();
128 }
129
130 virtual void MarkSamplesModifiedFromGpu() override
131 {
132 m_outdata.MarkModifiedFromGpu();
133 m_accumdata.MarkModifiedFromGpu();
134 }
135
136 virtual void MarkModifiedFromCpu() override
137 {
138 m_outdata.MarkModifiedFromCpu();
139 m_accumdata.MarkModifiedFromCpu();
140 }
141
142 virtual void MarkModifiedFromGpu() override
143 {
144 m_outdata.MarkModifiedFromGpu();
145 m_accumdata.MarkModifiedFromGpu();
146 }
147
148protected:
149
156
159};
160
161#endif
Declaration of DensityFunctionWaveform.
Declaration of EyeWaveform.
Definition AcceleratorBuffer.h:204
bool HasGpuBuffer() const
Returns true if there is currently a GPU-side buffer.
Definition AcceleratorBuffer.h:634
T * GetCpuPointer()
Gets a pointer to the CPU-side buffer.
Definition AcceleratorBuffer.h:659
A constellation diagram.
Definition ConstellationWaveform.h:48
virtual void MarkModifiedFromGpu() override
Indicates that this waveform's sample data and timestamps have been modified on the GPU and the CPU-s...
Definition ConstellationWaveform.h:142
virtual void MarkSamplesModifiedFromGpu() override
Indicates that this waveform's sample data has been modified on the GPU and the CPU-side copy is no l...
Definition ConstellationWaveform.h:130
void Normalize()
Normalizes the waveform so that the output buffer has values in the range [0, 1].
Definition ConstellationWaveform.cpp:71
virtual bool HasGpuBuffer() override
Returns true if we have at least one buffer resident on the GPU.
Definition ConstellationWaveform.h:103
size_t m_totalSymbols
The number of symbols which have been integrated so far.
Definition ConstellationWaveform.h:158
virtual void PrepareForCpuAccess() override
Indicates that this waveform is going to be used by the CPU in the near future.
Definition ConstellationWaveform.h:112
int64_t * GetAccumData()
Returns the raw accumulator sample data.
Definition ConstellationWaveform.h:59
void IntegrateSymbols(size_t symbols)
Marks the waveform as having integrated another batch of symbols.
Definition ConstellationWaveform.h:84
size_t GetTotalSymbols()
Returns the number of integrated symbols in the constellation.
Definition ConstellationWaveform.h:76
virtual void MarkSamplesModifiedFromCpu() override
Indicates that this waveform's sample data has been modified on the CPU and the GPU-side copy is no l...
Definition ConstellationWaveform.h:124
AcceleratorBuffer< int64_t > m_accumdata
Raw accumulator buffer, not normalized.
Definition ConstellationWaveform.h:155
virtual void PrepareForCpuAccessNonblocking(vk::raii::CommandBuffer &cmdBuf) override
Indicates that this waveform is going to be used by the CPU in the near future.
Definition ConstellationWaveform.h:106
AcceleratorBuffer< int64_t > & GetAccumBuffer()
Returns the raw accumulator sample data's buffer object.
Definition ConstellationWaveform.h:63
virtual void PrepareForGpuAccess() override
Indicates that this waveform is going to be used by the GPU in the near future.
Definition ConstellationWaveform.h:118
virtual void MarkModifiedFromCpu() override
Indicates that this waveform's sample data and timestamps have been modified on the CPU and the GPU-s...
Definition ConstellationWaveform.h:136
virtual void FreeGpuMemory() override
Free GPU-side memory if we are short on VRAM or do not anticipate using this waveform for a while.
Definition ConstellationWaveform.h:100
float m_saturationLevel
Value to pre-normalize the waveform to before clipping to the range [0, 1]. Must be non-negative.
Definition ConstellationWaveform.h:98
Base class for waveforms such as eye patterns, spectrograms, and waterfalls which are conceptually a ...
Definition DensityFunctionWaveform.h:51
AcceleratorBuffer< float > m_outdata
Pixel buffer.
Definition DensityFunctionWaveform.h:137