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: armSP.h 17 * OpenMAX DL: v1.0.2 18 * Last Modified Revision: 7014 19 * Last Modified Date: Wed, 01 Aug 2007 20 * 21 * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. 22 * 23 * 24 * 25 * File: armSP.h 26 * Brief: Declares API's/Basic Data types used across the OpenMAX Signal Processing domain 27 * 28 */ 29#ifndef _armSP_H_ 30#define _armSP_H_ 31 32#include <stdint.h> 33 34#include "dl/api/omxtypes.h" 35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 40/** FFT Specific declarations */ 41extern OMX_S32 armSP_FFT_S32TwiddleTable[1026]; 42extern OMX_F32 armSP_FFT_F32TwiddleTable[]; 43 44typedef struct ARMsFFTSpec_SC32_Tag 45{ 46 OMX_U32 N; 47 OMX_U16 *pBitRev; 48 OMX_SC32 *pTwiddle; 49 OMX_SC32 *pBuf; 50}ARMsFFTSpec_SC32; 51 52 53typedef struct ARMsFFTSpec_SC16_Tag 54{ 55 OMX_U32 N; 56 OMX_U16 *pBitRev; 57 OMX_SC16 *pTwiddle; 58 OMX_SC16 *pBuf; 59}ARMsFFTSpec_SC16; 60 61typedef struct ARMsFFTSpec_R_SC32_Tag 62{ 63 OMX_U32 N; 64 OMX_U16 *pBitRev; 65 OMX_SC32 *pTwiddle; 66 OMX_S32 *pBuf; 67}ARMsFFTSpec_R_SC32; 68 69typedef struct ARMsFFTSpec_R_SC16_Tag 70{ 71 OMX_U32 N; 72 OMX_U16 *pBitRev; 73 OMX_SC16 *pTwiddle; 74 OMX_S16 *pBuf; 75} ARMsFFTSpec_R_SC16; 76 77typedef struct ARMsFFTSpec_R_FC32_Tag 78{ 79 OMX_U32 N; 80 OMX_U16* pBitRev; 81 OMX_FC32* pTwiddle; 82 OMX_F32* pBuf; 83} ARMsFFTSpec_R_FC32; 84 85typedef struct ARMsFFTSpec_FC32_Tag 86{ 87 OMX_U32 N; 88 OMX_U16* pBitRev; 89 OMX_FC32* pTwiddle; 90 OMX_FC32* pBuf; 91} ARMsFFTSpec_FC32; 92 93/* 94 * Compute log2(x), where x must be a power of 2. 95 */ 96static inline OMX_U32 fastlog2(long x) { 97 OMX_U32 out; 98 asm("clz %0,%1\n\t" 99 "sub %0, %0, #63\n\t" 100 "neg %0, %0\n\t" 101 : "=r"(out) 102 : "r"(x) 103 :); 104 return out; 105} 106 107/* 108 * Validate args. All pointers must be non-NULL; the source and 109 * destination pointers must be aligned on a 32-byte boundary; the 110 * FFT spec must have non-NULL pointers; and the FFT size must be 111 * within range. 112 */ 113static inline int validateParametersFC32(const void* pSrc, 114 const void* pDst, 115 const ARMsFFTSpec_FC32* pFFTSpec) { 116 return pSrc && pDst && pFFTSpec && !(((uintptr_t)pSrc) & 31) && 117 !(((uintptr_t)pDst) & 31) && pFFTSpec->pTwiddle && pFFTSpec->pBuf && 118 (pFFTSpec->N >= 2) && (pFFTSpec->N <= (1 << TWIDDLE_TABLE_ORDER)); 119} 120 121static inline int validateParametersF32(const void* pSrc, 122 const void* pDst, 123 const ARMsFFTSpec_R_FC32* pFFTSpec) { 124 return pSrc && pDst && pFFTSpec && !(((uintptr_t)pSrc) & 31) && 125 !(((uintptr_t)pDst) & 31) && pFFTSpec->pTwiddle && pFFTSpec->pBuf && 126 (pFFTSpec->N >= 2) && (pFFTSpec->N <= (1 << TWIDDLE_TABLE_ORDER)); 127} 128 129#ifdef __cplusplus 130} 131#endif 132 133#endif 134 135/*End of File*/ 136 137 138 139