Aufgrund eines Versionsupdates wird GitLab am 17.12. zwischen 9:00 und 9:30 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to a version upgrade, GitLab won't be accessible at 17.12. between 9 and 9:30 a.m.

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

Merge branch 'master' into develop

parents f00d5594 660b19d9
......@@ -17,7 +17,7 @@ if ( NOT WIN32 )
endif ()
if( NOT DEFINED ITA_FFT_WITH_FFTW3 )
set( ITA_FFT_WITH_FFTW3 ON CACHE BOOL "Build with FFTW3 for fast fourier transforms" )
set( ITA_FFT_WITH_FFTW3 ON CACHE BOOL "Build with FFTW3 for fast fourier transforms (will force the ITA libraries to select the GNU GPL license)" )
endif( )
if( NOT DEFINED ITA_FFT_WITH_INTEL_MKL10 )
......@@ -51,6 +51,7 @@ set( ITAFFTSources
src/ITAFFTUtils.cpp
)
set( ITA_SELECTIVE_LICENSE_DEPENDENCY_GPL OFF )
if( ITA_FFT_WITH_FFTW3 )
set( ITAFFTSources "${ITAFFTSources}" src/FFTW3Backend.h src/FFTW3Backend.cpp )
add_definitions( -DITAFFT_WITH_FFTW3 )
......@@ -62,7 +63,6 @@ if( ITA_FFT_WITH_INTEL_MKL10 )
endif( )
# compiler settings
# compiler settings
if( ITA_VISTA_BUILD_STATIC )
add_definitions( -DVISTABASE_STATIC -DVISTAMATH_STATIC -DVISTAASPECTS_STATIC -DVISTATOOLS_STATIC -DVISTAINTERPROCCOMM_STATIC )
......@@ -83,6 +83,30 @@ add_library( ITAFFT ${ITAFFTHeader} ${ITAFFTSources} )
target_link_libraries( ITAFFT ${VISTA_USE_PACKAGE_LIBRARIES} )
# selective license
if( ITA_FFT_WITH_FFTW3 )
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
# Take care of license here
message( "FFTW3 requires copying under the terms of the GNU General Public License. This license includes a copyleft and may require your source code to be published under the same terms. Please respect the license agreements. Will include the GNU GPL COPYING file into distribution." )
set( SELECTED_LICENSE "GNU General Public License" )
set( GPL_DEPENDENCIES "FFTW3" )
configure_file( COPYING.proto ${CMAKE_CURRENT_SOURCE_DIR}/COPYING @ONLY )
install( FILES COPYING DESTINATION . )
else( )
# Pass it on to parent
set( ITA_SELECTIVE_LICENSE_DEPENDENCY_GPL ON PARENT_SCOPE )
endif( )
endif( )
# config
vista_configure_lib( ITAFFT )
vista_install( ITAFFT )
......
Copyright 2015-2018 Institute of Technical Acoustics (ITA), RWTH Aachen University
This binary packages, although generated from code published under
Apache License, Version 2.0 requires distribution under the terms of
the @SELECTED_LICENSE@. Options in the build configuration have been
selected that require linking against libraries that include a copyleft.
GNU GPL dependencies: @GPL_DEPENDENCIES@
> This distribution is subject to VA's selective license dependency and may require you to publish your derived work under a copyleft license as well. The details are described in [README.md](https://git.rwth-aachen.de/ita/ITACoreLibs/) of ITACoreLibs.
This program is free software: you can redistribute it and/or modify
it under the terms of the @SELECTED_LICENSE@ as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the @SELECTED_LICENSE@
along with this program. If not, see <http://www.gnu.org/licenses/>.
\ No newline at end of file
## ITADataSources
## ITAFFT
ITAFFT is a backend-configurable C++ library for fast Fourier transformations. Currently, FFTW and Intel MKL is supported.
ITAFFT is a component of [ITACoreLibs](https://git.rwth-aachen.de/ita/ITACoreLibs), a collection of C++ libraries for virtual acoustics.
......
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_FFT
#define INCLUDE_WATCHER_ITA_FFT
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
/*
* ITAFFT, eine Wrapper-Bibliothek für schnelle Fouriertransformationen
*
* Autor: Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
*
* (c) Copyright Institut für Technische Akustik (ITA), RWTH Aachen
*
*/
// $Id: FFTW3Backend.cpp,v 1.3 2010-01-18 17:19:01 fwefers Exp $
#include "FFTW3Backend.h"
#include <cassert>
......@@ -18,37 +7,41 @@
ITACriticalSection csFFTW3BackendPlannerLock;
FFTW3Realization::FFTW3Realization(int type, int size, float* in, float* out, unsigned int uiFlags)
: m_plan(NULL), m_type(type), m_size(size), m_out(out)
FFTW3Realization::FFTW3Realization( int type, int size, float* in, float* out, unsigned int uiFlags )
: m_plan( NULL )
, m_type( type )
, m_size( size )
, m_out( out )
{
if ((size <= 0) || (in == NULL) || (out == NULL)) ITA_EXCEPT0(INVALID_PARAMETER);
if( ( size <= 0 ) || ( in == NULL ) || ( out == NULL ) ) ITA_EXCEPT0( INVALID_PARAMETER );
fftw_iodim dim, howmany_dim;
csFFTW3BackendPlannerLock.enter();
// [fwe 2010-07-20] Wichtiges Bugfix. Für out-of-place Transformationen die Eingabe unberührt lassen.
m_inplace = (in == out);
if (m_inplace) uiFlags |= FFTW_PRESERVE_INPUT;
m_inplace = ( in == out );
if( m_inplace ) uiFlags |= FFTW_PRESERVE_INPUT;
switch (type) {
switch( type )
{
case ITAFFT::FFT_R2C:
m_plan = fftwf_plan_dft_r2c_1d(size, in, (fftwf_complex*) out, uiFlags);
m_plan = fftwf_plan_dft_r2c_1d( size, in, ( fftwf_complex* ) out, uiFlags );
m_sInfo = "FFT_R2C [fftw3]";
break;
case ITAFFT::FFT_C2C:
m_plan = fftwf_plan_dft_1d(size, (fftwf_complex*) in, (fftwf_complex*) out, FFTW_FORWARD, uiFlags);
m_plan = fftwf_plan_dft_1d( size, ( fftwf_complex* ) in, ( fftwf_complex* ) out, FFTW_FORWARD, uiFlags );
m_sInfo = "FFT_C2C [fftw3]";
break;
case ITAFFT::IFFT_C2R:
m_plan = fftwf_plan_dft_c2r_1d(size, (fftwf_complex*) in, out, uiFlags);
m_plan = fftwf_plan_dft_c2r_1d( size, ( fftwf_complex* ) in, out, uiFlags );
m_sInfo = "IFFT_C2R [fftw3]";
break;
case ITAFFT::IFFT_C2C:
m_plan = fftwf_plan_dft_1d(size, (fftwf_complex*) in, (fftwf_complex*) out, FFTW_BACKWARD, uiFlags);
m_plan = fftwf_plan_dft_1d( size, ( fftwf_complex* ) in, ( fftwf_complex* ) out, FFTW_BACKWARD, uiFlags );
m_sInfo = "IFFT_C2C [fftw3]";
break;
......@@ -59,7 +52,7 @@ FFTW3Realization::FFTW3Realization(int type, int size, float* in, float* out, un
howmany_dim.n = 1;
howmany_dim.is = howmany_dim.os = 1;
m_plan = fftwf_plan_guru_split_dft_r2c(1, &dim, 1, &howmany_dim, in, out, out+(size/2)+1, uiFlags);
m_plan = fftwf_plan_guru_split_dft_r2c( 1, &dim, 1, &howmany_dim, in, out, out + ( size / 2 ) + 1, uiFlags );
m_sInfo = "SPLIT_FFT_R2C [fftw3]";
break;
......@@ -70,7 +63,7 @@ FFTW3Realization::FFTW3Realization(int type, int size, float* in, float* out, un
howmany_dim.n = 1;
howmany_dim.is = howmany_dim.os = 1;
m_plan = fftwf_plan_guru_split_dft_c2r(1, &dim, 1, &howmany_dim, in, in+(size/2)+1, out, uiFlags);
m_plan = fftwf_plan_guru_split_dft_c2r( 1, &dim, 1, &howmany_dim, in, in + ( size / 2 ) + 1, out, uiFlags );
m_sInfo = "SPLIT_IFFT_C2R [fftw3]";
break;
......@@ -81,68 +74,79 @@ FFTW3Realization::FFTW3Realization(int type, int size, float* in, float* out, un
howmany_dim.n = 1;
howmany_dim.is = howmany_dim.os = 1;
m_plan = fftwf_plan_guru_split_dft_c2r(1, &dim, 1, &howmany_dim, in, in+(size/2)+1, out, uiFlags);
m_plan = fftwf_plan_guru_split_dft_c2r( 1, &dim, 1, &howmany_dim, in, in + ( size / 2 ) + 1, out, uiFlags );
m_sInfo = "NORMALIZED_SPLIT_IFFT_C2R [fftw3]";
break;
}
csFFTW3BackendPlannerLock.leave();
if (m_plan == NULL) ITA_EXCEPT0(UNKNOWN);
if( m_plan == NULL )
ITA_EXCEPT0( UNKNOWN );
}
FFTW3Realization::~FFTW3Realization() {
if (m_plan != NULL) fftwf_destroy_plan(m_plan);
FFTW3Realization::~FFTW3Realization()
{
if( m_plan != NULL )
fftwf_destroy_plan( m_plan );
}
void FFTW3Realization::execute() {
fftwf_execute(m_plan);
fftwf_execute( m_plan );
// Sonderfall NORMALIZED_SPLIT_IFFT_C2R: Hier noch die Normalisierung durchführen
if (m_type == ITAFFT::NORMALIZED_SPLIT_IFFT_C2R)
for (int i=0; i<m_size; i++) m_out[i] /= (float) m_size;
if( m_type == ITAFFT::NORMALIZED_SPLIT_IFFT_C2R )
for( int i = 0; i < m_size; i++ )
m_out[ i ] /= ( float ) m_size;
}
void FFTW3Realization::execute(float* in, float* out) {
if (m_inplace) {
if (in != out) ITA_EXCEPT1(INVALID_PARAMETER, "Attempt to execute in-place transform out-of-place");
} else {
if (in == out) ITA_EXCEPT1(INVALID_PARAMETER, "Attempt to execute out-of-place transform in-place");
void FFTW3Realization::execute( float* in, float* out )
{
if( m_inplace )
{
if( in != out ) ITA_EXCEPT1( INVALID_PARAMETER, "Attempt to execute in-place transform out-of-place" );
}
else
{
if( in == out ) ITA_EXCEPT1( INVALID_PARAMETER, "Attempt to execute out-of-place transform in-place" );
}
switch (m_type) {
switch( m_type )
{
case ITAFFT::FFT_R2C:
fftwf_execute_dft_r2c(m_plan, in, (fftwf_complex*) out);
fftwf_execute_dft_r2c( m_plan, in, ( fftwf_complex* ) out );
break;
case ITAFFT::IFFT_C2R:
fftwf_execute_dft_c2r(m_plan, (fftwf_complex*) in, out);
fftwf_execute_dft_c2r( m_plan, ( fftwf_complex* ) in, out );
break;
case ITAFFT::FFT_C2C:
case ITAFFT::IFFT_C2C:
fftwf_execute_dft(m_plan, (fftwf_complex*) in, (fftwf_complex*) out);
fftwf_execute_dft( m_plan, ( fftwf_complex* ) in, ( fftwf_complex* ) out );
break;
case ITAFFT::SPLIT_FFT_R2C:
fftwf_execute_split_dft_r2c(m_plan, in, out, (out+(m_size/2)+1));
fftwf_execute_split_dft_r2c( m_plan, in, out, ( out + ( m_size / 2 ) + 1 ) );
break;
case ITAFFT::SPLIT_IFFT_C2R:
fftwf_execute_split_dft_c2r(m_plan, in, (in+(m_size/2)+1), out);
fftwf_execute_split_dft_c2r( m_plan, in, ( in + ( m_size / 2 ) + 1 ), out );
break;
case ITAFFT::NORMALIZED_SPLIT_IFFT_C2R:
fftwf_execute_split_dft_c2r(m_plan, in, (in+(m_size/2)+1), out);
fftwf_execute_split_dft_c2r( m_plan, in, ( in + ( m_size / 2 ) + 1 ), out );
// Normalisierung durchführen
for (int i=0; i<m_size; i++) out[i] /= (float) m_size;
for( int i = 0; i < m_size; i++ ) out[ i ] /= ( float ) m_size;
break;
}
}
std::string FFTW3Realization::toString() {
std::string FFTW3Realization::toString()
{
return m_sInfo;
}
......@@ -150,12 +154,15 @@ std::string FFTW3Realization::toString() {
FFTW3Backend* FFTW3Backend::m_pInstance = NULL;
FFTW3Backend* FFTW3Backend::getInstance() {
if (m_pInstance == NULL) m_pInstance = new FFTW3Backend();
FFTW3Backend* FFTW3Backend::getInstance()
{
if( m_pInstance == NULL )
m_pInstance = new FFTW3Backend();
return m_pInstance;
}
ITAFFTRealization* FFTW3Backend::plan(int type, int size, float* in, float* out, unsigned int uiFlags) {
return new FFTW3Realization(type, size, in, out, uiFlags);
ITAFFTRealization* FFTW3Backend::plan( int type, int size, float* in, float* out, unsigned int uiFlags )
{
return new FFTW3Realization( type, size, in, out, uiFlags );
}
/*
* ITAFFT, eine Wrapper-Bibliothek fr schnelle Fouriertransformationen
* ----------------------------------------------------------------
*
* Autor: Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* (c) Copyright Institut fr Technische Akustik (ITA), RWTH Aachen
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
// $Id: FFTW3Backend.h,v 1.1 2009-12-14 10:19:17 fwefers Exp $
#ifndef INCLUDE_WATCHER_FFTW3_BACKEND
#define INCLUDE_WATCHER_FFTW3_BACKEND
......
......@@ -15,10 +15,14 @@
#endif
ITAFFT::ITAFFT() : m_pRealization(NULL) {}
ITAFFT::ITAFFT() : m_pRealization( NULL )
{
}
ITAFFT::ITAFFT(int type, int size, float* in, float* out, int iPlannungMethod) : m_pRealization(NULL) {
plan(type, size, in, out, iPlannungMethod);
ITAFFT::ITAFFT( int type, int size, float* in, float* out, int iPlannungMethod )
: m_pRealization( NULL )
{
plan( type, size, in, out, iPlannungMethod );
}
ITAFFT::~ITAFFT()
......@@ -26,18 +30,20 @@ ITAFFT::~ITAFFT()
delete m_pRealization;
}
bool ITAFFT::isPlanned() {
return (m_pRealization != NULL);
bool ITAFFT::isPlanned()
{
return ( m_pRealization != NULL );
}
void ITAFFT::plan(int type, int size, float* in, float* out, int iPlannungMethod) {
void ITAFFT::plan( int type, int size, float* in, float* out, int iPlannungMethod )
{
// Falls bereits geplant wurde, wird der alte Plan verworfen
delete m_pRealization;
unsigned int uiFlags = 0;
if (iPlannungMethod == PLAN_USING_MEASUREMENT)
if( iPlannungMethod == PLAN_USING_MEASUREMENT )
uiFlags |= FFTW_MEASURE;
if (iPlannungMethod == PLAN_USING_ESTIMATION)
if( iPlannungMethod == PLAN_USING_ESTIMATION )
uiFlags |= FFTW_ESTIMATE;
#ifdef ITAFFT_WITH_FFTW3
......@@ -45,26 +51,27 @@ void ITAFFT::plan(int type, int size, float* in, float* out, int iPlannungMethod
#endif
#ifdef ITAFFT_WITH_MKL10
m_pRealization = MKL10Backend::getInstance()->plan(type, size, in, out, uiFlags);
m_pRealization = MKL10Backend::getInstance()->plan( type, size, in, out, uiFlags );
#endif
if (m_pRealization == NULL) ITA_EXCEPT1(UNKNOWN, "Planning of the FFT failed");
if( m_pRealization == NULL )
ITA_EXCEPT1( UNKNOWN, "Planning of the FFT failed" );
}
void ITAFFT::execute()
{
if (m_pRealization == NULL)
ITA_EXCEPT1(MODAL_EXCEPTION, "Attempt to execute unplanned ITAFFT");
if( m_pRealization == NULL )
ITA_EXCEPT1( MODAL_EXCEPTION, "Attempt to execute unplanned ITAFFT" );
m_pRealization->execute();
}
void ITAFFT::execute(float* in, float* out)
void ITAFFT::execute( float* in, float* out )
{
if (m_pRealization == NULL)
ITA_EXCEPT1(MODAL_EXCEPTION, "Attempt to execute unplanned ITAFFT");
m_pRealization->execute(in, out);
if( m_pRealization == NULL )
ITA_EXCEPT1( MODAL_EXCEPTION, "Attempt to execute unplanned ITAFFT" );
m_pRealization->execute( in, out );
}
std::string ITAFFT::toString() {
return (m_pRealization == NULL ? std::string("unplanned ITAFFT") : m_pRealization->toString());
return ( m_pRealization == NULL ? std::string( "unplanned ITAFFT" ) : m_pRealization->toString() );
}
/*
* ITAFFT, eine Wrapper-Bibliothek fr schnelle Fouriertransformationen
* ----------------------------------------------------------------
*
* Autor: Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* (c) Copyright Institut fr Technische Akustik (ITA), RWTH Aachen
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
// $Id: ITAFFTBackend.h,v 1.2 2009-02-10 22:37:42 stienen Exp $
#ifndef INCLUDE_WATCHER_ITA_FFT_BACKEND
#define INCLUDE_WATCHER_ITA_FFT_BACKEND
......
/*
* ITAFFT, eine Wrapper-Bibliothek fr schnelle Fouriertransformationen
* ----------------------------------------------------------------
*
* Autor: Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* (c) Copyright 2008 Institut fr Technische Akustik (ITA), RWTH Aachen
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
// $Id: ITAFFTFactory.h,v 1.1 2008-02-07 19:14:44 fwefers Exp $
#ifndef INCLUDE_WATCHER_ITA_FFT_FACTORY
#define INCLUDE_WATCHER_ITA_FFT_FACTORY
......
/*
* ITAFFT, eine Wrapper-Bibliothek für schnelle Fouriertransformationen
* ----------------------------------------------------------------
*
* Autor: Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* (c) Copyright Institut für Technische Akustik (ITA), RWTH Aachen
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
// $Id: ITAFFTRealization.h,v 1.2 2009-02-10 22:37:42 stienen Exp $
#ifndef INCLUDE_WATCHER_ITA_FFT_REALIZATION
#define INCLUDE_WATCHER_ITA_FFT_REALIZATION
......
/*
* ITAFFT, eine Wrapper-Bibliothek fr schnelle Fouriertransformationen
* ----------------------------------------------------------------
*
* Autor: Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* (c) Copyright Institut fr Technische Akustik (ITA), RWTH Aachen
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
// $Id: MKL10Backend.h,v 1.1 2009-12-14 10:19:17 fwefers Exp $
#ifndef __MKL10_BACKEND_H__
#define __MKL10_BACKEND_H__
#ifndef IW_MKL10_BACKEND
#define IW_MKL10_BACKEND
#ifdef WITH_MKL10
#ifdef ITAFFT_WITH_FFTW3
// Hinweis: Diese Implementierung nutzt derzeit das FFTW3-Interface der MKL
......@@ -20,7 +27,8 @@
#include <ITAFFTBackend.h>
#include <ITAFFTRealization.h>
class MKL10Realization : public ITAFFTRealization {
class MKL10Realization : public ITAFFTRealization
{
public:
MKL10Realization(int type, int size, float* in, float* out);
~MKL10Realization();
......@@ -38,7 +46,8 @@ private:
std::string m_sInfo;
};
class MKL10Backend : public ITAFFTBackend {
class MKL10Backend : public ITAFFTBackend
{
public:
static MKL10Backend* getInstance();
......@@ -48,10 +57,6 @@ private:
static MKL10Backend* m_pInstance; // Singleton-Instanz
};
#endif // WITH_MKL10
#endif // __MKL10_BACKEND_H__
#endif // ITAFFT_WITH_FFTW3
#endif // IW_MKL10_BACKEND
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