Home | History | Annotate | Download | only in arm
      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_C_SC16.c
     17  * OpenMAX DL: v1.0.2
     18  * Last Modified Revision:   9468
     19  * Last Modified Date:       Thu, 03 Jan 2008
     20  *
     21  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
     22  *
     23  *
     24  * Description:
     25  * Compute 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 /**
     35  * Function:  omxSP_FFTGetBufSize_C_SC16   (2.2.4.1.6)
     36  *
     37  * Description:
     38  * These functions compute the size of the specification structure
     39  * required for the length 2^order complex FFT and IFFT functions. The function
     40  * <FFTGetBufSize_C_SC16> is used in conjunction with the 16-bit functions
     41  * <FFTFwd_CToC_SC16_Sfs> and <FFTInv_CToC_SC16_Sfs>.
     42  *
     43  * Input Arguments:
     44  *
     45  *   order - base-2 logarithm of the desired block length; valid in the range
     46  *            [0,12]
     47  *
     48  * Output Arguments:
     49  *
     50  *   pSize - pointer to the number of bytes required for the specification
     51  *            structure
     52  *
     53  * Return Value:
     54  *
     55  *    OMX_Sts_NoErr - no error
     56  *
     57  *
     58  */
     59 
     60 
     61 
     62 OMXResult omxSP_FFTGetBufSize_C_SC16(
     63      OMX_INT order,
     64      OMX_INT *pSize)
     65 {
     66 
     67     OMX_INT     N,twiddleSize;
     68 
     69     /* Check for order zero */
     70     if (order == 0)
     71     {
     72         *pSize = sizeof(ARMsFFTSpec_SC16);
     73         return OMX_Sts_NoErr;
     74     }
     75 
     76 
     77     N = 1 << order;
     78 
     79     /*The max size of the twiddle table needed is 3N/4 for a radix-4 stage*/
     80     twiddleSize = 3*N/4;
     81 
     82     /* 2 pointers to store bitreversed array and twiddle factor array */
     83     *pSize = sizeof(ARMsFFTSpec_SC16)
     84         /* Twiddle factors  */
     85            + sizeof(OMX_SC16) * twiddleSize
     86         /* Ping Pong buffer   */
     87            + sizeof(OMX_SC16) * N
     88            + 62 ;  /* Extra bytes to get 32 byte alignment of ptwiddle and pBuf */
     89 
     90     return OMX_Sts_NoErr;
     91 }
     92 
     93 /*****************************************************************************
     94  *                              END OF FILE
     95  *****************************************************************************/
     96 
     97