Commit bfd393eb authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Refactoring IIR coeffs and IIR filter usage

parent e3e273f0
......@@ -33,55 +33,66 @@ namespace ITADSP
BURG = 1, //Use the Burg algorithm for designing the filter coefficients
};
struct CIIRCoefficients
struct CFilterCoefficients
{
unsigned int uiOrder;
bool is_ARMA;
int design_algorithm;
bool bIsARMA;
int iDesignAlgorithm;
std::vector< float > vfNumerator;
std::vector< float > vfDenominator;
CIIRCoefficients( unsigned int uiOrder = 0, bool is_ARMA_init = true )
: design_algorithm( ITADSP::UNSPECIFIED )
inline CFilterCoefficients( unsigned int uiOrder = 0, bool bARMAInit = false )
: iDesignAlgorithm( ITADSP::UNSPECIFIED )
{
Initialise(uiOrder, is_ARMA_init);
Initialise( uiOrder, bARMAInit );
};
void Initialise( unsigned int uiOrder_, bool is_ARMA_ )
inline void Initialise( unsigned int uiOrder_, bool bARMAInit_ )
{
is_ARMA = is_ARMA_;
bIsARMA = bARMAInit_;
uiOrder = uiOrder_;
if( is_ARMA )
if( bIsARMA )
vfNumerator.resize( uiOrder + 1 );
else
vfNumerator.resize( 1 );
vfDenominator.resize( uiOrder + 1 );
};
void InitialiseOrder(unsigned int uiOrder_ )
inline void InitialiseOrder( unsigned int uiOrder_ )
{
uiOrder = uiOrder_;
if (is_ARMA)
vfNumerator.resize(uiOrder + 1);
if( bIsARMA )
vfNumerator.resize( uiOrder + 1 );
else
vfNumerator.resize(1);
vfNumerator.resize( 1 );
vfDenominator.resize(uiOrder + 1);
vfDenominator.resize( uiOrder + 1 );
};
inline void SetZero()
{
for( size_t i = 1; i < vfNumerator.size(); i++ )
vfNumerator[ i ] = 0.0f;
if( vfDenominator.size() > 0 )
vfDenominator[ 0 ] = 1.0f;
for( size_t i = 1; i < vfDenominator.size(); i++ )
vfDenominator[ i ] = 0.0f;
};
inline void SetIdentity()
{
SetZero();
vfNumerator[ 0 ] = 1;
vfDenominator[ 0 ] = 1.0f;
if( vfNumerator.size() > 0 )
vfNumerator[ 0 ] = 1.0f;
if( vfDenominator.size() > 0 )
vfDenominator[ 0 ] = 1.0f;
for( size_t i = 1; i < vfDenominator.size(); i++ )
vfDenominator[ i ] = 0.0f;
};
......
......@@ -23,6 +23,7 @@
#include <ITAIIRCoefficients.h>
#include <vector>
#include <atomic>
//! Implements digital biquad component for IIR filtering
/**
......@@ -36,13 +37,11 @@
class ITA_DSP_API CITAIIRFilterEngine
{
public:
CITAIIRFilterEngine();
CITAIIRFilterEngine( unsigned int iOrder );
CITAIIRFilterEngine( unsigned int iOrder = 0, bool bIsARMA = false );
virtual inline ~CITAIIRFilterEngine() {};
void Initialise(unsigned int uiOrder);
void Initialise( unsigned int uiOrder, bool bIsArma );
void Reset();
......@@ -54,7 +53,7 @@ public:
void SetCoefficientsToZero();
void SetCoefficientsToIdentity();
void SetCoefficients( const ITADSP::CIIRCoefficients& oCoefficients );
void SetCoefficients( const ITADSP::CFilterCoefficients& oCoefficients );
//! Filter samples, simple variant without any gain (factor)
/**
......@@ -67,7 +66,7 @@ public:
* @note Input and output samples must have same length
*/
void Process( const float* pfInputData, float* pfOutputData, const int iNumSamples );
//! Filter samples, simple variant with given gain (factor)
/**
* Direct second canonical form.
......@@ -81,12 +80,14 @@ public:
* @note Input and output samples must have same length
*/
void Process( const float* pfInputData, float* pfOutputData, const int iNumSamples, const float fOutputGain, const int iOutputMode );
void Process(const float* pfInputData, float* pfOutputData, const int iNumSamples, const float fOutputGain1, const float fOutputGain2, const int iOutputWriteMode);
void Process( const float* pfInputData, float* pfOutputData, const int iNumSamples, const float fOutputGain1, const float fOutputGain2, const int iOutputWriteMode );
private:
ITADSP::CIIRCoefficients m_oCoeffs;
ITADSP::CFilterCoefficients m_oCoeffs;
ITADSP::CFilterCoefficients m_oCoeffsNew;
std::atomic< bool > m_bNewFilterCoefficients;
std::vector< float > m_vfAccumulator; //!< Accumulators
unsigned int m_uiCursor;
};
......
......@@ -37,9 +37,9 @@ namespace ITADSP
*/
namespace IIRFilterGenerator
{
ITA_DSP_API void Yulewalk( const ITABase::CFiniteImpulseResponse& oIR, CIIRCoefficients& oCoeffs );
ITA_DSP_API void Yulewalk( const ITABase::CFiniteImpulseResponse& oIR, CFilterCoefficients& oCoeffs );
ITA_DSP_API void Burg(const ITABase::CFiniteImpulseResponse& oIR, CIIRCoefficients& oCoeffs);
ITA_DSP_API void Burg(const ITABase::CFiniteImpulseResponse& oIR, CFilterCoefficients& oCoeffs);
ITA_DSP_API float InnerProduct(const float *x, const float *y, const int length);
......
......@@ -26,7 +26,7 @@
namespace ITADSP
{
void ITA_DSP_API ExportIIRCoefficientsToJSON( const std::string& sJSONFilePath, const CIIRCoefficients& oCoefficients );
void ITA_DSP_API ExportIIRCoefficientsToJSON( const std::string& sJSONFilePath, const CFilterCoefficients& oCoefficients );
}
......
......@@ -4,20 +4,21 @@
#include <cassert>
CITAIIRFilterEngine::CITAIIRFilterEngine()
:m_uiCursor( 0 )
CITAIIRFilterEngine::CITAIIRFilterEngine( unsigned int uiOrder /* = 0 */, bool bIsARMA /* = false */ )
: m_uiCursor( 0 )
, m_bNewFilterCoefficients( false )
{
Initialise( uiOrder, bIsARMA );
}
CITAIIRFilterEngine::CITAIIRFilterEngine( unsigned int uiOrder )
: m_uiCursor( 0 )
void CITAIIRFilterEngine::Initialise( unsigned int uiOrder, bool bIsARMA )
{
Initialise(uiOrder);
}
m_oCoeffsNew.Initialise( uiOrder, bIsARMA );
m_oCoeffs = m_oCoeffsNew;
m_bNewFilterCoefficients = true; // trigger swap in streaming context
void CITAIIRFilterEngine::Initialise( unsigned int uiOrder ) {
m_oCoeffs.InitialiseOrder( uiOrder );
m_vfAccumulator.resize( uiOrder + 1 );
Reset();
}
......@@ -29,32 +30,28 @@ void CITAIIRFilterEngine::Reset()
unsigned int CITAIIRFilterEngine::GetOrder() const
{
return (unsigned int)( m_vfAccumulator.size() - 1 );
return ( unsigned int ) ( m_vfAccumulator.size() - 1 );
}
void CITAIIRFilterEngine::SetCoefficientsToZero()
{
m_oCoeffs.SetZero();
m_oCoeffsNew.SetZero();
m_bNewFilterCoefficients = true; // trigger swap in streaming context
}
void CITAIIRFilterEngine::SetCoefficientsToIdentity()
{
m_oCoeffs.SetIdentity();
m_oCoeffsNew.SetIdentity();
m_bNewFilterCoefficients = true; // trigger swap in streaming context
}
void CITAIIRFilterEngine::SetCoefficients( const ITADSP::CIIRCoefficients& oCoefficients )
void CITAIIRFilterEngine::SetCoefficients( const ITADSP::CFilterCoefficients& oNewCoeffs )
{
assert( oCoefficients.uiOrder == GetOrder() );
if( oCoefficients.uiOrder != m_oCoeffs.uiOrder )
ITA_EXCEPT_INVALID_PARAMETER( "Order missmatch in coefficients" );
if( oCoefficients.vfNumerator.size() != m_oCoeffs.vfNumerator.size() )
ITA_EXCEPT_INVALID_PARAMETER( "Numerator count mismatch" );
if( oCoefficients.vfDenominator.size() != m_oCoeffs.vfDenominator.size() )
ITA_EXCEPT_INVALID_PARAMETER( "Denominator count mismatch" );
if( oNewCoeffs.uiOrder != m_oCoeffs.uiOrder )
ITA_EXCEPT_INVALID_PARAMETER( "Order missmatch in filter coefficients" );
m_oCoeffs = oCoefficients;
m_oCoeffsNew = oNewCoeffs;
m_bNewFilterCoefficients = true; // trigger swap in streaming context
}
void CITAIIRFilterEngine::ClearAccumulators()
......@@ -82,122 +79,131 @@ void CITAIIRFilterEngine::Process( const float* pfInputData, float* pfOutputData
//after this (i=4), the read cursor returns to 0, and the value for m_vfAccumulator(0) calculated at i=0 is overwritten as it is the least recent entry.
//This cycle repeats for all samples in the input buffer
if( m_bNewFilterCoefficients )
{
m_oCoeffs = m_oCoeffsNew;
m_bNewFilterCoefficients = false;
}
for( int i = 0; i < iNumSamples; i++ )
{
m_vfAccumulator[ m_uiCursor ] = pfInputData[i]; // v(n) = x(n), insert ith sample of input data at the start of the accumulator
for (int j = 0; j < m_oCoeffs.vfDenominator.size()-1; j++) { //assumes that element 0 of the numerator coefficients is a1, rather than a0 (a0 normalised to 1)
m_vfAccumulator[ m_uiCursor ] -= m_oCoeffs.vfDenominator[ j+1 ] * m_vfAccumulator[ ( m_uiCursor + j + 1 ) % m_vfAccumulator.size() ]; //add to the current accumulator v(n) = v(n) - a(j)*v(j)
m_vfAccumulator[ m_uiCursor ] = pfInputData[ i ]; // v(n) = x(n), insert ith sample of input data at the start of the accumulator
for( int j = 0; j < m_oCoeffs.vfDenominator.size() - 1; j++ ) { //assumes that element 0 of the numerator coefficients is a1, rather than a0 (a0 normalised to 1)
m_vfAccumulator[ m_uiCursor ] -= m_oCoeffs.vfDenominator[ j + 1 ] * m_vfAccumulator[ ( m_uiCursor + j + 1 ) % m_vfAccumulator.size() ]; //add to the current accumulator v(n) = v(n) - a(j)*v(j)
}
pfOutputData[i] = m_oCoeffs.vfNumerator[0] * m_vfAccumulator[ m_uiCursor ]; //overrides whatever might have been there already
pfOutputData[ i ] = m_oCoeffs.vfNumerator[ 0 ] * m_vfAccumulator[ m_uiCursor ]; //overrides whatever might have been there already
for( int j = 1; j < m_oCoeffs.vfNumerator.size(); j++ ) {
pfOutputData[ i ] += m_oCoeffs.vfNumerator[ j ] * m_vfAccumulator[( m_uiCursor + j ) % m_vfAccumulator.size() ]; //add output sample y(n) += b(j)*v(j)
pfOutputData[ i ] += m_oCoeffs.vfNumerator[ j ] * m_vfAccumulator[ ( m_uiCursor + j ) % m_vfAccumulator.size() ]; //add output sample y(n) += b(j)*v(j)
}
m_uiCursor = ( m_vfAccumulator.size() + m_uiCursor - 1 ) % m_vfAccumulator.size(); //move the read cursor one space back
m_uiCursor = (unsigned int) ( m_vfAccumulator.size() + m_uiCursor - 1 ) % m_vfAccumulator.size(); //move the read cursor one space back
}
return;
}
void CITAIIRFilterEngine::Process( const float* pfInputData, float* pfOutputData, const int iNumSamples, const float fOutputGain, const int iOutputMode )
{
if( m_bNewFilterCoefficients )
{
m_oCoeffs = m_oCoeffsNew;
m_bNewFilterCoefficients = false;
}
if( iOutputMode == ITABase::MixingMethod::ADD )
{
for (int i = 0; i < iNumSamples; i++)
for( int i = 0; i < iNumSamples; i++ )
{
m_vfAccumulator[m_uiCursor] = pfInputData[i]; // v(n) = x(n), insert ith sample of input data at the start of the accumulator
for (int j = 0; j < m_oCoeffs.vfDenominator.size()-1; j++) { //assumes that element 0 of the numerator coefficients is a1, rather than a0 (a0 normalised to 1)
m_vfAccumulator[m_uiCursor] -= m_oCoeffs.vfDenominator[j+1] * m_vfAccumulator[(m_uiCursor + j + 1) % m_vfAccumulator.size()]; //add to the current accumulator v(n) = v(n) - a(j)*v(j)
m_vfAccumulator[ m_uiCursor ] = pfInputData[ i ]; // v(n) = x(n), insert ith sample of input data at the start of the accumulator
for( int j = 0; j < m_oCoeffs.vfDenominator.size() - 1; j++ ) { //assumes that element 0 of the numerator coefficients is a1, rather than a0 (a0 normalised to 1)
m_vfAccumulator[ m_uiCursor ] -= m_oCoeffs.vfDenominator[ j + 1 ] * m_vfAccumulator[ ( m_uiCursor + j + 1 ) % m_vfAccumulator.size() ]; //add to the current accumulator v(n) = v(n) - a(j)*v(j)
}
for (int j = 0; j < m_oCoeffs.vfNumerator.size(); j++) {
for( int j = 0; j < m_oCoeffs.vfNumerator.size(); j++ ) {
pfOutputData[ i ] += m_oCoeffs.vfNumerator[ j ] * m_vfAccumulator[ ( m_uiCursor + j ) % m_vfAccumulator.size() ] * fOutputGain; //add output sample y(n) += b(j)*v(j)
}
m_uiCursor = (m_vfAccumulator.size() + m_uiCursor - 1) % m_vfAccumulator.size(); //move the read cursor one space back
m_uiCursor = ( unsigned int ) ( m_vfAccumulator.size() + m_uiCursor - 1 ) % m_vfAccumulator.size(); //move the read cursor one space back
}
}
else if( iOutputMode == ITABase::MixingMethod::OVERWRITE )
{
for (int i = 0; i < iNumSamples; i++)
for( int i = 0; i < iNumSamples; i++ )
{
m_vfAccumulator[m_uiCursor] = pfInputData[i]; // v(n) = x(n), insert ith sample of input data at the start of the accumulator
for (int j = 0; j < m_oCoeffs.vfDenominator.size()-1; j++) { //assumes that element 0 of the numerator coefficients is a1, rather than a0 (a0 normalised to 1)
m_vfAccumulator[m_uiCursor] -= m_oCoeffs.vfDenominator[j+1] * m_vfAccumulator[(m_uiCursor + j + 1) % m_vfAccumulator.size()]; //add to the current accumulator v(n) = v(n) - a(j)*v(j)
m_vfAccumulator[ m_uiCursor ] = pfInputData[ i ]; // v(n) = x(n), insert ith sample of input data at the start of the accumulator
for( int j = 0; j < m_oCoeffs.vfDenominator.size() - 1; j++ ) { //assumes that element 0 of the numerator coefficients is a1, rather than a0 (a0 normalised to 1)
m_vfAccumulator[ m_uiCursor ] -= m_oCoeffs.vfDenominator[ j + 1 ] * m_vfAccumulator[ ( m_uiCursor + j + 1 ) % m_vfAccumulator.size() ]; //add to the current accumulator v(n) = v(n) - a(j)*v(j)
}
pfOutputData[ i ] = m_oCoeffs.vfNumerator[ 0 ] * m_vfAccumulator[ m_uiCursor ] * fOutputGain; //overrides whatever might have been there already
for (int j = 1; j < m_oCoeffs.vfNumerator.size(); j++) {
for( int j = 1; j < m_oCoeffs.vfNumerator.size(); j++ ) {
pfOutputData[ i ] += m_oCoeffs.vfNumerator[ j ] * m_vfAccumulator[ ( m_uiCursor + j ) % m_vfAccumulator.size() ] * fOutputGain; //add output sample y(n) += b(j)*v(j)
}
m_uiCursor = (m_vfAccumulator.size() + m_uiCursor - 1) % m_vfAccumulator.size(); //move the read cursor one space back
m_uiCursor = ( unsigned int ) ( m_vfAccumulator.size() + m_uiCursor - 1 ) % m_vfAccumulator.size(); //move the read cursor one space back
}
}
else
{
ITA_EXCEPT1( INVALID_PARAMETER, "Unrecognized output write mode in CITAFilterEngine" );
}
return;
}
void CITAIIRFilterEngine::Process(const float* pfInputData, float* pfOutputData, const int iNumSamples, const float fOutputGain1, const float fOutputGain2, const int iOutputWriteMode)
void CITAIIRFilterEngine::Process( const float* pfInputData, float* pfOutputData, const int iNumSamples, const float fOutputGain1, const float fOutputGain2, const int iOutputWriteMode )
{
if (iNumSamples == 0)
if( iNumSamples == 0 )
return;
if( m_bNewFilterCoefficients )
{
m_oCoeffs = m_oCoeffsNew;
m_bNewFilterCoefficients = false;
}
// Factor for linear gain
const float fLinearGainFactor = (fOutputGain2 - fOutputGain1) / float(iNumSamples);
const float fLinearGainFactor = ( fOutputGain2 - fOutputGain1 ) / float( iNumSamples );
if (iOutputWriteMode == ITABase::MixingMethod::ADD)
if( iOutputWriteMode == ITABase::MixingMethod::ADD )
{
for (int i = 0; i < iNumSamples; i++)
for( int i = 0; i < iNumSamples; i++ )
{
const float fSampleGain = fOutputGain1 + i * fLinearGainFactor;
m_vfAccumulator[m_uiCursor] = pfInputData[i]; // v(n) = x(n), insert ith sample of input data at the start of the accumulator
for (int j = 0; j < m_oCoeffs.vfDenominator.size()-1; j++) { //assumes that element 0 of the numerator coefficients is a1, rather than a0 (a0 normalised to 1)
m_vfAccumulator[m_uiCursor] -= m_oCoeffs.vfDenominator[j+1] * m_vfAccumulator[(m_uiCursor + j + 1) % m_vfAccumulator.size()]; //add to the current accumulator v(n) = v(n) - a(j)*v(j)
m_vfAccumulator[ m_uiCursor ] = pfInputData[ i ]; // v(n) = x(n), insert ith sample of input data at the start of the accumulator
for( int j = 0; j < m_oCoeffs.vfDenominator.size() - 1; j++ ) { //assumes that element 0 of the numerator coefficients is a1, rather than a0 (a0 normalised to 1)
m_vfAccumulator[ m_uiCursor ] -= m_oCoeffs.vfDenominator[ j + 1 ] * m_vfAccumulator[ ( m_uiCursor + j + 1 ) % m_vfAccumulator.size() ]; //add to the current accumulator v(n) = v(n) - a(j)*v(j)
}
for (int j = 0; j < m_oCoeffs.vfNumerator.size(); j++) {
pfOutputData[i] += m_oCoeffs.vfNumerator[j] * m_vfAccumulator[(m_uiCursor + j) % m_vfAccumulator.size()] * fSampleGain; //add output sample y(n) += b(j)*v(j)
for( int j = 0; j < m_oCoeffs.vfNumerator.size(); j++ ) {
pfOutputData[ i ] += m_oCoeffs.vfNumerator[ j ] * m_vfAccumulator[ ( m_uiCursor + j ) % m_vfAccumulator.size() ] * fSampleGain; //add output sample y(n) += b(j)*v(j)
}
m_uiCursor = (m_vfAccumulator.size() + m_uiCursor - 1) % m_vfAccumulator.size(); //move the read cursor one space back
m_uiCursor = ( unsigned int ) ( m_vfAccumulator.size() + m_uiCursor - 1 ) % m_vfAccumulator.size(); //move the read cursor one space back
}
}
else if (iOutputWriteMode == ITABase::MixingMethod::OVERWRITE)
else if( iOutputWriteMode == ITABase::MixingMethod::OVERWRITE )
{
for (int i = 0; i < iNumSamples; i++)
for( int i = 0; i < iNumSamples; i++ )
{
const float fSampleGain = fOutputGain1 + i * fLinearGainFactor;
m_vfAccumulator[m_uiCursor] = pfInputData[i]; // v(n) = x(n), insert ith sample of input data at the start of the accumulator
for (int j = 0; j < m_oCoeffs.vfDenominator.size()-1; j++) { //assumes that element 0 of the numerator coefficients is a1, rather than a0 (a0 normalised to 1)
m_vfAccumulator[m_uiCursor] -= m_oCoeffs.vfDenominator[j+1] * m_vfAccumulator[(m_uiCursor + j + 1) % m_vfAccumulator.size()]; //add to the current accumulator v(n) = v(n) - a(j)*v(j)
m_vfAccumulator[ m_uiCursor ] = pfInputData[ i ]; // v(n) = x(n), insert ith sample of input data at the start of the accumulator
for( int j = 0; j < m_oCoeffs.vfDenominator.size() - 1; j++ ) { //assumes that element 0 of the numerator coefficients is a1, rather than a0 (a0 normalised to 1)
m_vfAccumulator[ m_uiCursor ] -= m_oCoeffs.vfDenominator[ j + 1 ] * m_vfAccumulator[ ( m_uiCursor + j + 1 ) % m_vfAccumulator.size() ]; //add to the current accumulator v(n) = v(n) - a(j)*v(j)
}
pfOutputData[i] = m_oCoeffs.vfNumerator[0] * m_vfAccumulator[m_uiCursor]; //overrides whatever might have been there already
for (int j = 1; j < m_oCoeffs.vfNumerator.size(); j++) {
pfOutputData[i] += m_oCoeffs.vfNumerator[j] * m_vfAccumulator[(m_uiCursor + j) % m_vfAccumulator.size()]; //add output sample y(n) += b(j)*v(j)
pfOutputData[ i ] = m_oCoeffs.vfNumerator[ 0 ] * m_vfAccumulator[ m_uiCursor ]; //overrides whatever might have been there already
for( int j = 1; j < m_oCoeffs.vfNumerator.size(); j++ ) {
pfOutputData[ i ] += m_oCoeffs.vfNumerator[ j ] * m_vfAccumulator[ ( m_uiCursor + j ) % m_vfAccumulator.size() ]; //add output sample y(n) += b(j)*v(j)
}
pfOutputData[i] *= fSampleGain;
pfOutputData[ i ] *= fSampleGain;
m_uiCursor = (m_vfAccumulator.size() + m_uiCursor - 1) % m_vfAccumulator.size(); //move the read cursor one space back
m_uiCursor = ( unsigned int ) ( m_vfAccumulator.size() + m_uiCursor - 1 ) % m_vfAccumulator.size(); //move the read cursor one space back
}
}
else
{
ITA_EXCEPT1(INVALID_PARAMETER, "Unrecognized output write mode in CITAFilterEngine");
ITA_EXCEPT1( INVALID_PARAMETER, "Unrecognized output write mode in CITAFilterEngine" );
}
}
\ No newline at end of file
}
......@@ -5,7 +5,7 @@
#include <iostream>
void ITADSP::IIRFilterGenerator::Yulewalk( const ITABase::CFiniteImpulseResponse& oIR, CIIRCoefficients& oCoeffs )
void ITADSP::IIRFilterGenerator::Yulewalk( const ITABase::CFiniteImpulseResponse& oIR, CFilterCoefficients& oCoeffs )
{
int na = oCoeffs.vfDenominator.size();
......@@ -113,7 +113,7 @@ void ITADSP::IIRFilterGenerator::toeplitz(float **out, const ITASampleBuffer &in
void ITADSP::IIRFilterGenerator::Burg(const ITABase::CFiniteImpulseResponse& oIR, CIIRCoefficients& oCoeffs) {
void ITADSP::IIRFilterGenerator::Burg(const ITABase::CFiniteImpulseResponse& oIR, CFilterCoefficients& oCoeffs) {
//oIR -> targe impulse response -> x, filter order = oCoeffs.uiOrder -> p
float k;
int buffer_length = oIR.GetLength() - 1;
......@@ -132,8 +132,8 @@ void ITADSP::IIRFilterGenerator::Burg(const ITABase::CFiniteImpulseResponse& oIR
oCoeffs.vfNumerator[0] = InnerProduct( oIR.GetData(), oIR.GetData(), oIR.GetLength()) / oIR.GetLength();
oCoeffs.vfDenominator[0] = 1.0f;
oCoeffs.is_ARMA = false;
oCoeffs.design_algorithm = ITADSP::BURG; //record that the Burg algorithm was used to generate the coefficients
oCoeffs.bIsARMA = false;
oCoeffs.iDesignAlgorithm = ITADSP::BURG; //record that the Burg algorithm was used to generate the coefficients
for (int m = 0; m < oCoeffs.uiOrder; m++) {
k = (-2 * InnerProduct(ebp.GetData(), efp.GetData()+m, buffer_length)) /
......
......@@ -6,7 +6,7 @@
#include <libjson.h>
#endif
void ITADSP::ExportIIRCoefficientsToJSON( const std::string& sJSONFilePath, const CIIRCoefficients& oCoefficients )
void ITADSP::ExportIIRCoefficientsToJSON( const std::string& sJSONFilePath, const CFilterCoefficients& oCoefficients )
{
#ifdef WITH_JSON_SUPPORT
......@@ -29,9 +29,9 @@ void ITADSP::ExportIIRCoefficientsToJSON( const std::string& sJSONFilePath, cons
jnCoefficients.push_back( jnDenominator );
jnCoefficients.push_back(JSONNode("design_algorithm", oCoefficients.design_algorithm));
jnCoefficients.push_back(JSONNode("design_algorithm", oCoefficients.iDesignAlgorithm));
jnCoefficients.push_back(JSONNode("is_ARMA", oCoefficients.is_ARMA));
jnCoefficients.push_back(JSONNode("is_ARMA", oCoefficients.bIsARMA));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment