ngscopeclient v0.2.2
Loading...
Searching...
No Matches
ScopeDeskewWizard.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* ngscopeclient *
4* *
5* Copyright (c) 2012-2025 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
35#ifndef ScopeDeskewWizard_h
36#define ScopeDeskewWizard_h
37
38#include "Dialog.h"
39#include "Session.h"
40
42{
43public:
45
46 int64_t priTimescale;
47 int64_t secTimescale;
48
49 int64_t trigPhaseDelta;
50
51 int32_t startingDelta;
52 int32_t numDeltas;
53
54 int32_t priLen;
55 int32_t secLen;
56};
57
59{
60public:
62 std::shared_ptr<TriggerGroup> group,
63 std::shared_ptr<Oscilloscope> secondary,
65 Session* session);
66 virtual ~ScopeDeskewWizard();
67
68 virtual bool DoRender();
69
70protected:
71 void DoMainProcessingFlow();
72 void StartCorrelation();
73 void DoProcessWaveformUniformUnequalRate(UniformAnalogWaveform* ppri, UniformAnalogWaveform* psec);
74 void DoProcessWaveformUniform4xRateVulkan(UniformAnalogWaveform* ppri, UniformAnalogWaveform* psec);
75 void DoProcessWaveformUniformUnequalRateVulkan(UniformAnalogWaveform* ppri, UniformAnalogWaveform* psec);
76 void DoProcessWaveformUniformEqualRateVulkan(UniformAnalogWaveform* ppri, UniformAnalogWaveform* psec);
77 void PostprocessVulkanCorrelation();
78 void DoProcessWaveformSparse(SparseAnalogWaveform* ppri, SparseAnalogWaveform* psec);
79 void ChannelSelector(const char* name, std::shared_ptr<Oscilloscope> scope, StreamDescriptor& stream);
80
81 enum state_t
82 {
83 STATE_WELCOME_1,
84 STATE_WELCOME_2,
85 STATE_WELCOME_3,
86 STATE_WELCOME_4,
87 STATE_WELCOME_5,
88 STATE_ACQUIRE,
89 STATE_CORRELATE,
90 STATE_DONE,
91 STATE_CLOSE
92 } m_state;
93
94 std::shared_ptr<TriggerGroup> m_group;
95 std::shared_ptr<Oscilloscope> m_secondary;
96
97 bool m_useExtRefPrimary;
98 bool m_useExtRefSecondary;
99
100 int m_measureCycle;
101
102 time_t m_lastTriggerTimestamp;
103 int64_t m_lastTriggerFs;
104
105 StreamDescriptor m_primaryStream;
106 StreamDescriptor m_secondaryStream;
107
108 //Combined measurements from all waveforms to date
109 std::vector<float> m_correlations;
110 std::vector<int64_t> m_skews;
111
112 //Best results found from the current waveform
113 float m_bestCorrelation;
114 int64_t m_bestCorrelationOffset;
115
116 bool m_gpuCorrelationAvailable;
117
118 //Maximum number of samples offset to consider
119 int64_t m_maxSkewSamples;
120
123
124 //Vulkan processing queues etc
125 std::shared_ptr<QueueHandle> m_queue;
126 vk::raii::CommandPool m_pool;
127 vk::raii::CommandBuffer m_cmdBuf;
128
129 //Vulkan compute pipelines
130 std::shared_ptr<ComputePipeline> m_uniform4xRatePipeline;
131 std::shared_ptr<ComputePipeline> m_uniformUnequalRatePipeline;
132 std::shared_ptr<ComputePipeline> m_uniformEqualRatePipeline;
133
134 //Output correlation data
135 AcceleratorBuffer<float> m_corrOut;
136};
137
138#endif
Declaration of Dialog.
Declaration of Session.
Definition AcceleratorBuffer.h:204
Generic dialog box or other popup window.
Definition Dialog.h:46
Top level application window.
Definition MainWindow.h:168
Definition ScopeDeskewWizard.h:59
int64_t m_medianSkew
Calculated total skew.
Definition ScopeDeskewWizard.h:122
virtual bool DoRender()
Renders the dialog and handles UI events.
Definition ScopeDeskewWizard.cpp:138
A Session stores all of the instrument configuration and other state the user has open.
Definition Session.h:126
A waveform sampled at irregular intervals.
Definition Waveform.h:514
Descriptor for a single stream coming off a channel.
Definition StreamDescriptor.h:47
Definition ScopeDeskewWizard.h:42
A waveform sampled at uniform intervals.
Definition Waveform.h:404