/*------------------------------------------------------------------------- * pfft.h Partioned Fast Fourier Transform * $Id: $ *------------------------------------------------------------------------- * * Copyright (C) 2001 Algo Vision Systems GmbH * *------------------------------------------------------------------------- */ #ifndef _PFFT_H #define _PFFT_H #include "avtypes.h" #include "avfft.h" /*-----------------------------------------------------------------------*/ /* PFLMS-Parameter */ /*-----------------------------------------------------------------------*/ typedef struct _sCOMPLEX { avfloat_t *pReal, *pImag; } COMPLEX; typedef struct _sREALBUF { avfloat_t *pData; struct _sREALBUF *pNext, *pLast, *pLastPS; UINT32 user; } REALBUF; typedef struct _sCMPXBUF { struct _sCOMPLEX cmpxData; struct _sCMPXBUF *pNext, *pLast, *pLastPS; UINT32 user; } CMPXBUF; typedef struct _sPFFT { UINT32 N, P, S, L, C; /* PFLMS-Parameter N, P, S, L, C */ CMPXBUF *pBufX; /* komplexer Puffer X[P*S][C] */ CMPXBUF *pX; /* aktuelle Zeiger auf Puffer[p][] */ COMPLEX *pY; /* temporaerer Puffer fuer Y[] und E[] */ COMPLEX BufXsave; /* Overlap-Save Puffer xs[S*L] */ FFT *pFFT; /* FFT-Objekt */ } PFFT; #ifdef __cplusplus extern "C" { #endif AVERR PfftInit(PFFT *pObj,UINT32 N, UINT32 P, UINT32 S, UINT32 L, UINT32 C); AVERR PfftFilterAlloc(PFFT *pObj, CMPXBUF **ppH); AVERR PfftFilterInit(PFFT *pObj, COMPLEX WTD, CMPXBUF *pH); AVERR PfftFilter(PFFT *pObj, CMPXBUF *pH, COMPLEX x, COMPLEX y); AVERR PfftFilterFast(PFFT *pObj, CMPXBUF *pH); avfloat_t *PfftGetBufInRe(PFFT *pObj); avfloat_t *PfftGetBufInIm(PFFT *pObj); avfloat_t *PfftGetBufOutRe(PFFT *pObj); avfloat_t *PfftGetBufOutIm(PFFT *pObj); /*-----------------------------------------------------------------*/ /* Complex-Funktionen /*-----------------------------------------------------------------*/ _inline void CmpxVectMul( struct _sCOMPLEX *pA, struct _sCOMPLEX *pB, struct _sCOMPLEX *pAB, UINT32 len) { UINT32 i; for (i=0; i < len; i++) { pAB->pReal[i] = pA->pReal[i]*pB->pReal[i] - pA->pImag[i]*pB->pImag[i]; pAB->pImag[i] = pA->pReal[i]*pB->pImag[i] + pA->pImag[i]*pB->pReal[i]; } } _inline void CmpxVectAdd( struct _sCOMPLEX *pA, struct _sCOMPLEX *pB, struct _sCOMPLEX *pAB, UINT32 len) { UINT32 i; for (i=0; i < len; i++) { pAB->pReal[i] = pA->pReal[i] + pB->pReal[i]; pAB->pImag[i] = pA->pImag[i] + pB->pImag[i]; } } _inline void CmpxVectMac( struct _sCOMPLEX *pA, struct _sCOMPLEX *pB, struct _sCOMPLEX *pAB, UINT32 len) { UINT32 i; for (i=0; i < len; i++) { pAB->pReal[i] += pA->pReal[i]*pB->pReal[i] - pA->pImag[i]*pB->pImag[i]; pAB->pImag[i] += pA->pReal[i]*pB->pImag[i] + pA->pImag[i]*pB->pReal[i]; } } _inline void CmpxVectMulS( struct _sCOMPLEX *pA, struct _sCOMPLEX *pB, struct _sCOMPLEX *pAB, UINT32 len) { UINT32 i; for (i=0; i < len; i++) { pAB->pReal[i] = (pA->pReal[i]*pB->pReal[i] - pA->pImag[i]*pB->pImag[i])*len; pAB->pImag[i] = (pA->pReal[i]*pB->pImag[i] + pA->pImag[i]*pB->pReal[i])*len; } } _inline void CmpxVectMacS( struct _sCOMPLEX *pA, struct _sCOMPLEX *pB, struct _sCOMPLEX *pAB, UINT32 len) { UINT32 i; for (i=0; i < len; i++) { pAB->pReal[i] += (pA->pReal[i]*pB->pReal[i] - pA->pImag[i]*pB->pImag[i])*len; pAB->pImag[i] += (pA->pReal[i]*pB->pImag[i] + pA->pImag[i]*pB->pReal[i])*len; } } #ifdef __cplusplus } #endif #endif /* _PFFT_H */