#include <cmath>
#include "DataTypes.hxx"
#include "FastRounding.hxx"
Go to the source code of this file.
Namespaces | |
namespace | CLAM |
Defines | |
#define | CLAM_DB_SCALING 20 |
Functions | |
float | CLAM_sin (register float x) |
Efficient versions of common functions. | |
float | CLAM_cos (register float x) |
float | CLAM_atan (register float x) |
float | CLAM_atan2 (float Imag, float Real) |
float | CLAM_exp2 (register float x) |
float | CLAM_log2 (register float x) |
float | CLAM_pow (float x, float y) |
float | CLAM_sqrt (register float x) |
float | CLAM_log (register float x) |
float | CLAM_log10 (register float x) |
float | CLAM_20log10 (register float x) |
float | CLAM_exp (register float x) |
double | round (double _X) |
float | round (float _X) |
float | log2lin (float x) |
Fast "pow" for converting a logarithmic value into linear value ( assumes a log scale factor of 20 ). | |
bool | isPowerOfTwo (CLAM::TUInt32 n) |
Returns true if the given (unsigned) integer n is a power-of-two. | |
CLAM::TUInt32 | nextPowerOfTwo (CLAM::TUInt32 n) |
Returns the closest power-of-two number greater or equal to n for the given (unsigned) integer n. | |
template<class T> | |
T | CLAM::Abs (T value) |
double | CLAM::DB (double linData, int scaling=20) |
double | CLAM::Lin (double logData, int scaling=20) |
template<class T> | |
T | CLAM::CLAM_max (const T &x, const T &y) |
Definition of CLAM_min and CLAM_max. | |
template<class T> | |
T | CLAM::CLAM_min (const T &x, const T &y) |
Variables | |
const float | PI_ = 3.1415926535897932384626433832795028841972 |
const float | ONE_OVER_PI = (0.3183098861837906661338147750939f) |
const float | TWOPI = (6.2831853071795864769252867665590057683943f) |
const float | ONE_OVER_TWOPI = (0.15915494309189535682609381638f) |
const float | PI_2 = (1.5707963267948966192313216916397514420986f) |
const float | TWO_OVER_PI = (0.636619772367581332267629550188f) |
const float | LN2 = (0.6931471805599453094172321214581765680755f) |
const float | ONE_OVER_LN2 = (1.44269504088896333066907387547f) |
const float | LN10 = (2.3025850929940456840179914546843642076011f) |
const float | ONE_OVER_LN10 = (0.43429448190325177635683940025f) |
const float | LN2_OVER_LN10 = LN2*ONE_OVER_LN10 |
const float | TIMES20LN2_OVER_LN10 = 20*LN2_OVER_LN10 |
const long | LONG_OFFSET = 4096L |
const float | FLOAT_OFFSET = 4096.0 |
const float | HUGE_ = 1.0e8 |
const float | ROOT2 = (1.4142135623730950488016887242096980785697f) |
#define CLAM_DB_SCALING 20 |
Definition at line 450 of file CLAM_Math.hxx.
Definition at line 338 of file CLAM_Math.hxx.
References CLAM_log2().
Referenced by CLAM::Linear2LogMagnitude(), CLAM::Spectrum::ToDB(), and CLAM::SpectralPeakArray::TodB().
Definition at line 98 of file CLAM_Math.hxx.
Referenced by CLAM::FFT_ooura::makect(), and CLAM::FFT_ooura::makewt().
Definition at line 132 of file CLAM_Math.hxx.
Referenced by CLAM::ComplexTmpl< T >::Ang(), CLAM::FDCombFilter::Do(), CLAM::PolarTmpl< T >::operator+(), CLAM::PolarTmpl< T >::operator-(), and CLAM::PolarTmpl< T >::operator-=().
Definition at line 73 of file CLAM_Math.hxx.
Referenced by CLAM::FDCombFilter::Do(), CLAM::FFT_ooura::makect(), CLAM::FFT_ooura::makewt(), CLAM::PolarTmpl< T >::operator+(), CLAM::PolarTmpl< T >::operator+=(), CLAM::PolarTmpl< T >::operator-(), CLAM::PolarTmpl< T >::operator-=(), CLAM::PolarTmpl< T >::Real(), CLAM::Spectrum::SetMag(), CLAM::Spectrum::SetPhase(), and CLAM::ComplexTmpl< T >::ToPolar().
Definition at line 192 of file CLAM_Math.hxx.
References LONG_OFFSET.
Referenced by CLAM_exp(), and CLAM_pow().
Definition at line 329 of file CLAM_Math.hxx.
References CLAM_log2().
Referenced by CLAM::Complex2LogMagPhase(), and CLAM::DB().
Definition at line 225 of file CLAM_Math.hxx.
Referenced by CLAM_20log10(), CLAM_log(), CLAM_log10(), and CLAM_pow().
Definition at line 266 of file CLAM_Math.hxx.
References CLAM_exp2(), and CLAM_log2().
Referenced by CLAM::PointTmpl< float, float >::Distance(), CLAM::SpectralEnvelopeExtract::Do(), CLAM::SMSPitchDiscretization::Do(), CLAM::SMSHarmonizer::Do(), CLAM::FDFilterGen::Do(), CLAM::Lin(), CLAM::Log2LinearMagnitude(), CLAM::SpectralAnalysisConfig::SetWindowSize(), and CLAM::SpectralAnalysisConfig::SetZeroPadding().
Efficient versions of common functions.
Definition at line 50 of file CLAM_Math.hxx.
Referenced by CLAM::FDCombFilter::Do(), CLAM::PolarTmpl< T >::Imag(), CLAM::FFT_ooura::makect(), CLAM::FFT_ooura::makewt(), CLAM::PolarTmpl< T >::operator+(), CLAM::PolarTmpl< T >::operator+=(), CLAM::PolarTmpl< T >::operator-(), CLAM::PolarTmpl< T >::operator-=(), CLAM::Spectrum::SetMag(), CLAM::Spectrum::SetPhase(), and CLAM::ComplexTmpl< T >::ToPolar().
Definition at line 275 of file CLAM_Math.hxx.
Referenced by CLAM::Normalization::ComputeScaleFactorFromAvgEnergy(), CLAM::Normalization::ComputeScaleFactorFromDominantEnergy(), CLAM::Normalization::ComputeScaleFactorFromMaxEnergy(), CLAM::FDCombFilter::Do(), CLAM::ComplexTmpl< T >::Mag(), CLAM::StandardDeviationTmpl< abs, CLAM::FrameDescriptors, CLAM::FrameDescriptors >::operator()(), CLAM::RMSTmpl< CLAM::FrameDescriptors >::operator()(), CLAM::PolarTmpl< T >::operator+(), CLAM::PolarTmpl< T >::operator-(), CLAM::PolarTmpl< T >::operator-=(), CLAM::Spectrum::ToDB(), and CLAM::Spectrum::ToLinear().
bool isPowerOfTwo | ( | CLAM::TUInt32 | n | ) | [inline] |
Returns true if the given (unsigned) integer n is a power-of-two.
Will return true for n = 0 and n = 1.
Definition at line 414 of file CLAM_Math.hxx.
Referenced by CLAM::IFFT_ooura::Do(), CLAM::FFT_ooura::Do(), and CLAM::FFT_fftw3::Do().
Fast "pow" for converting a logarithmic value into linear value ( assumes a log scale factor of 20 ).
Warning, float should be TData but includes should then be changed
Definition at line 400 of file CLAM_Math.hxx.
References CLAM_exp().
Referenced by CLAM::Vocoder::Do(), CLAM::SpectralReject::Do(), CLAM::SpectralNotch::Do(), CLAM::SpectralLimiter::Do(), CLAM::SpectralGate::Do(), CLAM::SpectralExciter::Do(), CLAM::SpectralCombTriang::Do(), CLAM::SpectralCombDelta::Do(), CLAM::Peakalizer::Do(), CLAM::Partializer::Do(), CLAM::OscillatingSpectralNotch::Do(), CLAM::NoSpectralTransformation::Do(), CLAM::Deesser::Do(), CLAM::ThreeBandGate::Do(), CLAM::ThreeBandFilter::Do(), CLAM::ThreeBandCompressor::Do(), CLAM::Lin(), CLAM::Spectrum::ToLinear(), and CLAM::SpectralPeakArray::ToLinear().
CLAM::TUInt32 nextPowerOfTwo | ( | CLAM::TUInt32 | n | ) | [inline] |
Returns the closest power-of-two number greater or equal to n for the given (unsigned) integer n.
Will return 0 when n = 0 and 1 when n = 1.
Definition at line 424 of file CLAM_Math.hxx.
Referenced by CLAM::SpectralAnalysisConfig::SetWindowSize(), and CLAM::SpectralAnalysisConfig::SetZeroPadding().
Definition at line 392 of file CLAM_Math.hxx.
double round | ( | double | _X | ) | [inline] |
Definition at line 390 of file CLAM_Math.hxx.
const float FLOAT_OFFSET = 4096.0 |
Definition at line 45 of file CLAM_Math.hxx.
Definition at line 46 of file CLAM_Math.hxx.
Definition at line 40 of file CLAM_Math.hxx.
Definition at line 38 of file CLAM_Math.hxx.
const float LN2_OVER_LN10 = LN2*ONE_OVER_LN10 |
Definition at line 42 of file CLAM_Math.hxx.
const long LONG_OFFSET = 4096L |
const float ONE_OVER_LN10 = (0.43429448190325177635683940025f) |
Definition at line 41 of file CLAM_Math.hxx.
const float ONE_OVER_LN2 = (1.44269504088896333066907387547f) |
Definition at line 39 of file CLAM_Math.hxx.
const float ONE_OVER_PI = (0.3183098861837906661338147750939f) |
Definition at line 33 of file CLAM_Math.hxx.
const float ONE_OVER_TWOPI = (0.15915494309189535682609381638f) |
Definition at line 35 of file CLAM_Math.hxx.
Definition at line 32 of file CLAM_Math.hxx.
Definition at line 36 of file CLAM_Math.hxx.
Definition at line 47 of file CLAM_Math.hxx.
const float TIMES20LN2_OVER_LN10 = 20*LN2_OVER_LN10 |
Definition at line 43 of file CLAM_Math.hxx.
const float TWO_OVER_PI = (0.636619772367581332267629550188f) |
Definition at line 37 of file CLAM_Math.hxx.
Definition at line 34 of file CLAM_Math.hxx.