199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//
299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//
499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//  Use of this source code is governed by a BSD-style license
599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//  that can be found in the LICENSE file in the root of the source
699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//  tree. An additional intellectual property rights grant can be found
799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//  in the file PATENTS.  All contributing project authors may
899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//  be found in the AUTHORS file in the root of the source tree.
999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//
1099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//  This file was originally licensed as follows. It has been
1199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//  relicensed with permission from the copyright holders.
1299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
1399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//
1499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//
1599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// File Name:  armSP_FFT_CToC_SC32_Radix2_fs_unsafe_s.s
1699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// OpenMAX DL: v1.0.2
1799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// Last Modified Revision:   5995
1899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// Last Modified Date:       Fri, 08 Jun 2007
1999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//
2099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
2199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//
2299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//
2399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//
2499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// Description:
2599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// Compute the first stage of a Radix 2 DIT in-order out-of-place FFT
2699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// stage for a N point complex signal.
2799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//
2899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
2999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
3099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// Include standard headers
3199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
32bdf981cb383b7ec472ee86d2fedb53937285f894rtoy@google.com#include "dl/api/arm/armCOMM_s.h"
33bdf981cb383b7ec472ee86d2fedb53937285f894rtoy@google.com#include "dl/api/arm/omxtypes_s.h"
3499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
3599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
3699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// Import symbols required from other files
3799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// (For example tables)
3899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
3999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
4099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
4199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
4299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// Set debugging level
4399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//DEBUG_ON    SETL {TRUE}
4499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
4599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
4699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
4799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// Guarding implementation by the processor name
4899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
4999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
5099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
5199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// Guarding implementation by the processor name
5299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
5399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
5499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//Input Registers
5599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
5699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define pSrc		r0
5799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define pDst		r2
5899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define pTwiddle	r1
5999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define pPingPongBuf	r5
6099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define subFFTNum	r6
6199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define subFFTSize	r7
6299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
6399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
6499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//Output Registers
6599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
6699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
6799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@//Local Scratch Registers
6899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
6999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define pointStep	r3
7099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define outPointStep	r3
7199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define grpSize		r4
7299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define setCount	r4
7399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define step		r8
7499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define dstStep		r8
7599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
7699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com@// Neon Registers
7799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
7899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define dX0	D0.S32
7999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define dX1	D1.S32
8099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define dY0	D2.S32
8199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define dY1	D3.S32
8299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
8399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
845d8507771824df2b96d9c6f2fd55a47fcfd9dec9rtoy@google.com        .macro FFTSTAGE scaled, inverse, name
8599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
8699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        @// Define stack arguments
8799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
8899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
8999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        @// update subFFTSize and subFFTNum into RN6 and RN7 for the next stage
9099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
9199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
9299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        MOV        subFFTSize,#2
9399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        LSR        grpSize,subFFTNum,#1
9499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        MOV        subFFTNum,grpSize
9599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
9699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
9799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        @// pT0+1 increments pT0 by 8 bytes
9899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        @// pT0+pointStep = increment of 8*pointStep bytes = 4*grpSize bytes
9999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        @// Note: outPointStep = pointStep for firststage
10099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        @// Note: setCount = grpSize/2 (reuse the updated grpSize for setCount)
10199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
10299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        MOV        pointStep,grpSize,LSL #3
10399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        RSB        step,pointStep,#8
10499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
10599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
10699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        @// Loop on the sets for grp zero
10799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
10899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.comgrpZeroSetLoop\name :
10999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
11099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        VLD1    dX0,[pSrc],pointStep
11199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        VLD1    dX1,[pSrc],step                   @// step = -pointStep + 8
11299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        SUBS    setCount,setCount,#1              @// decrement the loop counter
11399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
11499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        .ifeqs "\scaled", "TRUE"
11599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
11699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com            VHADD    dY0,dX0,dX1
11799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com            VHSUB    dY1,dX0,dX1
11899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
1195d8507771824df2b96d9c6f2fd55a47fcfd9dec9rtoy@google.com        .else
12099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
12199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com            VADD    dY0,dX0,dX1
12299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com            VSUB    dY1,dX0,dX1
12399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
12499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
1255d8507771824df2b96d9c6f2fd55a47fcfd9dec9rtoy@google.com        .endif
12699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
12799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        VST1    dY0,[pDst],outPointStep
12899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        VST1    dY1,[pDst],dstStep                  @// dstStep =  step = -pointStep + 8
12999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
13099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        BGT     grpZeroSetLoop\name
13199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
13299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
13399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        @// reset pSrc to pDst for the next stage
13499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        SUB     pSrc,pDst,pointStep                     @// pDst -= 2*grpSize
13599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        MOV     pDst,pPingPongBuf
13699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
13799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        .endm
13899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
13999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
14099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
14199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        M_START armSP_FFTFwd_CToC_SC32_Radix2_fs_OutOfPlace_unsafe,r4
14299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        FFTSTAGE "FALSE","FALSE",fwd
14399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        M_END
14499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
14599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
14699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
14799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        M_START armSP_FFTInv_CToC_SC32_Radix2_fs_OutOfPlace_unsafe,r4
14899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        FFTSTAGE "FALSE","TRUE",inv
14999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        M_END
15099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
15199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
15299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
15399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        M_START armSP_FFTFwd_CToC_SC32_Sfs_Radix2_fs_OutOfPlace_unsafe,r4
15499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        FFTSTAGE "TRUE","FALSE",fwdsfs
15599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        M_END
15699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
15799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
15899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
15999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        M_START armSP_FFTInv_CToC_SC32_Sfs_Radix2_fs_OutOfPlace_unsafe,r4
16099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        FFTSTAGE "TRUE","TRUE",invsfs
16199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com        M_END
16299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com
16399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com	.end
164