Commit 450e2bef authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen

Merge branch 'feature/sweetspot_widening' of...

Merge branch 'feature/sweetspot_widening' of https://git.rwth-aachen.de/ita/ITACTC into feature/sweetspot_widening
parents aca5fc79 c6edadb2
......@@ -299,44 +299,50 @@ bool ITANCTC::CalculateFilter( std::vector< ITAHDFTSpectra* >& vpCTCFilter )
pHRTF->Export( "HRIR_LS" + IntToString( n + 1 ) + "_WICKed" );
#endif // NCTC_EXPORT_FILTER_TO_HARDDRIVE
// --- CTC compensation factor + weighting ---
// Weighting
float fWeight = float( m_vdWeights[ n ] ); // diag element
// --- CTC compensation factor ---
// CTC compensation factors
int iLSSide = GetLoudspeakerSide( n + 1 );
int iLSSide = GetLoudspeakerSide(n + 1);
float fRightChannelCTC = 1.0f;
if( iLSSide == Config::Loudspeaker::LEFT_SIDE )
if (iLSSide == Config::Loudspeaker::LEFT_SIDE)
fRightChannelCTC *= m_fCrossTalkCancellationFactor; // only apply to left channel if LS is at left side
float fLeftChannelCTC = 1.0f;
if( iLSSide == Config::Loudspeaker::RIGHT_SIDE )
if (iLSSide == Config::Loudspeaker::RIGHT_SIDE)
fLeftChannelCTC *= m_fCrossTalkCancellationFactor; // only apply to right channel if LS is at right side
(*pHRTF)[0]->mul(fLeftChannelCTC);
(*pHRTF)[1]->mul(fRightChannelCTC);
#ifdef NCTC_EXPORT_FILTER_TO_HARDDRIVE
pHRTF->Export("HRIR_LS" + IntToString(n + 1) + "_WICKedPlusCTCFactor");
#endif // NCTC_EXPORT_FILTER_TO_HARDDRIVE
// --- Weighting ---
float fWeight = float( m_vdWeights[ n ] ); // diag element
// Element wise (a and d): HWH* -> 2x2
t->copy( ( *pHRTF )[ 0 ] );
t->mul( fWeight * fLeftChannelCTC );
t->mul( fWeight );
t->mul_conj( ( *pHRTF )[ 0 ] );
n == 0 ? a->copy( t ) : a->add( t );
t->copy( ( *pHRTF )[ 1 ] );
t->mul( fWeight * fRightChannelCTC );
t->mul( fWeight );
t->mul_conj( ( *pHRTF )[ 1 ] );
n == 0 ? d->copy( t ) : d->add( t );
// Cross elements (b and c): HWH*
t->copy( ( *pHRTF )[ 1 ] );
t->mul( fWeight * fRightChannelCTC );
t->mul( fWeight );
t->mul_conj( ( *pHRTF )[ 0 ] );
n == 0 ? b->copy( t ) : b->add( t );
t->copy( ( *pHRTF )[ 0 ] );
t->mul( fWeight * fLeftChannelCTC );
t->mul( fWeight );
t->mul_conj( ( *pHRTF )[ 1 ] );
n == 0 ? c->copy( t ) : c->add( t );
......@@ -383,38 +389,27 @@ bool ITANCTC::CalculateFilter( std::vector< ITAHDFTSpectra* >& vpCTCFilter )
for( int n = 0; n < GetN(); n++ )
{
// Again, apply CTC compensation factors
int iLSSide = GetLoudspeakerSide( n + 1 );
float fRightChannelCTC = 1.0f;
if( iLSSide == Config::Loudspeaker::LEFT_SIDE )
fRightChannelCTC *= m_fCrossTalkCancellationFactor;
float fLeftChannelCTC = 1.0f;
if( iLSSide == Config::Loudspeaker::RIGHT_SIDE )
fLeftChannelCTC *= m_fCrossTalkCancellationFactor;
ITAHDFTSpectra* pHRTF( m_vpHRTFs[ n ] ); // two-channel, already WICKed
ITAHDFTSpectra* pCTCFilter( vpCTCFilter[ n ] ); // two-channel
float fWeight = float( m_vdWeights[ n ] ); // diag element
t->copy( a );
t->mul_conj( ( *pHRTF )[ 0 ] );
t->mul( fWeight * fLeftChannelCTC );
t->mul( fWeight );
( *pCTCFilter )[ 0 ]->copy( t );
t->copy( b );
t->mul_conj( ( *pHRTF )[ 1 ] );
t->mul( fWeight * fRightChannelCTC );
t->mul( fWeight );
( *pCTCFilter )[ 0 ]->add( t );
t->copy( c );
t->mul_conj( ( *pHRTF )[ 0 ] );
t->mul( fWeight * fLeftChannelCTC );
t->mul( fWeight );
( *pCTCFilter )[ 1 ]->copy( t );
t->copy( d );
t->mul_conj( ( *pHRTF )[ 1 ] );
t->mul( fWeight * fRightChannelCTC );
t->mul( fWeight );
( *pCTCFilter )[ 1 ]->add( t );
#ifdef NCTC_EXPORT_FILTER_TO_HARDDRIVE
......@@ -423,7 +418,6 @@ bool ITANCTC::CalculateFilter( std::vector< ITAHDFTSpectra* >& vpCTCFilter )
// Time-shift
m_ifft.execute( ( *pCTCFilter )[ 0 ]->data(), m_sfCTC_temp[ 0 ].data() );
m_ifft.execute( ( *pCTCFilter )[ 1 ]->data(), m_sfCTC_temp[ 1 ].data() );
......
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