diff options
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/float_cast.h')
-rw-r--r-- | lib/rbcodec/codecs/libopus/celt/float_cast.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/float_cast.h b/lib/rbcodec/codecs/libopus/celt/float_cast.h index ede6574860..889dae965f 100644 --- a/lib/rbcodec/codecs/libopus/celt/float_cast.h +++ b/lib/rbcodec/codecs/libopus/celt/float_cast.h | |||
@@ -61,7 +61,13 @@ | |||
61 | ** the config.h file. | 61 | ** the config.h file. |
62 | */ | 62 | */ |
63 | 63 | ||
64 | #if (HAVE_LRINTF) | 64 | /* With GCC, when SSE is available, the fastest conversion is cvtss2si. */ |
65 | #if defined(__GNUC__) && defined(__SSE__) | ||
66 | |||
67 | #include <xmmintrin.h> | ||
68 | static OPUS_INLINE opus_int32 float2int(float x) {return _mm_cvt_ss2si(_mm_set_ss(x));} | ||
69 | |||
70 | #elif defined(HAVE_LRINTF) | ||
65 | 71 | ||
66 | /* These defines enable functionality introduced with the 1999 ISO C | 72 | /* These defines enable functionality introduced with the 1999 ISO C |
67 | ** standard. They must be defined before the inclusion of math.h to | 73 | ** standard. They must be defined before the inclusion of math.h to |
@@ -90,21 +96,21 @@ | |||
90 | #include <math.h> | 96 | #include <math.h> |
91 | #define float2int(x) lrint(x) | 97 | #define float2int(x) lrint(x) |
92 | 98 | ||
93 | #elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN64) || defined (_WIN64)) | 99 | #elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1)) |
94 | #include <xmmintrin.h> | 100 | #include <xmmintrin.h> |
95 | 101 | ||
96 | __inline long int float2int(float value) | 102 | static __inline long int float2int(float value) |
97 | { | 103 | { |
98 | return _mm_cvtss_si32(_mm_load_ss(&value)); | 104 | return _mm_cvtss_si32(_mm_load_ss(&value)); |
99 | } | 105 | } |
100 | #elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN32) || defined (_WIN32)) | 106 | #elif (defined(_MSC_VER) && _MSC_VER >= 1400) && defined (_M_IX86) |
101 | #include <math.h> | 107 | #include <math.h> |
102 | 108 | ||
103 | /* Win32 doesn't seem to have these functions. | 109 | /* Win32 doesn't seem to have these functions. |
104 | ** Therefore implement OPUS_INLINE versions of these functions here. | 110 | ** Therefore implement OPUS_INLINE versions of these functions here. |
105 | */ | 111 | */ |
106 | 112 | ||
107 | __inline long int | 113 | static __inline long int |
108 | float2int (float flt) | 114 | float2int (float flt) |
109 | { int intgr; | 115 | { int intgr; |
110 | 116 | ||