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