Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / openmax_dl / dl / sp / src / arm / arm64 / armSP_FFT_CToC_FC32_Radix2_ls_s.S
1 //
2 //  Copyright (c) 2013 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 //  This is a modification of armSP_FFT_CToC_SC32_Radix2_ls_unsafe_s.S
11 //  to support float instead of SC32.
12 //
13
14 //
15 // Description:
16 // Compute the last stage of a Radix 2 DIT in-order out-of-place FFT
17 // stage for a N point complex signal.
18 //
19 //
20
21
22 // Include standard headers
23
24 #include "dl/api/arm/arm64COMM_s.h"
25 #include "dl/api/arm/omxtypes_s.h"
26
27
28 // Import symbols required from other files
29 // (For example tables)
30
31
32
33
34 // Set debugging level
35 //DEBUG_ON    SETL {TRUE}
36
37
38 // Guarding implementation by the processor name
39
40
41 //Input Registers
42
43 #define pSrc            x0
44 #define pDst            x1
45 #define pTwiddle        x2
46 #define pSubFFTNum      x3
47 #define pSubFFTSize     x4      
48
49
50 //Output Registers
51
52
53 //Local Scratch Registers
54
55
56 #define subFFTNum       x5
57 #define subFFTSize      x6
58 #define outPointStep    x8
59 #define grpCount        x9
60 #define dstStep         x10
61
62 // Neon Registers
63
64 #define dWr     v0.2s
65 #define dWi     v1.2s
66 #define dXr0    v2.2s
67 #define dXi0    v3.2s
68 #define dXr1    v4.2s
69 #define dXi1    v5.2s
70 #define dYr0    v6.2s
71 #define dYi0    v7.2s
72 #define dYr1    v8.2s
73 #define dYi1    v9.2s
74 #define qT0     v10.2s
75 #define qT1     v12.2s
76
77         .macro FFTSTAGE scaled, inverse, name
78
79         // Move parameters into our work registers
80         ldr     subFFTSize, [pSubFFTSize]
81
82         lsl     outPointStep, subFFTSize, #3
83
84         // Update grpCount and grpSize rightaway
85
86         MOV     subFFTNum,#1                          //after the last stage
87         LSL     grpCount,subFFTSize,#1
88
89         // update subFFTSize for the next stage
90         MOV     subFFTSize,grpCount
91
92         rsb     dstStep,outPointStep,#16
93
94         // Loop on 2 grps at a time for the last stage
95
96 radix2lsGrpLoop\name :
97         // dWr = [pTwiddle[0].Re, pTwiddle[1].Re]
98         // dWi = [pTwiddle[0].Im, pTwiddle[1].Im]
99         ld2     {dWr,dWi},[pTwiddle], #16
100
101         // dXr0 = [pSrc[0].Re, pSrc[2].Re]
102         // dXi0 = [pSrc[0].Im, pSrc[2].Im]
103         // dXr1 = [pSrc[1].Re, pSrc[3].Re]
104         // dXi1 = [pSrc[1].Im, pSrc[3].Im]
105         ld4     {dXr0,dXi0,dXr1,dXi1}, [pSrc], #32
106
107         SUBS    grpCount,grpCount,#4                  // grpCount is multiplied by 2
108
109         .ifeqs  "\inverse", "TRUE"
110             fmul   qT0,dWr,dXr1
111             fmla   qT0,dWi,dXi1                       // real part
112             fmul   qT1,dWr,dXi1
113             fmls   qT1,dWi,dXr1                       // imag part
114
115         .else
116
117             fmul   qT0,dWr,dXr1
118             fmls   qT0,dWi,dXi1                       // real part
119             fmul   qT1,dWr,dXi1
120             fmla   qT1,dWi,dXr1                       // imag part
121
122         .endif
123
124         fsub    dYr0,dXr0,qT0
125         fsub    dYi0,dXi0,qT1
126         fadd    dYr1,dXr0,qT0
127         fadd    dYi1,dXi0,qT1
128
129         st2     {dYr0,dYi0},[pDst],outPointStep
130         st2     {dYr1,dYi1},[pDst],dstStep            // dstStep =  step = -outPointStep + 16
131
132         BGT     radix2lsGrpLoop\name
133
134
135         .endm
136
137
138
139         M_START armSP_FFTFwd_CToC_FC32_Radix2_ls_OutOfPlace,,d12
140         FFTSTAGE "FALSE","FALSE",fwd
141         M_END
142
143
144
145         M_START armSP_FFTInv_CToC_FC32_Radix2_ls_OutOfPlace,,d12
146         FFTSTAGE "FALSE","TRUE",inv
147         M_END
148
149         .end