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: 8e53486fdc19
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7368341e061b
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Dec 14, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7368341 View commit details
Showing with 10 additions and 4 deletions.
  1. +10 −4 scopeprotocols/FIRFilter.cpp
14 changes: 10 additions & 4 deletions scopeprotocols/FIRFilter.cpp
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ FIRFilter::FIRFilter(const string& color)
m_parameters[m_filterTypeName].SetIntVal(FILTER_TYPE_LOWPASS);

m_parameters[m_filterLengthName] = FilterParameter(FilterParameter::TYPE_INT, Unit(Unit::UNIT_SAMPLEDEPTH));
m_parameters[m_filterLengthName].SetIntVal(19);
m_parameters[m_filterLengthName].SetIntVal(0);

m_parameters[m_stopbandAttenName] = FilterParameter(FilterParameter::TYPE_FLOAT, Unit(Unit::UNIT_DB));
m_parameters[m_stopbandAttenName].SetFloatVal(60);
@@ -200,15 +200,21 @@ void FIRFilter::Refresh()
flo = max(flo, 0.0f);
fhi = min(fhi, nyquist);

//Calculate filter order
size_t filterlen = m_parameters[m_filterLengthName].GetIntVal();
float atten = m_parameters[m_stopbandAttenName].GetFloatVal();
if(filterlen == 0)
filterlen = (atten / 22) * (sample_hz / (fhi - flo) );
filterlen |= 1; //force length to be odd

//Create the filter coefficients (TODO: cache this)
size_t filterlen = m_parameters[m_filterLengthName].GetIntVal() | 1; //force length to be odd
vector<float> coeffs;
coeffs.resize(filterlen);
CalculateFilterCoefficients(
coeffs,
flo / nyquist,
fhi / nyquist,
m_parameters[m_stopbandAttenName].GetFloatVal(),
atten,
type
);

@@ -223,7 +229,7 @@ void FIRFilter::Refresh()
float vmax;
DoFilterKernel(coeffs, din, cap, vmin, vmax);

//Correct for phase shift
//Shift output to compensate for filter group delay
cap->m_triggerPhase = (radius * fs_per_sample) + din->m_triggerPhase;

//Calculate bounds