ngscopeclient 0.1-dev+51fbda87c
DensityFunctionWaveform.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2024 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
38#ifndef DensityFunctionWaveform_h
39#define DensityFunctionWaveform_h
40
41#include "Waveform.h"
42
51{
52public:
53
54 DensityFunctionWaveform(size_t width, size_t height);
56
57 //not copyable or assignable
59 DensityFunctionWaveform& operator=(const DensityFunctionWaveform&) =delete;
60
61 //nothing to do if not gpu accelerated
62 virtual void Rename([[maybe_unused]] const std::string& name = "") override
63 {}
64
66 float* GetData()
67 {
69 return m_outdata.GetCpuPointer();
70 }
71
74 { return m_outdata; }
75
77 size_t GetHeight()
78 { return m_height; }
79
81 size_t GetWidth()
82 { return m_width; }
83
84 //Unused virtual methods from WaveformBase that we have to override
85 virtual void clear() override
86 {}
87
88 virtual void Resize([[maybe_unused]] size_t unused) override
89 {}
90
91 virtual void PrepareForCpuAccess() override
93
94 virtual void PrepareForGpuAccess() override
96
97 virtual void MarkSamplesModifiedFromCpu() override
99
100 virtual void MarkSamplesModifiedFromGpu() override
102
103 virtual void MarkModifiedFromCpu() override
105
106 virtual void MarkModifiedFromGpu() override
108
109 //we have no linear sample buffer so return 0
110 virtual size_t size() const override
111 { return 0; }
112
113protected:
114
116 size_t m_width;
117
119 size_t m_height;
120
123};
124
125#endif
Declaration of WaveformBase, SparseWaveformBase, UniformWaveformBase.
void MarkModifiedFromGpu()
Marks the GPU-side copy of the buffer as modified.
Definition: AcceleratorBuffer.h:863
void MarkModifiedFromCpu()
Marks the CPU-side copy of the buffer as modified.
Definition: AcceleratorBuffer.h:852
void PrepareForCpuAccess()
Prepares the buffer to be accessed from the CPU.
Definition: AcceleratorBuffer.h:877
void PrepareForGpuAccess(bool outputOnly=false)
Prepares the buffer to be accessed from the GPU.
Definition: AcceleratorBuffer.h:899
T * GetCpuPointer()
Gets a pointer to the CPU-side buffer.
Definition: AcceleratorBuffer.h:440
Base class for waveforms such as eye patterns, spectrograms, and waterfalls which are conceptually a ...
Definition: DensityFunctionWaveform.h:51
AcceleratorBuffer< float > & GetOutData()
Returns a reference to the output data buffer object.
Definition: DensityFunctionWaveform.h:73
virtual void PrepareForGpuAccess() override
Indicates that this waveform is going to be used by the CPU in the near future.
Definition: DensityFunctionWaveform.h:94
virtual void clear() override
Remove all samples from this waveform.
Definition: DensityFunctionWaveform.h:85
virtual void PrepareForCpuAccess() override
Indicates that this waveform is going to be used by the CPU in the near future.
Definition: DensityFunctionWaveform.h:91
size_t m_width
Buffer width, in pixels.
Definition: DensityFunctionWaveform.h:116
DensityFunctionWaveform(size_t width, size_t height)
Initialize a new density function waveform of a given size.
Definition: DensityFunctionWaveform.cpp:47
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: DensityFunctionWaveform.h:97
virtual void Resize(size_t unused) override
Reallocates buffers so the waveform contains the specified number of samples.
Definition: DensityFunctionWaveform.h:88
virtual void MarkModifiedFromCpu() override
Indicates that this waveform's sample data and timestamps have been modified on the CPU and the GPU-s...
Definition: DensityFunctionWaveform.h:103
float * GetData()
Returns a pointer to the CPU-side sample data buffer.
Definition: DensityFunctionWaveform.h:66
size_t m_height
Buffer height, in pixels.
Definition: DensityFunctionWaveform.h:119
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: DensityFunctionWaveform.h:100
AcceleratorBuffer< float > m_outdata
Pixel buffer.
Definition: DensityFunctionWaveform.h:122
virtual size_t size() const override
Returns the number of samples in this waveform.
Definition: DensityFunctionWaveform.h:110
virtual void MarkModifiedFromGpu() override
Indicates that this waveform's sample data and timestamps have been modified on the GPU and the CPU-s...
Definition: DensityFunctionWaveform.h:106
size_t GetWidth()
Returns the width of the bitmap in pixels.
Definition: DensityFunctionWaveform.h:81
size_t GetHeight()
Returns the height of the bitmap in pixels.
Definition: DensityFunctionWaveform.h:77
virtual void Rename(const std::string &name="") override
Assings a human readable name to the waveform for debug purposes.
Definition: DensityFunctionWaveform.h:62
Base class for all Waveform specializations.
Definition: Waveform.h:59