23 #ifndef AAX_QUANTIZE_H
24 #define AAX_QUANTIZE_H
30 #if ! defined( _TMS320C6X )
32 #if _MSC_VER && !defined(__INTEL_COMPILER)
33 #define _MM_FUNCTIONALITY
36 #elif TARGET_OS_IPHONE
37 #elif defined(__arm__)
40 #include <xmmintrin.h>
41 #include <pmmintrin.h>
42 #include <tmmintrin.h>
51 #if ! defined( _TMS320C6X )
54 static const double cDouble2IntBias = ldexpf(1,52)*1.5;
55 static const double cOneHalfOffset = 0.5;
56 static const int32_t cMantisaWord =
cBigEndian;
59 static const double kExponentMagicDelta = 1.5e-8;
60 static const double kBigMantissaMagicFloat = 6755399441055744.0;
61 static const int64_t kBigMantissaMagicMask = 0x1fffffffffffffLL;
62 static const int64_t kBigMantissaMagicInt = 0x18000000000000LL;
77 #if defined( _TMS320C6X )
79 const int32_t r = _dpint(iVal);
82 iVal += cDouble2IntBias;
83 return (
reinterpret_cast<int32_t*
>(&iVal))[cMantisaWord];
97 #if defined( _TMS320C6X )
99 const int32_t r = _spint(iVal);
128 #if defined( _TMS320C6X )
130 const int32_t r = _dpint(iVal - 0.5);
147 #if defined( _TMS320C6X )
149 const int32_t r = _spint(iVal - 0.5f);
153 r = _mm_cvtt_ss2si( _mm_load_ss(&iVal) );
156 return static_cast<int32_t
>(iVal);
171 #if defined( _TMS320C6X )
172 return (int64_t)(iVal > 0.0 ? iVal + 0.5 : iVal - 0.5);
174 iVal += kExponentMagicDelta;
175 iVal += kBigMantissaMagicFloat;
176 int64_t result = *
reinterpret_cast<int64_t*
>(&iVal);
177 result &= kBigMantissaMagicMask;
178 result -= kBigMantissaMagicInt;
Various utility definitions for AAX.
Signal processing constants.
Definition: AAX_Exception.h:42
int64_t FastRound2Int64(double iVal)
Round to Int64.
Definition: AAX_Quantize.h:169
int32_t FastTrunc2Int32(double iVal)
Float to Int conversion with truncation.
Definition: AAX_Quantize.h:126
int32_t FastRndDbl2Int32(double iVal)
Definition: AAX_Quantize.h:109
int32_t FastRound2Int32(double iVal)
Round to Int32.
Definition: AAX_Quantize.h:75
const int cBigEndian
Definition: AAX_Constants.h:47