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 MODULES_AUDIO_PROCESSING_UTILITY_OOURA_FFT_TABLES_NEON_SSE2_H_
12 #define MODULES_AUDIO_PROCESSING_UTILITY_OOURA_FFT_TABLES_NEON_SSE2_H_
13 
14 #include "common_audio/third_party/ooura/fft_size_128/ooura_fft.h"
15 #include "rtc_base/system/arch.h"
16 
17 #ifdef _MSC_VER /* visual c++ */
18 #define ALIGN16_BEG __declspec(align(16))
19 #define ALIGN16_END
20 #else /* gcc or icc */
21 #define ALIGN16_BEG
22 #define ALIGN16_END __attribute__((aligned(16)))
23 #endif
24 
25 namespace webrtc {
26 
27 // These tables used to be computed at run-time. For example, refer to:
28 // https://code.google.com/p/webrtc/source/browse/trunk/webrtc/modules/audio_processing/utility/apm_rdft.c?r=6564
29 // to see the initialization code.
30 #if defined(WEBRTC_ARCH_X86_FAMILY) || defined(WEBRTC_HAS_NEON)
31 // Constants used by SSE2 and NEON but initialized in the C path.
32 const ALIGN16_BEG float ALIGN16_END k_swap_sign[4] = {-1.f, 1.f, -1.f, 1.f};
33 
34 ALIGN16_BEG const float ALIGN16_END rdft_wk1r[32] = {
35     1.000000000f, 1.000000000f, 0.707106769f, 0.707106769f, 0.923879564f,
36     0.923879564f, 0.382683456f, 0.382683456f, 0.980785251f, 0.980785251f,
37     0.555570245f, 0.555570245f, 0.831469595f, 0.831469595f, 0.195090324f,
38     0.195090324f, 0.995184720f, 0.995184720f, 0.634393334f, 0.634393334f,
39     0.881921291f, 0.881921291f, 0.290284663f, 0.290284663f, 0.956940353f,
40     0.956940353f, 0.471396744f, 0.471396744f, 0.773010433f, 0.773010433f,
41     0.098017141f, 0.098017141f,
42 };
43 ALIGN16_BEG const float ALIGN16_END rdft_wk2r[32] = {
44     1.000000000f,  1.000000000f,  -0.000000000f, -0.000000000f, 0.707106769f,
45     0.707106769f,  -0.707106769f, -0.707106769f, 0.923879564f,  0.923879564f,
46     -0.382683456f, -0.382683456f, 0.382683456f,  0.382683456f,  -0.923879564f,
47     -0.923879564f, 0.980785251f,  0.980785251f,  -0.195090324f, -0.195090324f,
48     0.555570245f,  0.555570245f,  -0.831469595f, -0.831469595f, 0.831469595f,
49     0.831469595f,  -0.555570245f, -0.555570245f, 0.195090324f,  0.195090324f,
50     -0.980785251f, -0.980785251f,
51 };
52 ALIGN16_BEG const float ALIGN16_END rdft_wk3r[32] = {
53     1.000000000f,  1.000000000f,  -0.707106769f, -0.707106769f, 0.382683456f,
54     0.382683456f,  -0.923879564f, -0.923879564f, 0.831469536f,  0.831469536f,
55     -0.980785251f, -0.980785251f, -0.195090353f, -0.195090353f, -0.555570245f,
56     -0.555570245f, 0.956940353f,  0.956940353f,  -0.881921172f, -0.881921172f,
57     0.098017156f,  0.098017156f,  -0.773010492f, -0.773010492f, 0.634393334f,
58     0.634393334f,  -0.995184720f, -0.995184720f, -0.471396863f, -0.471396863f,
59     -0.290284693f, -0.290284693f,
60 };
61 ALIGN16_BEG const float ALIGN16_END rdft_wk1i[32] = {
62     -0.000000000f, 0.000000000f,  -0.707106769f, 0.707106769f,  -0.382683456f,
63     0.382683456f,  -0.923879564f, 0.923879564f,  -0.195090324f, 0.195090324f,
64     -0.831469595f, 0.831469595f,  -0.555570245f, 0.555570245f,  -0.980785251f,
65     0.980785251f,  -0.098017141f, 0.098017141f,  -0.773010433f, 0.773010433f,
66     -0.471396744f, 0.471396744f,  -0.956940353f, 0.956940353f,  -0.290284663f,
67     0.290284663f,  -0.881921291f, 0.881921291f,  -0.634393334f, 0.634393334f,
68     -0.995184720f, 0.995184720f,
69 };
70 ALIGN16_BEG const float ALIGN16_END rdft_wk2i[32] = {
71     -0.000000000f, 0.000000000f,  -1.000000000f, 1.000000000f,  -0.707106769f,
72     0.707106769f,  -0.707106769f, 0.707106769f,  -0.382683456f, 0.382683456f,
73     -0.923879564f, 0.923879564f,  -0.923879564f, 0.923879564f,  -0.382683456f,
74     0.382683456f,  -0.195090324f, 0.195090324f,  -0.980785251f, 0.980785251f,
75     -0.831469595f, 0.831469595f,  -0.555570245f, 0.555570245f,  -0.555570245f,
76     0.555570245f,  -0.831469595f, 0.831469595f,  -0.980785251f, 0.980785251f,
77     -0.195090324f, 0.195090324f,
78 };
79 ALIGN16_BEG const float ALIGN16_END rdft_wk3i[32] = {
80     -0.000000000f, 0.000000000f,  -0.707106769f, 0.707106769f,  -0.923879564f,
81     0.923879564f,  0.382683456f,  -0.382683456f, -0.555570245f, 0.555570245f,
82     -0.195090353f, 0.195090353f,  -0.980785251f, 0.980785251f,  0.831469536f,
83     -0.831469536f, -0.290284693f, 0.290284693f,  -0.471396863f, 0.471396863f,
84     -0.995184720f, 0.995184720f,  0.634393334f,  -0.634393334f, -0.773010492f,
85     0.773010492f,  0.098017156f,  -0.098017156f, -0.881921172f, 0.881921172f,
86     0.956940353f,  -0.956940353f,
87 };
88 ALIGN16_BEG const float ALIGN16_END cftmdl_wk1r[4] = {
89     0.707106769f,
90     0.707106769f,
91     0.707106769f,
92     -0.707106769f,
93 };
94 #endif
95 
96 }  // namespace webrtc
97 
98 #endif  // MODULES_AUDIO_PROCESSING_UTILITY_OOURA_FFT_TABLES_NEON_SSE2_H_
99