IIR Filter denormalisation


#1

Hello!

I found the IIRFilter class working fast and usefull, but had some problems with CPU power sometimes. I guessed it has to do with denormalisation.

 

Maybe this could help. I added to the class a few snaptozero's:

 

IIRCoefficients::IIRCoefficients (double c1, double c2, double c3, double c4, double c5, double c6) noexcept

{

const double a = 1.0 / c4;

coefficients[0] = (float) (c1 * a);

coefficients[1] = (float) (c2 * a);

coefficients[2] = (float) (c3 * a);

coefficients[3] = (float) (c5 * a);

coefficients[4] = (float) (c6 * a);

JUCE_SNAP_TO_ZERO(c1);

JUCE_SNAP_TO_ZERO(c2);

JUCE_SNAP_TO_ZERO(c3);

JUCE_SNAP_TO_ZERO(c4);

JUCE_SNAP_TO_ZERO(c5);

JUCE_SNAP_TO_ZERO(c6);

}


#2

Did you try the FloatVectorOperations::enableFlushToZeroMode(true)? Also you have to use SSE as minimun architecure in the compiler (which is at least the default in VS2012...) 

Jules, is there any chance to read the current enableFlushToZeroMode? Itwould be nice to reconstruct the old mode, if we are using this in a plugin-context.

 


#3

I could certainly add a getter method for that flag, but TBH in reality there must be thousands of plugins out there which will happily ignore any previous state and mess it up, so anyone for whom the state matters will probably already have to deliberately set it in their process method anyway.


#4

I did not and am looking into it. I am still using VS2010. I guess SSE is not supported for 2010 and I should go at least towards 2012?


#5

SSE support in VS2010 is just fine.