summaryrefslogtreecommitdiff
path: root/dl/sp/src/arm/armv7/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S
blob: 68dcde90df6cb58724ab777bc95b56abfef0c556 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
@//
@//  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
@//
@//  Use of this source code is governed by a BSD-style license
@//  that can be found in the LICENSE file in the root of the source
@//  tree. An additional intellectual property rights grant can be found
@//  in the file PATENTS.  All contributing project authors may
@//  be found in the AUTHORS file in the root of the source tree.
@//
@//  This is a modification of armSP_FFT_CToC_SC32_Radix2_fs_unsafe_s.S
@//  to support float instead of SC32.
@//

@//
@// Description:
@// Compute a Radix 2 FFT stage for a N point complex signal
@//
@//


@// Include standard headers

#include "dl/api/arm/armCOMM_s.h"
#include "dl/api/arm/omxtypes_s.h"

@//        M_VARIANTS ARM1136JS

@// Import symbols required from other files
@// (For example tables)




@// Set debugging level
@//DEBUG_ON    SETL {TRUE}



@// Guarding implementation by the processor name

@//    IF  ARM1136JS

@//Input Registers

#define pSrc            r0
#define pDst            r2
#define pTwiddle        r1
#define pPingPongBuf    r5
#define subFFTNum       r6
#define subFFTSize      r7


@//Output Registers


@//Local Scratch Registers

#define pDstBuf         r3                   /*@// Temporarily hold pingpong buffer ptr*/
#define grpSize         r14
#define outPointStep    r12
#define setCount        r14
#define pointStep       r12

@// Real and Imaginary parts
#define x0r s0
#define x0i s1
#define x1r s2
#define x1i s3
#define y1r s4
#define y1i s5
#define y0r s6
#define y0i s7



        .macro FFTSTAGE scaled, inverse, name

        @// Update grpCount and grpSize rightaway inorder to reuse pGrpCount 
	@// and pGrpSize regs

        mov     subFFTSize, #2
        lsr     grpSize, subFFTNum, #1
        mov     subFFTNum, grpSize

        @// pT0+1 increments pT0 by 8 bytes
        @// pT0+pointStep = increment of 8*pointStep bytes = 4*grpSize bytes
        @// Note: outPointStep = pointStep for firststage
        @// Note: setCount = grpSize/2 (reuse the updated grpSize for setCount)
        MOV     pointStep,grpSize,LSL #3



        @// Loop on the sets for grp zero

grpZeroSetLoop\name:

        add      pSrc, pSrc, pointStep
        @// {x1r,x1i} = [pSrc, pointStep]
        vldm.f32 pSrc, {x1r, x1i}
        sub      pSrc, pSrc, pointStep
        vldm.f32 pSrc!, {x0r, x0i}

        SUBS    setCount,setCount,#1            @// decrement the loop counter



        vsub.f32     y1r,x0r,x1r
        vsub.f32     y1i,x0i,x1i

        vadd.f32     y0r,x0r,x1r
        vadd.f32     y0i,x0i,x1i

        add     pDst, pDst, outPointStep
        @// {y1r,y1i} -> [pDst, outPointStep]
        vstm    pDst, {y1r, y1i}
        sub     pDst, pDst, outPointStep
        vstm    pDst!, {y0r, y0i}

        BGT     grpZeroSetLoop\name


        @// reset pSrc to pDst for the next stage
        SUB     pSrc,pDst,pointStep             @// pDst -= 2*grpSize
        mov     pDst, pPingPongBuf

        .endm


        M_START armSP_FFTFwd_CToC_FC32_Radix2_fs_OutOfPlace_unsafe_vfp,r4
        FFTSTAGE "FALSE","FALSE",FWD
        M_END

        M_START armSP_FFTInv_CToC_FC32_Radix2_fs_OutOfPlace_unsafe_vfp,r4
        FFTSTAGE "FALSE","TRUE",INV
        M_END


@/    ENDIF                                                           @//ARM1136JS


@// Guarding implementation by the processor name



    .end