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 */
11
12#include "dl/api/omxtypes.h"
13#include "dl/sp/api/x86SP.h"
14#include "dl/sp/api/omxSP.h"
15
16/**
17 * Function: omxSP_FFTGetBufSize_R_F32
18 *
19 * Description:
20 * Computes the size of the specification structure required for the length
21 * 2^order real FFT and IFFT functions.
22 *
23 * Remarks:
24 * This function is used in conjunction with the 32-bit functions
25 * <FFTFwd_RToCCS_F32_Sfs> and <FFTInv_CCSToR_F32_Sfs>.
26 *
27 * Parameters:
28 * [in]  order       base-2 logarithm of the length; valid in the range
29 *                    [1,12]. ([1,15] if BIG_FFT_TABLE is defined.)
30 * [out] pSize	   pointer to the number of bytes required for the
31 *			   specification structure.
32 *
33 * Return Value:
34 * Standard omxError result. See enumeration for possible result codes.
35 *
36 */
37
38OMXResult omxSP_FFTGetBufSize_R_F32(OMX_INT order, OMX_INT *pSize) {
39  OMX_INT n_by_2;
40  OMX_INT n;
41
42  if (!pSize || (order < 1) || (order > TWIDDLE_TABLE_ORDER))
43    return OMX_Sts_BadArgErr;
44
45  n_by_2 = 1 << (order - 1);
46  n = n_by_2 << 1;
47
48  *pSize = sizeof(X86FFTSpec_R_FC32) +
49           // Twiddle factors.
50           sizeof(OMX_F32) * (n << 1) +
51           // Ping Pong buffer for doing the n/2 point complex FFT.
52           // pBuf1
53           sizeof(OMX_F32) * n + 4 +
54           // pBuf2
55           sizeof(OMX_F32) * n + 4 +
56           // Extra bytes to get 32 byte alignment of ptwiddle, pBuf1
57           62;
58
59  return OMX_Sts_NoErr;
60}
61