Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
ITAConvolution
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
ITAConvolution
Commits
576d7fa7
Commit
576d7fa7
authored
May 18, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished refactoring and renaming
parent
3a334d98
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
276 deletions
+21
-276
apps/ita_convoi/ita_convoi.cpp
apps/ita_convoi/ita_convoi.cpp
+5
-5
include/ITAUPFilter.h
include/ITAUPFilter.h
+1
-1
include/ITAUPFilterPool.h
include/ITAUPFilterPool.h
+1
-1
src/ITAUPConvolution.cpp
src/ITAUPConvolution.cpp
+2
-2
tests/CMakeLists.txt
tests/CMakeLists.txt
+12
-12
tests/DSMBCTest.cpp
tests/DSMBCTest.cpp
+0
-203
tests/ITAConvolutionTest.cpp
tests/ITAConvolutionTest.cpp
+0
-52
No files found.
apps/ita_convoi/ita_convoi.cpp
View file @
576d7fa7
...
...
@@ -42,11 +42,11 @@
#include <VistaTools/VistaFileSystemFile.h>
class
ITAStreamConvolver
:
public
ITADatasourceRealizationEventHandler
,
public
DSMBCConvolver
class
ITAStreamConvolver
:
public
ITADatasourceRealizationEventHandler
,
public
ITAUPConvolution
{
public:
inline
ITAStreamConvolver
(
const
double
dSampleRate
,
const
int
iBlockLength
,
const
int
iFilterLength
)
:
DSMBCConvolver
(
iBlockLength
,
iFilterLength
)
:
ITAUPConvolution
(
iBlockLength
,
iFilterLength
)
,
pdsInput
(
NULL
)
{
m_pdsOutput
=
new
ITADatasourceRealization
(
1
,
dSampleRate
,
iBlockLength
);
...
...
@@ -59,7 +59,7 @@ public:
ITA_EXCEPT1
(
MODAL_EXCEPTION
,
"Input data source not defined yet"
);
const
float
*
pfInputData
=
pdsInput
->
GetBlockPointer
(
0
,
pStreamInfo
);
process
(
pfInputData
,
getBlocklength
(),
m_pdsOutput
->
GetWritePointer
(
0
),
getBlocklength
(),
DSMBCConvolver
::
OUTPUT_OVERWRITE
);
process
(
pfInputData
,
getBlocklength
(),
m_pdsOutput
->
GetWritePointer
(
0
),
getBlocklength
(),
ITAUPConvolution
::
OUTPUT_OVERWRITE
);
m_pdsOutput
->
IncrementWritePointer
();
};
...
...
@@ -303,7 +303,7 @@ std::string ita_convoi_commands()
void
ita_convio_exchange_channel
(
ITAStreamConvolver
*
pSC
,
const
ITASampleFrame
&
sfIR
,
const
int
iChannelIndex
)
{
assert
(
sfIR
.
channels
()
>
iChannelIndex
);
DSMBC
Filter
*
pFilter
=
pSC
->
requestFilter
();
ITAUP
Filter
*
pFilter
=
pSC
->
requestFilter
();
pFilter
->
load
(
sfIR
[
iChannelIndex
].
GetData
(),
sfIR
.
GetLength
()
);
pSC
->
exchangeFilter
(
pFilter
);
pSC
->
releaseFilter
(
pFilter
);
...
...
@@ -313,7 +313,7 @@ void ita_convio_exchange_channel( ITAStreamConvolver* pSC, const ITASampleFrame&
void
ita_convio_dirac_channel
(
ITAStreamConvolver
*
pSC
)
{
DSMBC
Filter
*
pFilter
=
pSC
->
requestFilter
();
ITAUP
Filter
*
pFilter
=
pSC
->
requestFilter
();
pFilter
->
identity
();
pSC
->
exchangeFilter
(
pFilter
);
pSC
->
releaseFilter
(
pFilter
);
...
...
include/ITAUPFilter.h
View file @
576d7fa7
...
...
@@ -34,7 +34,7 @@ class ITAFFT;
/**
* Diese Klasse realisiert Filter (d.h. Representationen von Impulsantworten im Frequenzbereich)
* für
DSMBCConvolver
. Solche Filter haben einen Zustand: 1) unbenutzt oder 2) momentan in einem
* für
ITAUPConvolution
. Solche Filter haben einen Zustand: 1) unbenutzt oder 2) momentan in einem
* Falter in Benutzung. Generell kann 1 Filter in beliebig vielen Faltern verwendet werden.
* Seine Daten dürfen aber nur modifiziert werden, wenn es nicht in Benutzung ist.
*
...
...
include/ITAUPFilterPool.h
View file @
576d7fa7
...
...
@@ -76,7 +76,7 @@ public:
/**
* Ist das Filter nicht in Benutzung, so kann es sofort weiterbenutzt werden.
* Ist das Filter in Benutzung, so wird es für die Weiterbenutzung freigebenen,
* sobald es in einem Falter (
DSMBCConvolver
) nicht mehr in Benutzung ist
* sobald es in einem Falter (
ITAUPConvolution
) nicht mehr in Benutzung ist
*/
void
releaseFilter
(
ITAUPFilter
*
pFilter
);
...
...
src/ITAUPConvolution.cpp
View file @
576d7fa7
...
...
@@ -223,7 +223,7 @@ ITAUPFilter* ITAUPConvolution::getActiveFilter()
void
ITAUPConvolution
::
exchangeFilter
(
ITAUPFilter
*
pNewFilter
,
const
int
iExchangeMode
,
const
int
iCrossfadeLength
)
{
//DEBUG_PRINTF("[
DSMBCConvolver
0x%08Xh] Exchanging to filter 0x%08Xh\n", this, pNewFilter);
//DEBUG_PRINTF("[
ITAUPConvolution
0x%08Xh] Exchanging to filter 0x%08Xh\n", this, pNewFilter);
// Platzierung des Filter vermerken
if
(
pNewFilter
)
...
...
@@ -327,7 +327,7 @@ void ITAUPConvolution::process( const float* pfInputData, const int iInputLength
// Wichtig: Ein Switching bei den Updates ist dominant
bForceSwitch
|=
(
xmode
==
SWITCH
);
//DEBUG_PRINTF("[
DSMBCConvolver
0x%08Xh] Popped next filter 0x%08Xh\n", this, Z);
//DEBUG_PRINTF("[
ITAUPConvolution
0x%08Xh] Popped next filter 0x%08Xh\n", this, Z);
if
(
N
)
N
->
m_oState
.
removePrep
();
N
=
Z
;
}
...
...
tests/CMakeLists.txt
View file @
576d7fa7
...
...
@@ -10,21 +10,21 @@ if( NOT ITA_CORE_LIBS_BUILD_STATIC )
add_definitions
(
-DITA_BASE_STATIC -DITA_FFT_STATIC -DITA_CONVOLUTION_STATIC
)
endif
(
)
add_executable
(
ITA
ConvolutionTest
"ITA
ConvolutionTest.cpp"
)
target_link_libraries
(
ITAConvolutionTest
${
VISTA_USE_PACKAGE_LIBRARIES
}
)
add_executable
(
ITA
DirectConvolutionTest
"ITADirect
ConvolutionTest.cpp"
)
target_link_libraries
(
ITA
Direct
ConvolutionTest
${
VISTA_USE_PACKAGE_LIBRARIES
}
)
vista_configure_app
(
ITAConvolutionTest
)
vista_install
(
ITAConvolutionTest
)
vista_create_default_info_file
(
ITAConvolutionTest
)
vista_configure_app
(
ITA
Direct
ConvolutionTest
)
vista_install
(
ITA
Direct
ConvolutionTest
)
vista_create_default_info_file
(
ITA
Direct
ConvolutionTest
)
set_property
(
TARGET ITAConvolutionTest PROPERTY FOLDER
"ITACoreLibs/Tests/ITAConvolution"
)
set_property
(
TARGET ITA
Direct
ConvolutionTest PROPERTY FOLDER
"ITACoreLibs/Tests/ITAConvolution"
)
add_executable
(
DSMBCTest
"DSMBC
Test.cpp"
)
target_link_libraries
(
DSMBC
Test
${
VISTA_USE_PACKAGE_LIBRARIES
}
)
add_executable
(
ITAUniformPartitionedConvolutionTest
"ITAUniformPartitionedConvolution
Test.cpp"
)
target_link_libraries
(
ITAUniformPartitionedConvolution
Test
${
VISTA_USE_PACKAGE_LIBRARIES
}
)
vista_configure_app
(
DSMBC
Test
)
vista_install
(
DSMBC
Test
)
vista_create_default_info_file
(
DSMBC
Test
)
vista_configure_app
(
ITAUniformPartitionedConvolution
Test
)
vista_install
(
ITAUniformPartitionedConvolution
Test
)
vista_create_default_info_file
(
ITAUniformPartitionedConvolution
Test
)
set_property
(
TARGET
DSMBC
Test PROPERTY FOLDER
"ITACoreLibs/Tests/ITAConvolution"
)
set_property
(
TARGET
ITAUniformPartitionedConvolution
Test PROPERTY FOLDER
"ITACoreLibs/Tests/ITAConvolution"
)
tests/DSMBCTest.cpp
deleted
100644 → 0
View file @
3a334d98
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <string>
#include <ITAException.h>
#include <ITAAudiofileReader.h>
#include <ITAAudiofileWriter.h>
#include <ITAUPConvolution.h>
#include <ITAUPFilter.h>
#include <ITAUPFilterPool.h>
#include <ITAFunctors.h>
#include <ITANumericUtils.h>
#include <ITAStringUtils.h>
using
namespace
std
;
ITAAudiofileReader
*
pInputReader
=
NULL
,
*
pFilterReader
=
NULL
;
ITAAudiofileWriter
*
pOutputWriter
=
NULL
;
vector
<
float
*>
vpfInputData
;
vector
<
float
*>
vpfOutputData
;
vector
<
float
*>
vpfFilterData
;
void
test1
()
{
// Einfaches Durchfalten. Kein Austausch
const
int
m
=
16
;
const
int
n
=
8
;
const
int
b
=
4
;
int
o
=
uprmul
(
m
+
n
-
1
,
b
);
float
*
s
=
new
float
[
m
];
float
*
h
=
new
float
[
n
];
float
*
g
=
new
float
[
o
];
memset
(
s
,
0
,
m
*
sizeof
(
float
));
memset
(
h
,
0
,
n
*
sizeof
(
float
));
memset
(
g
,
0
,
o
*
sizeof
(
float
));
for
(
int
i
=
0
;
i
<
(
m
>>
1
);
i
++
)
s
[
i
]
=
1
;
for
(
int
i
=
0
;
i
<
(
n
>>
1
);
i
++
)
h
[
i
]
=
1
;
DSMBCConvolver
*
conv
=
new
DSMBCConvolver
(
b
,
n
);
DSMBCFilter
*
filter1
=
new
DSMBCFilter
(
b
,
n
);
filter1
->
load
(
h
,
n
);
conv
->
exchangeFilter
(
filter1
);
int
j
=
0
;
for
(
int
i
=
0
;
i
<
uprdiv
(
o
,
b
);
i
++
)
{
//for (int i=0; i<1; i++) {
conv
->
process
(
s
+
j
,
g
+
j
);
j
+=
b
;
}
delete
conv
;
delete
filter1
;
delete
[]
s
;
delete
[]
h
;
delete
[]
g
;
}
void
test2
()
{
// Einfaches Durchfalten. Einblenden
const
int
m
=
16
;
const
int
n
=
8
;
const
int
b
=
4
;
int
o
=
uprmul
(
m
+
n
-
1
,
b
);
float
*
s
=
new
float
[
m
];
float
*
h
=
new
float
[
n
];
float
*
g
=
new
float
[
o
];
memset
(
s
,
0
,
m
*
sizeof
(
float
));
memset
(
h
,
0
,
n
*
sizeof
(
float
));
memset
(
g
,
0
,
o
*
sizeof
(
float
));
for
(
int
i
=
0
;
i
<
(
m
>>
1
);
i
++
)
s
[
i
]
=
1
;
for
(
int
i
=
0
;
i
<
(
n
>>
1
);
i
++
)
h
[
i
]
=
1
;
DSMBCConvolver
*
conv
=
new
DSMBCConvolver
(
b
,
n
);
conv
->
setFilterExchangeMode
(
DSMBCConvolver
::
CROSSFADE_LINEAR
);
conv
->
setFilterCrossfadeLength
(
3
);
DSMBCFilter
*
filter1
=
new
DSMBCFilter
(
b
,
n
);
//conv->destroyFilter(filter1);
filter1
->
load
(
h
,
n
);
conv
->
exchangeFilter
(
filter1
);
int
j
=
0
;
for
(
int
i
=
0
;
i
<
uprdiv
(
o
,
b
);
i
++
)
{
//for (int i=0; i<1; i++) {
conv
->
process
(
s
,
g
);
j
+=
b
;
}
delete
conv
;
delete
filter1
;
delete
[]
s
;
delete
[]
h
;
delete
[]
g
;
}
void
test3
()
{
// Einfaches Durchfalten. Einblenden
const
int
m
=
16
;
const
int
n
=
8
;
const
int
b
=
4
;
int
o
=
uprmul
(
m
+
n
-
1
,
b
);
float
*
s
=
new
float
[
m
];
float
*
h1
=
new
float
[
n
];
float
*
h2
=
new
float
[
n
];
float
*
g
=
new
float
[
o
];
memset
(
s
,
0
,
m
*
sizeof
(
float
));
memset
(
h1
,
0
,
n
*
sizeof
(
float
));
memset
(
h2
,
0
,
n
*
sizeof
(
float
));
memset
(
g
,
0
,
o
*
sizeof
(
float
));
for
(
int
i
=
0
;
i
<
(
m
>>
1
);
i
++
)
s
[
i
]
=
1
;
for
(
int
i
=
0
;
i
<
(
n
>>
1
);
i
++
)
h1
[
i
]
=
1
;
h2
[
n
-
1
]
=
1
;
DSMBCConvolver
*
conv
=
new
DSMBCConvolver
(
b
,
n
);
conv
->
setFilterExchangeMode
(
DSMBCConvolver
::
CROSSFADE_LINEAR
);
conv
->
setFilterCrossfadeLength
(
3
);
DSMBCFilterPool
*
pool
=
new
DSMBCFilterPool
(
b
,
n
,
0
);
DSMBCFilter
*
filter1
=
pool
->
requestFilter
();
DSMBCFilter
*
filter2
=
pool
->
requestFilter
();
//conv->destroyFilter(filter1);
filter1
->
load
(
h1
,
n
);
filter2
->
load
(
h2
,
n
);
conv
->
exchangeFilter
(
filter1
);
int
j
=
0
;
for
(
int
i
=
0
;
i
<
uprdiv
(
o
,
b
);
i
++
)
{
//for (int i=0; i<1; i++) {
if
(
i
==
1
)
conv
->
exchangeFilter
(
filter2
);
// vvv f�r Bereichspr�fung auf s
conv
->
process
(
s
,
g
);
j
+=
b
;
}
//writeAudiofile("out.wav", g, o, 44100);
printf
(
"s = (%s)
\n
"
,
FloatArrayToString
(
s
,
m
,
1
).
c_str
());
printf
(
"h1 = (%s)
\n
"
,
FloatArrayToString
(
h1
,
n
,
1
).
c_str
());
printf
(
"h2 = (%s)
\n
"
,
FloatArrayToString
(
h2
,
n
,
1
).
c_str
());
printf
(
"g = (%s)
\n
"
,
FloatArrayToString
(
g
,
m
+
n
-
1
,
1
).
c_str
());
delete
conv
;
delete
pool
;
delete
[]
s
;
delete
[]
h1
;
delete
[]
h2
;
delete
[]
g
;
}
void
test_filterpool
()
{
// Einfaches Durchfalten. Einblenden
const
int
b
=
8
;
const
int
n
=
8
;
float
*
s
=
new
float
[
n
];
DSMBCConvolver
*
conv
=
new
DSMBCConvolver
(
b
,
n
);
DSMBCFilterPool
*
pool
=
new
DSMBCFilterPool
(
b
,
n
,
0
);
DSMBCFilter
*
f1
=
pool
->
requestFilter
();
conv
->
exchangeFilter
(
f1
);
conv
->
process
(
s
,
s
);
f1
->
release
();
DSMBCFilter
*
f2
=
pool
->
requestFilter
();
conv
->
exchangeFilter
(
f2
);
conv
->
process
(
s
,
s
);
DSMBCFilter
*
f3
=
pool
->
requestFilter
();
conv
->
exchangeFilter
(
f2
);
conv
->
process
(
s
,
s
);
delete
conv
;
delete
pool
;
delete
[]
s
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
test1
();
//test2();
//test3();
//test_filterpool();
return
0
;
}
tests/ITAConvolutionTest.cpp
deleted
100644 → 0
View file @
3a334d98
#include <stdio.h>
#include <cstring>
#include <ITAAudiofileReader.h>
#include <ITAAudiofileWriter.h>
#include <ITADirectConvolution.h>
#include <ITAStringUtils.h>
using
namespace
std
;
void
test1
()
{
// Einfaches Durchfalten. Kein Austausch
const
int
m
=
7
;
const
int
n
=
5
;
int
o
=
m
+
n
-
1
;
float
*
s
=
new
float
[
m
];
float
*
h
=
new
float
[
n
];
float
*
g
=
new
float
[
o
];
memset
(
s
,
0
,
m
*
sizeof
(
float
)
);
memset
(
h
,
0
,
n
*
sizeof
(
float
)
);
memset
(
g
,
0
,
o
*
sizeof
(
float
)
);
for
(
int
i
=
0
;
i
<
(
m
>>
1
);
i
++
)
s
[
i
]
=
1
;
for
(
int
i
=
0
;
i
<
(
n
>>
1
);
i
++
)
h
[
i
]
=
1
;
//for (int i=0; i<n; i++) h[i] = 1;
printf
(
"s = %s
\n
"
,
FloatArrayToString
(
s
,
m
).
c_str
()
);
printf
(
"h = %s
\n
"
,
FloatArrayToString
(
h
,
n
).
c_str
()
);
ITAConvolution
conv
(
m
,
n
);
conv
.
convolve
(
s
,
m
,
h
,
n
,
g
,
o
);
printf
(
"g = %s
\n
"
,
FloatArrayToString
(
g
,
o
).
c_str
()
);
delete
[]
s
;
delete
[]
h
;
delete
[]
g
;
}
int
main
(
int
argc
,
char
*
argv
[]
)
{
test1
();
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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