| OLD | NEW |
| 1 /* Copyright (C) 2001 Erik de Castro Lopo <erikd AT mega-nerd DOT com> */ | 1 /* Copyright (C) 2001 Erik de Castro Lopo <erikd AT mega-nerd DOT com> */ |
| 2 /* | 2 /* |
| 3 Redistribution and use in source and binary forms, with or without | 3 Redistribution and use in source and binary forms, with or without |
| 4 modification, are permitted provided that the following conditions | 4 modification, are permitted provided that the following conditions |
| 5 are met: | 5 are met: |
| 6 | 6 |
| 7 - Redistributions of source code must retain the above copyright | 7 - Redistributions of source code must retain the above copyright |
| 8 notice, this list of conditions and the following disclaimer. | 8 notice, this list of conditions and the following disclaimer. |
| 9 | 9 |
| 10 - Redistributions in binary form must reproduce the above copyright | 10 - Redistributions in binary form must reproduce the above copyright |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 #define _ISOC9X_SOURCE 1 | 84 #define _ISOC9X_SOURCE 1 |
| 85 #define _ISOC99_SOURCE 1 | 85 #define _ISOC99_SOURCE 1 |
| 86 | 86 |
| 87 #define __USE_ISOC9X 1 | 87 #define __USE_ISOC9X 1 |
| 88 #define __USE_ISOC99 1 | 88 #define __USE_ISOC99 1 |
| 89 | 89 |
| 90 #include <math.h> | 90 #include <math.h> |
| 91 #define float2int(x) lrint(x) | 91 #define float2int(x) lrint(x) |
| 92 | 92 |
| 93 #elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN64) || defined (_W
IN64)) | 93 #elif (defined(_MSC_VER) && _MSC_VER >= 1400) && defined (_M_X64) |
| 94 #include <xmmintrin.h> | 94 #include <xmmintrin.h> |
| 95 | 95 |
| 96 __inline long int float2int(float value) | 96 __inline long int float2int(float value) |
| 97 { | 97 { |
| 98 return _mm_cvtss_si32(_mm_load_ss(&value)); | 98 return _mm_cvtss_si32(_mm_load_ss(&value)); |
| 99 } | 99 } |
| 100 #elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN32) || defined (_W
IN32)) | 100 #elif (defined(_MSC_VER) && _MSC_VER >= 1400) && defined (_M_IX86) |
| 101 #include <math.h> | 101 #include <math.h> |
| 102 | 102 |
| 103 /* Win32 doesn't seem to have these functions. | 103 /* Win32 doesn't seem to have these functions. |
| 104 ** Therefore implement OPUS_INLINE versions of these functions here
. | 104 ** Therefore implement OPUS_INLINE versions of these functions here
. |
| 105 */ | 105 */ |
| 106 | 106 |
| 107 __inline long int | 107 __inline long int |
| 108 float2int (float flt) | 108 float2int (float flt) |
| 109 { int intgr; | 109 { int intgr; |
| 110 | 110 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 131 static OPUS_INLINE opus_int16 FLOAT2INT16(float x) | 131 static OPUS_INLINE opus_int16 FLOAT2INT16(float x) |
| 132 { | 132 { |
| 133 x = x*CELT_SIG_SCALE; | 133 x = x*CELT_SIG_SCALE; |
| 134 x = MAX32(x, -32768); | 134 x = MAX32(x, -32768); |
| 135 x = MIN32(x, 32767); | 135 x = MIN32(x, 32767); |
| 136 return (opus_int16)float2int(x); | 136 return (opus_int16)float2int(x); |
| 137 } | 137 } |
| 138 #endif /* DISABLE_FLOAT_API */ | 138 #endif /* DISABLE_FLOAT_API */ |
| 139 | 139 |
| 140 #endif /* FLOAT_CAST_H */ | 140 #endif /* FLOAT_CAST_H */ |
| OLD | NEW |