Audit finding
- ID:
AUD-021
- Status: Verified defect
- Severity: High
- Confidence: High
- Audited revision:
2f479320d805a1f9f35ebe4afaaeeded48913a94
Problem
The FIR simulator converts the low-cutoff low-pass kernel into a high-pass kernel, then computes LP(high) - HP(low). At DC this is approximately one, but a band-pass response must be zero. The spectral subtraction should be LP(high) - LP(low).
Source:
|
lowpass[mid] += 1.0f; |
|
return lowpass; |
|
} |
|
|
|
case FilterType::BandPass: |
|
{ |
|
auto normalizedLow = design.cutoffHz / design.sampleRateHz; |
|
auto normalizedHigh = design.cutoffHighHz / design.sampleRateHz; |
|
auto highpass = WindowedSinc(design.order, normalizedHigh); |
|
auto lowpass = WindowedSinc(design.order, normalizedLow); |
|
|
|
auto mid = (design.order - 1) / 2; |
|
for (std::size_t i = 0; i < lowpass.size(); ++i) |
|
lowpass[i] = -lowpass[i]; |
|
lowpass[mid] += 1.0f; |
|
|
|
std::vector<float> bandpass(design.order); |
|
for (std::size_t i = 0; i < design.order; ++i) |
|
bandpass[i] = highpass[i] - lowpass[i]; |
|
return bandpass; |
|
} |
|
|
|
default: |
|
return WindowedSinc(design.order, normalizedCutoff); |
Acceptance criteria
Audit finding
AUD-0212f479320d805a1f9f35ebe4afaaeeded48913a94Problem
The FIR simulator converts the low-cutoff low-pass kernel into a high-pass kernel, then computes
LP(high) - HP(low). At DC this is approximately one, but a band-pass response must be zero. The spectral subtraction should beLP(high) - LP(low).Source:
numerical-toolbox-cpp/simulator/filters/FirFilter/application/FirFilterSimulator.cpp
Lines 137 to 160 in 2f47932
Acceptance criteria