Removing cepstrum

parent 010c9f2d
...@@ -262,36 +262,32 @@ bool ITANCTC::CalculateFilter( std::vector< ITAHDFTSpectra* >& vpCTCFilter ) ...@@ -262,36 +262,32 @@ bool ITANCTC::CalculateFilter( std::vector< ITAHDFTSpectra* >& vpCTCFilter )
// First, store original energy of HRTF (left channel) // First, store original energy of HRTF (left channel)
float fEnergy = ( *pHRTF )[ 0 ]->getEnergy(); float fEnergy = ( *pHRTF )[ 0 ]->getEnergy();
// Apply WICK factor in cepstrum domain only on magnitudes (left channel) // Apply WICK factor only on magnitudes (left channel)
( *pHRTF )[ 0 ]->log();
for( int i = 0; i < ( *pHRTF )[ 0 ]->getSize(); i++ ) for( int i = 0; i < ( *pHRTF )[ 0 ]->getSize(); i++ )
{ {
float fCepstrumMag = ( *pHRTF )[ 0 ]->calcMagnitude( i ); float fMag = ( *pHRTF )[ 0 ]->calcMagnitude( i );
( *pHRTF )[ 0 ]->setMagnitudePreservePhase( i, fCepstrumMag * m_fWaveIncidenceAngleCompensationFactor ); ( *pHRTF )[ 0 ]->setMagnitudePreservePhase( i, std::powf( fMag, m_fWaveIncidenceAngleCompensationFactor ) );
} }
( *pHRTF )[ 0 ]->exp();
// Compensate initial HRTF energy when WICK is used (left channel) // Compensate initial HRTF energy when WICK is used (left channel)
assert( fEnergy > 0 ); assert( fEnergy > 0 );
float fEnergyCompensation = powf( fEnergy, ( 1 - m_fWaveIncidenceAngleCompensationFactor ) ); float fEnergyCompensation = std::powf( fEnergy, ( 1 - m_fWaveIncidenceAngleCompensationFactor ) );
( *pHRTF )[ 0 ]->mul( fEnergyCompensation ); ( *pHRTF )[ 0 ]->mul( fEnergyCompensation );
// First, store original energy of HRTF only on magnitudes (right channel) // First, store original energy of HRTF only on magnitudes (right channel)
fEnergy = ( *pHRTF )[ 1 ]->getEnergy(); fEnergy = ( *pHRTF )[ 1 ]->getEnergy();
// Apply WICK factor in cepstrum domain (right channel) // Apply WICK factor only on magnitude (right channel)
( *pHRTF )[ 1 ]->log();
for( int i = 0; i < ( *pHRTF )[ 1 ]->getSize(); i++ ) for( int i = 0; i < ( *pHRTF )[ 1 ]->getSize(); i++ )
{ {
float fCepstrumMag = ( *pHRTF )[ 1 ]->calcMagnitude( i ); float fMag = ( *pHRTF )[ 1 ]->calcMagnitude( i );
( *pHRTF )[ 1 ]->setMagnitudePreservePhase( i, fCepstrumMag * m_fWaveIncidenceAngleCompensationFactor ); ( *pHRTF )[ 1 ]->setMagnitudePreservePhase( i, std::powf( fMag, m_fWaveIncidenceAngleCompensationFactor ) );
} }
( *pHRTF )[ 1 ]->exp();
// Compensate initial HRTF energy when WICK is used (right channel) // Compensate initial HRTF energy when WICK is used (right channel)
assert( fEnergy > 0 ); assert( fEnergy > 0 );
fEnergyCompensation = powf( fEnergy, ( 1 - m_fWaveIncidenceAngleCompensationFactor ) ); fEnergyCompensation = std::powf( fEnergy, ( 1 - m_fWaveIncidenceAngleCompensationFactor ) );
( *pHRTF )[ 1 ]->mul( fEnergyCompensation ); ( *pHRTF )[ 1 ]->mul( fEnergyCompensation );
......
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