OLD | NEW |
(Empty) | |
| 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_fs_unsafe_s.s |
| 11 @// to support float instead of SC32. |
| 12 @// |
| 13 |
| 14 @// |
| 15 @// Description: |
| 16 @// Compute an inverse FFT for a complex signal |
| 17 @// |
| 18 @// |
| 19 |
| 20 |
| 21 @// Include standard headers |
| 22 |
| 23 #include "dl/api/armCOMM_s.h" |
| 24 #include "dl/api/omxtypes_s.h" |
| 25 |
| 26 @// Import symbols required from other files |
| 27 @// (For example tables) |
| 28 |
| 29 .extern armSP_FFTInv_CToC_FC32_Radix2_fs_OutOfPlace_unsafe |
| 30 .extern armSP_FFTInv_CToC_FC32_Radix4_fs_OutOfPlace_unsafe |
| 31 .extern armSP_FFTInv_CToC_FC32_Radix8_fs_OutOfPlace_unsafe |
| 32 .extern armSP_FFTInv_CToC_FC32_Radix4_OutOfPlace_unsafe |
| 33 .extern armSP_FFTInv_CToC_FC32_Radix2_OutOfPlace_unsafe |
| 34 |
| 35 @// Set debugging level |
| 36 @//DEBUG_ON SETL {TRUE} |
| 37 |
| 38 |
| 39 |
| 40 @// Guarding implementation by the processor name |
| 41 |
| 42 |
| 43 |
| 44 @// Guarding implementation by the processor name |
| 45 |
| 46 @// Import symbols required from other files |
| 47 @// (For example tables) |
| 48 .extern armSP_FFTInv_CToC_FC32_Radix4_ls_OutOfPlace_unsafe |
| 49 .extern armSP_FFTInv_CToC_FC32_Radix2_ls_OutOfPlace_unsafe |
| 50 |
| 51 |
| 52 @//Input Registers |
| 53 |
| 54 #define pSrc r0 |
| 55 #define pDst r1 |
| 56 #define pFFTSpec r2 |
| 57 |
| 58 |
| 59 @// Output registers |
| 60 #define result r0 |
| 61 |
| 62 @//Local Scratch Registers |
| 63 |
| 64 #define argTwiddle r1 |
| 65 #define argDst r2 |
| 66 #define argScale r4 |
| 67 #define tmpOrder r4 |
| 68 #define pTwiddle r4 |
| 69 #define pOut r5 |
| 70 #define subFFTSize r7 |
| 71 #define subFFTNum r6 |
| 72 #define N r6 |
| 73 #define order r14 |
| 74 #define diff r9 |
| 75 @// Total num of radix stages required to comple the FFT |
| 76 #define count r8 |
| 77 #define x0r r4 |
| 78 #define x0i r5 |
| 79 #define diffMinusOne r2 |
| 80 |
| 81 @// Neon registers |
| 82 |
| 83 #define dX0 D0.F32 |
| 84 #define qX0 Q0.F32 |
| 85 #define sN S0.S32 |
| 86 #define fN S1.F32 |
| 87 @// one must be the same as dScale[0]! |
| 88 #define dScale D4.F32 |
| 89 #define one S8.F32 |
| 90 |
| 91 |
| 92 |
| 93 @// Allocate stack memory required by the function |
| 94 M_ALLOC4 fftSize, 4 |
| 95 |
| 96 @// Write function header |
| 97 M_START omxSP_FFTInv_CToC_FC32_Sfs,r11,d15 |
| 98 |
| 99 @ Structure offsets for the FFTSpec |
| 100 .set ARMsFFTSpec_N, 0 |
| 101 .set ARMsFFTSpec_pBitRev, 4 |
| 102 .set ARMsFFTSpec_pTwiddle, 8 |
| 103 .set ARMsFFTSpec_pBuf, 12 |
| 104 |
| 105 @// Define stack arguments |
| 106 |
| 107 @// Read the size from structure and take log |
| 108 LDR N, [pFFTSpec, #ARMsFFTSpec_N] |
| 109 M_STR N, fftSize |
| 110 |
| 111 @// Read other structure parameters |
| 112 LDR pTwiddle, [pFFTSpec, #ARMsFFTSpec_pTwiddle] |
| 113 LDR pOut, [pFFTSpec, #ARMsFFTSpec_pBuf] |
| 114 |
| 115 CLZ order,N @// N = 2^order |
| 116 RSB order,order,#31 |
| 117 MOV subFFTSize,#1 |
| 118 @//MOV subFFTNum,N |
| 119 |
| 120 CMP order,#3 |
| 121 BGT orderGreaterthan3 @// order > 3 |
| 122 |
| 123 CMP order,#1 |
| 124 BGE orderGreaterthan0 @// order > 0 |
| 125 VLD1 dX0,[pSrc] |
| 126 VST1 dX0,[pDst] |
| 127 MOV pSrc,pDst |
| 128 BLT FFTEnd |
| 129 |
| 130 orderGreaterthan0: |
| 131 @// set the buffers appropriately for various orders |
| 132 CMP order,#2 |
| 133 MOVNE argDst,pDst |
| 134 MOVEQ argDst,pOut |
| 135 @// Pass the first stage destination in RN5 |
| 136 MOVEQ pOut,pDst |
| 137 MOV argTwiddle,pTwiddle |
| 138 BGE orderGreaterthan1 |
| 139 @// order = 1 |
| 140 BLLT armSP_FFTInv_CToC_FC32_Radix2_fs_OutOfPlace_unsafe |
| 141 B FFTEnd |
| 142 |
| 143 orderGreaterthan1: |
| 144 MOV tmpOrder,order @// tmpOrder = RN 4 |
| 145 BL armSP_FFTInv_CToC_FC32_Radix2_fs_OutOfPlace_unsafe |
| 146 CMP tmpOrder,#2 |
| 147 BLGT armSP_FFTInv_CToC_FC32_Radix2_OutOfPlace_unsafe |
| 148 BL armSP_FFTInv_CToC_FC32_Radix2_ls_OutOfPlace_unsafe |
| 149 B FFTEnd |
| 150 |
| 151 |
| 152 orderGreaterthan3: |
| 153 |
| 154 @// Set input args to fft stages |
| 155 TST order, #2 |
| 156 MOVNE argDst,pDst |
| 157 MOVEQ argDst,pOut |
| 158 @// Pass the first stage destination in RN5 |
| 159 MOVEQ pOut,pDst |
| 160 MOV argTwiddle,pTwiddle |
| 161 |
| 162 @//check for even or odd order |
| 163 @// NOTE: The following combination of BL's would work fine even though |
| 164 @// the first BL would corrupt the flags. This is because the end of |
| 165 @// the "grpZeroSetLoop" loop inside |
| 166 @// armSP_FFTInv_CToC_SC32_Radix4_fs_OutOfPlace_unsafe sets the Z flag |
| 167 @// to EQ |
| 168 |
| 169 TST order,#0x00000001 |
| 170 BLEQ armSP_FFTInv_CToC_FC32_Radix4_fs_OutOfPlace_unsafe |
| 171 BLNE armSP_FFTInv_CToC_FC32_Radix8_fs_OutOfPlace_unsafe |
| 172 |
| 173 CMP subFFTNum,#4 |
| 174 BLT FFTEnd |
| 175 |
| 176 |
| 177 unscaledRadix4Loop: |
| 178 BEQ lastStageUnscaledRadix4 |
| 179 BL armSP_FFTInv_CToC_FC32_Radix4_OutOfPlace_unsafe |
| 180 CMP subFFTNum,#4 |
| 181 B unscaledRadix4Loop |
| 182 |
| 183 lastStageUnscaledRadix4: |
| 184 BL armSP_FFTInv_CToC_FC32_Radix4_ls_OutOfPlace_unsafe |
| 185 B FFTEnd |
| 186 |
| 187 FFTEnd: @// Does only the scaling |
| 188 |
| 189 M_LDR N, fftSize |
| 190 |
| 191 VMOV sN,N |
| 192 VCVT fN, sN @ fn = fftSize, as a float |
| 193 VMOV one, 1.0 |
| 194 VDIV one, one, fN @ one = dScale[0] = 1 / fftSize |
| 195 |
| 196 @ Scale data, doing 2 complex values at a time (because N is |
| 197 @ always even). |
| 198 |
| 199 @// N = subFFTSize ; dataptr = pDst ; scale = diff |
| 200 scaleFFTData: |
| 201 VLD1 {qX0},[pSrc :128] @// pSrc contains pDst pointer |
| 202 SUBS subFFTSize,subFFTSize,#2 |
| 203 VMUL qX0, qX0, dScale[0] |
| 204 VST1 {qX0},[pSrc :128]! |
| 205 |
| 206 BGT scaleFFTData |
| 207 End: |
| 208 @// Set return value |
| 209 MOV result, #OMX_Sts_NoErr |
| 210 |
| 211 @// Write function tail |
| 212 M_END |
| 213 |
| 214 .end |
OLD | NEW |