Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6dca062b102a
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4025799d6a1a
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Aug 17, 2020

  1. Copy the full SHA
    4025799 View commit details
Showing with 20 additions and 1 deletion.
  1. +2 −1 scopehal/LeCroyOscilloscope.cpp
  2. +17 −0 scopehal/ProtocolDecoder.cpp
  3. +1 −0 scopehal/ProtocolDecoder.h
3 changes: 2 additions & 1 deletion scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -1560,7 +1560,8 @@ map<int, DigitalWaveform*> LeCroyOscilloscope::ProcessDigitalWaveform(
cap->m_startTimestamp = ttime;
cap->m_startPicoseconds = static_cast<int64_t>(basetime * 1e12f);
cap->Resize(num_samples);
#pragma omp parallel for

//TODO: AVX this
for(int j=0; j<num_samples; j++)
{
cap->m_offsets[j] = j;
17 changes: 17 additions & 0 deletions scopehal/ProtocolDecoder.cpp
Original file line number Diff line number Diff line change
@@ -879,6 +879,23 @@ float ProtocolDecoder::InterpolateTime(AnalogWaveform* cap, size_t a, float volt
return delta / slope;
}

/**
@brief Interpolates the actual value of a point between two samples
@param cap Waveform to work with
@param index Starting position
@param frac_ticks Fractional position of the sample.
Note that this is in timebase ticks, so if some samples are >1 tick apart it's possible for
this value to be outside [0, 1].
*/
float ProtocolDecoder::InterpolateValue(AnalogWaveform* cap, size_t index, float frac_ticks)
{
float frac = frac_ticks / (cap->m_offsets[index+1] - cap->m_offsets[index]);
float v1 = cap->m_samples[index];
float v2 = cap->m_samples[index+1];
return v1 + (v2-v1)*frac;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Measurement helpers

1 change: 1 addition & 0 deletions scopehal/ProtocolDecoder.h
Original file line number Diff line number Diff line change
@@ -225,6 +225,7 @@ class ProtocolDecoder : public OscilloscopeChannel

//Helpers for superresolution
static float InterpolateTime(AnalogWaveform* cap, size_t a, float voltage);
static float InterpolateValue(AnalogWaveform* cap, size_t index, float frac_ticks);

//Helpers for more complex measurements
//TODO: create some process for caching this so we don't waste CPU time