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: 0109bda87633
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 48609894ce81
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Jul 26, 2020

  1. Copy the full SHA
    4860989 View commit details
Showing with 17 additions and 5 deletions.
  1. +4 −1 scopehal/TouchstoneParser.cpp
  2. +13 −4 scopeprotocols/DeEmbedDecoder.cpp
5 changes: 4 additions & 1 deletion scopehal/TouchstoneParser.cpp
Original file line number Diff line number Diff line change
@@ -49,7 +49,10 @@ SParameterPoint SParameterVector::InterpolatePoint(float frequency)

//If out of range, clip
if(frequency < m_points[0].m_frequency)
return m_points[0];
{
return SParameterPoint(frequency, 1, 0);
//return m_points[0];
}
else if(frequency > m_points[len-1].m_frequency)
return SParameterPoint(frequency, 0, 0);
else
17 changes: 13 additions & 4 deletions scopeprotocols/DeEmbedDecoder.cpp
Original file line number Diff line number Diff line change
@@ -230,16 +230,25 @@ void DeEmbedDecoder::DoRefresh(bool invert)
//Resample the S-parameter file for our point
float freq = bin_hz * i;
auto point = m_sparams.SamplePoint(2, 1, freq);
float cosval = cos(-point.m_phase);
float sinval = sin(-point.m_phase);

//Zero channel response = flatten
if(fabs(point.m_amplitude) < FLT_EPSILON)
{
rdout[i*2 + 0] = 0;
rdout[i*2 + 1] = 0;
continue;
}

float cosval = cos(point.m_phase);
float sinval = sin(point.m_phase);

//Uncorrected complex value
float real_orig = rdout[i*2 + 0];
float imag_orig = rdout[i*2 + 1];

//Phase correction
float real = real_orig;//real_orig*cosval - imag_orig*sinval;
float imag = imag_orig;//real_orig*sinval + imag_orig*cosval;
float real = real_orig*cosval - imag_orig*sinval;
float imag = real_orig*sinval + imag_orig*cosval;

//Amplitude correction
rdout[i*2 + 0] = real * point.m_amplitude;