⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 omxsp_fftinit_c_sc32.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
字号:
/** *  * File Name:  omxSP_FFTInit_C_SC32.c * OpenMAX DL: v1.0.2 * Revision:   10586 * Date:       Wednesday, March 5, 2008 *  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. *  *  * Description: * Initializes the specification structures required */#include "omxtypes.h"#include "armOMX.h"#include "omxSP.h"#include "armCOMM.h"#include "armSP.h"#include <math.h>  /** * Function:  omxSP_FFTInit_C_SC32   (2.2.4.1.2) * * Description: * These functions initialize the specification structures required for the  * complex FFT and IFFT functions. Desired block length is specified as an  * input. The function <FFTInit_C_SC32> is used to initialize  * the specification structures for the functions <FFTFwd_CToC_SC32_Sfs> and  * <FFTInv_CToC_SC32_Sfs>. * * Memory for the specification structure *pFFTSpec must be allocated prior  * to calling these functions and should be 8-byte aligned for  * omxSP_FFTInit_C_SC32.  * * The space required for *pFFTSpec, in bytes, can be  * determined using <FFTGetBufSize_C_SC32>.  * * Input Arguments: *    *   order - base-2 logarithm of the desired block length; valid in the range  *            [0,12]  * * Output Arguments: *    *   pFFTSpec - pointer to initialized specification structure  * * Return Value: *     *    OMX_Sts_NoErr -no error  *    OMX_Sts_BadArgErr - bad arguments; returned if one or more of the  *              following is true:  *    -   pFFTSpec is either NULL or violates the 8-byte alignment  *              restrictions  *    -   order < 0 or order > 12  * */OMXResult omxSP_FFTInit_C_SC32(     OMXFFTSpec_C_SC32* pFFTSpec,     OMX_INT order ){    OMX_INT     i;    OMX_FC64    *pTwiddle, *pBuf;    OMX_U16     *pBitRev;    OMX_F64     W;    OMX_INT     Nby2, N;    OMX_U32     Val, BitR;    ARMsFFTSpec_FC64 *pFFTStruct = 0;    /* Input parameter check */     armRetArgErrIf(pFFTSpec == NULL, OMX_Sts_BadArgErr)    armRetArgErrIf(armNot8ByteAligned(pFFTSpec), OMX_Sts_BadArgErr)    armRetArgErrIf(order < 0, OMX_Sts_BadArgErr)    armRetArgErrIf(order > 12, OMX_Sts_BadArgErr)        pFFTStruct = (ARMsFFTSpec_FC64 *) pFFTSpec;    /* if order zero no init is needed */    if (order == 0)    {        pFFTStruct->N = 1;        return OMX_Sts_NoErr;    }    /* Do the initializations */    Nby2 = 1 << (order - 1);    N = Nby2 << 1;        pBitRev = (OMX_U16 *)         (sizeof(ARMsFFTSpec_FC64) + (OMX_S8*) pFFTSpec);    pTwiddle = (OMX_FC64 *)         (sizeof(OMX_U16) * (N/* - 1*/) + (OMX_S8*) pBitRev);    pBuf = (OMX_FC64 *)                (sizeof(OMX_FC64) * (Nby2) + (OMX_S8*) pTwiddle);    /* Bitreversed Index's */    BitR = 0;    pBitRev [0] = 0;    for (i = 1; i < N; i++)    {        for (Val = N >> 1; BitR & Val; Val >>= 1)        {            BitR ^= Val;                }        BitR ^= Val;        pBitRev [i /*- 1*/] = BitR;    }    /*      * Filling Twiddle factors      *     * W = (-2 * PI) / N      * N = 1 << order     * W = -PI >> (order - 1)     */    W = -PI / Nby2;    pTwiddle [0] . Re = 1;/*(OMX_S32)(1 * (1 << 15));*/    pTwiddle [0] . Im = 0;    for (i = 1; i < Nby2; i++)    {        /* store twiddle fac in q15 format */        pTwiddle[i].Re = cos (W * i);        pTwiddle[i].Im = sin (W * i);    }    /* Update the structure */    pFFTStruct->N = N;    pFFTStruct->pTwiddle = pTwiddle;    pFFTStruct->pBitRev = pBitRev;    pFFTStruct->pBuf = pBuf;    return OMX_Sts_NoErr;}/***************************************************************************** *                              END OF FILE *****************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -