1 /*
2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_UTILITY_OOURA_FFT_TABLES_NEON_SSE2_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_UTILITY_OOURA_FFT_TABLES_NEON_SSE2_H_
13 
14 #include "webrtc/modules/audio_processing/utility/ooura_fft.h"
15 
16 #ifdef _MSC_VER /* visual c++ */
17 #define ALIGN16_BEG __declspec(align(16))
18 #define ALIGN16_END
19 #else /* gcc or icc */
20 #define ALIGN16_BEG
21 #define ALIGN16_END __attribute__((aligned(16)))
22 #endif
23 
24 namespace webrtc {
25 
26 // These tables used to be computed at run-time. For example, refer to:
27 // https://code.google.com/p/webrtc/source/browse/trunk/webrtc/modules/audio_processing/utility/apm_rdft.c?r=6564
28 // to see the initialization code.
29 #if defined(WEBRTC_ARCH_X86_FAMILY) || defined(WEBRTC_HAS_NEON)
30 // Constants used by SSE2 and NEON but initialized in the C path.
31 const ALIGN16_BEG float ALIGN16_END k_swap_sign[4] = {-1.f, 1.f, -1.f, 1.f};
32 
33 ALIGN16_BEG const float ALIGN16_END rdft_wk1r[32] = {
34     1.000000000f, 1.000000000f, 0.707106769f, 0.707106769f, 0.923879564f,
35     0.923879564f, 0.382683456f, 0.382683456f, 0.980785251f, 0.980785251f,
36     0.555570245f, 0.555570245f, 0.831469595f, 0.831469595f, 0.195090324f,
37     0.195090324f, 0.995184720f, 0.995184720f, 0.634393334f, 0.634393334f,
38     0.881921291f, 0.881921291f, 0.290284663f, 0.290284663f, 0.956940353f,
39     0.956940353f, 0.471396744f, 0.471396744f, 0.773010433f, 0.773010433f,
40     0.098017141f, 0.098017141f,
41 };
42 ALIGN16_BEG const float ALIGN16_END rdft_wk2r[32] = {
43     1.000000000f,  1.000000000f,  -0.000000000f, -0.000000000f, 0.707106769f,
44     0.707106769f,  -0.707106769f, -0.707106769f, 0.923879564f,  0.923879564f,
45     -0.382683456f, -0.382683456f, 0.382683456f,  0.382683456f,  -0.923879564f,
46     -0.923879564f, 0.980785251f,  0.980785251f,  -0.195090324f, -0.195090324f,
47     0.555570245f,  0.555570245f,  -0.831469595f, -0.831469595f, 0.831469595f,
48     0.831469595f,  -0.555570245f, -0.555570245f, 0.195090324f,  0.195090324f,
49     -0.980785251f, -0.980785251f,
50 };
51 ALIGN16_BEG const float ALIGN16_END rdft_wk3r[32] = {
52     1.000000000f,  1.000000000f,  -0.707106769f, -0.707106769f, 0.382683456f,
53     0.382683456f,  -0.923879564f, -0.923879564f, 0.831469536f,  0.831469536f,
54     -0.980785251f, -0.980785251f, -0.195090353f, -0.195090353f, -0.555570245f,
55     -0.555570245f, 0.956940353f,  0.956940353f,  -0.881921172f, -0.881921172f,
56     0.098017156f,  0.098017156f,  -0.773010492f, -0.773010492f, 0.634393334f,
57     0.634393334f,  -0.995184720f, -0.995184720f, -0.471396863f, -0.471396863f,
58     -0.290284693f, -0.290284693f,
59 };
60 ALIGN16_BEG const float ALIGN16_END rdft_wk1i[32] = {
61     -0.000000000f, 0.000000000f,  -0.707106769f, 0.707106769f,  -0.382683456f,
62     0.382683456f,  -0.923879564f, 0.923879564f,  -0.195090324f, 0.195090324f,
63     -0.831469595f, 0.831469595f,  -0.555570245f, 0.555570245f,  -0.980785251f,
64     0.980785251f,  -0.098017141f, 0.098017141f,  -0.773010433f, 0.773010433f,
65     -0.471396744f, 0.471396744f,  -0.956940353f, 0.956940353f,  -0.290284663f,
66     0.290284663f,  -0.881921291f, 0.881921291f,  -0.634393334f, 0.634393334f,
67     -0.995184720f, 0.995184720f,
68 };
69 ALIGN16_BEG const float ALIGN16_END rdft_wk2i[32] = {
70     -0.000000000f, 0.000000000f,  -1.000000000f, 1.000000000f,  -0.707106769f,
71     0.707106769f,  -0.707106769f, 0.707106769f,  -0.382683456f, 0.382683456f,
72     -0.923879564f, 0.923879564f,  -0.923879564f, 0.923879564f,  -0.382683456f,
73     0.382683456f,  -0.195090324f, 0.195090324f,  -0.980785251f, 0.980785251f,
74     -0.831469595f, 0.831469595f,  -0.555570245f, 0.555570245f,  -0.555570245f,
75     0.555570245f,  -0.831469595f, 0.831469595f,  -0.980785251f, 0.980785251f,
76     -0.195090324f, 0.195090324f,
77 };
78 ALIGN16_BEG const float ALIGN16_END rdft_wk3i[32] = {
79     -0.000000000f, 0.000000000f,  -0.707106769f, 0.707106769f,  -0.923879564f,
80     0.923879564f,  0.382683456f,  -0.382683456f, -0.555570245f, 0.555570245f,
81     -0.195090353f, 0.195090353f,  -0.980785251f, 0.980785251f,  0.831469536f,
82     -0.831469536f, -0.290284693f, 0.290284693f,  -0.471396863f, 0.471396863f,
83     -0.995184720f, 0.995184720f,  0.634393334f,  -0.634393334f, -0.773010492f,
84     0.773010492f,  0.098017156f,  -0.098017156f, -0.881921172f, 0.881921172f,
85     0.956940353f,  -0.956940353f,
86 };
87 ALIGN16_BEG const float ALIGN16_END cftmdl_wk1r[4] = {
88     0.707106769f, 0.707106769f, 0.707106769f, -0.707106769f,
89 };
90 #endif
91 
92 }  // namespace webrtc
93 
94 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_UTILITY_OOURA_FFT_TABLES_NEON_SSE2_H_
95