Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITACTC
Commits
4aabc712
Commit
4aabc712
authored
May 18, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Applying refactoring name changes for uniform partitioned convolution
parent
c395e918
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/ITANCTCStreamFilter.h
View file @
4aabc712
...
...
@@ -26,10 +26,10 @@
#include
<ITADataSourceRealization.h>
// Forward declarations
class
DSMBC
Convol
ver
;
class
DSMBC
Filter
;
class
DSMBC
FilterPool
;
class
DSMBC
Trigger
;
class
ITAUP
Convol
ution
;
class
ITAUP
Filter
;
class
ITAUP
FilterPool
;
class
ITAUP
Trigger
;
class
ITADatasource
;
class
ITAHDFTSpectra
;
...
...
@@ -47,7 +47,7 @@ public:
double
dSampleRate
;
//!< Audio processing sample rate
int
iBlockLength
;
//!< Audio processing block length
int
iFilterLength
;
//!< Length of filter
int
iFilterExchangeMode
;
//!< Exchange mode \see
DSMBC
Convol
ver
int
iFilterExchangeMode
;
//!< Exchange mode \see
ITAUP
Convol
ution
int
iFilterCrossfadeLength
;
//!< Filter exchange crossfade length
};
...
...
@@ -82,10 +82,10 @@ private:
ITADatasource
*
m_pdsInput
;
//!< Input data source
ITADatasourceRealization
*
m_pdsOutput
;
//!< Output data source
DSMBC
FilterPool
*
m_pFilterPool
;
//!< Filter Pool containing dropped, current and queued filters
DSMBC
Trigger
*
m_pFilterExchangeTrigger
;
//!< Trigger for filter exchange
ITAUP
FilterPool
*
m_pFilterPool
;
//!< Filter Pool containing dropped, current and queued filters
ITAUP
Trigger
*
m_pFilterExchangeTrigger
;
//!< Trigger for filter exchange
std
::
vector
<
DSMBC
Convol
ver
*
>
m_vpConvolvers
;
//!< 2*N individual block convolver for each CTC filter, even number = left binaural signal
std
::
vector
<
ITAUP
Convol
ution
*
>
m_vpConvolvers
;
//!< 2*N individual block convolver for each CTC filter, even number = left binaural signal
};
#endif // INCLUDE_WATCHER_ITA_N_CTC_STREAMING_FILTER
\ No newline at end of file
src/ITANCTCStreamFilter.cpp
View file @
4aabc712
...
...
@@ -2,9 +2,10 @@
#include
<assert.h>
#include
<DSMBCConvolver.h>
#include
<DSMBCFilter.h>
#include
<DSMBCFilterPool.h>
#include
<ITAUPConvolution.h>
#include
<ITAUPFilter.h>
#include
<ITAUPFilterPool.h>
#include
<ITAUPTrigger.h>
#include
<ITAAudiofileWriter.h>
#include
<ITAException.h>
...
...
@@ -16,21 +17,21 @@ ITANCTCStreamFilter::ITANCTCStreamFilter( const ITANCTCStreamFilter::Config& oC
:
m_pdsInput
(
NULL
)
,
m_pdsOutput
(
NULL
)
,
m_pFilterPool
(
NULL
)
,
m_pFilterExchangeTrigger
(
new
DSMBC
Trigger
)
,
m_pFilterExchangeTrigger
(
new
ITAUP
Trigger
)
,
oConfig
(
oC
)
{
// Create filter pool; pre-fetch 2*N filters... arbitrary, done dynamically later
m_pFilterPool
=
new
DSMBC
FilterPool
(
oConfig
.
iBlockLength
,
oConfig
.
iFilterLength
,
2
*
oConfig
.
N
);
m_pFilterPool
=
new
ITAUP
FilterPool
(
oConfig
.
iBlockLength
,
oConfig
.
iFilterLength
,
2
*
oConfig
.
N
);
// Create N two-channel convolvers
for
(
int
n
=
0
;
n
<
oConfig
.
N
;
n
++
)
{
DSMBC
Convol
ver
*
pConvolverL
=
new
DSMBC
Convol
ver
(
oConfig
.
iBlockLength
,
oConfig
.
iFilterLength
,
m_pFilterPool
);
ITAUP
Convol
ution
*
pConvolverL
=
new
ITAUP
Convol
ution
(
oConfig
.
iBlockLength
,
oConfig
.
iFilterLength
,
m_pFilterPool
);
pConvolverL
->
setFilterExchangeMode
(
oConfig
.
iFilterExchangeMode
);
pConvolverL
->
setFilterCrossfadeLength
(
oConfig
.
iFilterCrossfadeLength
);
m_vpConvolvers
.
push_back
(
pConvolverL
);
DSMBC
Convol
ver
*
pConvolverR
=
new
DSMBC
Convol
ver
(
oConfig
.
iBlockLength
,
oConfig
.
iFilterLength
,
m_pFilterPool
);
ITAUP
Convol
ution
*
pConvolverR
=
new
ITAUP
Convol
ution
(
oConfig
.
iBlockLength
,
oConfig
.
iFilterLength
,
m_pFilterPool
);
pConvolverR
->
setFilterExchangeMode
(
oConfig
.
iFilterExchangeMode
);
pConvolverR
->
setFilterCrossfadeLength
(
oConfig
.
iFilterCrossfadeLength
);
m_vpConvolvers
.
push_back
(
pConvolverR
);
...
...
@@ -61,7 +62,7 @@ void ITANCTCStreamFilter::SetInputDatasource( ITADatasource* pdsInput )
if
(
pdsInput
->
GetNumberOfChannels
()
!=
2
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Input datasource must be stereo"
);
if
(
pdsInput
->
GetBlocklength
()
!=
oConfig
.
iBlockLength
)
if
(
int
(
pdsInput
->
GetBlocklength
()
)
!=
oConfig
.
iBlockLength
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Datasource has different streaming blocklength"
);
m_pdsInput
=
pdsInput
;
...
...
@@ -96,8 +97,8 @@ void ITANCTCStreamFilter::ExchangeFilters( const std::vector< ITAHDFTSpectra* >&
int
iIdxRight
=
iIdxLeft
+
1
;
// Left binaural signal
DSMBC
Convol
ver
*
pConvolverL
(
m_vpConvolvers
[
iIdxLeft
]
);
DSMBC
Filter
*
pNewFilterL
=
m_pFilterPool
->
requestFilter
();
ITAUP
Convol
ution
*
pConvolverL
(
m_vpConvolvers
[
iIdxLeft
]
);
ITAUP
Filter
*
pNewFilterL
=
m_pFilterPool
->
requestFilter
();
sbSpectrum
.
write
(
oCTCFilterL
.
data
(),
sbSpectrum
.
length
()
);
fIn
=
sbSpectrum
.
data
();
fOut
=
sbImpulseResponse
.
data
();
...
...
@@ -108,8 +109,8 @@ void ITANCTCStreamFilter::ExchangeFilters( const std::vector< ITAHDFTSpectra* >&
pNewFilterL
->
release
();
// Right binaural signal
DSMBC
Convol
ver
*
pConvolverR
(
m_vpConvolvers
[
iIdxRight
]
);
DSMBC
Filter
*
pNewFilterR
=
m_pFilterPool
->
requestFilter
();
ITAUP
Convol
ution
*
pConvolverR
(
m_vpConvolvers
[
iIdxRight
]
);
ITAUP
Filter
*
pNewFilterR
=
m_pFilterPool
->
requestFilter
();
sbSpectrum
.
write
(
oCTCFilterR
.
data
(),
sbSpectrum
.
length
()
);
fIn
=
sbSpectrum
.
data
();
fOut
=
sbImpulseResponse
.
data
();
...
...
@@ -132,8 +133,8 @@ void ITANCTCStreamFilter::SetGains( const std::vector< float >& vfGains, bool bS
{
int
iIdxLeft
=
2
*
n
;
int
iIdxRight
=
iIdxLeft
+
1
;
DSMBC
Convol
ver
*
pConvolverL
(
m_vpConvolvers
[
iIdxLeft
]
);
DSMBC
Convol
ver
*
pConvolverR
(
m_vpConvolvers
[
iIdxRight
]
);
ITAUP
Convol
ution
*
pConvolverL
(
m_vpConvolvers
[
iIdxLeft
]
);
ITAUP
Convol
ution
*
pConvolverR
(
m_vpConvolvers
[
iIdxRight
]
);
const
float
&
fGain
(
vfGains
[
n
]
);
pConvolverL
->
setGain
(
fGain
,
bSetImmediately
);
...
...
@@ -142,7 +143,7 @@ void ITANCTCStreamFilter::SetGains( const std::vector< float >& vfGains, bool bS
}
}
void
ITANCTCStreamFilter
::
HandleProcessStream
(
ITADatasourceRealization
*
pSender
,
const
ITAStreamInfo
*
pStreamInfo
)
void
ITANCTCStreamFilter
::
HandleProcessStream
(
ITADatasourceRealization
*
,
const
ITAStreamInfo
*
pStreamInfo
)
{
if
(
!
m_pdsInput
)
ITA_EXCEPT1
(
MODAL_EXCEPTION
,
"Input data source not defined yet"
);
...
...
@@ -158,11 +159,11 @@ void ITANCTCStreamFilter::HandleProcessStream( ITADatasourceRealization* pSender
int
iIdxLeft
=
2
*
n
;
int
iIdxRight
=
iIdxLeft
+
1
;
DSMBC
Convol
ver
*
pConvolverL
(
m_vpConvolvers
[
iIdxLeft
]
);
DSMBC
Convol
ver
*
pConvolverR
(
m_vpConvolvers
[
iIdxRight
]
);
ITAUP
Convol
ution
*
pConvolverL
(
m_vpConvolvers
[
iIdxLeft
]
);
ITAUP
Convol
ution
*
pConvolverR
(
m_vpConvolvers
[
iIdxRight
]
);
pConvolverL
->
process
(
pfInputDataCh0
,
oConfig
.
iBlockLength
,
pfOutputData
,
oConfig
.
iBlockLength
,
DSMBC
Convol
ver
::
OUTPUT_OVERWRITE
);
pConvolverR
->
process
(
pfInputDataCh1
,
oConfig
.
iBlockLength
,
pfOutputData
,
oConfig
.
iBlockLength
,
DSMBC
Convol
ver
::
OUTPUT_MIX
);
pConvolverL
->
process
(
pfInputDataCh0
,
oConfig
.
iBlockLength
,
pfOutputData
,
oConfig
.
iBlockLength
,
ITAUP
Convol
ution
::
OUTPUT_OVERWRITE
);
pConvolverR
->
process
(
pfInputDataCh1
,
oConfig
.
iBlockLength
,
pfOutputData
,
oConfig
.
iBlockLength
,
ITAUP
Convol
ution
::
OUTPUT_MIX
);
}
// Increment write pointer on output stream
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment