Commit 135ca3ca authored by henryjandrew's avatar henryjandrew
Browse files

changed IIR filter design algorithm enumn type to be in the IIR coeffs class

parent 86fc8c97
......@@ -27,11 +27,16 @@
namespace ITADSP
{
enum FilterDesignAlgorithm //used to select the algorithm used to design filter coefficients
{
BURG = 0, //Use the Burg algorithm for designing the filter coefficients
};
struct CIIRCoefficients
{
unsigned int uiOrder;
bool is_ARMA;
std::string design_algorithm;
int design_algorithm;
std::vector< float > vfNumerator;
std::vector< float > vfDenominator;
......
......@@ -45,7 +45,6 @@ void CITAIIRFilterEngine::SetCoefficientsToIdentity()
void CITAIIRFilterEngine::SetCoefficients( const ITADSP::CIIRCoefficients& oCoefficients )
{
assert( oCoefficients.uiOrder == GetOrder() );
if( oCoefficients.uiOrder != m_oCoeffs.uiOrder )
ITA_EXCEPT_INVALID_PARAMETER( "Order missmatch in coefficients" );
......@@ -54,9 +53,10 @@ void CITAIIRFilterEngine::SetCoefficients( const ITADSP::CIIRCoefficients& oCoef
if( oCoefficients.vfDenominator.size() != m_oCoeffs.vfDenominator.size() )
ITA_EXCEPT_INVALID_PARAMETER( "Number of denominator does not match filter order" );
m_oCoeffs.vfNumerator = oCoefficients.vfNumerator;
m_oCoeffs.vfDenominator = oCoefficients.vfDenominator;
m_oCoeffs = oCoefficients;
//m_oCoeffs.vfNumerator = oCoefficients.vfNumerator;
//m_oCoeffs.vfDenominator = oCoefficients.vfDenominator;
}
void CITAIIRFilterEngine::ClearAccumulators()
......
......@@ -127,10 +127,13 @@ void ITADSP::IIRFilterGenerator::Burg(const ITABase::CFiniteImpulseResponse& oIR
std::vector<float> a_temp;
a_temp.resize(oCoeffs.uiOrder + 1);
for (auto it = oCoeffs.vfDenominator.begin(); it != oCoeffs.vfDenominator.end(); it++)
*it = 0.0f;
oCoeffs.vfNumerator[0] = InnerProduct( oIR.GetData(), oIR.GetData(), oIR.GetLength()) / oIR.GetLength();
oCoeffs.vfDenominator[0] = 1.0f;
oCoeffs.is_ARMA = false;
oCoeffs.design_algorithm = "Burg"; //record that the Burg algorithm was used to generate the coefficients
oCoeffs.design_algorithm = 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)) /
......
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