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

Merge branch 'develop'

parents 8fea2efb 7261d7a7
HTML
*.bat
*.mat
*.pdf
*.dll
*.exe
*.so*
Thumbs.db
.DS_Store
*.asv
*.wav
*.xlsx
*.docx
*.dll
*.csv
*.h5
*.ita
*.fig
*.png
*.jpeg
*.sofa
*.spk
*.unv
*.stl
svnaccess
*.lib
*.exp
......@@ -11,25 +11,21 @@ vista_use_package( fftw )
vista_use_package( MKL )
#vista_find_package( FFTS )
if( NOT DEFINED ITA_CORE_LIBS_BUILD_STATIC )
set( ITA_CORE_LIBS_BUILD_STATIC OFF CACHE BOOL "Build all ITA core libs in static mode" )
endif( NOT DEFINED ITA_CORE_LIBS_BUILD_STATIC )
if( NOT DEFINED ITA_FFT_WITH_FFTW3 )
set( ITA_FFT_WITH_FFTW3 ON CACHE BOOL "Build with FFTW3 for fast fourier transforms" )
endif( NOT DEFINED ITA_FFT_WITH_FFTW3 )
endif( )
if( NOT DEFINED ITA_FFT_WITH_INTEL_MKL10 )
set( ITA_FFT_WITH_INTEL_MKL10 OFF CACHE BOOL "Build with Intel MKL for fast fourier transforms" )
endif( NOT DEFINED ITA_FFT_WITH_INTEL_MKL10 )
endif( )
if( NOT DEFINED ITA_FFT_WITH_INTEL_TBB )
set( ITA_FFT_WITH_INTEL_TBB OFF CACHE BOOL "Build with Intel TBB for fast fourier transforms" )
endif( NOT DEFINED ITA_FFT_WITH_INTEL_TBB )
endif( )
if( NOT DEFINED ITA_FFT_WITH_FFTS )
set( ITA_FFT_WITH_FFTS OFF CACHE BOOL "Build with FFTS for fast fourier transforms" )
endif( NOT DEFINED ITA_FFT_WITH_FFTS )
endif( )
# includes
......@@ -40,44 +36,43 @@ include_directories( "include" )
set( ITAFFTHeader
include/ITAFFT.h
include/ITAFFTDefinitions.h
include/ITAFFTUtils.h
)
set( ITAFFTSources
src/ITAFFT.cpp
src/ITAFFTBackend.h
src/ITAFFTFactory.h
src/ITAFFTRealization.h
src/ITAFFTUtils.cpp
)
if( ITA_FFT_WITH_FFTW3 )
set( ITAFFTSources "${ITAFFTSources}" src/FFTW3Backend.h src/FFTW3Backend.cpp )
add_definitions( -DITAFFT_WITH_FFTW3 )
endif( ITA_FFT_WITH_FFTW3 )
endif( )
if( ITA_FFT_WITH_INTEL_MKL10 )
set( ITAFFTSources "${ITAFFTSources}" src/MKL10Backend.h src/MKL10Backend.cpp )
add_definitions( -DITAFFT_WITH_MKL10 )
endif( ITA_FFT_WITH_INTEL_MKL10 )
endif( )
# compiler settings
if( NOT ITA_CORE_LIBS_BUILD_STATIC )
# compiler settings
if( ITA_VISTA_BUILD_STATIC )
add_definitions( -DVISTABASE_STATIC -DVISTAMATH_STATIC -DVISTAASPECTS_STATIC -DVISTATOOLS_STATIC -DVISTAINTERPROCCOMM_STATIC )
endif( )
if( BUILD_SHARED_LIBS )
add_definitions( -DITA_FFT_EXPORT )
else( NOT ITA_CORE_LIBS_BUILD_STATIC )
add_definitions( -DITA_FFT_STATIC -DITA_BASE_STATIC )
set( BUILD_SHARED_LIBS_TEMP ${BUILD_SHARED_LIBS} )
if( BUILD_SHARED_LIBS )
set( BUILD_SHARED_LIBS OFF )
message( "Ignoring activated BUILD_SHARED_LIBS temporary because static ITA core libs requested" )
endif( BUILD_SHARED_LIBS )
endif( NOT ITA_CORE_LIBS_BUILD_STATIC )
else( )
add_definitions( -DITA_BASE_STATIC -DITA_FFT_STATIC )
endif( )
# linker
add_library( ITAFFT ${ITAFFTHeader} ${ITAFFTSources} )
target_link_libraries( ITAFFT ${VISTA_USE_PACKAGE_LIBRARIES} )
set( BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_TEMP} )
# config
vista_configure_lib( ITAFFT )
......@@ -88,7 +83,9 @@ vista_create_default_info_file( ITAFFT )
set_property( TARGET ITAFFT PROPERTY FOLDER "ITACoreLibs" )
# tests
set( ITAFFT_COMMON_BUILD TRUE )
add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )
if( ITA_CORE_LIBS_WITH_TESTS )
set( ITAFFT_COMMON_BUILD TRUE )
add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )
endif( )
Copyright 2015-2016 Institute of Technical Acoustics, RWTH Aachen University. Any usage and distribution is prohibited, unless explicitly granted by the authors.
\ No newline at end of file
Copyright 2015-2017 Institute of Technical Acoustics, RWTH Aachen University. Any usage and distribution is prohibited, unless explicitly granted by the authors.
\ No newline at end of file
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2016
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
......@@ -15,7 +15,6 @@
* ----------------------------------------------------------------
*
*/
// $Id: ITAFFTDefinitions.h 2900 2012-09-17 08:42:42Z stienen $
#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-2016
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
......
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_FFT_UTILS
#define INCLUDE_WATCHER_ITA_FFT_UTILS
#include <ITAFFTDefinitions.h>
#include <ITASampleBuffer.h>
#include <ITASampleFrame.h>
class ITAHDFTSpectrum;
class ITAHDFTSpectra;
namespace ITAFFTUtils
{
//! Convert a single-channel HDFT spectrum into time-domain representation
/**
* \param[in] pFreqDomainSpectrum HDFT spectrum in frequency domain
* \param[out] sfIR Impulse response in time domain
* \param[in] bNormalize Normalize time data
*/
ITA_FFT_API void Convert( const ITAHDFTSpectrum* pFreqDomainSpectrum, ITASampleBuffer& sfIR);
//! Convert a multi-channel HDFT spectrum into time-domain representation
/**
* \param[in] pFreqDomainSpectra HDFT spectrum in frequency domain
* \param[out] sfIR Impulse response in time domain
* \param[in] bNormalize Normalize time data
*/
ITA_FFT_API void Convert( const ITAHDFTSpectra* pFreqDomainSpectra, ITASampleFrame& sfIR );
//! Export a single-channel HDFT spectrum as a WAV file
/**
* \param[in] pFreqDomainSpectrum HDFT spectra in frequency domain
* \param[in] sFilePath File path with or without wav extension
* \param[in] bNormalize Normalize time data
*/
ITA_FFT_API void Export( const ITAHDFTSpectrum* pFreqDomainSpectrum, const std::string& sFilePath, bool bNormalize = false );
//! Export a multi-channel HDFT spectrum as a WAV file
/**
* \param[in] pFreqDomainSpectra HDFT spectrum in frequency domain
* \param[in] sFilePath File path with or without wav extension
* \param[in] bNormalize Normalize time data
*/
ITA_FFT_API void Export( const ITAHDFTSpectra* pFreqDomainSpectra, const std::string& sFilePath, bool bNormalize = false );
};
#endif // INCLUDE_WATCHER_ITA_FFT_UTILS
#include <ITAFFTUtils.h>
#include <ITAHDFTSpectra.h>
#include <ITAHDFTSpectrum.h>
#include <ITAAudiofileWriter.h>
#include <ITAFileSystemUtils.h>
#include <ITAFFT.h>
ITA_FFT_API void ITAFFTUtils::Convert( const ITAHDFTSpectrum* pSpectrum, ITASampleBuffer& sbIR )
{
sbIR.Init( pSpectrum->getDFTSize() - 1, true );
ITASampleBuffer sbSpectrum( pSpectrum->getDFTSize(), true ); // local copy
ITAFFT ifft( ITAFFT::IFFT_C2R, sbIR.length(), sbSpectrum.GetData(), sbIR.GetData() );
// Make local copy of input (will be destroyed by in-place FFT)
sbSpectrum.write( pSpectrum->data(), sbSpectrum.length() );
float* fIn = sbSpectrum.GetData();
float* fOut = sbIR.GetData();
ifft.execute( fIn, fOut );
// Normalize after IFFT
sbIR.div_scalar( float( sbIR.length() ) );
return;
}
ITA_FFT_API void ITAFFTUtils::Convert( const ITAHDFTSpectra* pSpectra, ITASampleFrame& sfIR )
{
sfIR.Init( pSpectra->GetNumChannels(), pSpectra->GetDFTSize() - 1, true );
ITASampleBuffer sbSourceData( pSpectra->GetDFTSize(), true ); // local copy
ITAFFT ifft( ITAFFT::IFFT_C2R, sfIR.GetLength(), sbSourceData.GetData(), sfIR[ 0 ].GetData() );
for( int i = 0; i < pSpectra->GetNumChannels(); i++ )
{
// Make local copy of input (will be destroyed by in-place FFT)
sbSourceData.write( ( *pSpectra )[ i ]->data(), sbSourceData.GetLength() );
float* fIn = sbSourceData.GetData();
float* fOut = sfIR[ i ].GetData();
ifft.execute( fIn, fOut );
}
// Normalize after IFFT
sfIR.div_scalar( float( sfIR.length() ) );
return;
}
ITA_FFT_API void ITAFFTUtils::Export( const ITAHDFTSpectrum* pSpectrum, const std::string& sFilePath, bool bNormalize /*= false */ )
{
std::string sFilePathComplete = sFilePath;
if( getFilenameSuffix( sFilePath ).empty() )
sFilePathComplete += ".wav";
std::string sFilePathFinal = correctPath( sFilePathComplete );
ITASampleBuffer sbIR;
ITAFFTUtils::Convert( pSpectrum, sbIR );
if( bNormalize )
sbIR.Normalize();
writeAudiofile( sFilePathFinal, &sbIR, pSpectrum->getSamplerate(), ITAQuantization::ITA_FLOAT );
return;
}
ITA_FFT_API void ITAFFTUtils::Export( const ITAHDFTSpectra* pSpectra, const std::string& sFilePath, bool bNormalize /*= false */ )
{
std::string sFilePathComplete = sFilePath;
if( getFilenameSuffix( sFilePath ).empty() )
sFilePathComplete += ".wav";
std::string sFilePathFinal = correctPath( sFilePathComplete );
ITASampleFrame sfIR;
ITAFFTUtils::Convert( pSpectra, sfIR );
if( bNormalize )
sfIR.normalize();
const double dSampleRate = pSpectra->GetSampleRate();
writeAudiofile( sFilePathFinal, &sfIR, dSampleRate, ITAQuantization::ITA_FLOAT );
return;
}
cmake_minimum_required( VERSION 2.8 )
if( NOT ITAFFT_COMMON_BUILD )
project( ITAFFTTest )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
endif()
project( ITAFFTTest )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( ITAFFT REQUIRED FIND_DEPENDENCIES )
if( ITA_CORE_LIBS_BUILD_STATIC AND DEFINED ITA_CORE_LIBS_BUILD_STATIC )
if( ITA_CORE_LIBS_BUILD_STATIC )
add_definitions( -DITA_BASE_STATIC -DITA_FFT_STATIC )
endif( ITA_CORE_LIBS_BUILD_STATIC AND DEFINED ITA_CORE_LIBS_BUILD_STATIC )
endif( )
add_executable( ITAFFTTest test.cpp )
target_link_libraries( ITAFFTTest ${VISTA_USE_PACKAGE_LIBRARIES} )
......
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