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

Merge branch 'master' of https://git.rwth-aachen.de/ita/ITABase

parents cf72a9c1 40cb5a3b
......@@ -21,7 +21,7 @@ endif ()
if( NOT DEFINED ITA_BASE_WITH_FASTMATH_IPP )
set( ITA_BASE_WITH_FASTMATH_IPP OFF CACHE BOOL "Build with IPP implementation of fast math ops" )
set( ITA_BASE_WITH_FASTMATH_IPP OFF CACHE BOOL "Build with IPP implementation of fast math ops (requires license for redistribution)" )
endif( )
if( NOT DEFINED ITA_BASE_WITH_FASTMATH_ASSEMBLER )
......@@ -214,6 +214,9 @@ endif( )
if( ITA_VISTA_BUILD_STATIC )
add_definitions( -DVISTABASE_STATIC -DVISTAMATH_STATIC -DVISTAASPECTS_STATIC -DVISTATOOLS_STATIC -DVISTAINTERPROCCOMM_STATIC )
if( WIN32 )
list( APPEND VISTA_USE_PACKAGE_LIBRARIES Ws2_32 )
endif( )
endif( )
if( NOT WIN32 )
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......@@ -35,6 +35,8 @@ struct ITA_BASE_API ITAAudiofileProperties
iLength = -1;
};
inline ~ITAAudiofileProperties() {};
ITAQuantization eQuantization;
ITADomain eDomain;
int iChannels;
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......@@ -116,7 +116,7 @@ ITA_BASE_API void INIFileRequireNonemptyKey(const std::string& sINIFilename,
* | Diese Funktionen lsen Ausnahmen aus falls: |
* | |
* | - die INI-Datei nicht existiert |
* | - der Wert nicht als gewnschter Datentyp interpretierbar ist. | |
* | - der Wert nicht als gewnschter Datentyp interpretierbar ist. |
* | |
* +----------------------------------------------------------------------------------------------+ */
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......@@ -45,6 +45,7 @@ ITA_BASE_API bool isPow2( unsigned int x );
ITA_BASE_API unsigned int nextPow2( unsigned int x );
// Rundung auf Compilern definieren die dies nicht standardmäßig mitliefern
// not so nice!! consider namespacing this very typical function names
#ifndef HAVE_ROUND
ITA_BASE_API inline double round( double x )
......@@ -288,6 +289,9 @@ ITA_BASE_API float anglef_proj_0_360_DEG( const float alpha );
*/
ITA_BASE_API float anglef_proj_N180_180_DEG( const float alpha );
//! Project an angle into interval of -90 and 90 degree
ITA_BASE_API float anglef_proj_N90_90_DEG( const float alpha );
//! (Gerichtete) minimale Winkeldifferenz für zwei Winkel [°] im Intervall [0°,360°)
/**
* Für zwei gegebene Winkel 0°<= alpha, beta < 360° im Interval [0°,360°) berechnet
......@@ -324,27 +328,21 @@ ITA_BASE_API float anglef_mindiff_0_360_DEG( const float alpha, const float beta
ITA_BASE_API float anglef_mindiff_abs_0_360_DEG( const float alpha, const float beta );
// Orientierung in Yaw-Pitch-Roll Winkeln in View-Up-Vektor umrechnen (Alle Winkel in Bogenmaß)
ITA_BASE_API void convertYPR2VU( const double yaw, const double pitch, const double roll,
double& vx, double& vy, double& vz,
double& ux, double& uy, double& uz );
//! Orientierung in Yaw-Pitch-Roll Winkeln in View-Up-Vektor umrechnen (Alle Winkel in Bogenmaß)
ITA_BASE_API void convertYPR2VU( const double yaw, const double pitch, const double roll, double& vx, double& vy, double& vz, double& ux, double& uy, double& uz );
// Orientierung in Yaw-Pitch-Roll Winkeln in View-Up-Vektor umrechnen (Alle Winkel in Bogenmaß)
ITA_BASE_API void convertYPR2VU( const float yaw, const float pitch, const float roll,
float& vx, float& vy, float& vz,
float& ux, float& uy, float& uz );
//! Orientierung in Yaw-Pitch-Roll Winkeln in View-Up-Vektor umrechnen (Alle Winkel in Bogenmaß)
ITA_BASE_API void convertYPR2VU( const float yaw, const float pitch, const float roll, float& vx, float& vy, float& vz, float& ux, float& uy, float& uz );
// Orientierung in View-Up-Vektor in Yaw-Pitch-Roll Winkeln umrechnen (Alle Winkel in Bogenmaß)
ITA_BASE_API void convertVU2YPR( const double vx, const double vy, const double vz,
const double ux, const double uy, const double uz,
double& yaw, double& pitch, double& roll );
// Orientierung in View-Up-Vektor in Yaw-Pitch-Roll Winkeln umrechnen (Alle Winkel in Bogenmaß)
ITA_BASE_API void convertVU2YPR( const float vx, const float vy, const float vz,
const float ux, const float uy, const float uz,
float& yaw, float& pitch, float& roll );
//! Orientierung in View-Up-Vektor in Yaw-Pitch-Roll Winkeln umrechnen (Alle Winkel in Bogenmaß)
ITA_BASE_API void convertVU2YPR( const float vx, const float vy, const float vz, const float ux, const float uy, const float uz, float& yaw, float& pitch, float& roll );
// Datenklasse für Fehlerwerte
//! Datenklasse für Fehlerwerte
template< typename T >
class ITA_BASE_API ErrorValues
{
......@@ -363,7 +361,7 @@ public:
{};
};
// Fehler zwischen zwei Vektoren berechnen
//! Fehler zwischen zwei Vektoren berechnen
template< typename Tc, typename Ta, typename Tb >
inline ErrorValues<Tc> computeErrorValues( const Ta* A, const Tb* B, const int size )
{
......@@ -391,13 +389,8 @@ inline ErrorValues<Tc> computeErrorValues( const Ta* A, const Tb* B, const int s
return v;
};
/* +-----------------------+
| |
| Listen und Folgen |
| |
+-----------------------+ */
// Fills a vector with numbers dest = { a+n*s < b | n in N }
//! Fills a vector with numbers dest = { a+n*s < b | n in N }
template< typename T > inline void linspace( std::vector< T >& dest, T a, T b, T s = 1 )
{
dest.clear();
......@@ -425,26 +418,40 @@ template< typename T > inline void linspace( std::vector< T >& dest, T a, T b, T
}
};
// Fills a vector with powers of two in the range a=2^i <= 2^j <= 2^k=b
// (Note a and b must be powers of two, otherwise an exception is thrown)
//! Fills a vector with powers of two in the range a=2^i <= 2^j <= 2^k=b
/**
* @note a and b must be powers of two, otherwise an exception is thrown)
*/
ITA_BASE_API void pow2space( std::vector< int >& dest, const int a, const int b );
//! Returns the elevation angle (0 = frontal direction) in radians from a polar angle theta (0 = above)
ITA_BASE_API double theta2elevation( const double dThetaRAD );
//! returns the polar angle theta (0 = above) in radians from a given elevation angle (0 = frontal direction)
ITA_BASE_API double elevation2theta( const double dElevationRAD );
// Calculates the factorial of an positive integer m
ITA_BASE_API int factorial( const int m );
//Calculates the normalizing constant for SHRealvaluedBasefunctions
//! Calculates the normalizing constant for SHRealvaluedBasefunctions
ITA_BASE_API double SHNormalizeConst( const int m, const int n );
//Calculates the Kronecker delta
//! Calculates the Kronecker delta
ITA_BASE_API int SHKronecker( const int m );
// Returns the index of a basefunction with degree m and order n
//! Returns the linear index of a basefunction with degree m and order n, linear indexing starts with 0
ITA_BASE_API int SHDegreeOrder2Linear( const int m, const int n );
//Calculates the realvalued Basefunctions of SH for e.g. Ambisonics
ITA_BASE_API std::vector<double> SHRealvaluedBasefunctions( const double elevation, const double azimuth, const int maxOrder );
//! Returns degree and order of a basefunctions from a linear index, linear indexing starts with 0
ITA_BASE_API void SHLinear2DegreeOrder( const int iLinear, int &m, int &n );
//! Calculates the remax weightings up to a given order
ITA_BASE_API std::vector< double > HOARemaxWeights( int iTruncationOrder );
//! Calculates the realvalued Basefunctions of SH for e.g. Ambisonics
ITA_BASE_API std::vector< double > SHRealvaluedBasefunctions( const double thetaRAD, const double azimuthRAD, const int maxOrder );
//Calculates the associated legendre polynomials
ITA_BASE_API std::vector<double> SHAssociatedLegendre( const int N, const double mu );
//! Calculates the associated legendre polynomials
ITA_BASE_API std::vector< double > SHAssociatedLegendre( const int N, const double mu );
#endif // INCLUDE_WATCHER_ITA_NUMERIC_UTILS
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -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
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -48,7 +48,7 @@ void CITAAudioSample::LoadWithSampleRateConversion( const std::string& sFilePath
ITASampleFrame sfRaw;
sfRaw.Load( sFilePath, dSampleRate );
Load( sfRaw, GetSampleRate() );
Load( sfRaw, dSampleRate );
}
void CITAAudioSample::Load( const CITAAudioSample& oSource )
......
/*
+-----------------------------------------------------------------------+
| |
| ITAToolkit |
| |
| (c) Copyright Institut f�r technische Akustik (ITA) |
| RWTH Aachen University of Technology |
| |
+-----------------------------------------------------------------------+
| |
| File: ITAConfigUtilsSimpleIniImpl.cpp |
| Purpose: Implementierung einiger INI-Funktionen mittels SimpleINI |
| Authors: Frank Wefers, Jonas Stienen |
| |
+-----------------------------------------------------------------------+
*/
// $Id: ITAConfigUtilsSimpleIniImpl.cpp 2825 2012-07-27 14:26:20Z stienen $
#include "ITAConfigUtils.h"
#ifdef USE_SIMPLEINI
......
#include <ITAHDFTSpectrum.h>
#include <ITAFastMath.h>
#include <stdio.h>
#include <ITAException.h>
#include <ITAStringUtils.h>
#include <cmath>
#include <complex>
#include <math.h>
#include <ITANumericUtils.h>
#include "ITASampleBuffer.h"
#include <ITASampleBuffer.h>
#include <cmath>
#include <cmath>
#include <stdio.h>
ITAHDFTSpectrum::ITAHDFTSpectrum()
: m_iSize( 0 )
......
......@@ -2,13 +2,16 @@
#include <ITAConstants.h>
#include <ITASampleBuffer.h>
#include <ITANumericUtils.h>
#include <cassert>
#include <vector>
// Calculate cubic spline set (second derivatives, ypp) for equidistant data
void spline_cubic_set_equidistant( const int n, const float* y, float* ypp );
void spline_cubic_set_equidistant( const int n, const float* y, std::vector< float >& ypp );
// Evaluate cubic spline interpolation point using only base values (y) and second derivatives (ypp) for equidistant data
float spline_cubic_val_equidistant( const int n, const float fX, const float* y, const float* ypp );
float spline_cubic_val_equidistant( const float fX, const float* y, const std::vector< float >& ypp );
bool CITASampleLinearInterpolation::Interpolate( const ITASampleBuffer* pInput, const int iInputLength, const int iInputStartOffset, ITASampleBuffer* pOutput, const int iOutputLength, const int iOutputOffset /*=0*/ ) const
{
......@@ -98,7 +101,7 @@ bool CITASampleLinearInterpolation::Interpolate( const ITASampleBuffer* pInput,
if( i == iOutputLength - 1 )
{
assert( x_input == ( float ) iInputLength - iInputStartOffset );
assert( std::lroundf( x_input ) == iInputLength - iInputStartOffset );
}
// Linkes/rechtes Nachbarsample in der Eingabe
......@@ -159,8 +162,8 @@ bool CITASampleCubicSplineInterpolation::Interpolate( const ITASampleBuffer* pIn
float* pOutputData = pOutput->data();
// Return value
float* pInputSecondDerivatives = new float[ iInputLength ];
spline_cubic_set_equidistant( iInputLength, pInputData, pInputSecondDerivatives ); // Natural spline interpolation
std::vector< float > vfInputSecondDerivatives( iInputLength );
spline_cubic_set_equidistant( iInputLength, pInputData, vfInputSecondDerivatives ); // Natural spline interpolation
for( int i = 0; i < iOutputLength; i++ )
{
......@@ -171,14 +174,12 @@ bool CITASampleCubicSplineInterpolation::Interpolate( const ITASampleBuffer* pIn
assert( iOutputLength + iDeltaDelay == iInputLength - iInputStartOffset );
// Spline-Segment auswerten
float fYOutput = spline_cubic_val_equidistant( iInputLength, fXInput + iInputStartOffset, pInputData, pInputSecondDerivatives );
float fYOutput = spline_cubic_val_equidistant( fXInput + iInputStartOffset, pInputData, vfInputSecondDerivatives );
pOutputData[ i + iOutputOffset ] = fYOutput;
}
delete[] pInputSecondDerivatives;
return true;
}
......@@ -246,7 +247,7 @@ bool CITASampleWindowedSincInterpolation::Interpolate( const ITASampleBuffer* pI
return true;
}
void spline_cubic_set_equidistant( const int n, const float* y, float* ypp )
void spline_cubic_set_equidistant( const int n, const float* y, std::vector< float >& ypp )
{
assert( n > 2 );
......@@ -287,13 +288,16 @@ void spline_cubic_set_equidistant( const int n, const float* y, float* ypp )
delete[] a;
}
float spline_cubic_val_equidistant( const int n, const float fX, const float* y, const float* ypp )