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 file was originally licensed as follows. It has been 11 * relicensed with permission from the copyright holders. 12 */ 13 14 /** 15 * 16 * File Name: omxSP_FFTGetBufSize_R_S32.c 17 * OpenMAX DL: v1.0.2 18 * Last Modified Revision: 7777 19 * Last Modified Date: Thu, 27 Sep 2007 20 * 21 * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. 22 * 23 * 24 * Description: 25 * Computes the size of the specification structure required. 26 */ 27 28 #include "dl/api/arm/armOMX.h" 29 #include "dl/api/omxtypes.h" 30 #include "dl/sp/api/armSP.h" 31 #include "dl/sp/api/omxSP.h" 32 33 /** 34 * Function: omxSP_FFTGetBufSize_R_S32 35 * 36 * Description: 37 * Computes the size of the specification structure required for the length 38 * 2^order real FFT and IFFT functions. 39 * 40 * Remarks: 41 * This function is used in conjunction with the 32-bit functions 42 * <FFTFwd_RToCCS_S32_Sfs> and <FFTInv_CCSToR_S32_Sfs>. 43 * 44 * Parameters: 45 * [in] order base-2 logarithm of the length; valid in the range 46 * [0,12]. 47 * [out] pSize pointer to the number of bytes required for the 48 * specification structure. 49 * 50 * Return Value: 51 * Standard omxError result. See enumeration for possible result codes. 52 * 53 */ 54 55 OMXResult omxSP_FFTGetBufSize_R_S32( 56 OMX_INT order, 57 OMX_INT *pSize 58 ) 59 { 60 OMX_INT NBy2,N,twiddleSize; 61 62 63 /* Check for order zero */ 64 if (order == 0) 65 { 66 *pSize = sizeof(ARMsFFTSpec_R_SC32) 67 + sizeof(OMX_S32) * (2); /* Extra size 'N' is used in FFTInv_CCSToR_S32S16_Sfs as a temporary buf */ 68 69 return OMX_Sts_NoErr; 70 } 71 72 NBy2 = 1 << (order - 1); 73 N = NBy2<<1; 74 twiddleSize = 5*N/8; /* 3/4(N/2) + N/4 */ 75 76 /* 2 pointers to store bitreversed array and twiddle factor array */ 77 *pSize = sizeof(ARMsFFTSpec_R_SC32) 78 /* Twiddle factors */ 79 + sizeof(OMX_SC32) * twiddleSize 80 /* Ping Pong buffer for doing the N/2 point complex FFT */ 81 + sizeof(OMX_S32) * (N<<1) /* Extra size 'N' is used in FFTInv_CCSToR_S32_Sfs as a temporary buf */ 82 + 62 ; /* Extra bytes to get 32 byte alignment of ptwiddle and pBuf */ 83 84 85 return OMX_Sts_NoErr; 86 } 87 88 /***************************************************************************** 89 * END OF FILE 90 *****************************************************************************/ 91 92