Aufgrund einer Wartung wird GitLab am 25.01 zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 25.01 between 8:00 and 9:00 am.

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 @@ ...@@ -27,11 +27,16 @@
namespace ITADSP 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 struct CIIRCoefficients
{ {
unsigned int uiOrder; unsigned int uiOrder;
bool is_ARMA; bool is_ARMA;
std::string design_algorithm; int design_algorithm;
std::vector< float > vfNumerator; std::vector< float > vfNumerator;
std::vector< float > vfDenominator; std::vector< float > vfDenominator;
......
...@@ -45,7 +45,6 @@ void CITAIIRFilterEngine::SetCoefficientsToIdentity() ...@@ -45,7 +45,6 @@ void CITAIIRFilterEngine::SetCoefficientsToIdentity()
void CITAIIRFilterEngine::SetCoefficients( const ITADSP::CIIRCoefficients& oCoefficients ) void CITAIIRFilterEngine::SetCoefficients( const ITADSP::CIIRCoefficients& oCoefficients )
{ {
assert( oCoefficients.uiOrder == GetOrder() ); assert( oCoefficients.uiOrder == GetOrder() );
if( oCoefficients.uiOrder != m_oCoeffs.uiOrder ) if( oCoefficients.uiOrder != m_oCoeffs.uiOrder )
ITA_EXCEPT_INVALID_PARAMETER( "Order missmatch in coefficients" ); ITA_EXCEPT_INVALID_PARAMETER( "Order missmatch in coefficients" );
...@@ -54,9 +53,10 @@ void CITAIIRFilterEngine::SetCoefficients( const ITADSP::CIIRCoefficients& oCoef ...@@ -54,9 +53,10 @@ void CITAIIRFilterEngine::SetCoefficients( const ITADSP::CIIRCoefficients& oCoef
if( oCoefficients.vfDenominator.size() != m_oCoeffs.vfDenominator.size() ) if( oCoefficients.vfDenominator.size() != m_oCoeffs.vfDenominator.size() )
ITA_EXCEPT_INVALID_PARAMETER( "Number of denominator does not match filter order" ); ITA_EXCEPT_INVALID_PARAMETER( "Number of denominator does not match filter order" );
m_oCoeffs.vfNumerator = oCoefficients.vfNumerator; m_oCoeffs = oCoefficients;
m_oCoeffs.vfDenominator = oCoefficients.vfDenominator; //m_oCoeffs.vfNumerator = oCoefficients.vfNumerator;
//m_oCoeffs.vfDenominator = oCoefficients.vfDenominator;
} }
void CITAIIRFilterEngine::ClearAccumulators() void CITAIIRFilterEngine::ClearAccumulators()
......
...@@ -127,10 +127,13 @@ void ITADSP::IIRFilterGenerator::Burg(const ITABase::CFiniteImpulseResponse& oIR ...@@ -127,10 +127,13 @@ void ITADSP::IIRFilterGenerator::Burg(const ITABase::CFiniteImpulseResponse& oIR
std::vector<float> a_temp; std::vector<float> a_temp;
a_temp.resize(oCoeffs.uiOrder + 1); 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.vfNumerator[0] = InnerProduct( oIR.GetData(), oIR.GetData(), oIR.GetLength()) / oIR.GetLength();
oCoeffs.vfDenominator[0] = 1.0f; oCoeffs.vfDenominator[0] = 1.0f;
oCoeffs.is_ARMA = false; 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++) { for (int m = 0; m < oCoeffs.uiOrder; m++) {
k = (-2 * InnerProduct(ebp.GetData(), efp.GetData()+m, buffer_length)) / 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