diff options
Diffstat (limited to 'libFDK')
61 files changed, 16897 insertions, 0 deletions
diff --git a/libFDK/Android.mk b/libFDK/Android.mk new file mode 100644 index 0000000..5053e7d --- /dev/null +++ b/libFDK/Android.mk @@ -0,0 +1 @@ +include $(call all-subdir-makefiles) diff --git a/libFDK/include/FDK_archdef.h b/libFDK/include/FDK_archdef.h new file mode 100644 index 0000000..eecc990 --- /dev/null +++ b/libFDK/include/FDK_archdef.h @@ -0,0 +1,184 @@ +/*************************** Fraunhofer IIS FDK Tools *********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef __ARCH_H__ +#define __ARCH_H__ + +/* Performance / Quality profile selector */ + #define FDK_HIGH_PERFORMANCE + +/* Unify some few toolchain specific defines to avoid having large "or" macro contraptions all over the source code. */ + +/* Take action against VisualStudio 2005 crosscompile problems. */ + +/* Use single macro (the GCC built in macro) for architecture identification independent of the particular toolchain */ +#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || (defined(_MSC_VER) && defined(_M_IX86)) || defined (__x86_64__) +#define __x86__ +#endif + +#if (defined(_M_ARM) || defined(__CC_ARM)) && !defined(__arm__) || defined(__TI_TMS470_V5__) && !defined(__arm__) +#define __arm__ +#endif + + + +/* Define __ARM_ARCH_5TE__ if armv5te features are supported */ +#if (__TARGET_ARCH_ARM == 5) || defined(__TARGET_FEATURE_DSPMUL) || (_M_ARM == 5) || defined(__ARM_ARCH_5TEJ__) || defined(__TI_TMS470_V5__) || defined(__ARM_ARCH_7EM__) +#define __ARM_ARCH_5TE__ +#endif + +/* Define __ARM_ARCH_6__ if the armv6 intructions are being supported. */ +#if (__TARGET_ARCH_ARM == 6) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6ZK__) +#define __ARM_ARCH_5TE__ +#define __ARM_ARCH_6__ +#endif + +/* Define __ARM_ARCH_7_A__ if the armv7 intructions are being supported. */ +#if defined(__TARGET_ARCH_7_R) || defined(__ARM_ARCH_7R__) +#define __ARM_ARCH_5TE__ +#define __ARM_ARCH_6__ +#define __ARM_ARCH_7_R__ +#endif + +/* Define __ARM_ARCH_7_A__ if the armv7 intructions are being supported. */ +#if defined(__TARGET_ARCH_7_A) || defined(__ARM_ARCH_7A__) +#define __ARM_ARCH_5TE__ +#define __ARM_ARCH_6__ +#define __ARM_ARCH_7_A__ +#endif + +/* Define __ARM_ARCH_7M__ if the ARMv7-M instructions are being supported, e.g. Cortex-M3. */ +#if defined(__TARGET_ARCH_7_M) || defined(__ARM_ARCH_7_M__) +#define __ARM_ARCH_7M__ +#endif + +/* Define __ARM_ARCH_7EM__ if the ARMv7-ME instructions are being supported, e.g. Cortex-M4. */ +#if defined(__TARGET_ARCH_7E_M) || defined(__ARM_ARCH_7E_M__) +#define __ARM_ARCH_7EM__ +#endif + +/* Detect and unify macros for neon feature. */ +#if defined(__TARGET_FEATURE_NEON) && !defined(__ARM_NEON__) +#define __ARM_NEON__ +#endif + +#ifdef _M_ARM +#include "cmnintrin.h" +#include "armintr.h" +#endif + + + +/* Define preferred Multiplication type */ +#if defined(FDK_HIGH_PERFORMANCE) && !defined(FDK_HIGH_QUALITY) /* FDK_HIGH_PERFORMANCE */ + +#if defined(__mips__) || defined(__powerpc__) || defined(__sh__) +#define ARCH_PREFER_MULT_16x16 +#undef SINETABLE_16BIT +#undef POW2COEFF_16BIT +#undef LDCOEFF_16BIT +#undef WINDOWTABLE_16BIT + +#elif defined(__arm__) && defined(__ARM_ARCH_5TE__) /* cppp replaced: elif */ /* cppp replaced: elif */ +#define ARCH_PREFER_MULT_32x16 +#define SINETABLE_16BIT +#define POW2COEFF_16BIT +#define LDCOEFF_16BIT +#define WINDOWTABLE_16BIT + +#elif defined(__arm__) && defined(__ARM_ARCH_7M__) +#define ARCH_PREFER_MULT_32x16 +#define SINETABLE_16BIT +#define POW2COEFF_16BIT +#define LDCOEFF_16BIT +#define WINDOWTABLE_16BIT + +#elif defined(__arm__) && defined(__ARM_ARCH_7EM__) +#define ARCH_PREFER_MULT_32x32 +#define ARCH_PREFER_MULT_32x16 +#define SINETABLE_16BIT +#define POW2COEFF_16BIT +#define LDCOEFF_16BIT +#define WINDOWTABLE_16BIT + +#elif defined(__arm__) && !defined(__ARM_ARCH_5TE__) +#define ARCH_PREFER_MULT_16x16 +#undef SINETABLE_16BIT +#undef WINDOWTABLE_16BIT +#undef POW2COEFF_16BIT +#undef LDCOEFF_16BIT + +#elif defined(__x86__) /* cppp replaced: elif */ +#define ARCH_PREFER_MULT_32x16 +#define SINETABLE_16BIT +#define WINDOWTABLE_16BIT +#define POW2COEFF_16BIT +#define LDCOEFF_16BIT + +#else + + #error >>>> Please set architecture characterization defines for your platform (FDK_HIGH_PERFORMANCE)! <<<< + +#endif /* Architecture switches */ + +#else /* neither FDK_HIGH_QUALITY or FDK_HIGH_PERFORMANCE */ + +#error Either set FDK_HIGH_QUALITY or FDK_HIGH_PERFORMANCE, but not both nor none of them. + +#endif /* End of quality/complexity tradeoff */ + +#define FDKTOOLS_PACKED_TABLES + + +#ifdef SINETABLE_16BIT + #define FIXP_STB FIXP_SGL /* STB sinus Tab used in transformation */ + #define FIXP_STP FIXP_SPK + #define STC(a) (FX_DBL2FXCONST_SGL(a)) +#else + #define FIXP_STB FIXP_DBL + #define FIXP_STP FIXP_DPK + #define STC(a) ((FIXP_DBL)(LONG)(a)) +#endif /* defined(SINETABLE_16BIT) */ + +#define STCP(cos,sin) { { STC(cos), STC(sin) } } + + +#ifdef WINDOWTABLE_16BIT + #define FIXP_WTB FIXP_SGL /* single FIXP_SGL values */ + #define FIXP_WTP FIXP_SPK /* packed FIXP_SGL values */ + #define WTC(a) FX_DBL2FXCONST_SGL(a) +#else /* SINETABLE_16BIT */ + #define FIXP_WTB FIXP_DBL + #define FIXP_WTP FIXP_DPK + #define WTC(a) (FIXP_DBL)(a) +#endif /* SINETABLE_16BIT */ + +#define WTCP(a,b) { { WTC(a), WTC(b) } } + + +#endif /* __ARCH_H__ */ diff --git a/libFDK/include/FDK_bitbuffer.h b/libFDK/include/FDK_bitbuffer.h new file mode 100644 index 0000000..3b6afd7 --- /dev/null +++ b/libFDK/include/FDK_bitbuffer.h @@ -0,0 +1,104 @@ +/*************************** Fraunhofer IIS FDK Tools *********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Lohwasser + Description: common bitbuffer read/write routines + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef __FDK_BITBUFFER_H__ +#define __FDK_BITBUFFER_H__ + + + +#include "machine_type.h" + +typedef struct +{ + UINT ValidBits; + UINT ReadOffset; + UINT WriteOffset; + UINT BitCnt; + UINT BitNdx; + + UCHAR *Buffer; + UINT bufSize; + UINT bufBits; +} FDK_BITBUF; + +typedef FDK_BITBUF *HANDLE_FDK_BITBUF; + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern const UINT BitMask [32+1]; + +/** The BitBuffer Functions are called straight from FDK_bitstream Interface. + For Functions functional survey look there. +*/ + +void FDK_CreateBitBuffer (HANDLE_FDK_BITBUF *hBitBuffer, UCHAR *pBuffer, UINT bufSize) ; + +void FDK_InitBitBuffer (HANDLE_FDK_BITBUF hBitBuffer, UCHAR *pBuffer, + UINT bufSize, UINT validBits) ; + +void FDK_ResetBitBuffer (HANDLE_FDK_BITBUF hBitBuffer) ; + +void FDK_DeleteBitBuffer (HANDLE_FDK_BITBUF hBitBuffer) ; + +INT FDK_get (HANDLE_FDK_BITBUF hBitBuffer, const UINT numberOfBits) ; + +INT FDK_get32 (HANDLE_FDK_BITBUF hBitBuffer) ; + +void FDK_put (HANDLE_FDK_BITBUF hBitBuffer, UINT value, const UINT numberOfBits) ; + +INT FDK_getBwd (HANDLE_FDK_BITBUF hBitBuffer, const UINT numberOfBits); +void FDK_putBwd (HANDLE_FDK_BITBUF hBitBuffer, UINT value, const UINT numberOfBits) ; + +void FDK_pushBack (HANDLE_FDK_BITBUF hBitBuffer, const UINT numberOfBits, UCHAR config) ; +void FDK_pushForward (HANDLE_FDK_BITBUF hBitBuffer, const UINT numberOfBits, UCHAR config) ; + +void FDK_byteAlign (HANDLE_FDK_BITBUF hBitBuffer, UCHAR config) ; + +UINT FDK_getValidBits (HANDLE_FDK_BITBUF hBitBuffer) ; +INT FDK_getFreeBits (HANDLE_FDK_BITBUF hBitBuffer) ; + +void FDK_setBitCnt (HANDLE_FDK_BITBUF hBitBuffer, const UINT value) ; +INT FDK_getBitCnt (HANDLE_FDK_BITBUF hBitBuffer) ; + +void FDK_Feed (HANDLE_FDK_BITBUF hBitBuffer, UCHAR inputBuffer [], + const UINT bufferSize, UINT *bytesValid) ; + +void FDK_Copy (HANDLE_FDK_BITBUF hBitBufDst, HANDLE_FDK_BITBUF hBitBufSrc, UINT *bytesValid) ; + +void FDK_Fetch (HANDLE_FDK_BITBUF hBitBuffer, UCHAR outBuf[], UINT *writeBytes); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libFDK/include/FDK_bitstream.h b/libFDK/include/FDK_bitstream.h new file mode 100644 index 0000000..81c4e93 --- /dev/null +++ b/libFDK/include/FDK_bitstream.h @@ -0,0 +1,556 @@ +/*************************** Fraunhofer IIS FDK Tools *********************** + + (C) Copyright Fraunhofer IIS (2009) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Lohwasser + Description: bitstream interface to bitbuffer routines + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef __FDK_BITSTREAM_H__ +#define __FDK_BITSTREAM_H__ + + + +#include "FDK_bitbuffer.h" +#include "machine_type.h" + +#include "genericStds.h" + +#define CACHE_BITS 32 + +typedef enum { + BS_READER, + BS_WRITER +} FDK_BS_CFG; + + +typedef struct +{ + UINT CacheWord ; + UINT BitsInCache ; + FDK_BITBUF hBitBuf; + UINT ConfigCache ; +} FDK_BITSTREAM; + +typedef FDK_BITSTREAM* HANDLE_FDK_BITSTREAM; + +/** + * \brief CreateBitStream Function. + * + * Create and initialize bitstream with extern allocated buffer. + * + * \param pBuffer Pointer to BitBuffer array. + * \param bufSize Length of BitBuffer array. (awaits size 2^n) + * \param config Initialize BitStream as Reader or Writer. + */ +FDK_INLINE +HANDLE_FDK_BITSTREAM FDKcreateBitStream (UCHAR *pBuffer, + UINT bufSize, + FDK_BS_CFG config = BS_READER) +{ + HANDLE_FDK_BITSTREAM hBitStream = (HANDLE_FDK_BITSTREAM) FDKcalloc(1, sizeof(FDK_BITSTREAM)); + FDK_InitBitBuffer(&hBitStream->hBitBuf, pBuffer, bufSize, 0) ; + + /* init cache */ + hBitStream->CacheWord = hBitStream->BitsInCache = 0 ; + hBitStream->ConfigCache = config ; + + return hBitStream ; +} + + +/** + * \brief Initialize BistreamBuffer. BitBuffer can point to filled BitBuffer array . + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param pBuffer Pointer to BitBuffer array. + * \param bufSize Length of BitBuffer array. (awaits size 2^n) + * \param validBits Number of valid BitBuffer filled Bits. + * \param config Initialize BitStream as Reader or Writer. + * \return void + */ +FDK_INLINE +void FDKinitBitStream (HANDLE_FDK_BITSTREAM hBitStream, + UCHAR *pBuffer, + UINT bufSize, + UINT validBits, + FDK_BS_CFG config = BS_READER) +{ + FDK_InitBitBuffer(&hBitStream->hBitBuf, pBuffer, bufSize, validBits) ; + + /* init cache */ + hBitStream->CacheWord = hBitStream->BitsInCache = 0 ; + hBitStream->ConfigCache = config ; +} + + +/** + * \brief ResetBitbuffer Function. Reset states in BitBuffer and Cache. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param config Initialize BitStream as Reader or Writer. + * \return void + */ +FDK_INLINE void FDKresetBitbuffer( HANDLE_FDK_BITSTREAM hBitStream, FDK_BS_CFG config = BS_READER) +{ + FDK_ResetBitBuffer( &hBitStream->hBitBuf ) ; + + /* init cache */ + hBitStream->CacheWord = hBitStream->BitsInCache = 0 ; + hBitStream->ConfigCache = config ; +} + + +/** DeleteBitStream. + + Deletes the in Create Bitstream allocated BitStream and BitBuffer. +*/ +FDK_INLINE void FDKdeleteBitStream (HANDLE_FDK_BITSTREAM hBitStream) +{ + FDK_DeleteBitBuffer(&hBitStream->hBitBuf) ; + FDKfree(hBitStream) ; +} + + +/** + * \brief ReadBits Function (forward). This function returns a number of sequential + * bits from the input bitstream. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param numberOfBits The number of bits to be retrieved. + * \return the requested bits, right aligned + * \return + */ +#define OPTIMIZE_FDKREADBITS + +FDK_INLINE UINT FDKreadBits(HANDLE_FDK_BITSTREAM hBitStream, + const UINT numberOfBits) +{ +#ifdef noOPTIMIZE_FDKREADBITS + INT missingBits = numberOfBits - hBitStream->BitsInCache; + if (missingBits > 0) + { + UINT bits = hBitStream->CacheWord << missingBits; + hBitStream->CacheWord = FDK_get32 (&hBitStream->hBitBuf) ; + hBitStream->BitsInCache = CACHE_BITS - missingBits; + return ( bits | (hBitStream->CacheWord >> hBitStream->BitsInCache)) & BitMask[numberOfBits]; + } + + hBitStream->BitsInCache -= numberOfBits; + return ( hBitStream->CacheWord >> hBitStream->BitsInCache) & BitMask[numberOfBits]; + +#else + const UINT validMask = BitMask [numberOfBits] ; + + if (hBitStream->BitsInCache <= numberOfBits) + { + const INT freeBits = (CACHE_BITS-1) - hBitStream->BitsInCache ; + + hBitStream->CacheWord = (hBitStream->CacheWord << freeBits) | FDK_get (&hBitStream->hBitBuf,freeBits) ; + hBitStream->BitsInCache += freeBits ; + } + + hBitStream->BitsInCache -= numberOfBits ; + + return (hBitStream->CacheWord >> hBitStream->BitsInCache) & validMask ; +#endif +} + +FDK_INLINE UINT FDKreadBit(HANDLE_FDK_BITSTREAM hBitStream) +{ +#ifdef OPTIMIZE_FDKREADBITS + if (!hBitStream->BitsInCache) + { + hBitStream->CacheWord = FDK_get32 (&hBitStream->hBitBuf); + hBitStream->BitsInCache = CACHE_BITS; + } + hBitStream->BitsInCache--; + + return (hBitStream->CacheWord >> hBitStream->BitsInCache) & 1; +#else + return FDKreadBits(hBitStream,1); +#endif +} + +/** + * \brief Read2Bits Function (forward). This function 2 sequential + * bits from the input bitstream. It is the optimized version + of FDKreadBits() for readign 2 bits. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \return the requested bits, right aligned + * \return + */ +inline UINT FDKread2Bits(HANDLE_FDK_BITSTREAM hBitStream) +{ + UINT BitsInCache = hBitStream->BitsInCache; + if (BitsInCache < 2) /* Comparison changed from 'less-equal' to 'less' */ + { + const INT freeBits = (CACHE_BITS-1) - BitsInCache ; + + hBitStream->CacheWord = (hBitStream->CacheWord << freeBits) | FDK_get (&hBitStream->hBitBuf,freeBits) ; + BitsInCache += freeBits; + } + hBitStream->BitsInCache = BitsInCache - 2; + return (hBitStream->CacheWord >> hBitStream->BitsInCache) & 0x3; +} + +/** + * \brief ReadBits Function (backward). This function returns a number of sequential bits + * from the input bitstream. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param numberOfBits The number of bits to be retrieved. + * \return the requested bits, right aligned + */ +FDK_INLINE UINT FDKreadBitsBwd(HANDLE_FDK_BITSTREAM hBitStream, + const UINT numberOfBits) +{ + const UINT validMask = BitMask [numberOfBits] ; + + if (hBitStream->BitsInCache <= numberOfBits) + { + const INT freeBits = (CACHE_BITS-1) - hBitStream->BitsInCache ; + + hBitStream->CacheWord = (hBitStream->CacheWord << freeBits) | FDK_getBwd (&hBitStream->hBitBuf,freeBits) ; + hBitStream->BitsInCache += freeBits ; + } + + hBitStream->BitsInCache -= numberOfBits ; + + return (hBitStream->CacheWord >> hBitStream->BitsInCache) & validMask ; +} + + +/** + * \brief return a number of bits from the bitBuffer. + * You have to know what you do! Cache has to be synchronized before using this + * function. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param numBits The number of bits to be retrieved. + * \return the requested bits, right aligned + */ +FDK_INLINE UINT FDKgetBits (HANDLE_FDK_BITSTREAM hBitStream, UINT numBits) +{ + return FDK_get (&hBitStream->hBitBuf, numBits) ; +} + + +/** + * \brief WriteBits Function. This function writes numberOfBits of value into bitstream. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param value Variable holds data to be written. + * \param numberOfBits The number of bits to be written. + * \return number of bits written + */ +FDK_INLINE UCHAR FDKwriteBits(HANDLE_FDK_BITSTREAM hBitStream, UINT value, + const UINT numberOfBits) +{ + const UINT validMask = BitMask [numberOfBits] ; + + if ((hBitStream->BitsInCache+numberOfBits) < CACHE_BITS) + { + hBitStream->BitsInCache += numberOfBits ; + hBitStream->CacheWord = (hBitStream->CacheWord << numberOfBits) | (value & validMask); + } + else + { + FDK_put(&hBitStream->hBitBuf, hBitStream->CacheWord, hBitStream->BitsInCache) ; + hBitStream->BitsInCache = numberOfBits ; + hBitStream->CacheWord = (value & validMask) ; + } + + return numberOfBits; +} + + +/** + * \brief WriteBits Function (backward). This function writes numberOfBits of value into bitstream. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param value Variable holds data to be written. + * \param numberOfBits The number of bits to be written. + * \return number of bits written + */ +FDK_INLINE UCHAR FDKwriteBitsBwd(HANDLE_FDK_BITSTREAM hBitStream, UINT value, + const UINT numberOfBits) +{ + const UINT validMask = BitMask [numberOfBits] ; + + if ((hBitStream->BitsInCache+numberOfBits) <= CACHE_BITS) + { + hBitStream->BitsInCache += numberOfBits ; + hBitStream->CacheWord = (hBitStream->CacheWord << numberOfBits) | (value & validMask); + } + else + { + FDK_putBwd(&hBitStream->hBitBuf, hBitStream->CacheWord, hBitStream->BitsInCache) ; + hBitStream->BitsInCache = numberOfBits ; + hBitStream->CacheWord = (value & validMask) ; + } + + return numberOfBits; +} + + +/** + * \brief SyncCache Function. Clear cache after read forward. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \return void + */ +FDK_INLINE void FDKsyncCache (HANDLE_FDK_BITSTREAM hBitStream) +{ + if (hBitStream->ConfigCache == BS_READER) + FDK_pushBack (&hBitStream->hBitBuf,hBitStream->BitsInCache,hBitStream->ConfigCache) ; + else /* BS_WRITER */ + FDK_put(&hBitStream->hBitBuf, hBitStream->CacheWord, hBitStream->BitsInCache) ; + + hBitStream->BitsInCache = 0 ; + hBitStream->CacheWord = 0 ; +} + + +/** + * \brief SyncCache Function. Clear cache after read backwards. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \return void + */ +FDK_INLINE void FDKsyncCacheBwd (HANDLE_FDK_BITSTREAM hBitStream) +{ + if (hBitStream->ConfigCache == BS_READER) { + FDK_pushForward (&hBitStream->hBitBuf,hBitStream->BitsInCache,hBitStream->ConfigCache) ; + } else { /* BS_WRITER */ + FDK_putBwd (&hBitStream->hBitBuf, hBitStream->CacheWord, hBitStream->BitsInCache) ; + } + + hBitStream->BitsInCache = 0 ; + hBitStream->CacheWord = 0 ; +} + + +/** + * \brief Byte Alignment Function. + * This function performs the byte_alignment() syntactic function on the input stream, + * i.e. some bits will be discarded/padded so that the next bits to be read/written will + * be aligned on a byte boundary with respect to the bit position 0. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \return void + */ +FDK_INLINE void FDKbyteAlign (HANDLE_FDK_BITSTREAM hBitStream) +{ + FDKsyncCache (hBitStream) ; + FDK_byteAlign (&hBitStream->hBitBuf, (UCHAR)hBitStream->ConfigCache) ; +} + + +/** + * \brief Byte Alignment Function with anchor + * This function performs the byte_alignment() syntactic function on the input stream, + * i.e. some bits will be discarded so that the next bits to be read/written would be aligned + * on a byte boundary with respect to the given alignment anchor. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param alignmentAnchor bit position to be considered as origin for byte alignment + * \return void + */ +FDK_INLINE void FDKbyteAlign (HANDLE_FDK_BITSTREAM hBitStream, UINT alignmentAnchor) +{ + FDKsyncCache (hBitStream) ; + if (hBitStream->ConfigCache == BS_READER) { + FDK_pushForward (&hBitStream->hBitBuf, + (8 - ((alignmentAnchor - FDK_getValidBits(&hBitStream->hBitBuf)) & 0x07)) & 0x07, + hBitStream->ConfigCache) ; + } + else { + FDK_put (&hBitStream->hBitBuf, + 0, + (8 - ((FDK_getValidBits(&hBitStream->hBitBuf)-alignmentAnchor) & 0x07)) & 0x07 ); + } +} + + +/** + * \brief Push Back(Cache) / For / BiDirectional Function. + * PushBackCache function ungets a number of bits erroneously read/written by the last Get() call. + * NB: The number of bits to be stuffed back into the stream may never exceed the + * number of bits returned by the immediately preceding Get() call. + * + * PushBack function ungets a number of bits (combines cache and bitbuffer indices) + * PushFor function gets a number of bits (combines cache and bitbuffer indices) + * PushBiDirectional gets/ungets number of bits as defined in PusBack/For function + * NB: The sign of bits is not known, so the function checks direction and calls + * appropriate function. (positive sign pushFor, negative sign pushBack ) + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param numberOfBits The number of bits to be pushed back/for. + * \return void + */ +FDK_INLINE void FDKpushBackCache (HANDLE_FDK_BITSTREAM hBitStream, const UINT numberOfBits) +{ + FDK_ASSERT ((hBitStream->BitsInCache+numberOfBits)<=CACHE_BITS); + hBitStream->BitsInCache += numberOfBits ; +} + +FDK_INLINE void FDKpushBack (HANDLE_FDK_BITSTREAM hBitStream, const UINT numberOfBits) +{ + if ((hBitStream->BitsInCache+numberOfBits)<CACHE_BITS && (hBitStream->ConfigCache == BS_READER) ) { + hBitStream->BitsInCache += numberOfBits ; + FDKsyncCache(hBitStream) ; /* sync cache to avoid invalid cache */ + } + else { + FDKsyncCache(hBitStream) ; + FDK_pushBack(&hBitStream->hBitBuf,numberOfBits,hBitStream->ConfigCache); + } +} + +FDK_INLINE void FDKpushFor (HANDLE_FDK_BITSTREAM hBitStream, const UINT numberOfBits) +{ + if ( (hBitStream->BitsInCache>numberOfBits) && (hBitStream->ConfigCache == BS_READER) ) { + hBitStream->BitsInCache -= numberOfBits; + } + else { + FDKsyncCache(hBitStream) ; + FDK_pushForward(&hBitStream->hBitBuf,numberOfBits,hBitStream->ConfigCache); + } +} + +FDK_INLINE void FDKpushBiDirectional (HANDLE_FDK_BITSTREAM hBitStream, const INT numberOfBits) +{ + if(numberOfBits>=0) FDKpushFor(hBitStream, numberOfBits) ; + else FDKpushBack(hBitStream, -numberOfBits) ; +} + + +/** + * \brief GetValidBits Function. Clear cache and return valid Bits from Bitbuffer. + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \return amount of valid bits that still can be read or were already written. + * + */ +FDK_INLINE UINT FDKgetValidBits (HANDLE_FDK_BITSTREAM hBitStream) +{ + FDKsyncCache(hBitStream) ; + return FDK_getValidBits(&hBitStream->hBitBuf) ; +} + + +/** + * \brief return amount of unused Bits from Bitbuffer. + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \return amount of free bits that still can be written into the bitstream + */ +FDK_INLINE INT FDKgetFreeBits (HANDLE_FDK_BITSTREAM hBitStream) +{ + return FDK_getFreeBits (&hBitStream->hBitBuf) ; +} + +/** + * \brief reset bitcounter in bitBuffer to zero. + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \return void + */ +FDK_INLINE void FDKresetBitCnt (HANDLE_FDK_BITSTREAM hBitStream) +{ + FDKsyncCache (hBitStream) ; + FDK_setBitCnt (&hBitStream->hBitBuf, 0) ; +} + +/** + * \brief set bitcoutner in bitBuffer to given value. + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param value new value to be assigned to the bit counter + * \return void + */ +FDK_INLINE void FDKsetBitCnt (HANDLE_FDK_BITSTREAM hBitStream, UINT value) +{ + FDKsyncCache (hBitStream) ; + FDK_setBitCnt (&hBitStream->hBitBuf, value) ; +} + +/** + * \brief get bitcounter state from bitBuffer. + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \return current bit counter value + */ +FDK_INLINE INT FDKgetBitCnt (HANDLE_FDK_BITSTREAM hBitStream) +{ + FDKsyncCache(hBitStream) ; + return FDK_getBitCnt(&hBitStream->hBitBuf) ; +} + + +/** + * \brief Fill the BitBuffer with a number of input bytes from external source. + * The bytesValid variable returns the number of ramaining valid bytes in extern inputBuffer. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param inputBuffer Pointer to input buffer with bitstream data. + * \param bufferSize Total size of inputBuffer array. + * \param bytesValid Input: number of valid bytes in inputBuffer. Output: bytes still left unread in inputBuffer. + * \return void + */ +FDK_INLINE void FDKfeedBuffer (HANDLE_FDK_BITSTREAM hBitStream, const UCHAR inputBuffer [], const UINT bufferSize, UINT *bytesValid) +{ + FDKsyncCache (hBitStream) ; + FDK_Feed(&hBitStream->hBitBuf, (UCHAR*)inputBuffer, bufferSize, bytesValid ) ; +} + + +/** + * \brief fill destination BitBuffer with a number of bytes from source BitBuffer. The + * bytesValid variable returns the number of ramaining valid bytes in source BitBuffer. + * + * \param hBSDst HANDLE_FDK_BITSTREAM handle to write data into + * \param hBSSrc HANDLE_FDK_BITSTREAM handle to read data from + * \param bytesValid Input: number of valid bytes in inputBuffer. Output: bytes still left unread in inputBuffer. + * \return void + */ +FDK_INLINE void FDKcopyBuffer (HANDLE_FDK_BITSTREAM hBSDst, HANDLE_FDK_BITSTREAM hBSSrc, UINT *bytesValid) +{ + FDKsyncCache (hBSSrc) ; + FDK_Copy (&hBSDst->hBitBuf, &hBSSrc->hBitBuf, bytesValid) ; +} + + +/** + * \brief fill the outputBuffer with all valid bytes hold in BitBuffer. The WriteBytes + * variable returns the number of written Bytes. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param outputBuffer Pointer to output buffer. + * \param writeBytes Number of bytes write to output buffer. + * \return void + */ +FDK_INLINE void FDKfetchBuffer(HANDLE_FDK_BITSTREAM hBitStream, UCHAR *outputBuffer, UINT *writeBytes) +{ + FDKsyncCache (hBitStream) ; + FDK_Fetch(&hBitStream->hBitBuf, outputBuffer, writeBytes); +} + + +#endif diff --git a/libFDK/include/FDK_core.h b/libFDK/include/FDK_core.h new file mode 100644 index 0000000..ce77882 --- /dev/null +++ b/libFDK/include/FDK_core.h @@ -0,0 +1,47 @@ +/*************************** Fraunhofer IIS FDK Tools *********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Manuel Jander + Description: FDK tools versioning support + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef FDK_CORE_H +#define FDK_CORE_H + +#include "FDK_audio.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief Get FDK_tools library information. + * @return Return 0 on success and a negative errorcode on failure (see errorcodes.h). + */ +int FDK_toolsGetLibInfo(LIB_INFO *info); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libFDK/include/FDK_crc.h b/libFDK/include/FDK_crc.h new file mode 100644 index 0000000..29ae6c5 --- /dev/null +++ b/libFDK/include/FDK_crc.h @@ -0,0 +1,169 @@ +/******************************** MPEG Audio Encoder ************************** + + (C) copyright Fraunhofer-IIS (1999) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + + $Id$ + Initial author: + contents/description: CRC calculation + +******************************************************************************/ + +#ifndef FDK_CRC_H +#define FDK_CRC_H + + + +#include "FDK_bitstream.h" + + +#define MAX_CRC_REGS 3 /*!< Maximal number of overlapping crc region in ADTS channel pair element is two. + Select three independent regions preventively. */ + +/** + * This structure describes single crc region used for crc calculation. + */ +typedef struct +{ + UCHAR isActive; + INT maxBits; + UINT bitBufCntBits; + UINT validBits; + +} CCrcRegData; + +/** + * CRC info structure. + */ +typedef struct +{ + CCrcRegData crcRegData[MAX_CRC_REGS]; /*!< Multiple crc region description. */ + const USHORT *pCrcLookup; /*!< Pointer to lookup table filled in FDK_crcInit(). */ + + USHORT crcPoly; /*!< CRC generator polynom. */ + USHORT crcMask; /*!< CRC mask. */ + USHORT startValue; /*!< CRC start value. */ + UCHAR crcLen; /*!< CRC length. */ + + UINT regStart; /*!< Start region marker for synchronization. */ + UINT regStop; /*!< Stop region marker for synchronization. */ + + USHORT crcValue; /*!< Crc value to be calculated. */ + +} FDK_CRCINFO; + +/** + * CRC info handle. + */ +typedef FDK_CRCINFO* HANDLE_FDK_CRCINFO; + + +/** + * \brief Initialize CRC structure. + * + * The function initializes existing crc info structure with denoted configuration. + * + * \param hCrcInfo Pointer to an outlying allocated crc info structure. + * \param crcPoly Configure crc polynom. + * \param crcStartValue Configure crc start value. + * \param crcLen Configure crc length. + * + * \return none + */ +void FDKcrcInit( + HANDLE_FDK_CRCINFO hCrcInfo, + const UINT crcPoly, + const UINT crcStartValue, + const UINT crcLen + ); + +/** + * \brief Reset CRC info structure. + * + * This function clears all intern states of the crc structure. + * + * \param hCrcInfo Pointer to crc info stucture. + * + * \return none + */ +void FDKcrcReset( + HANDLE_FDK_CRCINFO hCrcInfo + ); + + +/** + * \brief Start CRC region with maximum number of bits. + * + * This function marks position in bitstream to be used as start point for crc calculation. + * Bitstream range for crc calculation can be limited or kept dynamic depending on mBits parameter. + * The crc region has to be terminated with FDKcrcEndReg() in each case. + * + * \param hCrcInfo Pointer to crc info stucture. + * \param hBs Pointer to current bit buffer structure. + * \param mBits Number of bits in crc region to be calculated. + * - mBits > 0: Zero padding will be used for CRC calculation, if there + * are less than mBits bits available. + * - mBits < 0: No zero padding is done. + * - mBits = 0: The number of bits used in crc calculation is dynamically, + * depending on bitstream position between FDKcrcStartReg() and + * FDKcrcEndReg() call. + * + * \return ID for the created region, -1 in case of an error + */ +INT FDKcrcStartReg( + HANDLE_FDK_CRCINFO hCrcInfo, + const HANDLE_FDK_BITSTREAM hBs, + const INT mBits + ); + + +/** + * \brief Ends CRC region. + * + * This function terminates crc region specified with FDKcrcStartReg(). The number of bits in crc region depends + * on mBits parameter of FDKcrcStartReg(). + * This function calculates and updates crc in info structure. + * + * \param hCrcInfo Pointer to crc info stucture. + * \param hBs Pointer to current bit buffer structure. + * \param reg Crc region ID created in FDKcrcStartReg(). + * + * \return 0 on success + */ +INT FDKcrcEndReg( + HANDLE_FDK_CRCINFO hCrcInfo, + const HANDLE_FDK_BITSTREAM hBs, + const INT reg + ); + + +/** + * \brief This function returns crc value from info struct. + * + * \param hCrcInfo Pointer to crc info stucture. + * + * \return CRC value masked with crc length. + */ +USHORT FDKcrcGetCRC( + const HANDLE_FDK_CRCINFO hCrcInfo + ); + + +#endif /* FDK_CRC_H */ diff --git a/libFDK/include/FDK_tools_rom.h b/libFDK/include/FDK_tools_rom.h new file mode 100644 index 0000000..6425e49 --- /dev/null +++ b/libFDK/include/FDK_tools_rom.h @@ -0,0 +1,205 @@ +/*************************** Fraunhofer IIS FDK Tools *********************** + + (C) Copyright Fraunhofer IIS (2008) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Oliver Moser + Description: ROM tables used by FDK tools + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef __FDK_TOOLS_ROM_H__ +#define __FDK_TOOLS_ROM_H__ + +#include "common_fix.h" +#include "FDK_audio.h" + + +/* None radix2 rotation vectors */ +extern const FIXP_STB RotVectorReal60[60]; +extern const FIXP_STB RotVectorImag60[60]; +extern const FIXP_STB RotVectorReal240[240]; +extern const FIXP_STB RotVectorImag240[240]; +extern const FIXP_STB RotVectorReal480[480]; +extern const FIXP_STB RotVectorImag480[480]; + + +/* Regular sine tables */ +extern const FIXP_STP SineTable512[]; +extern const FIXP_STP SineTable480[]; + +/* AAC-LC windows */ +extern const FIXP_WTP SineWindow1024[]; +extern const FIXP_WTP KBDWindow1024[]; +extern const FIXP_WTP SineWindow128[]; +extern const FIXP_WTP KBDWindow128[]; + +extern const FIXP_WTP SineWindow960[]; +extern const FIXP_WTP KBDWindow960[]; +extern const FIXP_WTP SineWindow120[]; +extern const FIXP_WTP KBDWindow120[]; + +/* AAC-LD windows */ +extern const FIXP_WTP SineWindow512[]; +#define LowOverlapWindow512 SineWindow128 +extern const FIXP_WTP SineWindow480[]; +#define LowOverlapWindow480 SineWindow120 + + + +extern const FIXP_WTP SineWindow64[]; +extern const FIXP_WTP SineWindow32[]; + +/** + * \brief Helper table for window slope mapping. You should prefer the usage of the + * function FDKgetWindowSlope(), this table is only made public for some optimized + * access inside dct.cpp. + */ +extern const FIXP_WTP *const windowSlopes[2][3][9]; + +/** + * \brief Window slope access helper. Obtain a window of given length and shape. + * \param length Length of the window slope. + * \param shape Shape index of the window slope. 0: sine window, 1: Kaiser-Bessel. Any other + * value is applied a mask of 1 to, mapping it to either 0 or 1. + * \param Pointer to window slope or NULL if the requested window slope is not available. + */ +const FIXP_WTP * FDKgetWindowSlope(int length, int shape); + +extern const FIXP_WTP sin_twiddle_L64[]; + +/* + * Filter coefficient type definition + */ + +#if defined(ARCH_PREFER_MULT_16x16) || defined(ARCH_PREFER_MULT_32x16) + #define QMF_COEFF_16BIT +#endif + +#define QMF_FILTER_PROTOTYPE_SIZE 640 +#define QMF_NO_POLY 5 + +#ifdef QMF_COEFF_16BIT + #define FIXP_PFT FIXP_SGL + #define FIXP_QTW FIXP_SGL +#else + #define FIXP_PFT FIXP_DBL + #define FIXP_QTW FIXP_DBL +#endif + +#define QMF640_PFT_TABLE_SIZE (640/2 + QMF_NO_POLY) + +extern const FIXP_QTW qmf_phaseshift_cos32[32]; +extern const FIXP_QTW qmf_phaseshift_sin32[32]; +extern const FIXP_QTW qmf_phaseshift_cos64[64]; +extern const FIXP_QTW qmf_phaseshift_sin64[64]; + +extern const FIXP_PFT qmf_64[QMF640_PFT_TABLE_SIZE+QMF_NO_POLY]; + + + + + +#define QMF640_CLDFB_PFT_TABLE_SIZE (640) +#define QMF320_CLDFB_PFT_TABLE_SIZE (320) +#define QMF_CLDFB_PFT_SCALE 1 + +extern const FIXP_QTW qmf_phaseshift_cos32_cldfb[32]; +extern const FIXP_QTW qmf_phaseshift_sin32_cldfb[32]; +extern const FIXP_QTW qmf_phaseshift_cos64_cldfb[64]; +extern const FIXP_QTW qmf_phaseshift_sin64_cldfb[64]; + +extern const FIXP_PFT qmf_cldfb_640[QMF640_CLDFB_PFT_TABLE_SIZE]; +extern const FIXP_PFT qmf_cldfb_320[QMF320_CLDFB_PFT_TABLE_SIZE]; + + + + + +/* + * Raw Data Block list stuff. + */ +typedef enum { + element_instance_tag, + common_window, + global_gain, + ics_info, /* ics_reserved_bit, window_sequence, window_shape, max_sfb, scale_factor_grouping, predictor_data_present, ltp_data_present, ltp_data */ + max_sfb, + ms, /* ms_mask_present, ms_used */ + /*predictor_data_present,*/ /* part of ics_info */ + ltp_data_present, + ltp_data, + section_data, + scale_factor_data, + pulse, /* pulse_data_present, pulse_data */ + tns_data_present, + tns_data, + gain_control_data_present, + gain_control_data, + esc1_hcr, + esc2_rvlc, + spectral_data, + + scale_factor_data_usac, + core_mode, + common_tw, + lpd_channel_stream, + tw_data, + noise, + ac_spectral_data, + fac_data, + tns_active, /* introduced in MPEG-D usac CD */ + tns_data_present_usac, + common_max_sfb, + + + /* Non data list items */ + adtscrc_start_reg1, + adtscrc_start_reg2, + adtscrc_end_reg1, + adtscrc_end_reg2, + drmcrc_start_reg, + drmcrc_end_reg, + next_channel, + next_channel_loop, + link_sequence, + end_of_sequence +} rbd_id_t; + +struct element_list { + const rbd_id_t *id; + const struct element_list *next[2]; +}; + +typedef struct element_list element_list_t; +/** + * \brief get elementary stream pieces list for given parameters. + * \param aot audio object type + * \param epConfig the epConfig value from the current Audio Specific Config + * \param nChannels amount of channels contained in the current element. + * \param layer the layer of the current element. + * \return element_list_t parser guidance structure. + */ +const element_list_t * getBitstreamElementList(AUDIO_OBJECT_TYPE aot, SCHAR epConfig, UCHAR nChannels, UCHAR layer); + + +#endif + diff --git a/libFDK/include/FDK_trigFcts.h b/libFDK/include/FDK_trigFcts.h new file mode 100644 index 0000000..19ab0b8 --- /dev/null +++ b/libFDK/include/FDK_trigFcts.h @@ -0,0 +1,169 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Haricharan Lakshman, Manuel Jander + Description: Trigonometric functions fixed point fractional implementation. + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + + + +#include "common_fix.h" + +#include "FDK_tools_rom.h" + +/* Fixed point precision definitions */ +#define Q(format) ((FIXP_DBL)(((LONG)1) << (format))) + +#ifndef M_PI +#define M_PI (3.14159265358979323846f) +#endif + +/*! + * Inverse tangent function. + */ + +// --- fixp_atan() ---- +#define Q_ATANINP (25) // Input in q25, Output in q30 +#define Q_ATANOUT (30) +#define ATI_SF ((DFRACT_BITS-1)-Q_ATANINP) // 6 +#define ATI_SCALE ((float)(1<<ATI_SF)) // +#define ATO_SF ((DFRACT_BITS-1)-Q_ATANOUT) // 1 ] -pi/2 .. pi/2 [ +#define ATO_SCALE ((float)(1<<ATO_SF)) // +// --- fixp_atan2() --- +#define Q_ATAN2OUT (29) +#define AT2O_SF ((DFRACT_BITS-1)-Q_ATAN2OUT) // 2 ] -pi .. pi ] +#define AT2O_SCALE ((float)(1<<AT2O_SF)) // +// -------------------- + +FIXP_DBL fixp_atan(FIXP_DBL x); +FIXP_DBL fixp_atan2(FIXP_DBL y, FIXP_DBL x); + +FIXP_DBL fixp_cos(FIXP_DBL x, int scale); +FIXP_DBL fixp_sin(FIXP_DBL x, int scale); + +#define FIXP_COS_SIN + +#ifndef CORDIC_SINCOS + +#include "FDK_tools_rom.h" + +#define SINETAB SineTable512 +#define LD 9 + +#endif + +#ifndef FUNCTION_inline_fixp_cos_sin + +#define FUNCTION_inline_fixp_cos_sin + +/* + * Calculates coarse lookup index and sign for sine. + * Returns delta x residual. + */ +static inline FIXP_DBL fixp_sin_cos_residual_inline(FIXP_DBL x, int scale, FIXP_DBL *sine, FIXP_DBL *cosine) +{ + FIXP_DBL residual; + int s; + int shift = (31-scale-LD-1); + int ssign = 1; + int csign = 1; + + residual = fMult(x, FL2FXCONST_DBL(1.0/M_PI)); + s = ((LONG)residual) >> shift; + + residual &= ( (1<<shift) - 1 ); + residual = fMult(residual, FL2FXCONST_DBL(M_PI/4.0)) << 2; + residual <<= scale; + + /* Sine sign symmetry */ + if (s & ((1<<LD)<<1) ) { + ssign = -ssign; + } + /* Cosine sign symmetry */ + if ( (s + (1<<LD)) & ((1<<LD)<<1) ) { + csign = -csign; + } + + s = fAbs(s); + + s &= (((1<<LD)<<1)-1); /* Modulo PI */ + + if (s > (1<<LD)) { + s = ((1<<LD)<<1) - s; + } + + { + LONG sl, cl; + /* Because of packed table */ + if (s > (1<<(LD-1))) { + FIXP_STP tmp; + /* Cosine/Sine simetry for angles greater than PI/4 */ + s = (1<<LD)-s; + tmp = SINETAB[s]; + sl = (LONG)tmp.v.re; + cl = (LONG)tmp.v.im; + } else { + FIXP_STP tmp; + tmp = SINETAB[s]; + sl = (LONG)tmp.v.im; + cl = (LONG)tmp.v.re; + } + +#ifdef SINETABLE_16BIT + *sine = (FIXP_DBL)((sl * ssign) << (DFRACT_BITS-FRACT_BITS)); + *cosine = (FIXP_DBL)((cl * csign) << (DFRACT_BITS-FRACT_BITS)); +#else + *sine = (FIXP_DBL)(sl * ssign); + *cosine = (FIXP_DBL)(cl * csign); +#endif + } + + return residual; +} + +/** + * \brief Calculate cosine and sine value each of 2 angles different angle values. + * \param x1 first angle value + * \param x2 second angle value + * \param scale exponent of x1 and x2 + * \param out pointer to 4 FIXP_DBL locations, were the values cos(x1), sin(x1), cos(x2), sin(x2) + * will be stored into. + */ +static inline void inline_fixp_cos_sin (FIXP_DBL x1, FIXP_DBL x2, const int scale, FIXP_DBL *out) +{ + FIXP_DBL residual, error0, error1, sine, cosine; + residual = fixp_sin_cos_residual_inline(x1, scale, &sine, &cosine); + error0 = fMultDiv2(sine, residual); + error1 = fMultDiv2(cosine, residual); + *out++ = cosine - (error0<<1); + *out++ = sine + (error1<<1); + + residual = fixp_sin_cos_residual_inline(x2, scale, &sine, &cosine); + error0 = fMultDiv2(sine, residual); + error1 = fMultDiv2(cosine, residual); + *out++ = cosine - (error0<<1); + *out++ = sine + (error1<<1); +} +#endif + diff --git a/libFDK/include/abs.h b/libFDK/include/abs.h new file mode 100644 index 0000000..69b6be3 --- /dev/null +++ b/libFDK/include/abs.h @@ -0,0 +1,59 @@ +/*************************** Fraunhofer IIS FDK Tools *********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Lohwasser + Description: fixed point abs definitions + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#if !defined(__ABS_H__) +#define __ABS_H__ + + +#if defined(__mips__) /* cppp replaced: elif */ +#include "mips/abs_mips.h" + +#elif defined(__x86__) /* cppp replaced: elif */ +#include "x86/abs_x86.h" + +#endif /* all cores */ + +/************************************************************************* + ************************************************************************* + Software fallbacks for missing functions +************************************************************************** +**************************************************************************/ + +#if !defined(FUNCTION_fixabs_D) +inline FIXP_DBL fixabs_D(FIXP_DBL x) { return ((x) > (FIXP_DBL)(0)) ? (x) : -(x) ; } +#endif + +#if !defined(FUNCTION_fixabs_I) +inline INT fixabs_I(INT x) { return ((x) > (INT)(0)) ? (x) : -(x) ; } +#endif + +#if !defined(FUNCTION_fixabs_S) +inline FIXP_SGL fixabs_S(FIXP_SGL x) { return ((x) > (FIXP_SGL)(0)) ? (x) : -(x) ; } +#endif + +#endif /* __ABS_H__ */ diff --git a/libFDK/include/arm/clz_arm.h b/libFDK/include/arm/clz_arm.h new file mode 100644 index 0000000..d3c3e04 --- /dev/null +++ b/libFDK/include/arm/clz_arm.h @@ -0,0 +1,59 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +#if defined(__arm__) + +#if defined(__GNUC__) && defined(__ARM_ARCH_5TE__) /* cppp replaced: elif */ + /* ARM gcc*/ + + #define FUNCTION_fixnormz_D + #define FUNCTION_fixnorm_D + + inline INT fixnormz_D(LONG value) + { + INT result; + asm("clz %0, %1 ": "=r"(result) : "r"(value) ); + return result; + } + + inline INT fixnorm_D(LONG value) + { + INT result; + if (value < 0) { + value = ~value; + } + if (value == 0) { + return 0; + } + result = fixnormz_D(value); + return result - 1; + } + +#endif /* arm toolchain */ + +#endif /* __arm__ */ + diff --git a/libFDK/include/arm/cplx_mul.h b/libFDK/include/arm/cplx_mul.h new file mode 100644 index 0000000..dba2a9f --- /dev/null +++ b/libFDK/include/arm/cplx_mul.h @@ -0,0 +1,153 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + + +#if defined(__arm__) && defined(__GNUC__) /* cppp replaced: elif */ + +#if defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_6__) + #define FUNCTION_cplxMultDiv2_32x16 + #define FUNCTION_cplxMultDiv2_32x16X2 + //#define FUNCTION_cplxMult_32x16 + //#define FUNCTION_cplxMult_32x16X2 +#endif + +#define FUNCTION_cplxMultDiv2_32x32X2 +//#define FUNCTION_cplxMult_32x32X2 + +#ifdef FUNCTION_cplxMultDiv2_32x16 +inline void cplxMultDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_SPK wpk ) +{ + LONG tmp1,tmp2; + const LONG w = wpk.w; + + asm("smulwt %0, %3, %4;\n" + "rsb %1,%0,#0;\n" + "smlawb %0, %2, %4, %1;\n" + "smulwt %1, %2, %4;\n" + "smlawb %1, %3, %4, %1;\n" + : "=&r"(tmp1), "=&r"(tmp2) + : "r"(a_Re), "r"(a_Im), "r"(w) + ); + + *c_Re = tmp1; + *c_Im = tmp2; +} +#endif /* FUNCTION_cplxMultDiv2_32x16 */ + +#ifdef FUNCTION_cplxMultDiv2_32x16X2 +inline void cplxMultDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_SGL b_Re, + const FIXP_SGL b_Im) +{ + LONG tmp1, tmp2; + + asm("smulwb %0, %3, %5;\n" /* %7 = -a_Im * b_Im */ + "rsb %1,%0,#0;\n" + "smlawb %0, %2, %4, %1;\n" /* tmp1 = a_Re * b_Re - a_Im * b_Im */ + "smulwb %1, %2, %5;\n" /* %7 = a_Re * b_Im */ + "smlawb %1, %3, %4, %1;\n" /* tmp2 = a_Im * b_Re + a_Re * b_Im */ + : "=&r"(tmp1), "=&r"(tmp2) + : "r"(a_Re), "r"(a_Im), "r"(b_Re), "r"(b_Im) + ); + + *c_Re = tmp1; + *c_Im = tmp2; +} +#endif /* FUNCTION_cplxMultDiv2_32x16X2 */ + +#ifdef FUNCTION_cplxMultAddDiv2_32x16X2 +inline void cplxMultAddDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_SGL b_Re, + const FIXP_SGL b_Im) +{ + LONG tmp1, tmp2; + + asm("smulwb %0, %3, %5;\n" + "rsb %1,%0,#0;\n" + "smlawb %0, %2, %4, %1;\n" + "smulwb %1, %2, %5;\n" + "smlawb %1, %3, %4, %1;\n" + : "=&r"(tmp1), "=&r"(tmp2) + : "r"(a_Re), "r"(a_Im), "r"(b_Re), "r"(b_Im) + ); + + *c_Re += tmp1; + *c_Im += tmp2; +} +#endif /* FUNCTION_cplxMultAddDiv2_32x16X2 */ + + +#ifdef FUNCTION_cplxMultDiv2_32x32X2 +inline void cplxMultDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_DBL b_Re, + const FIXP_DBL b_Im) +{ + LONG tmp1, tmp2; + +#ifdef __ARM_ARCH_6__ + asm( + "smmul %0, %2, %4;\n" /* tmp1 = a_Re * b_Re */ + "smmls %0, %3, %5, %0;\n" /* tmp1 -= a_Im * b_Im */ + "smmul %1, %2, %5;\n" /* tmp2 = a_Re * b_Im */ + "smmla %1, %3, %4, %1;\n" /* tmp2 += a_Im * b_Re */ + : "=&r"(tmp1), "=&r"(tmp2) + : "r"(a_Re), "r"(a_Im), "r"(b_Re), "r"(b_Im) + : "r0" + ); +#else + LONG discard; + asm( + "smull %2, %0, %7, %6;\n" /* tmp1 = -a_Im * b_Im */ + "smlal %2, %0, %3, %5;\n" /* tmp1 += a_Re * b_Re */ + "smull %2, %1, %3, %6;\n" /* tmp2 = a_Re * b_Im */ + "smlal %2, %1, %4, %5;\n" /* tmp2 += a_Im * b_Re */ + : "=&r"(tmp1), "=&r"(tmp2), "=&r"(discard) + : "r"(a_Re), "r"(a_Im), "r"(b_Re), "r"(b_Im), "r"(-a_Im) + ); + #endif + *c_Re = tmp1; + *c_Im = tmp2; +} +#endif /* FUNCTION_cplxMultDiv2_32x32X2 */ + + +#endif + diff --git a/libFDK/include/arm/fixmadd_arm.h b/libFDK/include/arm/fixmadd_arm.h new file mode 100644 index 0000000..15308f7 --- /dev/null +++ b/libFDK/include/arm/fixmadd_arm.h @@ -0,0 +1,97 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +#if defined(__arm__) + + /* ############################################################################# */ + #if defined(__GNUC__) && defined(__arm__) && !defined(__SYMBIAN32__) /* cppp replaced: elif */ + /* ############################################################################# */ + /* ARM GNU GCC */ + + #define FUNCTION_fixmadddiv2_DD + + #ifdef __ARM_ARCH_6__ + inline FIXP_DBL fixmadddiv2_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) { + INT result; + asm ("smmla %0, %1, %2, %3;\n" + : "=r" (result) + : "r" (a), "r" (b), "r"(x) ); + return result ; + } + #define FUNCTION_fixmsubdiv2_DD + inline FIXP_DBL fixmsubdiv2_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) { + INT result; + asm ("smmls %0, %1, %2, %3;\n" + : "=r" (result) + : "r" (a), "r" (b), "r"(x) ); + return result ; + } + #else /* __ARM_ARCH_6__ */ + inline FIXP_DBL fixmadddiv2_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) { + INT discard, result = x; + asm ("smlal %0, %1, %2, %3;\n" + : "=r" (discard), "+r" (result) + : "r" (a), "r" (b) ); + return result ; + } + #endif /* __ARM_ARCH_6__ */ + + #if defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_6__) + + #define FUNCTION_fixmadddiv2_DS + + inline FIXP_DBL fixmadddiv2_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) { + INT result; + asm("smlawb %0, %1, %2, %3 " + : "=r" (result) + : "r" (a), "r" (b), "r" (x) ); + return result ; + } + + #endif /* defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_6__) */ + + #define FUNCTION_fixmadddiv2BitExact_DD + #define fixmadddiv2BitExact_DD(a, b, c) fixmadddiv2_DD(a, b, c) + + #define FUNCTION_fixmsubdiv2BitExact_DD + inline FIXP_DBL fixmsubdiv2BitExact_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) { + return x - fixmuldiv2BitExact_DD(a, b); + } + + #define FUNCTION_fixmadddiv2BitExact_DS + #define fixmadddiv2BitExact_DS(a, b, c) fixmadddiv2_DS(a, b, c) + + #define FUNCTION_fixmsubdiv2BitExact_DS + inline FIXP_DBL fixmsubdiv2BitExact_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) { + return x - fixmuldiv2BitExact_DS(a, b); + } + /* ############################################################################# */ + #endif /* toolchain */ + /* ############################################################################# */ + +#endif /* __arm__ */ + diff --git a/libFDK/include/arm/fixmul_arm.h b/libFDK/include/arm/fixmul_arm.h new file mode 100644 index 0000000..8cc448d --- /dev/null +++ b/libFDK/include/arm/fixmul_arm.h @@ -0,0 +1,79 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +#if defined(__arm__) + +#if defined(__GNUC__) && defined(__arm__) /* cppp replaced: elif */ +/* ARM with GNU compiler */ + +#define FUNCTION_fixmuldiv2_DD + +#define FUNCTION_fixmuldiv2BitExact_DD +#define fixmuldiv2BitExact_DD(a,b) fixmuldiv2_DD(a,b) +#define FUNCTION_fixmulBitExact_DD +#define fixmulBitExact_DD(a,b) fixmul_DD(a,b) + +#define FUNCTION_fixmuldiv2BitExact_DS +#define fixmuldiv2BitExact_DS(a,b) fixmuldiv2_DS(a,b) + +#define FUNCTION_fixmulBitExact_DS +#define fixmulBitExact_DS(a,b) fixmul_DS(a,b) + +#if defined(__ARM_ARCH_6__) || defined(__TARGET_ARCH_7E_M) +inline INT fixmuldiv2_DD (const INT a, const INT b) +{ + INT result ; + __asm__ ("smmul %0, %1, %2" : "=r" (result) + : "r" (a), "r" (b)) ; + return result ; +} +#else +inline INT fixmuldiv2_DD (const INT a, const INT b) +{ + INT discard, result ; + __asm__ ("smull %0, %1, %2, %3" : "=&r" (discard), "=r" (result) + : "r" (a), "r" (b)) ; + return result ; +} +#endif + +#if defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_6__) +#define FUNCTION_fixmuldiv2_SD +inline INT fixmuldiv2_SD (const SHORT a, const INT b) +{ + INT result ; + __asm__ ("smulwb %0, %1, %2" + : "=r" (result) + : "r" (b), "r" (a)) ; + return result ; +} +#endif + +#endif /* defined(__GNUC__) && defined(__arm__) */ + +#endif /* __arm__ */ + diff --git a/libFDK/include/arm/scale.h b/libFDK/include/arm/scale.h new file mode 100644 index 0000000..11d18fb --- /dev/null +++ b/libFDK/include/arm/scale.h @@ -0,0 +1,90 @@ +/******************************** Fraunhofer IIS *************************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id: + Author(s): + Description: ARM scaling operations + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#if defined(__GNUC__) /* GCC Compiler */ /* cppp replaced: elif */ + +#if defined(__ARM_ARCH_6__) + +inline static INT shiftRightSat(INT src, int scale) +{ + INT result; + asm( + "ssat %0,%2,%0;\n" + + : "=&r"(result) + : "r"(src>>scale), "M"(SAMPLE_BITS) + ); + + return result; +} + + #define SATURATE_INT_PCM_RIGHT_SHIFT(src, scale) shiftRightSat(src, scale) + +inline static INT shiftLeftSat(INT src, int scale) +{ + INT result; + asm( + "ssat %0,%2,%0;\n" + + : "=&r"(result) + : "r"(src<<scale), "M"(SAMPLE_BITS) + ); + + return result; +} + + #define SATURATE_INT_PCM_LEFT_SHIFT(src, scale) shiftLeftSat(src, scale) + +#endif /* __ARM_ARCH_6__ */ + +#endif /* compiler selection */ + +#define FUNCTION_scaleValueInPlace +inline +void scaleValueInPlace(FIXP_DBL *value, /*!< Value */ + INT scalefactor /*!< Scalefactor */ + ) +{ + INT newscale; + if ((newscale = scalefactor) >= 0) + *value <<= newscale; + else + *value >>= -newscale; +} + + + #define SATURATE_RIGHT_SHIFT(src, scale, dBits) \ + ( (((LONG)(src) ^ ((LONG)(src) >> (DFRACT_BITS-1)))>>(scale)) > (LONG)(((1U)<<((dBits)-1))-1)) \ + ? ((LONG)(src) >> (DFRACT_BITS-1)) ^ (LONG)(((1U)<<((dBits)-1))-1) \ + : ((LONG)(src) >> (scale)) + + #define SATURATE_LEFT_SHIFT(src, scale, dBits) \ + ( ((LONG)(src) ^ ((LONG)(src) >> (DFRACT_BITS-1))) > ((LONG)(((1U)<<((dBits)-1))-1) >> (scale)) ) \ + ? ((LONG)(src) >> (DFRACT_BITS-1)) ^ (LONG)(((1U)<<((dBits)-1))-1) \ + : ((LONG)(src) << (scale)) + diff --git a/libFDK/include/arm/scramble.h b/libFDK/include/arm/scramble.h new file mode 100644 index 0000000..9143155 --- /dev/null +++ b/libFDK/include/arm/scramble.h @@ -0,0 +1,98 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: bitreversal of input data + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + + + +#if defined(FUNCTION_scramble) +#if defined(__GNUC__) /* cppp replaced: elif */ + +#define FUNCTION_scramble + +#if defined(__ARM_ARCH_5TE__) +#define USE_LDRD_STRD /* LDRD requires 8 byte data alignment. */ +#endif + +inline void scramble(FIXP_DBL x [], INT n) { + FDK_ASSERT(!(((INT)x)&(ALIGNMENT_DEFAULT-1))); + asm("mov r2, #1;\n" /* r2(m) = 1; */ + "sub r3, %1, #1;\n" /* r3 = n-1; */ + "mov r4, #0;\n" /* r4(j) = 0; */ + +"scramble_m_loop%=:\n" /* { */ + "mov r5, %1;\n" /* r5(k) = 1; */ + +"scramble_k_loop%=:\n" /* { */ + "mov r5, r5, lsr #1;\n" /* k >>= 1; */ + "eor r4, r4, r5;\n" /* j ^=k; */ + "ands r10, r4, r5;\n" /* r10 = r4 & r5; */ + "beq scramble_k_loop%=;\n" /* } while (r10 == 0); */ + + "cmp r4, r2;\n" /* if (r4 < r2) break; */ + "bcc scramble_m_loop_end%=;\n" + +#ifdef USE_LDRD_STRD + "mov r5, r2, lsl #3;\n" /* m(r5) = r2*4*2 */ + "ldrd r10, [%0, r5];\n" /* r10 = x[r5], x7 = x[r5+1] */ + "mov r6, r4, lsl #3;\n" /* j(r6) = r4*4*2 */ + "ldrd r8, [%0, r6];\n" /* r8 = x[r6], r9 = x[r6+1]; */ + "strd r10, [%0, r6];\n" /* x[r6,r6+1] = r10,r11; */ + "strd r8, [%0, r5];\n" /* x[r5,r5+1] = r8,r9; */ +#else + "mov r5, r2, lsl #3;\n" /* m(r5) = r2*4*2 */ + "ldr r10, [%0, r5];\n" + "mov r6, r4, lsl #3;\n" /* j(r6) = r4*4*2 */ + "ldr r11, [%0, r6];\n" + + "str r10, [%0, r6];\n" + "str r11, [%0, r5];\n" + + "add r5, r5, #4;" + "ldr r10, [%0, r5];\n" + "add r6, r6, #4;" + "ldr r11, [%0, r6];\n" + "str r10, [%0, r6];\n" + "str r11, [%0, r5];\n" +#endif +"scramble_m_loop_end%=:\n" + "add r2, r2, #1;\n" /* r2++; */ + "cmp r2, r3;\n" + "bcc scramble_m_loop%=;\n" /* } while (r2(m) < r3(n-1)); */ + : + : "r"(x), "r"(n) +#ifdef USE_LDRD_STRD + : "r2","r3", "r4","r5", "r10","r11", "r8","r9", "r6" ); +#else + : "r2","r3", "r4","r5", "r10","r11", "r6" ); +#endif +} +#else +/* Force C implementation if no assembler version available. */ +#undef FUNCTION_scramble +#endif /* Toolchain selection. */ + +#endif /* defined(FUNCTION_scramble) */ diff --git a/libFDK/include/autocorr2nd.h b/libFDK/include/autocorr2nd.h new file mode 100644 index 0000000..896fc17 --- /dev/null +++ b/libFDK/include/autocorr2nd.h @@ -0,0 +1,66 @@ +/*************************** Fraunhofer IIS FDK Tools *********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Lohwasser + Description: fixed point abs definitions + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef _AUTOCORR_2ND_H +#define _AUTOCORR_2ND_H + + + +#include "common_fix.h" + +typedef struct { + FIXP_DBL r00r; + FIXP_DBL r11r; + FIXP_DBL r22r; + FIXP_DBL r01r; + FIXP_DBL r02r; + FIXP_DBL r12r; + FIXP_DBL r01i; + FIXP_DBL r02i; + FIXP_DBL r12i; + FIXP_DBL det; + int det_scale; +} ACORR_COEFS; + +#define LPC_ORDER 2 + + +INT +autoCorr2nd_real (ACORR_COEFS *ac, /*!< Pointer to autocorrelation coeffs */ + const FIXP_DBL *reBuffer, /*!< Pointer to to real part of spectrum */ + const int len /*!< Number of qmf slots */ + ); +INT +autoCorr2nd_cplx (ACORR_COEFS *ac, /*!< Pointer to autocorrelation coeffs */ + const FIXP_DBL *reBuffer, /*!< Pointer to to real part of spectrum */ + const FIXP_DBL *imBuffer, /*!< Pointer to imag part of spectrum */ + const int len /*!< Number of qmf slots */ + ); + + +#endif /* _AUTOCORR_2ND_H */ diff --git a/libFDK/include/clz.h b/libFDK/include/clz.h new file mode 100644 index 0000000..42c1c53 --- /dev/null +++ b/libFDK/include/clz.h @@ -0,0 +1,127 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (1999) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Marc Gayer + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#if !defined(__CLZ_H__) +#define __CLZ_H__ + +#include "FDK_archdef.h" +#include "machine_type.h" + +#if defined(__arm__) +#include "arm/clz_arm.h" + +#elif defined(__mips__) /* cppp replaced: elif */ +#include "mips/clz_mips.h" + +#endif /* all cores */ + + +/************************************************************************* + ************************************************************************* + Software fallbacks for missing functions. +************************************************************************** +**************************************************************************/ + +#if !defined(FUNCTION_fixnormz_S) +#ifdef FUNCTION_fixnormz_D +inline INT fixnormz_S (SHORT a) +{ + return fixnormz_D((INT)(a)); +} +#else +inline INT fixnormz_S (SHORT a) +{ + int leadingBits = 0; + a = ~a; + while(a & 0x8000) { + leadingBits++; + a <<= 1; + } + + return (leadingBits); +} +#endif +#endif + +#if !defined(FUNCTION_fixnormz_D) +inline INT fixnormz_D (LONG a) +{ + INT leadingBits = 0; + a = ~a; + while(a & 0x80000000) { + leadingBits++; + a <<= 1; + } + + return (leadingBits); +} +#endif + + +/***************************************************************************** + + functionname: fixnorm_D + description: Count leading ones or zeros of operand val for dfract/LONG INT values. + Return this value minus 1. Return 0 if operand==0. +*****************************************************************************/ +#if !defined(FUNCTION_fixnorm_S) +#ifdef FUNCTION_fixnorm_D +inline INT fixnorm_S(FIXP_SGL val) +{ + return fixnorm_D((INT)(val)); +} +#else +inline INT fixnorm_S(FIXP_SGL val) +{ + INT leadingBits = 0; + if ( val != (FIXP_SGL)0 ) { + if ( val < (FIXP_SGL)0 ) { + val = ~val; + } + leadingBits = fixnormz_S(val) - 1; + } + return (leadingBits); +} +#endif +#endif + +#if !defined(FUNCTION_fixnorm_D) +inline INT fixnorm_D(FIXP_DBL val) +{ + INT leadingBits = 0; + if ( val != (FIXP_DBL)0 ) { + if ( val < (FIXP_DBL)0 ) { + val = ~val; + } + leadingBits = fixnormz_D(val) - 1; + } + return (leadingBits); +} +#endif + +#endif /* __CLZ_H__ */ diff --git a/libFDK/include/common_fix.h b/libFDK/include/common_fix.h new file mode 100644 index 0000000..c5cbd8a --- /dev/null +++ b/libFDK/include/common_fix.h @@ -0,0 +1,324 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2002) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Lohwasser, M. Gayer + Description: Flexible fixpoint library configuration + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef _COMMON_FIX_H +#define _COMMON_FIX_H + +#include "FDK_archdef.h" +#include "machine_type.h" + +/* ***** Start of former fix.h ****** */ + +/* Configure fractional or integer arithmetic */ + #define FIX_FRACT 0 /* Define this to "1" to use fractional arithmetic simulation in class fract instead of integer arithmetic */ + /* 1 for debug with extra runtime overflow checking. */ + +/* Truncate -1.0 to -1.0 + 1/(D)FRACT_FIX_SCALE */ +//#define FRACT_TRUNC_MINUSONE + +/* Define bit sizes of integer fixpoint fractional data types */ +#define FRACT_BITS 16 /* single precision */ +#define DFRACT_BITS 32 /* double precision */ +#define ACCU_BITS 40 /* double precision plus overflow */ + +/* Fixpoint equivalent type fot PCM audio time domain data. */ +#if defined(SAMPLE_BITS) +#if (SAMPLE_BITS == DFRACT_BITS) + #define FIXP_PCM FIXP_DBL + #define FX_PCM2FX_DBL(x) ((FIXP_DBL)(x)) + #define FX_DBL2FX_PCM(x) ((INT_PCM)(x)) +#elif (SAMPLE_BITS == FRACT_BITS) + #define FIXP_PCM FIXP_SGL + #define FX_PCM2FX_DBL(x) FX_SGL2FX_DBL((FIXP_SGL)(x)) + #define FX_DBL2FX_PCM(x) FX_DBL2FX_SGL(x) +#else + #error SAMPLE_BITS different from FRACT_BITS or DFRACT_BITS not implemented! +#endif +#endif + +/* ****** End of former fix.h ****** */ + +#define SGL_MASK ((1UL<<FRACT_BITS)-1) /* 16bit: (2^16)-1 = 0xFFFF */ + +#define MAX_SHIFT_SGL (FRACT_BITS-1) /* maximum possible shift for FIXP_SGL values */ +#define MAX_SHIFT_DBL (DFRACT_BITS-1) /* maximum possible shift for FIXP_DBL values */ + +/* Scale factor from/to float/fixpoint values. DO NOT USE THESE VALUES AS SATURATION LIMITS !! */ +#define FRACT_FIX_SCALE ((INT64(1)<<(FRACT_BITS-1))) +#define DFRACT_FIX_SCALE ((INT64(1)<<(DFRACT_BITS-1))) + +/* Max and Min values for saturation purposes. DO NOT USE THESE VALUES AS SCALE VALUES !! */ +#define MAXVAL_SGL ((signed)0x00007FFF) /* this has to be synchronized to FRACT_BITS */ +#define MINVAL_SGL ((signed)0xFFFF8000) /* this has to be synchronized to FRACT_BITS */ +#define MAXVAL_DBL ((signed)0x7FFFFFFF) /* this has to be synchronized to DFRACT_BITS */ +#define MINVAL_DBL ((signed)0x80000000) /* this has to be synchronized to DFRACT_BITS */ + + +#define FX_DBL2FXCONST_SGL(val) ( ( ((((val) >> (DFRACT_BITS-FRACT_BITS-1)) + 1) > (((LONG)1<<FRACT_BITS)-1)) && ((LONG)(val) > 0) ) ? \ + (FIXP_SGL)(SHORT)(((LONG)1<<(FRACT_BITS-1))-1):(FIXP_SGL)(SHORT)((((val) >> (DFRACT_BITS-FRACT_BITS-1)) + 1) >> 1) ) + + + +#define shouldBeUnion union /* unions are possible */ + + typedef SHORT FIXP_SGL; + typedef LONG FIXP_DBL; + +/* macros for compile-time conversion of constant float values to fixedpoint */ +#define FL2FXCONST_SPC FL2FXCONST_DBL + +#ifdef FRACT_TRUNC_MINUSONE +#define MINVAL_DBL_CONST MINVAL_DBL+1 +#define MINVAL_SGL_CONST MINVAL_SGL+1 +#else +#define MINVAL_DBL_CONST MINVAL_DBL +#define MINVAL_SGL_CONST MINVAL_SGL +#endif + +#define FL2FXCONST_SGL(val) \ +(FIXP_SGL)( ( (val) >= 0) ? \ +((( (double)(val) * (FRACT_FIX_SCALE) + 0.5 ) >= (double)(MAXVAL_SGL) ) ? (SHORT)(MAXVAL_SGL) : (SHORT)( (double)(val) * (double)(FRACT_FIX_SCALE) + 0.5)) : \ +((( (double)(val) * (FRACT_FIX_SCALE) - 0.5) <= (double)(MINVAL_SGL_CONST) ) ? (SHORT)(MINVAL_SGL_CONST) : (SHORT)( (double)(val) * (double)(FRACT_FIX_SCALE) - 0.5)) ) + +#define FL2FXCONST_DBL(val) \ +(FIXP_DBL)( ( (val) >= 0) ? \ +((( (double)(val) * (DFRACT_FIX_SCALE) + 0.5 ) >= (double)(MAXVAL_DBL) ) ? (LONG)(MAXVAL_DBL) : (LONG)( (double)(val) * (double)(DFRACT_FIX_SCALE) + 0.5)) : \ +((( (double)(val) * (DFRACT_FIX_SCALE) - 0.5) <= (double)(MINVAL_DBL_CONST) ) ? (LONG)(MINVAL_DBL_CONST) : (LONG)( (double)(val) * (double)(DFRACT_FIX_SCALE) - 0.5)) ) + +/* macros for runtime conversion of float values to integer fixedpoint. NO OVERFLOW CHECK!!! */ +#define FL2FX_SPC FL2FX_DBL +#define FL2FX_SGL(val) ( (val)>0.0f ? (SHORT)( (val)*(float)(FRACT_FIX_SCALE)+0.5f ) : (SHORT)( (val)*(float)(FRACT_FIX_SCALE)-0.5f ) ) +#define FL2FX_DBL(val) ( (val)>0.0f ? (LONG)( (val)*(float)(DFRACT_FIX_SCALE)+0.5f ) : (LONG)( (val)*(float)(DFRACT_FIX_SCALE)-0.5f ) ) + +/* macros for runtime conversion of fixedpoint values to other fixedpoint. NO ROUNDING!!! */ +#define FX_ACC2FX_SGL(val) ((FIXP_SGL)((val)>>(ACCU_BITS-FRACT_BITS))) +#define FX_ACC2FX_DBL(val) ((FIXP_DBL)((val)>>(ACCU_BITS-DFRACT_BITS))) +#define FX_SGL2FX_ACC(val) ((FIXP_ACC)((LONG)(val)<<(ACCU_BITS-FRACT_BITS))) +#define FX_SGL2FX_DBL(val) ((FIXP_DBL)((LONG)(val)<<(DFRACT_BITS-FRACT_BITS))) +#define FX_DBL2FX_SGL(val) ((FIXP_SGL)((val)>>(DFRACT_BITS-FRACT_BITS))) + +/* ############################################################# */ + +/* macros for runtime conversion of integer fixedpoint values to float. */ +/* This is just for temporary use and should not be required in a final version! */ + +/* #define FX_DBL2FL(val) ((float)(pow(2.,-31.)*(float)val)) */ /* version #1 */ +#define FX_DBL2FL(val) ((float)((double)(val)/(double)DFRACT_FIX_SCALE)) /* version #2 - identical to class dfract cast from dfract to float */ + +/* ############################################################# */ +#include "fixmul.h" + +FDK_INLINE LONG fMult(SHORT a, SHORT b) { return fixmul_SS(a, b); } +FDK_INLINE LONG fMult(SHORT a, LONG b) { return fixmul_SD(a, b); } +FDK_INLINE LONG fMult(LONG a, SHORT b) { return fixmul_DS(a, b); } +FDK_INLINE LONG fMult(LONG a, LONG b) { return fixmul_DD(a, b); } +FDK_INLINE LONG fPow2(LONG a) { return fixpow2_D(a); } +FDK_INLINE LONG fPow2(SHORT a) { return fixpow2_S(a); } + +FDK_INLINE INT fMultI(LONG a, SHORT b) { return ( (INT)(((1<<(FRACT_BITS-2)) + + fixmuldiv2_DD(a,((INT)b<<FRACT_BITS)))>>(FRACT_BITS-1)) ); } + +FDK_INLINE INT fMultIfloor(LONG a, INT b) { return ( (INT)((1 + + fixmuldiv2_DD(a,(b<<FRACT_BITS))) >> (FRACT_BITS-1)) ); } + +FDK_INLINE INT fMultIceil(LONG a, INT b) { return ( (INT)(((INT)0x7fff + + fixmuldiv2_DD(a,(b<<FRACT_BITS))) >> (FRACT_BITS-1)) ); } + +FDK_INLINE LONG fMultDiv2(SHORT a, SHORT b) { return fixmuldiv2_SS(a, b); } +FDK_INLINE LONG fMultDiv2(SHORT a, LONG b) { return fixmuldiv2_SD(a, b); } +FDK_INLINE LONG fMultDiv2(LONG a, SHORT b) { return fixmuldiv2_DS(a, b); } +FDK_INLINE LONG fMultDiv2(LONG a, LONG b) { return fixmuldiv2_DD(a, b); } +FDK_INLINE LONG fPow2Div2(LONG a) { return fixpow2div2_D(a); } +FDK_INLINE LONG fPow2Div2(SHORT a) { return fixpow2div2_S(a); } + +FDK_INLINE LONG fMultDiv2BitExact(LONG a, LONG b) { return fixmuldiv2BitExact_DD(a, b); } +FDK_INLINE LONG fMultDiv2BitExact(SHORT a, LONG b) { return fixmuldiv2BitExact_SD(a, b); } +FDK_INLINE LONG fMultDiv2BitExact(LONG a, SHORT b) { return fixmuldiv2BitExact_DS(a, b); } +FDK_INLINE LONG fMultBitExact(LONG a, LONG b) { return fixmulBitExact_DD(a, b); } +FDK_INLINE LONG fMultBitExact(SHORT a, LONG b) { return fixmulBitExact_SD(a, b); } +FDK_INLINE LONG fMultBitExact(LONG a, SHORT b) { return fixmulBitExact_DS(a, b); } + +/* ******************************************************************************** */ +#include "abs.h" + +FDK_INLINE FIXP_DBL fAbs(FIXP_DBL x) + { return fixabs_D(x); } +FDK_INLINE FIXP_SGL fAbs(FIXP_SGL x) + { return fixabs_S(x); } + +/* workaround for TI C6x compiler but not for TI ARM9E compiler */ +#if (!defined(__TI_COMPILER_VERSION__) || defined(__TI_TMS470_V5__)) && !defined(__x86_64__) +FDK_INLINE INT fAbs(INT x) + { return fixabs_I(x); } +#endif + +/* ******************************************************************************** */ + +#include "clz.h" + +FDK_INLINE INT fNormz(FIXP_DBL x) + { return fixnormz_D(x); } +FDK_INLINE INT fNormz(FIXP_SGL x) + { return fixnormz_S(x); } +FDK_INLINE INT fNorm(FIXP_DBL x) + { return fixnorm_D(x); } +FDK_INLINE INT fNorm(FIXP_SGL x) + { return fixnorm_S(x); } + + +/* ******************************************************************************** */ +/* ******************************************************************************** */ +/* ******************************************************************************** */ + +#include "clz.h" +#define fixp_abs(x) fAbs(x) +#define fixMin(a,b) fMin(a,b) +#define fixMax(a,b) fMax(a,b) +#define CntLeadingZeros(x) fixnormz_D(x) +#define CountLeadingBits(x) fixnorm_D(x) + +#include "fixmadd.h" + +/* y = (x+0.5*a*b) */ +FDK_INLINE FIXP_DBL fMultAddDiv2(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b) + { return fixmadddiv2_DD(x, a, b); } +FDK_INLINE FIXP_DBL fMultAddDiv2(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b) + { return fixmadddiv2_SD(x, a, b); } +FDK_INLINE FIXP_DBL fMultAddDiv2(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b) + { return fixmadddiv2_DS(x, a, b); } +FDK_INLINE FIXP_DBL fMultAddDiv2(FIXP_DBL x, FIXP_SGL a, FIXP_SGL b) + { return fixmadddiv2_SS(x, a, b); } + +FDK_INLINE FIXP_DBL fPow2AddDiv2(FIXP_DBL x, FIXP_DBL a) + { return fixpadddiv2_D(x, a); } +FDK_INLINE FIXP_DBL fPow2AddDiv2(FIXP_DBL x, FIXP_SGL a) + { return fixpadddiv2_S(x, a); } + + +/* y = 2*(x+0.5*a*b) = (2x+a*b) */ +FDK_INLINE FIXP_DBL fMultAdd(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b) + { return fixmadd_DD(x, a, b); } +inline FIXP_DBL fMultAdd(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b) + { return fixmadd_SD(x, a, b); } +inline FIXP_DBL fMultAdd(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b) + { return fixmadd_DS(x, a, b); } +inline FIXP_DBL fMultAdd(FIXP_DBL x, FIXP_SGL a, FIXP_SGL b) + { return fixmadd_SS(x, a, b); } + +inline FIXP_DBL fPow2Add(FIXP_DBL x, FIXP_DBL a) + { return fixpadd_D(x, a); } +inline FIXP_DBL fPow2Add(FIXP_DBL x, FIXP_SGL a) + { return fixpadd_S(x, a); } + + +/* y = (x-0.5*a*b) */ +inline FIXP_DBL fMultSubDiv2(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b) + { return fixmsubdiv2_DD(x, a, b); } +inline FIXP_DBL fMultSubDiv2(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b) + { return fixmsubdiv2_SD(x, a, b); } +inline FIXP_DBL fMultSubDiv2(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b) + { return fixmsubdiv2_DS(x, a, b); } +inline FIXP_DBL fMultSubDiv2(FIXP_DBL x, FIXP_SGL a, FIXP_SGL b) + { return fixmsubdiv2_SS(x, a, b); } + +/* y = 2*(x-0.5*a*b) = (2*x-a*b) */ +FDK_INLINE FIXP_DBL fMultSub(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b) + { return fixmsub_DD(x, a, b); } +inline FIXP_DBL fMultSub(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b) + { return fixmsub_SD(x, a, b); } +inline FIXP_DBL fMultSub(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b) + { return fixmsub_DS(x, a, b); } +inline FIXP_DBL fMultSub(FIXP_DBL x, FIXP_SGL a, FIXP_SGL b) + { return fixmsub_SS(x, a, b); } + +FDK_INLINE FIXP_DBL fMultAddDiv2BitExact(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b) + { return fixmadddiv2BitExact_DD(x, a, b); } +FDK_INLINE FIXP_DBL fMultAddDiv2BitExact(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b) + { return fixmadddiv2BitExact_SD(x, a, b); } +FDK_INLINE FIXP_DBL fMultAddDiv2BitExact(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b) + { return fixmadddiv2BitExact_DS(x, a, b); } +FDK_INLINE FIXP_DBL fMultSubDiv2BitExact(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b) + { return fixmsubdiv2BitExact_DD(x, a, b); } +FDK_INLINE FIXP_DBL fMultSubDiv2BitExact(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b) + { return fixmsubdiv2BitExact_SD(x, a, b); } +FDK_INLINE FIXP_DBL fMultSubDiv2BitExact(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b) + { return fixmsubdiv2BitExact_DS(x, a, b); } + +#include "fixminmax.h" + +FDK_INLINE FIXP_DBL fMin(FIXP_DBL a, FIXP_DBL b) + { return fixmin_D(a,b); } +FDK_INLINE FIXP_DBL fMax(FIXP_DBL a, FIXP_DBL b) + { return fixmax_D(a,b); } + +FDK_INLINE FIXP_SGL fMin(FIXP_SGL a, FIXP_SGL b) + { return fixmin_S(a,b); } +FDK_INLINE FIXP_SGL fMax(FIXP_SGL a, FIXP_SGL b) + { return fixmax_S(a,b); } + +/* workaround for TI C6x compiler but not for TI ARM9E */ +#if ((!defined(__TI_COMPILER_VERSION__) || defined(__TI_TMS470_V5__)) && !defined(__x86_64__)) || (FIX_FRACT == 1) +FDK_INLINE INT fMax(INT a, INT b) + { return fixmax_I(a,b); } +FDK_INLINE INT fMin(INT a, INT b) + { return fixmin_I(a,b); } +#endif + +inline UINT fMax(UINT a, UINT b) + { return fixmax_UI(a,b); } +inline UINT fMin(UINT a, UINT b) + { return fixmin_UI(a,b); } + +/* Complex data types */ +typedef shouldBeUnion { + /* vector representation for arithmetic */ + struct { + FIXP_SGL re; + FIXP_SGL im; + } v; + /* word representation for memory move */ + LONG w; +} FIXP_SPK; + +typedef shouldBeUnion { + /* vector representation for arithmetic */ + struct { + FIXP_DBL re; + FIXP_DBL im; + } v; + /* word representation for memory move */ + INT64 w; +} FIXP_DPK; + +#include "fixmul.h" +#include "fixmadd.h" +#include "cplx_mul.h" +#include "scale.h" +#include "fixpoint_math.h" + +#endif diff --git a/libFDK/include/cplx_mul.h b/libFDK/include/cplx_mul.h new file mode 100644 index 0000000..42064d4 --- /dev/null +++ b/libFDK/include/cplx_mul.h @@ -0,0 +1,207 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#include "common_fix.h" + +#if !defined(__CPLX_Mult_H__) +#define __CPLX_Mult_H__ + +#if defined(__CC_ARM) || defined(__arm__) || defined(_M_ARM) /* cppp replaced: elif */ +#include "arm/cplx_mul.h" + +#elif defined(__GNUC__) && defined(__mips__) /* cppp replaced: elif */ +#include "mips/cplx_mul.h" + +#endif /* #if defined all cores: bfin, arm, etc. */ + +/* ############################################################################# */ + +/* Fallback generic implementations */ + +#if !defined(FUNCTION_cplxMultDiv2_32x16X2) +#define FUNCTION_cplxMultDiv2_32x16X2 + +inline void cplxMultDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_SGL b_Re, + const FIXP_SGL b_Im) +{ + *c_Re = fMultDiv2(a_Re,b_Re) - fMultDiv2(a_Im,b_Im); + *c_Im = fMultDiv2(a_Re,b_Im) + fMultDiv2(a_Im,b_Re); +} +#endif + +#if !defined(FUNCTION_cplxMultDiv2_32x16) +#define FUNCTION_cplxMultDiv2_32x16 + +inline void cplxMultDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_SPK w ) +{ + cplxMultDiv2(c_Re, c_Im, a_Re, a_Im, w.v.re, w.v.im); +} +#endif + +#if !defined(FUNCTION_cplxMultAddDiv2_32x16X2) +#define FUNCTION_cplxMultAddDiv2_32x16X2 + +inline void cplxMultAddDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_SGL b_Re, + const FIXP_SGL b_Im) +{ + *c_Re += fMultDiv2(a_Re,b_Re) - fMultDiv2(a_Im,b_Im); + *c_Im += fMultDiv2(a_Re,b_Im) + fMultDiv2(a_Im,b_Re); +} +#endif + +#if !defined(FUNCTION_cplxMultSubDiv2_32x16X2) +#define FUNCTION_cplxMultSubDiv2_32x16X2 + +inline void cplxMultSubDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_SGL b_Re, + const FIXP_SGL b_Im) +{ + *c_Re -= fMultDiv2(a_Re,b_Re) - fMultDiv2(a_Im,b_Im); + *c_Im -= fMultDiv2(a_Re,b_Im) + fMultDiv2(a_Im,b_Re); +} +#endif + +#if !defined(FUNCTION_cplxMultDiv2_32x32X2) +#define FUNCTION_cplxMultDiv2_32x32X2 + +inline void cplxMultDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_DBL b_Re, + const FIXP_DBL b_Im) +{ + *c_Re = fMultDiv2(a_Re,b_Re) - fMultDiv2(a_Im,b_Im); + *c_Im = fMultDiv2(a_Re,b_Im) + fMultDiv2(a_Im,b_Re); +} +#endif + +#if !defined(FUNCTION_cplxMultDiv2_32x32) +#define FUNCTION_cplxMultDiv2_32x32 + +inline void cplxMultDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_DPK w) +{ + cplxMultDiv2(c_Re, c_Im, a_Re, a_Im, w.v.re, w.v.im); +} +#endif + +#if !defined(FUNCTION_cplxMultSubDiv2_32x32X2) +#define FUNCTION_cplxMultSubDiv2_32x32X2 + +inline void cplxMultSubDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_DBL b_Re, + const FIXP_DBL b_Im) +{ + *c_Re -= fMultDiv2(a_Re,b_Re) - fMultDiv2(a_Im,b_Im); + *c_Im -= fMultDiv2(a_Re,b_Im) + fMultDiv2(a_Im,b_Re); +} +#endif + +/* ############################################################################# */ + +#if !defined(FUNCTION_cplxMult_32x16X2) +#define FUNCTION_cplxMult_32x16X2 + +inline void cplxMult( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_SGL b_Re, + const FIXP_SGL b_Im) +{ + *c_Re = fMult(a_Re,b_Re) - fMult(a_Im,b_Im); + *c_Im = fMult(a_Re,b_Im) + fMult(a_Im,b_Re); +} +#endif + +#if !defined(FUNCTION_cplxMult_32x16) +#define FUNCTION_cplxMult_32x16 + +inline void cplxMult( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_SPK w ) +{ + cplxMult(c_Re, c_Im, a_Re, a_Im, w.v.re, w.v.im); +} +#endif + +#if !defined(FUNCTION_cplxMult_32x32X2) +#define FUNCTION_cplxMult_32x32X2 + +inline void cplxMult( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_DBL b_Re, + const FIXP_DBL b_Im) +{ + *c_Re = fMult(a_Re,b_Re) - fMult(a_Im,b_Im); + *c_Im = fMult(a_Re,b_Im) + fMult(a_Im,b_Re); +} +#endif + +#if !defined(FUNCTION_cplxMult_32x32) +#define FUNCTION_cplxMult_32x32 +inline void cplxMult( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + const FIXP_DBL a_Re, + const FIXP_DBL a_Im, + const FIXP_DPK w) +{ + cplxMult(c_Re, c_Im, a_Re, a_Im, w.v.re, w.v.im); +} +#endif + +/* ############################################################################# */ + +#endif /* __CPLX_Mult_H__ */ + diff --git a/libFDK/include/dct.h b/libFDK/include/dct.h new file mode 100644 index 0000000..3ffacf5 --- /dev/null +++ b/libFDK/include/dct.h @@ -0,0 +1,85 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2009) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: Library functions to calculate standard DCTs. This will most + likely be replaced by hand-optimized functions for the specific + target processor. + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef __dct_H +#define __dct_H + + + +#include "common_fix.h" + +/** + * \brief Calculate DCT type II of given length. The DCT IV is + * calculated by a complex FFT, with some pre and post twiddeling. + * A factor of sqrt(2/(N-1)) is NOT applied. + * \param pDat pointer to input/output data (in place processing). + * \param size size of pDat. + * \param pDat_e pointer to an integer containing the exponent of the data + * referenced by pDat. The exponent is updated accordingly. + */ +void dct_II(FIXP_DBL *pDat, FIXP_DBL *tmp, int size, int *pDat_e); + +/** + * \brief Calculate DCT type III of given length. The DCT IV is + * calculated by a complex FFT, with some pre and post twiddeling. + * Note that the factor 0.5 for the sum term x[0] is 1.0 instead of 0.5. + * A factor of sqrt(2/N) is NOT applied. + * \param pDat pointer to input/output data (in place processing). + * \param size size of pDat. + * \param pDat_e pointer to an integer containing the exponent of the data + * referenced by pDat. The exponent is updated accordingly. + */ +void dct_III(FIXP_DBL *pDat, FIXP_DBL *tmp, int size, int *pDat_e); + +/** + * \brief Calculate DCT type IV of given length. The DCT IV is + * calculated by a complex FFT, with some pre and post twiddeling. + * A factor of sqrt(2/N) is NOT applied. + * \param pDat pointer to input/output data (in place processing). + * \param size size of pDat. + * \param pDat_e pointer to an integer containing the exponent of the data + * referenced by pDat. The exponent is updated accordingly. + */ +void dct_IV(FIXP_DBL *pDat,int size, int *pDat_e); + +/** + * \brief Calculate DST type IV of given length. The DST IV is + * calculated by a complex FFT, with some pre and post twiddeling. + * A factor of sqrt(2/N) is NOT applied. + * \param pDat pointer to input/output data (in place processing). + * \param size size of pDat. + * \param pDat_e pointer to an integer containing the exponent of the data + * referenced by pDat. The exponent is updated accordingly. + */ +void dst_IV(FIXP_DBL *pDat,int size, int *pDat_e); + + + +#endif diff --git a/libFDK/include/fft.h b/libFDK/include/fft.h new file mode 100644 index 0000000..95e7a05 --- /dev/null +++ b/libFDK/include/fft.h @@ -0,0 +1,191 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2001) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Josef Hoepfl, DSP Solutions + Description: Fix point FFT + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef __FFT_H__ +#define __FFT_H__ + +#include "common_fix.h" + +/** + * \brief Perform an inplace complex valued FFT of length 2^n + * + * \param length Length of the FFT to be calculated. + * \param pInput Input/Output data buffer. The input data must have at least 1 bit scale headroom. + * The values are interleaved, real/imag pairs. + * \param scalefactor Pointer to an INT, which contains the current scale of the input data, + * which is updated according to the FFT scale. + */ +void fft(int length, FIXP_DBL *pInput, INT *scalefactor); + +/** + * \brief Perform an inplace complex valued IFFT of length 2^n + * + * \param length Length of the FFT to be calculated. + * \param pInput Input/Output data buffer. The input data must have at least 1 bit scale headroom. + * The values are interleaved, real/imag pairs. + * \param scalefactor Pointer to an INT, which contains the current scale of the input data, + * which is updated according to the IFFT scale. + */ +void ifft(int length, FIXP_DBL *pInput, INT *scalefactor); + + +/* + * Frequently used and fixed short length FFTs. + */ + +LNK_SECTION_CODE_L1 +static void FORCEINLINE fft_4(FIXP_DBL *x) +{ + FIXP_DBL a00, a10, a20, a30, tmp0, tmp1; + + a00 = (x[0] + x[4])>>1; /* Re A + Re B */ + a10 = (x[2] + x[6])>>1; /* Re C + Re D */ + a20 = (x[1] + x[5])>>1; /* Im A + Im B */ + a30 = (x[3] + x[7])>>1; /* Im C + Im D */ + + x[0] = a00 + a10; /* Re A' = Re A + Re B + Re C + Re D */ + x[1] = a20 + a30; /* Im A' = Im A + Im B + Im C + Im D */ + + tmp0 = a00 - x[4]; /* Re A - Re B */ + tmp1 = a20 - x[5]; /* Im A - Im B */ + + x[4] = a00 - a10; /* Re C' = Re A + Re B - Re C - Re D */ + x[5] = a20 - a30; /* Im C' = Im A + Im B - Im C - Im D */ + + a10 = a10 - x[6]; /* Re C - Re D */ + a30 = a30 - x[7]; /* Im C - Im D */ + + x[2] = tmp0 + a30; /* Re B' = Re A - Re B + Im C - Im D */ + x[6] = tmp0 - a30; /* Re D' = Re A - Re B - Im C + Im D */ + x[3] = tmp1 - a10; /* Im B' = Im A - Im B - Re C + Re D */ + x[7] = tmp1 + a10; /* Im D' = Im A - Im B + Re C - Re D */ +} + +LNK_SECTION_CODE_L1 +static void FORCEINLINE fft_8(FIXP_DBL *x) +{ + #define W_PiFOURTH STC(0x5a82799a) + + FIXP_DBL a00, a10, a20, a30; + FIXP_DBL y[16]; + + a00 = (x[0] + x[8])>>1; + a10 = x[4] + x[12]; + a20 = (x[1] + x[9])>>1; + a30 = x[5] + x[13]; + + y[0] = a00 + (a10>>1); + y[4] = a00 - (a10>>1); + y[1] = a20 + (a30>>1); + y[5] = a20 - (a30>>1); + + a00 = a00 - x[8]; + a10 = (a10>>1) - x[12]; + a20 = a20 - x[9]; + a30 = (a30>>1) - x[13]; + + y[2] = a00 + a30; + y[6] = a00 - a30; + y[3] = a20 - a10; + y[7] = a20 + a10; + + a00 = (x[2] + x[10])>>1; + a10 = x[6] + x[14]; + a20 = (x[3] + x[11])>>1; + a30 = x[7] + x[15]; + + y[8] = a00 + (a10>>1); + y[12] = a00 - (a10>>1); + y[9] = a20 + (a30>>1); + y[13] = a20 - (a30>>1); + + a00 = a00 - x[10]; + a10 = (a10>>1) - x[14]; + a20 = a20 - x[11]; + a30 = (a30>>1) - x[15]; + + y[10] = a00 + a30; + y[14] = a00 - a30; + y[11] = a20 - a10; + y[15] = a20 + a10; + + FIXP_DBL vr, vi, ur, ui; + + ur = y[0]>>1; + ui = y[1]>>1; + vr = y[8]; + vi = y[9]; + x[0] = ur + (vr>>1); + x[1] = ui + (vi>>1); + x[8] = ur - (vr>>1); + x[9] = ui - (vi>>1); + + ur = y[4]>>1; + ui = y[5]>>1; + vi = y[12]; + vr = y[13]; + x[4] = ur + (vr>>1); + x[5] = ui - (vi>>1); + x[12] = ur - (vr>>1); + x[13] = ui + (vi>>1); + + ur = y[10]; + ui = y[11]; + vr = fMultDiv2(ui+ur,W_PiFOURTH); + vi = fMultDiv2(ui-ur,W_PiFOURTH); + ur = y[2]; + ui = y[3]; + x[2] = (ur>>1) + vr; + x[3] = (ui>>1) + vi; + x[10] = (ur>>1) - vr; + x[11] = (ui>>1) - vi; + + ur = y[14]; + ui = y[15]; + vr = fMultDiv2(ui-ur,W_PiFOURTH); + vi = fMultDiv2(ui+ur,W_PiFOURTH); + ur = y[6]; + ui = y[7]; + x[6] = (ur>>1) + vr; + x[7] = (ui>>1) - vi; + x[14] = (ur>>1) - vr; + x[15] = (ui>>1) + vi; +} + +/** + * \brief FFT of fixed length 16 + */ +inline void fft_16(FIXP_DBL *x); + +/** + * \brief FFT of fixed length 32 + */ +inline void fft_32(FIXP_DBL *x); + + +#endif diff --git a/libFDK/include/fft_rad2.h b/libFDK/include/fft_rad2.h new file mode 100644 index 0000000..07efc83 --- /dev/null +++ b/libFDK/include/fft_rad2.h @@ -0,0 +1,72 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2003) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Lohwasser, M. Gayer + Description: + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef _FFT_RAD2_H +#define _FFT_RAD2_H + + +#include "common_fix.h" + +/** + * \brief Performe an inplace complex valued FFT of 2^n length + * + * \param x Input/Output data buffer. The input data must have at least 1 bit scale headroom. + * The values are interleaved, real/imag pairs. + * \param ldn log2 of FFT length + * \param trigdata Pointer to a sinetable of a length of at least (2^ldn)/2 sine values. + * \param trigDataSize length of the sinetable "trigdata". + */ +void dit_fft(FIXP_DBL *x, const INT ldn, const FIXP_STP *trigdata, const INT trigDataSize) ; + +/** + * \brief Performe an inplace complex valued inverse FFT of 2^n length + * + * \param x Input/Output data buffer. The input data must have at least 1 bit scale headroom. + * The values are interleaved, real/imag pairs. + * \param ldn log2 of FFT length + * \param trigdata Pointer to a sinetable of a length of at least (2^ldn)/2 sine values. + * \param trigDataSize length of the sinetable "trigdata". + */ +void dit_ifft(FIXP_DBL *x, const INT ldn, const FIXP_STP *trigdata, const INT trigDataSize) ; + +/* Rest of the world. */ + +#define SCALEFACTOR2048 10 +#define SCALEFACTOR1024 9 +#define SCALEFACTOR512 8 +#define SCALEFACTOR256 7 +#define SCALEFACTOR128 6 +#define SCALEFACTOR64 5 +#define SCALEFACTOR32 4 +#define SCALEFACTOR16 3 +#define SCALEFACTOR8 2 +#define SCALEFACTOR4 1 +#define SCALEFACTOR2 1 + +#endif /* _FFT_RAD2_H */ + diff --git a/libFDK/include/fixmadd.h b/libFDK/include/fixmadd.h new file mode 100644 index 0000000..65591a7 --- /dev/null +++ b/libFDK/include/fixmadd.h @@ -0,0 +1,244 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2003) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Lohwasser, M. Gayer + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#if !defined(__FIXMADD_H__) +#define __FIXMADD_H__ + +#include "FDK_archdef.h" +#include "machine_type.h" +#include "fixmul.h" + +#if defined(__arm__) +#include "arm/fixmadd_arm.h" + +#elif defined(__mips__) /* cppp replaced: elif */ +#include "mips/fixmadd_mips.h" + +#endif /* all cores */ + +/************************************************************************* + ************************************************************************* + Software fallbacks for missing functions. +************************************************************************** +**************************************************************************/ + +/* Divide by two versions. */ + +#if !defined(FUNCTION_fixmadddiv2_DD) +inline FIXP_DBL fixmadddiv2_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) + { return (x + fMultDiv2 (a, b)); } +#endif + +#if !defined(FUNCTION_fixmadddiv2_SD) +inline FIXP_DBL fixmadddiv2_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) { +#ifdef FUNCTION_fixmadddiv2_DS + return fixmadddiv2_DS(x, b, a); +#else + return fixmadddiv2_DD(x, FX_SGL2FX_DBL(a), b); +#endif +} +#endif + +#if !defined(FUNCTION_fixmadddiv2_DS) +inline FIXP_DBL fixmadddiv2_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) { +#ifdef FUNCTION_fixmadddiv2_SD + return fixmadddiv2_SD(x, b, a); +#else + return fixmadddiv2_DD(x, a, FX_SGL2FX_DBL(b)); +#endif +} +#endif + +#if !defined(FUNCTION_fixmadddiv2_SS) +inline FIXP_DBL fixmadddiv2_SS (FIXP_DBL x, const FIXP_SGL a, const FIXP_SGL b) + { return x + fMultDiv2(a,b); } +#endif + +#if !defined(FUNCTION_fixmsubdiv2_DD) +inline FIXP_DBL fixmsubdiv2_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) + { return (x - fMultDiv2 (a, b)); } +#endif + +#if !defined(FUNCTION_fixmsubdiv2_SD) +inline FIXP_DBL fixmsubdiv2_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) { +#ifdef FUNCTION_fixmsubdiv2_DS + return fixmsubdiv2_DS(x, b, a); +#else + return fixmsubdiv2_DD(x, FX_SGL2FX_DBL(a), b); +#endif +} +#endif + +#if !defined(FUNCTION_fixmsubdiv2_DS) +inline FIXP_DBL fixmsubdiv2_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) { +#ifdef FUNCTION_fixmsubdiv2_SD + return fixmsubdiv2_SD(x, b, a); +#else + return fixmsubdiv2_DD(x, a, FX_SGL2FX_DBL(b)); +#endif +} +#endif + +#if !defined(FUNCTION_fixmsubdiv2_SS) +inline FIXP_DBL fixmsubdiv2_SS (FIXP_DBL x, const FIXP_SGL a, const FIXP_SGL b) + { return x - fMultDiv2(a,b); } +#endif + + +#if !defined(FUNCTION_fixmadddiv2BitExact_DD) +#define FUNCTION_fixmadddiv2BitExact_DD +inline FIXP_DBL fixmadddiv2BitExact_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) { + return x + fMultDiv2BitExact(a, b); +} +#endif +#if !defined(FUNCTION_fixmadddiv2BitExact_SD) +#define FUNCTION_fixmadddiv2BitExact_SD +inline FIXP_DBL fixmadddiv2BitExact_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) { +#ifdef FUNCTION_fixmadddiv2BitExact_DS + return fixmadddiv2BitExact_DS(x, b, a); +#else + return x + fMultDiv2BitExact(a, b); +#endif +} +#endif +#if !defined(FUNCTION_fixmadddiv2BitExact_DS) +#define FUNCTION_fixmadddiv2BitExact_DS +inline FIXP_DBL fixmadddiv2BitExact_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) { +#ifdef FUNCTION_fixmadddiv2BitExact_SD + return fixmadddiv2BitExact_SD(x, b, a); +#else + return x + fMultDiv2BitExact(a, b); +#endif +} +#endif + +#if !defined(FUNCTION_fixmsubdiv2BitExact_DD) +#define FUNCTION_fixmsubdiv2BitExact_DD +inline FIXP_DBL fixmsubdiv2BitExact_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) { + return x - fMultDiv2BitExact(a, b); +} +#endif +#if !defined(FUNCTION_fixmsubdiv2BitExact_SD) +#define FUNCTION_fixmsubdiv2BitExact_SD +inline FIXP_DBL fixmsubdiv2BitExact_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) { +#ifdef FUNCTION_fixmsubdiv2BitExact_DS + return fixmsubdiv2BitExact_DS(x, b, a); +#else + return x - fMultDiv2BitExact(a, b); +#endif +} +#endif +#if !defined(FUNCTION_fixmsubdiv2BitExact_DS) +#define FUNCTION_fixmsubdiv2BitExact_DS +inline FIXP_DBL fixmsubdiv2BitExact_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) { +#ifdef FUNCTION_fixmsubdiv2BitExact_SD + return fixmsubdiv2BitExact_SD(x, b, a); +#else + return x - fMultDiv2BitExact(a, b); +#endif +} +#endif + +/* Normal versions */ + +#if !defined(FUNCTION_fixmadd_DD) +inline FIXP_DBL fixmadd_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) + { return fixmadddiv2_DD(x,a,b)<<1; } +#endif +#if !defined(FUNCTION_fixmadd_SD) +inline FIXP_DBL fixmadd_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) { +#ifdef FUNCTION_fixmadd_DS + return fixmadd_DS(x, b, a); +#else + return fixmadd_DD(x, FX_SGL2FX_DBL(a), b); +#endif +} +#endif +#if !defined(FUNCTION_fixmadd_DS) +inline FIXP_DBL fixmadd_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) { +#ifdef FUNCTION_fixmadd_SD + return fixmadd_SD(x, b, a); +#else + return fixmadd_DD(x, a, FX_SGL2FX_DBL(b)); +#endif +} +#endif +#if !defined(FUNCTION_fixmadd_SS) +inline FIXP_DBL fixmadd_SS (FIXP_DBL x, const FIXP_SGL a, const FIXP_SGL b) + { return (x + fMultDiv2(a,b))<<1; } +#endif + +#if !defined(FUNCTION_fixmsub_DD) +inline FIXP_DBL fixmsub_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) + { return fixmsubdiv2_DD(x,a,b)<<1; } +#endif +#if !defined(FUNCTION_fixmsub_SD) +inline FIXP_DBL fixmsub_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) { +#ifdef FUNCTION_fixmsub_DS + return fixmsub_DS(x, b, a); +#else + return fixmsub_DD(x, FX_SGL2FX_DBL(a), b); +#endif +} +#endif +#if !defined(FUNCTION_fixmsub_DS) +inline FIXP_DBL fixmsub_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) { +#ifdef FUNCTION_fixmsub_SD + return fixmsub_SD(x, b, a); +#else + return fixmsub_DD(x, a, FX_SGL2FX_DBL(b)); +#endif +} +#endif +#if !defined(FUNCTION_fixmsub_SS) +inline FIXP_DBL fixmsub_SS (FIXP_DBL x, const FIXP_SGL a, const FIXP_SGL b) + { return (x - fMultDiv2(a,b))<<1; } +#endif + +#if !defined(FUNCTION_fixpow2adddiv2_D) +inline INT fixpadddiv2_D (FIXP_DBL x, const FIXP_DBL a) + { return (x + fPow2Div2(a)); } +#endif +#if !defined(FUNCTION_fixpow2add_D) +inline INT fixpadd_D (FIXP_DBL x, const FIXP_DBL a) + { return (x + fPow2(a)); } +#endif + +#if !defined(FUNCTION_fixpow2adddiv2_S) +inline INT fixpadddiv2_S (FIXP_DBL x, const FIXP_SGL a) + { return (x + fPow2Div2(a)); } +#endif +#if !defined(FUNCTION_fixpow2add_S) +inline INT fixpadd_S (FIXP_DBL x, const FIXP_SGL a) + { return (x + fPow2(a)); } +#endif + + + +#endif // __FIXMADD_H__ + diff --git a/libFDK/include/fixminmax.h b/libFDK/include/fixminmax.h new file mode 100644 index 0000000..5bbd53b --- /dev/null +++ b/libFDK/include/fixminmax.h @@ -0,0 +1,58 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Lohwasser, M. Gayer + Description: min/max inline functions and defines + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef FIXMINMAX__H +#define FIXMINMAX__H + +#include "FDK_archdef.h" +#include "machine_type.h" + +/* Inline Function to determine the smaller/bigger value of two values with same type. */ + + +template <class T> inline T fixmin (T a, T b) +{ + return (a < b ? a : b); +} + +template <class T> inline T fixmax (T a, T b) +{ + return (a > b ? a : b); +} + +#define fixmax_D(a,b) fixmax(a,b) +#define fixmin_D(a,b) fixmin(a,b) +#define fixmax_S(a,b) fixmax(a,b) +#define fixmin_S(a,b) fixmin(a,b) +#define fixmax_I(a,b) fixmax(a,b) +#define fixmin_I(a,b) fixmin(a,b) +#define fixmax_UI(a,b) fixmax(a,b) +#define fixmin_UI(a,b) fixmin(a,b) + + +#endif diff --git a/libFDK/include/fixmul.h b/libFDK/include/fixmul.h new file mode 100644 index 0000000..f9f35e2 --- /dev/null +++ b/libFDK/include/fixmul.h @@ -0,0 +1,223 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (1999) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Stefan Gewinner + Description: fixed point multiplication + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +#if !defined(__FIXMUL_H__) +#define __FIXMUL_H__ + +#include "FDK_archdef.h" +#include "machine_type.h" + + +#if defined(__arm__) +#include "arm/fixmul_arm.h" + +#elif defined(__mips__) /* cppp replaced: elif */ +#include "mips/fixmul_mips.h" + +#elif defined(__x86__) /* cppp replaced: elif */ +#include "x86/fixmul_x86.h" + +#endif /* all cores */ + +/************************************************************************* + ************************************************************************* + Software fallbacks for missing functions +************************************************************************** +**************************************************************************/ + +#if !defined(FUNCTION_fixmuldiv2_DD) +#define FUNCTION_fixmuldiv2_DD +#if defined(_MSC_VER) || defined(__CC_ARM) || defined(__ANALOG_EXTENSIONS__) || defined(__TI_COMPILER_VERSION__) +#pragma message ("Extremely slow implementation of fixmuldiv2_DD !!") +#else +#warning Extremely slow implementation of fixmuldiv2_DD !! +#endif +inline LONG fixmuldiv2_DD (const LONG a, const LONG b) +{ + return (LONG) ((((INT64)a) * b) >> 32) ; +} +#endif + +#if !defined(FUNCTION_fixmuldiv2BitExact_DD) +#define FUNCTION_fixmuldiv2BitExact_DD +#if defined(_MSC_VER) || defined(__CC_ARM) || defined(__ANALOG_EXTENSIONS__) || defined(__TI_COMPILER_VERSION__) +#pragma message ("Extremely slow implementation of fixmuldiv2BitExact_DD !!") +#else +#warning Extremely slow implementation of fixmuldiv2BitExact_DD !! +#endif +inline LONG fixmuldiv2BitExact_DD (const LONG a, const LONG b) +{ + return (LONG) ((((INT64)a) * b) >> 32) ; +} +#endif + +#if !defined(FUNCTION_fixmul_DD) +#define FUNCTION_fixmul_DD +inline LONG fixmul_DD (const LONG a, const LONG b) + { return fixmuldiv2_DD (a, b) << 1 ; } +#endif + +#if !defined(FUNCTION_fixmulBitExact_DD) +#define FUNCTION_fixmulBitExact_DD +#if defined(_MSC_VER) || defined(__CC_ARM) || defined(__ANALOG_EXTENSIONS__) || defined(__TI_COMPILER_VERSION__) || defined(__XTENSA__) +#pragma message ("Extremely slow implementation of fixmulBitExact_DD !!") +#else +#warning Extremely slow implementation of fixmulBitExact_DD !! +#endif +inline LONG fixmulBitExact_DD (const LONG a, const LONG b) +{ + return ( (LONG) ((((INT64)a) * b) >> 32) ) << 1; +} +#endif + +#if !defined(FUNCTION_fixmuldiv2_SS) +#define FUNCTION_fixmuldiv2_SS +inline LONG fixmuldiv2_SS (const SHORT a, const SHORT b) + { return ((LONG)a*b); } +#endif + +#if !defined(FUNCTION_fixmul_SS) +#define FUNCTION_fixmul_SS +inline LONG fixmul_SS (const SHORT a, const SHORT b) + { return (a*b) <<1; } +#endif + +#if !defined(FUNCTION_fixmuldiv2_SD) +#define FUNCTION_fixmuldiv2_SD +inline LONG fixmuldiv2_SD (const SHORT a, const LONG b) +#ifdef FUNCTION_fixmuldiv2_DS + { return fixmuldiv2_DS(b, a); } +#else + { return fixmuldiv2_DD(FX_SGL2FX_DBL(a), b); } +#endif +#endif + +#if !defined(FUNCTION_fixmuldiv2_DS) +#define FUNCTION_fixmuldiv2_DS +inline LONG fixmuldiv2_DS (const LONG a, const SHORT b) +#ifdef FUNCTION_fixmuldiv2_SD + { return fixmuldiv2_SD(b, a); } +#else + { return fixmuldiv2_DD(a, FX_SGL2FX_DBL(b)); } +#endif +#endif + +#if !defined(FUNCTION_fixmuldiv2BitExact_SD) +#define FUNCTION_fixmuldiv2BitExact_SD +inline LONG fixmuldiv2BitExact_SD (const SHORT a, const LONG b) +#ifdef FUNCTION_fixmuldiv2BitExact_DS + { return fixmuldiv2BitExact_DS(b, a); } +#else + { return (LONG) ((((INT64)a) * b) >> 16) ; } +#endif +#endif + +#if !defined(FUNCTION_fixmuldiv2BitExact_DS) +#define FUNCTION_fixmuldiv2BitExact_DS +inline LONG fixmuldiv2BitExact_DS (const LONG a, const SHORT b) +#ifdef FUNCTION_fixmuldiv2BitExact_SD + { return fixmuldiv2BitExact_SD(b, a); } +#else + { return (LONG) ((((INT64)a) * b) >> 16) ; } +#endif +#endif + +#if !defined(FUNCTION_fixmul_SD) +#define FUNCTION_fixmul_SD +inline LONG fixmul_SD (const SHORT a, const LONG b) { +#ifdef FUNCTION_fixmul_DS + return fixmul_SD(b, a); +#else + return fixmuldiv2_SD (a, b) << 1 ; +#endif +} +#endif + +#if !defined(FUNCTION_fixmul_DS) +#define FUNCTION_fixmul_DS +inline LONG fixmul_DS (const LONG a, const SHORT b) { +#ifdef FUNCTION_fixmul_SD + return fixmul_SD(b, a); +#else + return fixmuldiv2_DS(a, b) << 1 ; +#endif +} +#endif + +#if !defined(FUNCTION_fixmulBitExact_SD) +#define FUNCTION_fixmulBitExact_SD +inline LONG fixmulBitExact_SD (const SHORT a, const LONG b) +#ifdef FUNCTION_fixmulBitExact_DS + { return fixmulBitExact_DS(b, a); } +#else + { return (LONG) (((((INT64)a) * b) >> 16) << 1); } +#endif +#endif + +#if !defined(FUNCTION_fixmulBitExact_DS) +#define FUNCTION_fixmulBitExact_DS +inline LONG fixmulBitExact_DS (const LONG a, const SHORT b) +#ifdef FUNCTION_fixmulBitExact_SD + { return fixmulBitExact_SD(b, a); } +#else + { return (LONG) (((((INT64)a) * b) >> 16) << 1); } +#endif +#endif + + +#if !defined(FUNCTION_fixpow2div2_D) +#ifdef ARCH_WA_16BITMULT +#error Fallback for fixpow2div2_D is not 16 bit safe ! +#endif +#define FUNCTION_fixpow2div2_D +inline LONG fixpow2div2_D (const LONG a) + { return fixmuldiv2_DD(a, a); } +#endif + +#if !defined(FUNCTION_fixpow2_D) +#ifdef ARCH_WA_16BITMULT +#error Fallback for fixpow2_D is not 16 bit safe ! +#endif +#define FUNCTION_fixpow2_D +inline LONG fixpow2_D (const LONG a) + { return fixpow2div2_D(a)<<1; } +#endif + +#if !defined(FUNCTION_fixpow2div2_S) +#define FUNCTION_fixpow2div2_S +inline LONG fixpow2div2_S (const SHORT a) + { return fixmuldiv2_SS(a, a); } +#endif + +#if !defined(FUNCTION_fixpow2_S) +#define FUNCTION_fixpow2_S +inline LONG fixpow2_S (const SHORT a) + { return fixpow2div2_S(a)<<1; } +#endif + + +#endif /* __FIXMUL_H__ */ diff --git a/libFDK/include/fixpoint_math.h b/libFDK/include/fixpoint_math.h new file mode 100644 index 0000000..0d0a059 --- /dev/null +++ b/libFDK/include/fixpoint_math.h @@ -0,0 +1,397 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (1999) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Gayer + Description: Fixed point specific mathematical functions + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef __fixpoint_math_H +#define __fixpoint_math_H + + +#include "common_fix.h" + + +#define LD_DATA_SCALING (64.0f) +#define LD_DATA_SHIFT 6 /* pow(2, LD_DATA_SHIFT) = LD_DATA_SCALING */ +/*#define SIMULATE_MIPS_DIV */ /* schur_div() in C that simulates the inline asm schur_div() on MIPS */ + +/** + * \brief deprecated. Use fLog2() instead. + */ +FIXP_DBL CalcLdData(FIXP_DBL op); + +void LdDataVector(FIXP_DBL *srcVector, FIXP_DBL *destVector, INT number); + +FIXP_DBL CalcInvLdData(FIXP_DBL op); + + +void InitLdInt(); +FIXP_DBL CalcLdInt(INT i); + +extern const USHORT sqrt_tab[49]; + +inline FIXP_DBL sqrtFixp_lookup(FIXP_DBL x) +{ + UINT y = (INT)x; + UCHAR is_zero=(y==0); + INT zeros=fixnormz_D(y) & 0x1e; + y<<=zeros; + UINT idx=(y>>26)-16; + USHORT frac=(y>>10)&0xffff; + USHORT nfrac=0xffff^frac; + UINT t=nfrac*sqrt_tab[idx]+frac*sqrt_tab[idx+1]; + t=t>>(zeros>>1); + return(is_zero ? 0 : t); +} + +inline FIXP_DBL sqrtFixp_lookup(FIXP_DBL x, INT *x_e) +{ + UINT y = (INT)x; + INT e; + + if (x == (FIXP_DBL)0) { + return x; + } + + /* Normalize */ + e=fixnormz_D(y); + y<<=e; + e = *x_e - e + 2; + + /* Correct odd exponent. */ + if (e & 1) { + y >>= 1; + e ++; + } + /* Get square root */ + UINT idx=(y>>26)-16; + USHORT frac=(y>>10)&0xffff; + USHORT nfrac=0xffff^frac; + UINT t=nfrac*sqrt_tab[idx]+frac*sqrt_tab[idx+1]; + + /* Write back exponent */ + *x_e = e >> 1; + return (FIXP_DBL)(LONG)(t>>1); +} + + + +FIXP_DBL sqrtFixp(FIXP_DBL op); + +void InitInvSqrtTab(); + +FIXP_DBL invSqrtNorm2(FIXP_DBL op, INT *shift); + +/***************************************************************************** + + functionname: invFixp + description: delivers 1/(op) + +*****************************************************************************/ +inline FIXP_DBL invFixp(FIXP_DBL op) +{ + INT tmp_exp ; + FIXP_DBL tmp_inv = invSqrtNorm2(op, &tmp_exp) ; + FDK_ASSERT((31-(2*tmp_exp+1))>=0) ; + return ( fPow2Div2( (FIXP_DBL)tmp_inv ) >> (31-(2*tmp_exp+1)) ) ; +} + + + +#if defined(__mips__) && (__GNUC__==2) + +#define FUNCTION_schur_div +inline FIXP_DBL schur_div(FIXP_DBL num,FIXP_DBL denum, INT count) +{ + INT result, tmp ; + __asm__ ("srl %1, %2, 15\n" + "div %3, %1\n" : "=lo" (result) + : "%d" (tmp), "d" (denum) , "d" (num) + : "hi" ) ; + return result<<16 ; +} + +/*###########################################################################################*/ +#elif defined(__mips__) && (__GNUC__==3) + +#define FUNCTION_schur_div +inline FIXP_DBL schur_div(FIXP_DBL num,FIXP_DBL denum, INT count) +{ + INT result, tmp; + + __asm__ ("srl %[tmp], %[denum], 15\n" + "div %[result], %[num], %[tmp]\n" + : [tmp] "+r" (tmp), [result]"=r"(result) + : [denum]"r"(denum), [num]"r"(num) + : "hi", "lo"); + return result << (DFRACT_BITS-16); +} + +/*###########################################################################################*/ +#elif defined(SIMULATE_MIPS_DIV) + +#define FUNCTION_schur_div +inline FIXP_DBL schur_div(FIXP_DBL num, FIXP_DBL denum, INT count) +{ + FDK_ASSERT (count<=DFRACT_BITS-1); + FDK_ASSERT (num>=(FIXP_DBL)0); + FDK_ASSERT (denum>(FIXP_DBL)0); + FDK_ASSERT (num <= denum); + + INT tmp = denum >> (count-1); + INT result = 0; + + while (num > tmp) + { + num -= tmp; + result++; + } + + return result << (DFRACT_BITS-count); +} + +/*###########################################################################################*/ +#endif /* target architecture selector */ + +#if !defined(FUNCTION_schur_div) +/** + * \brief Divide two FIXP_DBL values with given precision. + * \param num dividend + * \param denum divisor + * \param count amount of significant bits of the result (starting to the MSB) + * \return num/divisor + */ +FIXP_DBL schur_div(FIXP_DBL num,FIXP_DBL denum, INT count); +#endif + + + +FIXP_DBL mul_dbl_sgl_rnd (const FIXP_DBL op1, + const FIXP_SGL op2); + +/** + * \brief multiply two values with normalization, thus max precision. + * Author: Robert Weidner + * + * \param f1 first factor + * \param f2 secod factor + * \param result_e pointer to an INT where the exponent of the result is stored into + * \return mantissa of the product f1*f2 + */ +FIXP_DBL fMultNorm( + FIXP_DBL f1, + FIXP_DBL f2, + INT *result_e + ); + +/** + * \brief Divide 2 FIXP_DBL values with normalization of input values. + * \param num numerator + * \param denum denomintator + * \return num/denum with exponent = 0 + */ +FIXP_DBL fDivNorm(FIXP_DBL num, FIXP_DBL denom, INT *result_e); + +/** + * \brief Divide 2 FIXP_DBL values with normalization of input values. + * \param num numerator + * \param denum denomintator + * \param result_e pointer to an INT where the exponent of the result is stored into + * \return num/denum with exponent = *result_e + */ +FIXP_DBL fDivNorm(FIXP_DBL num, FIXP_DBL denom); + +/** + * \brief Divide 2 FIXP_DBL values with normalization of input values. + * \param num numerator + * \param denum denomintator + * \return num/denum with exponent = 0 + */ +FIXP_DBL fDivNormHighPrec(FIXP_DBL L_num, FIXP_DBL L_denum, INT *result_e); + +/** + * \brief Calculate log(argument)/log(2) (logarithm with base 2). deprecated. Use fLog2() instead. + * \param arg mantissa of the argument + * \param arg_e exponent of the argument + * \param result_e pointer to an INT to store the exponent of the result + * \return the mantissa of the result. + * \param + */ +FIXP_DBL CalcLog2(FIXP_DBL arg, INT arg_e, INT *result_e); + +/** + * \brief return 2 ^ (exp * 2^exp_e) + * \param exp_m mantissa of the exponent to 2.0f + * \param exp_e exponent of the exponent to 2.0f + * \param result_e pointer to a INT where the exponent of the result will be stored into + * \return mantissa of the result + */ +FIXP_DBL f2Pow(const FIXP_DBL exp_m, const INT exp_e, INT *result_e); + +/** + * \brief return 2 ^ (exp_m * 2^exp_e). This version returns only the mantissa with implicit exponent of zero. + * \param exp_m mantissa of the exponent to 2.0f + * \param exp_e exponent of the exponent to 2.0f + * \return mantissa of the result + */ +FIXP_DBL f2Pow(const FIXP_DBL exp_m, const INT exp_e); + +/** + * \brief return x ^ (exp * 2^exp_e), where log2(x) = baseLd_m * 2^(baseLd_e). This saves + * the need to compute log2() of constant values (when x is a constant). + * \param ldx_m mantissa of log2() of x. + * \param ldx_e exponent of log2() of x. + * \param exp_m mantissa of the exponent to 2.0f + * \param exp_e exponent of the exponent to 2.0f + * \param result_e pointer to a INT where the exponent of the result will be stored into + * \return mantissa of the result + */ +FIXP_DBL fLdPow( + FIXP_DBL baseLd_m, + INT baseLd_e, + FIXP_DBL exp_m, INT exp_e, + INT *result_e + ); + +/** + * \brief return x ^ (exp * 2^exp_e), where log2(x) = baseLd_m * 2^(baseLd_e). This saves + * the need to compute log2() of constant values (when x is a constant). This version + * does not return an exponent, which is implicitly 0. + * \param ldx_m mantissa of log2() of x. + * \param ldx_e exponent of log2() of x. + * \param exp_m mantissa of the exponent to 2.0f + * \param exp_e exponent of the exponent to 2.0f + * \return mantissa of the result + */ +FIXP_DBL fLdPow( + FIXP_DBL baseLd_m, INT baseLd_e, + FIXP_DBL exp_m, INT exp_e + ); + +/** + * \brief return (base * 2^base_e) ^ (exp * 2^exp_e). Use fLdPow() instead whenever possible. + * \param base_m mantissa of the base. + * \param base_e exponent of the base. + * \param exp_m mantissa of power to be calculated of the base. + * \param exp_e exponent of power to be calculated of the base. + * \param result_e pointer to a INT where the exponent of the result will be stored into. + * \return mantissa of the result. + */ +FIXP_DBL fPow(FIXP_DBL base_m, INT base_e, FIXP_DBL exp_m, INT exp_e, INT *result_e); + +/** + * \brief return (base * 2^base_e) ^ N + * \param base mantissa of the base + * \param base_e exponent of the base + * \param power to be calculated of the base + * \param result_e pointer to a INT where the exponent of the result will be stored into + * \return mantissa of the result + */ +FIXP_DBL fPowInt(FIXP_DBL base_m, INT base_e, INT N, INT *result_e); + +/** + * \brief calculate logarithm of base 2 of x_m * 2^(x_e) + * \param x_m mantissa of the input value. + * \param x_e exponent of the input value. + * \param pointer to an INT where the exponent of the result is returned into. + * \return mantissa of the result. + */ +FIXP_DBL fLog2(FIXP_DBL x_m, INT x_e, INT *result_e); + +/** + * \brief calculate logarithm of base 2 of x_m * 2^(x_e) + * \param x_m mantissa of the input value. + * \param x_e exponent of the input value. + * \return mantissa of the result with implicit exponent of LD_DATA_SHIFT. + */ +FIXP_DBL fLog2(FIXP_DBL x_m, INT x_e); + +/** + * \brief Add with saturation of the result. + * \param a first summand + * \param b second summand + * \return saturated sum of a and b. + */ +inline FIXP_SGL fAddSaturate(const FIXP_SGL a, const FIXP_SGL b) +{ + LONG sum; + + sum = (LONG)(SHORT)a + (LONG)(SHORT)b; + sum = fMax(fMin((INT)sum, (INT)MAXVAL_SGL), (INT)MINVAL_SGL); + return (FIXP_SGL)(SHORT)sum; +} + +/** + * \brief Add with saturation of the result. + * \param a first summand + * \param b second summand + * \return saturated sum of a and b. + */ +inline FIXP_DBL fAddSaturate(const FIXP_DBL a, const FIXP_DBL b) +{ + LONG sum; + + sum = (LONG)(a>>1) + (LONG)(b>>1); + sum = fMax(fMin((INT)sum, (INT)(MAXVAL_DBL>>1)), (INT)(MINVAL_DBL>>1)); + return (FIXP_DBL)(LONG)(sum<<1); +} + +#define TEST_ROUNDING 0 + + +#if TEST_ROUNDING +void checkRound(); +void checkRound2(); +#endif + + +/***************************************************************************** + + array for 1/n, n=1..50 + +****************************************************************************/ + + extern const FIXP_DBL invCount[50]; + + LNK_SECTION_INITCODE + inline void InitInvInt(void) {} + + +/** + * \brief Calculate the value of 1/i where i is a integer value. It supports + * input values from 1 upto 50. + * \param intValue Integer input value. + * \param FIXP_DBL representation of 1/intValue + */ +inline FIXP_DBL GetInvInt(int intValue) +{ + FDK_ASSERT((intValue > 0) && (intValue < 50)); + FDK_ASSERT(intValue<50); + return invCount[intValue]; +} + + +#endif + diff --git a/libFDK/include/mdct.h b/libFDK/include/mdct.h new file mode 100644 index 0000000..f96ea06 --- /dev/null +++ b/libFDK/include/mdct.h @@ -0,0 +1,181 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2011) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Manuel Jander, Josef Hoepfl + Description: MDCT routines + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef __MDCT_H__ +#define __MDCT_H__ + + + +#include "common_fix.h" + +#define MDCT_OUT_HEADROOM 2 /* Output additional headroom */ +#define MDCT_OUTPUT_SCALE (DFRACT_BITS-SAMPLE_BITS-MDCT_OUT_HEADROOM) +/* Refer to "Output word length" in ISO/IEC 14496-3:2008(E) 23.2.3.6 */ +#define MDCT_OUTPUT_GAIN 16 + +#if (SAMPLE_BITS == DFRACT_BITS) +#define IMDCT_SCALE(x) (INT_PCM)SATURATE_LEFT_SHIFT(x, -MDCT_OUTPUT_SCALE, SAMPLE_BITS) +#else +#define IMDCT_SCALE(x) (INT_PCM)SATURATE_RIGHT_SHIFT(x, MDCT_OUTPUT_SCALE, SAMPLE_BITS) +#endif +#define IMDCT_SCALE_DBL(x) (FIXP_DBL)(x) + +/** + * \brief MDCT persistent data + */ +typedef struct { + union { + FIXP_DBL *freq; + FIXP_DBL *time; + } overlap; /**< Pointer to overlap memory */ + + const FIXP_WTP *prev_wrs; /**< pointer to previous right window slope */ + int prev_tl; /**< previous tranform length */ + int prev_nr; /**< previous right window offset */ + int prev_fr; /**< previous right window slope length */ + int ov_offset; /**< overlap time data fill level */ + int ov_size; /**< Overlap buffer size in words */ + +} mdct_t; + +typedef mdct_t* H_MDCT; + +/** + * \brief Initialize as valid MDCT handle + * + * \param hMdct handle of an allocated MDCT handle. + * \param overlap pointer to FIXP_DBL overlap buffer. + * \param overlapBufferSize size in FIXP_DBLs of the given overlap buffer. + * \return void + */ +void mdct_init( H_MDCT hMdct, + FIXP_DBL *overlap, + INT overlapBufferSize ); + +/** + * \brief perform MDCT transform (time domain to frequency domain) with given parameters. + * + * \param hMdct handle of an allocated MDCT handle. + * \param spectrum pointer to where the resulting MDCT spectrum will be stored into. + * \param scalefactor pointer to the input scale shift value. Updated accordingly on return. + * \param input pointer to input time domain signal + * \param tl transformation length. + * \param nr right window slope offset (amount of window coefficients assumed to be 1.0) + * \param fr right overlap window slope length + * \param wrs pointer to the right side overlap window coefficients. + * \return number of input samples processed. + */ +INT mdct_block( + H_MDCT hMdct, + FIXP_DBL *spectrum, + INT *scalefactor, + INT_PCM *input, + INT tl, + INT nr, + INT fr, + const FIXP_WTB *wrs ); + + +/** + * \brief add/multiply 2/N transform gain and MPEG4 part 3 defined output gain (see definition + * of MDCT_OUTPUT_GAIN) to given mantissa factor and exponent. + * \param pGain pointer to the mantissa of a gain factor to be applied to IMDCT data. + * \param pExponent pointer to the exponent of a gain factor to be applied to IMDCT data. + * \param tl length of the IMDCT where the gain *pGain * (2 ^ *pExponent) will be applied to. + */ +void imdct_gain( + FIXP_DBL *pGain, + int *pExponent, + int tl + ); + +/** + * \brief drain buffered output samples into given buffer. Changes the MDCT state. + */ +INT imdct_drain( + H_MDCT hMdct, + FIXP_DBL * pTimeData, + INT nrSamplesRoom + ); + + +/** + * \brief Copy overlap time domain data to given buffer. Does not change the MDCT state. + * \return number of actually copied samples (ov + nr). + */ +INT imdct_copy_ov_and_nr( + H_MDCT hMdct, + FIXP_DBL * pTimeData, + INT nrSamples + ); + +/** + * \brief Adapt MDCT parameters for non-matching window slopes. + * \param hMdct handle of an allocated MDCT handle. + * \param pfl pointer to left overlap window side length. + * \param pnl pointer to length of the left n part of the window. + * \param tl transform length. + * \param wls pointer to the left side overlap window coefficients. + * \param noOutSamples desired number of output samples. + */ +void imdct_adapt_parameters(H_MDCT hMdct, int *pfl, int *pnl, int tl, const FIXP_WTP *wls, int noOutSamples); + +/** + * \brief perform several inverse MDCT transforms (frequency domain to time domain) with given parameters. + * + * \param hMdct handle of an allocated MDCT handle. + * \param output pointer to where the output time domain signal will be stored into. + * \param stride the stride factor for accessing time domain samples in output. + * \param spectrum pointer to the input MDCT spectra. + * \param scalefactors scale shift values of the input spectrum. + * \param nSpec number of MDCT spectrums. + * \param noOutSamples desired number of output samples. + * \param tl transform length. + * \param wls pointer to the left side overlap window coefficients. + * \param fl left overlap window side length. + * \param wrs pointer to the right side overlap window coefficients of all individual IMDCTs. + * \param fr right overlap window side length of all individual IMDCTs. + * \param gain factor to apply to output samples (if != 0). + * \return number of output samples returned. + */ +INT imdct_block( + H_MDCT hMdct, + FIXP_DBL *output, + FIXP_DBL *spectrum, + const SHORT scalefactor[], + const INT nSpec, + const INT noOutSamples, + const INT tl, + const FIXP_WTP *wls, + INT fl, + const FIXP_WTP *wrs, + const INT fr, + FIXP_DBL gain ); + + +#endif /* __MDCT_H__ */ diff --git a/libFDK/include/mips/abs_mips.h b/libFDK/include/mips/abs_mips.h new file mode 100644 index 0000000..92729c5 --- /dev/null +++ b/libFDK/include/mips/abs_mips.h @@ -0,0 +1,44 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +#if defined(__mips__) + +#if defined(__GNUC__) && defined(__mips__) + + #if defined(__mips_dsp) + #define FUNCTION_fixabs_D + #define FUNCTION_fixabs_I + #define FUNCTION_fixabs_S + inline FIXP_DBL fixabs_D(FIXP_DBL x) { return __builtin_mips_absq_s_w(x); } + inline FIXP_SGL fixabs_S(FIXP_SGL x) { return ((x) > (FIXP_SGL)(0)) ? (x) : -(x) ; } + inline INT fixabs_I(INT x) { return __builtin_mips_absq_s_w(x); } + #endif /* __mips_dsp */ + +#endif /* defined(__GNUC__) && defined(__mips__) */ + +#endif /*__mips__ */ + diff --git a/libFDK/include/mips/clz_mips.h b/libFDK/include/mips/clz_mips.h new file mode 100644 index 0000000..23e6949 --- /dev/null +++ b/libFDK/include/mips/clz_mips.h @@ -0,0 +1,55 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +#if defined(__mips__) + +#if defined(__mips__) && (__GNUC__==2) && (mips>=32) + + #define FUNCTION_fixnormz_D + inline INT fixnormz_D(LONG value) + { + INT result; + __asm__ ("clz %0,%1" : "=d" (result) : "d" (value)); + + return result; + } + +#elif defined(__mips__) && (__GNUC__==3) && (__mips>=32) + + #define FUNCTION_fixnormz_D + INT inline fixnormz_D(LONG value) + { + INT result; + __asm__ ("clz %[result], %[value]" : [result] "=r" (result) : [value] "r" (value)) ; + + return result; + } + +#endif + +#endif /* __mips__ */ + diff --git a/libFDK/include/mips/cplx_mul.h b/libFDK/include/mips/cplx_mul.h new file mode 100644 index 0000000..f6f46cc --- /dev/null +++ b/libFDK/include/mips/cplx_mul.h @@ -0,0 +1,93 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + + +#if defined(__GNUC__) && defined(__mips__) + + +//#define FUNCTION_cplxMultDiv2_32x16 +//#define FUNCTION_cplxMultDiv2_32x16X2 +#define FUNCTION_cplxMultDiv2_32x32X2 +//#define FUNCTION_cplxMult_32x16 +//#define FUNCTION_cplxMult_32x16X2 +#define FUNCTION_cplxMult_32x32X2 + +#if defined(FUNCTION_cplxMultDiv2_32x32X2) +inline void cplxMultDiv2( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + FIXP_DBL a_Re, + FIXP_DBL a_Im, + FIXP_DBL b_Re, + FIXP_DBL b_Im) +{ + INT result; + + __asm__ ("mult %[a_Re], %[b_Re];\n" + "msub %[a_Im], %[b_Im];\n" + : "=hi"(result) + : [a_Re]"r"(a_Re), [b_Re]"r"(b_Re), [a_Im]"r"(a_Im), [b_Im]"r"(b_Im) + : "lo"); + + *c_Re = result; + + __asm__ ("mult %[a_Re], %[b_Im];\n" + "madd %[a_Im], %[b_Re];\n" + : "=hi"(result) + : [a_Re]"r"(a_Re), [b_Im]"r"(b_Im), [a_Im]"r"(a_Im), [b_Re]"r"(b_Re) + : "lo"); + *c_Im = result; +} +#endif + +#if defined(FUNCTION_cplxMult_32x32X2) +inline void cplxMult( FIXP_DBL *c_Re, + FIXP_DBL *c_Im, + FIXP_DBL a_Re, + FIXP_DBL a_Im, + FIXP_DBL b_Re, + FIXP_DBL b_Im) +{ + INT result; + __asm__ ("mult %[a_Re], %[b_Re];\n" + "msub %[a_Im], %[b_Im];\n" + : "=hi"(result) + : [a_Re]"r"(a_Re), [b_Re]"r"(b_Re), [a_Im]"r"(a_Im), [b_Im]"r"(b_Im) + : "lo"); + *c_Re = result<<1; + + __asm__ ("mult %[a_Re], %[b_Im];\n" + "madd %[a_Im], %[b_Re];\n" + : "=hi"(result) + : [a_Re]"r"(a_Re), [b_Im]"r"(b_Im), [a_Im]"r"(a_Im), [b_Re]"r"(b_Re) + : "lo"); + *c_Im = result<<1; +} +#endif + +#endif /* defined(__GNUC__) && defined(__mips__) */ + diff --git a/libFDK/include/mips/fixmadd_mips.h b/libFDK/include/mips/fixmadd_mips.h new file mode 100644 index 0000000..4d075ad --- /dev/null +++ b/libFDK/include/mips/fixmadd_mips.h @@ -0,0 +1,32 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +#if defined(__mips__) + + +#endif /* __mips__ */ + diff --git a/libFDK/include/mips/fixmul_mips.h b/libFDK/include/mips/fixmul_mips.h new file mode 100644 index 0000000..067674c --- /dev/null +++ b/libFDK/include/mips/fixmul_mips.h @@ -0,0 +1,53 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +#if defined(__mips__) + +#if (__GNUC__) && defined(__mips__) /* cppp replaced: elif */ +/* MIPS GCC based compiler */ + +#define FUNCTION_fixmuldiv2_DD + +#define FUNCTION_fixmuldiv2BitExact_DD +#define fixmuldiv2BitExact_DD(a,b) fixmuldiv2_DD(a,b) + +inline INT fixmuldiv2_DD (const INT a, const INT b) +{ + INT result ; + + asm ("mult %1,%2;\n" + : "=hi" (result) + : "d" (a), "r" (b) + : "lo"); + + return result ; +} + +#endif /* (__GNUC__) && defined(__mips__) */ + +#endif /* __mips__ */ + diff --git a/libFDK/include/mips/scale.h b/libFDK/include/mips/scale.h new file mode 100644 index 0000000..82b1833 --- /dev/null +++ b/libFDK/include/mips/scale.h @@ -0,0 +1,48 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2007) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef MIPS_SCALE_H +#define MIPS_SCALE_H + +#if defined(__mips_dsp) + +/*! +* +* \brief Scale input value by 2^{scale} and saturate output to 2^{dBits-1} +* \return scaled and saturated value +* +* This macro scales src value right or left and applies saturation to (2^dBits)-1 +* maxima output. +*/ +#define SATURATE_RIGHT_SHIFT(src, scale, dBits) \ + (__builtin_mips_shll_s_w((src)>>scale,(DFRACT_BITS-(dBits)))>>(DFRACT_BITS-(dBits))) + + +#endif /*__mips_dsp */ + +#endif /* MIPS_SCALE_H */ diff --git a/libFDK/include/mips/scramble.h b/libFDK/include/mips/scramble.h new file mode 100644 index 0000000..b93031a --- /dev/null +++ b/libFDK/include/mips/scramble.h @@ -0,0 +1,59 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2007) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef MIPS_SCRAMBLE_H +#define MIPS_SCRAMBLE_H + +#define FUNCTION_scramble + +#if defined(FUNCTION_scramble) +inline void scramble(FIXP_DBL *x, INT n) { + INT m,j; + int ldn=1; + do {ldn++;} while((1<<ldn)<n); + + for (m=1,j=0; m<n-1; m++) + { + j = __builtin_mips_bitrev(m) >> (16-ldn); + + if (j>m) + { + FIXP_DBL tmp; + tmp=x[2*m]; + x[2*m]=x[2*j]; + x[2*j]=tmp; + + tmp=x[2*m+1]; + x[2*m+1]=x[2*j+1]; + x[2*j+1]=tmp; + } + } +} +#endif + +#endif /* MIPS_SCRAMBLE_H */ diff --git a/libFDK/include/qmf.h b/libFDK/include/qmf.h new file mode 100644 index 0000000..89c1061 --- /dev/null +++ b/libFDK/include/qmf.h @@ -0,0 +1,188 @@ +/**************************************************************************** + + (C) Copyright Fraunhofer IIS (2004) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + + $Id$ + +*******************************************************************************/ +/*! + \file qmf.h + \brief Complex qmf analysis/synthesis $Revision: 36871 $ + \author Markus Werner + +*/ +#ifndef __QMF_H +#define __QMF_H + + + +#include "common_fix.h" +#include "FDK_tools_rom.h" +#include "dct.h" + +/* + * Filter coefficient type definition + */ +#ifdef QMF_DATA_16BIT +#define FIXP_QMF FIXP_SGL +#define FX_DBL2FX_QMF FX_DBL2FX_SGL +#define FX_QMF2FX_DBL FX_SGL2FX_DBL +#define QFRACT_BITS FRACT_BITS +#else +#define FIXP_QMF FIXP_DBL +#define FX_DBL2FX_QMF +#define FX_QMF2FX_DBL +#define QFRACT_BITS DFRACT_BITS +#endif + +/* ARM neon optimized QMF analysis filter requires 32 bit input. + Implemented for RVCT only, currently disabled. See src/arm/qmf_arm.cpp:45 */ +#define FIXP_QAS FIXP_PCM +#define QAS_BITS SAMPLE_BITS + +#ifdef QMFSYN_STATES_16BIT +#define FIXP_QSS FIXP_SGL +#define QSS_BITS FRACT_BITS +#else +#define FIXP_QSS FIXP_DBL +#define QSS_BITS DFRACT_BITS +#endif + +/* Flags for QMF intialization */ +/* Low Power mode flag */ +#define QMF_FLAG_LP 1 +/* Filter is not symetric. This flag is set internally in the QMF initialization as required. */ +#define QMF_FLAG_NONSYMMETRIC 2 +/* Complex Low Delay Filter Bank (or std symmetric filter bank) */ +#define QMF_FLAG_CLDFB 4 +/* Flag indicating that the states should be kept. */ +#define QMF_FLAG_KEEP_STATES 8 +/* Complex Low Delay Filter Bank used in MPEG Surround Encoder */ +#define QMF_FLAG_MPSLDFB 16 +/* Complex Low Delay Filter Bank used in MPEG Surround Encoder allows a optimized calculation of the modulation in qmfForwardModulationHQ() */ +#define QMF_FLAG_MPSLDFB_OPTIMIZE_MODULATION 32 + + +typedef struct +{ + int lb_scale; /*!< Scale of low band area */ + int ov_lb_scale; /*!< Scale of adjusted overlap low band area */ + int hb_scale; /*!< Scale of high band area */ + int ov_hb_scale; /*!< Scale of adjusted overlap high band area */ +} QMF_SCALE_FACTOR; + +struct QMF_FILTER_BANK +{ + const FIXP_PFT *p_filter; /*!< Pointer to filter coefficients */ + + void *FilterStates; /*!< Pointer to buffer of filter states + FIXP_PCM in analyse and + FIXP_DBL in synthesis filter */ + int FilterSize; /*!< Size of prototype filter. */ + const FIXP_QTW *t_cos; /*!< Modulation tables. */ + const FIXP_QTW *t_sin; + int filterScale; /*!< filter scale */ + + int no_channels; /*!< Total number of channels (subbands) */ + int no_col; /*!< Number of time slots */ + int lsb; /*!< Top of low subbands */ + int usb; /*!< Top of high subbands */ + + int outScalefactor; /*!< Scale factor of output data (syn only) */ + FIXP_DBL outGain; /*!< Gain output data (syn only) (init with 0x80000000 to ignore) */ + + UINT flags; /*!< flags */ + UCHAR p_stride; /*!< Stride Factor of polyphase filters */ + +}; + +typedef struct QMF_FILTER_BANK *HANDLE_QMF_FILTER_BANK; + +void +qmfAnalysisFiltering( HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Analysis Bank */ + FIXP_QMF **qmfReal, /*!< Pointer to real subband slots */ + FIXP_QMF **qmfImag, /*!< Pointer to imag subband slots */ + QMF_SCALE_FACTOR *scaleFactor, /*!< Scale factors of QMF data */ + const INT_PCM *timeIn, /*!< Time signal */ + const int stride, /*!< Stride factor of audio data */ + FIXP_QMF *pWorkBuffer /*!< pointer to temporal working buffer */ + ); + +void +qmfSynthesisFiltering( HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_QMF **QmfBufferReal, /*!< Pointer to real subband slots */ + FIXP_QMF **QmfBufferImag, /*!< Pointer to imag subband slots */ + const QMF_SCALE_FACTOR *scaleFactor, /*!< Scale factors of QMF data */ + const int ov_len, /*!< Length of band overlap */ + INT_PCM *timeOut, /*!< Time signal */ + const int stride, /*!< Stride factor of audio data */ + FIXP_QMF *pWorkBuffer /*!< pointer to temporal working buffer */ + ); + +int +qmfInitAnalysisFilterBank( HANDLE_QMF_FILTER_BANK h_Qmf, /*!< QMF Handle */ + FIXP_QAS *pFilterStates, /*!< Pointer to filter state buffer */ + int noCols, /*!< Number of time slots */ + int lsb, /*!< Number of lower bands */ + int usb, /*!< Number of upper bands */ + int no_channels, /*!< Number of critically sampled bands */ + int flags); /*!< Flags */ + +void +qmfAnalysisFilteringSlot( HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_QMF *qmfReal, /*!< Low and High band, real */ + FIXP_QMF *qmfImag, /*!< Low and High band, imag */ + const INT_PCM *timeIn, /*!< Pointer to input */ + const int stride, /*!< stride factor of input */ + FIXP_QMF *pWorkBuffer /*!< pointer to temporal working buffer */ + ); + +int +qmfInitSynthesisFilterBank( HANDLE_QMF_FILTER_BANK h_Qmf, /*!< QMF Handle */ + FIXP_QSS *pFilterStates, /*!< Pointer to filter state buffer */ + int noCols, /*!< Number of time slots */ + int lsb, /*!< Number of lower bands */ + int usb, /*!< Number of upper bands */ + int no_channels, /*!< Number of critically sampled bands */ + int flags); /*!< Flags */ + +void qmfSynthesisFilteringSlot( HANDLE_QMF_FILTER_BANK synQmf, + const FIXP_QMF *realSlot, + const FIXP_QMF *imagSlot, + const int scaleFactorLowBand, + const int scaleFactorHighBand, + INT_PCM *timeOut, + const int stride, + FIXP_QMF *pWorkBuffer); + +void +qmfChangeOutScalefactor (HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + int outScalefactor /*!< New scaling factor for output data */ + ); + +void +qmfChangeOutGain (HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_DBL outputGain /*!< New gain for output data */ + ); + + + +#endif /* __QMF_H */ diff --git a/libFDK/include/scale.h b/libFDK/include/scale.h new file mode 100644 index 0000000..72e7f03 --- /dev/null +++ b/libFDK/include/scale.h @@ -0,0 +1,180 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: Scaling operations + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef SCALE_H +#define SCALE_H + +#include "common_fix.h" +#include "genericStds.h" +#include "fixminmax.h" + + #define SCALE_INLINE inline + + +#if defined(__arm__) /* cppp replaced: elif */ +#include "arm/scale.h" + +#elif defined(__mips__) /* cppp replaced: elif */ +#include "mips/scale.h" + +#endif + + +#include "../src/scale.cpp" + +#ifndef FUNCTION_scaleValue +/*! + * + * \brief Multiply input by \f$ 2^{scalefactor} \f$ + * + * \return Scaled input + * + */ +#define FUNCTION_scaleValue +inline +FIXP_DBL scaleValue(const FIXP_DBL value, /*!< Value */ + INT scalefactor /*!< Scalefactor */ + ) +{ + if(scalefactor > 0) + return (value<<scalefactor); + else + return (value>>(-scalefactor)); +} +#endif + +#ifndef FUNCTION_scaleValueSaturate +/*! + * + * \brief Multiply input by \f$ 2^{scalefactor} \f$ + * \param value The value to be scaled. + * \param the shift amount + * \return \f$ value * 2^scalefactor \f$ + * + */ +#define FUNCTION_scaleValueSaturate +inline +FIXP_DBL scaleValueSaturate( + const FIXP_DBL value, + INT scalefactor + ) +{ + if(scalefactor > 0) { + if (fNorm(value) < scalefactor && value != (FIXP_DBL)0) { + return (FIXP_DBL)MAXVAL_DBL; + } else { + return (value<<scalefactor); + } + } else { + return (value>>(-scalefactor)); + } +} +#endif + +#ifndef FUNCTION_scaleValueInPlace +/*! + * + * \brief Multiply input by \f$ 2^{scalefactor} \f$ in place + * + * \return void + * + */ +#define FUNCTION_scaleValueInPlace +inline +void scaleValueInPlace( + FIXP_DBL *value, /*!< Value */ + INT scalefactor /*!< Scalefactor */ + ) +{ + INT newscale; + /* Note: The assignment inside the if conditional allows combining a load with the compare to zero (on ARM and maybe others) */ + if ((newscale = (scalefactor)) >= 0) { + *(value) <<= newscale; + } else { + *(value) >>= -newscale; + } +} +#endif + +/*! + * + * \brief Scale input value by 2^{scale} and saturate output to 2^{dBits-1} + * \return scaled and saturated value + * + * This macro scales src value right or left and applies saturation to (2^dBits)-1 + * maxima output. + */ + +#ifndef SATURATE_RIGHT_SHIFT + #define SATURATE_RIGHT_SHIFT(src, scale, dBits) \ + ( (((LONG)(src)>>(scale)) > (LONG)(((1U)<<((dBits)-1))-1)) ? (LONG)(((1U)<<((dBits)-1))-1) \ + : (((LONG)(src)>>(scale)) < ~((LONG)(((1U)<<((dBits)-1))-1))) ? ~((LONG)(((1U)<<((dBits)-1))-1)) \ + : ((LONG)(src) >> (scale)) ) +#endif + +#ifndef SATURATE_LEFT_SHIFT + #define SATURATE_LEFT_SHIFT(src, scale, dBits) \ + ( ((LONG)(src) > ((LONG)(((1U)<<((dBits)-1))-1)>>(scale))) ? (LONG)(((1U)<<((dBits)-1))-1) \ + : ((LONG)(src) < ~((LONG)(((1U)<<((dBits)-1))-1)>>(scale))) ? ~((LONG)(((1U)<<((dBits)-1))-1)) \ + : ((LONG)(src) << (scale)) ) +#endif + +#ifndef SATURATE_SHIFT +#define SATURATE_SHIFT(src, scale, dBits) \ + ( ((scale) < 0) \ + ? SATURATE_LEFT_SHIFT((src), -(scale), (dBits)) \ + : SATURATE_RIGHT_SHIFT((src), (scale), (dBits)) ) +#endif + +/* + * Alternative shift and saturate left, saturates to -0.99999 instead of -1.0000 + * to avoid problems when inverting the sign of the result. + */ +#ifndef SATURATE_LEFT_SHIFT_ALT +#define SATURATE_LEFT_SHIFT_ALT(src, scale, dBits) \ + ( ((LONG)(src) > ((LONG)(((1U)<<((dBits)-1))-1)>>(scale))) ? (LONG)(((1U)<<((dBits)-1))-1) \ + : ((LONG)(src) < ~((LONG)(((1U)<<((dBits)-1))-2)>>(scale))) ? ~((LONG)(((1U)<<((dBits)-1))-2)) \ + : ((LONG)(src) << (scale)) ) +#endif + +#ifndef SATURATE_RIGHT_SHIFT_ALT + #define SATURATE_RIGHT_SHIFT_ALT(src, scale, dBits) \ + ( (((LONG)(src)>>(scale)) > (LONG)(((1U)<<((dBits)-1))-1)) ? (LONG)(((1U)<<((dBits)-1))-1) \ + : (((LONG)(src)>>(scale)) < ~((LONG)(((1U)<<((dBits)-1))-2))) ? ~((LONG)(((1U)<<((dBits)-1))-2)) \ + : ((LONG)(src) >> (scale)) ) +#endif + +#ifndef SATURATE_INT_PCM_RIGHT_SHIFT +#define SATURATE_INT_PCM_RIGHT_SHIFT(src, scale) SATURATE_RIGHT_SHIFT(src, scale, SAMPLE_BITS) +#endif + +#ifndef SATURATE_INT_PCM_LEFT_SHIFT +#define SATURATE_INT_PCM_LEFT_SHIFT(src, scale) SATURATE_LEFT_SHIFT(src, scale, SAMPLE_BITS) +#endif + +#endif /* #ifndef SCALE_H */ diff --git a/libFDK/include/scramble.h b/libFDK/include/scramble.h new file mode 100644 index 0000000..3fc3b56 --- /dev/null +++ b/libFDK/include/scramble.h @@ -0,0 +1,103 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#ifndef SCRAMBLE_H +#define SCRAMBLE_H + +#include "common_fix.h" + +#if defined(__arm__) +#include "arm/scramble.h" + +#elif defined(__mips__) && defined(__mips_dsp) /* cppp replaced: elif */ +#include "mips/scramble.h" + +#endif + +/***************************************************************************** + + functionname: scramble + description: bitreversal of input data + returns: + input: + output: + +*****************************************************************************/ +#if !defined(FUNCTION_scramble_sgl) + +inline void scramble_sgl(FIXP_SGL *x, INT n) +{ + INT m,k,j; + + for (m=1,j=0; m<n-1; m++) + { + {for(k=n>>1; (!((j^=k)&k)); k>>=1);} + + if (j>m) + { + FIXP_SGL tmp; + tmp=x[2*m]; + x[2*m]=x[2*j]; + x[2*j]=tmp; + + tmp=x[2*m+1]; + x[2*m+1]=x[2*j+1]; + x[2*j+1]=tmp; + } + } +} +#endif + +#if !defined(FUNCTION_scramble) + +/* default scramble functionality */ +inline void scramble(FIXP_DBL *x, INT n) +{ + INT m,k,j; + FDK_ASSERT(!(((UINT64)x)&(ALIGNMENT_DEFAULT-1))); + + for (m=1,j=0; m<n-1; m++) + { + {for(k=n>>1; (!((j^=k)&k)); k>>=1);} + + if (j>m) + { + FIXP_DBL tmp; + tmp=x[2*m]; + x[2*m]=x[2*j]; + x[2*j]=tmp; + + tmp=x[2*m+1]; + x[2*m+1]=x[2*j+1]; + x[2*j+1]=tmp; + } + } +} +#endif /* !defined(FUNCTION_scramble) */ + +#endif /* SCRAMBLE_H */ diff --git a/libFDK/include/x86/abs_x86.h b/libFDK/include/x86/abs_x86.h new file mode 100644 index 0000000..682bc9f --- /dev/null +++ b/libFDK/include/x86/abs_x86.h @@ -0,0 +1,44 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +#if defined(__x86__) + + #if defined(__x86_64__) + + inline INT fixabs_D(INT x) { return ((x) > (INT)(0)) ? (x) : -(x) ; } + inline INT fixabs_S(INT x) { return ((x) > (INT)(0)) ? (x) : -(x) ; } + + #define fixabs_I(x) fixabs_D(x) + + #define FUNCTION_fixabs_S + #define FUNCTION_fixabs_D + #define FUNCTION_fixabs_I + + #endif /* __x86_64__ */ + +#endif /*__x86__ */ + diff --git a/libFDK/include/x86/fixmul_x86.h b/libFDK/include/x86/fixmul_x86.h new file mode 100644 index 0000000..d391b40 --- /dev/null +++ b/libFDK/include/x86/fixmul_x86.h @@ -0,0 +1,115 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: fixed point intrinsics + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +#if defined(__x86__) + +#if defined(_MSC_VER) && defined(_M_IX86) +/* Intel x86 */ + +#define FUNCTION_fixmul_DD +#define FUNCTION_fixmuldiv2_DD +#define FUNCTION_fixmuldiv2BitExact_DD +#define fixmuldiv2BitExact_DD(a,b) fixmuldiv2_DD(a,b) +#define FUNCTION_fixmulBitExact_DD +#define fixmulBitExact_DD(a,b) fixmul_DD(a,b) + +#define FUNCTION_fixmuldiv2BitExact_DS +#define fixmuldiv2BitExact_DS(a,b) fixmuldiv2_DS(a,b) + +#define FUNCTION_fixmulBitExact_DS +#define fixmulBitExact_DS(a,b) fixmul_DS(a,b) + +inline INT fixmul_DD (INT a, const INT b) +{ + __asm + { + mov eax, a + imul b + shl edx, 1 + mov a, edx + } + return a ; +} + + +inline INT fixmuldiv2_DD (INT a, const INT b) +{ + __asm + { + mov eax, a + imul b + mov a, edx + } + return a ; +} + +/* ############################################################################# */ +#elif (defined(__GNUC__)||defined(__gnu_linux__)) && defined(__x86__) + +#define FUNCTION_fixmul_DD +#define FUNCTION_fixmuldiv2_DD + +#define FUNCTION_fixmuldiv2BitExact_DD +#define fixmuldiv2BitExact_DD(a,b) fixmuldiv2_DD(a,b) + +#define FUNCTION_fixmulBitExact_DD +#define fixmulBitExact_DD(a,b) fixmul_DD(a,b) + +#define FUNCTION_fixmuldiv2BitExact_DS +#define fixmuldiv2BitExact_DS(a,b) fixmuldiv2_DS(a,b) + +#define FUNCTION_fixmulBitExact_DS +#define fixmulBitExact_DS(a,b) fixmul_DS(a,b) + +inline INT fixmul_DD (INT a, const INT b) +{ + INT result; + + asm( "imul %2;\n" + "shl $1, %0;\n" + : "=d"(result), "+a"(a) + : "r"(b) ); + + return result; +} + + +inline INT fixmuldiv2_DD (INT a, const INT b) +{ + INT result; + + asm ( "imul %2;" + : "=d"(result), "+a"(a) + : "r"(b) ); + + return result; +} + +#endif /* (defined(__GNUC__)||defined(__gnu_linux__)) && defined(__x86__) */ + +#endif /* __x86__ */ + diff --git a/libFDK/src/Android.mk b/libFDK/src/Android.mk new file mode 100644 index 0000000..64553d8 --- /dev/null +++ b/libFDK/src/Android.mk @@ -0,0 +1,30 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_SRC_FILES := \ + autocorr2nd.cpp \ + dct.cpp \ + FDK_bitbuffer.cpp \ + FDK_core.cpp \ + FDK_crc.cpp \ + FDK_tools_rom.cpp \ + FDK_trigFcts.cpp \ + fft.cpp \ + fft_rad2.cpp \ + fixpoint_math.cpp \ + mdct.cpp \ + qmf.cpp \ + scale.cpp + +LOCAL_CFLAGS := -DANDROID + +LOCAL_CFLAGS += -Wno-sequence-point -Wno-extra + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/../include \ + $(LOCAL_PATH)/../../libSYS/include \ + +LOCAL_MODULE:= libFDK + +include $(BUILD_STATIC_LIBRARY) diff --git a/libFDK/src/FDK_bitbuffer.cpp b/libFDK/src/FDK_bitbuffer.cpp new file mode 100644 index 0000000..75a0375 --- /dev/null +++ b/libFDK/src/FDK_bitbuffer.cpp @@ -0,0 +1,427 @@ +/*************************** Fraunhofer IIS FDK Tools *********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Lohwasser + Description: common bitbuffer read/write routines + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#include "FDK_bitbuffer.h" + + + + +#include "genericStds.h" +#include "common_fix.h" +#include "fixminmax.h" + +const UINT BitMask [32+1] = +{ + 0x0, 0x1, 0x3, 0x7, + 0xf, 0x1f, 0x3f, 0x7f, + 0xff, 0x1ff, 0x3ff, 0x7ff, + 0xfff, 0x1fff, 0x3fff, 0x7fff, + 0xffff, 0x1ffff, 0x3ffff, 0x7ffff, + 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, + 0xffffff, 0x1ffffff, 0x3ffffff, 0x7ffffff, + 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, + 0xffffffff +}; + +const UINT *const RESTRICT pBitMask = BitMask; + +void FDK_CreateBitBuffer (HANDLE_FDK_BITBUF *hBitBuf, UCHAR *pBuffer, + UINT bufSize) +{ + //*hBitBuf = (HANDLE_FDK_BITBUF) FDKcalloc(sizeof(FDK_BITBUF),1); + + FDK_InitBitBuffer (*hBitBuf, pBuffer, bufSize, 0); + + FDKmemclear((*hBitBuf)->Buffer, bufSize*sizeof(UCHAR)); +} + +void FDK_DeleteBitBuffer (HANDLE_FDK_BITBUF hBitBuf) { /*FDKfree((HANDLE_FDK_BITBUF)hBitBuf) */; } + +void FDK_InitBitBuffer (HANDLE_FDK_BITBUF hBitBuf, UCHAR *pBuffer, + UINT bufSize, UINT validBits) +{ + hBitBuf->ValidBits = validBits ; + hBitBuf->ReadOffset = 0 ; + hBitBuf->WriteOffset = 0 ; + hBitBuf->BitCnt = 0 ; + hBitBuf->BitNdx = 0 ; + + hBitBuf->Buffer = pBuffer ; + hBitBuf->bufSize = bufSize ; + hBitBuf->bufBits = (bufSize << 3) ; +#if defined(FDK_DEBUG) || defined(DEBUG) + /*assure bufsize (2^n) */ + if (bufSize!=0) { + UINT x = 0, n=bufSize; + for (x=0; n>0; x++,n>>=1) {} + if ( bufSize != (1<<(x-1)) ) { + FDKprintfErr("Error: bufSizein FDK_InitBitBuffer() != (2^n), %d\n", bufSize); + } + } +#endif +} + +void FDK_ResetBitBuffer ( HANDLE_FDK_BITBUF hBitBuf ) +{ + hBitBuf->ValidBits = 0 ; + hBitBuf->ReadOffset = 0 ; + hBitBuf->WriteOffset = 0 ; + hBitBuf->BitCnt = 0 ; + hBitBuf->BitNdx = 0 ; +} + +INT FDK_get (HANDLE_FDK_BITBUF hBitBuf, const UINT numberOfBits) +{ + UINT byteOffset = hBitBuf->BitNdx >> 3 ; + UINT bitOffset = hBitBuf->BitNdx & 0x07 ; + + hBitBuf->BitNdx = (hBitBuf->BitNdx + numberOfBits) & (hBitBuf->bufBits - 1) ; + hBitBuf->BitCnt += numberOfBits ; + hBitBuf->ValidBits -= numberOfBits ; + + UINT byteMask = hBitBuf->bufSize - 1 ; + + UINT tx = (hBitBuf->Buffer [ byteOffset & byteMask] << 24) | + (hBitBuf->Buffer [(byteOffset+1) & byteMask] << 16) | + (hBitBuf->Buffer [(byteOffset+2) & byteMask] << 8) | + hBitBuf->Buffer [(byteOffset+3) & byteMask]; + + if (bitOffset) + { + tx <<= bitOffset; + tx |= hBitBuf->Buffer [(byteOffset+4) & byteMask] >> (8-bitOffset); + } + + return (tx >> (32 - numberOfBits)) ; +} + +/* 01-DEC_2009 A. Tritthart + New routine added that reads 32 bits in order to allow a simple update of the 32-bit cache. + Due to push-back features, the read operations are not byte-aligned, nor 32-bit aligned, + all bytes need to be shifted according to the current read bit position. + Usage: bitstream->cache = FDK_get32 (bitstream); +*/ + +INT FDK_get32 (HANDLE_FDK_BITBUF hBitBuf) +{ + UINT BitNdx = hBitBuf->BitNdx + 32; + if (BitNdx <= hBitBuf->bufBits) + { + hBitBuf->BitNdx = BitNdx; + hBitBuf->BitCnt += 32; + hBitBuf->ValidBits -= 32; + + UINT byteOffset = (BitNdx-1) >> 3; + UINT cache = (hBitBuf->Buffer[(byteOffset-3)] << 24) | + (hBitBuf->Buffer[(byteOffset-2)] << 16) | + (hBitBuf->Buffer[(byteOffset-1)] << 8) | + hBitBuf->Buffer[(byteOffset-0)]; + + if ( (BitNdx = (BitNdx&7)) != 0 ) { + cache = (cache >> (8-BitNdx)) | ((UINT)hBitBuf->Buffer [byteOffset-4] << (24+BitNdx)); + } + return (cache) ; + } + else + { + /* exotic path, used only at the end of the buffer, when wrapping around */ + int nBits = (INT)hBitBuf->bufBits-(INT)hBitBuf->BitNdx; + + UINT cache = FDK_get (hBitBuf,nBits)<< (32-nBits); + cache |= (FDK_get (hBitBuf,32-nBits)); + return (cache); + } +} + +INT FDK_getBwd (HANDLE_FDK_BITBUF hBitBuf, const UINT numberOfBits) +{ + UINT byteOffset = hBitBuf->BitNdx >> 3 ; + UINT bitOffset = hBitBuf->BitNdx & 0x07 ; + UINT byteMask = hBitBuf->bufSize - 1 ; + int i; + + hBitBuf->BitNdx = (hBitBuf->BitNdx - numberOfBits) & (hBitBuf->bufBits - 1) ; + hBitBuf->BitCnt -= numberOfBits ; + hBitBuf->ValidBits += numberOfBits ; + + UINT tx = hBitBuf->Buffer [(byteOffset-3) & byteMask] << 24 | + hBitBuf->Buffer [(byteOffset-2) & byteMask] << 16 | + hBitBuf->Buffer [(byteOffset-1) & byteMask] << 8 | + hBitBuf->Buffer [ byteOffset & byteMask] ; + UINT txa = 0x0; + + tx >>= (8 - bitOffset) ; + + if (bitOffset && numberOfBits > 24) + { + tx |= hBitBuf->Buffer [(byteOffset-4) & byteMask] << (24 + bitOffset) ; + } + + /* in place turn around */ + for (i = 0; i < 16; i++) { + UINT bitMaskR = 0x00000001 << i; + UINT bitMaskL = 0x80000000 >> i; + + txa |= (tx & bitMaskR) << (31 - (i<<1)); + txa |= (tx & bitMaskL) >> (31 - (i<<1)); + } + + return (txa >> (32 - numberOfBits)) ; +} + +void FDK_put (HANDLE_FDK_BITBUF hBitBuf, UINT value, const UINT numberOfBits) +{ + UINT byteOffset = hBitBuf->BitNdx >> 3 ; + UINT bitOffset = hBitBuf->BitNdx & 0x07 ; + + hBitBuf->BitNdx = (hBitBuf->BitNdx + numberOfBits) & (hBitBuf->bufBits - 1) ; + hBitBuf->BitCnt += numberOfBits ; + hBitBuf->ValidBits += numberOfBits ; + + UINT byteMask = hBitBuf->bufSize - 1 ; + + UINT tmp = value<<(32-numberOfBits)>>bitOffset; + UINT mask = ~BitMask[(32-bitOffset)] | (BitMask [(32-numberOfBits)] >> bitOffset) ; + + hBitBuf->Buffer [ byteOffset & byteMask] = (hBitBuf->Buffer [ byteOffset & byteMask]&(mask>>24)) | (UCHAR)(tmp>>24); + hBitBuf->Buffer [(byteOffset+1) & byteMask] = (hBitBuf->Buffer [(byteOffset+1) & byteMask]&(mask>>16)) | (UCHAR)(tmp>>16); + hBitBuf->Buffer [(byteOffset+2) & byteMask] = (hBitBuf->Buffer [(byteOffset+2) & byteMask]&(mask>>8)) | (UCHAR)(tmp>>8); + hBitBuf->Buffer [(byteOffset+3) & byteMask] = (hBitBuf->Buffer [(byteOffset+3) & byteMask]&(mask)) | (UCHAR)(tmp); + + if (bitOffset && numberOfBits > 24) + { + hBitBuf->Buffer [(byteOffset+4) & byteMask] = (UCHAR)(value<<(40-numberOfBits)>>bitOffset) | + ( hBitBuf->Buffer [(byteOffset+4) & byteMask] & BitMask[(40-numberOfBits-bitOffset)] ) ; + } +} + +void FDK_putBwd (HANDLE_FDK_BITBUF hBitBuf, UINT value, const UINT numberOfBits) +{ + UINT byteOffset = hBitBuf->BitNdx >> 3 ; + UINT bitOffset = 7 - (hBitBuf->BitNdx & 0x07) ; + UINT byteMask = hBitBuf->bufSize - 1 ; + + UINT mask = ~(BitMask[numberOfBits] << bitOffset) ; + UINT tmp = 0x0000; + int i; + + hBitBuf->BitNdx = (hBitBuf->BitNdx - numberOfBits) & (hBitBuf->bufBits - 1) ; + hBitBuf->BitCnt -= numberOfBits ; + hBitBuf->ValidBits -= numberOfBits ; + + /* in place turn around */ + for (i = 0; i < 16; i++) { + UINT bitMaskR = 0x00000001 << i; + UINT bitMaskL = 0x80000000 >> i; + + tmp |= (value & bitMaskR) << (31 - (i<<1)); + tmp |= (value & bitMaskL) >> (31 - (i<<1)); + } + value = tmp; + tmp = value>>(32-numberOfBits)<<bitOffset; + + hBitBuf->Buffer [ byteOffset & byteMask] = (hBitBuf->Buffer [ byteOffset & byteMask]&(mask)) | (UCHAR)(tmp); + hBitBuf->Buffer [(byteOffset-1) & byteMask] = (hBitBuf->Buffer [(byteOffset-1) & byteMask]&(mask>>8)) | (UCHAR)(tmp>>8); + hBitBuf->Buffer [(byteOffset-2) & byteMask] = (hBitBuf->Buffer [(byteOffset-2) & byteMask]&(mask>>16)) | (UCHAR)(tmp>>16); + hBitBuf->Buffer [(byteOffset-3) & byteMask] = (hBitBuf->Buffer [(byteOffset-3) & byteMask]&(mask>>24)) | (UCHAR)(tmp>>24); + + if ((bitOffset + numberOfBits) > 32) + { + hBitBuf->Buffer [(byteOffset-4) & byteMask] = (UCHAR)(value>>(64-numberOfBits-bitOffset)) | + ( hBitBuf->Buffer [(byteOffset-4) & byteMask] & ~(BitMask[bitOffset] >> (32-numberOfBits)) ) ; + } +} + + +void FDK_pushBack (HANDLE_FDK_BITBUF hBitBuf, const UINT numberOfBits, UCHAR config) +{ + hBitBuf->BitCnt -= numberOfBits ; + hBitBuf->ValidBits += (config==0) ? numberOfBits : (-(INT)numberOfBits) ; + hBitBuf->BitNdx = (hBitBuf->BitNdx - numberOfBits) & (hBitBuf->bufBits - 1) ; +} + +void FDK_pushForward (HANDLE_FDK_BITBUF hBitBuf, const UINT numberOfBits, UCHAR config) +{ + hBitBuf->BitCnt += numberOfBits ; + hBitBuf->ValidBits -= (config==0) ? numberOfBits : (-(INT)numberOfBits) ; + hBitBuf->BitNdx = (hBitBuf->BitNdx + numberOfBits) & (hBitBuf->bufBits - 1) ; +} + + +void FDK_byteAlign (HANDLE_FDK_BITBUF hBitBuf, UCHAR config) +{ + INT alignment = hBitBuf->BitCnt & 0x07 ; + + if (alignment) + { + if (config==0) + FDK_pushForward (hBitBuf, 8 - alignment, config) ; /* BS_READER */ + else + FDK_put (hBitBuf,0 , 8 - alignment) ; /* BS_WRITER */ + } + + hBitBuf->BitCnt = 0 ; +} + +UINT FDK_getValidBits (HANDLE_FDK_BITBUF hBitBuf) +{ + return hBitBuf->ValidBits; +} + +INT FDK_getFreeBits (HANDLE_FDK_BITBUF hBitBuf) +{ + return (hBitBuf->bufBits - hBitBuf->ValidBits) ; +} + +void FDK_setBitCnt (HANDLE_FDK_BITBUF hBitBuf, const UINT value) +{ + hBitBuf->BitCnt = value ; +} + +INT FDK_getBitCnt (HANDLE_FDK_BITBUF hBitBuf) +{ + return hBitBuf->BitCnt ; +} + +void FDK_Feed(HANDLE_FDK_BITBUF hBitBuf, + UCHAR *RESTRICT inputBuffer, + const UINT bufferSize, + UINT *bytesValid) +{ + inputBuffer = &inputBuffer [bufferSize - *bytesValid] ; + + UINT bTotal = 0 ; + + UINT bToRead = (hBitBuf->bufBits - hBitBuf->ValidBits) >> 3 ; + UINT noOfBytes = fMin(bToRead, *bytesValid); //(bToRead < *bytesValid) ? bToRead : *bytesValid ; + + while (noOfBytes > 0) + { + /* split read to buffer size */ + bToRead = hBitBuf->bufSize - hBitBuf->ReadOffset ; + bToRead = fMin(bToRead, noOfBytes); //(bToRead < noOfBytes) ? bToRead : noOfBytes ; + + /* copy 'bToRead' bytes from 'ptr' to inputbuffer */ + FDKmemcpy(&hBitBuf->Buffer[hBitBuf->ReadOffset], inputBuffer, bToRead*sizeof(UCHAR)); + + /* add noOfBits to number of valid bits in buffer */ + hBitBuf->ValidBits += bToRead << 3 ; + bTotal += bToRead ; + inputBuffer += bToRead ; + + hBitBuf->ReadOffset = (hBitBuf->ReadOffset + bToRead) & (hBitBuf->bufSize - 1) ; + noOfBytes -= bToRead ; + } + + *bytesValid -= bTotal ; +} + +void CopyAlignedBlock (HANDLE_FDK_BITBUF h_BitBufSrc, UCHAR *RESTRICT dstBuffer, UINT bToRead) +{ + UINT byteOffset = h_BitBufSrc->BitNdx >> 3 ; + const UINT byteMask = h_BitBufSrc->bufSize - 1 ; + + UCHAR *RESTRICT pBBB = h_BitBufSrc->Buffer; + for (UINT i = 0 ; i < bToRead ; i++) + { + dstBuffer[i] = pBBB[(byteOffset+i) & byteMask] ; + } + + bToRead <<= 3 ; + + h_BitBufSrc->BitNdx = (h_BitBufSrc->BitNdx + bToRead) & (h_BitBufSrc->bufBits - 1) ; + h_BitBufSrc->BitCnt += bToRead ; + h_BitBufSrc->ValidBits -= bToRead ; +} + +void FDK_Copy (HANDLE_FDK_BITBUF h_BitBufDst, HANDLE_FDK_BITBUF h_BitBufSrc, UINT *bytesValid) +{ + INT bTotal = 0; + + /* limit noOfBytes to valid bytes in src buffer and available bytes in dst buffer */ + UINT bToRead = h_BitBufSrc->ValidBits >> 3 ; + UINT noOfBytes = fMin(bToRead, *bytesValid); //(*bytesValid < bToRead) ? *bytesValid : bToRead ; + bToRead = FDK_getFreeBits(h_BitBufDst); + noOfBytes = fMin(bToRead, noOfBytes); //(bToRead < noOfBytes) ? bToRead : noOfBytes; + + while (noOfBytes > 0) + { + /* Split Read to buffer size */ + bToRead = h_BitBufDst->bufSize - h_BitBufDst->ReadOffset ; + bToRead = fMin(noOfBytes, bToRead); //(noOfBytes < bToRead) ? noOfBytes : bToRead ; + + /* copy 'bToRead' bytes from buffer to buffer */ + if (!(h_BitBufSrc->BitNdx & 0x07)) { + CopyAlignedBlock (h_BitBufSrc, h_BitBufDst->Buffer + h_BitBufDst->ReadOffset, bToRead) ; + } else { + for (UINT i = 0; i < bToRead; i++) + { + h_BitBufDst->Buffer [h_BitBufDst->ReadOffset + i] = (UCHAR)FDK_get(h_BitBufSrc,8); + } + } + + /* add noOfBits to number of valid bits in buffer */ + h_BitBufDst->ValidBits += bToRead << 3 ; + bTotal += bToRead; + + h_BitBufDst->ReadOffset = (h_BitBufDst->ReadOffset + bToRead) & (h_BitBufDst->bufSize-1); + noOfBytes -= bToRead; + } + + *bytesValid -=bTotal; +} + +void FDK_Fetch (HANDLE_FDK_BITBUF hBitBuf, UCHAR *outBuf, UINT *writeBytes) +{ + UCHAR *RESTRICT outputBuffer = outBuf; + UINT bTotal = 0 ; + + UINT bToWrite = (hBitBuf->ValidBits) >> 3 ; + UINT noOfBytes = fMin(bToWrite, *writeBytes); //(bToWrite < *writeBytes) ? bToWrite : *writeBytes ; + + while (noOfBytes > 0) + { + /* split write to buffer size */ + bToWrite = hBitBuf->bufSize - hBitBuf->WriteOffset ; + bToWrite = fMin(bToWrite, noOfBytes); //(bToWrite < noOfBytes) ? bToWrite : noOfBytes ; + + /* copy 'bToWrite' bytes from bitbuffer to outputbuffer */ + FDKmemcpy(outputBuffer, &hBitBuf->Buffer[hBitBuf->WriteOffset], bToWrite*sizeof(UCHAR)); + + /* sub noOfBits from number of valid bits in buffer */ + hBitBuf->ValidBits -= bToWrite << 3 ; + bTotal += bToWrite ; + outputBuffer += bToWrite ; + + hBitBuf->WriteOffset = (hBitBuf->WriteOffset + bToWrite) & (hBitBuf->bufSize - 1) ; + noOfBytes -= bToWrite ; + } + + *writeBytes = bTotal ; +} + diff --git a/libFDK/src/FDK_core.cpp b/libFDK/src/FDK_core.cpp new file mode 100644 index 0000000..3f5e8fb --- /dev/null +++ b/libFDK/src/FDK_core.cpp @@ -0,0 +1,66 @@ +/*************************** Fraunhofer IIS FDK Tools *********************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Manuel Jander + Description: FDK tools versioning support + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#include "FDK_core.h" + +/* FDK tools library info */ +#define FDK_TOOLS_LIB_VL0 2 +#define FDK_TOOLS_LIB_VL1 2 +#define FDK_TOOLS_LIB_VL2 5 +#define FDK_TOOLS_LIB_TITLE "FDK Tools" +#define FDK_TOOLS_LIB_BUILD_DATE __DATE__ +#define FDK_TOOLS_LIB_BUILD_TIME __TIME__ + +int FDK_toolsGetLibInfo(LIB_INFO *info) +{ + UINT v; + int i; + + if (info == NULL) { + return -1; + } + + /* search for next free tab */ + i = FDKlibInfo_lookup(info, FDK_TOOLS); + if (i<0) return -1; + + info += i; + + v = LIB_VERSION(FDK_TOOLS_LIB_VL0, FDK_TOOLS_LIB_VL1, FDK_TOOLS_LIB_VL2); + + FDKsprintf(info->versionStr, "%d.%d.%d", ((v >> 24) & 0xff), ((v >> 16) & 0xff), ((v >> 8 ) & 0xff)); + + info->module_id = FDK_TOOLS; + info->version = v; + info->build_date = (char *)FDK_TOOLS_LIB_BUILD_DATE; + info->build_time = (char *)FDK_TOOLS_LIB_BUILD_TIME; + info->title = (char *)FDK_TOOLS_LIB_TITLE; + info->flags = 0; + + return 0; +} diff --git a/libFDK/src/FDK_crc.cpp b/libFDK/src/FDK_crc.cpp new file mode 100644 index 0000000..0049807 --- /dev/null +++ b/libFDK/src/FDK_crc.cpp @@ -0,0 +1,397 @@ +/******************************** MPEG Audio Encoder ************************** + + (C) Copyright Fraunhofer IIS (1999) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + + $Id$ + Initial author: + contents/description: CRC calculation + +******************************************************************************/ + +#include "FDK_crc.h" + + + +/*---------------- constants -----------------------*/ + +/** + * \brief This table defines precalculated lookup tables for crc polynom x^16 + x^15 + x^2 + x^0. + */ +static const USHORT crcLookup_16_15_2_0[256] = +{ + 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, + 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022, + 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, + 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041, + 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2, + 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1, + 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1, + 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082, + 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192, + 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1, + 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1, + 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2, + 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151, + 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162, + 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132, + 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101, + 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312, + 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321, + 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371, + 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342, + 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1, + 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2, + 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2, + 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381, + 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291, + 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2, + 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2, + 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1, + 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, + 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261, + 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, + 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202 +}; + +/** + * \brief This table defines precalculated lookup tables for crc polynom x^16 + x^12 + x^5 + x^0. + */ +static const USHORT crcLookup_16_12_5_0[256] = +{ + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, + 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, + 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, + 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, + 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, + 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, + 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, + 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, + 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, + 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, + 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, + 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, + 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, + 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, + 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, + 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, + 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, + 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, + 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, + 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, + 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, + 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, + 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 +}; + + +/*--------------- function declarations --------------------*/ + +static inline INT calcCrc_Bits( + USHORT * const pCrc, + USHORT crcMask, + USHORT crcPoly, + HANDLE_FDK_BITSTREAM hBs, + INT nBits + ); + +static inline INT calcCrc_Bytes( + USHORT * const pCrc, + const USHORT * pCrcLookup, + HANDLE_FDK_BITSTREAM hBs, + INT nBytes + ); + +static void crcCalc( + HANDLE_FDK_CRCINFO hCrcInfo, + HANDLE_FDK_BITSTREAM hBs, + const INT reg + ); + + +/*------------- function definitions ----------------*/ + +void FDKcrcInit( + HANDLE_FDK_CRCINFO hCrcInfo, + const UINT crcPoly, + const UINT crcStartValue, + const UINT crcLen + ) +{ + /* crc polynom example: + x^16 + x^15 + x^2 + x^0 (1) 1000 0000 0000 0101 -> 0x8005 + x^16 + x^12 + x^5 + x^0 (1) 0001 0000 0010 0001 -> 0x1021 + x^8 + x^4 + x^3 + x^2 + x^0 (1) 0001 1101 -> 0x001d */ + + hCrcInfo->crcLen = crcLen; + hCrcInfo->crcPoly = crcPoly; + hCrcInfo->startValue = crcStartValue; + hCrcInfo->crcMask = (crcLen) ? (1<<(crcLen-1)) : 0; + + FDKcrcReset(hCrcInfo); + + hCrcInfo->pCrcLookup = 0; + + if (hCrcInfo->crcLen==16) { + switch ( crcPoly ) { + case 0x8005: + hCrcInfo->pCrcLookup = crcLookup_16_15_2_0; + break; + case 0x1021: + hCrcInfo->pCrcLookup = crcLookup_16_12_5_0; + break; + case 0x001d: + default: + /* no lookup table */ + hCrcInfo->pCrcLookup = 0; + } + } + + +} + +void FDKcrcReset(HANDLE_FDK_CRCINFO hCrcInfo) +{ + int i; + + hCrcInfo->crcValue = hCrcInfo->startValue; + + for(i=0;i<MAX_CRC_REGS;i++) { + hCrcInfo->crcRegData[i].isActive = 0; + } + hCrcInfo->regStart = 0; + hCrcInfo->regStop = 0; +} + +INT FDKcrcStartReg( + HANDLE_FDK_CRCINFO hCrcInfo, + const HANDLE_FDK_BITSTREAM hBs, + const INT mBits + ) +{ + int reg = hCrcInfo->regStart; + + FDK_ASSERT(hCrcInfo->crcRegData[reg].isActive==0); + hCrcInfo->crcRegData[reg].isActive = 1; + hCrcInfo->crcRegData[reg].maxBits = mBits; + hCrcInfo->crcRegData[reg].validBits = FDKgetValidBits(hBs) ; + hCrcInfo->crcRegData[reg].bitBufCntBits = 0; + + hCrcInfo->regStart = (hCrcInfo->regStart+1)%MAX_CRC_REGS; + + return (reg); +} + +INT FDKcrcEndReg( + HANDLE_FDK_CRCINFO hCrcInfo, + const HANDLE_FDK_BITSTREAM hBs, + const INT reg + ) +{ + FDK_ASSERT((reg==(INT)hCrcInfo->regStop)&&(hCrcInfo->crcRegData[reg].isActive==1)); + + if (hBs->ConfigCache==BS_WRITER) { + hCrcInfo->crcRegData[reg].bitBufCntBits = FDKgetValidBits(hBs) - hCrcInfo->crcRegData[reg].validBits; + } + else { + hCrcInfo->crcRegData[reg].bitBufCntBits = hCrcInfo->crcRegData[reg].validBits - FDKgetValidBits(hBs); + } + + if (hCrcInfo->crcRegData[reg].maxBits == 0) { + hCrcInfo->crcRegData[reg].maxBits = hCrcInfo->crcRegData[reg].bitBufCntBits; + } + + crcCalc( hCrcInfo, hBs, reg); + + hCrcInfo->crcRegData[reg].isActive = 0; + hCrcInfo->regStop = (hCrcInfo->regStop+1)%MAX_CRC_REGS; + + return 0; +} + +USHORT FDKcrcGetCRC( + const HANDLE_FDK_CRCINFO hCrcInfo + ) +{ + return ( hCrcInfo->crcValue & (((hCrcInfo->crcMask-1)<<1)+1) ); +} + +/** + * \brief Calculate crc bits. + * + * Calculate crc starting at current bitstream postion over nBits. + * + * \param pCrc Pointer to an outlying allocated crc info structure. + * \param crcMask CrcMask in use. + * \param crcPoly Crc polynom in use. + * \param hBs Handle to current bit buffer structure. + * \param nBits Number of processing bits. + * + * \return Number of processed bits. + */ +static inline INT calcCrc_Bits( + USHORT * const pCrc, + USHORT crcMask, + USHORT crcPoly, + HANDLE_FDK_BITSTREAM hBs, + INT nBits + ) +{ + int i; + USHORT crc = *pCrc; /* get crc value */ + + if (hBs!=NULL) { + for (i = 0; (i < nBits); i++) { + USHORT tmp = FDKreadBits(hBs,1); // process single bit + tmp ^= ( (crc & crcMask) ? 1 : 0 ); + tmp *= crcPoly; + crc <<= 1; + crc ^= tmp; + } + } + else { + for (i = 0; (i < nBits); i++) { + USHORT tmp = 0; // process single bit + tmp ^= ( (crc & crcMask) ? 1 : 0 ); + tmp *= crcPoly; + crc <<= 1; + crc ^= tmp; + } + } + *pCrc = crc; /* update crc value */ + + return nBits; +} + +/** + * \brief Calculate crc bytes. + * + * Calculate crc starting at current bitstream postion over nBytes. + * + * \param pCrc Pointer to an outlying allocated crc info structure. + * \param pCrcLookup Pointer to lookup table used for fast crc calculation. + * \param hBs Handle to current bit buffer structure. + * \param nBits Number of processing bytes. + * + * \return Number of processed bits. + */ +static inline INT calcCrc_Bytes( + USHORT * const pCrc, + const USHORT * pCrcLookup, + HANDLE_FDK_BITSTREAM hBs, + INT nBytes + ) +{ + int i; + USHORT crc = *pCrc; /* get crc value */ + + if (hBs!=NULL) { + for (i=0; i<nBytes; i++) { + crc = (crc<<8)^pCrcLookup[((crc>>8)^((UCHAR)FDKreadBits(hBs,8)))&0xFF]; + } + } + else { + for (i=0; i<nBytes; i++) { + crc = (crc<<8)^pCrcLookup[((crc>>8)^((UCHAR)0))&0xFF]; + } + } + + *pCrc = crc; /* update crc value */ + + return (i); +} + +/** + * \brief Calculate crc. + * + * Calculate crc. Lenght depends on mBits parameter in FDKcrcStartReg() configuration. + * + * \param hCrcInfo Pointer to an outlying allocated crc info structure. + * \param hBs Pointer to current bit buffer structure. + * \param reg Crc region ID. + * + * \return Number of processed bits. + */ +static void crcCalc( + HANDLE_FDK_CRCINFO hCrcInfo, + HANDLE_FDK_BITSTREAM hBs, + const INT reg + ) +{ + USHORT crc = hCrcInfo->crcValue; + CCrcRegData *rD = &hCrcInfo->crcRegData[reg]; + FDK_BITSTREAM bsReader; + + if (hBs->ConfigCache==BS_READER) { + bsReader = *hBs; + FDKpushBiDirectional(&bsReader, -(INT)(rD->validBits-FDKgetValidBits(&bsReader))); + } + else { + FDKinitBitStream(&bsReader, hBs->hBitBuf.Buffer, hBs->hBitBuf.bufSize, hBs->hBitBuf.ValidBits, BS_READER); + FDKpushBiDirectional(&bsReader, rD->validBits); + } + + int bits, rBits; + rBits = (rD->maxBits>=0) ? rD->maxBits : -rD->maxBits; /* ramaining bits */ + if ((rD->maxBits>0) && (((INT)rD->bitBufCntBits>>3<<3)<rBits) ) { + bits = rD->bitBufCntBits; + } + else { + bits = rBits; + } + + int words = bits >> 3; /* processing bytes */ + int mBits = bits & 0x7; /* modulo bits */ + + if(hCrcInfo->pCrcLookup) { + rBits -= (calcCrc_Bytes(&crc, hCrcInfo->pCrcLookup, &bsReader, words)<<3); + } + else { + rBits -= calcCrc_Bits(&crc, hCrcInfo->crcMask, hCrcInfo->crcPoly, &bsReader, words<<3 ); + } + + /* remaining valid bits*/ + if(mBits!=0) { + rBits -= calcCrc_Bits(&crc, hCrcInfo->crcMask, hCrcInfo->crcPoly, &bsReader, mBits ); + } + + if (rBits!=0) { + /* zero bytes */ + if ( (hCrcInfo->pCrcLookup) && (rBits>8) ) { + rBits -= (calcCrc_Bytes(&crc, hCrcInfo->pCrcLookup, NULL, rBits>>3)<<3); + } + /* remaining zero bits */ + if (rBits!=0) { + rBits -= calcCrc_Bits(&crc, hCrcInfo->crcMask, hCrcInfo->crcPoly, NULL, rBits ); + } + } + + hCrcInfo->crcValue = crc; +} + diff --git a/libFDK/src/FDK_tools_rom.cpp b/libFDK/src/FDK_tools_rom.cpp new file mode 100644 index 0000000..d3c768b --- /dev/null +++ b/libFDK/src/FDK_tools_rom.cpp @@ -0,0 +1,2358 @@ +/*************************** Fraunhofer IIS FDK Tools *********************** + + (C) Copyright Fraunhofer IIS (2008) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Oliver Moser + Description: ROM tables used by FDK tools + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#include "FDK_tools_rom.h" + + + + + + + + + + + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STP SineTable480[] = +{ + STCP(0x7fffffff, 0x00000000), STCP(0x7fffd315, 0x006b3b9b), STCP(0x7fff4c54, 0x00d676eb), STCP(0x7ffe6bbf, 0x0141b1a5), + STCP(0x7ffd3154, 0x01aceb7c), STCP(0x7ffb9d15, 0x02182427), STCP(0x7ff9af04, 0x02835b5a), STCP(0x7ff76721, 0x02ee90c8), + STCP(0x7ff4c56f, 0x0359c428), STCP(0x7ff1c9ef, 0x03c4f52f), STCP(0x7fee74a2, 0x0430238f), STCP(0x7feac58d, 0x049b4f00), + STCP(0x7fe6bcb0, 0x05067734), STCP(0x7fe25a0f, 0x05719be2), STCP(0x7fdd9dad, 0x05dcbcbe), STCP(0x7fd8878e, 0x0647d97c), + STCP(0x7fd317b4, 0x06b2f1d2), STCP(0x7fcd4e24, 0x071e0575), STCP(0x7fc72ae2, 0x07891418), STCP(0x7fc0adf2, 0x07f41d72), + STCP(0x7fb9d759, 0x085f2137), STCP(0x7fb2a71b, 0x08ca1f1b), STCP(0x7fab1d3d, 0x093516d4), STCP(0x7fa339c5, 0x09a00817), + STCP(0x7f9afcb9, 0x0a0af299), STCP(0x7f92661d, 0x0a75d60e), STCP(0x7f8975f9, 0x0ae0b22c), STCP(0x7f802c52, 0x0b4b86a8), + STCP(0x7f76892f, 0x0bb65336), STCP(0x7f6c8c96, 0x0c21178c), STCP(0x7f62368f, 0x0c8bd35e), STCP(0x7f578721, 0x0cf68662), + STCP(0x7f4c7e54, 0x0d61304e), STCP(0x7f411c2f, 0x0dcbd0d5), STCP(0x7f3560b9, 0x0e3667ad), STCP(0x7f294bfd, 0x0ea0f48c), + STCP(0x7f1cde01, 0x0f0b7727), STCP(0x7f1016ce, 0x0f75ef33), STCP(0x7f02f66f, 0x0fe05c64), STCP(0x7ef57cea, 0x104abe71), + STCP(0x7ee7aa4c, 0x10b5150f), STCP(0x7ed97e9c, 0x111f5ff4), STCP(0x7ecaf9e5, 0x11899ed3), STCP(0x7ebc1c31, 0x11f3d164), + STCP(0x7eace58a, 0x125df75b), STCP(0x7e9d55fc, 0x12c8106f), STCP(0x7e8d6d91, 0x13321c53), STCP(0x7e7d2c54, 0x139c1abf), + STCP(0x7e6c9251, 0x14060b68), STCP(0x7e5b9f93, 0x146fee03), STCP(0x7e4a5426, 0x14d9c245), STCP(0x7e38b017, 0x154387e6), + STCP(0x7e26b371, 0x15ad3e9a), STCP(0x7e145e42, 0x1616e618), STCP(0x7e01b096, 0x16807e15), STCP(0x7deeaa7a, 0x16ea0646), + STCP(0x7ddb4bfc, 0x17537e63), STCP(0x7dc79529, 0x17bce621), STCP(0x7db3860f, 0x18263d36), STCP(0x7d9f1ebd, 0x188f8357), + STCP(0x7d8a5f40, 0x18f8b83c), STCP(0x7d7547a7, 0x1961db9b), STCP(0x7d5fd801, 0x19caed29), STCP(0x7d4a105d, 0x1a33ec9c), + STCP(0x7d33f0ca, 0x1a9cd9ac), STCP(0x7d1d7958, 0x1b05b40f), STCP(0x7d06aa16, 0x1b6e7b7a), STCP(0x7cef8315, 0x1bd72fa4), + STCP(0x7cd80464, 0x1c3fd045), STCP(0x7cc02e15, 0x1ca85d12), STCP(0x7ca80038, 0x1d10d5c2), STCP(0x7c8f7ade, 0x1d793a0b), + STCP(0x7c769e18, 0x1de189a6), STCP(0x7c5d69f7, 0x1e49c447), STCP(0x7c43de8e, 0x1eb1e9a7), STCP(0x7c29fbee, 0x1f19f97b), + STCP(0x7c0fc22a, 0x1f81f37c), STCP(0x7bf53153, 0x1fe9d75f), STCP(0x7bda497d, 0x2051a4dd), STCP(0x7bbf0aba, 0x20b95bac), + STCP(0x7ba3751d, 0x2120fb83), STCP(0x7b8788ba, 0x2188841a), STCP(0x7b6b45a5, 0x21eff528), STCP(0x7b4eabf1, 0x22574e65), + STCP(0x7b31bbb2, 0x22be8f87), STCP(0x7b1474fd, 0x2325b847), STCP(0x7af6d7e6, 0x238cc85d), STCP(0x7ad8e482, 0x23f3bf7e), + STCP(0x7aba9ae6, 0x245a9d65), STCP(0x7a9bfb27, 0x24c161c7), STCP(0x7a7d055b, 0x25280c5e), STCP(0x7a5db997, 0x258e9ce0), + STCP(0x7a3e17f2, 0x25f51307), STCP(0x7a1e2082, 0x265b6e8a), STCP(0x79fdd35c, 0x26c1af22), STCP(0x79dd3098, 0x2727d486), + STCP(0x79bc384d, 0x278dde6e), STCP(0x799aea92, 0x27f3cc94), STCP(0x7979477d, 0x28599eb0), STCP(0x79574f28, 0x28bf547b), + STCP(0x793501a9, 0x2924edac), STCP(0x79125f19, 0x298a69fc), STCP(0x78ef678f, 0x29efc925), STCP(0x78cc1b26, 0x2a550adf), + STCP(0x78a879f4, 0x2aba2ee4), STCP(0x78848414, 0x2b1f34eb), STCP(0x7860399e, 0x2b841caf), STCP(0x783b9aad, 0x2be8e5e8), + STCP(0x7816a759, 0x2c4d9050), STCP(0x77f15fbc, 0x2cb21ba0), STCP(0x77cbc3f2, 0x2d168792), STCP(0x77a5d413, 0x2d7ad3de), + STCP(0x777f903c, 0x2ddf0040), STCP(0x7758f886, 0x2e430c6f), STCP(0x77320d0d, 0x2ea6f827), STCP(0x770acdec, 0x2f0ac320), + STCP(0x76e33b3f, 0x2f6e6d16), STCP(0x76bb5521, 0x2fd1f5c1), STCP(0x76931bae, 0x30355cdd), STCP(0x766a8f04, 0x3098a223), + STCP(0x7641af3d, 0x30fbc54d), STCP(0x76187c77, 0x315ec617), STCP(0x75eef6ce, 0x31c1a43b), STCP(0x75c51e61, 0x32245f72), + STCP(0x759af34c, 0x3286f779), STCP(0x757075ac, 0x32e96c09), STCP(0x7545a5a0, 0x334bbcde), STCP(0x751a8346, 0x33ade9b3), + STCP(0x74ef0ebc, 0x340ff242), STCP(0x74c34820, 0x3471d647), STCP(0x74972f92, 0x34d3957e), STCP(0x746ac52f, 0x35352fa1), + STCP(0x743e0918, 0x3596a46c), STCP(0x7410fb6b, 0x35f7f39c), STCP(0x73e39c49, 0x36591cea), STCP(0x73b5ebd1, 0x36ba2014), + STCP(0x7387ea23, 0x371afcd5), STCP(0x73599760, 0x377bb2e9), STCP(0x732af3a7, 0x37dc420c), STCP(0x72fbff1b, 0x383ca9fb), + STCP(0x72ccb9db, 0x389cea72), STCP(0x729d2409, 0x38fd032d), STCP(0x726d3dc6, 0x395cf3e9), STCP(0x723d0734, 0x39bcbc63), + STCP(0x720c8075, 0x3a1c5c57), STCP(0x71dba9ab, 0x3a7bd382), STCP(0x71aa82f7, 0x3adb21a1), STCP(0x71790c7e, 0x3b3a4672), + STCP(0x71474660, 0x3b9941b1), STCP(0x711530c2, 0x3bf8131c), STCP(0x70e2cbc6, 0x3c56ba70), STCP(0x70b01790, 0x3cb5376b), + STCP(0x707d1443, 0x3d1389cb), STCP(0x7049c203, 0x3d71b14d), STCP(0x701620f5, 0x3dcfadb0), STCP(0x6fe2313c, 0x3e2d7eb1), + STCP(0x6fadf2fc, 0x3e8b240e), STCP(0x6f79665b, 0x3ee89d86), STCP(0x6f448b7e, 0x3f45ead8), STCP(0x6f0f6289, 0x3fa30bc1), + STCP(0x6ed9eba1, 0x40000000), STCP(0x6ea426ed, 0x405cc754), STCP(0x6e6e1492, 0x40b9617d), STCP(0x6e37b4b6, 0x4115ce38), + STCP(0x6e010780, 0x41720d46), STCP(0x6dca0d14, 0x41ce1e65), STCP(0x6d92c59b, 0x422a0154), STCP(0x6d5b313b, 0x4285b5d4), + STCP(0x6d23501b, 0x42e13ba4), STCP(0x6ceb2261, 0x433c9283), STCP(0x6cb2a837, 0x4397ba32), STCP(0x6c79e1c2, 0x43f2b271), + STCP(0x6c40cf2c, 0x444d7aff), STCP(0x6c07709b, 0x44a8139e), STCP(0x6bcdc639, 0x45027c0c), STCP(0x6b93d02e, 0x455cb40c), + STCP(0x6b598ea3, 0x45b6bb5e), STCP(0x6b1f01c0, 0x461091c2), STCP(0x6ae429ae, 0x466a36f9), STCP(0x6aa90697, 0x46c3aac5), + STCP(0x6a6d98a4, 0x471cece7), STCP(0x6a31e000, 0x4775fd1f), STCP(0x69f5dcd3, 0x47cedb31), STCP(0x69b98f48, 0x482786dc), + STCP(0x697cf78a, 0x487fffe4), STCP(0x694015c3, 0x48d84609), STCP(0x6902ea1d, 0x4930590f), STCP(0x68c574c4, 0x498838b6), + STCP(0x6887b5e2, 0x49dfe4c2), STCP(0x6849ada3, 0x4a375cf5), STCP(0x680b5c33, 0x4a8ea111), STCP(0x67ccc1be, 0x4ae5b0da), + STCP(0x678dde6e, 0x4b3c8c12), STCP(0x674eb271, 0x4b93327c), STCP(0x670f3df3, 0x4be9a3db), STCP(0x66cf8120, 0x4c3fdff4), + STCP(0x668f7c25, 0x4c95e688), STCP(0x664f2f2e, 0x4cebb75c), STCP(0x660e9a6a, 0x4d415234), STCP(0x65cdbe05, 0x4d96b6d3), + STCP(0x658c9a2d, 0x4debe4fe), STCP(0x654b2f10, 0x4e40dc79), STCP(0x65097cdb, 0x4e959d08), STCP(0x64c783bd, 0x4eea2670), + STCP(0x648543e4, 0x4f3e7875), STCP(0x6442bd7e, 0x4f9292dc), STCP(0x63fff0ba, 0x4fe6756a), STCP(0x63bcddc7, 0x503a1fe5), + STCP(0x637984d4, 0x508d9211), STCP(0x6335e611, 0x50e0cbb4), STCP(0x62f201ac, 0x5133cc94), STCP(0x62add7d6, 0x51869476), + STCP(0x626968be, 0x51d92321), STCP(0x6224b495, 0x522b7859), STCP(0x61dfbb8a, 0x527d93e6), STCP(0x619a7dce, 0x52cf758f), + STCP(0x6154fb91, 0x53211d18), STCP(0x610f3505, 0x53728a4a), STCP(0x60c92a5a, 0x53c3bcea), STCP(0x6082dbc1, 0x5414b4c1), + STCP(0x603c496c, 0x54657194), STCP(0x5ff5738d, 0x54b5f32c), STCP(0x5fae5a55, 0x55063951), STCP(0x5f66fdf5, 0x555643c8), + STCP(0x5f1f5ea1, 0x55a6125c), STCP(0x5ed77c8a, 0x55f5a4d2), STCP(0x5e8f57e2, 0x5644faf4), STCP(0x5e46f0dd, 0x5694148b), + STCP(0x5dfe47ad, 0x56e2f15d), STCP(0x5db55c86, 0x57319135), STCP(0x5d6c2f99, 0x577ff3da), STCP(0x5d22c11c, 0x57ce1917), + STCP(0x5cd91140, 0x581c00b3), STCP(0x5c8f203b, 0x5869aa79), STCP(0x5c44ee40, 0x58b71632), STCP(0x5bfa7b82, 0x590443a7), + STCP(0x5bafc837, 0x595132a2), STCP(0x5b64d492, 0x599de2ee), STCP(0x5b19a0c8, 0x59ea5454), STCP(0x5ace2d0f, 0x5a36869f), + STCP(0x5a82799a, 0x5a82799a) +}; + + +RAM_ALIGN +LNK_SECTION_CONSTDATA +LNK_SECTION_CONSTDATA_L1 +const FIXP_STP SineTable512[] = +{ + STCP(0x7fffffff, 0x00000000), STCP(0x7fffd886, 0x006487e3), STCP(0x7fff6216, 0x00c90f88), STCP(0x7ffe9cb2, 0x012d96b1), + STCP(0x7ffd885a, 0x01921d20), STCP(0x7ffc250f, 0x01f6a297), STCP(0x7ffa72d1, 0x025b26d7), STCP(0x7ff871a2, 0x02bfa9a4), + STCP(0x7ff62182, 0x03242abf), STCP(0x7ff38274, 0x0388a9ea), STCP(0x7ff09478, 0x03ed26e6), STCP(0x7fed5791, 0x0451a177), + STCP(0x7fe9cbc0, 0x04b6195d), STCP(0x7fe5f108, 0x051a8e5c), STCP(0x7fe1c76b, 0x057f0035), STCP(0x7fdd4eec, 0x05e36ea9), + STCP(0x7fd8878e, 0x0647d97c), STCP(0x7fd37153, 0x06ac406f), STCP(0x7fce0c3e, 0x0710a345), STCP(0x7fc85854, 0x077501be), + STCP(0x7fc25596, 0x07d95b9e), STCP(0x7fbc040a, 0x083db0a7), STCP(0x7fb563b3, 0x08a2009a), STCP(0x7fae7495, 0x09064b3a), + STCP(0x7fa736b4, 0x096a9049), STCP(0x7f9faa15, 0x09cecf89), STCP(0x7f97cebd, 0x0a3308bd), STCP(0x7f8fa4b0, 0x0a973ba5), + STCP(0x7f872bf3, 0x0afb6805), STCP(0x7f7e648c, 0x0b5f8d9f), STCP(0x7f754e80, 0x0bc3ac35), STCP(0x7f6be9d4, 0x0c27c389), + STCP(0x7f62368f, 0x0c8bd35e), STCP(0x7f5834b7, 0x0cefdb76), STCP(0x7f4de451, 0x0d53db92), STCP(0x7f434563, 0x0db7d376), + STCP(0x7f3857f6, 0x0e1bc2e4), STCP(0x7f2d1c0e, 0x0e7fa99e), STCP(0x7f2191b4, 0x0ee38766), STCP(0x7f15b8ee, 0x0f475bff), + STCP(0x7f0991c4, 0x0fab272b), STCP(0x7efd1c3c, 0x100ee8ad), STCP(0x7ef05860, 0x1072a048), STCP(0x7ee34636, 0x10d64dbd), + STCP(0x7ed5e5c6, 0x1139f0cf), STCP(0x7ec8371a, 0x119d8941), STCP(0x7eba3a39, 0x120116d5), STCP(0x7eabef2c, 0x1264994e), + STCP(0x7e9d55fc, 0x12c8106f), STCP(0x7e8e6eb2, 0x132b7bf9), STCP(0x7e7f3957, 0x138edbb1), STCP(0x7e6fb5f4, 0x13f22f58), + STCP(0x7e5fe493, 0x145576b1), STCP(0x7e4fc53e, 0x14b8b17f), STCP(0x7e3f57ff, 0x151bdf86), STCP(0x7e2e9cdf, 0x157f0086), + STCP(0x7e1d93ea, 0x15e21445), STCP(0x7e0c3d29, 0x16451a83), STCP(0x7dfa98a8, 0x16a81305), STCP(0x7de8a670, 0x170afd8d), + STCP(0x7dd6668f, 0x176dd9de), STCP(0x7dc3d90d, 0x17d0a7bc), STCP(0x7db0fdf8, 0x183366e9), STCP(0x7d9dd55a, 0x18961728), + STCP(0x7d8a5f40, 0x18f8b83c), STCP(0x7d769bb5, 0x195b49ea), STCP(0x7d628ac6, 0x19bdcbf3), STCP(0x7d4e2c7f, 0x1a203e1b), + STCP(0x7d3980ec, 0x1a82a026), STCP(0x7d24881b, 0x1ae4f1d6), STCP(0x7d0f4218, 0x1b4732ef), STCP(0x7cf9aef0, 0x1ba96335), + STCP(0x7ce3ceb2, 0x1c0b826a), STCP(0x7ccda169, 0x1c6d9053), STCP(0x7cb72724, 0x1ccf8cb3), STCP(0x7ca05ff1, 0x1d31774d), + STCP(0x7c894bde, 0x1d934fe5), STCP(0x7c71eaf9, 0x1df5163f), STCP(0x7c5a3d50, 0x1e56ca1e), STCP(0x7c4242f2, 0x1eb86b46), + STCP(0x7c29fbee, 0x1f19f97b), STCP(0x7c116853, 0x1f7b7481), STCP(0x7bf88830, 0x1fdcdc1b), STCP(0x7bdf5b94, 0x203e300d), + STCP(0x7bc5e290, 0x209f701c), STCP(0x7bac1d31, 0x21009c0c), STCP(0x7b920b89, 0x2161b3a0), STCP(0x7b77ada8, 0x21c2b69c), + STCP(0x7b5d039e, 0x2223a4c5), STCP(0x7b420d7a, 0x22847de0), STCP(0x7b26cb4f, 0x22e541af), STCP(0x7b0b3d2c, 0x2345eff8), + STCP(0x7aef6323, 0x23a6887f), STCP(0x7ad33d45, 0x24070b08), STCP(0x7ab6cba4, 0x24677758), STCP(0x7a9a0e50, 0x24c7cd33), + STCP(0x7a7d055b, 0x25280c5e), STCP(0x7a5fb0d8, 0x2588349d), STCP(0x7a4210d8, 0x25e845b6), STCP(0x7a24256f, 0x26483f6c), + STCP(0x7a05eead, 0x26a82186), STCP(0x79e76ca7, 0x2707ebc7), STCP(0x79c89f6e, 0x27679df4), STCP(0x79a98715, 0x27c737d3), + STCP(0x798a23b1, 0x2826b928), STCP(0x796a7554, 0x288621b9), STCP(0x794a7c12, 0x28e5714b), STCP(0x792a37fe, 0x2944a7a2), + STCP(0x7909a92d, 0x29a3c485), STCP(0x78e8cfb2, 0x2a02c7b8), STCP(0x78c7aba2, 0x2a61b101), STCP(0x78a63d11, 0x2ac08026), + STCP(0x78848414, 0x2b1f34eb), STCP(0x786280bf, 0x2b7dcf17), STCP(0x78403329, 0x2bdc4e6f), STCP(0x781d9b65, 0x2c3ab2b9), + STCP(0x77fab989, 0x2c98fbba), STCP(0x77d78daa, 0x2cf72939), STCP(0x77b417df, 0x2d553afc), STCP(0x7790583e, 0x2db330c7), + STCP(0x776c4edb, 0x2e110a62), STCP(0x7747fbce, 0x2e6ec792), STCP(0x77235f2d, 0x2ecc681e), STCP(0x76fe790e, 0x2f29ebcc), + STCP(0x76d94989, 0x2f875262), STCP(0x76b3d0b4, 0x2fe49ba7), STCP(0x768e0ea6, 0x3041c761), STCP(0x76680376, 0x309ed556), + STCP(0x7641af3d, 0x30fbc54d), STCP(0x761b1211, 0x3158970e), STCP(0x75f42c0b, 0x31b54a5e), STCP(0x75ccfd42, 0x3211df04), + STCP(0x75a585cf, 0x326e54c7), STCP(0x757dc5ca, 0x32caab6f), STCP(0x7555bd4c, 0x3326e2c3), STCP(0x752d6c6c, 0x3382fa88), + STCP(0x7504d345, 0x33def287), STCP(0x74dbf1ef, 0x343aca87), STCP(0x74b2c884, 0x34968250), STCP(0x7489571c, 0x34f219a8), + STCP(0x745f9dd1, 0x354d9057), STCP(0x74359cbd, 0x35a8e625), STCP(0x740b53fb, 0x36041ad9), STCP(0x73e0c3a3, 0x365f2e3b), + STCP(0x73b5ebd1, 0x36ba2014), STCP(0x738acc9e, 0x3714f02a), STCP(0x735f6626, 0x376f9e46), STCP(0x7333b883, 0x37ca2a30), + STCP(0x7307c3d0, 0x382493b0), STCP(0x72db8828, 0x387eda8e), STCP(0x72af05a7, 0x38d8fe93), STCP(0x72823c67, 0x3932ff87), + STCP(0x72552c85, 0x398cdd32), STCP(0x7227d61c, 0x39e6975e), STCP(0x71fa3949, 0x3a402dd2), STCP(0x71cc5626, 0x3a99a057), + STCP(0x719e2cd2, 0x3af2eeb7), STCP(0x716fbd68, 0x3b4c18ba), STCP(0x71410805, 0x3ba51e29), STCP(0x71120cc5, 0x3bfdfecd), + STCP(0x70e2cbc6, 0x3c56ba70), STCP(0x70b34525, 0x3caf50da), STCP(0x708378ff, 0x3d07c1d6), STCP(0x70536771, 0x3d600d2c), + STCP(0x7023109a, 0x3db832a6), STCP(0x6ff27497, 0x3e10320d), STCP(0x6fc19385, 0x3e680b2c), STCP(0x6f906d84, 0x3ebfbdcd), + STCP(0x6f5f02b2, 0x3f1749b8), STCP(0x6f2d532c, 0x3f6eaeb8), STCP(0x6efb5f12, 0x3fc5ec98), STCP(0x6ec92683, 0x401d0321), + STCP(0x6e96a99d, 0x4073f21d), STCP(0x6e63e87f, 0x40cab958), STCP(0x6e30e34a, 0x4121589b), STCP(0x6dfd9a1c, 0x4177cfb1), + STCP(0x6dca0d14, 0x41ce1e65), STCP(0x6d963c54, 0x42244481), STCP(0x6d6227fa, 0x427a41d0), STCP(0x6d2dd027, 0x42d0161e), + STCP(0x6cf934fc, 0x4325c135), STCP(0x6cc45698, 0x437b42e1), STCP(0x6c8f351c, 0x43d09aed), STCP(0x6c59d0a9, 0x4425c923), + STCP(0x6c242960, 0x447acd50), STCP(0x6bee3f62, 0x44cfa740), STCP(0x6bb812d1, 0x452456bd), STCP(0x6b81a3cd, 0x4578db93), + STCP(0x6b4af279, 0x45cd358f), STCP(0x6b13fef5, 0x4621647d), STCP(0x6adcc964, 0x46756828), STCP(0x6aa551e9, 0x46c9405c), + STCP(0x6a6d98a4, 0x471cece7), STCP(0x6a359db9, 0x47706d93), STCP(0x69fd614a, 0x47c3c22f), STCP(0x69c4e37a, 0x4816ea86), + STCP(0x698c246c, 0x4869e665), STCP(0x69532442, 0x48bcb599), STCP(0x6919e320, 0x490f57ee), STCP(0x68e06129, 0x4961cd33), + STCP(0x68a69e81, 0x49b41533), STCP(0x686c9b4b, 0x4a062fbd), STCP(0x683257ab, 0x4a581c9e), STCP(0x67f7d3c5, 0x4aa9dba2), + STCP(0x67bd0fbd, 0x4afb6c98), STCP(0x67820bb7, 0x4b4ccf4d), STCP(0x6746c7d8, 0x4b9e0390), STCP(0x670b4444, 0x4bef092d), + STCP(0x66cf8120, 0x4c3fdff4), STCP(0x66937e91, 0x4c9087b1), STCP(0x66573cbb, 0x4ce10034), STCP(0x661abbc5, 0x4d31494b), + STCP(0x65ddfbd3, 0x4d8162c4), STCP(0x65a0fd0b, 0x4dd14c6e), STCP(0x6563bf92, 0x4e210617), STCP(0x6526438f, 0x4e708f8f), + STCP(0x64e88926, 0x4ebfe8a5), STCP(0x64aa907f, 0x4f0f1126), STCP(0x646c59bf, 0x4f5e08e3), STCP(0x642de50d, 0x4faccfab), + STCP(0x63ef3290, 0x4ffb654d), STCP(0x63b0426d, 0x5049c999), STCP(0x637114cc, 0x5097fc5e), STCP(0x6331a9d4, 0x50e5fd6d), + STCP(0x62f201ac, 0x5133cc94), STCP(0x62b21c7b, 0x518169a5), STCP(0x6271fa69, 0x51ced46e), STCP(0x62319b9d, 0x521c0cc2), + STCP(0x61f1003f, 0x5269126e), STCP(0x61b02876, 0x52b5e546), STCP(0x616f146c, 0x53028518), STCP(0x612dc447, 0x534ef1b5), + STCP(0x60ec3830, 0x539b2af0), STCP(0x60aa7050, 0x53e73097), STCP(0x60686ccf, 0x5433027d), STCP(0x60262dd6, 0x547ea073), + STCP(0x5fe3b38d, 0x54ca0a4b), STCP(0x5fa0fe1f, 0x55153fd4), STCP(0x5f5e0db3, 0x556040e2), STCP(0x5f1ae274, 0x55ab0d46), + STCP(0x5ed77c8a, 0x55f5a4d2), STCP(0x5e93dc1f, 0x56400758), STCP(0x5e50015d, 0x568a34a9), STCP(0x5e0bec6e, 0x56d42c99), + STCP(0x5dc79d7c, 0x571deefa), STCP(0x5d8314b1, 0x57677b9d), STCP(0x5d3e5237, 0x57b0d256), STCP(0x5cf95638, 0x57f9f2f8), + STCP(0x5cb420e0, 0x5842dd54), STCP(0x5c6eb258, 0x588b9140), STCP(0x5c290acc, 0x58d40e8c), STCP(0x5be32a67, 0x591c550e), + STCP(0x5b9d1154, 0x59646498), STCP(0x5b56bfbd, 0x59ac3cfd), STCP(0x5b1035cf, 0x59f3de12), STCP(0x5ac973b5, 0x5a3b47ab), + STCP(0x5a82799a, 0x5a82799a) +}; + + + + + + + + + + + + + + + + + + + + + +/* generate_fft_tables.m 4 15 */ +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal60[] = +{ + STC(0x7f4c7e54), STC(0x7d33f0ca), STC(0x79bc384d), + STC(0x7d33f0ca), STC(0x74ef0ebc), STC(0x678dde6e), + STC(0x79bc384d), STC(0x678dde6e), STC(0x4b3c8c12), + STC(0x74ef0ebc), STC(0x55a6125c), STC(0x278dde6e), + STC(0x6ed9eba1), STC(0x40000000), STC(0x00000000), + STC(0x678dde6e), STC(0x278dde6e), STC(0xd8722191), + STC(0x5f1f5ea1), STC(0x0d61304e), STC(0xb4c373ed), + STC(0x55a6125c), STC(0xf29ecfb1), STC(0x98722191), + STC(0x4b3c8c12), STC(0xd8722191), STC(0x8643c7b2), + STC(0x40000000), STC(0xbfffffff), STC(0x80000000), + STC(0x340ff242), STC(0xaa59eda3), STC(0x8643c7b2), + STC(0x278dde6e), STC(0x98722191), STC(0x98722191), + STC(0x1a9cd9ac), STC(0x8b10f143), STC(0xb4c373ed), + STC(0x0d61304e), STC(0x82cc0f35), STC(0xd8722191), +}; +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag60[] = +{ + STC(0x0d61304e), STC(0x1a9cd9ac), STC(0x278dde6e), + STC(0x1a9cd9ac), STC(0x340ff242), STC(0x4b3c8c12), + STC(0x278dde6e), STC(0x4b3c8c12), STC(0x678dde6e), + STC(0x340ff242), STC(0x5f1f5ea1), STC(0x79bc384d), + STC(0x40000000), STC(0x6ed9eba1), STC(0x7fffffff), + STC(0x4b3c8c12), STC(0x79bc384d), STC(0x79bc384d), + STC(0x55a6125c), STC(0x7f4c7e54), STC(0x678dde6e), + STC(0x5f1f5ea1), STC(0x7f4c7e54), STC(0x4b3c8c12), + STC(0x678dde6e), STC(0x79bc384d), STC(0x278dde6e), + STC(0x6ed9eba1), STC(0x6ed9eba1), STC(0x00000000), + STC(0x74ef0ebc), STC(0x5f1f5ea1), STC(0xd8722191), + STC(0x79bc384d), STC(0x4b3c8c12), STC(0xb4c373ed), + STC(0x7d33f0ca), STC(0x340ff242), STC(0x98722191), + STC(0x7f4c7e54), STC(0x1a9cd9ac), STC(0x8643c7b2), +}; + + + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal240[] = +{ + STC(0x7ff4c56f), STC(0x7fd317b4), STC(0x7f9afcb9), STC(0x7f4c7e54), STC(0x7ee7aa4c), STC(0x7e6c9251), STC(0x7ddb4bfc), STC(0x7d33f0ca), STC(0x7c769e18), STC(0x7ba3751d), STC(0x7aba9ae6), STC(0x79bc384d), STC(0x78a879f4), STC(0x777f903c), STC(0x7641af3d), + STC(0x7fd317b4), STC(0x7f4c7e54), STC(0x7e6c9251), STC(0x7d33f0ca), STC(0x7ba3751d), STC(0x79bc384d), STC(0x777f903c), STC(0x74ef0ebc), STC(0x720c8075), STC(0x6ed9eba1), STC(0x6b598ea3), STC(0x678dde6e), STC(0x637984d4), STC(0x5f1f5ea1), STC(0x5a82799a), + STC(0x7f9afcb9), STC(0x7e6c9251), STC(0x7c769e18), STC(0x79bc384d), STC(0x7641af3d), STC(0x720c8075), STC(0x6d23501b), STC(0x678dde6e), STC(0x6154fb91), STC(0x5a82799a), STC(0x53211d18), STC(0x4b3c8c12), STC(0x42e13ba4), STC(0x3a1c5c57), STC(0x30fbc54d), + STC(0x7f4c7e54), STC(0x7d33f0ca), STC(0x79bc384d), STC(0x74ef0ebc), STC(0x6ed9eba1), STC(0x678dde6e), STC(0x5f1f5ea1), STC(0x55a6125c), STC(0x4b3c8c12), STC(0x40000000), STC(0x340ff242), STC(0x278dde6e), STC(0x1a9cd9ac), STC(0x0d61304e), STC(0x00000000), + STC(0x7ee7aa4c), STC(0x7ba3751d), STC(0x7641af3d), STC(0x6ed9eba1), STC(0x658c9a2d), STC(0x5a82799a), STC(0x4debe4fe), STC(0x40000000), STC(0x30fbc54d), STC(0x2120fb83), STC(0x10b5150f), STC(0x00000000), STC(0xef4aeaf0), STC(0xdedf047c), STC(0xcf043ab2), + STC(0x7e6c9251), STC(0x79bc384d), STC(0x720c8075), STC(0x678dde6e), STC(0x5a82799a), STC(0x4b3c8c12), STC(0x3a1c5c57), STC(0x278dde6e), STC(0x14060b68), STC(0x00000000), STC(0xebf9f497), STC(0xd8722191), STC(0xc5e3a3a8), STC(0xb4c373ed), STC(0xa57d8665), + STC(0x7ddb4bfc), STC(0x777f903c), STC(0x6d23501b), STC(0x5f1f5ea1), STC(0x4debe4fe), STC(0x3a1c5c57), STC(0x245a9d65), STC(0x0d61304e), STC(0xf5f50d66), STC(0xdedf047c), STC(0xc8e5032a), STC(0xb4c373ed), STC(0xa326eebf), STC(0x94a6715c), STC(0x89be50c2), + STC(0x7d33f0ca), STC(0x74ef0ebc), STC(0x678dde6e), STC(0x55a6125c), STC(0x40000000), STC(0x278dde6e), STC(0x0d61304e), STC(0xf29ecfb1), STC(0xd8722191), STC(0xbfffffff), STC(0xaa59eda3), STC(0x98722191), STC(0x8b10f143), STC(0x82cc0f35), STC(0x80000000), + STC(0x7c769e18), STC(0x720c8075), STC(0x6154fb91), STC(0x4b3c8c12), STC(0x30fbc54d), STC(0x14060b68), STC(0xf5f50d66), STC(0xd8722191), STC(0xbd1ec45b), STC(0xa57d8665), STC(0x92dcafe4), STC(0x8643c7b2), STC(0x80650346), STC(0x81936dae), STC(0x89be50c2), + STC(0x7ba3751d), STC(0x6ed9eba1), STC(0x5a82799a), STC(0x40000000), STC(0x2120fb83), STC(0x00000000), STC(0xdedf047c), STC(0xbfffffff), STC(0xa57d8665), STC(0x9126145e), STC(0x845c8ae2), STC(0x80000000), STC(0x845c8ae2), STC(0x9126145e), STC(0xa57d8665), + STC(0x7aba9ae6), STC(0x6b598ea3), STC(0x53211d18), STC(0x340ff242), STC(0x10b5150f), STC(0xebf9f497), STC(0xc8e5032a), STC(0xaa59eda3), STC(0x92dcafe4), STC(0x845c8ae2), STC(0x800b3a90), STC(0x8643c7b2), STC(0x96830875), STC(0xaf726dee), STC(0xcf043ab2), + STC(0x79bc384d), STC(0x678dde6e), STC(0x4b3c8c12), STC(0x278dde6e), STC(0x00000000), STC(0xd8722191), STC(0xb4c373ed), STC(0x98722191), STC(0x8643c7b2), STC(0x80000000), STC(0x8643c7b2), STC(0x98722191), STC(0xb4c373ed), STC(0xd8722191), STC(0xffffffff), + STC(0x78a879f4), STC(0x637984d4), STC(0x42e13ba4), STC(0x1a9cd9ac), STC(0xef4aeaf0), STC(0xc5e3a3a8), STC(0xa326eebf), STC(0x8b10f143), STC(0x80650346), STC(0x845c8ae2), STC(0x96830875), STC(0xb4c373ed), STC(0xdba5629a), STC(0x06b2f1d2), STC(0x30fbc54d), + STC(0x777f903c), STC(0x5f1f5ea1), STC(0x3a1c5c57), STC(0x0d61304e), STC(0xdedf047c), STC(0xb4c373ed), STC(0x94a6715c), STC(0x82cc0f35), STC(0x81936dae), STC(0x9126145e), STC(0xaf726dee), STC(0xd8722191), STC(0x06b2f1d2), STC(0x340ff242), STC(0x5a82799a), +}; +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag240[] = +{ + STC(0x0359c428), STC(0x06b2f1d2), STC(0x0a0af299), STC(0x0d61304e), STC(0x10b5150f), STC(0x14060b68), STC(0x17537e63), STC(0x1a9cd9ac), STC(0x1de189a6), STC(0x2120fb83), STC(0x245a9d65), STC(0x278dde6e), STC(0x2aba2ee4), STC(0x2ddf0040), STC(0x30fbc54d), + STC(0x06b2f1d2), STC(0x0d61304e), STC(0x14060b68), STC(0x1a9cd9ac), STC(0x2120fb83), STC(0x278dde6e), STC(0x2ddf0040), STC(0x340ff242), STC(0x3a1c5c57), STC(0x40000000), STC(0x45b6bb5e), STC(0x4b3c8c12), STC(0x508d9211), STC(0x55a6125c), STC(0x5a82799a), + STC(0x0a0af299), STC(0x14060b68), STC(0x1de189a6), STC(0x278dde6e), STC(0x30fbc54d), STC(0x3a1c5c57), STC(0x42e13ba4), STC(0x4b3c8c12), STC(0x53211d18), STC(0x5a82799a), STC(0x6154fb91), STC(0x678dde6e), STC(0x6d23501b), STC(0x720c8075), STC(0x7641af3d), + STC(0x0d61304e), STC(0x1a9cd9ac), STC(0x278dde6e), STC(0x340ff242), STC(0x40000000), STC(0x4b3c8c12), STC(0x55a6125c), STC(0x5f1f5ea1), STC(0x678dde6e), STC(0x6ed9eba1), STC(0x74ef0ebc), STC(0x79bc384d), STC(0x7d33f0ca), STC(0x7f4c7e54), STC(0x7fffffff), + STC(0x10b5150f), STC(0x2120fb83), STC(0x30fbc54d), STC(0x40000000), STC(0x4debe4fe), STC(0x5a82799a), STC(0x658c9a2d), STC(0x6ed9eba1), STC(0x7641af3d), STC(0x7ba3751d), STC(0x7ee7aa4c), STC(0x7fffffff), STC(0x7ee7aa4c), STC(0x7ba3751d), STC(0x7641af3d), + STC(0x14060b68), STC(0x278dde6e), STC(0x3a1c5c57), STC(0x4b3c8c12), STC(0x5a82799a), STC(0x678dde6e), STC(0x720c8075), STC(0x79bc384d), STC(0x7e6c9251), STC(0x7fffffff), STC(0x7e6c9251), STC(0x79bc384d), STC(0x720c8075), STC(0x678dde6e), STC(0x5a82799a), + STC(0x17537e63), STC(0x2ddf0040), STC(0x42e13ba4), STC(0x55a6125c), STC(0x658c9a2d), STC(0x720c8075), STC(0x7aba9ae6), STC(0x7f4c7e54), STC(0x7f9afcb9), STC(0x7ba3751d), STC(0x7387ea23), STC(0x678dde6e), STC(0x581c00b3), STC(0x45b6bb5e), STC(0x30fbc54d), + STC(0x1a9cd9ac), STC(0x340ff242), STC(0x4b3c8c12), STC(0x5f1f5ea1), STC(0x6ed9eba1), STC(0x79bc384d), STC(0x7f4c7e54), STC(0x7f4c7e54), STC(0x79bc384d), STC(0x6ed9eba1), STC(0x5f1f5ea1), STC(0x4b3c8c12), STC(0x340ff242), STC(0x1a9cd9ac), STC(0x00000000), + STC(0x1de189a6), STC(0x3a1c5c57), STC(0x53211d18), STC(0x678dde6e), STC(0x7641af3d), STC(0x7e6c9251), STC(0x7f9afcb9), STC(0x79bc384d), STC(0x6d23501b), STC(0x5a82799a), STC(0x42e13ba4), STC(0x278dde6e), STC(0x0a0af299), STC(0xebf9f497), STC(0xcf043ab2), + STC(0x2120fb83), STC(0x40000000), STC(0x5a82799a), STC(0x6ed9eba1), STC(0x7ba3751d), STC(0x7fffffff), STC(0x7ba3751d), STC(0x6ed9eba1), STC(0x5a82799a), STC(0x40000000), STC(0x2120fb83), STC(0x00000000), STC(0xdedf047c), STC(0xbfffffff), STC(0xa57d8665), + STC(0x245a9d65), STC(0x45b6bb5e), STC(0x6154fb91), STC(0x74ef0ebc), STC(0x7ee7aa4c), STC(0x7e6c9251), STC(0x7387ea23), STC(0x5f1f5ea1), STC(0x42e13ba4), STC(0x2120fb83), STC(0xfca63bd7), STC(0xd8722191), STC(0xb780001b), STC(0x9c867b2b), STC(0x89be50c2), + STC(0x278dde6e), STC(0x4b3c8c12), STC(0x678dde6e), STC(0x79bc384d), STC(0x7fffffff), STC(0x79bc384d), STC(0x678dde6e), STC(0x4b3c8c12), STC(0x278dde6e), STC(0x00000000), STC(0xd8722191), STC(0xb4c373ed), STC(0x98722191), STC(0x8643c7b2), STC(0x80000000), + STC(0x2aba2ee4), STC(0x508d9211), STC(0x6d23501b), STC(0x7d33f0ca), STC(0x7ee7aa4c), STC(0x720c8075), STC(0x581c00b3), STC(0x340ff242), STC(0x0a0af299), STC(0xdedf047c), STC(0xb780001b), STC(0x98722191), STC(0x85456519), STC(0x802ce84b), STC(0x89be50c2), + STC(0x2ddf0040), STC(0x55a6125c), STC(0x720c8075), STC(0x7f4c7e54), STC(0x7ba3751d), STC(0x678dde6e), STC(0x45b6bb5e), STC(0x1a9cd9ac), STC(0xebf9f497), STC(0xbfffffff), STC(0x9c867b2b), STC(0x8643c7b2), STC(0x802ce84b), STC(0x8b10f143), STC(0xa57d8665), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal480[] = +{ + STC(0x7ffd3154), STC(0x7ff4c56f), STC(0x7fe6bcb0), STC(0x7fd317b4), STC(0x7fb9d759), STC(0x7f9afcb9), STC(0x7f76892f), STC(0x7f4c7e54), STC(0x7f1cde01), STC(0x7ee7aa4c), STC(0x7eace58a), STC(0x7e6c9251), STC(0x7e26b371), STC(0x7ddb4bfc), STC(0x7d8a5f40), STC(0x7d33f0ca), STC(0x7cd80464), STC(0x7c769e18), STC(0x7c0fc22a), STC(0x7ba3751d), STC(0x7b31bbb2), STC(0x7aba9ae6), STC(0x7a3e17f2), STC(0x79bc384d), STC(0x793501a9), STC(0x78a879f4), STC(0x7816a759), STC(0x777f903c), STC(0x76e33b3f), STC(0x7641af3d), STC(0x759af34c), + STC(0x7ff4c56f), STC(0x7fd317b4), STC(0x7f9afcb9), STC(0x7f4c7e54), STC(0x7ee7aa4c), STC(0x7e6c9251), STC(0x7ddb4bfc), STC(0x7d33f0ca), STC(0x7c769e18), STC(0x7ba3751d), STC(0x7aba9ae6), STC(0x79bc384d), STC(0x78a879f4), STC(0x777f903c), STC(0x7641af3d), STC(0x74ef0ebc), STC(0x7387ea23), STC(0x720c8075), STC(0x707d1443), STC(0x6ed9eba1), STC(0x6d23501b), STC(0x6b598ea3), STC(0x697cf78a), STC(0x678dde6e), STC(0x658c9a2d), STC(0x637984d4), STC(0x6154fb91), STC(0x5f1f5ea1), STC(0x5cd91140), STC(0x5a82799a), STC(0x581c00b3), + STC(0x7fe6bcb0), STC(0x7f9afcb9), STC(0x7f1cde01), STC(0x7e6c9251), STC(0x7d8a5f40), STC(0x7c769e18), STC(0x7b31bbb2), STC(0x79bc384d), STC(0x7816a759), STC(0x7641af3d), STC(0x743e0918), STC(0x720c8075), STC(0x6fadf2fc), STC(0x6d23501b), STC(0x6a6d98a4), STC(0x678dde6e), STC(0x648543e4), STC(0x6154fb91), STC(0x5dfe47ad), STC(0x5a82799a), STC(0x56e2f15d), STC(0x53211d18), STC(0x4f3e7875), STC(0x4b3c8c12), STC(0x471cece7), STC(0x42e13ba4), STC(0x3e8b240e), STC(0x3a1c5c57), STC(0x3596a46c), STC(0x30fbc54d), STC(0x2c4d9050), + STC(0x7fd317b4), STC(0x7f4c7e54), STC(0x7e6c9251), STC(0x7d33f0ca), STC(0x7ba3751d), STC(0x79bc384d), STC(0x777f903c), STC(0x74ef0ebc), STC(0x720c8075), STC(0x6ed9eba1), STC(0x6b598ea3), STC(0x678dde6e), STC(0x637984d4), STC(0x5f1f5ea1), STC(0x5a82799a), STC(0x55a6125c), STC(0x508d9211), STC(0x4b3c8c12), STC(0x45b6bb5e), STC(0x40000000), STC(0x3a1c5c57), STC(0x340ff242), STC(0x2ddf0040), STC(0x278dde6e), STC(0x2120fb83), STC(0x1a9cd9ac), STC(0x14060b68), STC(0x0d61304e), STC(0x06b2f1d2), STC(0x00000000), STC(0xf94d0e2d), + STC(0x7fb9d759), STC(0x7ee7aa4c), STC(0x7d8a5f40), STC(0x7ba3751d), STC(0x793501a9), STC(0x7641af3d), STC(0x72ccb9db), STC(0x6ed9eba1), STC(0x6a6d98a4), STC(0x658c9a2d), STC(0x603c496c), STC(0x5a82799a), STC(0x54657194), STC(0x4debe4fe), STC(0x471cece7), STC(0x40000000), STC(0x389cea72), STC(0x30fbc54d), STC(0x2924edac), STC(0x2120fb83), STC(0x18f8b83c), STC(0x10b5150f), STC(0x085f2137), STC(0x00000000), STC(0xf7a0dec8), STC(0xef4aeaf0), STC(0xe70747c3), STC(0xdedf047c), STC(0xd6db1253), STC(0xcf043ab2), STC(0xc763158d), + STC(0x7f9afcb9), STC(0x7e6c9251), STC(0x7c769e18), STC(0x79bc384d), STC(0x7641af3d), STC(0x720c8075), STC(0x6d23501b), STC(0x678dde6e), STC(0x6154fb91), STC(0x5a82799a), STC(0x53211d18), STC(0x4b3c8c12), STC(0x42e13ba4), STC(0x3a1c5c57), STC(0x30fbc54d), STC(0x278dde6e), STC(0x1de189a6), STC(0x14060b68), STC(0x0a0af299), STC(0x00000000), STC(0xf5f50d66), STC(0xebf9f497), STC(0xe21e7659), STC(0xd8722191), STC(0xcf043ab2), STC(0xc5e3a3a8), STC(0xbd1ec45b), STC(0xb4c373ed), STC(0xacdee2e7), STC(0xa57d8665), STC(0x9eab046e), + STC(0x7f76892f), STC(0x7ddb4bfc), STC(0x7b31bbb2), STC(0x777f903c), STC(0x72ccb9db), STC(0x6d23501b), STC(0x668f7c25), STC(0x5f1f5ea1), STC(0x56e2f15d), STC(0x4debe4fe), STC(0x444d7aff), STC(0x3a1c5c57), STC(0x2f6e6d16), STC(0x245a9d65), STC(0x18f8b83c), STC(0x0d61304e), STC(0x01aceb7c), STC(0xf5f50d66), STC(0xea52c165), STC(0xdedf047c), STC(0xd3b26faf), STC(0xc8e5032a), STC(0xbe8df2b9), STC(0xb4c373ed), STC(0xab9a8e6b), STC(0xa326eebf), STC(0x9b7abc1b), STC(0x94a6715c), STC(0x8eb8b99f), STC(0x89be50c2), STC(0x85c1e80d), + STC(0x7f4c7e54), STC(0x7d33f0ca), STC(0x79bc384d), STC(0x74ef0ebc), STC(0x6ed9eba1), STC(0x678dde6e), STC(0x5f1f5ea1), STC(0x55a6125c), STC(0x4b3c8c12), STC(0x40000000), STC(0x340ff242), STC(0x278dde6e), STC(0x1a9cd9ac), STC(0x0d61304e), STC(0x00000000), STC(0xf29ecfb1), STC(0xe5632653), STC(0xd8722191), STC(0xcbf00dbd), STC(0xbfffffff), STC(0xb4c373ed), STC(0xaa59eda3), STC(0xa0e0a15e), STC(0x98722191), STC(0x9126145e), STC(0x8b10f143), STC(0x8643c7b2), STC(0x82cc0f35), STC(0x80b381ab), STC(0x80000000), STC(0x80b381ab), + STC(0x7f1cde01), STC(0x7c769e18), STC(0x7816a759), STC(0x720c8075), STC(0x6a6d98a4), STC(0x6154fb91), STC(0x56e2f15d), STC(0x4b3c8c12), STC(0x3e8b240e), STC(0x30fbc54d), STC(0x22be8f87), STC(0x14060b68), STC(0x05067734), STC(0xf5f50d66), STC(0xe70747c3), STC(0xd8722191), STC(0xca695b93), STC(0xbd1ec45b), STC(0xb0c1878a), STC(0xa57d8665), STC(0x9b7abc1b), STC(0x92dcafe4), STC(0x8bc1f6e7), STC(0x8643c7b2), STC(0x8275a0bf), STC(0x80650346), STC(0x8019434f), STC(0x81936dae), STC(0x84ce444d), STC(0x89be50c2), STC(0x90520d03), + STC(0x7ee7aa4c), STC(0x7ba3751d), STC(0x7641af3d), STC(0x6ed9eba1), STC(0x658c9a2d), STC(0x5a82799a), STC(0x4debe4fe), STC(0x40000000), STC(0x30fbc54d), STC(0x2120fb83), STC(0x10b5150f), STC(0x00000000), STC(0xef4aeaf0), STC(0xdedf047c), STC(0xcf043ab2), STC(0xbfffffff), STC(0xb2141b01), STC(0xa57d8665), STC(0x9a7365d2), STC(0x9126145e), STC(0x89be50c2), STC(0x845c8ae2), STC(0x811855b3), STC(0x80000000), STC(0x811855b3), STC(0x845c8ae2), STC(0x89be50c2), STC(0x9126145e), STC(0x9a7365d2), STC(0xa57d8665), STC(0xb2141b01), + STC(0x7eace58a), STC(0x7aba9ae6), STC(0x743e0918), STC(0x6b598ea3), STC(0x603c496c), STC(0x53211d18), STC(0x444d7aff), STC(0x340ff242), STC(0x22be8f87), STC(0x10b5150f), STC(0xfe531483), STC(0xebf9f497), STC(0xda0aecf8), STC(0xc8e5032a), STC(0xb8e31318), STC(0xaa59eda3), STC(0x9d969741), STC(0x92dcafe4), STC(0x8a650cb3), STC(0x845c8ae2), STC(0x80e321fe), STC(0x800b3a90), STC(0x81d94c8e), STC(0x8643c7b2), STC(0x8d334624), STC(0x96830875), STC(0xa201b852), STC(0xaf726dee), STC(0xbe8df2b9), STC(0xcf043ab2), STC(0xe07e0c83), + STC(0x7e6c9251), STC(0x79bc384d), STC(0x720c8075), STC(0x678dde6e), STC(0x5a82799a), STC(0x4b3c8c12), STC(0x3a1c5c57), STC(0x278dde6e), STC(0x14060b68), STC(0x00000000), STC(0xebf9f497), STC(0xd8722191), STC(0xc5e3a3a8), STC(0xb4c373ed), STC(0xa57d8665), STC(0x98722191), STC(0x8df37f8a), STC(0x8643c7b2), STC(0x81936dae), STC(0x80000000), STC(0x81936dae), STC(0x8643c7b2), STC(0x8df37f8a), STC(0x98722191), STC(0xa57d8665), STC(0xb4c373ed), STC(0xc5e3a3a8), STC(0xd8722191), STC(0xebf9f497), STC(0xffffffff), STC(0x14060b68), + STC(0x7e26b371), STC(0x78a879f4), STC(0x6fadf2fc), STC(0x637984d4), STC(0x54657194), STC(0x42e13ba4), STC(0x2f6e6d16), STC(0x1a9cd9ac), STC(0x05067734), STC(0xef4aeaf0), STC(0xda0aecf8), STC(0xc5e3a3a8), STC(0xb36a1977), STC(0xa326eebf), STC(0x9592675b), STC(0x8b10f143), STC(0x83f03dd5), STC(0x80650346), STC(0x808976d0), STC(0x845c8ae2), STC(0x8bc1f6e7), STC(0x96830875), STC(0xa45037c8), STC(0xb4c373ed), STC(0xc763158d), STC(0xdba5629a), STC(0xf0f488d8), STC(0x06b2f1d2), STC(0x1c3fd045), STC(0x30fbc54d), STC(0x444d7aff), + STC(0x7ddb4bfc), STC(0x777f903c), STC(0x6d23501b), STC(0x5f1f5ea1), STC(0x4debe4fe), STC(0x3a1c5c57), STC(0x245a9d65), STC(0x0d61304e), STC(0xf5f50d66), STC(0xdedf047c), STC(0xc8e5032a), STC(0xb4c373ed), STC(0xa326eebf), STC(0x94a6715c), STC(0x89be50c2), STC(0x82cc0f35), STC(0x800b3a90), STC(0x81936dae), STC(0x8757860b), STC(0x9126145e), STC(0x9eab046e), STC(0xaf726dee), STC(0xc2ec7634), STC(0xd8722191), STC(0xef4aeaf0), STC(0x06b2f1d2), STC(0x1de189a6), STC(0x340ff242), STC(0x487fffe4), STC(0x5a82799a), STC(0x697cf78a), +}; +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag480[] = +{ + STC(0x01aceb7c), STC(0x0359c428), STC(0x05067734), STC(0x06b2f1d2), STC(0x085f2137), STC(0x0a0af299), STC(0x0bb65336), STC(0x0d61304e), STC(0x0f0b7727), STC(0x10b5150f), STC(0x125df75b), STC(0x14060b68), STC(0x15ad3e9a), STC(0x17537e63), STC(0x18f8b83c), STC(0x1a9cd9ac), STC(0x1c3fd045), STC(0x1de189a6), STC(0x1f81f37c), STC(0x2120fb83), STC(0x22be8f87), STC(0x245a9d65), STC(0x25f51307), STC(0x278dde6e), STC(0x2924edac), STC(0x2aba2ee4), STC(0x2c4d9050), STC(0x2ddf0040), STC(0x2f6e6d16), STC(0x30fbc54d), STC(0x3286f779), + STC(0x0359c428), STC(0x06b2f1d2), STC(0x0a0af299), STC(0x0d61304e), STC(0x10b5150f), STC(0x14060b68), STC(0x17537e63), STC(0x1a9cd9ac), STC(0x1de189a6), STC(0x2120fb83), STC(0x245a9d65), STC(0x278dde6e), STC(0x2aba2ee4), STC(0x2ddf0040), STC(0x30fbc54d), STC(0x340ff242), STC(0x371afcd5), STC(0x3a1c5c57), STC(0x3d1389cb), STC(0x40000000), STC(0x42e13ba4), STC(0x45b6bb5e), STC(0x487fffe4), STC(0x4b3c8c12), STC(0x4debe4fe), STC(0x508d9211), STC(0x53211d18), STC(0x55a6125c), STC(0x581c00b3), STC(0x5a82799a), STC(0x5cd91140), + STC(0x05067734), STC(0x0a0af299), STC(0x0f0b7727), STC(0x14060b68), STC(0x18f8b83c), STC(0x1de189a6), STC(0x22be8f87), STC(0x278dde6e), STC(0x2c4d9050), STC(0x30fbc54d), STC(0x3596a46c), STC(0x3a1c5c57), STC(0x3e8b240e), STC(0x42e13ba4), STC(0x471cece7), STC(0x4b3c8c12), STC(0x4f3e7875), STC(0x53211d18), STC(0x56e2f15d), STC(0x5a82799a), STC(0x5dfe47ad), STC(0x6154fb91), STC(0x648543e4), STC(0x678dde6e), STC(0x6a6d98a4), STC(0x6d23501b), STC(0x6fadf2fc), STC(0x720c8075), STC(0x743e0918), STC(0x7641af3d), STC(0x7816a759), + STC(0x06b2f1d2), STC(0x0d61304e), STC(0x14060b68), STC(0x1a9cd9ac), STC(0x2120fb83), STC(0x278dde6e), STC(0x2ddf0040), STC(0x340ff242), STC(0x3a1c5c57), STC(0x40000000), STC(0x45b6bb5e), STC(0x4b3c8c12), STC(0x508d9211), STC(0x55a6125c), STC(0x5a82799a), STC(0x5f1f5ea1), STC(0x637984d4), STC(0x678dde6e), STC(0x6b598ea3), STC(0x6ed9eba1), STC(0x720c8075), STC(0x74ef0ebc), STC(0x777f903c), STC(0x79bc384d), STC(0x7ba3751d), STC(0x7d33f0ca), STC(0x7e6c9251), STC(0x7f4c7e54), STC(0x7fd317b4), STC(0x7fffffff), STC(0x7fd317b4), + STC(0x085f2137), STC(0x10b5150f), STC(0x18f8b83c), STC(0x2120fb83), STC(0x2924edac), STC(0x30fbc54d), STC(0x389cea72), STC(0x40000000), STC(0x471cece7), STC(0x4debe4fe), STC(0x54657194), STC(0x5a82799a), STC(0x603c496c), STC(0x658c9a2d), STC(0x6a6d98a4), STC(0x6ed9eba1), STC(0x72ccb9db), STC(0x7641af3d), STC(0x793501a9), STC(0x7ba3751d), STC(0x7d8a5f40), STC(0x7ee7aa4c), STC(0x7fb9d759), STC(0x7fffffff), STC(0x7fb9d759), STC(0x7ee7aa4c), STC(0x7d8a5f40), STC(0x7ba3751d), STC(0x793501a9), STC(0x7641af3d), STC(0x72ccb9db), + STC(0x0a0af299), STC(0x14060b68), STC(0x1de189a6), STC(0x278dde6e), STC(0x30fbc54d), STC(0x3a1c5c57), STC(0x42e13ba4), STC(0x4b3c8c12), STC(0x53211d18), STC(0x5a82799a), STC(0x6154fb91), STC(0x678dde6e), STC(0x6d23501b), STC(0x720c8075), STC(0x7641af3d), STC(0x79bc384d), STC(0x7c769e18), STC(0x7e6c9251), STC(0x7f9afcb9), STC(0x7fffffff), STC(0x7f9afcb9), STC(0x7e6c9251), STC(0x7c769e18), STC(0x79bc384d), STC(0x7641af3d), STC(0x720c8075), STC(0x6d23501b), STC(0x678dde6e), STC(0x6154fb91), STC(0x5a82799a), STC(0x53211d18), + STC(0x0bb65336), STC(0x17537e63), STC(0x22be8f87), STC(0x2ddf0040), STC(0x389cea72), STC(0x42e13ba4), STC(0x4c95e688), STC(0x55a6125c), STC(0x5dfe47ad), STC(0x658c9a2d), STC(0x6c40cf2c), STC(0x720c8075), STC(0x76e33b3f), STC(0x7aba9ae6), STC(0x7d8a5f40), STC(0x7f4c7e54), STC(0x7ffd3154), STC(0x7f9afcb9), STC(0x7e26b371), STC(0x7ba3751d), STC(0x7816a759), STC(0x7387ea23), STC(0x6e010780), STC(0x678dde6e), STC(0x603c496c), STC(0x581c00b3), STC(0x4f3e7875), STC(0x45b6bb5e), STC(0x3b9941b1), STC(0x30fbc54d), STC(0x25f51307), + STC(0x0d61304e), STC(0x1a9cd9ac), STC(0x278dde6e), STC(0x340ff242), STC(0x40000000), STC(0x4b3c8c12), STC(0x55a6125c), STC(0x5f1f5ea1), STC(0x678dde6e), STC(0x6ed9eba1), STC(0x74ef0ebc), STC(0x79bc384d), STC(0x7d33f0ca), STC(0x7f4c7e54), STC(0x7fffffff), STC(0x7f4c7e54), STC(0x7d33f0ca), STC(0x79bc384d), STC(0x74ef0ebc), STC(0x6ed9eba1), STC(0x678dde6e), STC(0x5f1f5ea1), STC(0x55a6125c), STC(0x4b3c8c12), STC(0x40000000), STC(0x340ff242), STC(0x278dde6e), STC(0x1a9cd9ac), STC(0x0d61304e), STC(0x00000000), STC(0xf29ecfb1), + STC(0x0f0b7727), STC(0x1de189a6), STC(0x2c4d9050), STC(0x3a1c5c57), STC(0x471cece7), STC(0x53211d18), STC(0x5dfe47ad), STC(0x678dde6e), STC(0x6fadf2fc), STC(0x7641af3d), STC(0x7b31bbb2), STC(0x7e6c9251), STC(0x7fe6bcb0), STC(0x7f9afcb9), STC(0x7d8a5f40), STC(0x79bc384d), STC(0x743e0918), STC(0x6d23501b), STC(0x648543e4), STC(0x5a82799a), STC(0x4f3e7875), STC(0x42e13ba4), STC(0x3596a46c), STC(0x278dde6e), STC(0x18f8b83c), STC(0x0a0af299), STC(0xfaf988cb), STC(0xebf9f497), STC(0xdd417078), STC(0xcf043ab2), STC(0xc174dbf1), + STC(0x10b5150f), STC(0x2120fb83), STC(0x30fbc54d), STC(0x40000000), STC(0x4debe4fe), STC(0x5a82799a), STC(0x658c9a2d), STC(0x6ed9eba1), STC(0x7641af3d), STC(0x7ba3751d), STC(0x7ee7aa4c), STC(0x7fffffff), STC(0x7ee7aa4c), STC(0x7ba3751d), STC(0x7641af3d), STC(0x6ed9eba1), STC(0x658c9a2d), STC(0x5a82799a), STC(0x4debe4fe), STC(0x40000000), STC(0x30fbc54d), STC(0x2120fb83), STC(0x10b5150f), STC(0x00000000), STC(0xef4aeaf0), STC(0xdedf047c), STC(0xcf043ab2), STC(0xbfffffff), STC(0xb2141b01), STC(0xa57d8665), STC(0x9a7365d2), + STC(0x125df75b), STC(0x245a9d65), STC(0x3596a46c), STC(0x45b6bb5e), STC(0x54657194), STC(0x6154fb91), STC(0x6c40cf2c), STC(0x74ef0ebc), STC(0x7b31bbb2), STC(0x7ee7aa4c), STC(0x7ffd3154), STC(0x7e6c9251), STC(0x7a3e17f2), STC(0x7387ea23), STC(0x6a6d98a4), STC(0x5f1f5ea1), STC(0x51d92321), STC(0x42e13ba4), STC(0x3286f779), STC(0x2120fb83), STC(0x0f0b7727), STC(0xfca63bd7), STC(0xea52c165), STC(0xd8722191), STC(0xc763158d), STC(0xb780001b), STC(0xa91d0ea2), STC(0x9c867b2b), STC(0x91fef87f), STC(0x89be50c2), STC(0x83f03dd5), + STC(0x14060b68), STC(0x278dde6e), STC(0x3a1c5c57), STC(0x4b3c8c12), STC(0x5a82799a), STC(0x678dde6e), STC(0x720c8075), STC(0x79bc384d), STC(0x7e6c9251), STC(0x7fffffff), STC(0x7e6c9251), STC(0x79bc384d), STC(0x720c8075), STC(0x678dde6e), STC(0x5a82799a), STC(0x4b3c8c12), STC(0x3a1c5c57), STC(0x278dde6e), STC(0x14060b68), STC(0x00000000), STC(0xebf9f497), STC(0xd8722191), STC(0xc5e3a3a8), STC(0xb4c373ed), STC(0xa57d8665), STC(0x98722191), STC(0x8df37f8a), STC(0x8643c7b2), STC(0x81936dae), STC(0x80000000), STC(0x81936dae), + STC(0x15ad3e9a), STC(0x2aba2ee4), STC(0x3e8b240e), STC(0x508d9211), STC(0x603c496c), STC(0x6d23501b), STC(0x76e33b3f), STC(0x7d33f0ca), STC(0x7fe6bcb0), STC(0x7ee7aa4c), STC(0x7a3e17f2), STC(0x720c8075), STC(0x668f7c25), STC(0x581c00b3), STC(0x471cece7), STC(0x340ff242), STC(0x1f81f37c), STC(0x0a0af299), STC(0xf449acc9), STC(0xdedf047c), STC(0xca695b93), STC(0xb780001b), STC(0xa6aecd5d), STC(0x98722191), STC(0x8d334624), STC(0x85456519), STC(0x80e321fe), STC(0x802ce84b), STC(0x8327fb9b), STC(0x89be50c2), STC(0x93bf30d3), + STC(0x17537e63), STC(0x2ddf0040), STC(0x42e13ba4), STC(0x55a6125c), STC(0x658c9a2d), STC(0x720c8075), STC(0x7aba9ae6), STC(0x7f4c7e54), STC(0x7f9afcb9), STC(0x7ba3751d), STC(0x7387ea23), STC(0x678dde6e), STC(0x581c00b3), STC(0x45b6bb5e), STC(0x30fbc54d), STC(0x1a9cd9ac), STC(0x0359c428), STC(0xebf9f497), STC(0xd545d11b), STC(0xbfffffff), STC(0xacdee2e7), STC(0x9c867b2b), STC(0x8f82ebbc), STC(0x8643c7b2), STC(0x811855b3), STC(0x802ce84b), STC(0x838961e7), STC(0x8b10f143), STC(0x96830875), STC(0xa57d8665), STC(0xb780001b), +}; + + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow1024[] = +{ + WTCP(0x7ffffd88, 0x001921fb), WTCP(0x7fffe9cb, 0x004b65ee), WTCP(0x7fffc251, 0x007da9d4), WTCP(0x7fff8719, 0x00afeda8), + WTCP(0x7fff3824, 0x00e23160), WTCP(0x7ffed572, 0x011474f6), WTCP(0x7ffe5f03, 0x0146b860), WTCP(0x7ffdd4d7, 0x0178fb99), + WTCP(0x7ffd36ee, 0x01ab3e97), WTCP(0x7ffc8549, 0x01dd8154), WTCP(0x7ffbbfe6, 0x020fc3c6), WTCP(0x7ffae6c7, 0x024205e8), + WTCP(0x7ff9f9ec, 0x027447b0), WTCP(0x7ff8f954, 0x02a68917), WTCP(0x7ff7e500, 0x02d8ca16), WTCP(0x7ff6bcf0, 0x030b0aa4), + WTCP(0x7ff58125, 0x033d4abb), WTCP(0x7ff4319d, 0x036f8a51), WTCP(0x7ff2ce5b, 0x03a1c960), WTCP(0x7ff1575d, 0x03d407df), + WTCP(0x7fefcca4, 0x040645c7), WTCP(0x7fee2e30, 0x04388310), WTCP(0x7fec7c02, 0x046abfb3), WTCP(0x7feab61a, 0x049cfba7), + WTCP(0x7fe8dc78, 0x04cf36e5), WTCP(0x7fe6ef1c, 0x05017165), WTCP(0x7fe4ee06, 0x0533ab20), WTCP(0x7fe2d938, 0x0565e40d), + WTCP(0x7fe0b0b1, 0x05981c26), WTCP(0x7fde7471, 0x05ca5361), WTCP(0x7fdc247a, 0x05fc89b8), WTCP(0x7fd9c0ca, 0x062ebf22), + WTCP(0x7fd74964, 0x0660f398), WTCP(0x7fd4be46, 0x06932713), WTCP(0x7fd21f72, 0x06c5598a), WTCP(0x7fcf6ce8, 0x06f78af6), + WTCP(0x7fcca6a7, 0x0729bb4e), WTCP(0x7fc9ccb2, 0x075bea8c), WTCP(0x7fc6df08, 0x078e18a7), WTCP(0x7fc3dda9, 0x07c04598), + WTCP(0x7fc0c896, 0x07f27157), WTCP(0x7fbd9fd0, 0x08249bdd), WTCP(0x7fba6357, 0x0856c520), WTCP(0x7fb7132b, 0x0888ed1b), + WTCP(0x7fb3af4e, 0x08bb13c5), WTCP(0x7fb037bf, 0x08ed3916), WTCP(0x7facac7f, 0x091f5d06), WTCP(0x7fa90d8e, 0x09517f8f), + WTCP(0x7fa55aee, 0x0983a0a7), WTCP(0x7fa1949e, 0x09b5c048), WTCP(0x7f9dbaa0, 0x09e7de6a), WTCP(0x7f99ccf4, 0x0a19fb04), + WTCP(0x7f95cb9a, 0x0a4c1610), WTCP(0x7f91b694, 0x0a7e2f85), WTCP(0x7f8d8de1, 0x0ab0475c), WTCP(0x7f895182, 0x0ae25d8d), + WTCP(0x7f850179, 0x0b147211), WTCP(0x7f809dc5, 0x0b4684df), WTCP(0x7f7c2668, 0x0b7895f0), WTCP(0x7f779b62, 0x0baaa53b), + WTCP(0x7f72fcb4, 0x0bdcb2bb), WTCP(0x7f6e4a5e, 0x0c0ebe66), WTCP(0x7f698461, 0x0c40c835), WTCP(0x7f64aabf, 0x0c72d020), + WTCP(0x7f5fbd77, 0x0ca4d620), WTCP(0x7f5abc8a, 0x0cd6da2d), WTCP(0x7f55a7fa, 0x0d08dc3f), WTCP(0x7f507fc7, 0x0d3adc4e), + WTCP(0x7f4b43f2, 0x0d6cda53), WTCP(0x7f45f47b, 0x0d9ed646), WTCP(0x7f409164, 0x0dd0d01f), WTCP(0x7f3b1aad, 0x0e02c7d7), + WTCP(0x7f359057, 0x0e34bd66), WTCP(0x7f2ff263, 0x0e66b0c3), WTCP(0x7f2a40d2, 0x0e98a1e9), WTCP(0x7f247ba5, 0x0eca90ce), + WTCP(0x7f1ea2dc, 0x0efc7d6b), WTCP(0x7f18b679, 0x0f2e67b8), WTCP(0x7f12b67c, 0x0f604faf), WTCP(0x7f0ca2e7, 0x0f923546), + WTCP(0x7f067bba, 0x0fc41876), WTCP(0x7f0040f6, 0x0ff5f938), WTCP(0x7ef9f29d, 0x1027d784), WTCP(0x7ef390ae, 0x1059b352), + WTCP(0x7eed1b2c, 0x108b8c9b), WTCP(0x7ee69217, 0x10bd6356), WTCP(0x7edff570, 0x10ef377d), WTCP(0x7ed94538, 0x11210907), + WTCP(0x7ed28171, 0x1152d7ed), WTCP(0x7ecbaa1a, 0x1184a427), WTCP(0x7ec4bf36, 0x11b66dad), WTCP(0x7ebdc0c6, 0x11e83478), + WTCP(0x7eb6aeca, 0x1219f880), WTCP(0x7eaf8943, 0x124bb9be), WTCP(0x7ea85033, 0x127d7829), WTCP(0x7ea1039b, 0x12af33ba), + WTCP(0x7e99a37c, 0x12e0ec6a), WTCP(0x7e922fd6, 0x1312a230), WTCP(0x7e8aa8ac, 0x13445505), WTCP(0x7e830dff, 0x137604e2), + WTCP(0x7e7b5fce, 0x13a7b1bf), WTCP(0x7e739e1d, 0x13d95b93), WTCP(0x7e6bc8eb, 0x140b0258), WTCP(0x7e63e03b, 0x143ca605), + WTCP(0x7e5be40c, 0x146e4694), WTCP(0x7e53d462, 0x149fe3fc), WTCP(0x7e4bb13c, 0x14d17e36), WTCP(0x7e437a9c, 0x1503153a), + WTCP(0x7e3b3083, 0x1534a901), WTCP(0x7e32d2f4, 0x15663982), WTCP(0x7e2a61ed, 0x1597c6b7), WTCP(0x7e21dd73, 0x15c95097), + WTCP(0x7e194584, 0x15fad71b), WTCP(0x7e109a24, 0x162c5a3b), WTCP(0x7e07db52, 0x165dd9f0), WTCP(0x7dff0911, 0x168f5632), + WTCP(0x7df62362, 0x16c0cef9), WTCP(0x7ded2a47, 0x16f2443e), WTCP(0x7de41dc0, 0x1723b5f9), WTCP(0x7ddafdce, 0x17552422), + WTCP(0x7dd1ca75, 0x17868eb3), WTCP(0x7dc883b4, 0x17b7f5a3), WTCP(0x7dbf298d, 0x17e958ea), WTCP(0x7db5bc02, 0x181ab881), + WTCP(0x7dac3b15, 0x184c1461), WTCP(0x7da2a6c6, 0x187d6c82), WTCP(0x7d98ff17, 0x18aec0db), WTCP(0x7d8f4409, 0x18e01167), + WTCP(0x7d85759f, 0x19115e1c), WTCP(0x7d7b93da, 0x1942a6f3), WTCP(0x7d719eba, 0x1973ebe6), WTCP(0x7d679642, 0x19a52ceb), + WTCP(0x7d5d7a74, 0x19d669fc), WTCP(0x7d534b50, 0x1a07a311), WTCP(0x7d4908d9, 0x1a38d823), WTCP(0x7d3eb30f, 0x1a6a0929), + WTCP(0x7d3449f5, 0x1a9b361d), WTCP(0x7d29cd8c, 0x1acc5ef6), WTCP(0x7d1f3dd6, 0x1afd83ad), WTCP(0x7d149ad5, 0x1b2ea43a), + WTCP(0x7d09e489, 0x1b5fc097), WTCP(0x7cff1af5, 0x1b90d8bb), WTCP(0x7cf43e1a, 0x1bc1ec9e), WTCP(0x7ce94dfb, 0x1bf2fc3a), + WTCP(0x7cde4a98, 0x1c240786), WTCP(0x7cd333f3, 0x1c550e7c), WTCP(0x7cc80a0f, 0x1c861113), WTCP(0x7cbcccec, 0x1cb70f43), + WTCP(0x7cb17c8d, 0x1ce80906), WTCP(0x7ca618f3, 0x1d18fe54), WTCP(0x7c9aa221, 0x1d49ef26), WTCP(0x7c8f1817, 0x1d7adb73), + WTCP(0x7c837ad8, 0x1dabc334), WTCP(0x7c77ca65, 0x1ddca662), WTCP(0x7c6c06c0, 0x1e0d84f5), WTCP(0x7c602fec, 0x1e3e5ee5), + WTCP(0x7c5445e9, 0x1e6f342c), WTCP(0x7c4848ba, 0x1ea004c1), WTCP(0x7c3c3860, 0x1ed0d09d), WTCP(0x7c3014de, 0x1f0197b8), + WTCP(0x7c23de35, 0x1f325a0b), WTCP(0x7c179467, 0x1f63178f), WTCP(0x7c0b3777, 0x1f93d03c), WTCP(0x7bfec765, 0x1fc4840a), + WTCP(0x7bf24434, 0x1ff532f2), WTCP(0x7be5ade6, 0x2025dcec), WTCP(0x7bd9047c, 0x205681f1), WTCP(0x7bcc47fa, 0x208721f9), + WTCP(0x7bbf7860, 0x20b7bcfe), WTCP(0x7bb295b0, 0x20e852f6), WTCP(0x7ba59fee, 0x2118e3dc), WTCP(0x7b989719, 0x21496fa7), + WTCP(0x7b8b7b36, 0x2179f64f), WTCP(0x7b7e4c45, 0x21aa77cf), WTCP(0x7b710a49, 0x21daf41d), WTCP(0x7b63b543, 0x220b6b32), + WTCP(0x7b564d36, 0x223bdd08), WTCP(0x7b48d225, 0x226c4996), WTCP(0x7b3b4410, 0x229cb0d5), WTCP(0x7b2da2fa, 0x22cd12bd), + WTCP(0x7b1feee5, 0x22fd6f48), WTCP(0x7b1227d3, 0x232dc66d), WTCP(0x7b044dc7, 0x235e1826), WTCP(0x7af660c2, 0x238e646a), + WTCP(0x7ae860c7, 0x23beab33), WTCP(0x7ada4dd8, 0x23eeec78), WTCP(0x7acc27f7, 0x241f2833), WTCP(0x7abdef25, 0x244f5e5c), + WTCP(0x7aafa367, 0x247f8eec), WTCP(0x7aa144bc, 0x24afb9da), WTCP(0x7a92d329, 0x24dfdf20), WTCP(0x7a844eae, 0x250ffeb7), + WTCP(0x7a75b74f, 0x25401896), WTCP(0x7a670d0d, 0x25702cb7), WTCP(0x7a584feb, 0x25a03b11), WTCP(0x7a497feb, 0x25d0439f), + WTCP(0x7a3a9d0f, 0x26004657), WTCP(0x7a2ba75a, 0x26304333), WTCP(0x7a1c9ece, 0x26603a2c), WTCP(0x7a0d836d, 0x26902b39), + WTCP(0x79fe5539, 0x26c01655), WTCP(0x79ef1436, 0x26effb76), WTCP(0x79dfc064, 0x271fda96), WTCP(0x79d059c8, 0x274fb3ae), + WTCP(0x79c0e062, 0x277f86b5), WTCP(0x79b15435, 0x27af53a6), WTCP(0x79a1b545, 0x27df1a77), WTCP(0x79920392, 0x280edb23), + WTCP(0x79823f20, 0x283e95a1), WTCP(0x797267f2, 0x286e49ea), WTCP(0x79627e08, 0x289df7f8), WTCP(0x79528167, 0x28cd9fc1), + WTCP(0x79427210, 0x28fd4140), WTCP(0x79325006, 0x292cdc6d), WTCP(0x79221b4b, 0x295c7140), WTCP(0x7911d3e2, 0x298bffb2), + WTCP(0x790179cd, 0x29bb87bc), WTCP(0x78f10d0f, 0x29eb0957), WTCP(0x78e08dab, 0x2a1a847b), WTCP(0x78cffba3, 0x2a49f920), + WTCP(0x78bf56f9, 0x2a796740), WTCP(0x78ae9fb0, 0x2aa8ced3), WTCP(0x789dd5cb, 0x2ad82fd2), WTCP(0x788cf94c, 0x2b078a36), + WTCP(0x787c0a36, 0x2b36ddf7), WTCP(0x786b088c, 0x2b662b0e), WTCP(0x7859f44f, 0x2b957173), WTCP(0x7848cd83, 0x2bc4b120), + WTCP(0x7837942b, 0x2bf3ea0d), WTCP(0x78264849, 0x2c231c33), WTCP(0x7814e9df, 0x2c52478a), WTCP(0x780378f1, 0x2c816c0c), + WTCP(0x77f1f581, 0x2cb089b1), WTCP(0x77e05f91, 0x2cdfa071), WTCP(0x77ceb725, 0x2d0eb046), WTCP(0x77bcfc3f, 0x2d3db928), + WTCP(0x77ab2ee2, 0x2d6cbb10), WTCP(0x77994f11, 0x2d9bb5f6), WTCP(0x77875cce, 0x2dcaa9d5), WTCP(0x7775581d, 0x2df996a3), + WTCP(0x776340ff, 0x2e287c5a), WTCP(0x77511778, 0x2e575af3), WTCP(0x773edb8b, 0x2e863267), WTCP(0x772c8d3a, 0x2eb502ae), + WTCP(0x771a2c88, 0x2ee3cbc1), WTCP(0x7707b979, 0x2f128d99), WTCP(0x76f5340e, 0x2f41482e), WTCP(0x76e29c4b, 0x2f6ffb7a), + WTCP(0x76cff232, 0x2f9ea775), WTCP(0x76bd35c7, 0x2fcd4c19), WTCP(0x76aa670d, 0x2ffbe95d), WTCP(0x76978605, 0x302a7f3a), + WTCP(0x768492b4, 0x30590dab), WTCP(0x76718d1c, 0x308794a6), WTCP(0x765e7540, 0x30b61426), WTCP(0x764b4b23, 0x30e48c22), + WTCP(0x76380ec8, 0x3112fc95), WTCP(0x7624c031, 0x31416576), WTCP(0x76115f63, 0x316fc6be), WTCP(0x75fdec60, 0x319e2067), + WTCP(0x75ea672a, 0x31cc7269), WTCP(0x75d6cfc5, 0x31fabcbd), WTCP(0x75c32634, 0x3228ff5c), WTCP(0x75af6a7b, 0x32573a3f), + WTCP(0x759b9c9b, 0x32856d5e), WTCP(0x7587bc98, 0x32b398b3), WTCP(0x7573ca75, 0x32e1bc36), WTCP(0x755fc635, 0x330fd7e1), + WTCP(0x754bafdc, 0x333debab), WTCP(0x7537876c, 0x336bf78f), WTCP(0x75234ce8, 0x3399fb85), WTCP(0x750f0054, 0x33c7f785), + WTCP(0x74faa1b3, 0x33f5eb89), WTCP(0x74e63108, 0x3423d78a), WTCP(0x74d1ae55, 0x3451bb81), WTCP(0x74bd199f, 0x347f9766), + WTCP(0x74a872e8, 0x34ad6b32), WTCP(0x7493ba34, 0x34db36df), WTCP(0x747eef85, 0x3508fa66), WTCP(0x746a12df, 0x3536b5be), + WTCP(0x74552446, 0x356468e2), WTCP(0x744023bc, 0x359213c9), WTCP(0x742b1144, 0x35bfb66e), WTCP(0x7415ece2, 0x35ed50c9), + WTCP(0x7400b69a, 0x361ae2d3), WTCP(0x73eb6e6e, 0x36486c86), WTCP(0x73d61461, 0x3675edd9), WTCP(0x73c0a878, 0x36a366c6), + WTCP(0x73ab2ab4, 0x36d0d746), WTCP(0x73959b1b, 0x36fe3f52), WTCP(0x737ff9ae, 0x372b9ee3), WTCP(0x736a4671, 0x3758f5f2), + WTCP(0x73548168, 0x37864477), WTCP(0x733eaa96, 0x37b38a6d), WTCP(0x7328c1ff, 0x37e0c7cc), WTCP(0x7312c7a5, 0x380dfc8d), + WTCP(0x72fcbb8c, 0x383b28a9), WTCP(0x72e69db7, 0x38684c19), WTCP(0x72d06e2b, 0x389566d6), WTCP(0x72ba2cea, 0x38c278d9), + WTCP(0x72a3d9f7, 0x38ef821c), WTCP(0x728d7557, 0x391c8297), WTCP(0x7276ff0d, 0x39497a43), WTCP(0x7260771b, 0x39766919), + WTCP(0x7249dd86, 0x39a34f13), WTCP(0x72333251, 0x39d02c2a), WTCP(0x721c7580, 0x39fd0056), WTCP(0x7205a716, 0x3a29cb91), + WTCP(0x71eec716, 0x3a568dd4), WTCP(0x71d7d585, 0x3a834717), WTCP(0x71c0d265, 0x3aaff755), WTCP(0x71a9bdba, 0x3adc9e86), + WTCP(0x71929789, 0x3b093ca3), WTCP(0x717b5fd3, 0x3b35d1a5), WTCP(0x7164169d, 0x3b625d86), WTCP(0x714cbbeb, 0x3b8ee03e), + WTCP(0x71354fc0, 0x3bbb59c7), WTCP(0x711dd220, 0x3be7ca1a), WTCP(0x7106430e, 0x3c143130), WTCP(0x70eea28e, 0x3c408f03), + WTCP(0x70d6f0a4, 0x3c6ce38a), WTCP(0x70bf2d53, 0x3c992ec0), WTCP(0x70a7589f, 0x3cc5709e), WTCP(0x708f728b, 0x3cf1a91c), + WTCP(0x70777b1c, 0x3d1dd835), WTCP(0x705f7255, 0x3d49fde1), WTCP(0x70475839, 0x3d761a19), WTCP(0x702f2ccd, 0x3da22cd7), + WTCP(0x7016f014, 0x3dce3614), WTCP(0x6ffea212, 0x3dfa35c8), WTCP(0x6fe642ca, 0x3e262bee), WTCP(0x6fcdd241, 0x3e52187f), + WTCP(0x6fb5507a, 0x3e7dfb73), WTCP(0x6f9cbd79, 0x3ea9d4c3), WTCP(0x6f841942, 0x3ed5a46b), WTCP(0x6f6b63d8, 0x3f016a61), + WTCP(0x6f529d40, 0x3f2d26a0), WTCP(0x6f39c57d, 0x3f58d921), WTCP(0x6f20dc92, 0x3f8481dd), WTCP(0x6f07e285, 0x3fb020ce), + WTCP(0x6eeed758, 0x3fdbb5ec), WTCP(0x6ed5bb10, 0x40074132), WTCP(0x6ebc8db0, 0x4032c297), WTCP(0x6ea34f3d, 0x405e3a16), + WTCP(0x6e89ffb9, 0x4089a7a8), WTCP(0x6e709f2a, 0x40b50b46), WTCP(0x6e572d93, 0x40e064ea), WTCP(0x6e3daaf8, 0x410bb48c), + WTCP(0x6e24175c, 0x4136fa27), WTCP(0x6e0a72c5, 0x416235b2), WTCP(0x6df0bd35, 0x418d6729), WTCP(0x6dd6f6b1, 0x41b88e84), + WTCP(0x6dbd1f3c, 0x41e3abbc), WTCP(0x6da336dc, 0x420ebecb), WTCP(0x6d893d93, 0x4239c7aa), WTCP(0x6d6f3365, 0x4264c653), + WTCP(0x6d551858, 0x428fbabe), WTCP(0x6d3aec6e, 0x42baa4e6), WTCP(0x6d20afac, 0x42e584c3), WTCP(0x6d066215, 0x43105a50), + WTCP(0x6cec03af, 0x433b2585), WTCP(0x6cd1947c, 0x4365e65b), WTCP(0x6cb71482, 0x43909ccd), WTCP(0x6c9c83c3, 0x43bb48d4), + WTCP(0x6c81e245, 0x43e5ea68), WTCP(0x6c67300b, 0x44108184), WTCP(0x6c4c6d1a, 0x443b0e21), WTCP(0x6c319975, 0x44659039), + WTCP(0x6c16b521, 0x449007c4), WTCP(0x6bfbc021, 0x44ba74bd), WTCP(0x6be0ba7b, 0x44e4d71c), WTCP(0x6bc5a431, 0x450f2edb), + WTCP(0x6baa7d49, 0x45397bf4), WTCP(0x6b8f45c7, 0x4563be60), WTCP(0x6b73fdae, 0x458df619), WTCP(0x6b58a503, 0x45b82318), + WTCP(0x6b3d3bcb, 0x45e24556), WTCP(0x6b21c208, 0x460c5cce), WTCP(0x6b0637c1, 0x46366978), WTCP(0x6aea9cf8, 0x46606b4e), + WTCP(0x6acef1b2, 0x468a624a), WTCP(0x6ab335f4, 0x46b44e65), WTCP(0x6a9769c1, 0x46de2f99), WTCP(0x6a7b8d1e, 0x470805df), + WTCP(0x6a5fa010, 0x4731d131), WTCP(0x6a43a29a, 0x475b9188), WTCP(0x6a2794c1, 0x478546de), WTCP(0x6a0b7689, 0x47aef12c), + WTCP(0x69ef47f6, 0x47d8906d), WTCP(0x69d3090e, 0x48022499), WTCP(0x69b6b9d3, 0x482badab), WTCP(0x699a5a4c, 0x48552b9b), + WTCP(0x697dea7b, 0x487e9e64), WTCP(0x69616a65, 0x48a805ff), WTCP(0x6944da10, 0x48d16265), WTCP(0x6928397e, 0x48fab391), + WTCP(0x690b88b5, 0x4923f97b), WTCP(0x68eec7b9, 0x494d341e), WTCP(0x68d1f68f, 0x49766373), WTCP(0x68b5153a, 0x499f8774), + WTCP(0x689823bf, 0x49c8a01b), WTCP(0x687b2224, 0x49f1ad61), WTCP(0x685e106c, 0x4a1aaf3f), WTCP(0x6840ee9b, 0x4a43a5b0), + WTCP(0x6823bcb7, 0x4a6c90ad), WTCP(0x68067ac3, 0x4a957030), WTCP(0x67e928c5, 0x4abe4433), WTCP(0x67cbc6c0, 0x4ae70caf), + WTCP(0x67ae54ba, 0x4b0fc99d), WTCP(0x6790d2b6, 0x4b387af9), WTCP(0x677340ba, 0x4b6120bb), WTCP(0x67559eca, 0x4b89badd), + WTCP(0x6737ecea, 0x4bb24958), WTCP(0x671a2b20, 0x4bdacc28), WTCP(0x66fc596f, 0x4c034345), WTCP(0x66de77dc, 0x4c2baea9), + WTCP(0x66c0866d, 0x4c540e4e), WTCP(0x66a28524, 0x4c7c622d), WTCP(0x66847408, 0x4ca4aa41), WTCP(0x6666531d, 0x4ccce684), + WTCP(0x66482267, 0x4cf516ee), WTCP(0x6629e1ec, 0x4d1d3b7a), WTCP(0x660b91af, 0x4d455422), WTCP(0x65ed31b5, 0x4d6d60df), + WTCP(0x65cec204, 0x4d9561ac), WTCP(0x65b0429f, 0x4dbd5682), WTCP(0x6591b38c, 0x4de53f5a), WTCP(0x657314cf, 0x4e0d1c30), + WTCP(0x6554666d, 0x4e34ecfc), WTCP(0x6535a86b, 0x4e5cb1b9), WTCP(0x6516dacd, 0x4e846a60), WTCP(0x64f7fd98, 0x4eac16eb), + WTCP(0x64d910d1, 0x4ed3b755), WTCP(0x64ba147d, 0x4efb4b96), WTCP(0x649b08a0, 0x4f22d3aa), WTCP(0x647bed3f, 0x4f4a4f89), + WTCP(0x645cc260, 0x4f71bf2e), WTCP(0x643d8806, 0x4f992293), WTCP(0x641e3e38, 0x4fc079b1), WTCP(0x63fee4f8, 0x4fe7c483), + WTCP(0x63df7c4d, 0x500f0302), WTCP(0x63c0043b, 0x50363529), WTCP(0x63a07cc7, 0x505d5af1), WTCP(0x6380e5f6, 0x50847454), + WTCP(0x63613fcd, 0x50ab814d), WTCP(0x63418a50, 0x50d281d5), WTCP(0x6321c585, 0x50f975e6), WTCP(0x6301f171, 0x51205d7b), + WTCP(0x62e20e17, 0x5147388c), WTCP(0x62c21b7e, 0x516e0715), WTCP(0x62a219aa, 0x5194c910), WTCP(0x628208a1, 0x51bb7e75), + WTCP(0x6261e866, 0x51e22740), WTCP(0x6241b8ff, 0x5208c36a), WTCP(0x62217a72, 0x522f52ee), WTCP(0x62012cc2, 0x5255d5c5), + WTCP(0x61e0cff5, 0x527c4bea), WTCP(0x61c06410, 0x52a2b556), WTCP(0x619fe918, 0x52c91204), WTCP(0x617f5f12, 0x52ef61ee), + WTCP(0x615ec603, 0x5315a50e), WTCP(0x613e1df0, 0x533bdb5d), WTCP(0x611d66de, 0x536204d7), WTCP(0x60fca0d2, 0x53882175), + WTCP(0x60dbcbd1, 0x53ae3131), WTCP(0x60bae7e1, 0x53d43406), WTCP(0x6099f505, 0x53fa29ed), WTCP(0x6078f344, 0x542012e1), + WTCP(0x6057e2a2, 0x5445eedb), WTCP(0x6036c325, 0x546bbdd7), WTCP(0x601594d1, 0x54917fce), WTCP(0x5ff457ad, 0x54b734ba), + WTCP(0x5fd30bbc, 0x54dcdc96), WTCP(0x5fb1b104, 0x5502775c), WTCP(0x5f90478a, 0x55280505), WTCP(0x5f6ecf53, 0x554d858d), + WTCP(0x5f4d4865, 0x5572f8ed), WTCP(0x5f2bb2c5, 0x55985f20), WTCP(0x5f0a0e77, 0x55bdb81f), WTCP(0x5ee85b82, 0x55e303e6), + WTCP(0x5ec699e9, 0x5608426e), WTCP(0x5ea4c9b3, 0x562d73b2), WTCP(0x5e82eae5, 0x565297ab), WTCP(0x5e60fd84, 0x5677ae54), + WTCP(0x5e3f0194, 0x569cb7a8), WTCP(0x5e1cf71c, 0x56c1b3a1), WTCP(0x5dfade20, 0x56e6a239), WTCP(0x5dd8b6a7, 0x570b8369), + WTCP(0x5db680b4, 0x5730572e), WTCP(0x5d943c4e, 0x57551d80), WTCP(0x5d71e979, 0x5779d65b), WTCP(0x5d4f883b, 0x579e81b8), + WTCP(0x5d2d189a, 0x57c31f92), WTCP(0x5d0a9a9a, 0x57e7afe4), WTCP(0x5ce80e41, 0x580c32a7), WTCP(0x5cc57394, 0x5830a7d6), + WTCP(0x5ca2ca99, 0x58550f6c), WTCP(0x5c801354, 0x58796962), WTCP(0x5c5d4dcc, 0x589db5b3), WTCP(0x5c3a7a05, 0x58c1f45b), + WTCP(0x5c179806, 0x58e62552), WTCP(0x5bf4a7d2, 0x590a4893), WTCP(0x5bd1a971, 0x592e5e19), WTCP(0x5bae9ce7, 0x595265df), + WTCP(0x5b8b8239, 0x59765fde), WTCP(0x5b68596d, 0x599a4c12), WTCP(0x5b452288, 0x59be2a74), WTCP(0x5b21dd90, 0x59e1faff), + WTCP(0x5afe8a8b, 0x5a05bdae), WTCP(0x5adb297d, 0x5a29727b), WTCP(0x5ab7ba6c, 0x5a4d1960), WTCP(0x5a943d5e, 0x5a70b258), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP KBDWindow1024[] = +{ + WTCP(0x7fffffa4, 0x0009962f), WTCP(0x7fffff39, 0x000e16fb), WTCP(0x7ffffebf, 0x0011ea65), WTCP(0x7ffffe34, 0x0015750e), + WTCP(0x7ffffd96, 0x0018dc74), WTCP(0x7ffffce5, 0x001c332e), WTCP(0x7ffffc1f, 0x001f83f5), WTCP(0x7ffffb43, 0x0022d59a), + WTCP(0x7ffffa4f, 0x00262cc2), WTCP(0x7ffff942, 0x00298cc4), WTCP(0x7ffff81a, 0x002cf81f), WTCP(0x7ffff6d6, 0x003070c4), + WTCP(0x7ffff573, 0x0033f840), WTCP(0x7ffff3f1, 0x00378fd9), WTCP(0x7ffff24d, 0x003b38a1), WTCP(0x7ffff085, 0x003ef381), + WTCP(0x7fffee98, 0x0042c147), WTCP(0x7fffec83, 0x0046a2a8), WTCP(0x7fffea44, 0x004a9847), WTCP(0x7fffe7d8, 0x004ea2b7), + WTCP(0x7fffe53f, 0x0052c283), WTCP(0x7fffe274, 0x0056f829), WTCP(0x7fffdf76, 0x005b4422), WTCP(0x7fffdc43, 0x005fa6dd), + WTCP(0x7fffd8d6, 0x006420c8), WTCP(0x7fffd52f, 0x0068b249), WTCP(0x7fffd149, 0x006d5bc4), WTCP(0x7fffcd22, 0x00721d9a), + WTCP(0x7fffc8b6, 0x0076f828), WTCP(0x7fffc404, 0x007bebca), WTCP(0x7fffbf06, 0x0080f8d9), WTCP(0x7fffb9bb, 0x00861fae), + WTCP(0x7fffb41e, 0x008b609e), WTCP(0x7fffae2c, 0x0090bbff), WTCP(0x7fffa7e1, 0x00963224), WTCP(0x7fffa13a, 0x009bc362), + WTCP(0x7fff9a32, 0x00a17009), WTCP(0x7fff92c5, 0x00a7386c), WTCP(0x7fff8af0, 0x00ad1cdc), WTCP(0x7fff82ad, 0x00b31da8), + WTCP(0x7fff79f9, 0x00b93b21), WTCP(0x7fff70cf, 0x00bf7596), WTCP(0x7fff672a, 0x00c5cd57), WTCP(0x7fff5d05, 0x00cc42b1), + WTCP(0x7fff525c, 0x00d2d5f3), WTCP(0x7fff4729, 0x00d9876c), WTCP(0x7fff3b66, 0x00e05769), WTCP(0x7fff2f10, 0x00e74638), + WTCP(0x7fff221f, 0x00ee5426), WTCP(0x7fff148e, 0x00f58182), WTCP(0x7fff0658, 0x00fcce97), WTCP(0x7ffef776, 0x01043bb3), + WTCP(0x7ffee7e2, 0x010bc923), WTCP(0x7ffed795, 0x01137733), WTCP(0x7ffec68a, 0x011b4631), WTCP(0x7ffeb4ba, 0x01233669), + WTCP(0x7ffea21d, 0x012b4827), WTCP(0x7ffe8eac, 0x01337bb8), WTCP(0x7ffe7a61, 0x013bd167), WTCP(0x7ffe6533, 0x01444982), + WTCP(0x7ffe4f1c, 0x014ce454), WTCP(0x7ffe3813, 0x0155a229), WTCP(0x7ffe2011, 0x015e834d), WTCP(0x7ffe070d, 0x0167880c), + WTCP(0x7ffdecff, 0x0170b0b2), WTCP(0x7ffdd1df, 0x0179fd8b), WTCP(0x7ffdb5a2, 0x01836ee1), WTCP(0x7ffd9842, 0x018d0500), + WTCP(0x7ffd79b3, 0x0196c035), WTCP(0x7ffd59ee, 0x01a0a0ca), WTCP(0x7ffd38e8, 0x01aaa70a), WTCP(0x7ffd1697, 0x01b4d341), + WTCP(0x7ffcf2f2, 0x01bf25b9), WTCP(0x7ffccdee, 0x01c99ebd), WTCP(0x7ffca780, 0x01d43e99), WTCP(0x7ffc7f9e, 0x01df0597), + WTCP(0x7ffc563d, 0x01e9f401), WTCP(0x7ffc2b51, 0x01f50a22), WTCP(0x7ffbfecf, 0x02004844), WTCP(0x7ffbd0ab, 0x020baeb1), + WTCP(0x7ffba0da, 0x02173db4), WTCP(0x7ffb6f4f, 0x0222f596), WTCP(0x7ffb3bfd, 0x022ed6a1), WTCP(0x7ffb06d8, 0x023ae11f), + WTCP(0x7ffacfd3, 0x02471558), WTCP(0x7ffa96e0, 0x02537397), WTCP(0x7ffa5bf2, 0x025ffc25), WTCP(0x7ffa1efc, 0x026caf4a), + WTCP(0x7ff9dfee, 0x02798d4f), WTCP(0x7ff99ebb, 0x0286967c), WTCP(0x7ff95b55, 0x0293cb1b), WTCP(0x7ff915ab, 0x02a12b72), + WTCP(0x7ff8cdaf, 0x02aeb7cb), WTCP(0x7ff88351, 0x02bc706d), WTCP(0x7ff83682, 0x02ca559f), WTCP(0x7ff7e731, 0x02d867a9), + WTCP(0x7ff7954e, 0x02e6a6d2), WTCP(0x7ff740c8, 0x02f51361), WTCP(0x7ff6e98e, 0x0303ad9c), WTCP(0x7ff68f8f, 0x031275ca), + WTCP(0x7ff632ba, 0x03216c30), WTCP(0x7ff5d2fb, 0x03309116), WTCP(0x7ff57042, 0x033fe4bf), WTCP(0x7ff50a7a, 0x034f6773), + WTCP(0x7ff4a192, 0x035f1975), WTCP(0x7ff43576, 0x036efb0a), WTCP(0x7ff3c612, 0x037f0c78), WTCP(0x7ff35353, 0x038f4e02), + WTCP(0x7ff2dd24, 0x039fbfeb), WTCP(0x7ff26370, 0x03b06279), WTCP(0x7ff1e623, 0x03c135ed), WTCP(0x7ff16527, 0x03d23a8b), + WTCP(0x7ff0e067, 0x03e37095), WTCP(0x7ff057cc, 0x03f4d84e), WTCP(0x7fefcb40, 0x040671f7), WTCP(0x7fef3aad, 0x04183dd3), + WTCP(0x7feea5fa, 0x042a3c22), WTCP(0x7fee0d11, 0x043c6d25), WTCP(0x7fed6fda, 0x044ed11d), WTCP(0x7fecce3d, 0x04616849), + WTCP(0x7fec2821, 0x047432eb), WTCP(0x7feb7d6c, 0x04873140), WTCP(0x7feace07, 0x049a6388), WTCP(0x7fea19d6, 0x04adca01), + WTCP(0x7fe960c0, 0x04c164ea), WTCP(0x7fe8a2aa, 0x04d53481), WTCP(0x7fe7df79, 0x04e93902), WTCP(0x7fe71712, 0x04fd72aa), + WTCP(0x7fe6495a, 0x0511e1b6), WTCP(0x7fe57634, 0x05268663), WTCP(0x7fe49d83, 0x053b60eb), WTCP(0x7fe3bf2b, 0x05507189), + WTCP(0x7fe2db0f, 0x0565b879), WTCP(0x7fe1f110, 0x057b35f4), WTCP(0x7fe10111, 0x0590ea35), WTCP(0x7fe00af3, 0x05a6d574), + WTCP(0x7fdf0e97, 0x05bcf7ea), WTCP(0x7fde0bdd, 0x05d351cf), WTCP(0x7fdd02a6, 0x05e9e35c), WTCP(0x7fdbf2d2, 0x0600acc8), + WTCP(0x7fdadc40, 0x0617ae48), WTCP(0x7fd9becf, 0x062ee814), WTCP(0x7fd89a5e, 0x06465a62), WTCP(0x7fd76eca, 0x065e0565), + WTCP(0x7fd63bf1, 0x0675e954), WTCP(0x7fd501b0, 0x068e0662), WTCP(0x7fd3bfe4, 0x06a65cc3), WTCP(0x7fd2766a, 0x06beecaa), + WTCP(0x7fd1251e, 0x06d7b648), WTCP(0x7fcfcbda, 0x06f0b9d1), WTCP(0x7fce6a7a, 0x0709f775), WTCP(0x7fcd00d8, 0x07236f65), + WTCP(0x7fcb8ecf, 0x073d21d2), WTCP(0x7fca1439, 0x07570eea), WTCP(0x7fc890ed, 0x077136dd), WTCP(0x7fc704c7, 0x078b99da), + WTCP(0x7fc56f9d, 0x07a6380d), WTCP(0x7fc3d147, 0x07c111a4), WTCP(0x7fc2299e, 0x07dc26cc), WTCP(0x7fc07878, 0x07f777b1), + WTCP(0x7fbebdac, 0x0813047d), WTCP(0x7fbcf90f, 0x082ecd5b), WTCP(0x7fbb2a78, 0x084ad276), WTCP(0x7fb951bc, 0x086713f7), + WTCP(0x7fb76eaf, 0x08839206), WTCP(0x7fb58126, 0x08a04ccb), WTCP(0x7fb388f4, 0x08bd446e), WTCP(0x7fb185ee, 0x08da7915), + WTCP(0x7faf77e5, 0x08f7eae7), WTCP(0x7fad5ead, 0x09159a09), WTCP(0x7fab3a17, 0x0933869f), WTCP(0x7fa909f6, 0x0951b0cd), + WTCP(0x7fa6ce1a, 0x097018b7), WTCP(0x7fa48653, 0x098ebe7f), WTCP(0x7fa23273, 0x09ada248), WTCP(0x7f9fd249, 0x09ccc431), + WTCP(0x7f9d65a4, 0x09ec245b), WTCP(0x7f9aec53, 0x0a0bc2e7), WTCP(0x7f986625, 0x0a2b9ff3), WTCP(0x7f95d2e7, 0x0a4bbb9e), + WTCP(0x7f933267, 0x0a6c1604), WTCP(0x7f908472, 0x0a8caf43), WTCP(0x7f8dc8d5, 0x0aad8776), WTCP(0x7f8aff5c, 0x0ace9eb9), + WTCP(0x7f8827d3, 0x0aeff526), WTCP(0x7f854204, 0x0b118ad8), WTCP(0x7f824dbb, 0x0b335fe6), WTCP(0x7f7f4ac3, 0x0b557469), + WTCP(0x7f7c38e4, 0x0b77c879), WTCP(0x7f7917e9, 0x0b9a5c2b), WTCP(0x7f75e79b, 0x0bbd2f97), WTCP(0x7f72a7c3, 0x0be042d0), + WTCP(0x7f6f5828, 0x0c0395ec), WTCP(0x7f6bf892, 0x0c2728fd), WTCP(0x7f6888c9, 0x0c4afc16), WTCP(0x7f650894, 0x0c6f0f4a), + WTCP(0x7f6177b9, 0x0c9362a8), WTCP(0x7f5dd5ff, 0x0cb7f642), WTCP(0x7f5a232a, 0x0cdcca26), WTCP(0x7f565f00, 0x0d01de63), + WTCP(0x7f528947, 0x0d273307), WTCP(0x7f4ea1c2, 0x0d4cc81f), WTCP(0x7f4aa835, 0x0d729db7), WTCP(0x7f469c65, 0x0d98b3da), + WTCP(0x7f427e13, 0x0dbf0a92), WTCP(0x7f3e4d04, 0x0de5a1e9), WTCP(0x7f3a08f9, 0x0e0c79e7), WTCP(0x7f35b1b4, 0x0e339295), + WTCP(0x7f3146f8, 0x0e5aebfa), WTCP(0x7f2cc884, 0x0e82861a), WTCP(0x7f28361b, 0x0eaa60fd), WTCP(0x7f238f7c, 0x0ed27ca5), + WTCP(0x7f1ed467, 0x0efad917), WTCP(0x7f1a049d, 0x0f237656), WTCP(0x7f151fdc, 0x0f4c5462), WTCP(0x7f1025e3, 0x0f75733d), + WTCP(0x7f0b1672, 0x0f9ed2e6), WTCP(0x7f05f146, 0x0fc8735e), WTCP(0x7f00b61d, 0x0ff254a1), WTCP(0x7efb64b4, 0x101c76ae), + WTCP(0x7ef5fcca, 0x1046d981), WTCP(0x7ef07e19, 0x10717d15), WTCP(0x7eeae860, 0x109c6165), WTCP(0x7ee53b5b, 0x10c7866a), + WTCP(0x7edf76c4, 0x10f2ec1e), WTCP(0x7ed99a58, 0x111e9279), WTCP(0x7ed3a5d1, 0x114a7971), WTCP(0x7ecd98eb, 0x1176a0fc), + WTCP(0x7ec77360, 0x11a30910), WTCP(0x7ec134eb, 0x11cfb1a1), WTCP(0x7ebadd44, 0x11fc9aa2), WTCP(0x7eb46c27, 0x1229c406), + WTCP(0x7eade14c, 0x12572dbf), WTCP(0x7ea73c6c, 0x1284d7bc), WTCP(0x7ea07d41, 0x12b2c1ed), WTCP(0x7e99a382, 0x12e0ec42), + WTCP(0x7e92aee7, 0x130f56a8), WTCP(0x7e8b9f2a, 0x133e010b), WTCP(0x7e847402, 0x136ceb59), WTCP(0x7e7d2d25, 0x139c157b), + WTCP(0x7e75ca4c, 0x13cb7f5d), WTCP(0x7e6e4b2d, 0x13fb28e6), WTCP(0x7e66af7f, 0x142b1200), WTCP(0x7e5ef6f8, 0x145b3a92), + WTCP(0x7e572150, 0x148ba281), WTCP(0x7e4f2e3b, 0x14bc49b4), WTCP(0x7e471d70, 0x14ed300f), WTCP(0x7e3eeea5, 0x151e5575), + WTCP(0x7e36a18e, 0x154fb9c9), WTCP(0x7e2e35e2, 0x15815ced), WTCP(0x7e25ab56, 0x15b33ec1), WTCP(0x7e1d019e, 0x15e55f25), + WTCP(0x7e14386e, 0x1617bdf9), WTCP(0x7e0b4f7d, 0x164a5b19), WTCP(0x7e02467e, 0x167d3662), WTCP(0x7df91d25, 0x16b04fb2), + WTCP(0x7defd327, 0x16e3a6e2), WTCP(0x7de66837, 0x17173bce), WTCP(0x7ddcdc0a, 0x174b0e4d), WTCP(0x7dd32e53, 0x177f1e39), + WTCP(0x7dc95ec6, 0x17b36b69), WTCP(0x7dbf6d17, 0x17e7f5b3), WTCP(0x7db558f9, 0x181cbcec), WTCP(0x7dab221f, 0x1851c0e9), + WTCP(0x7da0c83c, 0x1887017d), WTCP(0x7d964b05, 0x18bc7e7c), WTCP(0x7d8baa2b, 0x18f237b6), WTCP(0x7d80e563, 0x19282cfd), + WTCP(0x7d75fc5e, 0x195e5e20), WTCP(0x7d6aeed0, 0x1994caee), WTCP(0x7d5fbc6d, 0x19cb7335), WTCP(0x7d5464e6, 0x1a0256c2), + WTCP(0x7d48e7ef, 0x1a397561), WTCP(0x7d3d453b, 0x1a70cede), WTCP(0x7d317c7c, 0x1aa86301), WTCP(0x7d258d65, 0x1ae03195), + WTCP(0x7d1977aa, 0x1b183a63), WTCP(0x7d0d3afc, 0x1b507d30), WTCP(0x7d00d710, 0x1b88f9c5), WTCP(0x7cf44b97, 0x1bc1afe6), + WTCP(0x7ce79846, 0x1bfa9f58), WTCP(0x7cdabcce, 0x1c33c7e0), WTCP(0x7ccdb8e4, 0x1c6d293f), WTCP(0x7cc08c39, 0x1ca6c337), + WTCP(0x7cb33682, 0x1ce0958a), WTCP(0x7ca5b772, 0x1d1a9ff8), WTCP(0x7c980ebd, 0x1d54e240), WTCP(0x7c8a3c14, 0x1d8f5c21), + WTCP(0x7c7c3f2e, 0x1dca0d56), WTCP(0x7c6e17bc, 0x1e04f59f), WTCP(0x7c5fc573, 0x1e4014b4), WTCP(0x7c514807, 0x1e7b6a53), + WTCP(0x7c429f2c, 0x1eb6f633), WTCP(0x7c33ca96, 0x1ef2b80f), WTCP(0x7c24c9fa, 0x1f2eaf9e), WTCP(0x7c159d0d, 0x1f6adc98), + WTCP(0x7c064383, 0x1fa73eb2), WTCP(0x7bf6bd11, 0x1fe3d5a3), WTCP(0x7be7096c, 0x2020a11e), WTCP(0x7bd7284a, 0x205da0d8), + WTCP(0x7bc71960, 0x209ad483), WTCP(0x7bb6dc65, 0x20d83bd1), WTCP(0x7ba6710d, 0x2115d674), WTCP(0x7b95d710, 0x2153a41b), + WTCP(0x7b850e24, 0x2191a476), WTCP(0x7b7415ff, 0x21cfd734), WTCP(0x7b62ee59, 0x220e3c02), WTCP(0x7b5196e9, 0x224cd28d), + WTCP(0x7b400f67, 0x228b9a82), WTCP(0x7b2e578a, 0x22ca938a), WTCP(0x7b1c6f0b, 0x2309bd52), WTCP(0x7b0a55a1, 0x23491783), + WTCP(0x7af80b07, 0x2388a1c4), WTCP(0x7ae58ef5, 0x23c85bbf), WTCP(0x7ad2e124, 0x2408451a), WTCP(0x7ac0014e, 0x24485d7c), + WTCP(0x7aacef2e, 0x2488a48a), WTCP(0x7a99aa7e, 0x24c919e9), WTCP(0x7a8632f8, 0x2509bd3d), WTCP(0x7a728858, 0x254a8e29), + WTCP(0x7a5eaa5a, 0x258b8c50), WTCP(0x7a4a98b9, 0x25ccb753), WTCP(0x7a365333, 0x260e0ed3), WTCP(0x7a21d983, 0x264f9271), + WTCP(0x7a0d2b68, 0x269141cb), WTCP(0x79f8489e, 0x26d31c80), WTCP(0x79e330e4, 0x2715222f), WTCP(0x79cde3f8, 0x27575273), + WTCP(0x79b8619a, 0x2799acea), WTCP(0x79a2a989, 0x27dc3130), WTCP(0x798cbb85, 0x281ededf), WTCP(0x7976974e, 0x2861b591), + WTCP(0x79603ca5, 0x28a4b4e0), WTCP(0x7949ab4c, 0x28e7dc65), WTCP(0x7932e304, 0x292b2bb8), WTCP(0x791be390, 0x296ea270), + WTCP(0x7904acb3, 0x29b24024), WTCP(0x78ed3e30, 0x29f6046b), WTCP(0x78d597cc, 0x2a39eed8), WTCP(0x78bdb94a, 0x2a7dff02), + WTCP(0x78a5a270, 0x2ac2347c), WTCP(0x788d5304, 0x2b068eda), WTCP(0x7874cacb, 0x2b4b0dae), WTCP(0x785c098d, 0x2b8fb08a), + WTCP(0x78430f11, 0x2bd47700), WTCP(0x7829db1f, 0x2c1960a1), WTCP(0x78106d7f, 0x2c5e6cfd), WTCP(0x77f6c5fb, 0x2ca39ba3), + WTCP(0x77dce45c, 0x2ce8ec23), WTCP(0x77c2c86e, 0x2d2e5e0b), WTCP(0x77a871fa, 0x2d73f0e8), WTCP(0x778de0cd, 0x2db9a449), + WTCP(0x777314b2, 0x2dff77b8), WTCP(0x77580d78, 0x2e456ac4), WTCP(0x773ccaeb, 0x2e8b7cf6), WTCP(0x77214cdb, 0x2ed1addb), + WTCP(0x77059315, 0x2f17fcfb), WTCP(0x76e99d69, 0x2f5e69e2), WTCP(0x76cd6ba9, 0x2fa4f419), WTCP(0x76b0fda4, 0x2feb9b27), + WTCP(0x7694532e, 0x30325e96), WTCP(0x76776c17, 0x30793dee), WTCP(0x765a4834, 0x30c038b5), WTCP(0x763ce759, 0x31074e72), + WTCP(0x761f4959, 0x314e7eab), WTCP(0x76016e0b, 0x3195c8e6), WTCP(0x75e35545, 0x31dd2ca9), WTCP(0x75c4fedc, 0x3224a979), + WTCP(0x75a66aab, 0x326c3ed8), WTCP(0x75879887, 0x32b3ec4d), WTCP(0x7568884b, 0x32fbb159), WTCP(0x754939d1, 0x33438d81), + WTCP(0x7529acf4, 0x338b8045), WTCP(0x7509e18e, 0x33d3892a), WTCP(0x74e9d77d, 0x341ba7b1), WTCP(0x74c98e9e, 0x3463db5a), + WTCP(0x74a906cd, 0x34ac23a7), WTCP(0x74883fec, 0x34f48019), WTCP(0x746739d8, 0x353cf02f), WTCP(0x7445f472, 0x3585736a), + WTCP(0x74246f9c, 0x35ce0949), WTCP(0x7402ab37, 0x3616b14c), WTCP(0x73e0a727, 0x365f6af0), WTCP(0x73be6350, 0x36a835b5), + WTCP(0x739bdf95, 0x36f11118), WTCP(0x73791bdd, 0x3739fc98), WTCP(0x7356180e, 0x3782f7b2), WTCP(0x7332d410, 0x37cc01e3), + WTCP(0x730f4fc9, 0x38151aa8), WTCP(0x72eb8b24, 0x385e417e), WTCP(0x72c7860a, 0x38a775e1), WTCP(0x72a34066, 0x38f0b74d), + WTCP(0x727eba24, 0x393a053e), WTCP(0x7259f331, 0x39835f30), WTCP(0x7234eb79, 0x39ccc49e), WTCP(0x720fa2eb, 0x3a163503), + WTCP(0x71ea1977, 0x3a5fafda), WTCP(0x71c44f0c, 0x3aa9349e), WTCP(0x719e439d, 0x3af2c2ca), WTCP(0x7177f71a, 0x3b3c59d7), + WTCP(0x71516978, 0x3b85f940), WTCP(0x712a9aaa, 0x3bcfa07e), WTCP(0x71038aa4, 0x3c194f0d), WTCP(0x70dc395e, 0x3c630464), + WTCP(0x70b4a6cd, 0x3cacbfff), WTCP(0x708cd2e9, 0x3cf68155), WTCP(0x7064bdab, 0x3d4047e1), WTCP(0x703c670d, 0x3d8a131c), + WTCP(0x7013cf0a, 0x3dd3e27e), WTCP(0x6feaf59c, 0x3e1db580), WTCP(0x6fc1dac1, 0x3e678b9b), WTCP(0x6f987e76, 0x3eb16449), + WTCP(0x6f6ee0b9, 0x3efb3f01), WTCP(0x6f45018b, 0x3f451b3d), WTCP(0x6f1ae0eb, 0x3f8ef874), WTCP(0x6ef07edb, 0x3fd8d620), + WTCP(0x6ec5db5d, 0x4022b3b9), WTCP(0x6e9af675, 0x406c90b7), WTCP(0x6e6fd027, 0x40b66c93), WTCP(0x6e446879, 0x410046c5), + WTCP(0x6e18bf71, 0x414a1ec6), WTCP(0x6decd517, 0x4193f40d), WTCP(0x6dc0a972, 0x41ddc615), WTCP(0x6d943c8d, 0x42279455), + WTCP(0x6d678e71, 0x42715e45), WTCP(0x6d3a9f2a, 0x42bb235f), WTCP(0x6d0d6ec5, 0x4304e31a), WTCP(0x6cdffd4f, 0x434e9cf1), + WTCP(0x6cb24ad6, 0x4398505b), WTCP(0x6c84576b, 0x43e1fcd1), WTCP(0x6c56231c, 0x442ba1cd), WTCP(0x6c27adfd, 0x44753ec7), + WTCP(0x6bf8f81e, 0x44bed33a), WTCP(0x6bca0195, 0x45085e9d), WTCP(0x6b9aca75, 0x4551e06b), WTCP(0x6b6b52d5, 0x459b581e), + WTCP(0x6b3b9ac9, 0x45e4c52f), WTCP(0x6b0ba26b, 0x462e2717), WTCP(0x6adb69d3, 0x46777d52), WTCP(0x6aaaf11b, 0x46c0c75a), + WTCP(0x6a7a385c, 0x470a04a9), WTCP(0x6a493fb3, 0x475334b9), WTCP(0x6a18073d, 0x479c5707), WTCP(0x69e68f17, 0x47e56b0c), + WTCP(0x69b4d761, 0x482e7045), WTCP(0x6982e039, 0x4877662c), WTCP(0x6950a9c0, 0x48c04c3f), WTCP(0x691e341a, 0x490921f8), + WTCP(0x68eb7f67, 0x4951e6d5), WTCP(0x68b88bcd, 0x499a9a51), WTCP(0x68855970, 0x49e33beb), WTCP(0x6851e875, 0x4a2bcb1f), + WTCP(0x681e3905, 0x4a74476b), WTCP(0x67ea4b47, 0x4abcb04c), WTCP(0x67b61f63, 0x4b050541), WTCP(0x6781b585, 0x4b4d45c9), + WTCP(0x674d0dd6, 0x4b957162), WTCP(0x67182883, 0x4bdd878c), WTCP(0x66e305b8, 0x4c2587c6), WTCP(0x66ada5a5, 0x4c6d7190), + WTCP(0x66780878, 0x4cb5446a), WTCP(0x66422e60, 0x4cfcffd5), WTCP(0x660c1790, 0x4d44a353), WTCP(0x65d5c439, 0x4d8c2e64), + WTCP(0x659f348e, 0x4dd3a08c), WTCP(0x656868c3, 0x4e1af94b), WTCP(0x6531610d, 0x4e623825), WTCP(0x64fa1da3, 0x4ea95c9d), + WTCP(0x64c29ebb, 0x4ef06637), WTCP(0x648ae48d, 0x4f375477), WTCP(0x6452ef53, 0x4f7e26e1), WTCP(0x641abf46, 0x4fc4dcfb), + WTCP(0x63e254a2, 0x500b7649), WTCP(0x63a9afa2, 0x5051f253), WTCP(0x6370d083, 0x5098509f), WTCP(0x6337b784, 0x50de90b3), + WTCP(0x62fe64e3, 0x5124b218), WTCP(0x62c4d8e0, 0x516ab455), WTCP(0x628b13bc, 0x51b096f3), WTCP(0x625115b8, 0x51f6597b), + WTCP(0x6216df18, 0x523bfb78), WTCP(0x61dc701f, 0x52817c72), WTCP(0x61a1c912, 0x52c6dbf5), WTCP(0x6166ea36, 0x530c198d), + WTCP(0x612bd3d2, 0x535134c5), WTCP(0x60f0862d, 0x53962d2a), WTCP(0x60b50190, 0x53db024a), WTCP(0x60794644, 0x541fb3b1), + WTCP(0x603d5494, 0x546440ef), WTCP(0x60012cca, 0x54a8a992), WTCP(0x5fc4cf33, 0x54eced2b), WTCP(0x5f883c1c, 0x55310b48), + WTCP(0x5f4b73d2, 0x5575037c), WTCP(0x5f0e76a5, 0x55b8d558), WTCP(0x5ed144e5, 0x55fc806f), WTCP(0x5e93dee1, 0x56400452), + WTCP(0x5e5644ec, 0x56836096), WTCP(0x5e187757, 0x56c694cf), WTCP(0x5dda7677, 0x5709a092), WTCP(0x5d9c429f, 0x574c8374), + WTCP(0x5d5ddc24, 0x578f3d0d), WTCP(0x5d1f435d, 0x57d1ccf2), WTCP(0x5ce078a0, 0x581432bd), WTCP(0x5ca17c45, 0x58566e04), + WTCP(0x5c624ea4, 0x58987e63), WTCP(0x5c22f016, 0x58da6372), WTCP(0x5be360f6, 0x591c1ccc), WTCP(0x5ba3a19f, 0x595daa0d), + WTCP(0x5b63b26c, 0x599f0ad1), WTCP(0x5b2393ba, 0x59e03eb6), WTCP(0x5ae345e7, 0x5a214558), WTCP(0x5aa2c951, 0x5a621e56), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow128[] = +{ + WTCP(0x7fff6216, 0x00c90f88), WTCP(0x7ffa72d1, 0x025b26d7), WTCP(0x7ff09478, 0x03ed26e6), WTCP(0x7fe1c76b, 0x057f0035), + WTCP(0x7fce0c3e, 0x0710a345), WTCP(0x7fb563b3, 0x08a2009a), WTCP(0x7f97cebd, 0x0a3308bd), WTCP(0x7f754e80, 0x0bc3ac35), + WTCP(0x7f4de451, 0x0d53db92), WTCP(0x7f2191b4, 0x0ee38766), WTCP(0x7ef05860, 0x1072a048), WTCP(0x7eba3a39, 0x120116d5), + WTCP(0x7e7f3957, 0x138edbb1), WTCP(0x7e3f57ff, 0x151bdf86), WTCP(0x7dfa98a8, 0x16a81305), WTCP(0x7db0fdf8, 0x183366e9), + WTCP(0x7d628ac6, 0x19bdcbf3), WTCP(0x7d0f4218, 0x1b4732ef), WTCP(0x7cb72724, 0x1ccf8cb3), WTCP(0x7c5a3d50, 0x1e56ca1e), + WTCP(0x7bf88830, 0x1fdcdc1b), WTCP(0x7b920b89, 0x2161b3a0), WTCP(0x7b26cb4f, 0x22e541af), WTCP(0x7ab6cba4, 0x24677758), + WTCP(0x7a4210d8, 0x25e845b6), WTCP(0x79c89f6e, 0x27679df4), WTCP(0x794a7c12, 0x28e5714b), WTCP(0x78c7aba2, 0x2a61b101), + WTCP(0x78403329, 0x2bdc4e6f), WTCP(0x77b417df, 0x2d553afc), WTCP(0x77235f2d, 0x2ecc681e), WTCP(0x768e0ea6, 0x3041c761), + WTCP(0x75f42c0b, 0x31b54a5e), WTCP(0x7555bd4c, 0x3326e2c3), WTCP(0x74b2c884, 0x34968250), WTCP(0x740b53fb, 0x36041ad9), + WTCP(0x735f6626, 0x376f9e46), WTCP(0x72af05a7, 0x38d8fe93), WTCP(0x71fa3949, 0x3a402dd2), WTCP(0x71410805, 0x3ba51e29), + WTCP(0x708378ff, 0x3d07c1d6), WTCP(0x6fc19385, 0x3e680b2c), WTCP(0x6efb5f12, 0x3fc5ec98), WTCP(0x6e30e34a, 0x4121589b), + WTCP(0x6d6227fa, 0x427a41d0), WTCP(0x6c8f351c, 0x43d09aed), WTCP(0x6bb812d1, 0x452456bd), WTCP(0x6adcc964, 0x46756828), + WTCP(0x69fd614a, 0x47c3c22f), WTCP(0x6919e320, 0x490f57ee), WTCP(0x683257ab, 0x4a581c9e), WTCP(0x6746c7d8, 0x4b9e0390), + WTCP(0x66573cbb, 0x4ce10034), WTCP(0x6563bf92, 0x4e210617), WTCP(0x646c59bf, 0x4f5e08e3), WTCP(0x637114cc, 0x5097fc5e), + WTCP(0x6271fa69, 0x51ced46e), WTCP(0x616f146c, 0x53028518), WTCP(0x60686ccf, 0x5433027d), WTCP(0x5f5e0db3, 0x556040e2), + WTCP(0x5e50015d, 0x568a34a9), WTCP(0x5d3e5237, 0x57b0d256), WTCP(0x5c290acc, 0x58d40e8c), WTCP(0x5b1035cf, 0x59f3de12), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP KBDWindow128[] = +{ + WTCP(0x7ffffffe, 0x00016f63), WTCP(0x7ffffff1, 0x0003e382), WTCP(0x7fffffc7, 0x00078f64), WTCP(0x7fffff5d, 0x000cc323), + WTCP(0x7ffffe76, 0x0013d9ed), WTCP(0x7ffffcaa, 0x001d3a9d), WTCP(0x7ffff953, 0x0029581f), WTCP(0x7ffff372, 0x0038b1bd), + WTCP(0x7fffe98b, 0x004bd34d), WTCP(0x7fffd975, 0x00635538), WTCP(0x7fffc024, 0x007fdc64), WTCP(0x7fff995b, 0x00a219f1), + WTCP(0x7fff5f5b, 0x00cacad0), WTCP(0x7fff0a75, 0x00fab72d), WTCP(0x7ffe9091, 0x0132b1af), WTCP(0x7ffde49e, 0x01739689), + WTCP(0x7ffcf5ef, 0x01be4a63), WTCP(0x7ffbaf84, 0x0213b910), WTCP(0x7ff9f73a, 0x0274d41e), WTCP(0x7ff7acf1, 0x02e2913a), + WTCP(0x7ff4a99a, 0x035de86c), WTCP(0x7ff0be3d, 0x03e7d233), WTCP(0x7febb2f1, 0x0481457c), WTCP(0x7fe545d4, 0x052b357c), + WTCP(0x7fdd2a02, 0x05e68f77), WTCP(0x7fd30695, 0x06b4386f), WTCP(0x7fc675b4, 0x07950acb), WTCP(0x7fb703be, 0x0889d3ef), + WTCP(0x7fa42e89, 0x099351e0), WTCP(0x7f8d64d8, 0x0ab230e0), WTCP(0x7f7205f8, 0x0be70923), WTCP(0x7f516195, 0x0d325c93), + WTCP(0x7f2ab7d0, 0x0e9494ae), WTCP(0x7efd3997, 0x100e0085), WTCP(0x7ec8094a, 0x119ed2ef), WTCP(0x7e8a3ba7, 0x134720d8), + WTCP(0x7e42d906, 0x1506dfdc), WTCP(0x7df0dee4, 0x16dde50b), WTCP(0x7d9341b4, 0x18cbe3f7), WTCP(0x7d28ef02, 0x1ad06e07), + WTCP(0x7cb0cfcc, 0x1ceaf215), WTCP(0x7c29cb20, 0x1f1abc4f), WTCP(0x7b92c8eb, 0x215ef677), WTCP(0x7aeab4ec, 0x23b6a867), + WTCP(0x7a3081d0, 0x2620b8ec), WTCP(0x79632c5a, 0x289beef5), WTCP(0x7881be95, 0x2b26f30b), WTCP(0x778b5304, 0x2dc0511f), + WTCP(0x767f17c0, 0x30667aa2), WTCP(0x755c5178, 0x3317c8dd), WTCP(0x74225e50, 0x35d27f98), WTCP(0x72d0b887, 0x3894cff3), + WTCP(0x7166f8e7, 0x3b5cdb7b), WTCP(0x6fe4d8e8, 0x3e28b770), WTCP(0x6e4a3491, 0x40f6702a), WTCP(0x6c970bfc, 0x43c40caa), + WTCP(0x6acb8483, 0x468f9231), WTCP(0x68e7e994, 0x495707f5), WTCP(0x66ecad1c, 0x4c187ac7), WTCP(0x64da6797, 0x4ed200c5), + WTCP(0x62b1d7b7, 0x5181bcea), WTCP(0x6073e1ae, 0x5425e28e), WTCP(0x5e218e16, 0x56bcb8c2), WTCP(0x5bbc0875, 0x59449d76), +}; + + + + + + + + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow960[] = +{ + WTCP(0x7ffffd31, 0x001aceea), WTCP(0x7fffe6bc, 0x00506cb9), WTCP(0x7fffb9d1, 0x00860a79), WTCP(0x7fff7671, 0x00bba822), + WTCP(0x7fff1c9b, 0x00f145ab), WTCP(0x7ffeac50, 0x0126e309), WTCP(0x7ffe2590, 0x015c8033), WTCP(0x7ffd885a, 0x01921d20), + WTCP(0x7ffcd4b0, 0x01c7b9c6), WTCP(0x7ffc0a91, 0x01fd561d), WTCP(0x7ffb29fd, 0x0232f21a), WTCP(0x7ffa32f4, 0x02688db4), + WTCP(0x7ff92577, 0x029e28e2), WTCP(0x7ff80186, 0x02d3c39b), WTCP(0x7ff6c720, 0x03095dd5), WTCP(0x7ff57647, 0x033ef786), + WTCP(0x7ff40efa, 0x037490a5), WTCP(0x7ff2913a, 0x03aa292a), WTCP(0x7ff0fd07, 0x03dfc109), WTCP(0x7fef5260, 0x0415583b), + WTCP(0x7fed9148, 0x044aeeb5), WTCP(0x7febb9bd, 0x0480846e), WTCP(0x7fe9cbc0, 0x04b6195d), WTCP(0x7fe7c752, 0x04ebad79), + WTCP(0x7fe5ac72, 0x052140b7), WTCP(0x7fe37b22, 0x0556d30f), WTCP(0x7fe13361, 0x058c6478), WTCP(0x7fded530, 0x05c1f4e7), + WTCP(0x7fdc608f, 0x05f78453), WTCP(0x7fd9d57f, 0x062d12b4), WTCP(0x7fd73401, 0x06629ffe), WTCP(0x7fd47c14, 0x06982c2b), + WTCP(0x7fd1adb9, 0x06cdb72f), WTCP(0x7fcec8f1, 0x07034101), WTCP(0x7fcbcdbc, 0x0738c998), WTCP(0x7fc8bc1b, 0x076e50eb), + WTCP(0x7fc5940e, 0x07a3d6f0), WTCP(0x7fc25596, 0x07d95b9e), WTCP(0x7fbf00b3, 0x080edeec), WTCP(0x7fbb9567, 0x084460cf), + WTCP(0x7fb813b0, 0x0879e140), WTCP(0x7fb47b91, 0x08af6033), WTCP(0x7fb0cd0a, 0x08e4dda0), WTCP(0x7fad081b, 0x091a597e), + WTCP(0x7fa92cc5, 0x094fd3c3), WTCP(0x7fa53b09, 0x09854c66), WTCP(0x7fa132e8, 0x09bac35d), WTCP(0x7f9d1461, 0x09f0389f), + WTCP(0x7f98df77, 0x0a25ac23), WTCP(0x7f949429, 0x0a5b1dde), WTCP(0x7f903279, 0x0a908dc9), WTCP(0x7f8bba66, 0x0ac5fbd9), + WTCP(0x7f872bf3, 0x0afb6805), WTCP(0x7f82871f, 0x0b30d244), WTCP(0x7f7dcbec, 0x0b663a8c), WTCP(0x7f78fa5b, 0x0b9ba0d5), + WTCP(0x7f74126b, 0x0bd10513), WTCP(0x7f6f141f, 0x0c066740), WTCP(0x7f69ff76, 0x0c3bc74f), WTCP(0x7f64d473, 0x0c71253a), + WTCP(0x7f5f9315, 0x0ca680f5), WTCP(0x7f5a3b5e, 0x0cdbda79), WTCP(0x7f54cd4f, 0x0d1131ba), WTCP(0x7f4f48e8, 0x0d4686b1), + WTCP(0x7f49ae2a, 0x0d7bd954), WTCP(0x7f43fd18, 0x0db12999), WTCP(0x7f3e35b0, 0x0de67776), WTCP(0x7f3857f6, 0x0e1bc2e4), + WTCP(0x7f3263e9, 0x0e510bd8), WTCP(0x7f2c598a, 0x0e865248), WTCP(0x7f2638db, 0x0ebb962c), WTCP(0x7f2001dd, 0x0ef0d77b), + WTCP(0x7f19b491, 0x0f26162a), WTCP(0x7f1350f8, 0x0f5b5231), WTCP(0x7f0cd712, 0x0f908b86), WTCP(0x7f0646e2, 0x0fc5c220), + WTCP(0x7effa069, 0x0ffaf5f6), WTCP(0x7ef8e3a6, 0x103026fe), WTCP(0x7ef2109d, 0x1065552e), WTCP(0x7eeb274d, 0x109a807e), + WTCP(0x7ee427b9, 0x10cfa8e5), WTCP(0x7edd11e1, 0x1104ce58), WTCP(0x7ed5e5c6, 0x1139f0cf), WTCP(0x7ecea36b, 0x116f1040), + WTCP(0x7ec74acf, 0x11a42ca2), WTCP(0x7ebfdbf5, 0x11d945eb), WTCP(0x7eb856de, 0x120e5c13), WTCP(0x7eb0bb8a, 0x12436f10), + WTCP(0x7ea909fc, 0x12787ed8), WTCP(0x7ea14235, 0x12ad8b63), WTCP(0x7e996436, 0x12e294a7), WTCP(0x7e917000, 0x13179a9b), + WTCP(0x7e896595, 0x134c9d34), WTCP(0x7e8144f6, 0x13819c6c), WTCP(0x7e790e25, 0x13b69836), WTCP(0x7e70c124, 0x13eb908c), + WTCP(0x7e685df2, 0x14208563), WTCP(0x7e5fe493, 0x145576b1), WTCP(0x7e575508, 0x148a646e), WTCP(0x7e4eaf51, 0x14bf4e91), + WTCP(0x7e45f371, 0x14f43510), WTCP(0x7e3d2169, 0x152917e1), WTCP(0x7e34393b, 0x155df6fc), WTCP(0x7e2b3ae8, 0x1592d257), + WTCP(0x7e222672, 0x15c7a9ea), WTCP(0x7e18fbda, 0x15fc7daa), WTCP(0x7e0fbb22, 0x16314d8e), WTCP(0x7e06644c, 0x1666198d), + WTCP(0x7dfcf759, 0x169ae19f), WTCP(0x7df3744b, 0x16cfa5b9), WTCP(0x7de9db23, 0x170465d2), WTCP(0x7de02be4, 0x173921e2), + WTCP(0x7dd6668f, 0x176dd9de), WTCP(0x7dcc8b25, 0x17a28dbe), WTCP(0x7dc299a9, 0x17d73d79), WTCP(0x7db8921c, 0x180be904), + WTCP(0x7dae747f, 0x18409058), WTCP(0x7da440d6, 0x1875336a), WTCP(0x7d99f721, 0x18a9d231), WTCP(0x7d8f9762, 0x18de6ca5), + WTCP(0x7d85219c, 0x191302bc), WTCP(0x7d7a95cf, 0x1947946c), WTCP(0x7d6ff3fe, 0x197c21ad), WTCP(0x7d653c2b, 0x19b0aa75), + WTCP(0x7d5a6e57, 0x19e52ebb), WTCP(0x7d4f8a85, 0x1a19ae76), WTCP(0x7d4490b6, 0x1a4e299d), WTCP(0x7d3980ec, 0x1a82a026), + WTCP(0x7d2e5b2a, 0x1ab71208), WTCP(0x7d231f70, 0x1aeb7f3a), WTCP(0x7d17cdc2, 0x1b1fe7b3), WTCP(0x7d0c6621, 0x1b544b6a), + WTCP(0x7d00e88f, 0x1b88aa55), WTCP(0x7cf5550e, 0x1bbd046c), WTCP(0x7ce9aba1, 0x1bf159a4), WTCP(0x7cddec48, 0x1c25a9f6), + WTCP(0x7cd21707, 0x1c59f557), WTCP(0x7cc62bdf, 0x1c8e3bbe), WTCP(0x7cba2ad3, 0x1cc27d23), WTCP(0x7cae13e4, 0x1cf6b97c), + WTCP(0x7ca1e715, 0x1d2af0c1), WTCP(0x7c95a467, 0x1d5f22e7), WTCP(0x7c894bde, 0x1d934fe5), WTCP(0x7c7cdd7b, 0x1dc777b3), + WTCP(0x7c705940, 0x1dfb9a48), WTCP(0x7c63bf2f, 0x1e2fb79a), WTCP(0x7c570f4b, 0x1e63cfa0), WTCP(0x7c4a4996, 0x1e97e251), + WTCP(0x7c3d6e13, 0x1ecbefa4), WTCP(0x7c307cc2, 0x1efff78f), WTCP(0x7c2375a8, 0x1f33fa0a), WTCP(0x7c1658c5, 0x1f67f70b), + WTCP(0x7c09261d, 0x1f9bee8a), WTCP(0x7bfbddb1, 0x1fcfe07d), WTCP(0x7bee7f85, 0x2003ccdb), WTCP(0x7be10b99, 0x2037b39b), + WTCP(0x7bd381f1, 0x206b94b4), WTCP(0x7bc5e290, 0x209f701c), WTCP(0x7bb82d76, 0x20d345cc), WTCP(0x7baa62a8, 0x210715b8), + WTCP(0x7b9c8226, 0x213adfda), WTCP(0x7b8e8bf5, 0x216ea426), WTCP(0x7b808015, 0x21a26295), WTCP(0x7b725e8a, 0x21d61b1e), + WTCP(0x7b642756, 0x2209cdb6), WTCP(0x7b55da7c, 0x223d7a55), WTCP(0x7b4777fe, 0x227120f3), WTCP(0x7b38ffde, 0x22a4c185), + WTCP(0x7b2a721f, 0x22d85c04), WTCP(0x7b1bcec4, 0x230bf065), WTCP(0x7b0d15d0, 0x233f7ea0), WTCP(0x7afe4744, 0x237306ab), + WTCP(0x7aef6323, 0x23a6887f), WTCP(0x7ae06971, 0x23da0411), WTCP(0x7ad15a2f, 0x240d7958), WTCP(0x7ac23561, 0x2440e84d), + WTCP(0x7ab2fb09, 0x247450e4), WTCP(0x7aa3ab29, 0x24a7b317), WTCP(0x7a9445c5, 0x24db0edb), WTCP(0x7a84cade, 0x250e6427), + WTCP(0x7a753a79, 0x2541b2f3), WTCP(0x7a659496, 0x2574fb36), WTCP(0x7a55d93a, 0x25a83ce6), WTCP(0x7a460867, 0x25db77fa), + WTCP(0x7a362220, 0x260eac6a), WTCP(0x7a262668, 0x2641da2d), WTCP(0x7a161540, 0x26750139), WTCP(0x7a05eead, 0x26a82186), + WTCP(0x79f5b2b1, 0x26db3b0a), WTCP(0x79e5614f, 0x270e4dbd), WTCP(0x79d4fa89, 0x27415996), WTCP(0x79c47e63, 0x27745e8c), + WTCP(0x79b3ece0, 0x27a75c95), WTCP(0x79a34602, 0x27da53a9), WTCP(0x799289cc, 0x280d43bf), WTCP(0x7981b841, 0x28402cce), + WTCP(0x7970d165, 0x28730ecd), WTCP(0x795fd53a, 0x28a5e9b4), WTCP(0x794ec3c3, 0x28d8bd78), WTCP(0x793d9d03, 0x290b8a12), + WTCP(0x792c60fe, 0x293e4f78), WTCP(0x791b0fb5, 0x29710da1), WTCP(0x7909a92d, 0x29a3c485), WTCP(0x78f82d68, 0x29d6741b), + WTCP(0x78e69c69, 0x2a091c59), WTCP(0x78d4f634, 0x2a3bbd37), WTCP(0x78c33acb, 0x2a6e56ac), WTCP(0x78b16a32, 0x2aa0e8b0), + WTCP(0x789f846b, 0x2ad37338), WTCP(0x788d897b, 0x2b05f63d), WTCP(0x787b7963, 0x2b3871b5), WTCP(0x78695428, 0x2b6ae598), + WTCP(0x785719cc, 0x2b9d51dd), WTCP(0x7844ca53, 0x2bcfb67b), WTCP(0x783265c0, 0x2c021369), WTCP(0x781fec15, 0x2c34689e), + WTCP(0x780d5d57, 0x2c66b611), WTCP(0x77fab989, 0x2c98fbba), WTCP(0x77e800ad, 0x2ccb3990), WTCP(0x77d532c7, 0x2cfd6f8a), + WTCP(0x77c24fdb, 0x2d2f9d9f), WTCP(0x77af57eb, 0x2d61c3c7), WTCP(0x779c4afc, 0x2d93e1f8), WTCP(0x77892910, 0x2dc5f829), + WTCP(0x7775f22a, 0x2df80653), WTCP(0x7762a64f, 0x2e2a0c6c), WTCP(0x774f4581, 0x2e5c0a6b), WTCP(0x773bcfc4, 0x2e8e0048), + WTCP(0x7728451c, 0x2ebfedfa), WTCP(0x7714a58b, 0x2ef1d377), WTCP(0x7700f115, 0x2f23b0b9), WTCP(0x76ed27be, 0x2f5585b5), + WTCP(0x76d94989, 0x2f875262), WTCP(0x76c55679, 0x2fb916b9), WTCP(0x76b14e93, 0x2fead2b0), WTCP(0x769d31d9, 0x301c863f), + WTCP(0x76890050, 0x304e315d), WTCP(0x7674b9fa, 0x307fd401), WTCP(0x76605edb, 0x30b16e23), WTCP(0x764beef8, 0x30e2ffb9), + WTCP(0x76376a52, 0x311488bc), WTCP(0x7622d0ef, 0x31460922), WTCP(0x760e22d1, 0x317780e2), WTCP(0x75f95ffc, 0x31a8eff5), + WTCP(0x75e48874, 0x31da5651), WTCP(0x75cf9c3d, 0x320bb3ee), WTCP(0x75ba9b5a, 0x323d08c3), WTCP(0x75a585cf, 0x326e54c7), + WTCP(0x75905ba0, 0x329f97f3), WTCP(0x757b1ccf, 0x32d0d23c), WTCP(0x7565c962, 0x3302039b), WTCP(0x7550615c, 0x33332c06), + WTCP(0x753ae4c0, 0x33644b76), WTCP(0x75255392, 0x339561e1), WTCP(0x750fadd7, 0x33c66f40), WTCP(0x74f9f391, 0x33f77388), + WTCP(0x74e424c5, 0x34286eb3), WTCP(0x74ce4177, 0x345960b7), WTCP(0x74b849aa, 0x348a498b), WTCP(0x74a23d62, 0x34bb2927), + WTCP(0x748c1ca4, 0x34ebff83), WTCP(0x7475e772, 0x351ccc96), WTCP(0x745f9dd1, 0x354d9057), WTCP(0x74493fc5, 0x357e4abe), + WTCP(0x7432cd51, 0x35aefbc2), WTCP(0x741c467b, 0x35dfa35a), WTCP(0x7405ab45, 0x3610417f), WTCP(0x73eefbb3, 0x3640d627), + WTCP(0x73d837ca, 0x3671614b), WTCP(0x73c15f8d, 0x36a1e2e0), WTCP(0x73aa7301, 0x36d25ae0), WTCP(0x7393722a, 0x3702c942), + WTCP(0x737c5d0b, 0x37332dfd), WTCP(0x736533a9, 0x37638908), WTCP(0x734df607, 0x3793da5b), WTCP(0x7336a42b, 0x37c421ee), + WTCP(0x731f3e17, 0x37f45fb7), WTCP(0x7307c3d0, 0x382493b0), WTCP(0x72f0355a, 0x3854bdcf), WTCP(0x72d892ba, 0x3884de0b), + WTCP(0x72c0dbf3, 0x38b4f45d), WTCP(0x72a91109, 0x38e500bc), WTCP(0x72913201, 0x3915031f), WTCP(0x72793edf, 0x3944fb7e), + WTCP(0x726137a8, 0x3974e9d0), WTCP(0x72491c5e, 0x39a4ce0e), WTCP(0x7230ed07, 0x39d4a82f), WTCP(0x7218a9a7, 0x3a04782a), + WTCP(0x72005242, 0x3a343df7), WTCP(0x71e7e6dc, 0x3a63f98d), WTCP(0x71cf677a, 0x3a93aae5), WTCP(0x71b6d420, 0x3ac351f6), + WTCP(0x719e2cd2, 0x3af2eeb7), WTCP(0x71857195, 0x3b228120), WTCP(0x716ca26c, 0x3b52092a), WTCP(0x7153bf5d, 0x3b8186ca), + WTCP(0x713ac86b, 0x3bb0f9fa), WTCP(0x7121bd9c, 0x3be062b0), WTCP(0x71089ef2, 0x3c0fc0e6), WTCP(0x70ef6c74, 0x3c3f1491), + WTCP(0x70d62625, 0x3c6e5daa), WTCP(0x70bccc09, 0x3c9d9c28), WTCP(0x70a35e25, 0x3cccd004), WTCP(0x7089dc7e, 0x3cfbf935), + WTCP(0x70704718, 0x3d2b17b3), WTCP(0x70569df8, 0x3d5a2b75), WTCP(0x703ce122, 0x3d893474), WTCP(0x7023109a, 0x3db832a6), + WTCP(0x70092c65, 0x3de72604), WTCP(0x6fef3488, 0x3e160e85), WTCP(0x6fd52907, 0x3e44ec22), WTCP(0x6fbb09e7, 0x3e73bed2), + WTCP(0x6fa0d72c, 0x3ea2868c), WTCP(0x6f8690db, 0x3ed14349), WTCP(0x6f6c36f8, 0x3efff501), WTCP(0x6f51c989, 0x3f2e9bab), + WTCP(0x6f374891, 0x3f5d373e), WTCP(0x6f1cb416, 0x3f8bc7b4), WTCP(0x6f020c1c, 0x3fba4d03), WTCP(0x6ee750a8, 0x3fe8c724), + WTCP(0x6ecc81be, 0x4017360e), WTCP(0x6eb19f64, 0x404599b9), WTCP(0x6e96a99d, 0x4073f21d), WTCP(0x6e7ba06f, 0x40a23f32), + WTCP(0x6e6083de, 0x40d080f0), WTCP(0x6e4553ef, 0x40feb74f), WTCP(0x6e2a10a8, 0x412ce246), WTCP(0x6e0eba0c, 0x415b01ce), + WTCP(0x6df35020, 0x418915de), WTCP(0x6dd7d2ea, 0x41b71e6f), WTCP(0x6dbc426e, 0x41e51b77), WTCP(0x6da09eb1, 0x42130cf0), + WTCP(0x6d84e7b7, 0x4240f2d1), WTCP(0x6d691d87, 0x426ecd12), WTCP(0x6d4d4023, 0x429c9bab), WTCP(0x6d314f93, 0x42ca5e94), + WTCP(0x6d154bd9, 0x42f815c5), WTCP(0x6cf934fc, 0x4325c135), WTCP(0x6cdd0b00, 0x435360de), WTCP(0x6cc0cdea, 0x4380f4b7), + WTCP(0x6ca47dbf, 0x43ae7cb7), WTCP(0x6c881a84, 0x43dbf8d7), WTCP(0x6c6ba43e, 0x44096910), WTCP(0x6c4f1af2, 0x4436cd58), + WTCP(0x6c327ea6, 0x446425a8), WTCP(0x6c15cf5d, 0x449171f8), WTCP(0x6bf90d1d, 0x44beb240), WTCP(0x6bdc37eb, 0x44ebe679), + WTCP(0x6bbf4fcd, 0x45190e99), WTCP(0x6ba254c7, 0x45462a9a), WTCP(0x6b8546de, 0x45733a73), WTCP(0x6b682617, 0x45a03e1d), + WTCP(0x6b4af279, 0x45cd358f), WTCP(0x6b2dac06, 0x45fa20c2), WTCP(0x6b1052c6, 0x4626ffae), WTCP(0x6af2e6bc, 0x4653d24b), + WTCP(0x6ad567ef, 0x46809891), WTCP(0x6ab7d663, 0x46ad5278), WTCP(0x6a9a321d, 0x46d9fff8), WTCP(0x6a7c7b23, 0x4706a10a), + WTCP(0x6a5eb17a, 0x473335a5), WTCP(0x6a40d527, 0x475fbdc3), WTCP(0x6a22e630, 0x478c395a), WTCP(0x6a04e499, 0x47b8a864), + WTCP(0x69e6d067, 0x47e50ad8), WTCP(0x69c8a9a1, 0x481160ae), WTCP(0x69aa704c, 0x483da9e0), WTCP(0x698c246c, 0x4869e665), + WTCP(0x696dc607, 0x48961635), WTCP(0x694f5523, 0x48c23949), WTCP(0x6930d1c4, 0x48ee4f98), WTCP(0x69123bf1, 0x491a591c), + WTCP(0x68f393ae, 0x494655cc), WTCP(0x68d4d900, 0x497245a1), WTCP(0x68b60bee, 0x499e2892), WTCP(0x68972c7d, 0x49c9fe99), + WTCP(0x68783ab1, 0x49f5c7ae), WTCP(0x68593691, 0x4a2183c8), WTCP(0x683a2022, 0x4a4d32e1), WTCP(0x681af76a, 0x4a78d4f0), + WTCP(0x67fbbc6d, 0x4aa469ee), WTCP(0x67dc6f31, 0x4acff1d3), WTCP(0x67bd0fbd, 0x4afb6c98), WTCP(0x679d9e14, 0x4b26da35), + WTCP(0x677e1a3e, 0x4b523aa2), WTCP(0x675e843e, 0x4b7d8dd8), WTCP(0x673edc1c, 0x4ba8d3cf), WTCP(0x671f21dc, 0x4bd40c80), + WTCP(0x66ff5584, 0x4bff37e2), WTCP(0x66df771a, 0x4c2a55ef), WTCP(0x66bf86a3, 0x4c55669f), WTCP(0x669f8425, 0x4c8069ea), + WTCP(0x667f6fa5, 0x4cab5fc9), WTCP(0x665f4929, 0x4cd64834), WTCP(0x663f10b7, 0x4d012324), WTCP(0x661ec654, 0x4d2bf091), + WTCP(0x65fe6a06, 0x4d56b073), WTCP(0x65ddfbd3, 0x4d8162c4), WTCP(0x65bd7bc0, 0x4dac077b), WTCP(0x659ce9d4, 0x4dd69e92), + WTCP(0x657c4613, 0x4e012800), WTCP(0x655b9083, 0x4e2ba3be), WTCP(0x653ac92b, 0x4e5611c5), WTCP(0x6519f010, 0x4e80720e), + WTCP(0x64f90538, 0x4eaac490), WTCP(0x64d808a8, 0x4ed50945), WTCP(0x64b6fa66, 0x4eff4025), WTCP(0x6495da79, 0x4f296928), + WTCP(0x6474a8e5, 0x4f538448), WTCP(0x645365b2, 0x4f7d917c), WTCP(0x643210e4, 0x4fa790be), WTCP(0x6410aa81, 0x4fd18206), + WTCP(0x63ef3290, 0x4ffb654d), WTCP(0x63cda916, 0x50253a8b), WTCP(0x63ac0e19, 0x504f01ba), WTCP(0x638a619e, 0x5078bad1), + WTCP(0x6368a3ad, 0x50a265c9), WTCP(0x6346d44b, 0x50cc029c), WTCP(0x6324f37d, 0x50f59141), WTCP(0x6303014a, 0x511f11b2), + WTCP(0x62e0fdb8, 0x514883e7), WTCP(0x62bee8cc, 0x5171e7d9), WTCP(0x629cc28c, 0x519b3d80), WTCP(0x627a8b00, 0x51c484d6), + WTCP(0x6258422c, 0x51edbdd4), WTCP(0x6235e816, 0x5216e871), WTCP(0x62137cc5, 0x524004a7), WTCP(0x61f1003f, 0x5269126e), + WTCP(0x61ce7289, 0x529211c0), WTCP(0x61abd3ab, 0x52bb0295), WTCP(0x618923a9, 0x52e3e4e6), WTCP(0x61666289, 0x530cb8ac), + WTCP(0x61439053, 0x53357ddf), WTCP(0x6120ad0d, 0x535e3479), WTCP(0x60fdb8bb, 0x5386dc72), WTCP(0x60dab365, 0x53af75c3), + WTCP(0x60b79d10, 0x53d80065), WTCP(0x609475c3, 0x54007c51), WTCP(0x60713d84, 0x5428e980), WTCP(0x604df459, 0x545147eb), + WTCP(0x602a9a48, 0x5479978a), WTCP(0x60072f57, 0x54a1d857), WTCP(0x5fe3b38d, 0x54ca0a4b), WTCP(0x5fc026f0, 0x54f22d5d), + WTCP(0x5f9c8987, 0x551a4189), WTCP(0x5f78db56, 0x554246c6), WTCP(0x5f551c65, 0x556a3d0d), WTCP(0x5f314cba, 0x55922457), + WTCP(0x5f0d6c5b, 0x55b9fc9e), WTCP(0x5ee97b4f, 0x55e1c5da), WTCP(0x5ec5799b, 0x56098005), WTCP(0x5ea16747, 0x56312b17), + WTCP(0x5e7d4458, 0x5658c709), WTCP(0x5e5910d4, 0x568053d5), WTCP(0x5e34ccc3, 0x56a7d174), WTCP(0x5e10782b, 0x56cf3fde), + WTCP(0x5dec1311, 0x56f69f0d), WTCP(0x5dc79d7c, 0x571deefa), WTCP(0x5da31773, 0x57452f9d), WTCP(0x5d7e80fc, 0x576c60f1), + WTCP(0x5d59da1e, 0x579382ee), WTCP(0x5d3522de, 0x57ba958d), WTCP(0x5d105b44, 0x57e198c7), WTCP(0x5ceb8355, 0x58088c96), + WTCP(0x5cc69b19, 0x582f70f3), WTCP(0x5ca1a295, 0x585645d7), WTCP(0x5c7c99d1, 0x587d0b3b), WTCP(0x5c5780d3, 0x58a3c118), + WTCP(0x5c3257a0, 0x58ca6767), WTCP(0x5c0d1e41, 0x58f0fe23), WTCP(0x5be7d4ba, 0x59178543), WTCP(0x5bc27b14, 0x593dfcc2), + WTCP(0x5b9d1154, 0x59646498), WTCP(0x5b779780, 0x598abcbe), WTCP(0x5b520da1, 0x59b1052f), WTCP(0x5b2c73bb, 0x59d73de3), + WTCP(0x5b06c9d6, 0x59fd66d4), WTCP(0x5ae10ff9, 0x5a237ffa), WTCP(0x5abb4629, 0x5a498950), WTCP(0x5a956c6e, 0x5a6f82ce), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP KBDWindow960[] = +{ + WTCP(0x7fffff9e, 0x0009e6ac), WTCP(0x7fffff2b, 0x000e96d5), WTCP(0x7ffffea6, 0x0012987e), WTCP(0x7ffffe0e, 0x001652b6), + WTCP(0x7ffffd60, 0x0019ebce), WTCP(0x7ffffc9c, 0x001d76bf), WTCP(0x7ffffbbf, 0x0020fe79), WTCP(0x7ffffac9, 0x002489ef), + WTCP(0x7ffff9b7, 0x00281de2), WTCP(0x7ffff887, 0x002bbdbb), WTCP(0x7ffff737, 0x002f6c0d), WTCP(0x7ffff5c6, 0x00332ad8), + WTCP(0x7ffff431, 0x0036fbb9), WTCP(0x7ffff276, 0x003ae004), WTCP(0x7ffff092, 0x003ed8d8), WTCP(0x7fffee84, 0x0042e72f), + WTCP(0x7fffec48, 0x00470be3), WTCP(0x7fffe9dd, 0x004b47b8), WTCP(0x7fffe73f, 0x004f9b5f), WTCP(0x7fffe46b, 0x0054077a), + WTCP(0x7fffe15f, 0x00588ca1), WTCP(0x7fffde17, 0x005d2b61), WTCP(0x7fffda91, 0x0061e442), WTCP(0x7fffd6c9, 0x0066b7c2), + WTCP(0x7fffd2bb, 0x006ba65c), WTCP(0x7fffce65, 0x0070b087), WTCP(0x7fffc9c2, 0x0075d6b5), WTCP(0x7fffc4cf, 0x007b1955), + WTCP(0x7fffbf87, 0x008078d5), WTCP(0x7fffb9e7, 0x0085f5a0), WTCP(0x7fffb3ea, 0x008b901d), WTCP(0x7fffad8c, 0x009148b4), + WTCP(0x7fffa6c9, 0x00971fcb), WTCP(0x7fff9f9c, 0x009d15c7), WTCP(0x7fff9800, 0x00a32b0b), WTCP(0x7fff8ff0, 0x00a95ff9), + WTCP(0x7fff8767, 0x00afb4f4), WTCP(0x7fff7e5f, 0x00b62a5c), WTCP(0x7fff74d4, 0x00bcc093), WTCP(0x7fff6ac0, 0x00c377f8), + WTCP(0x7fff601c, 0x00ca50eb), WTCP(0x7fff54e3, 0x00d14bcb), WTCP(0x7fff490e, 0x00d868f7), WTCP(0x7fff3c98, 0x00dfa8ce), + WTCP(0x7fff2f79, 0x00e70bad), WTCP(0x7fff21ac, 0x00ee91f3), WTCP(0x7fff1328, 0x00f63bfe), WTCP(0x7fff03e7, 0x00fe0a2c), + WTCP(0x7ffef3e1, 0x0105fcd9), WTCP(0x7ffee310, 0x010e1462), WTCP(0x7ffed16a, 0x01165126), WTCP(0x7ffebee9, 0x011eb381), + WTCP(0x7ffeab83, 0x01273bd0), WTCP(0x7ffe9731, 0x012fea6f), WTCP(0x7ffe81ea, 0x0138bfbc), WTCP(0x7ffe6ba4, 0x0141bc12), + WTCP(0x7ffe5457, 0x014adfce), WTCP(0x7ffe3bfa, 0x01542b4d), WTCP(0x7ffe2282, 0x015d9ee9), WTCP(0x7ffe07e6, 0x01673b01), + WTCP(0x7ffdec1b, 0x0170ffee), WTCP(0x7ffdcf17, 0x017aee0e), WTCP(0x7ffdb0d0, 0x018505bc), WTCP(0x7ffd913b, 0x018f4754), + WTCP(0x7ffd704b, 0x0199b330), WTCP(0x7ffd4df7, 0x01a449ad), WTCP(0x7ffd2a31, 0x01af0b25), WTCP(0x7ffd04ef, 0x01b9f7f4), + WTCP(0x7ffcde23, 0x01c51074), WTCP(0x7ffcb5c1, 0x01d05501), WTCP(0x7ffc8bbc, 0x01dbc5f5), WTCP(0x7ffc6006, 0x01e763ab), + WTCP(0x7ffc3293, 0x01f32e7d), WTCP(0x7ffc0354, 0x01ff26c5), WTCP(0x7ffbd23b, 0x020b4cde), WTCP(0x7ffb9f3a, 0x0217a120), + WTCP(0x7ffb6a41, 0x022423e6), WTCP(0x7ffb3342, 0x0230d58a), WTCP(0x7ffafa2d, 0x023db664), WTCP(0x7ffabef2, 0x024ac6ce), + WTCP(0x7ffa8180, 0x02580720), WTCP(0x7ffa41c9, 0x026577b3), WTCP(0x7ff9ffb9, 0x027318e0), WTCP(0x7ff9bb41, 0x0280eaff), + WTCP(0x7ff9744e, 0x028eee68), WTCP(0x7ff92acf, 0x029d2371), WTCP(0x7ff8deb1, 0x02ab8a74), WTCP(0x7ff88fe2, 0x02ba23c7), + WTCP(0x7ff83e4d, 0x02c8efc0), WTCP(0x7ff7e9e1, 0x02d7eeb7), WTCP(0x7ff79288, 0x02e72101), WTCP(0x7ff7382f, 0x02f686f5), + WTCP(0x7ff6dac1, 0x030620e9), WTCP(0x7ff67a29, 0x0315ef31), WTCP(0x7ff61651, 0x0325f224), WTCP(0x7ff5af23, 0x03362a14), + WTCP(0x7ff5448a, 0x03469758), WTCP(0x7ff4d66d, 0x03573a42), WTCP(0x7ff464b7, 0x03681327), WTCP(0x7ff3ef4f, 0x0379225a), + WTCP(0x7ff3761d, 0x038a682e), WTCP(0x7ff2f90a, 0x039be4f4), WTCP(0x7ff277fb, 0x03ad9900), WTCP(0x7ff1f2d8, 0x03bf84a3), + WTCP(0x7ff16986, 0x03d1a82e), WTCP(0x7ff0dbec, 0x03e403f3), WTCP(0x7ff049ef, 0x03f69840), WTCP(0x7fefb373, 0x04096568), + WTCP(0x7fef185d, 0x041c6bb8), WTCP(0x7fee7890, 0x042fab81), WTCP(0x7fedd3f1, 0x04432510), WTCP(0x7fed2a61, 0x0456d8b4), + WTCP(0x7fec7bc4, 0x046ac6ba), WTCP(0x7febc7fb, 0x047eef70), WTCP(0x7feb0ee8, 0x04935322), WTCP(0x7fea506b, 0x04a7f21d), + WTCP(0x7fe98c65, 0x04bcccab), WTCP(0x7fe8c2b7, 0x04d1e318), WTCP(0x7fe7f33e, 0x04e735af), WTCP(0x7fe71ddb, 0x04fcc4ba), + WTCP(0x7fe6426c, 0x05129081), WTCP(0x7fe560ce, 0x0528994d), WTCP(0x7fe478df, 0x053edf68), WTCP(0x7fe38a7c, 0x05556318), + WTCP(0x7fe29581, 0x056c24a5), WTCP(0x7fe199ca, 0x05832455), WTCP(0x7fe09733, 0x059a626e), WTCP(0x7fdf8d95, 0x05b1df35), + WTCP(0x7fde7ccb, 0x05c99aef), WTCP(0x7fdd64af, 0x05e195e0), WTCP(0x7fdc451a, 0x05f9d04b), WTCP(0x7fdb1de4, 0x06124a73), + WTCP(0x7fd9eee5, 0x062b0499), WTCP(0x7fd8b7f5, 0x0643ff00), WTCP(0x7fd778ec, 0x065d39e7), WTCP(0x7fd6319e, 0x0676b58f), + WTCP(0x7fd4e1e2, 0x06907237), WTCP(0x7fd3898d, 0x06aa701d), WTCP(0x7fd22873, 0x06c4af80), WTCP(0x7fd0be6a, 0x06df309c), + WTCP(0x7fcf4b44, 0x06f9f3ad), WTCP(0x7fcdced4, 0x0714f8f0), WTCP(0x7fcc48ed, 0x0730409f), WTCP(0x7fcab960, 0x074bcaf5), + WTCP(0x7fc91fff, 0x0767982a), WTCP(0x7fc77c9a, 0x0783a877), WTCP(0x7fc5cf02, 0x079ffc14), WTCP(0x7fc41705, 0x07bc9338), + WTCP(0x7fc25474, 0x07d96e19), WTCP(0x7fc0871b, 0x07f68ced), WTCP(0x7fbeaeca, 0x0813efe7), WTCP(0x7fbccb4c, 0x0831973d), + WTCP(0x7fbadc70, 0x084f8320), WTCP(0x7fb8e200, 0x086db3c3), WTCP(0x7fb6dbc8, 0x088c2957), WTCP(0x7fb4c993, 0x08aae40c), + WTCP(0x7fb2ab2b, 0x08c9e412), WTCP(0x7fb0805a, 0x08e92997), WTCP(0x7fae48e9, 0x0908b4c9), WTCP(0x7fac04a0, 0x092885d6), + WTCP(0x7fa9b347, 0x09489ce8), WTCP(0x7fa754a6, 0x0968fa2c), WTCP(0x7fa4e884, 0x09899dcb), WTCP(0x7fa26ea6, 0x09aa87ee), + WTCP(0x7f9fe6d1, 0x09cbb8be), WTCP(0x7f9d50cc, 0x09ed3062), WTCP(0x7f9aac5a, 0x0a0eef00), WTCP(0x7f97f93f, 0x0a30f4bf), + WTCP(0x7f95373e, 0x0a5341c2), WTCP(0x7f92661b, 0x0a75d62e), WTCP(0x7f8f8596, 0x0a98b224), WTCP(0x7f8c9572, 0x0abbd5c7), + WTCP(0x7f89956f, 0x0adf4137), WTCP(0x7f86854d, 0x0b02f494), WTCP(0x7f8364cd, 0x0b26effd), WTCP(0x7f8033ae, 0x0b4b338f), + WTCP(0x7f7cf1ae, 0x0b6fbf67), WTCP(0x7f799e8b, 0x0b9493a0), WTCP(0x7f763a03, 0x0bb9b056), WTCP(0x7f72c3d2, 0x0bdf15a2), + WTCP(0x7f6f3bb5, 0x0c04c39c), WTCP(0x7f6ba168, 0x0c2aba5d), WTCP(0x7f67f4a6, 0x0c50f9fa), WTCP(0x7f643529, 0x0c77828a), + WTCP(0x7f6062ac, 0x0c9e5420), WTCP(0x7f5c7ce8, 0x0cc56ed1), WTCP(0x7f588397, 0x0cecd2ae), WTCP(0x7f547670, 0x0d147fc8), + WTCP(0x7f50552c, 0x0d3c7630), WTCP(0x7f4c1f83, 0x0d64b5f6), WTCP(0x7f47d52a, 0x0d8d3f26), WTCP(0x7f4375d9, 0x0db611ce), + WTCP(0x7f3f0144, 0x0ddf2dfa), WTCP(0x7f3a7723, 0x0e0893b4), WTCP(0x7f35d729, 0x0e324306), WTCP(0x7f31210a, 0x0e5c3bf9), + WTCP(0x7f2c547b, 0x0e867e94), WTCP(0x7f27712e, 0x0eb10add), WTCP(0x7f2276d8, 0x0edbe0da), WTCP(0x7f1d6529, 0x0f07008e), + WTCP(0x7f183bd3, 0x0f3269fc), WTCP(0x7f12fa89, 0x0f5e1d27), WTCP(0x7f0da0fb, 0x0f8a1a0e), WTCP(0x7f082ed8, 0x0fb660b1), + WTCP(0x7f02a3d2, 0x0fe2f10f), WTCP(0x7efcff98, 0x100fcb25), WTCP(0x7ef741d9, 0x103ceeee), WTCP(0x7ef16a42, 0x106a5c66), + WTCP(0x7eeb7884, 0x10981386), WTCP(0x7ee56c4a, 0x10c61447), WTCP(0x7edf4543, 0x10f45ea0), WTCP(0x7ed9031b, 0x1122f288), + WTCP(0x7ed2a57f, 0x1151cff3), WTCP(0x7ecc2c1a, 0x1180f6d5), WTCP(0x7ec59699, 0x11b06720), WTCP(0x7ebee4a6, 0x11e020c8), + WTCP(0x7eb815ed, 0x121023ba), WTCP(0x7eb12a18, 0x12406fe8), WTCP(0x7eaa20d1, 0x1271053e), WTCP(0x7ea2f9c2, 0x12a1e3a9), + WTCP(0x7e9bb494, 0x12d30b15), WTCP(0x7e9450f0, 0x13047b6c), WTCP(0x7e8cce7f, 0x13363497), WTCP(0x7e852ce9, 0x1368367f), + WTCP(0x7e7d6bd6, 0x139a8109), WTCP(0x7e758aee, 0x13cd141b), WTCP(0x7e6d89d9, 0x13ffef99), WTCP(0x7e65683d, 0x14331368), + WTCP(0x7e5d25c1, 0x14667f67), WTCP(0x7e54c20b, 0x149a3379), WTCP(0x7e4c3cc3, 0x14ce2f7c), WTCP(0x7e43958e, 0x1502734f), + WTCP(0x7e3acc11, 0x1536fece), WTCP(0x7e31dff2, 0x156bd1d6), WTCP(0x7e28d0d7, 0x15a0ec41), WTCP(0x7e1f9e63, 0x15d64de9), + WTCP(0x7e16483d, 0x160bf6a5), WTCP(0x7e0cce08, 0x1641e64c), WTCP(0x7e032f6a, 0x16781cb4), WTCP(0x7df96c05, 0x16ae99b2), + WTCP(0x7def837e, 0x16e55d18), WTCP(0x7de57579, 0x171c66ba), WTCP(0x7ddb419a, 0x1753b667), WTCP(0x7dd0e784, 0x178b4bef), + WTCP(0x7dc666d9, 0x17c32721), WTCP(0x7dbbbf3e, 0x17fb47ca), WTCP(0x7db0f056, 0x1833adb5), WTCP(0x7da5f9c3, 0x186c58ae), + WTCP(0x7d9adb29, 0x18a5487d), WTCP(0x7d8f9429, 0x18de7cec), WTCP(0x7d842467, 0x1917f5c1), WTCP(0x7d788b86, 0x1951b2c2), + WTCP(0x7d6cc927, 0x198bb3b4), WTCP(0x7d60dced, 0x19c5f85a), WTCP(0x7d54c67c, 0x1a008077), WTCP(0x7d488574, 0x1a3b4bcb), + WTCP(0x7d3c1979, 0x1a765a17), WTCP(0x7d2f822d, 0x1ab1ab18), WTCP(0x7d22bf32, 0x1aed3e8d), WTCP(0x7d15d02b, 0x1b291432), + WTCP(0x7d08b4ba, 0x1b652bc1), WTCP(0x7cfb6c82, 0x1ba184f5), WTCP(0x7cedf725, 0x1bde1f86), WTCP(0x7ce05445, 0x1c1afb2c), + WTCP(0x7cd28386, 0x1c58179c), WTCP(0x7cc48489, 0x1c95748d), WTCP(0x7cb656f3, 0x1cd311b1), WTCP(0x7ca7fa65, 0x1d10eebd), + WTCP(0x7c996e83, 0x1d4f0b60), WTCP(0x7c8ab2f0, 0x1d8d674c), WTCP(0x7c7bc74f, 0x1dcc0230), WTCP(0x7c6cab44, 0x1e0adbbb), + WTCP(0x7c5d5e71, 0x1e49f398), WTCP(0x7c4de07c, 0x1e894973), WTCP(0x7c3e3108, 0x1ec8dcf8), WTCP(0x7c2e4fb9, 0x1f08add0), + WTCP(0x7c1e3c34, 0x1f48bba3), WTCP(0x7c0df61d, 0x1f890618), WTCP(0x7bfd7d18, 0x1fc98cd6), WTCP(0x7becd0cc, 0x200a4f80), + WTCP(0x7bdbf0dd, 0x204b4dbc), WTCP(0x7bcadcf1, 0x208c872c), WTCP(0x7bb994ae, 0x20cdfb71), WTCP(0x7ba817b9, 0x210faa2c), + WTCP(0x7b9665bb, 0x215192fc), WTCP(0x7b847e58, 0x2193b57f), WTCP(0x7b726139, 0x21d61153), WTCP(0x7b600e05, 0x2218a614), + WTCP(0x7b4d8463, 0x225b735d), WTCP(0x7b3ac3fc, 0x229e78c7), WTCP(0x7b27cc79, 0x22e1b5eb), WTCP(0x7b149d82, 0x23252a62), + WTCP(0x7b0136c1, 0x2368d5c2), WTCP(0x7aed97df, 0x23acb7a0), WTCP(0x7ad9c087, 0x23f0cf92), WTCP(0x7ac5b063, 0x24351d2a), + WTCP(0x7ab1671e, 0x24799ffc), WTCP(0x7a9ce464, 0x24be5799), WTCP(0x7a8827e1, 0x25034391), WTCP(0x7a733142, 0x25486375), + WTCP(0x7a5e0033, 0x258db6d2), WTCP(0x7a489461, 0x25d33d35), WTCP(0x7a32ed7c, 0x2618f62c), WTCP(0x7a1d0b31, 0x265ee143), + WTCP(0x7a06ed2f, 0x26a4fe02), WTCP(0x79f09327, 0x26eb4bf5), WTCP(0x79d9fcc8, 0x2731caa3), WTCP(0x79c329c2, 0x27787995), + WTCP(0x79ac19c9, 0x27bf5850), WTCP(0x7994cc8d, 0x2806665c), WTCP(0x797d41c1, 0x284da33c), WTCP(0x79657918, 0x28950e74), + WTCP(0x794d7247, 0x28dca788), WTCP(0x79352d01, 0x29246dfa), WTCP(0x791ca8fc, 0x296c614a), WTCP(0x7903e5ee, 0x29b480f9), + WTCP(0x78eae38d, 0x29fccc87), WTCP(0x78d1a191, 0x2a454372), WTCP(0x78b81fb1, 0x2a8de537), WTCP(0x789e5da6, 0x2ad6b155), + WTCP(0x78845b29, 0x2b1fa745), WTCP(0x786a17f5, 0x2b68c684), WTCP(0x784f93c4, 0x2bb20e8c), WTCP(0x7834ce53, 0x2bfb7ed7), + WTCP(0x7819c75c, 0x2c4516dc), WTCP(0x77fe7e9e, 0x2c8ed615), WTCP(0x77e2f3d7, 0x2cd8bbf7), WTCP(0x77c726c5, 0x2d22c7fa), + WTCP(0x77ab1728, 0x2d6cf993), WTCP(0x778ec4c0, 0x2db75037), WTCP(0x77722f4e, 0x2e01cb59), WTCP(0x77555695, 0x2e4c6a6d), + WTCP(0x77383a58, 0x2e972ce6), WTCP(0x771ada5a, 0x2ee21235), WTCP(0x76fd3660, 0x2f2d19cc), WTCP(0x76df4e30, 0x2f78431a), + WTCP(0x76c12190, 0x2fc38d91), WTCP(0x76a2b047, 0x300ef89d), WTCP(0x7683fa1e, 0x305a83af), WTCP(0x7664fede, 0x30a62e34), + WTCP(0x7645be51, 0x30f1f798), WTCP(0x76263842, 0x313ddf49), WTCP(0x76066c7e, 0x3189e4b1), WTCP(0x75e65ad1, 0x31d6073d), + WTCP(0x75c60309, 0x32224657), WTCP(0x75a564f6, 0x326ea168), WTCP(0x75848067, 0x32bb17da), WTCP(0x7563552d, 0x3307a917), + WTCP(0x7541e31a, 0x33545486), WTCP(0x75202a02, 0x33a1198e), WTCP(0x74fe29b8, 0x33edf798), WTCP(0x74dbe211, 0x343aee09), + WTCP(0x74b952e3, 0x3487fc48), WTCP(0x74967c06, 0x34d521bb), WTCP(0x74735d51, 0x35225dc7), WTCP(0x744ff69f, 0x356fafcf), + WTCP(0x742c47c9, 0x35bd173a), WTCP(0x740850ab, 0x360a9369), WTCP(0x73e41121, 0x365823c1), WTCP(0x73bf8909, 0x36a5c7a4), + WTCP(0x739ab842, 0x36f37e75), WTCP(0x73759eab, 0x37414796), WTCP(0x73503c26, 0x378f2268), WTCP(0x732a9095, 0x37dd0e4c), + WTCP(0x73049bda, 0x382b0aa4), WTCP(0x72de5ddb, 0x387916d0), WTCP(0x72b7d67d, 0x38c73230), WTCP(0x729105a6, 0x39155c24), + WTCP(0x7269eb3f, 0x3963940c), WTCP(0x72428730, 0x39b1d946), WTCP(0x721ad964, 0x3a002b31), WTCP(0x71f2e1c5, 0x3a4e892c), + WTCP(0x71caa042, 0x3a9cf296), WTCP(0x71a214c7, 0x3aeb66cc), WTCP(0x71793f43, 0x3b39e52c), WTCP(0x71501fa6, 0x3b886d14), + WTCP(0x7126b5e3, 0x3bd6fde1), WTCP(0x70fd01eb, 0x3c2596f1), WTCP(0x70d303b2, 0x3c74379f), WTCP(0x70a8bb2e, 0x3cc2df49), + WTCP(0x707e2855, 0x3d118d4c), WTCP(0x70534b1e, 0x3d604103), WTCP(0x70282381, 0x3daef9cc), WTCP(0x6ffcb17a, 0x3dfdb702), + WTCP(0x6fd0f504, 0x3e4c7800), WTCP(0x6fa4ee1a, 0x3e9b3c25), WTCP(0x6f789cbb, 0x3eea02ca), WTCP(0x6f4c00e5, 0x3f38cb4b), + WTCP(0x6f1f1a9a, 0x3f879505), WTCP(0x6ef1e9da, 0x3fd65f53), WTCP(0x6ec46ea9, 0x40252990), WTCP(0x6e96a90b, 0x4073f318), + WTCP(0x6e689905, 0x40c2bb46), WTCP(0x6e3a3e9d, 0x41118176), WTCP(0x6e0b99dd, 0x41604504), WTCP(0x6ddcaacc, 0x41af054a), + WTCP(0x6dad7177, 0x41fdc1a5), WTCP(0x6d7dede8, 0x424c7970), WTCP(0x6d4e202e, 0x429b2c06), WTCP(0x6d1e0855, 0x42e9d8c4), + WTCP(0x6ceda66f, 0x43387f05), WTCP(0x6cbcfa8d, 0x43871e26), WTCP(0x6c8c04c0, 0x43d5b581), WTCP(0x6c5ac51d, 0x44244474), + WTCP(0x6c293bb8, 0x4472ca5a), WTCP(0x6bf768a8, 0x44c14690), WTCP(0x6bc54c06, 0x450fb873), WTCP(0x6b92e5e9, 0x455e1f5f), + WTCP(0x6b60366c, 0x45ac7ab2), WTCP(0x6b2d3dab, 0x45fac9c8), WTCP(0x6af9fbc2, 0x46490bff), WTCP(0x6ac670d1, 0x469740b5), + WTCP(0x6a929cf6, 0x46e56747), WTCP(0x6a5e8053, 0x47337f13), WTCP(0x6a2a1b0a, 0x47818779), WTCP(0x69f56d3e, 0x47cf7fd6), + WTCP(0x69c07715, 0x481d678a), WTCP(0x698b38b4, 0x486b3df3), WTCP(0x6955b243, 0x48b90272), WTCP(0x691fe3ec, 0x4906b466), + WTCP(0x68e9cdd8, 0x49545330), WTCP(0x68b37033, 0x49a1de30), WTCP(0x687ccb29, 0x49ef54c8), WTCP(0x6845dee9, 0x4a3cb657), + WTCP(0x680eaba3, 0x4a8a0242), WTCP(0x67d73187, 0x4ad737e9), WTCP(0x679f70c7, 0x4b2456af), WTCP(0x67676997, 0x4b715df7), + WTCP(0x672f1c2b, 0x4bbe4d25), WTCP(0x66f688ba, 0x4c0b239c), WTCP(0x66bdaf7b, 0x4c57e0c2), WTCP(0x668490a6, 0x4ca483fa), + WTCP(0x664b2c76, 0x4cf10cac), WTCP(0x66118326, 0x4d3d7a3b), WTCP(0x65d794f3, 0x4d89cc0f), WTCP(0x659d621a, 0x4dd6018f), + WTCP(0x6562eada, 0x4e221a22), WTCP(0x65282f74, 0x4e6e1530), WTCP(0x64ed302b, 0x4eb9f222), WTCP(0x64b1ed40, 0x4f05b061), + WTCP(0x647666f8, 0x4f514f57), WTCP(0x643a9d99, 0x4f9cce6f), WTCP(0x63fe916a, 0x4fe82d13), WTCP(0x63c242b2, 0x50336aaf), + WTCP(0x6385b1bc, 0x507e86b0), WTCP(0x6348ded1, 0x50c98082), WTCP(0x630bca3f, 0x51145793), WTCP(0x62ce7451, 0x515f0b51), + WTCP(0x6290dd57, 0x51a99b2b), WTCP(0x625305a0, 0x51f40692), WTCP(0x6214ed7d, 0x523e4cf5), WTCP(0x61d69541, 0x52886dc5), + WTCP(0x6197fd3e, 0x52d26875), WTCP(0x615925c9, 0x531c3c77), WTCP(0x611a0f39, 0x5365e93e), WTCP(0x60dab9e3, 0x53af6e3e), + WTCP(0x609b2621, 0x53f8caed), WTCP(0x605b544c, 0x5441fec0), WTCP(0x601b44bf, 0x548b092e), WTCP(0x5fdaf7d5, 0x54d3e9ae), + WTCP(0x5f9a6deb, 0x551c9fb7), WTCP(0x5f59a761, 0x55652ac3), WTCP(0x5f18a494, 0x55ad8a4d), WTCP(0x5ed765e6, 0x55f5bdcd), + WTCP(0x5e95ebb8, 0x563dc4c1), WTCP(0x5e54366d, 0x56859ea3), WTCP(0x5e12466a, 0x56cd4af3), WTCP(0x5dd01c13, 0x5714c92d), + WTCP(0x5d8db7cf, 0x575c18d0), WTCP(0x5d4b1a05, 0x57a3395e), WTCP(0x5d08431e, 0x57ea2a56), WTCP(0x5cc53384, 0x5830eb3a), + WTCP(0x5c81eba0, 0x58777b8e), WTCP(0x5c3e6bdf, 0x58bddad5), WTCP(0x5bfab4af, 0x59040893), WTCP(0x5bb6c67c, 0x594a044f), + WTCP(0x5b72a1b6, 0x598fcd8e), WTCP(0x5b2e46ce, 0x59d563d9), WTCP(0x5ae9b634, 0x5a1ac6b8), WTCP(0x5aa4f05a, 0x5a5ff5b5), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow120[] = +{ + WTCP(0x7fff4c54, 0x00d676eb), WTCP(0x7ff9af04, 0x02835b5a), WTCP(0x7fee74a2, 0x0430238f), WTCP(0x7fdd9dad, 0x05dcbcbe), + WTCP(0x7fc72ae2, 0x07891418), WTCP(0x7fab1d3d, 0x093516d4), WTCP(0x7f8975f9, 0x0ae0b22c), WTCP(0x7f62368f, 0x0c8bd35e), + WTCP(0x7f3560b9, 0x0e3667ad), WTCP(0x7f02f66f, 0x0fe05c64), WTCP(0x7ecaf9e5, 0x11899ed3), WTCP(0x7e8d6d91, 0x13321c53), + WTCP(0x7e4a5426, 0x14d9c245), WTCP(0x7e01b096, 0x16807e15), WTCP(0x7db3860f, 0x18263d36), WTCP(0x7d5fd801, 0x19caed29), + WTCP(0x7d06aa16, 0x1b6e7b7a), WTCP(0x7ca80038, 0x1d10d5c2), WTCP(0x7c43de8e, 0x1eb1e9a7), WTCP(0x7bda497d, 0x2051a4dd), + WTCP(0x7b6b45a5, 0x21eff528), WTCP(0x7af6d7e6, 0x238cc85d), WTCP(0x7a7d055b, 0x25280c5e), WTCP(0x79fdd35c, 0x26c1af22), + WTCP(0x7979477d, 0x28599eb0), WTCP(0x78ef678f, 0x29efc925), WTCP(0x7860399e, 0x2b841caf), WTCP(0x77cbc3f2, 0x2d168792), + WTCP(0x77320d0d, 0x2ea6f827), WTCP(0x76931bae, 0x30355cdd), WTCP(0x75eef6ce, 0x31c1a43b), WTCP(0x7545a5a0, 0x334bbcde), + WTCP(0x74972f92, 0x34d3957e), WTCP(0x73e39c49, 0x36591cea), WTCP(0x732af3a7, 0x37dc420c), WTCP(0x726d3dc6, 0x395cf3e9), + WTCP(0x71aa82f7, 0x3adb21a1), WTCP(0x70e2cbc6, 0x3c56ba70), WTCP(0x701620f5, 0x3dcfadb0), WTCP(0x6f448b7e, 0x3f45ead8), + WTCP(0x6e6e1492, 0x40b9617d), WTCP(0x6d92c59b, 0x422a0154), WTCP(0x6cb2a837, 0x4397ba32), WTCP(0x6bcdc639, 0x45027c0c), + WTCP(0x6ae429ae, 0x466a36f9), WTCP(0x69f5dcd3, 0x47cedb31), WTCP(0x6902ea1d, 0x4930590f), WTCP(0x680b5c33, 0x4a8ea111), + WTCP(0x670f3df3, 0x4be9a3db), WTCP(0x660e9a6a, 0x4d415234), WTCP(0x65097cdb, 0x4e959d08), WTCP(0x63fff0ba, 0x4fe6756a), + WTCP(0x62f201ac, 0x5133cc94), WTCP(0x61dfbb8a, 0x527d93e6), WTCP(0x60c92a5a, 0x53c3bcea), WTCP(0x5fae5a55, 0x55063951), + WTCP(0x5e8f57e2, 0x5644faf4), WTCP(0x5d6c2f99, 0x577ff3da), WTCP(0x5c44ee40, 0x58b71632), WTCP(0x5b19a0c8, 0x59ea5454), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP KBDWindow120[] = +{ + WTCP(0x7ffffffe, 0x00017b6f), WTCP(0x7fffffef, 0x00042d2f), WTCP(0x7fffffbb, 0x000849d0), WTCP(0x7fffff36, 0x000e3494), + WTCP(0x7ffffe0c, 0x00165efd), WTCP(0x7ffffbac, 0x002149be), WTCP(0x7ffff72e, 0x002f854c), WTCP(0x7fffef24, 0x0041b235), + WTCP(0x7fffe167, 0x0058814f), WTCP(0x7fffcacd, 0x0074b3af), WTCP(0x7fffa6d0, 0x00971a67), WTCP(0x7fff6f1e, 0x00c0960e), + WTCP(0x7fff1b12, 0x00f21602), WTCP(0x7ffe9f0b, 0x012c9775), WTCP(0x7ffdebb2, 0x01712428), WTCP(0x7ffced1b, 0x01c0d0f7), + WTCP(0x7ffb89c2, 0x021cbc12), WTCP(0x7ff9a17c, 0x02860b05), WTCP(0x7ff70c39, 0x02fde875), WTCP(0x7ff398bc, 0x038581b3), + WTCP(0x7fef0b3b, 0x041e040c), WTCP(0x7fe91bf3, 0x04c899f4), WTCP(0x7fe175ba, 0x05866803), WTCP(0x7fd7b493, 0x065889d5), + WTCP(0x7fcb6459, 0x07400ed4), WTCP(0x7fbbff82, 0x083df6e9), WTCP(0x7fa8ee09, 0x09532f37), WTCP(0x7f91849a, 0x0a808ed1), + WTCP(0x7f7503f2, 0x0bc6d381), WTCP(0x7f52989a, 0x0d269eb0), WTCP(0x7f295af4, 0x0ea07270), WTCP(0x7ef84fb6, 0x1034aeb6), + WTCP(0x7ebe68c5, 0x11e38ed2), WTCP(0x7e7a8686, 0x13ad2733), WTCP(0x7e2b79a3, 0x1591636d), WTCP(0x7dd0053c, 0x179004a7), + WTCP(0x7d66e18b, 0x19a8a05f), WTCP(0x7ceebef0, 0x1bda9fa2), WTCP(0x7c664953, 0x1e253ea1), WTCP(0x7bcc2be8, 0x20878cce), + WTCP(0x7b1f1526, 0x23006d5d), WTCP(0x7a5dbb01, 0x258e9848), WTCP(0x7986df3e, 0x28309bc6), WTCP(0x789953e0, 0x2ae4de3e), + WTCP(0x7793ff88, 0x2da9a0a8), WTCP(0x7675e1cc, 0x307d0163), WTCP(0x753e1763, 0x335cff72), WTCP(0x73ebde10, 0x36477e1f), + WTCP(0x727e984e, 0x393a48f1), WTCP(0x70f5d09b, 0x3c3317f9), WTCP(0x6f513c60, 0x3f2f945c), WTCP(0x6d90be61, 0x422d5d18), + WTCP(0x6bb468b1, 0x452a0bf3), WTCP(0x69bc7e1e, 0x48233a81), WTCP(0x67a97317, 0x4b16873e), WTCP(0x657bedfa, 0x4e019a9d), + WTCP(0x6334c6d2, 0x50e22c0b), WTCP(0x60d50689, 0x53b606cb), WTCP(0x5e5de588, 0x567b0ea7), WTCP(0x5bd0c9c6, 0x592f4460), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow512[] = +{ + WTCP(0x7ffff621, 0x003243f5), WTCP(0x7fffa72c, 0x0096cbc1), WTCP(0x7fff0943, 0x00fb5330), WTCP(0x7ffe1c65, 0x015fda03), + WTCP(0x7ffce093, 0x01c45ffe), WTCP(0x7ffb55ce, 0x0228e4e2), WTCP(0x7ff97c18, 0x028d6870), WTCP(0x7ff75370, 0x02f1ea6c), + WTCP(0x7ff4dbd9, 0x03566a96), WTCP(0x7ff21553, 0x03bae8b2), WTCP(0x7feeffe1, 0x041f6480), WTCP(0x7feb9b85, 0x0483ddc3), + WTCP(0x7fe7e841, 0x04e8543e), WTCP(0x7fe3e616, 0x054cc7b1), WTCP(0x7fdf9508, 0x05b137df), WTCP(0x7fdaf519, 0x0615a48b), + WTCP(0x7fd6064c, 0x067a0d76), WTCP(0x7fd0c8a3, 0x06de7262), WTCP(0x7fcb3c23, 0x0742d311), WTCP(0x7fc560cf, 0x07a72f45), + WTCP(0x7fbf36aa, 0x080b86c2), WTCP(0x7fb8bdb8, 0x086fd947), WTCP(0x7fb1f5fc, 0x08d42699), WTCP(0x7faadf7c, 0x09386e78), + WTCP(0x7fa37a3c, 0x099cb0a7), WTCP(0x7f9bc640, 0x0a00ece8), WTCP(0x7f93c38c, 0x0a6522fe), WTCP(0x7f8b7227, 0x0ac952aa), + WTCP(0x7f82d214, 0x0b2d7baf), WTCP(0x7f79e35a, 0x0b919dcf), WTCP(0x7f70a5fe, 0x0bf5b8cb), WTCP(0x7f671a05, 0x0c59cc68), + WTCP(0x7f5d3f75, 0x0cbdd865), WTCP(0x7f531655, 0x0d21dc87), WTCP(0x7f489eaa, 0x0d85d88f), WTCP(0x7f3dd87c, 0x0de9cc40), + WTCP(0x7f32c3d1, 0x0e4db75b), WTCP(0x7f2760af, 0x0eb199a4), WTCP(0x7f1baf1e, 0x0f1572dc), WTCP(0x7f0faf25, 0x0f7942c7), + WTCP(0x7f0360cb, 0x0fdd0926), WTCP(0x7ef6c418, 0x1040c5bb), WTCP(0x7ee9d914, 0x10a4784b), WTCP(0x7edc9fc6, 0x11082096), + WTCP(0x7ecf1837, 0x116bbe60), WTCP(0x7ec14270, 0x11cf516a), WTCP(0x7eb31e78, 0x1232d979), WTCP(0x7ea4ac58, 0x1296564d), + WTCP(0x7e95ec1a, 0x12f9c7aa), WTCP(0x7e86ddc6, 0x135d2d53), WTCP(0x7e778166, 0x13c0870a), WTCP(0x7e67d703, 0x1423d492), + WTCP(0x7e57dea7, 0x148715ae), WTCP(0x7e47985b, 0x14ea4a1f), WTCP(0x7e37042a, 0x154d71aa), WTCP(0x7e26221f, 0x15b08c12), + WTCP(0x7e14f242, 0x16139918), WTCP(0x7e0374a0, 0x1676987f), WTCP(0x7df1a942, 0x16d98a0c), WTCP(0x7ddf9034, 0x173c6d80), + WTCP(0x7dcd2981, 0x179f429f), WTCP(0x7dba7534, 0x1802092c), WTCP(0x7da77359, 0x1864c0ea), WTCP(0x7d9423fc, 0x18c7699b), + WTCP(0x7d808728, 0x192a0304), WTCP(0x7d6c9ce9, 0x198c8ce7), WTCP(0x7d58654d, 0x19ef0707), WTCP(0x7d43e05e, 0x1a517128), + WTCP(0x7d2f0e2b, 0x1ab3cb0d), WTCP(0x7d19eebf, 0x1b161479), WTCP(0x7d048228, 0x1b784d30), WTCP(0x7ceec873, 0x1bda74f6), + WTCP(0x7cd8c1ae, 0x1c3c8b8c), WTCP(0x7cc26de5, 0x1c9e90b8), WTCP(0x7cabcd28, 0x1d00843d), WTCP(0x7c94df83, 0x1d6265dd), + WTCP(0x7c7da505, 0x1dc4355e), WTCP(0x7c661dbc, 0x1e25f282), WTCP(0x7c4e49b7, 0x1e879d0d), WTCP(0x7c362904, 0x1ee934c3), + WTCP(0x7c1dbbb3, 0x1f4ab968), WTCP(0x7c0501d2, 0x1fac2abf), WTCP(0x7bebfb70, 0x200d888d), WTCP(0x7bd2a89e, 0x206ed295), + WTCP(0x7bb9096b, 0x20d0089c), WTCP(0x7b9f1de6, 0x21312a65), WTCP(0x7b84e61f, 0x219237b5), WTCP(0x7b6a6227, 0x21f3304f), + WTCP(0x7b4f920e, 0x225413f8), WTCP(0x7b3475e5, 0x22b4e274), WTCP(0x7b190dbc, 0x23159b88), WTCP(0x7afd59a4, 0x23763ef7), + WTCP(0x7ae159ae, 0x23d6cc87), WTCP(0x7ac50dec, 0x243743fa), WTCP(0x7aa8766f, 0x2497a517), WTCP(0x7a8b9348, 0x24f7efa2), + WTCP(0x7a6e648a, 0x2558235f), WTCP(0x7a50ea47, 0x25b84012), WTCP(0x7a332490, 0x26184581), WTCP(0x7a151378, 0x26783370), + WTCP(0x79f6b711, 0x26d809a5), WTCP(0x79d80f6f, 0x2737c7e3), WTCP(0x79b91ca4, 0x27976df1), WTCP(0x7999dec4, 0x27f6fb92), + WTCP(0x797a55e0, 0x2856708d), WTCP(0x795a820e, 0x28b5cca5), WTCP(0x793a6361, 0x29150fa1), WTCP(0x7919f9ec, 0x29743946), + WTCP(0x78f945c3, 0x29d34958), WTCP(0x78d846fb, 0x2a323f9e), WTCP(0x78b6fda8, 0x2a911bdc), WTCP(0x789569df, 0x2aefddd8), + WTCP(0x78738bb3, 0x2b4e8558), WTCP(0x7851633b, 0x2bad1221), WTCP(0x782ef08b, 0x2c0b83fa), WTCP(0x780c33b8, 0x2c69daa6), + WTCP(0x77e92cd9, 0x2cc815ee), WTCP(0x77c5dc01, 0x2d263596), WTCP(0x77a24148, 0x2d843964), WTCP(0x777e5cc3, 0x2de2211e), + WTCP(0x775a2e89, 0x2e3fec8b), WTCP(0x7735b6af, 0x2e9d9b70), WTCP(0x7710f54c, 0x2efb2d95), WTCP(0x76ebea77, 0x2f58a2be), + WTCP(0x76c69647, 0x2fb5fab2), WTCP(0x76a0f8d2, 0x30133539), WTCP(0x767b1231, 0x30705217), WTCP(0x7654e279, 0x30cd5115), + WTCP(0x762e69c4, 0x312a31f8), WTCP(0x7607a828, 0x3186f487), WTCP(0x75e09dbd, 0x31e39889), WTCP(0x75b94a9c, 0x32401dc6), + WTCP(0x7591aedd, 0x329c8402), WTCP(0x7569ca99, 0x32f8cb07), WTCP(0x75419de7, 0x3354f29b), WTCP(0x751928e0, 0x33b0fa84), + WTCP(0x74f06b9e, 0x340ce28b), WTCP(0x74c7663a, 0x3468aa76), WTCP(0x749e18cd, 0x34c4520d), WTCP(0x74748371, 0x351fd918), + WTCP(0x744aa63f, 0x357b3f5d), WTCP(0x74208150, 0x35d684a6), WTCP(0x73f614c0, 0x3631a8b8), WTCP(0x73cb60a8, 0x368cab5c), + WTCP(0x73a06522, 0x36e78c5b), WTCP(0x73752249, 0x37424b7b), WTCP(0x73499838, 0x379ce885), WTCP(0x731dc70a, 0x37f76341), + WTCP(0x72f1aed9, 0x3851bb77), WTCP(0x72c54fc1, 0x38abf0ef), WTCP(0x7298a9dd, 0x39060373), WTCP(0x726bbd48, 0x395ff2c9), + WTCP(0x723e8a20, 0x39b9bebc), WTCP(0x7211107e, 0x3a136712), WTCP(0x71e35080, 0x3a6ceb96), WTCP(0x71b54a41, 0x3ac64c0f), + WTCP(0x7186fdde, 0x3b1f8848), WTCP(0x71586b74, 0x3b78a007), WTCP(0x7129931f, 0x3bd19318), WTCP(0x70fa74fc, 0x3c2a6142), + WTCP(0x70cb1128, 0x3c830a50), WTCP(0x709b67c0, 0x3cdb8e09), WTCP(0x706b78e3, 0x3d33ec39), WTCP(0x703b44ad, 0x3d8c24a8), + WTCP(0x700acb3c, 0x3de4371f), WTCP(0x6fda0cae, 0x3e3c2369), WTCP(0x6fa90921, 0x3e93e950), WTCP(0x6f77c0b3, 0x3eeb889c), + WTCP(0x6f463383, 0x3f430119), WTCP(0x6f1461b0, 0x3f9a5290), WTCP(0x6ee24b57, 0x3ff17cca), WTCP(0x6eaff099, 0x40487f94), + WTCP(0x6e7d5193, 0x409f5ab6), WTCP(0x6e4a6e66, 0x40f60dfb), WTCP(0x6e174730, 0x414c992f), WTCP(0x6de3dc11, 0x41a2fc1a), + WTCP(0x6db02d29, 0x41f93689), WTCP(0x6d7c3a98, 0x424f4845), WTCP(0x6d48047e, 0x42a5311b), WTCP(0x6d138afb, 0x42faf0d4), + WTCP(0x6cdece2f, 0x4350873c), WTCP(0x6ca9ce3b, 0x43a5f41e), WTCP(0x6c748b3f, 0x43fb3746), WTCP(0x6c3f055d, 0x4450507e), + WTCP(0x6c093cb6, 0x44a53f93), WTCP(0x6bd3316a, 0x44fa0450), WTCP(0x6b9ce39b, 0x454e9e80), WTCP(0x6b66536b, 0x45a30df0), + WTCP(0x6b2f80fb, 0x45f7526b), WTCP(0x6af86c6c, 0x464b6bbe), WTCP(0x6ac115e2, 0x469f59b4), WTCP(0x6a897d7d, 0x46f31c1a), + WTCP(0x6a51a361, 0x4746b2bc), WTCP(0x6a1987b0, 0x479a1d67), WTCP(0x69e12a8c, 0x47ed5be6), WTCP(0x69a88c19, 0x48406e08), + WTCP(0x696fac78, 0x48935397), WTCP(0x69368bce, 0x48e60c62), WTCP(0x68fd2a3d, 0x49389836), WTCP(0x68c387e9, 0x498af6df), + WTCP(0x6889a4f6, 0x49dd282a), WTCP(0x684f8186, 0x4a2f2be6), WTCP(0x68151dbe, 0x4a8101de), WTCP(0x67da79c3, 0x4ad2a9e2), + WTCP(0x679f95b7, 0x4b2423be), WTCP(0x676471c0, 0x4b756f40), WTCP(0x67290e02, 0x4bc68c36), WTCP(0x66ed6aa1, 0x4c177a6e), + WTCP(0x66b187c3, 0x4c6839b7), WTCP(0x6675658c, 0x4cb8c9dd), WTCP(0x66390422, 0x4d092ab0), WTCP(0x65fc63a9, 0x4d595bfe), + WTCP(0x65bf8447, 0x4da95d96), WTCP(0x65826622, 0x4df92f46), WTCP(0x6545095f, 0x4e48d0dd), WTCP(0x65076e25, 0x4e984229), + WTCP(0x64c99498, 0x4ee782fb), WTCP(0x648b7ce0, 0x4f369320), WTCP(0x644d2722, 0x4f857269), WTCP(0x640e9386, 0x4fd420a4), + WTCP(0x63cfc231, 0x50229da1), WTCP(0x6390b34a, 0x5070e92f), WTCP(0x635166f9, 0x50bf031f), WTCP(0x6311dd64, 0x510ceb40), + WTCP(0x62d216b3, 0x515aa162), WTCP(0x6292130c, 0x51a82555), WTCP(0x6251d298, 0x51f576ea), WTCP(0x6211557e, 0x524295f0), + WTCP(0x61d09be5, 0x528f8238), WTCP(0x618fa5f7, 0x52dc3b92), WTCP(0x614e73da, 0x5328c1d0), WTCP(0x610d05b7, 0x537514c2), + WTCP(0x60cb5bb7, 0x53c13439), WTCP(0x60897601, 0x540d2005), WTCP(0x604754bf, 0x5458d7f9), WTCP(0x6004f819, 0x54a45be6), + WTCP(0x5fc26038, 0x54efab9c), WTCP(0x5f7f8d46, 0x553ac6ee), WTCP(0x5f3c7f6b, 0x5585adad), WTCP(0x5ef936d1, 0x55d05faa), + WTCP(0x5eb5b3a2, 0x561adcb9), WTCP(0x5e71f606, 0x566524aa), WTCP(0x5e2dfe29, 0x56af3750), WTCP(0x5de9cc33, 0x56f9147e), + WTCP(0x5da5604f, 0x5742bc06), WTCP(0x5d60baa7, 0x578c2dba), WTCP(0x5d1bdb65, 0x57d5696d), WTCP(0x5cd6c2b5, 0x581e6ef1), + WTCP(0x5c9170bf, 0x58673e1b), WTCP(0x5c4be5b0, 0x58afd6bd), WTCP(0x5c0621b2, 0x58f838a9), WTCP(0x5bc024f0, 0x594063b5), + WTCP(0x5b79ef96, 0x598857b2), WTCP(0x5b3381ce, 0x59d01475), WTCP(0x5aecdbc5, 0x5a1799d1), WTCP(0x5aa5fda5, 0x5a5ee79a), +}; + +/* The window coefficients are calculated according to the formula: + * N=FRAME_LEN_LONG_LD480 + * win[n]=sin(pi*(n+0.5)/(2*N)) for n=0,..,N-1 */ +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow480[480] = +{ + WTCP(0x7ffff4c5, 0x00359dd2), WTCP(0x7fff9aef, 0x00a0d951), WTCP(0x7ffee744, 0x010c1460), WTCP(0x7ffdd9c4, 0x01774eb2), + WTCP(0x7ffc726f, 0x01e287fc), WTCP(0x7ffab147, 0x024dbff4), WTCP(0x7ff8964d, 0x02b8f64e), WTCP(0x7ff62182, 0x03242abf), + WTCP(0x7ff352e8, 0x038f5cfb), WTCP(0x7ff02a82, 0x03fa8cb8), WTCP(0x7feca851, 0x0465b9aa), WTCP(0x7fe8cc57, 0x04d0e386), + WTCP(0x7fe49698, 0x053c0a01), WTCP(0x7fe00716, 0x05a72ccf), WTCP(0x7fdb1dd5, 0x06124ba5), WTCP(0x7fd5dad8, 0x067d6639), + WTCP(0x7fd03e23, 0x06e87c3f), WTCP(0x7fca47b9, 0x07538d6b), WTCP(0x7fc3f7a0, 0x07be9973), WTCP(0x7fbd4dda, 0x0829a00c), + WTCP(0x7fb64a6e, 0x0894a0ea), WTCP(0x7faeed5f, 0x08ff9bc2), WTCP(0x7fa736b4, 0x096a9049), WTCP(0x7f9f2671, 0x09d57e35), + WTCP(0x7f96bc9c, 0x0a40653a), WTCP(0x7f8df93c, 0x0aab450d), WTCP(0x7f84dc55, 0x0b161d63), WTCP(0x7f7b65ef, 0x0b80edf1), + WTCP(0x7f719611, 0x0bebb66c), WTCP(0x7f676cc0, 0x0c56768a), WTCP(0x7f5cea05, 0x0cc12dff), WTCP(0x7f520de6, 0x0d2bdc80), + WTCP(0x7f46d86c, 0x0d9681c2), WTCP(0x7f3b499d, 0x0e011d7c), WTCP(0x7f2f6183, 0x0e6baf61), WTCP(0x7f232026, 0x0ed63727), + WTCP(0x7f16858e, 0x0f40b483), WTCP(0x7f0991c4, 0x0fab272b), WTCP(0x7efc44d0, 0x10158ed4), WTCP(0x7eee9ebe, 0x107feb33), + WTCP(0x7ee09f95, 0x10ea3bfd), WTCP(0x7ed24761, 0x115480e9), WTCP(0x7ec3962a, 0x11beb9aa), WTCP(0x7eb48bfb, 0x1228e5f8), + WTCP(0x7ea528e0, 0x12930586), WTCP(0x7e956ce1, 0x12fd180b), WTCP(0x7e85580c, 0x13671d3d), WTCP(0x7e74ea6a, 0x13d114d0), + WTCP(0x7e642408, 0x143afe7b), WTCP(0x7e5304f2, 0x14a4d9f4), WTCP(0x7e418d32, 0x150ea6ef), WTCP(0x7e2fbcd6, 0x15786522), + WTCP(0x7e1d93ea, 0x15e21445), WTCP(0x7e0b127a, 0x164bb40b), WTCP(0x7df83895, 0x16b5442b), WTCP(0x7de50646, 0x171ec45c), + WTCP(0x7dd17b9c, 0x17883452), WTCP(0x7dbd98a4, 0x17f193c5), WTCP(0x7da95d6c, 0x185ae269), WTCP(0x7d94ca03, 0x18c41ff6), + WTCP(0x7d7fde76, 0x192d4c21), WTCP(0x7d6a9ad5, 0x199666a0), WTCP(0x7d54ff2e, 0x19ff6f2a), WTCP(0x7d3f0b90, 0x1a686575), + WTCP(0x7d28c00c, 0x1ad14938), WTCP(0x7d121cb0, 0x1b3a1a28), WTCP(0x7cfb218c, 0x1ba2d7fc), WTCP(0x7ce3ceb2, 0x1c0b826a), + WTCP(0x7ccc2430, 0x1c74192a), WTCP(0x7cb42217, 0x1cdc9bf2), WTCP(0x7c9bc87a, 0x1d450a78), WTCP(0x7c831767, 0x1dad6473), + WTCP(0x7c6a0ef2, 0x1e15a99a), WTCP(0x7c50af2b, 0x1e7dd9a4), WTCP(0x7c36f824, 0x1ee5f447), WTCP(0x7c1ce9ef, 0x1f4df93a), + WTCP(0x7c02849f, 0x1fb5e836), WTCP(0x7be7c847, 0x201dc0ef), WTCP(0x7bccb4f8, 0x2085831f), WTCP(0x7bb14ac5, 0x20ed2e7b), + WTCP(0x7b9589c3, 0x2154c2bb), WTCP(0x7b797205, 0x21bc3f97), WTCP(0x7b5d039e, 0x2223a4c5), WTCP(0x7b403ea2, 0x228af1fe), + WTCP(0x7b232325, 0x22f226f8), WTCP(0x7b05b13d, 0x2359436c), WTCP(0x7ae7e8fc, 0x23c04710), WTCP(0x7ac9ca7a, 0x2427319d), + WTCP(0x7aab55ca, 0x248e02cb), WTCP(0x7a8c8b01, 0x24f4ba50), WTCP(0x7a6d6a37, 0x255b57e6), WTCP(0x7a4df380, 0x25c1db44), + WTCP(0x7a2e26f2, 0x26284422), WTCP(0x7a0e04a4, 0x268e9238), WTCP(0x79ed8cad, 0x26f4c53e), WTCP(0x79ccbf22, 0x275adcee), + WTCP(0x79ab9c1c, 0x27c0d8fe), WTCP(0x798a23b1, 0x2826b928), WTCP(0x796855f9, 0x288c7d24), WTCP(0x7946330c, 0x28f224ab), + WTCP(0x7923bb01, 0x2957af74), WTCP(0x7900edf2, 0x29bd1d3a), WTCP(0x78ddcbf5, 0x2a226db5), WTCP(0x78ba5524, 0x2a87a09d), + WTCP(0x78968998, 0x2aecb5ac), WTCP(0x7872696a, 0x2b51ac9a), WTCP(0x784df4b3, 0x2bb68522), WTCP(0x78292b8d, 0x2c1b3efb), + WTCP(0x78040e12, 0x2c7fd9e0), WTCP(0x77de9c5b, 0x2ce45589), WTCP(0x77b8d683, 0x2d48b1b1), WTCP(0x7792bca5, 0x2dacee11), + WTCP(0x776c4edb, 0x2e110a62), WTCP(0x77458d40, 0x2e75065e), WTCP(0x771e77f0, 0x2ed8e1c0), WTCP(0x76f70f05, 0x2f3c9c40), + WTCP(0x76cf529c, 0x2fa03599), WTCP(0x76a742d1, 0x3003ad85), WTCP(0x767edfbe, 0x306703bf), WTCP(0x76562982, 0x30ca3800), + WTCP(0x762d2038, 0x312d4a03), WTCP(0x7603c3fd, 0x31903982), WTCP(0x75da14ef, 0x31f30638), WTCP(0x75b01329, 0x3255afe0), + WTCP(0x7585becb, 0x32b83634), WTCP(0x755b17f2, 0x331a98ef), WTCP(0x75301ebb, 0x337cd7cd), WTCP(0x7504d345, 0x33def287), + WTCP(0x74d935ae, 0x3440e8da), WTCP(0x74ad4615, 0x34a2ba81), WTCP(0x74810499, 0x35046736), WTCP(0x74547158, 0x3565eeb6), + WTCP(0x74278c72, 0x35c750bc), WTCP(0x73fa5607, 0x36288d03), WTCP(0x73ccce36, 0x3689a348), WTCP(0x739ef51f, 0x36ea9346), + WTCP(0x7370cae2, 0x374b5cb9), WTCP(0x73424fa0, 0x37abff5d), WTCP(0x73138379, 0x380c7aee), WTCP(0x72e4668f, 0x386ccf2a), + WTCP(0x72b4f902, 0x38ccfbcb), WTCP(0x72853af3, 0x392d008f), WTCP(0x72552c85, 0x398cdd32), WTCP(0x7224cdd8, 0x39ec9172), + WTCP(0x71f41f0f, 0x3a4c1d09), WTCP(0x71c3204c, 0x3aab7fb7), WTCP(0x7191d1b1, 0x3b0ab937), WTCP(0x71603361, 0x3b69c947), + WTCP(0x712e457f, 0x3bc8afa5), WTCP(0x70fc082d, 0x3c276c0d), WTCP(0x70c97b90, 0x3c85fe3d), WTCP(0x70969fca, 0x3ce465f3), + WTCP(0x706374ff, 0x3d42a2ec), WTCP(0x702ffb54, 0x3da0b4e7), WTCP(0x6ffc32eb, 0x3dfe9ba1), WTCP(0x6fc81bea, 0x3e5c56d8), + WTCP(0x6f93b676, 0x3eb9e64b), WTCP(0x6f5f02b2, 0x3f1749b8), WTCP(0x6f2a00c4, 0x3f7480dd), WTCP(0x6ef4b0d1, 0x3fd18b7a), + WTCP(0x6ebf12ff, 0x402e694c), WTCP(0x6e892772, 0x408b1a12), WTCP(0x6e52ee52, 0x40e79d8c), WTCP(0x6e1c67c4, 0x4143f379), + WTCP(0x6de593ee, 0x41a01b97), WTCP(0x6dae72f7, 0x41fc15a6), WTCP(0x6d770506, 0x4257e166), WTCP(0x6d3f4a40, 0x42b37e96), + WTCP(0x6d0742cf, 0x430eecf6), WTCP(0x6cceeed8, 0x436a2c45), WTCP(0x6c964e83, 0x43c53c44), WTCP(0x6c5d61f9, 0x44201cb2), + WTCP(0x6c242960, 0x447acd50), WTCP(0x6beaa4e2, 0x44d54ddf), WTCP(0x6bb0d4a7, 0x452f9e1e), WTCP(0x6b76b8d6, 0x4589bdcf), + WTCP(0x6b3c519a, 0x45e3acb1), WTCP(0x6b019f1a, 0x463d6a87), WTCP(0x6ac6a180, 0x4696f710), WTCP(0x6a8b58f6, 0x46f0520f), + WTCP(0x6a4fc5a6, 0x47497b44), WTCP(0x6a13e7b8, 0x47a27271), WTCP(0x69d7bf57, 0x47fb3757), WTCP(0x699b4cad, 0x4853c9b9), + WTCP(0x695e8fe5, 0x48ac2957), WTCP(0x69218929, 0x490455f4), WTCP(0x68e438a4, 0x495c4f52), WTCP(0x68a69e81, 0x49b41533), + WTCP(0x6868baec, 0x4a0ba75b), WTCP(0x682a8e0f, 0x4a63058a), WTCP(0x67ec1817, 0x4aba2f84), WTCP(0x67ad592f, 0x4b11250c), + WTCP(0x676e5183, 0x4b67e5e4), WTCP(0x672f013f, 0x4bbe71d1), WTCP(0x66ef6891, 0x4c14c894), WTCP(0x66af87a4, 0x4c6ae9f2), + WTCP(0x666f5ea6, 0x4cc0d5ae), WTCP(0x662eedc3, 0x4d168b8b), WTCP(0x65ee3529, 0x4d6c0b4e), WTCP(0x65ad3505, 0x4dc154bb), + WTCP(0x656bed84, 0x4e166795), WTCP(0x652a5ed6, 0x4e6b43a2), WTCP(0x64e88926, 0x4ebfe8a5), WTCP(0x64a66ca5, 0x4f145662), + WTCP(0x6464097f, 0x4f688ca0), WTCP(0x64215fe5, 0x4fbc8b22), WTCP(0x63de7003, 0x501051ae), WTCP(0x639b3a0b, 0x5063e008), + WTCP(0x6357be2a, 0x50b735f8), WTCP(0x6313fc90, 0x510a5340), WTCP(0x62cff56c, 0x515d37a9), WTCP(0x628ba8ef, 0x51afe2f6), + WTCP(0x62471749, 0x520254ef), WTCP(0x620240a8, 0x52548d59), WTCP(0x61bd253f, 0x52a68bfb), WTCP(0x6177c53c, 0x52f8509b), + WTCP(0x613220d2, 0x5349daff), WTCP(0x60ec3830, 0x539b2af0), WTCP(0x60a60b88, 0x53ec4032), WTCP(0x605f9b0b, 0x543d1a8e), + WTCP(0x6018e6eb, 0x548db9cb), WTCP(0x5fd1ef59, 0x54de1db1), WTCP(0x5f8ab487, 0x552e4605), WTCP(0x5f4336a7, 0x557e3292), + WTCP(0x5efb75ea, 0x55cde31e), WTCP(0x5eb37285, 0x561d5771), WTCP(0x5e6b2ca8, 0x566c8f55), WTCP(0x5e22a487, 0x56bb8a90), + WTCP(0x5dd9da55, 0x570a48ec), WTCP(0x5d90ce45, 0x5758ca31), WTCP(0x5d47808a, 0x57a70e29), WTCP(0x5cfdf157, 0x57f5149d), + WTCP(0x5cb420e0, 0x5842dd54), WTCP(0x5c6a0f59, 0x5890681a), WTCP(0x5c1fbcf6, 0x58ddb4b8), WTCP(0x5bd529eb, 0x592ac2f7), + WTCP(0x5b8a566c, 0x597792a1), WTCP(0x5b3f42ae, 0x59c42381), WTCP(0x5af3eee6, 0x5a107561), WTCP(0x5aa85b48, 0x5a5c880a), +}; + + + + + + +/** + * \brief Helper table containing the length, rasterand shape mapping to individual window slope tables. + * [0: sine ][0: radix2 raster ][ceil(log2(length)) length 4 .. 1024 ] + * [1: 10ms raster ][ceil(log2(length)) length 3.25 .. 960 ] + * [2: 3/4 of radix 2 raster][ceil(log2(length)) length 3 .. 768 ] + * [1: KBD ][0: radix2 raster ][ceil(log2(length)) length 128 .. 1024 ] + * [1: 10ms raster ][ceil(log2(length)) length 120 .. 960 ] + * [2: 3/4 of radix 2 raster][ceil(log2(length)) length 96 .. 768 ] + */ +const FIXP_WTP *const windowSlopes[2][3][9] = +{ + { /* Sine */ + { /* Radix 2 */ + NULL, + NULL, + NULL, + SineWindow32, + SineWindow64, + SineWindow128, + NULL, + SineWindow512, + SineWindow1024 + }, + { /* 10ms raster */ + NULL, /* 3.25 */ + NULL, /* 7.5 */ + NULL, + NULL, + NULL, + SineWindow120, + NULL, + SineWindow480, + SineWindow960 + }, + { /* 3/4 radix2 raster */ + NULL, /* 3 */ + NULL, /* 6 */ +#ifdef INCLUDE_SineWindow12 + SineWindow12, +#else + NULL, +#endif + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + { /* KBD */ + { /* Radix 2 */ + KBDWindow128, + NULL, + SineWindow512, + KBDWindow1024 + }, + { /* 10ms raster */ + KBDWindow120, + NULL, + SineWindow480, + KBDWindow960 + }, + { /* 3/4 radix2 raster */ + NULL, + NULL, + NULL, + NULL + } + } +}; + +const FIXP_WTP * FDKgetWindowSlope(int length, int shape) +{ + const FIXP_WTP * w = NULL; + int raster, ld2_length; + + /* Get ld2 of length - 2 + 1 + -2: because first table entry is window of size 4 + +1: because we already include +1 because of ceil(log2(length)) */ + ld2_length = DFRACT_BITS-1-fNormz((FIXP_DBL)length) - 1; + + /* Extract sort of "eigenvalue" (the 4 left most bits) of length. */ + switch ( (length) >> (ld2_length-2) ) { + case 0x8: /* radix 2 */ + raster = 0; + ld2_length--; /* revert + 1 because of ceil(log2(length)) from above. */ + break; + case 0xf: /* 10 ms */ + raster = 1; + break; + case 0xc: /* 3/4 of radix 2 */ + raster = 2; + break; + default: + raster = 0; + break; + } + + /* The table for sine windows (shape == 0) is 5 entries longer. */ + if (shape == 1) { + ld2_length-=5; + } + + /* Look up table */ + w = windowSlopes[shape&1][raster][ld2_length]; + + FDK_ASSERT(w != NULL); + + return w; +} + + +/* + * QMF filter and twiddle tables + */ + +#ifdef QMF_COEFF_16BIT +#define QFC(x) FX_DBL2FXCONST_SGL(x) +#define QTCFL(x) FL2FXCONST_SGL(x) +#define QTC(x) FX_DBL2FXCONST_SGL(x) +#else +#define QFC(x) (x) +#define QTCFL(x) FL2FXCONST_DBL(x) +#define QTC(x) (x) +#endif /* ARCH_PREFER_MULT_32x16 */ + +#ifndef LOW_POWER_SBR_ONLY +/*! + \name QMF-Twiddle + \brief QMF twiddle factors + + L=32, gain=2.0, angle = 0.75 +*/ + +const FIXP_QTW qmf_phaseshift_cos32[32] = +{ + QTCFL( 0.99932238458835f),QTCFL( 0.99390697000236f),QTCFL( 0.98310548743122f),QTCFL( 0.96697647104485f), + QTCFL( 0.94560732538052f),QTCFL( 0.91911385169006f),QTCFL( 0.88763962040285f),QTCFL( 0.85135519310527f), + QTCFL( 0.81045719825259f),QTCFL( 0.76516726562246f),QTCFL( 0.71573082528382f),QTCFL( 0.66241577759017f), + QTCFL( 0.60551104140433f),QTCFL( 0.54532498842205f),QTCFL( 0.48218377207912f),QTCFL( 0.41642956009764f), + QTCFL( 0.34841868024943f),QTCFL( 0.27851968938505f),QTCFL( 0.20711137619222f),QTCFL( 0.13458070850713f), + QTCFL( 0.06132073630221f),QTCFL(-0.01227153828572f),QTCFL(-0.08579731234444f),QTCFL(-0.15885814333386f), + QTCFL(-0.23105810828067f),QTCFL(-0.30200594931923f),QTCFL(-0.37131719395184f),QTCFL(-0.43861623853853f), + QTCFL(-0.50353838372572f),QTCFL(-0.56573181078361f),QTCFL(-0.62485948814239f),QTCFL(-0.68060099779545f) +}; + +const FIXP_QTW qmf_phaseshift_sin32[32] = +{ + QTCFL( 0.03680722294136f),QTCFL( 0.11022220729388f),QTCFL( 0.18303988795514f),QTCFL( 0.25486565960451f), + QTCFL( 0.32531029216226f),QTCFL( 0.39399204006105f),QTCFL( 0.46053871095824f),QTCFL( 0.52458968267847f), + QTCFL( 0.58579785745644f),QTCFL( 0.64383154288979f),QTCFL( 0.69837624940897f),QTCFL( 0.74913639452346f), + QTCFL( 0.79583690460888f),QTCFL( 0.83822470555484f),QTCFL( 0.87607009419541f),QTCFL( 0.90916798309052f), + QTCFL( 0.93733901191257f),QTCFL( 0.96043051941557f),QTCFL( 0.97831737071963f),QTCFL( 0.99090263542778f), + QTCFL( 0.99811811290015f),QTCFL( 0.99992470183914f),QTCFL( 0.99631261218278f),QTCFL( 0.98730141815786f), + QTCFL( 0.97293995220556f),QTCFL( 0.95330604035419f),QTCFL( 0.92850608047322f),QTCFL( 0.89867446569395f), + QTCFL( 0.86397285612159f),QTCFL( 0.82458930278503f),QTCFL( 0.78073722857209f),QTCFL( 0.73265427167241f) +}; +const FIXP_QTW qmf_phaseshift_cos64[64] = { + QTC(0x7ff62181), QTC(0x7fa736b3), QTC(0x7f0991c3), QTC(0x7e1d93e9), QTC(0x7ce3ceb1), QTC(0x7b5d039d), QTC(0x798a23b0), QTC(0x776c4eda), + QTC(0x7504d344), QTC(0x72552c84), QTC(0x6f5f02b1), QTC(0x6c24295f), QTC(0x68a69e80), QTC(0x64e88925), QTC(0x60ec382f), QTC(0x5cb420df), + QTC(0x5842dd54), QTC(0x539b2aef), QTC(0x4ebfe8a4), QTC(0x49b41533), QTC(0x447acd50), QTC(0x3f1749b7), QTC(0x398cdd32), QTC(0x33def287), + QTC(0x2e110a62), QTC(0x2826b928), QTC(0x2223a4c5), QTC(0x1c0b826a), QTC(0x15e21444), QTC(0x0fab272b), QTC(0x096a9049), QTC(0x03242abf), + QTC(0xfcdbd541), QTC(0xf6956fb7), QTC(0xf054d8d5), QTC(0xea1debbc), QTC(0xe3f47d96), QTC(0xdddc5b3b), QTC(0xd7d946d8), QTC(0xd1eef59e), + QTC(0xcc210d79), QTC(0xc67322ce), QTC(0xc0e8b649), QTC(0xbb8532b0), QTC(0xb64beacd), QTC(0xb140175c), QTC(0xac64d511), QTC(0xa7bd22ac), + QTC(0xa34bdf21), QTC(0x9f13c7d1), QTC(0x9b1776db), QTC(0x97596180), QTC(0x93dbd6a1), QTC(0x90a0fd4f), QTC(0x8daad37c), QTC(0x8afb2cbc), + QTC(0x8893b126), QTC(0x8675dc50), QTC(0x84a2fc63), QTC(0x831c314f), QTC(0x81e26c17), QTC(0x80f66e3d), QTC(0x8058c94d), QTC(0x8009de7f) +}; + +const FIXP_QTW qmf_phaseshift_sin64[64] = { + QTC(0x03242abf), QTC(0x096a9049), QTC(0x0fab272b), QTC(0x15e21444), QTC(0x1c0b826a), QTC(0x2223a4c5), QTC(0x2826b928), QTC(0x2e110a62), + QTC(0x33def287), QTC(0x398cdd32), QTC(0x3f1749b7), QTC(0x447acd50), QTC(0x49b41533), QTC(0x4ebfe8a4), QTC(0x539b2aef), QTC(0x5842dd54), + QTC(0x5cb420df), QTC(0x60ec382f), QTC(0x64e88925), QTC(0x68a69e80), QTC(0x6c24295f), QTC(0x6f5f02b1), QTC(0x72552c84), QTC(0x7504d344), + QTC(0x776c4eda), QTC(0x798a23b0), QTC(0x7b5d039d), QTC(0x7ce3ceb1), QTC(0x7e1d93e9), QTC(0x7f0991c3), QTC(0x7fa736b3), QTC(0x7ff62181), + QTC(0x7ff62181), QTC(0x7fa736b3), QTC(0x7f0991c3), QTC(0x7e1d93e9), QTC(0x7ce3ceb1), QTC(0x7b5d039d), QTC(0x798a23b0), QTC(0x776c4eda), + QTC(0x7504d344), QTC(0x72552c84), QTC(0x6f5f02b1), QTC(0x6c24295f), QTC(0x68a69e80), QTC(0x64e88925), QTC(0x60ec382f), QTC(0x5cb420df), + QTC(0x5842dd54), QTC(0x539b2aef), QTC(0x4ebfe8a4), QTC(0x49b41533), QTC(0x447acd50), QTC(0x3f1749b7), QTC(0x398cdd32), QTC(0x33def287), + QTC(0x2e110a62), QTC(0x2826b928), QTC(0x2223a4c5), QTC(0x1c0b826a), QTC(0x15e21444), QTC(0x0fab272b), QTC(0x096a9049), QTC(0x03242abf) +}; + +//@} + +#endif /* #ifdef LOW_POWER_SBR_ONLY */ + + + +/*! + \name QMF + \brief QMF-Table + 64 channels, N = 640, optimized by PE 010516 + + The coeffs are rearranged compared with the reference in the following + way, exploiting symmetry : + sbr_qmf_64[5] = p_64_640_qmf[0]; + sbr_qmf_64[6] = p_64_640_qmf[128]; + sbr_qmf_64[7] = p_64_640_qmf[256]; + sbr_qmf_64[8] = p_64_640_qmf[384]; + sbr_qmf_64[9] = p_64_640_qmf[512]; + + sbr_qmf_64[10] = p_64_640_qmf[1]; + sbr_qmf_64[11] = p_64_640_qmf[129]; + sbr_qmf_64[12] = p_64_640_qmf[257]; + sbr_qmf_64[13] = p_64_640_qmf[385]; + sbr_qmf_64[14] = p_64_640_qmf[513]; + . + . + . + sbr_qmf_64_640_qmf[315] = p_64_640_qmf[62]; + sbr_qmf_64_640_qmf[316] = p_64_640_qmf[190]; + sbr_qmf_64_640_qmf[317] = p_64_640_qmf[318]; + sbr_qmf_64_640_qmf[318] = p_64_640_qmf[446]; + sbr_qmf_64_640_qmf[319] = p_64_640_qmf[574]; + + sbr_qmf_64_640_qmf[320] = p_64_640_qmf[63]; + sbr_qmf_64_640_qmf[321] = p_64_640_qmf[191]; + sbr_qmf_64_640_qmf[322] = p_64_640_qmf[319]; + sbr_qmf_64_640_qmf[323] = p_64_640_qmf[447]; + sbr_qmf_64_640_qmf[324] = p_64_640_qmf[575]; + + sbr_qmf_64_640_qmf[319] = p_64_640_qmf[64]; + sbr_qmf_64_640_qmf[318] = p_64_640_qmf[192]; + sbr_qmf_64_640_qmf[317] = p_64_640_qmf[320]; + sbr_qmf_64_640_qmf[316] = p_64_640_qmf[448]; + sbr_qmf_64_640_qmf[315] = p_64_640_qmf[576]; + + sbr_qmf_64_640_qmf[314] = p_64_640_qmf[65]; + sbr_qmf_64_640_qmf[313] = p_64_640_qmf[193]; + sbr_qmf_64_640_qmf[312] = p_64_640_qmf[321]; + sbr_qmf_64_640_qmf[311] = p_64_640_qmf[449]; + sbr_qmf_64_640_qmf[310] = p_64_640_qmf[577]; + . + . + . + sbr_qmf_64[9] = p_64_640_qmf[126] + sbr_qmf_64[8] = p_64_640_qmf[254]; + sbr_qmf_64[7] = p_64_640_qmf[382]; + sbr_qmf_64[6] = p_64_640_qmf[510]; + sbr_qmf_64[5] = p_64_640_qmf[638]; + + sbr_qmf_64[4] = p_64_640_qmf[127] + sbr_qmf_64[3] = p_64_640_qmf[255]; + sbr_qmf_64[2] = p_64_640_qmf[383]; + sbr_qmf_64[1] = p_64_640_qmf[511]; + sbr_qmf_64[0] = p_64_640_qmf[639]; + + Max sum of all FIR filter absolute coefficients is: 0x7FF5B201 + thus, the filter output is not required to be scaled. + + \showinitializer +*/ +//@{ +#if QMF_NO_POLY==5 +LNK_SECTION_CONSTDATA_L1 +RAM_ALIGN +const FIXP_PFT qmf_64[QMF640_PFT_TABLE_SIZE+QMF_NO_POLY] = +{ + QFC(0x00000000), QFC(0x01b2e41d), QFC(0x2e3a7532), QFC(0xd1c58ace), QFC(0xfe4d1be3), + QFC(0xffede50e), QFC(0x01d78bfc), QFC(0x2faa221c), QFC(0xd3337b3e), QFC(0xfe70b8d1), + QFC(0xffed978a), QFC(0x01fd3ba0), QFC(0x311af3a4), QFC(0xd49fd55f), QFC(0xfe933dc0), + QFC(0xffefc9b9), QFC(0x02244a24), QFC(0x328cc6f0), QFC(0xd60a46e6), QFC(0xfeb48d0d), + QFC(0xfff0065d), QFC(0x024bf7a1), QFC(0x33ff670e), QFC(0xd7722f04), QFC(0xfed4bec3), + QFC(0xffeff6ca), QFC(0x0274ba43), QFC(0x3572ec70), QFC(0xd8d7f220), QFC(0xfef3f6ab), + QFC(0xffef7b8b), QFC(0x029e35b4), QFC(0x36e69691), QFC(0xda3b176a), QFC(0xff120d70), + QFC(0xffeedfa4), QFC(0x02c89901), QFC(0x385a49c3), QFC(0xdb9b5b12), QFC(0xff2ef725), + QFC(0xffee1650), QFC(0x02f3e48d), QFC(0x39ce0477), QFC(0xdcf898fb), QFC(0xff4aabc8), + QFC(0xffed651d), QFC(0x03201116), QFC(0x3b415115), QFC(0xde529087), QFC(0xff6542d1), + QFC(0xffecc31b), QFC(0x034d01f1), QFC(0x3cb41219), QFC(0xdfa93ab5), QFC(0xff7ee3f1), + QFC(0xffebe77b), QFC(0x037ad438), QFC(0x3e25b17e), QFC(0xe0fc421e), QFC(0xff975c01), + QFC(0xffeb50b2), QFC(0x03a966bb), QFC(0x3f962fb8), QFC(0xe24b8f67), QFC(0xffaea5d6), + QFC(0xffea9192), QFC(0x03d8afe6), QFC(0x41058bc5), QFC(0xe396a45d), QFC(0xffc4e365), + QFC(0xffe9ca76), QFC(0x04083fec), QFC(0x4272a385), QFC(0xe4de0cb0), QFC(0xffda17f2), + QFC(0xffe940f4), QFC(0x043889c6), QFC(0x43de620a), QFC(0xe620c476), QFC(0xffee183b), + QFC(0xffe88ba8), QFC(0x04694101), QFC(0x4547daea), QFC(0xe75f8bb8), QFC(0x0000e790), + QFC(0xffe83a07), QFC(0x049aa82f), QFC(0x46aea856), QFC(0xe89971b7), QFC(0x00131c75), + QFC(0xffe79e16), QFC(0x04cc2fcf), QFC(0x4812f848), QFC(0xe9cea84a), QFC(0x0023b989), + QFC(0xffe7746e), QFC(0x04fe20be), QFC(0x4973fef1), QFC(0xeafee7f1), QFC(0x0033b927), + QFC(0xffe6d466), QFC(0x05303f88), QFC(0x4ad237a2), QFC(0xec2a3f60), QFC(0x00426f36), + QFC(0xffe6afed), QFC(0x05626209), QFC(0x4c2ca3df), QFC(0xed50a31d), QFC(0x00504f41), + QFC(0xffe65416), QFC(0x05950122), QFC(0x4d83976c), QFC(0xee71b2fe), QFC(0x005d36df), + QFC(0xffe681c6), QFC(0x05c76fed), QFC(0x4ed62be2), QFC(0xef8d4d7b), QFC(0x006928a0), + QFC(0xffe66dd0), QFC(0x05f9c051), QFC(0x5024d70e), QFC(0xf0a3959f), QFC(0x007400b8), + QFC(0xffe66fab), QFC(0x062bf5ec), QFC(0x516eefb8), QFC(0xf1b461ab), QFC(0x007e0393), + QFC(0xffe69423), QFC(0x065dd56a), QFC(0x52b449dd), QFC(0xf2bf6ea4), QFC(0x00872c63), + QFC(0xffe6fed4), QFC(0x068f8b44), QFC(0x53f495a9), QFC(0xf3c4e887), QFC(0x008f87aa), + QFC(0xffe75361), QFC(0x06c0f0c0), QFC(0x552f8ff6), QFC(0xf4c473c6), QFC(0x0096dcc2), + QFC(0xffe80414), QFC(0x06f1825d), QFC(0x56654bdc), QFC(0xf5be0fa9), QFC(0x009da526), + QFC(0xffe85b4a), QFC(0x0721bf22), QFC(0x579505f4), QFC(0xf6b1f3c3), QFC(0x00a3508f), + QFC(0xffe954d0), QFC(0x075112a2), QFC(0x58befacc), QFC(0xf79fa13a), QFC(0x00a85e94), + QFC(0xffea353a), QFC(0x077fedb3), QFC(0x59e2f69e), QFC(0xf887507c), QFC(0x00acbd2f), + QFC(0xffeb3849), QFC(0x07ad8c26), QFC(0x5b001db7), QFC(0xf96916f5), QFC(0x00b06b68), + QFC(0xffec8409), QFC(0x07da2b7f), QFC(0x5c16d0ae), QFC(0xfa44a069), QFC(0x00b36acd), + QFC(0xffedc418), QFC(0x08061671), QFC(0x5d26be9b), QFC(0xfb19b7bd), QFC(0x00b58c8d), + QFC(0xffef2395), QFC(0x08303897), QFC(0x5e2f6366), QFC(0xfbe8f5bd), QFC(0x00b73ab0), + QFC(0xfff0e7ef), QFC(0x08594887), QFC(0x5f30ff5e), QFC(0xfcb1d740), QFC(0x00b85f70), + QFC(0xfff294c3), QFC(0x0880ffdd), QFC(0x602b0c7e), QFC(0xfd7475d8), QFC(0x00b8c6b0), + QFC(0xfff48700), QFC(0x08a75da4), QFC(0x611d58a2), QFC(0xfe310657), QFC(0x00b8fe0d), + QFC(0xfff681d6), QFC(0x08cb4e23), QFC(0x6207f21f), QFC(0xfee723c6), QFC(0x00b8394b), + QFC(0xfff91fc9), QFC(0x08edfeaa), QFC(0x62ea6473), QFC(0xff96db8f), QFC(0x00b74c37), + QFC(0xfffb42b0), QFC(0x090ec1fc), QFC(0x63c45243), QFC(0x0040c497), QFC(0x00b5c867), + QFC(0xfffdfa24), QFC(0x092d7970), QFC(0x64964062), QFC(0x00e42fa2), QFC(0x00b3d15c), + QFC(0x00007134), QFC(0x0949eaac), QFC(0x655f63f1), QFC(0x01816e06), QFC(0x00b1978d), + QFC(0x00039609), QFC(0x0963ed46), QFC(0x661fd6b7), QFC(0x02186a92), QFC(0x00af374c), + QFC(0x0006b1cf), QFC(0x097c1ee8), QFC(0x66d76724), QFC(0x02a99097), QFC(0x00abe79e), + QFC(0x0009aa3f), QFC(0x099140a7), QFC(0x6785c24c), QFC(0x03343534), QFC(0x00a8739d), + QFC(0x000d31b5), QFC(0x09a3e163), QFC(0x682b39a3), QFC(0x03b8f8dc), QFC(0x00a520bb), + QFC(0x0010bc63), QFC(0x09b3d77f), QFC(0x68c7269b), QFC(0x0437fb0a), QFC(0x00a1039c), + QFC(0x001471f8), QFC(0x09c0e59f), QFC(0x6959709c), QFC(0x04b0adcb), QFC(0x009d10bf), + QFC(0x0018703f), QFC(0x09cab9f2), QFC(0x69e29783), QFC(0x05237f9d), QFC(0x0098b855), + QFC(0x001c3549), QFC(0x09d19ca9), QFC(0x6a619c5e), QFC(0x0590a67d), QFC(0x009424c6), + QFC(0x002064f8), QFC(0x09d52709), QFC(0x6ad73e8d), QFC(0x05f7fb90), QFC(0x008f4bfd), + QFC(0x0024dd50), QFC(0x09d5560b), QFC(0x6b42a863), QFC(0x06593912), QFC(0x008a7dd7), + QFC(0x00293718), QFC(0x09d1fa23), QFC(0x6ba4629e), QFC(0x06b559c3), QFC(0x0085c217), + QFC(0x002d8e42), QFC(0x09caeb0f), QFC(0x6bfbdd97), QFC(0x070bbf58), QFC(0x00807994), + QFC(0x00329ab6), QFC(0x09c018ce), QFC(0x6c492216), QFC(0x075ca90c), QFC(0x007b3875), + QFC(0x003745f9), QFC(0x09b18a1d), QFC(0x6c8c4c79), QFC(0x07a8127d), QFC(0x0075fded), + QFC(0x003c1fa4), QFC(0x099ec3dc), QFC(0x6cc59baa), QFC(0x07ee507c), QFC(0x0070c8a5), + QFC(0x004103f5), QFC(0x09881dc5), QFC(0x6cf4073d), QFC(0x082f552e), QFC(0x006b47fa), + QFC(0x00465348), QFC(0x096d0e21), QFC(0x6d18520d), QFC(0x086b1eec), QFC(0x0065fde5), + QFC(0x004b6c46), QFC(0x094d7ec2), QFC(0x6d32730e), QFC(0x08a24899), QFC(0x006090c4), + QFC(0x0050b177), QFC(0x09299ead), QFC(0x6d41d963), QFC(0x08d3e41b), QFC(0x005b5371), + QFC(0x0055dba1), QFC(0x09015651), QFC(0x6d474e1d), QFC(0x09015651), QFC(0x0055dba1), + QFC(0xfe4d1be3), QFC(0xd1c58ace), QFC(0x2e3a7532), QFC(0x01b2e41d), QFC(0x00000000), +}; + +#else /* QMF_NO_POLY == 5 */ +#endif /* QMF_NO_POLY==5 */ + + + + + +/* + * Low Delay QMF aka CLDFB + */ + +#if defined(QMF_COEFF_16BIT) +#define QTCFLLD(x) FL2FXCONST_SGL(x/(float)(1<<QMF_CLDFB_PFT_SCALE)) +#define QTCFLLDT(x) FL2FXCONST_SGL(x) +#else +#define QTCFLLD(x) FL2FXCONST_DBL(x/(float)(1<<QMF_CLDFB_PFT_SCALE)) +#define QTCFLLDT(x) FL2FXCONST_DBL(x) +#endif + + +#ifndef LOW_POWER_SBR_ONLY +/*! + \name QMF-Twiddle + \brief QMF twiddle factors + + L=32, gain=2.0, angle = 0.75 +*/ +/* sin/cos (angle) / 2 */ +const FIXP_QTW qmf_phaseshift_cos32_cldfb[32] = { + QTCFLLDT(-7.071067e-01), QTCFLLDT(7.071070e-01), QTCFLLDT(7.071064e-01), QTCFLLDT(-7.071073e-01), + QTCFLLDT(-7.071061e-01), QTCFLLDT(7.071076e-01), QTCFLLDT(7.071058e-01), QTCFLLDT(-7.071080e-01), + QTCFLLDT(-7.071055e-01), QTCFLLDT(7.071083e-01), QTCFLLDT(7.071052e-01), QTCFLLDT(-7.071086e-01), + QTCFLLDT(-7.071049e-01), QTCFLLDT(7.071089e-01), QTCFLLDT(7.071046e-01), QTCFLLDT(-7.071092e-01), + QTCFLLDT(-7.071042e-01), QTCFLLDT(7.071095e-01), QTCFLLDT(7.071039e-01), QTCFLLDT(-7.071098e-01), + QTCFLLDT(-7.071036e-01), QTCFLLDT(7.071101e-01), QTCFLLDT(7.071033e-01), QTCFLLDT(-7.071104e-01), + QTCFLLDT(-7.071030e-01), QTCFLLDT(7.071107e-01), QTCFLLDT(7.071027e-01), QTCFLLDT(-7.071111e-01), + QTCFLLDT(-7.071024e-01), QTCFLLDT(7.071114e-01), QTCFLLDT(7.071021e-01), QTCFLLDT(-7.071117e-01), +}; + +const FIXP_QTW qmf_phaseshift_sin32_cldfb[32] = { + QTCFLLDT(7.071068e-01), QTCFLLDT(7.071065e-01), QTCFLLDT(-7.071072e-01), QTCFLLDT(-7.071062e-01), + QTCFLLDT(7.071075e-01), QTCFLLDT(7.071059e-01), QTCFLLDT(-7.071078e-01), QTCFLLDT(-7.071056e-01), + QTCFLLDT(7.071081e-01), QTCFLLDT(7.071053e-01), QTCFLLDT(-7.071084e-01), QTCFLLDT(-7.071050e-01), + QTCFLLDT(7.071087e-01), QTCFLLDT(7.071047e-01), QTCFLLDT(-7.071090e-01), QTCFLLDT(-7.071044e-01), + QTCFLLDT(7.071093e-01), QTCFLLDT(7.071041e-01), QTCFLLDT(-7.071096e-01), QTCFLLDT(-7.071038e-01), + QTCFLLDT(7.071099e-01), QTCFLLDT(7.071034e-01), QTCFLLDT(-7.071103e-01), QTCFLLDT(-7.071031e-01), + QTCFLLDT(7.071106e-01), QTCFLLDT(7.071028e-01), QTCFLLDT(-7.071109e-01), QTCFLLDT(-7.071025e-01), + QTCFLLDT(7.071112e-01), QTCFLLDT(7.071022e-01), QTCFLLDT(-7.071115e-01), QTCFLLDT(-7.071019e-01), +}; + + +/* sin/cos (angle) / 128 */ +const FIXP_QTW qmf_phaseshift_cos64_cldfb[64] = { + QTCFLLDT(7.071068e-01), QTCFLLDT(-7.071066e-01), QTCFLLDT(-7.071070e-01), QTCFLLDT(7.071065e-01), + QTCFLLDT(7.071072e-01), QTCFLLDT(-7.071063e-01), QTCFLLDT(-7.071074e-01), QTCFLLDT(7.071061e-01), + QTCFLLDT(7.071075e-01), QTCFLLDT(-7.071059e-01), QTCFLLDT(-7.071078e-01), QTCFLLDT(7.071057e-01), + QTCFLLDT(7.071080e-01), QTCFLLDT(-7.071055e-01), QTCFLLDT(-7.071081e-01), QTCFLLDT(7.071053e-01), + QTCFLLDT(7.071083e-01), QTCFLLDT(-7.071052e-01), QTCFLLDT(-7.071085e-01), QTCFLLDT(7.071050e-01), + QTCFLLDT(7.071087e-01), QTCFLLDT(-7.071048e-01), QTCFLLDT(-7.071089e-01), QTCFLLDT(7.071046e-01), + QTCFLLDT(7.071090e-01), QTCFLLDT(-7.071044e-01), QTCFLLDT(-7.071092e-01), QTCFLLDT(7.071042e-01), + QTCFLLDT(7.071095e-01), QTCFLLDT(-7.071040e-01), QTCFLLDT(-7.071096e-01), QTCFLLDT(7.071038e-01), + QTCFLLDT(7.071098e-01), QTCFLLDT(-7.071037e-01), QTCFLLDT(-7.071100e-01), QTCFLLDT(7.071035e-01), + QTCFLLDT(7.071102e-01), QTCFLLDT(-7.071033e-01), QTCFLLDT(-7.071103e-01), QTCFLLDT(7.071031e-01), + QTCFLLDT(7.071105e-01), QTCFLLDT(-7.071030e-01), QTCFLLDT(-7.071107e-01), QTCFLLDT(7.071028e-01), + QTCFLLDT(7.071109e-01), QTCFLLDT(-7.071025e-01), QTCFLLDT(-7.071111e-01), QTCFLLDT(7.071024e-01), + QTCFLLDT(7.071113e-01), QTCFLLDT(-7.071022e-01), QTCFLLDT(-7.071115e-01), QTCFLLDT(7.071020e-01), + QTCFLLDT(7.071117e-01), QTCFLLDT(-7.071018e-01), QTCFLLDT(-7.071118e-01), QTCFLLDT(7.071016e-01), + QTCFLLDT(7.071120e-01), QTCFLLDT(-7.071015e-01), QTCFLLDT(-7.071122e-01), QTCFLLDT(7.071013e-01), + QTCFLLDT(7.071124e-01), QTCFLLDT(-7.071011e-01), QTCFLLDT(-7.071126e-01), QTCFLLDT(7.071009e-01), + }; + const FIXP_QTW qmf_phaseshift_sin64_cldfb[64] = { + QTCFLLDT(7.071067e-01), QTCFLLDT(7.071069e-01), QTCFLLDT(-7.071065e-01), QTCFLLDT(-7.071071e-01), + QTCFLLDT(7.071064e-01), QTCFLLDT(7.071073e-01), QTCFLLDT(-7.071062e-01), QTCFLLDT(-7.071075e-01), + QTCFLLDT(7.071060e-01), QTCFLLDT(7.071077e-01), QTCFLLDT(-7.071058e-01), QTCFLLDT(-7.071078e-01), + QTCFLLDT(7.071056e-01), QTCFLLDT(7.071080e-01), QTCFLLDT(-7.071055e-01), QTCFLLDT(-7.071082e-01), + QTCFLLDT(7.071053e-01), QTCFLLDT(7.071084e-01), QTCFLLDT(-7.071050e-01), QTCFLLDT(-7.071086e-01), + QTCFLLDT(7.071049e-01), QTCFLLDT(7.071088e-01), QTCFLLDT(-7.071047e-01), QTCFLLDT(-7.071090e-01), + QTCFLLDT(7.071045e-01), QTCFLLDT(7.071092e-01), QTCFLLDT(-7.071043e-01), QTCFLLDT(-7.071093e-01), + QTCFLLDT(7.071041e-01), QTCFLLDT(7.071095e-01), QTCFLLDT(-7.071040e-01), QTCFLLDT(-7.071097e-01), + QTCFLLDT(7.071038e-01), QTCFLLDT(7.071099e-01), QTCFLLDT(-7.071036e-01), QTCFLLDT(-7.071100e-01), + QTCFLLDT(7.071034e-01), QTCFLLDT(7.071103e-01), QTCFLLDT(-7.071032e-01), QTCFLLDT(-7.071105e-01), + QTCFLLDT(7.071030e-01), QTCFLLDT(7.071106e-01), QTCFLLDT(-7.071028e-01), QTCFLLDT(-7.071108e-01), + QTCFLLDT(7.071027e-01), QTCFLLDT(7.071110e-01), QTCFLLDT(-7.071025e-01), QTCFLLDT(-7.071112e-01), + QTCFLLDT(7.071023e-01), QTCFLLDT(7.071114e-01), QTCFLLDT(-7.071021e-01), QTCFLLDT(-7.071115e-01), + QTCFLLDT(7.071019e-01), QTCFLLDT(7.071117e-01), QTCFLLDT(-7.071017e-01), QTCFLLDT(-7.071120e-01), + QTCFLLDT(7.071015e-01), QTCFLLDT(7.071121e-01), QTCFLLDT(-7.071013e-01), QTCFLLDT(-7.071123e-01), + QTCFLLDT(7.071012e-01), QTCFLLDT(7.071125e-01), QTCFLLDT(-7.071010e-01), QTCFLLDT(-7.071127e-01), +}; + +//@} + +#endif /* #ifdef LOW_POWER_SBR_ONLY */ + + + +/*! + \name QMF + \brief QMF-Table + 64 channels, N = 640, optimized by PE 010516 + + The coeffs are rearranged compared with the reference in the following + way: + sbr_qmf_64[0] = sbr_qmf_64_reference[0]; + sbr_qmf_64[1] = sbr_qmf_64_reference[128]; + sbr_qmf_64[2] = sbr_qmf_64_reference[256]; + sbr_qmf_64[3] = sbr_qmf_64_reference[384]; + sbr_qmf_64[4] = sbr_qmf_64_reference[512]; + + sbr_qmf_64[5] = sbr_qmf_64_reference[1]; + sbr_qmf_64[6] = sbr_qmf_64_reference[129]; + sbr_qmf_64[7] = sbr_qmf_64_reference[257]; + sbr_qmf_64[8] = sbr_qmf_64_reference[385]; + sbr_qmf_64[9] = sbr_qmf_64_reference[513]; + . + . + . + sbr_qmf_64[635] = sbr_qmf_64_reference[127] + sbr_qmf_64[636] = sbr_qmf_64_reference[255]; + sbr_qmf_64[637] = sbr_qmf_64_reference[383]; + sbr_qmf_64[638] = sbr_qmf_64_reference[511]; + sbr_qmf_64[639] = sbr_qmf_64_reference[639]; + + + Symmetric properties of qmf coeffs: + + Use point symmetry: + + sbr_qmf_64_640_qmf[320..634] = p_64_640_qmf[314..0] + + Max sum of all FIR filter absolute coefficients is: 0x7FF5B201 + thus, the filter output is not required to be scaled. + + \showinitializer +*/ +//@{ + +LNK_SECTION_CONSTDATA_L1 +RAM_ALIGN +const FIXP_PFT qmf_cldfb_640[QMF640_CLDFB_PFT_TABLE_SIZE] = +{ + QTCFLLD(6.571760e-07), QTCFLLD(-8.010079e-06), QTCFLLD(-1.250743e-03), QTCFLLD(8.996371e-03), QTCFLLD(5.128557e-01), + QTCFLLD(4.118360e-07), QTCFLLD(-1.469933e-05), QTCFLLD(-1.194743e-03), QTCFLLD(9.640299e-03), QTCFLLD(5.299510e-01), + QTCFLLD(8.109952e-07), QTCFLLD(4.840578e-06), QTCFLLD(-1.151796e-03), QTCFLLD(1.033126e-02), QTCFLLD(5.470652e-01), + QTCFLLD(7.099633e-07), QTCFLLD(7.167101e-06), QTCFLLD(-1.099001e-03), QTCFLLD(1.106959e-02), QTCFLLD(5.641523e-01), + QTCFLLD(6.834210e-07), QTCFLLD(1.088325e-05), QTCFLLD(-1.047655e-03), QTCFLLD(1.186211e-02), QTCFLLD(5.811993e-01), + QTCFLLD(4.292862e-07), QTCFLLD(1.013260e-05), QTCFLLD(-9.862027e-04), QTCFLLD(1.270747e-02), QTCFLLD(5.981877e-01), + QTCFLLD(-5.426597e-09), QTCFLLD(5.869707e-06), QTCFLLD(-9.294665e-04), QTCFLLD(1.361072e-02), QTCFLLD(6.151031e-01), + QTCFLLD(6.355303e-08), QTCFLLD(1.125135e-05), QTCFLLD(-9.767709e-04), QTCFLLD(1.456209e-02), QTCFLLD(6.319284e-01), + QTCFLLD(5.490570e-07), QTCFLLD(2.015445e-05), QTCFLLD(-1.040598e-03), QTCFLLD(1.557759e-02), QTCFLLD(6.486438e-01), + QTCFLLD(1.620171e-06), QTCFLLD(2.800456e-05), QTCFLLD(-1.146268e-03), QTCFLLD(1.665188e-02), QTCFLLD(6.652304e-01), + QTCFLLD(-6.025110e-10), QTCFLLD(8.975978e-06), QTCFLLD(-1.292866e-03), QTCFLLD(1.778249e-02), QTCFLLD(6.816668e-01), + QTCFLLD(-6.325664e-10), QTCFLLD(8.563820e-06), QTCFLLD(-1.196638e-03), QTCFLLD(1.897506e-02), QTCFLLD(6.979337e-01), + QTCFLLD(-4.013525e-09), QTCFLLD(1.168895e-05), QTCFLLD(-9.726699e-04), QTCFLLD(2.023525e-02), QTCFLLD(7.140087e-01), + QTCFLLD(-4.244091e-09), QTCFLLD(7.300589e-06), QTCFLLD(-8.029620e-04), QTCFLLD(2.156305e-02), QTCFLLD(7.298746e-01), + QTCFLLD(-1.846548e-08), QTCFLLD(3.965364e-06), QTCFLLD(-6.754936e-04), QTCFLLD(2.296471e-02), QTCFLLD(7.455112e-01), + QTCFLLD(-3.870537e-09), QTCFLLD(1.374896e-06), QTCFLLD(-5.791145e-04), QTCFLLD(2.443434e-02), QTCFLLD(7.609051e-01), + QTCFLLD(-8.883499e-10), QTCFLLD(3.798520e-07), QTCFLLD(-4.733148e-04), QTCFLLD(2.597957e-02), QTCFLLD(7.760386e-01), + QTCFLLD(5.303528e-08), QTCFLLD(4.469729e-06), QTCFLLD(-2.998740e-04), QTCFLLD(2.760091e-02), QTCFLLD(7.908995e-01), + QTCFLLD(7.391974e-08), QTCFLLD(2.461877e-05), QTCFLLD(7.882620e-05), QTCFLLD(2.931526e-02), QTCFLLD(8.054701e-01), + QTCFLLD(1.723217e-09), QTCFLLD(4.005269e-05), QTCFLLD(4.708010e-04), QTCFLLD(3.110861e-02), QTCFLLD(8.197387e-01), + QTCFLLD(2.443085e-07), QTCFLLD(5.272982e-05), QTCFLLD(8.089812e-04), QTCFLLD(3.298151e-02), QTCFLLD(8.336864e-01), + QTCFLLD(1.387567e-08), QTCFLLD(4.939392e-05), QTCFLLD(1.127142e-03), QTCFLLD(3.493300e-02), QTCFLLD(8.472987e-01), + QTCFLLD(-5.690531e-06), QTCFLLD(-4.256442e-05), QTCFLLD(1.417367e-03), QTCFLLD(3.696343e-02), QTCFLLD(8.605543e-01), + QTCFLLD(3.629067e-06), QTCFLLD(6.582328e-05), QTCFLLD(1.725030e-03), QTCFLLD(3.907138e-02), QTCFLLD(8.734367e-01), + QTCFLLD(-5.393556e-08), QTCFLLD(6.481921e-05), QTCFLLD(1.948069e-03), QTCFLLD(4.125570e-02), QTCFLLD(8.859232e-01), + QTCFLLD(1.349944e-07), QTCFLLD(3.367998e-05), QTCFLLD(2.033465e-03), QTCFLLD(4.355568e-02), QTCFLLD(8.979959e-01), + QTCFLLD(7.326611e-09), QTCFLLD(4.694252e-05), QTCFLLD(2.239143e-03), QTCFLLD(4.599068e-02), QTCFLLD(9.096311e-01), + QTCFLLD(2.399696e-07), QTCFLLD(6.904415e-05), QTCFLLD(2.470456e-03), QTCFLLD(4.849285e-02), QTCFLLD(9.208195e-01), + QTCFLLD(3.330982e-07), QTCFLLD(5.643103e-05), QTCFLLD(2.630472e-03), QTCFLLD(5.105621e-02), QTCFLLD(9.315442e-01), + QTCFLLD(4.767794e-07), QTCFLLD(7.095887e-05), QTCFLLD(2.703019e-03), QTCFLLD(5.368313e-02), QTCFLLD(9.417976e-01), + QTCFLLD(3.428661e-07), QTCFLLD(7.872593e-05), QTCFLLD(2.729137e-03), QTCFLLD(5.637219e-02), QTCFLLD(9.515675e-01), + QTCFLLD(8.676848e-06), QTCFLLD(2.666445e-04), QTCFLLD(2.719749e-03), QTCFLLD(5.911363e-02), QTCFLLD(9.608520e-01), + QTCFLLD(2.722296e-05), QTCFLLD(5.822201e-04), QTCFLLD(2.530907e-03), QTCFLLD(6.192693e-02), QTCFLLD(9.696426e-01), + QTCFLLD(3.575651e-07), QTCFLLD(7.870355e-05), QTCFLLD(2.225524e-03), QTCFLLD(6.480449e-02), QTCFLLD(9.779405e-01), + QTCFLLD(6.293002e-07), QTCFLLD(7.245096e-05), QTCFLLD(1.891972e-03), QTCFLLD(6.771675e-02), QTCFLLD(9.857388e-01), + QTCFLLD(1.070243e-06), QTCFLLD(7.194151e-05), QTCFLLD(1.557112e-03), QTCFLLD(7.064948e-02), QTCFLLD(9.930380e-01), + QTCFLLD(-3.225913e-07), QTCFLLD(-7.679955e-05), QTCFLLD(1.194731e-03), QTCFLLD(7.360559e-02), QTCFLLD(9.998286e-01), + QTCFLLD(-9.597516e-09), QTCFLLD(-6.093373e-05), QTCFLLD(6.415402e-04), QTCFLLD(7.657650e-02), QTCFLLD(1.006109e+00), + QTCFLLD(-8.908041e-08), QTCFLLD(-1.721347e-05), QTCFLLD(1.092526e-04), QTCFLLD(7.955571e-02), QTCFLLD(1.011868e+00), + QTCFLLD(-2.285563e-05), QTCFLLD(-8.882305e-05), QTCFLLD(2.934876e-04), QTCFLLD(8.251962e-02), QTCFLLD(1.017100e+00), + QTCFLLD(1.013575e-05), QTCFLLD(6.418658e-05), QTCFLLD(5.721223e-04), QTCFLLD(8.547716e-02), QTCFLLD(1.021799e+00), + QTCFLLD(-1.706941e-05), QTCFLLD(1.769262e-04), QTCFLLD(6.976561e-04), QTCFLLD(8.841813e-02), QTCFLLD(1.025967e+00), + QTCFLLD(1.356728e-06), QTCFLLD(2.206341e-05), QTCFLLD(7.376101e-04), QTCFLLD(9.133591e-02), QTCFLLD(1.029601e+00), + QTCFLLD(-1.398913e-08), QTCFLLD(-6.538879e-06), QTCFLLD(7.154124e-04), QTCFLLD(9.421624e-02), QTCFLLD(1.032713e+00), + QTCFLLD(3.552992e-08), QTCFLLD(-1.052707e-05), QTCFLLD(7.139920e-04), QTCFLLD(9.705240e-02), QTCFLLD(1.035312e+00), + QTCFLLD(4.211177e-07), QTCFLLD(-9.075431e-06), QTCFLLD(6.944123e-04), QTCFLLD(9.982958e-02), QTCFLLD(1.037422e+00), + QTCFLLD(5.433719e-07), QTCFLLD(-1.748285e-05), QTCFLLD(6.766320e-04), QTCFLLD(1.025398e-01), QTCFLLD(1.039062e+00), + QTCFLLD(8.226600e-08), QTCFLLD(-3.498286e-05), QTCFLLD(6.887784e-04), QTCFLLD(1.051642e-01), QTCFLLD(1.040262e+00), + QTCFLLD(1.272705e-07), QTCFLLD(-4.489491e-05), QTCFLLD(6.673250e-04), QTCFLLD(1.076972e-01), QTCFLLD(1.041043e+00), + QTCFLLD(2.542598e-07), QTCFLLD(-5.449816e-05), QTCFLLD(5.970697e-04), QTCFLLD(1.101216e-01), QTCFLLD(1.041434e+00), + QTCFLLD(6.322770e-07), QTCFLLD(-5.874199e-05), QTCFLLD(4.749931e-04), QTCFLLD(1.124296e-01), QTCFLLD(1.041443e+00), + QTCFLLD(2.801882e-08), QTCFLLD(-7.934510e-05), QTCFLLD(3.189336e-04), QTCFLLD(1.146042e-01), QTCFLLD(1.041087e+00), + QTCFLLD(5.891904e-07), QTCFLLD(-8.039232e-05), QTCFLLD(1.218226e-04), QTCFLLD(1.166399e-01), QTCFLLD(1.040350e+00), + QTCFLLD(7.301957e-07), QTCFLLD(-9.907631e-05), QTCFLLD(-1.324292e-04), QTCFLLD(1.185243e-01), QTCFLLD(1.039228e+00), + QTCFLLD(-4.518603e-06), QTCFLLD(-2.217025e-04), QTCFLLD(-4.268575e-04), QTCFLLD(1.202546e-01), QTCFLLD(1.037683e+00), + QTCFLLD(-3.561585e-06), QTCFLLD(-2.415166e-04), QTCFLLD(-7.804546e-04), QTCFLLD(1.218184e-01), QTCFLLD(1.035694e+00), + QTCFLLD(-1.074717e-07), QTCFLLD(-2.123672e-04), QTCFLLD(-1.156680e-03), QTCFLLD(1.232132e-01), QTCFLLD(1.033206e+00), + QTCFLLD(1.323268e-06), QTCFLLD(-2.078299e-04), QTCFLLD(-1.525819e-03), QTCFLLD(1.244270e-01), QTCFLLD(1.030199e+00), + QTCFLLD(3.377815e-06), QTCFLLD(-1.885286e-04), QTCFLLD(-1.914115e-03), QTCFLLD(1.254605e-01), QTCFLLD(1.026616e+00), + QTCFLLD(5.161607e-06), QTCFLLD(-1.728673e-04), QTCFLLD(-2.292814e-03), QTCFLLD(1.262996e-01), QTCFLLD(1.022470e+00), + QTCFLLD(5.924001e-06), QTCFLLD(-1.744842e-04), QTCFLLD(-2.658042e-03), QTCFLLD(1.269416e-01), QTCFLLD(1.017729e+00), + QTCFLLD(6.310208e-06), QTCFLLD(-1.784193e-04), QTCFLLD(-3.000423e-03), QTCFLLD(1.273648e-01), QTCFLLD(1.012508e+00), + QTCFLLD(3.357219e-06), QTCFLLD(-2.131406e-04), QTCFLLD(-3.318858e-03), QTCFLLD(1.275561e-01), QTCFLLD(1.006893e+00), + QTCFLLD(5.189087e-06), QTCFLLD(-2.078886e-04), QTCFLLD(-3.597476e-03), QTCFLLD(1.274568e-01), QTCFLLD(1.001463e+00), + QTCFLLD(4.178050e-06), QTCFLLD(-4.663778e-05), QTCFLLD(-3.870852e-03), QTCFLLD(1.273591e-01), QTCFLLD(9.927544e-01), + QTCFLLD(5.364807e-06), QTCFLLD(-5.889277e-06), QTCFLLD(-4.135130e-03), QTCFLLD(1.272499e-01), QTCFLLD(9.807692e-01), + QTCFLLD(4.083719e-06), QTCFLLD(-1.774108e-05), QTCFLLD(-4.351668e-03), QTCFLLD(1.268281e-01), QTCFLLD(9.690017e-01), + QTCFLLD(3.567581e-06), QTCFLLD(-2.599468e-08), QTCFLLD(-4.517190e-03), QTCFLLD(1.261262e-01), QTCFLLD(9.568886e-01), + QTCFLLD(3.262754e-06), QTCFLLD(1.260640e-05), QTCFLLD(-4.636228e-03), QTCFLLD(1.251477e-01), QTCFLLD(9.443803e-01), + QTCFLLD(2.041128e-06), QTCFLLD(2.364519e-05), QTCFLLD(-4.704321e-03), QTCFLLD(1.238869e-01), QTCFLLD(9.313874e-01), + QTCFLLD(-2.567965e-08), QTCFLLD(2.806963e-05), QTCFLLD(-4.722568e-03), QTCFLLD(1.223371e-01), QTCFLLD(9.179666e-01), + QTCFLLD(2.714879e-07), QTCFLLD(4.493916e-05), QTCFLLD(-4.663276e-03), QTCFLLD(1.204854e-01), QTCFLLD(9.041286e-01), + QTCFLLD(2.150884e-06), QTCFLLD(5.408155e-05), QTCFLLD(-4.554811e-03), QTCFLLD(1.183233e-01), QTCFLLD(8.899474e-01), + QTCFLLD(5.818595e-06), QTCFLLD(3.759630e-05), QTCFLLD(-4.369554e-03), QTCFLLD(1.158359e-01), QTCFLLD(8.754641e-01), + QTCFLLD(-1.686137e-09), QTCFLLD(2.515118e-05), QTCFLLD(-4.091033e-03), QTCFLLD(1.130180e-01), QTCFLLD(8.607492e-01), + QTCFLLD(-1.775191e-09), QTCFLLD(2.406517e-05), QTCFLLD(-3.794425e-03), QTCFLLD(1.098551e-01), QTCFLLD(8.458450e-01), + QTCFLLD(-2.222072e-09), QTCFLLD(3.628511e-05), QTCFLLD(-3.460363e-03), QTCFLLD(1.063455e-01), QTCFLLD(8.308040e-01), + QTCFLLD(-1.280675e-08), QTCFLLD(2.241546e-05), QTCFLLD(-3.064311e-03), QTCFLLD(1.024805e-01), QTCFLLD(8.156523e-01), + QTCFLLD(-6.977078e-08), QTCFLLD(1.499170e-05), QTCFLLD(-2.621537e-03), QTCFLLD(9.826251e-02), QTCFLLD(8.004165e-01), + QTCFLLD(-1.409927e-08), QTCFLLD(5.009913e-06), QTCFLLD(-2.124648e-03), QTCFLLD(9.368652e-02), QTCFLLD(7.851012e-01), + QTCFLLD(-2.986489e-09), QTCFLLD(1.277184e-06), QTCFLLD(-1.594861e-03), QTCFLLD(8.875756e-02), QTCFLLD(7.697093e-01), + QTCFLLD(1.876022e-07), QTCFLLD(1.580189e-05), QTCFLLD(-1.061499e-03), QTCFLLD(8.347151e-02), QTCFLLD(7.542294e-01), + QTCFLLD(1.737277e-07), QTCFLLD(5.533953e-05), QTCFLLD(-6.169855e-04), QTCFLLD(7.783300e-02), QTCFLLD(7.386515e-01), + QTCFLLD(3.818589e-09), QTCFLLD(8.870182e-05), QTCFLLD(-2.004823e-04), QTCFLLD(7.184074e-02), QTCFLLD(7.229599e-01), + QTCFLLD(5.143615e-07), QTCFLLD(1.035783e-04), QTCFLLD(2.048499e-04), QTCFLLD(6.550209e-02), QTCFLLD(7.071448e-01), + QTCFLLD(2.820292e-08), QTCFLLD(9.990758e-05), QTCFLLD(5.621721e-04), QTCFLLD(5.881297e-02), QTCFLLD(6.911982e-01), + QTCFLLD(4.677016e-06), QTCFLLD(1.181078e-04), QTCFLLD(9.373975e-04), QTCFLLD(5.177965e-02), QTCFLLD(6.751199e-01), + QTCFLLD(3.361682e-06), QTCFLLD(2.126365e-05), QTCFLLD(1.344657e-03), QTCFLLD(4.439684e-02), QTCFLLD(6.589149e-01), + QTCFLLD(-4.880845e-08), QTCFLLD(5.861800e-05), QTCFLLD(1.812176e-03), QTCFLLD(3.666943e-02), QTCFLLD(6.425940e-01), + QTCFLLD(2.267731e-07), QTCFLLD(5.021906e-05), QTCFLLD(2.172866e-03), QTCFLLD(2.857528e-02), QTCFLLD(6.261725e-01), + QTCFLLD(5.158213e-09), QTCFLLD(4.150075e-05), QTCFLLD(1.985825e-03), QTCFLLD(2.012237e-02), QTCFLLD(6.096690e-01), + QTCFLLD(-2.066962e-07), QTCFLLD(3.799972e-05), QTCFLLD(1.697653e-03), QTCFLLD(1.132324e-02), QTCFLLD(5.930982e-01), + QTCFLLD(4.883305e-07), QTCFLLD(6.606462e-05), QTCFLLD(1.471167e-03), QTCFLLD(2.184257e-03), QTCFLLD(5.764735e-01), + QTCFLLD(8.254430e-07), QTCFLLD(9.755685e-05), QTCFLLD(1.232134e-03), QTCFLLD(-7.298198e-03), QTCFLLD(5.598052e-01), + QTCFLLD(9.464783e-07), QTCFLLD(1.831121e-04), QTCFLLD(8.990256e-04), QTCFLLD(-1.711324e-02), QTCFLLD(5.430990e-01), + QTCFLLD(-1.232693e-05), QTCFLLD(-5.901618e-07), QTCFLLD(6.150317e-04), QTCFLLD(-2.726484e-02), QTCFLLD(5.263554e-01), + QTCFLLD(3.867483e-05), QTCFLLD(-3.595054e-04), QTCFLLD(6.307841e-04), QTCFLLD(-3.775928e-02), QTCFLLD(5.095721e-01), + QTCFLLD(-9.870548e-07), QTCFLLD(-1.815837e-04), QTCFLLD(4.366447e-04), QTCFLLD(-4.859006e-02), QTCFLLD(4.927464e-01), + QTCFLLD(-1.089501e-06), QTCFLLD(-9.204876e-05), QTCFLLD(1.498232e-04), QTCFLLD(-5.973742e-02), QTCFLLD(4.758754e-01), + QTCFLLD(-1.569003e-06), QTCFLLD(-5.192444e-05), QTCFLLD(-9.099723e-05), QTCFLLD(-7.120357e-02), QTCFLLD(4.589583e-01), + QTCFLLD(-2.778618e-07), QTCFLLD(6.487880e-05), QTCFLLD(-3.337967e-04), QTCFLLD(-8.298103e-02), QTCFLLD(4.420014e-01), + QTCFLLD(6.757015e-09), QTCFLLD(5.397065e-05), QTCFLLD(-5.599348e-04), QTCFLLD(-9.506967e-02), QTCFLLD(4.250144e-01), + QTCFLLD(1.496436e-07), QTCFLLD(2.472024e-05), QTCFLLD(-7.677634e-04), QTCFLLD(-1.074631e-01), QTCFLLD(4.080155e-01), + QTCFLLD(2.068297e-05), QTCFLLD(9.711682e-05), QTCFLLD(-9.730460e-04), QTCFLLD(-1.201629e-01), QTCFLLD(3.910244e-01), + QTCFLLD(-9.388963e-06), QTCFLLD(5.144969e-05), QTCFLLD(-1.131860e-03), QTCFLLD(-1.331545e-01), QTCFLLD(3.740644e-01), + QTCFLLD(-1.402925e-05), QTCFLLD(-1.039264e-04), QTCFLLD(-1.283281e-03), QTCFLLD(-1.464389e-01), QTCFLLD(3.571528e-01), + QTCFLLD(-2.757611e-06), QTCFLLD(2.853437e-06), QTCFLLD(-1.480543e-03), QTCFLLD(-1.600062e-01), QTCFLLD(3.403074e-01), + QTCFLLD(2.945239e-08), QTCFLLD(1.334091e-05), QTCFLLD(-1.699161e-03), QTCFLLD(-1.738542e-01), QTCFLLD(3.235299e-01), + QTCFLLD(-7.873304e-08), QTCFLLD(2.443161e-05), QTCFLLD(-1.924845e-03), QTCFLLD(-1.879712e-01), QTCFLLD(3.068187e-01), + QTCFLLD(-9.897194e-07), QTCFLLD(3.568555e-05), QTCFLLD(-2.152380e-03), QTCFLLD(-2.023548e-01), QTCFLLD(2.901491e-01), + QTCFLLD(-1.922074e-06), QTCFLLD(6.193370e-05), QTCFLLD(-2.396404e-03), QTCFLLD(-2.169926e-01), QTCFLLD(2.734977e-01), + QTCFLLD(-2.765650e-07), QTCFLLD(1.176237e-04), QTCFLLD(-2.653819e-03), QTCFLLD(-2.318815e-01), QTCFLLD(2.568176e-01), + QTCFLLD(-4.636105e-07), QTCFLLD(1.635906e-04), QTCFLLD(-2.927159e-03), QTCFLLD(-2.470098e-01), QTCFLLD(2.400768e-01), + QTCFLLD(-9.607069e-07), QTCFLLD(2.060394e-04), QTCFLLD(-3.209093e-03), QTCFLLD(-2.623749e-01), QTCFLLD(2.232277e-01), + QTCFLLD(-1.907927e-06), QTCFLLD(2.346981e-04), QTCFLLD(-3.505531e-03), QTCFLLD(-2.779638e-01), QTCFLLD(2.062605e-01), + QTCFLLD(-1.551251e-08), QTCFLLD(2.520607e-04), QTCFLLD(-3.811612e-03), QTCFLLD(-2.937725e-01), QTCFLLD(1.891590e-01), + QTCFLLD(-1.653464e-06), QTCFLLD(2.556450e-04), QTCFLLD(-4.133640e-03), QTCFLLD(-3.097862e-01), QTCFLLD(1.719726e-01), + QTCFLLD(-2.043464e-06), QTCFLLD(3.157664e-04), QTCFLLD(-4.448993e-03), QTCFLLD(-3.259994e-01), QTCFLLD(1.547461e-01), + QTCFLLD(1.622786e-05), QTCFLLD(6.205676e-04), QTCFLLD(-4.754192e-03), QTCFLLD(-3.423942e-01), QTCFLLD(1.376150e-01), + QTCFLLD(1.395221e-05), QTCFLLD(7.847840e-04), QTCFLLD(-5.063851e-03), QTCFLLD(-3.589627e-01), QTCFLLD(1.206924e-01), + QTCFLLD(4.591010e-07), QTCFLLD(9.019129e-04), QTCFLLD(-5.394570e-03), QTCFLLD(-3.756822e-01), QTCFLLD(1.042033e-01), + QTCFLLD(-6.261944e-06), QTCFLLD(1.054963e-03), QTCFLLD(-5.741103e-03), QTCFLLD(-3.925409e-01), QTCFLLD(8.829745e-02), + QTCFLLD(-1.606051e-05), QTCFLLD(1.089429e-03), QTCFLLD(-6.109179e-03), QTCFLLD(-4.095160e-01), QTCFLLD(7.325979e-02), + QTCFLLD(-2.464228e-05), QTCFLLD(1.122503e-03), QTCFLLD(-6.500503e-03), QTCFLLD(-4.265950e-01), QTCFLLD(5.918678e-02), + QTCFLLD(-2.976824e-05), QTCFLLD(1.177515e-03), QTCFLLD(-6.925141e-03), QTCFLLD(-4.437530e-01), QTCFLLD(4.634696e-02), + QTCFLLD(-3.177468e-05), QTCFLLD(1.226113e-03), QTCFLLD(-7.380544e-03), QTCFLLD(-4.609829e-01), QTCFLLD(3.450719e-02), + QTCFLLD(-4.373302e-05), QTCFLLD(1.263569e-03), QTCFLLD(-7.876393e-03), QTCFLLD(-4.782650e-01), QTCFLLD(2.353060e-02), + QTCFLLD(-3.299004e-05), QTCFLLD(1.287819e-03), QTCFLLD(-8.407749e-03), QTCFLLD(-4.956175e-01), QTCFLLD(1.129580e-02), +}; + +RAM_ALIGN +const FIXP_PFT qmf_cldfb_320[QMF320_CLDFB_PFT_TABLE_SIZE] = +{ +QTCFLLD(5.345060e-07), QTCFLLD(-1.135471e-05), QTCFLLD(-1.222743e-03), QTCFLLD(9.318335e-03), QTCFLLD(5.214033e-01), +QTCFLLD(7.604792e-07), QTCFLLD(6.003839e-06), QTCFLLD(-1.125398e-03), QTCFLLD(1.070043e-02), QTCFLLD(5.556087e-01), +QTCFLLD(5.563536e-07), QTCFLLD(1.050792e-05), QTCFLLD(-1.016929e-03), QTCFLLD(1.228479e-02), QTCFLLD(5.896935e-01), +QTCFLLD(2.906322e-08), QTCFLLD(8.560527e-06), QTCFLLD(-9.531187e-04), QTCFLLD(1.408640e-02), QTCFLLD(6.235157e-01), +QTCFLLD(1.084614e-06), QTCFLLD(2.407951e-05), QTCFLLD(-1.093433e-03), QTCFLLD(1.611474e-02), QTCFLLD(6.569371e-01), +QTCFLLD(-6.175387e-10), QTCFLLD(8.769899e-06), QTCFLLD(-1.244752e-03), QTCFLLD(1.837877e-02), QTCFLLD(6.898003e-01), +QTCFLLD(-4.128808e-09), QTCFLLD(9.494767e-06), QTCFLLD(-8.878160e-04), QTCFLLD(2.089915e-02), QTCFLLD(7.219416e-01), +QTCFLLD(-1.116801e-08), QTCFLLD(2.670130e-06), QTCFLLD(-6.273041e-04), QTCFLLD(2.369952e-02), QTCFLLD(7.532082e-01), +QTCFLLD(2.607347e-08), QTCFLLD(2.424790e-06), QTCFLLD(-3.865944e-04), QTCFLLD(2.679024e-02), QTCFLLD(7.834691e-01), +QTCFLLD(3.782148e-08), QTCFLLD(3.233573e-05), QTCFLLD(2.748136e-04), QTCFLLD(3.021193e-02), QTCFLLD(8.126044e-01), +QTCFLLD(1.290921e-07), QTCFLLD(5.106187e-05), QTCFLLD(9.680615e-04), QTCFLLD(3.395726e-02), QTCFLLD(8.404925e-01), +QTCFLLD(-1.030732e-06), QTCFLLD(1.162943e-05), QTCFLLD(1.571198e-03), QTCFLLD(3.801740e-02), QTCFLLD(8.669955e-01), +QTCFLLD(4.052940e-08), QTCFLLD(4.924960e-05), QTCFLLD(1.990767e-03), QTCFLLD(4.240569e-02), QTCFLLD(8.919595e-01), +QTCFLLD(1.236481e-07), QTCFLLD(5.799333e-05), QTCFLLD(2.354800e-03), QTCFLLD(4.724177e-02), QTCFLLD(9.152253e-01), +QTCFLLD(4.049388e-07), QTCFLLD(6.369496e-05), QTCFLLD(2.666746e-03), QTCFLLD(5.236967e-02), QTCFLLD(9.366709e-01), +QTCFLLD(4.509857e-06), QTCFLLD(1.726852e-04), QTCFLLD(2.724443e-03), QTCFLLD(5.774291e-02), QTCFLLD(9.562097e-01), +QTCFLLD(1.379026e-05), QTCFLLD(3.304619e-04), QTCFLLD(2.378216e-03), QTCFLLD(6.336571e-02), QTCFLLD(9.737916e-01), +QTCFLLD(8.497715e-07), QTCFLLD(7.219624e-05), QTCFLLD(1.724542e-03), QTCFLLD(6.918311e-02), QTCFLLD(9.893883e-01), +QTCFLLD(-1.660944e-07), QTCFLLD(-6.886664e-05), QTCFLLD(9.181354e-04), QTCFLLD(7.509105e-02), QTCFLLD(1.002969e+00), +QTCFLLD(-1.147235e-05), QTCFLLD(-5.301826e-05), QTCFLLD(2.013701e-04), QTCFLLD(8.103766e-02), QTCFLLD(1.014484e+00), +QTCFLLD(-3.466829e-06), QTCFLLD(1.205564e-04), QTCFLLD(6.348892e-04), QTCFLLD(8.694765e-02), QTCFLLD(1.023883e+00), +QTCFLLD(6.713692e-07), QTCFLLD(7.762268e-06), QTCFLLD(7.265112e-04), QTCFLLD(9.277608e-02), QTCFLLD(1.031157e+00), +QTCFLLD(2.283238e-07), QTCFLLD(-9.801253e-06), QTCFLLD(7.042022e-04), QTCFLLD(9.844099e-02), QTCFLLD(1.036367e+00), +QTCFLLD(3.128189e-07), QTCFLLD(-2.623285e-05), QTCFLLD(6.827052e-04), QTCFLLD(1.038520e-01), QTCFLLD(1.039662e+00), +QTCFLLD(1.907652e-07), QTCFLLD(-4.969654e-05), QTCFLLD(6.321974e-04), QTCFLLD(1.089094e-01), QTCFLLD(1.041239e+00), +QTCFLLD(3.301479e-07), QTCFLLD(-6.904354e-05), QTCFLLD(3.969634e-04), QTCFLLD(1.135169e-01), QTCFLLD(1.041265e+00), +QTCFLLD(6.596931e-07), QTCFLLD(-8.973431e-05), QTCFLLD(-5.303260e-06), QTCFLLD(1.175821e-01), QTCFLLD(1.039789e+00), +QTCFLLD(-4.040094e-06), QTCFLLD(-2.316096e-04), QTCFLLD(-6.036561e-04), QTCFLLD(1.210365e-01), QTCFLLD(1.036689e+00), +QTCFLLD(6.078980e-07), QTCFLLD(-2.100985e-04), QTCFLLD(-1.341249e-03), QTCFLLD(1.238201e-01), QTCFLLD(1.031702e+00), +QTCFLLD(4.269711e-06), QTCFLLD(-1.806979e-04), QTCFLLD(-2.103464e-03), QTCFLLD(1.258800e-01), QTCFLLD(1.024543e+00), +QTCFLLD(6.117105e-06), QTCFLLD(-1.764517e-04), QTCFLLD(-2.829232e-03), QTCFLLD(1.271532e-01), QTCFLLD(1.015119e+00), +QTCFLLD(4.273153e-06), QTCFLLD(-2.105146e-04), QTCFLLD(-3.458167e-03), QTCFLLD(1.275064e-01), QTCFLLD(1.004178e+00), +QTCFLLD(4.771428e-06), QTCFLLD(-2.626353e-05), QTCFLLD(-4.002991e-03), QTCFLLD(1.273045e-01), QTCFLLD(9.867618e-01), +QTCFLLD(3.825650e-06), QTCFLLD(-8.883540e-06), QTCFLLD(-4.434429e-03), QTCFLLD(1.264771e-01), QTCFLLD(9.629451e-01), +QTCFLLD(2.651941e-06), QTCFLLD(1.812579e-05), QTCFLLD(-4.670274e-03), QTCFLLD(1.245173e-01), QTCFLLD(9.378839e-01), +QTCFLLD(1.229041e-07), QTCFLLD(3.650440e-05), QTCFLLD(-4.692922e-03), QTCFLLD(1.214113e-01), QTCFLLD(9.110476e-01), +QTCFLLD(3.984739e-06), QTCFLLD(4.583892e-05), QTCFLLD(-4.462183e-03), QTCFLLD(1.170796e-01), QTCFLLD(8.827057e-01), +QTCFLLD(-1.730664e-09), QTCFLLD(2.460818e-05), QTCFLLD(-3.942729e-03), QTCFLLD(1.114366e-01), QTCFLLD(8.532971e-01), +QTCFLLD(-7.514413e-09), QTCFLLD(2.935029e-05), QTCFLLD(-3.262337e-03), QTCFLLD(1.044130e-01), QTCFLLD(8.232281e-01), +QTCFLLD(-4.193503e-08), QTCFLLD(1.000081e-05), QTCFLLD(-2.373092e-03), QTCFLLD(9.597452e-02), QTCFLLD(7.927589e-01), +QTCFLLD(9.230786e-08), QTCFLLD(8.539538e-06), QTCFLLD(-1.328180e-03), QTCFLLD(8.611453e-02), QTCFLLD(7.619694e-01), +QTCFLLD(8.877312e-08), QTCFLLD(7.202067e-05), QTCFLLD(-4.087339e-04), QTCFLLD(7.483687e-02), QTCFLLD(7.308058e-01), +QTCFLLD(2.712822e-07), QTCFLLD(1.017429e-04), QTCFLLD(3.835110e-04), QTCFLLD(6.215753e-02), QTCFLLD(6.991715e-01), +QTCFLLD(4.019349e-06), QTCFLLD(6.968570e-05), QTCFLLD(1.141027e-03), QTCFLLD(4.808825e-02), QTCFLLD(6.670174e-01), +QTCFLLD(8.898233e-08), QTCFLLD(5.441853e-05), QTCFLLD(1.992521e-03), QTCFLLD(3.262236e-02), QTCFLLD(6.343833e-01), +QTCFLLD(-1.007690e-07), QTCFLLD(3.975024e-05), QTCFLLD(1.841739e-03), QTCFLLD(1.572281e-02), QTCFLLD(6.013836e-01), +QTCFLLD(6.568868e-07), QTCFLLD(8.181074e-05), QTCFLLD(1.351651e-03), QTCFLLD(-2.556970e-03), QTCFLLD(5.681393e-01), +QTCFLLD(-5.690228e-06), QTCFLLD(9.126098e-05), QTCFLLD(7.570286e-04), QTCFLLD(-2.218904e-02), QTCFLLD(5.347272e-01), +QTCFLLD(1.884389e-05), QTCFLLD(-2.705446e-04), QTCFLLD(5.337144e-04), QTCFLLD(-4.317467e-02), QTCFLLD(5.011593e-01), +QTCFLLD(-1.329252e-06), QTCFLLD(-7.198660e-05), QTCFLLD(2.941296e-05), QTCFLLD(-6.547049e-02), QTCFLLD(4.674168e-01), +QTCFLLD(-1.355524e-07), QTCFLLD(5.942472e-05), QTCFLLD(-4.468657e-04), QTCFLLD(-8.902535e-02), QTCFLLD(4.335079e-01), +QTCFLLD(1.041631e-05), QTCFLLD(6.091853e-05), QTCFLLD(-8.704047e-04), QTCFLLD(-1.138130e-01), QTCFLLD(3.995200e-01), +QTCFLLD(-1.170911e-05), QTCFLLD(-2.623833e-05), QTCFLLD(-1.207570e-03), QTCFLLD(-1.397967e-01), QTCFLLD(3.656086e-01), +QTCFLLD(-1.364079e-06), QTCFLLD(8.097173e-06), QTCFLLD(-1.589852e-03), QTCFLLD(-1.669302e-01), QTCFLLD(3.319187e-01), +QTCFLLD(-5.342262e-07), QTCFLLD(3.005858e-05), QTCFLLD(-2.038612e-03), QTCFLLD(-1.951630e-01), QTCFLLD(2.984839e-01), +QTCFLLD(-1.099320e-06), QTCFLLD(8.977871e-05), QTCFLLD(-2.525111e-03), QTCFLLD(-2.244371e-01), QTCFLLD(2.651577e-01), +QTCFLLD(-7.121587e-07), QTCFLLD(1.848150e-04), QTCFLLD(-3.068126e-03), QTCFLLD(-2.546924e-01), QTCFLLD(2.316523e-01), +QTCFLLD(-9.617199e-07), QTCFLLD(2.433794e-04), QTCFLLD(-3.658572e-03), QTCFLLD(-2.858681e-01), QTCFLLD(1.977098e-01), +QTCFLLD(-1.848464e-06), QTCFLLD(2.857057e-04), QTCFLLD(-4.291316e-03), QTCFLLD(-3.178928e-01), QTCFLLD(1.633594e-01), +QTCFLLD(1.509004e-05), QTCFLLD(7.026758e-04), QTCFLLD(-4.909021e-03), QTCFLLD(-3.506784e-01), QTCFLLD(1.291537e-01), +QTCFLLD(-2.901422e-06), QTCFLLD(9.784381e-04), QTCFLLD(-5.567837e-03), QTCFLLD(-3.841116e-01), QTCFLLD(9.625038e-02), +QTCFLLD(-2.035140e-05), QTCFLLD(1.105966e-03), QTCFLLD(-6.304841e-03), QTCFLLD(-4.180555e-01), QTCFLLD(6.622328e-02), +QTCFLLD(-3.077146e-05), QTCFLLD(1.201814e-03), QTCFLLD(-7.152842e-03), QTCFLLD(-4.523680e-01), QTCFLLD(4.042707e-02), +QTCFLLD(-3.836153e-05), QTCFLLD(1.275694e-03), QTCFLLD(-8.142071e-03), QTCFLLD(-4.869413e-01), QTCFLLD(1.741320e-02), +}; + + + + + + +//@{ +/*! + \name DCT_II twiddle factors, L=64 +*/ +/*! sin (3.14159265358979323 / (2*L) * n) , L=64*/ +LNK_SECTION_CONSTDATA +RAM_ALIGN +const FIXP_WTP sin_twiddle_L64[]= +{ + WTCP(0x7fffffff, 0x00000000), WTCP(0x7ff62182, 0x03242abf), WTCP(0x7fd8878e, 0x0647d97c), WTCP(0x7fa736b4, 0x096a9049), + WTCP(0x7f62368f, 0x0c8bd35e), WTCP(0x7f0991c4, 0x0fab272b), WTCP(0x7e9d55fc, 0x12c8106f), WTCP(0x7e1d93ea, 0x15e21445), + WTCP(0x7d8a5f40, 0x18f8b83c), WTCP(0x7ce3ceb2, 0x1c0b826a), WTCP(0x7c29fbee, 0x1f19f97b), WTCP(0x7b5d039e, 0x2223a4c5), + WTCP(0x7a7d055b, 0x25280c5e), WTCP(0x798a23b1, 0x2826b928), WTCP(0x78848414, 0x2b1f34eb), WTCP(0x776c4edb, 0x2e110a62), + WTCP(0x7641af3d, 0x30fbc54d), WTCP(0x7504d345, 0x33def287), WTCP(0x73b5ebd1, 0x36ba2014), WTCP(0x72552c85, 0x398cdd32), + WTCP(0x70e2cbc6, 0x3c56ba70), WTCP(0x6f5f02b2, 0x3f1749b8), WTCP(0x6dca0d14, 0x41ce1e65), WTCP(0x6c242960, 0x447acd50), + WTCP(0x6a6d98a4, 0x471cece7), WTCP(0x68a69e81, 0x49b41533), WTCP(0x66cf8120, 0x4c3fdff4), WTCP(0x64e88926, 0x4ebfe8a5), + WTCP(0x62f201ac, 0x5133cc94), WTCP(0x60ec3830, 0x539b2af0), WTCP(0x5ed77c8a, 0x55f5a4d2), WTCP(0x5cb420e0, 0x5842dd54), + WTCP(0x5a82799a, 0x5a82799a) + , WTCP(0x5842dd54, 0x5cb420e0), WTCP(0x55f5a4d2, 0x5ed77c8a), WTCP(0x539b2af0, 0x60ec3830), + WTCP(0x5133cc94, 0x62f201ac), WTCP(0x4ebfe8a5, 0x64e88926), WTCP(0x4c3fdff4, 0x66cf8120), WTCP(0x49b41533, 0x68a69e81), + WTCP(0x471cece7, 0x6a6d98a4), WTCP(0x447acd50, 0x6c242960), WTCP(0x41ce1e65, 0x6dca0d14), WTCP(0x3f1749b8, 0x6f5f02b2), + WTCP(0x3c56ba70, 0x70e2cbc6), WTCP(0x398cdd32, 0x72552c85), WTCP(0x36ba2014, 0x73b5ebd1), WTCP(0x33def287, 0x7504d345), + WTCP(0x30fbc54d, 0x7641af3d), WTCP(0x2e110a62, 0x776c4edb), WTCP(0x2b1f34eb, 0x78848414), WTCP(0x2826b928, 0x798a23b1), + WTCP(0x25280c5e, 0x7a7d055b), WTCP(0x2223a4c5, 0x7b5d039e), WTCP(0x1f19f97b, 0x7c29fbee), WTCP(0x1c0b826a, 0x7ce3ceb2), + WTCP(0x18f8b83c, 0x7d8a5f40), WTCP(0x15e21445, 0x7e1d93ea), WTCP(0x12c8106f, 0x7e9d55fc), WTCP(0x0fab272b, 0x7f0991c4), + WTCP(0x0c8bd35e, 0x7f62368f), WTCP(0x096a9049, 0x7fa736b4), WTCP(0x0647d97c, 0x7fd8878e), WTCP(0x03242abf, 0x7ff62182) +}; + +LNK_SECTION_CONSTDATA +RAM_ALIGN +const FIXP_WTP SineWindow64[] = +{ + WTCP(0x7ffd885a, 0x01921d20), WTCP(0x7fe9cbc0, 0x04b6195d), WTCP(0x7fc25596, 0x07d95b9e), WTCP(0x7f872bf3, 0x0afb6805), + WTCP(0x7f3857f6, 0x0e1bc2e4), WTCP(0x7ed5e5c6, 0x1139f0cf), WTCP(0x7e5fe493, 0x145576b1), WTCP(0x7dd6668f, 0x176dd9de), + WTCP(0x7d3980ec, 0x1a82a026), WTCP(0x7c894bde, 0x1d934fe5), WTCP(0x7bc5e290, 0x209f701c), WTCP(0x7aef6323, 0x23a6887f), + WTCP(0x7a05eead, 0x26a82186), WTCP(0x7909a92d, 0x29a3c485), WTCP(0x77fab989, 0x2c98fbba), WTCP(0x76d94989, 0x2f875262), + WTCP(0x75a585cf, 0x326e54c7), WTCP(0x745f9dd1, 0x354d9057), WTCP(0x7307c3d0, 0x382493b0), WTCP(0x719e2cd2, 0x3af2eeb7), + WTCP(0x7023109a, 0x3db832a6), WTCP(0x6e96a99d, 0x4073f21d), WTCP(0x6cf934fc, 0x4325c135), WTCP(0x6b4af279, 0x45cd358f), + WTCP(0x698c246c, 0x4869e665), WTCP(0x67bd0fbd, 0x4afb6c98), WTCP(0x65ddfbd3, 0x4d8162c4), WTCP(0x63ef3290, 0x4ffb654d), + WTCP(0x61f1003f, 0x5269126e), WTCP(0x5fe3b38d, 0x54ca0a4b), WTCP(0x5dc79d7c, 0x571deefa), WTCP(0x5b9d1154, 0x59646498), +}; + + +LNK_SECTION_CONSTDATA +RAM_ALIGN +const FIXP_WTP SineWindow32[] = +{ + WTCP(0x7ff62182, 0x03242abf), WTCP(0x7fa736b4, 0x096a9049), WTCP(0x7f0991c4, 0x0fab272b), WTCP(0x7e1d93ea, 0x15e21445), + WTCP(0x7ce3ceb2, 0x1c0b826a), WTCP(0x7b5d039e, 0x2223a4c5), WTCP(0x798a23b1, 0x2826b928), WTCP(0x776c4edb, 0x2e110a62), + WTCP(0x7504d345, 0x33def287), WTCP(0x72552c85, 0x398cdd32), WTCP(0x6f5f02b2, 0x3f1749b8), WTCP(0x6c242960, 0x447acd50), + WTCP(0x68a69e81, 0x49b41533), WTCP(0x64e88926, 0x4ebfe8a5), WTCP(0x60ec3830, 0x539b2af0), WTCP(0x5cb420e0, 0x5842dd54), +}; + + + + + + + + +const USHORT sqrt_tab[49]={ +0x5a82, 0x5d4b, 0x6000, 0x62a1, +0x6531, 0x67b1, 0x6a21, 0x6c84, +0x6ed9, 0x7123, 0x7360, 0x7593, +0x77bb, 0x79da, 0x7bef, 0x7dfb, +0x8000, 0x81fc, 0x83f0, 0x85dd, +0x87c3, 0x89a3, 0x8b7c, 0x8d4e, +0x8f1b, 0x90e2, 0x92a4, 0x9460, +0x9617, 0x97ca, 0x9977, 0x9b20, +0x9cc4, 0x9e64, 0xa000, 0xa197, +0xa32b, 0xa4ba, 0xa646, 0xa7cf, +0xa953, 0xaad5, 0xac53, 0xadcd, +0xaf45, 0xb0b9, 0xb22b, 0xb399, +0xb504}; + +LNK_SECTION_CONSTDATA_L1 +const FIXP_DBL invCount[50]= /* This could be 16-bit wide */ +{ + 0x00000000, 0x7fffffff, 0x40000000, 0x2aaaaaab, 0x20000000, + 0x1999999a, 0x15555555, 0x12492492, 0x10000000, 0x0e38e38e, + 0x0ccccccd, 0x0ba2e8ba, 0x0aaaaaab, 0x09d89d8a, 0x09249249, + 0x08888889, 0x08000000, 0x07878788, 0x071c71c7, 0x06bca1af, + 0x06666666, 0x06186186, 0x05d1745d, 0x0590b216, 0x05555555, + 0x051eb852, 0x04ec4ec5, 0x04bda12f, 0x04924925, 0x0469ee58, + 0x04444444, 0x04210842, 0x04000000, 0x03e0f83e, 0x03c3c3c4, + 0x03a83a84, 0x038e38e4, 0x03759f23, 0x035e50d8, 0x03483483, + 0x03333333, 0x031f3832, 0x030c30c3, 0x02fa0be8, 0x02e8ba2f, + 0x02d82d83, 0x02c8590b, 0x02b93105, 0x02aaaaab, 0x029cbc15 +}; + + +/* + * Bitstream data lists + */ + +/* + * AOT {2,5,29} + * epConfig = -1 + */ + +static const rbd_id_t el_aac_sce[] = { + adtscrc_start_reg1, + element_instance_tag, + global_gain, + ics_info, + section_data, + scale_factor_data, + pulse, + tns_data_present, + tns_data, + gain_control_data_present, + /* gain_control_data, */ + spectral_data, + adtscrc_end_reg1, + end_of_sequence +}; + +static const struct element_list node_aac_sce = { + el_aac_sce, + { NULL, NULL } +}; + +static const rbd_id_t el_aac_cpe[] = { + adtscrc_start_reg1, + element_instance_tag, + common_window, + link_sequence +}; + +static const rbd_id_t el_aac_cpe0[] = +{ + /*common_window = 0*/ + global_gain, + ics_info, + section_data, + scale_factor_data, + pulse, + tns_data_present, + tns_data, + gain_control_data_present, + /*gain_control_data,*/ + spectral_data, + next_channel, + + adtscrc_start_reg2, + global_gain, + ics_info, + section_data, + scale_factor_data, + pulse, + tns_data_present, + tns_data, + gain_control_data_present, + /*gain_control_data,*/ + spectral_data, + adtscrc_end_reg1, + adtscrc_end_reg2, + end_of_sequence +}; + +static const rbd_id_t el_aac_cpe1[] = +{ + /* common_window = 1 */ + ics_info, + ms, + + global_gain, + section_data, + scale_factor_data, + pulse, + tns_data_present, + tns_data, + gain_control_data_present, + /*gain_control_data,*/ + spectral_data, + next_channel, + + adtscrc_start_reg2, + global_gain, + section_data, + scale_factor_data, + pulse, + tns_data_present, + tns_data, + gain_control_data_present, + /*gain_control_data,*/ + spectral_data, + adtscrc_end_reg1, + adtscrc_end_reg2, + end_of_sequence +}; + +static const struct element_list node_aac_cpe0 = { + el_aac_cpe0, + { NULL, NULL } +}; + +static const struct element_list node_aac_cpe1 = { + el_aac_cpe1, + { NULL, NULL } +}; + +static const element_list_t node_aac_cpe = { + el_aac_cpe, + { &node_aac_cpe0, &node_aac_cpe1 } +}; + +#define el_mpegsres_sce &el_aac_sce[2] + +static const element_list_t node_mpegsres_sce = { + el_mpegsres_sce, + { NULL, NULL } +}; + +static const element_list_t node_mpegsres_cpe = { + el_aac_cpe1, + { NULL, NULL } +}; + + +/* + * AOT C- {17,23} + * epConfig = 0,1 + */ +static const rbd_id_t el_aac_sce_epc0[] = { + element_instance_tag, + global_gain, + ics_info, + section_data, + scale_factor_data, + pulse, + tns_data_present, + gain_control_data_present, + gain_control_data, + esc1_hcr, /*length_of_rvlc_escapes, length_of_rvlc_sf */ + esc2_rvlc, /* rvlc_cod_sf, rvlc_esc_sf */ + tns_data, + spectral_data, + end_of_sequence +}; + +static const struct element_list node_aac_sce_epc0 = { + el_aac_sce_epc0, + { NULL, NULL } +}; + +static const rbd_id_t el_aac_sce_epc1[] = { + element_instance_tag, + global_gain, + ics_info, + section_data, + scale_factor_data, + pulse, + tns_data_present, + gain_control_data_present, + /*gain_control_data,*/ + esc1_hcr, /*length_of_rvlc_escapes, length_of_rvlc_sf */ + esc2_rvlc, /* rvlc_cod_sf, rvlc_esc_sf */ + tns_data, + spectral_data, + end_of_sequence +}; + +static const struct element_list node_aac_sce_epc1 = { + el_aac_sce_epc1, + { NULL, NULL } +}; + +static const rbd_id_t el_aac_cpe0_epc0[] = { + /* common_window = 0 */ + /* ESC 1: */ + global_gain, + ics_info, + /* ltp_data_present, + ltp_data, + */ + section_data, + scale_factor_data, + pulse, + tns_data_present, + gain_control_data_present, + /*gain_control_data,*/ + esc1_hcr, /*length_of_rvlc_escapes, length_of_rvlc_sf */ + /* ESC 2: */ + esc2_rvlc, /* rvlc_cod_sf, rvlc_esc_sf */ + /* ESC 3: */ + tns_data, + /* ESC 4: */ + spectral_data, + next_channel, + + /* ESC 1: */ + global_gain, + ics_info, + /* ltp_data_present, + ltp_data, + */ + section_data, + scale_factor_data, + pulse, + tns_data_present, + gain_control_data_present, + /*gain_control_data,*/ + esc1_hcr, /*length_of_rvlc_escapes, length_of_rvlc_sf */ + /* ESC 2: */ + esc2_rvlc, /* rvlc_cod_sf, rvlc_esc_sf */ + /* ESC 3: */ + tns_data, + /* ESC 4: */ + spectral_data, + end_of_sequence +}; + +static const rbd_id_t el_aac_cpe1_epc0[] = { + /* common_window = 1 */ + /* ESC 0: */ + ics_info, + /* ltp_data_present, + ltp_data, + next_channel, + ltp_data_present, + ltp_data, + next_channel, + */ + ms, + + /* ESC 1: */ + global_gain, + section_data, + scale_factor_data, + pulse, + tns_data_present, + gain_control_data_present, + /*gain_control_data,*/ + esc1_hcr, /* length_of_reordered_spectral_data, length_of_longest_codeword */ + /* ESC 2: */ + esc2_rvlc, /* rvlc_cod_sf, rvlc_esc_sf */ + /* ESC 3: */ + tns_data, + /* ESC 4: */ + spectral_data, + next_channel, + + /* ESC 1: */ + global_gain, + section_data, + scale_factor_data, + pulse, + tns_data_present, + gain_control_data_present, + /*gain_control_data,*/ + esc1_hcr, /* length_of_reordered_spectral_data, length_of_longest_codeword */ + /* ESC 2: */ + esc2_rvlc, /* rvlc_cod_sf, rvlc_esc_sf */ + /* ESC 3: */ + tns_data, + /* ESC 4: */ + spectral_data, + end_of_sequence +}; + +static const struct element_list node_aac_cpe0_epc0 = { + el_aac_cpe0_epc0, + { NULL, NULL } +}; + +static const struct element_list node_aac_cpe1_epc0 = { + el_aac_cpe1_epc0, + { NULL, NULL } +}; + +static const element_list_t node_aac_cpe_epc0 = { + el_aac_cpe, + { &node_aac_cpe0_epc0, &node_aac_cpe1_epc0 } +}; + +static const rbd_id_t el_aac_cpe0_epc1[] = { + global_gain, + ics_info, + section_data, + scale_factor_data, + pulse, + tns_data_present, + gain_control_data_present, + /*gain_control_data,*/ + next_channel, + global_gain, + ics_info, + section_data, + scale_factor_data, + pulse, + tns_data_present, + gain_control_data_present, + /*gain_control_data,*/ + next_channel, + esc1_hcr, /*length_of_rvlc_escapes, length_of_rvlc_sf */ + next_channel, + esc1_hcr, /*length_of_rvlc_escapes, length_of_rvlc_sf */ + next_channel, + esc2_rvlc, /* rvlc_cod_sf, rvlc_esc_sf */ + next_channel, + esc2_rvlc, /* rvlc_cod_sf, rvlc_esc_sf */ + next_channel, + tns_data, + next_channel, + tns_data, + next_channel, + spectral_data, + next_channel, + spectral_data, + end_of_sequence +}; + +static const rbd_id_t el_aac_cpe1_epc1[] = { + ics_info, + ms, + ltp_data_present, + ltp_data, + global_gain, + section_data, + scale_factor_data, + pulse, + tns_data_present, + gain_control_data_present, + /*gain_control_data,*/ + next_channel, + + ltp_data_present, + ltp_data, + global_gain, + section_data, + scale_factor_data, + pulse, + tns_data_present, + gain_control_data_present, + /*gain_control_data,*/ + next_channel, + esc1_hcr, /*length_of_rvlc_escapes, length_of_rvlc_sf */ + next_channel, + esc1_hcr, /*length_of_rvlc_escapes, length_of_rvlc_sf */ + next_channel, + esc2_rvlc, /* rvlc_cod_sf, rvlc_esc_sf */ + next_channel, + esc2_rvlc, /* rvlc_cod_sf, rvlc_esc_sf */ + + next_channel, + tns_data, + next_channel, + tns_data, + next_channel, + spectral_data, + next_channel, + spectral_data, + end_of_sequence +}; + +static const struct element_list node_aac_cpe0_epc1 = { + el_aac_cpe0_epc1, + { NULL, NULL } +}; + +static const struct element_list node_aac_cpe1_epc1 = { + el_aac_cpe1_epc1, + { NULL, NULL } +}; + +static const element_list_t node_aac_cpe_epc1 = { + el_aac_cpe, + { &node_aac_cpe0_epc1, &node_aac_cpe1_epc1 } +}; + + + +/* + * AOT = 39 + * epConfig = 0 + */ +static const rbd_id_t el_eld_sce_epc0[] = { + global_gain, + ics_info, + section_data, + scale_factor_data, + tns_data_present, + tns_data, + esc1_hcr, + esc2_rvlc, + spectral_data, + end_of_sequence +}; + +static const struct element_list node_eld_sce_epc0 = { + el_eld_sce_epc0, + { NULL, NULL } +}; + +#define node_eld_sce_epc1 node_eld_sce_epc0 + +static const rbd_id_t el_eld_cpe_epc0[] = { + ics_info, + ms, + global_gain, + section_data, + scale_factor_data, + tns_data_present, + tns_data, + esc1_hcr, + esc2_rvlc, + spectral_data, + next_channel, + global_gain, + section_data, + scale_factor_data, + tns_data_present, + tns_data, + esc1_hcr, + esc2_rvlc, + spectral_data, + end_of_sequence +}; + +static const rbd_id_t el_eld_cpe_epc1[] = { + ics_info, + ms, + global_gain, + section_data, + scale_factor_data, + tns_data_present, + next_channel, + global_gain, + section_data, + scale_factor_data, + tns_data_present, + next_channel, + tns_data, + next_channel, + tns_data, + next_channel, + esc1_hcr, + esc2_rvlc, + spectral_data, + next_channel, + esc1_hcr, + esc2_rvlc, + spectral_data, + end_of_sequence +}; + +static const struct element_list node_eld_cpe_epc0 = { + el_eld_cpe_epc0, + { NULL, NULL } +}; + +static const struct element_list node_eld_cpe_epc1 = { + el_eld_cpe_epc1, + { NULL, NULL } +}; + + +const element_list_t * getBitstreamElementList(AUDIO_OBJECT_TYPE aot, SCHAR epConfig, UCHAR nChannels, UCHAR layer) +{ + switch (aot) { + case AOT_AAC_LC: + case AOT_SBR: + case AOT_PS: + FDK_ASSERT(epConfig == -1); + if (nChannels == 1) { + return &node_aac_sce; + } else { + return &node_aac_cpe; + } + break; + case AOT_ER_AAC_LC: + case AOT_ER_AAC_LD: + if (nChannels == 1) { + if (epConfig == 0) { + return &node_aac_sce_epc0; + } else { + return &node_aac_sce_epc1; + } + } else { + if (epConfig == 0) + return &node_aac_cpe_epc0; + else + return &node_aac_cpe_epc1; + } + break; + case AOT_ER_AAC_ELD: + if (nChannels == 1) { + if (epConfig <= 0) + return &node_eld_sce_epc0; + else + return &node_eld_sce_epc1; + } else { + if (epConfig <= 0) + return &node_eld_cpe_epc0; + else + return &node_eld_cpe_epc1; + } + case AOT_MPEGS_RESIDUALS: + if (nChannels == 1) { + return &node_mpegsres_sce; + } else { + return &node_mpegsres_cpe; + } + break; + default: + break; + } + return NULL; +} + + diff --git a/libFDK/src/FDK_trigFcts.cpp b/libFDK/src/FDK_trigFcts.cpp new file mode 100644 index 0000000..a198dc6 --- /dev/null +++ b/libFDK/src/FDK_trigFcts.cpp @@ -0,0 +1,607 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Haricharan Lakshman, Manuel Jander + Description: Trigonometric functions fixed point fractional implementation. + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#include "FDK_trigFcts.h" + +#include "fixpoint_math.h" + + +// #define CORDIC_SINCOS + + +#define IMPROVE_ATAN2_ACCURACY 1 // 0 --> 59 dB SNR 1 --> 65 dB SNR +#define MINSFTAB 7 +#define MAXSFTAB 25 + +#if IMPROVE_ATAN2_ACCURACY +static const FIXP_DBL f_atan_expand_range[MAXSFTAB-(MINSFTAB-1)] = +{ + /***************************************************************************** + * + * Table holds fixp_atan() output values which are outside of input range + * of fixp_atan() to improve SNR of fixp_atan2(). + * + * This Table might also be used in fixp_atan() [todo] so there a wider input + * range can be covered, too. + * + * Matlab (generate table): + * for scl = 7:25 % MINSFTAB .. MAXSFTAB + * at=atan(0.5 *(2^scl)); % 0.5 because get in 'middle' area of current scale level 'scl' + * at/2 % div at by ATO_SCALE + * end + * + * Table divided by 2=ATO_SCALE <-- SF=ATO_SF + *****************************************************************************/ + FL2FXCONST_DBL(7.775862990872099e-001), FL2FXCONST_DBL(7.814919928673978e-001), FL2FXCONST_DBL(7.834450483314648e-001), + FL2FXCONST_DBL(7.844216021392089e-001), FL2FXCONST_DBL(7.849098823026687e-001), FL2FXCONST_DBL(7.851540227918509e-001), + FL2FXCONST_DBL(7.852760930873737e-001), FL2FXCONST_DBL(7.853371282415015e-001), FL2FXCONST_DBL(7.853676458193612e-001), + FL2FXCONST_DBL(7.853829046083906e-001), FL2FXCONST_DBL(7.853905340029177e-001), FL2FXCONST_DBL(7.853943487001828e-001), + FL2FXCONST_DBL(7.853962560488155e-001), FL2FXCONST_DBL(7.853972097231319e-001), FL2FXCONST_DBL(7.853976865602901e-001), + FL2FXCONST_DBL(7.853979249788692e-001), FL2FXCONST_DBL(7.853980441881587e-001), FL2FXCONST_DBL(7.853981037928035e-001), + FL2FXCONST_DBL(7.853981335951259e-001) + // pi/4 = 0.785398163397448 = pi/2/ATO_SCALE +}; +#endif + +FIXP_DBL fixp_atan2(FIXP_DBL y, FIXP_DBL x) +{ + FIXP_DBL q; + FIXP_DBL at; // atan out + FIXP_DBL at2; // atan2 out + FIXP_DBL ret = FL2FXCONST_DBL(-1.0f); + INT sf,sfo,stf; + + // --- division + + if (y > FL2FXCONST_DBL(0.0f)) + { + if (x > FL2FXCONST_DBL(0.0f)) { + q = fDivNormHighPrec( y, x, &sf); // both pos. + } + else if (x < FL2FXCONST_DBL(0.0f)) { + q = -fDivNormHighPrec( y,-x, &sf); // x neg. + } + else {//(x ==FL2FXCONST_DBL(0.0f)) + q = FL2FXCONST_DBL(+1.0f); // y/x = pos/zero = +Inf + sf = 0; + } + } + else if (y < FL2FXCONST_DBL(0.0f)) + { + if (x > FL2FXCONST_DBL(0.0f)) { + q = -fDivNormHighPrec(-y, x, &sf); // y neg. + } + else if (x < FL2FXCONST_DBL(0.0f)) { + q = fDivNormHighPrec(-y,-x, &sf); // both neg. + } + else {//(x ==FL2FXCONST_DBL(0.0f)) + q = FL2FXCONST_DBL(-1.0f); // y/x = neg/zero = -Inf + sf = 0; + } + } + else { // (y ==FL2FXCONST_DBL(0.0f)) + q = FL2FXCONST_DBL(0.0f); + sf = 0; + } + sfo = sf; + //write2file(fpF__h,(float)y/(float)x); + //write2file(fpC__h,(float) q * (float)FDKpow(2,sfo)); // SNR 86 dB But range not limited to [-64..64] which is the input range of fixp_atan() + + // --- atan() + + if ( sfo > ATI_SF ) { + // --- could not calc fixp_atan() here bec of input data out of range + // ==> therefore give back boundary values + + #if IMPROVE_ATAN2_ACCURACY + if (sfo > MAXSFTAB) sfo = MAXSFTAB; + #endif + + if ( q > FL2FXCONST_DBL(0.0f) ) { + #if IMPROVE_ATAN2_ACCURACY + at = +f_atan_expand_range[sfo-ATI_SF-1]; + #else + at = FL2FXCONST_DBL( +M_PI/2 / ATO_SCALE); + #endif + } + else if ( q < FL2FXCONST_DBL(0.0f) ) { + #if IMPROVE_ATAN2_ACCURACY + at = -f_atan_expand_range[sfo-ATI_SF-1]; + #else + at = FL2FXCONST_DBL( -M_PI/2 / ATO_SCALE); + #endif + } + else { // q== FL2FXCONST_DBL(0.0f) + at = FL2FXCONST_DBL( 0.0f ); + } + }else{ + // --- calc of fixp_atan() is possible; input data within range + // ==> set q on fixed scale level as desired from fixp_atan() + stf = sfo - ATI_SF; + if (stf > 0) q = q << (INT)fMin( stf,DFRACT_BITS-1); + else q = q >> (INT)fMin(-stf,DFRACT_BITS-1); + //write2file(fpF__e,(float)y/(float)x); + //write2file(fpC__e,(float)q * (float)FDKpow(2,ATI_SF)); // 88.9 dB + at = fixp_atan(q); // ATO_SF + } + //write2file(fpF__g,(float)FDKatan( (float)y/(float)x )); + //write2file(fpC__g,(float) at * (float)FDKpow(2,ATO_SF) ); // todo dB + + // --- atan2() + + at2 = at >> (AT2O_SF - ATO_SF); // now AT2O_SF for atan2 + if ( x > FL2FXCONST_DBL(0.0f) ) { + ret = at2; + } + else if ( x < FL2FXCONST_DBL(0.0f) ) { + if ( y >= FL2FXCONST_DBL(0.0f) ) { + ret = at2 + FL2FXCONST_DBL( M_PI / AT2O_SCALE); + } else { + ret = at2 - FL2FXCONST_DBL( M_PI / AT2O_SCALE); + } + } + else { + // x == 0 + if ( y > FL2FXCONST_DBL(0.0f) ) { + ret = FL2FXCONST_DBL( +M_PI/2 / AT2O_SCALE); + } + else if ( y < FL2FXCONST_DBL(0.0f) ) { + ret = FL2FXCONST_DBL( -M_PI/2 / AT2O_SCALE); + } + else if ( y == FL2FXCONST_DBL(0.0f) ) { + ret = FL2FXCONST_DBL(0.0f); + } + } + //write2file(fpC__f,(float)ret * (float)FDKpow(2,AT2O_SF)); // 65 dB + //write2file(fpF__f,(float)FDKatan2(y,x)); + return ret; +} + + +FIXP_DBL fixp_atan(FIXP_DBL x) +{ + INT sign; + FIXP_DBL result, temp; + + // SNR of fixp_atan() = 56 dB + FIXP_DBL ONEBY3P56 = (FIXP_DBL)0x26800000; // 1.0/3.56 in q31 + FIXP_DBL P281 = (FIXP_DBL)0x00013000; // 0.281 in q18 + FIXP_DBL ONEP571 = (FIXP_DBL)0x6487ef00; // 1.571 in q30 + + if (x < FIXP_DBL(0)) { + sign = 1; + x = - x ; + } else { + sign = 0; + } + + /* calc of arctan */ + if(x < ( Q(Q_ATANINP)-FL2FXCONST_DBL(0.00395)) ) + { + INT res_e; + + temp = fPow2(x); // q25 * q25 - (DFRACT_BITS-1) = q19 + temp = fMult(temp, ONEBY3P56); // q19 * q31 - (DFRACT_BITS-1) = q19 + temp = temp + Q(19); // q19 + q19 = q19 + result = fDivNorm(x, temp, &res_e); + result = scaleValue(result, (Q_ATANOUT-Q_ATANINP+19-DFRACT_BITS+1) + res_e ); + } + else if( x < FL2FXCONST_DBL(1.28/64.0) ) + { + FIXP_DBL delta_fix; + FIXP_DBL PI_BY_4 = FL2FXCONST_DBL(3.1415926/4.0) >> 1; /* pi/4 in q30 */ + + delta_fix = (x - FL2FXCONST_DBL(1.0/64.0)) << 5; /* q30 */ + result = PI_BY_4 + (delta_fix >> 1) - (fPow2Div2(delta_fix)); + } + else + { + INT res_e; + + temp = fPow2Div2(x); // q25 * q25 - (DFRACT_BITS-1) - 1 = q18 + temp = temp + P281; // q18 + q18 = q18 + result = fDivNorm(x, temp, &res_e); + result = scaleValue(result, (Q_ATANOUT-Q_ATANINP+18-DFRACT_BITS+1) + res_e ); + result = ONEP571 - result; // q30 + q30 = q30 + } + if (sign) { + result = -result; + } + + return(result); +} + + +#ifndef CORDIC_SINCOS + +#include "FDK_tools_rom.h" + +FIXP_DBL fixp_cos(FIXP_DBL x, int scale) +{ + FIXP_DBL residual, error, sine, cosine; + + residual = fixp_sin_cos_residual_inline(x, scale, &sine, &cosine); + error = fMult(sine, residual); + + return cosine - error; +} + +FIXP_DBL fixp_sin(FIXP_DBL x, int scale) +{ + FIXP_DBL residual, error, sine, cosine; + + residual = fixp_sin_cos_residual_inline(x, scale, &sine, &cosine); + error = fMult(cosine, residual); + + return sine + error; +} + +void fixp_cos_sin (FIXP_DBL x, int scale, FIXP_DBL *cos, FIXP_DBL *sin) +{ + FIXP_DBL residual, error0, error1, sine, cosine; + + residual = fixp_sin_cos_residual_inline(x, scale, &sine, &cosine); + error0 = fMult(sine, residual); + error1 = fMult(cosine, residual); + *cos = cosine - error0; + *sin = sine + error1; +} + +#else /* #ifndef CORDIC_SINCOS */ + +/* + // Matlab + function v = cordic(beta,n) + % This function computes v = [cos(beta), sin(beta)] (beta in radians) + % using n iterations. Increasing n will increase the precision. + + if beta < -pi/2 | beta > pi/2 + if beta < 0 + v = cordic(beta + pi, n); + else + v = cordic(beta - pi, n); + end + v = -v; % flip the sign for second or third quadrant + return + end + + % Initialization of tables of constants used by CORDIC + % need a table of arctangents of negative powers of two, in radians: + % angles = atan(2.^-(0:27)); + angles = [ ... + 0.78539816339745 0.46364760900081 0.24497866312686 0.12435499454676 ... + 0.06241880999596 0.03123983343027 0.01562372862048 0.00781234106010 ... + 0.00390623013197 0.00195312251648 0.00097656218956 0.00048828121119 ... + 0.00024414062015 0.00012207031189 0.00006103515617 0.00003051757812 ... + 0.00001525878906 0.00000762939453 0.00000381469727 0.00000190734863 ... + 0.00000095367432 0.00000047683716 0.00000023841858 0.00000011920929 ... + 0.00000005960464 0.00000002980232 0.00000001490116 0.00000000745058 ]; + % and a table of products of reciprocal lengths of vectors [1, 2^-j]: + Kvalues = [ ... + 0.70710678118655 0.63245553203368 0.61357199107790 0.60883391251775 ... + 0.60764825625617 0.60735177014130 0.60727764409353 0.60725911229889 ... + 0.60725447933256 0.60725332108988 0.60725303152913 0.60725295913894 ... + 0.60725294104140 0.60725293651701 0.60725293538591 0.60725293510314 ... + 0.60725293503245 0.60725293501477 0.60725293501035 0.60725293500925 ... + 0.60725293500897 0.60725293500890 0.60725293500889 0.60725293500888 ]; + Kn = Kvalues(min(n, length(Kvalues))); + + % Initialize loop variables: + v = [1;0]; % start with 2-vector cosine and sine of zero + poweroftwo = 1; + angle = angles(1); + + % Iterations + for j = 0:n-1; + if beta < 0 + sigma = -1; + else + sigma = 1; + end + factor = sigma * poweroftwo; + R = [1, -factor; factor, 1]; + v = R * v; % 2-by-2 matrix multiply + beta = beta - sigma * angle; % update the remaining angle + poweroftwo = poweroftwo / 2; + % update the angle from table, or eventually by just dividing by two + if j+2 > length(angles) + angle = angle / 2; + else + angle = angles(j+2); + end + end + + % Adjust length of output vector to be [cos(beta), sin(beta)]: + v = v * Kn; + return + + // C++ + #define C1 + #define C2 + #define TYPE double + + TYPE fixp_cordic(TYPE in, + int n, + int type) + { + int i; + TYPE c,s,a; + TYPE x,y,v; + TYPE b; + + c = 0.5; + s = 0.0; + b = 1.0; + + for (i=0; i<n; i++) { + a = angleValues[i]; + x = b * s; + y = b * c; + + if (in < 0.0) { + c = c + x; + s = s - y; + in = in + a; + } + else { + c = c - x; + s = s + y; + in = in - a; + } + b = b / 2; + } + + if (type == 0) + v = c * kValues[n-1]*2; + else + v = s * kValues[n-1]*2; + + return (v); + } + + TYPE fixp_cos(TYPE in, + int n, + int scale) + { + TYPE v; + INT sign = 0; + + while ( (in < -M_PI/2) || (in > M_PI/2) ) { + if (in < 0) + in = in + M_PI; + else + in = in - M_PI; + + if (sign == 0) + sign = 1; + else + sign = 0; + } + + v = fixp_cordic(in,n,0); + + if (sign) + v = -v; + + return (v); + } + + TYPE fixp_sin(TYPE in, + int n, + int scale) + { + TYPE v; + INT sign = 0; + + while ( (in < -M_PI/2) || (in > M_PI/2) ) { + if (in < 0) + in = in + M_PI; + else + in = in - M_PI; + + if (sign == 0) + sign = 1; + else + sign = 0; + } + + v = fixp_cordic(in,n,1); + + if (sign) + v = -v; + + return (v); + } +*/ + + +#define SF_C1 1 +#define C1(x) FL2FXCONST_DBL(x/(1<<SF_C1)) +#define C2(x) FL2FXCONST_DBL(x) +#define M_PI_4 FL2FXCONST_DBL(M_PI/4) +#define ITER (DFRACT_BITS-1) + +/* + for (i=0; i<DFRACT_BITS; i++) { + angleValues[i] = FDKatan(FDKpow(2.0,-i)); + } +*/ +const FIXP_DBL angleValues[DFRACT_BITS] = { + C1(7.853981633974483e-001), C1(4.636476090008061e-001), C1(2.449786631268641e-001), C1(1.243549945467614e-001), + C1(6.241880999595735e-002), C1(3.123983343026828e-002), C1(1.562372862047683e-002), C1(7.812341060101111e-003), + C1(3.906230131966972e-003), C1(1.953122516478819e-003), C1(9.765621895593195e-004), C1(4.882812111948983e-004), + C1(2.441406201493618e-004), C1(1.220703118936702e-004), C1(6.103515617420877e-005), C1(3.051757811552610e-005), + C1(1.525878906131576e-005), C1(7.629394531101970e-006), C1(3.814697265606496e-006), C1(1.907348632810187e-006), + C1(9.536743164059608e-007), C1(4.768371582030888e-007), C1(2.384185791015580e-007), C1(1.192092895507807e-007), + C1(5.960464477539055e-008), C1(2.980232238769530e-008), C1(1.490116119384766e-008), C1(7.450580596923828e-009), + C1(3.725290298461914e-009), C1(1.862645149230957e-009), C1(9.313225746154785e-010), C1(4.656612873077393e-010) +}; + +/* + for (i=0; i<DFRACT_BITS; i++) { + kValues[i] = 1.0; + for (j=0; j<=i; j++) { + val = FDKcos(FDKatan(FDKpow(2.0,-j))); + kValues[i] *= val; + } + } +*/ +const FIXP_DBL kValues[DFRACT_BITS] = { + C2(7.071067811865476e-001), C2(6.324555320336759e-001), C2(6.135719910778964e-001), C2(6.088339125177524e-001), + C2(6.076482562561683e-001), C2(6.073517701412960e-001), C2(6.072776440935261e-001), C2(6.072591122988928e-001), + C2(6.072544793325625e-001), C2(6.072533210898753e-001), C2(6.072530315291345e-001), C2(6.072529591389450e-001), + C2(6.072529410413973e-001), C2(6.072529365170104e-001), C2(6.072529353859136e-001), C2(6.072529351031395e-001), + C2(6.072529350324459e-001), C2(6.072529350147725e-001), C2(6.072529350103542e-001), C2(6.072529350092496e-001), + C2(6.072529350089735e-001), C2(6.072529350089044e-001), C2(6.072529350088872e-001), C2(6.072529350088829e-001), + C2(6.072529350088818e-001), C2(6.072529350088816e-001), C2(6.072529350088814e-001), C2(6.072529350088814e-001), + C2(6.072529350088814e-001), C2(6.072529350088814e-001), C2(6.072529350088814e-001), C2(6.072529350088814e-001) +}; + +inline +static FIXP_DBL fixp_cordic(FIXP_DBL in, + INT type) +{ + int i; + FIXP_DBL c,s,a; + FIXP_DBL x,y; + int n = ITER; + + in = fMult(in,M_PI_4); + c = kValues[n-1] >> 1; + s = FL2FXCONST_DBL(0.0f); + + for (i=0; i<n; i++) { + a = angleValues[i]; + x = s >> i; + y = c >> i; + + if (in < FL2FXCONST_DBL(0.0)) { + c = c + x; + s = s - y; + in = in + a; + } + else { + c = c - x; + s = s + y; + in = in - a; + } + } + + /* 1 headroom bit */ + if (type == 0) + return (c); + else + return (s); +} + +/* + in: argument + scale: scalefactor of argument has to be in the range of 0, ... ,DFRACT_BITS-1 + type: calculate cosine 0 + calculate sine 1 +*/ +static FIXP_DBL fixp_sincos(FIXP_DBL in, + INT scale, + INT type) +{ + FIXP_DBL v; + INT sign = 0; + FIXP_DBL pi,pi_2; + + if (scale < 2) { + in = in >> (2-scale); + scale = 2; + } + + pi = M_PI_4 >> (scale-2); + pi_2 = M_PI_4 >> (scale-1); + + /* move signal into the range of -pi/2 to +pi/2 */ + while ( (in < (-pi_2)) || (in > (pi_2)) ) { + if (in < FL2FXCONST_DBL(0.0)) + in = in + pi; + else + in = in - pi; + + sign = ~sign; + } + + /* scale signal with 2/pi => unscaled signal is in the range of [-1.0,...,+1.0[ */ + in = fMult(in,FL2FXCONST_DBL(2/M_PI)) << scale; + + v = fixp_cordic(in,type); + + if (sign) + v = -v; + + /* compensate 1 headroom bit */ + if ( v <= FL2FXCONST_DBL(-0.5f) ) + v = (FIXP_DBL) (MINVAL_DBL+1); + else + v = SATURATE_LEFT_SHIFT(v,1,DFRACT_BITS); + + return (v); +} + +/* + in: argument + scale: scalefactor of argument has to be in the range of 0, ... ,DFRACT_BITS-1 +*/ +FIXP_DBL fixp_cos(FIXP_DBL in, + INT scale) + +{ + FDK_ASSERT ((scale >= 0) && (scale < DFRACT_BITS)); + + if (in == FL2FXCONST_DBL(0.0f)) + return /*FL2FXCONST_DBL(1.0)*/ (FIXP_DBL)MAXVAL_DBL; + + return (fixp_sincos(in,scale,0)); +} + +/* + in: argument + scale: scalefactor of argument has to be in the range of 0, ... ,DFRACT_BITS-1 +*/ +FIXP_DBL fixp_sin(FIXP_DBL in, + INT scale) + +{ + FDK_ASSERT ((scale >= 0) && (scale < DFRACT_BITS)); + + if (in == FL2FXCONST_DBL(0.0f)) + return FL2FXCONST_DBL(0.0f); + + return (fixp_sincos(in,scale,1)); +} + +#endif /* #ifndef CORDIC_SINCOS */ + + + + diff --git a/libFDK/src/arm/autocorr2nd.cpp b/libFDK/src/arm/autocorr2nd.cpp new file mode 100644 index 0000000..85926af --- /dev/null +++ b/libFDK/src/arm/autocorr2nd.cpp @@ -0,0 +1,33 @@ +/**************************************************************************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + + $Id$ + +*******************************************************************************/ + +/*! + * + * \brief Calculate second order autocorrelation + * + */ + + diff --git a/libFDK/src/arm/dct_arm.cpp b/libFDK/src/arm/dct_arm.cpp new file mode 100644 index 0000000..dd0ca09 --- /dev/null +++ b/libFDK/src/arm/dct_arm.cpp @@ -0,0 +1,395 @@ +/**************************************************************************** + + (C) copyright Fraunhofer IIS (2004) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + + $Id$ + +***************************************************************************/ + + + +#ifdef FUNCTION_dct_IV_func1 + +/* + Note: This assembler routine is here, because the ARM926 compiler does + not encode the inline assembler with optimal speed. + With this version, we save 2 cycles per loop iteration. +*/ + +__asm void dct_IV_func1( + int i, + const FIXP_SPK *twiddle, + FIXP_DBL *RESTRICT pDat_0, + FIXP_DBL *RESTRICT pDat_1) +{ + /* Register map: + r0 i + r1 twiddle + r2 pDat_0 + r3 pDat_1 + r4 accu1 + r5 accu2 + r6 accu3 + r7 accu4 + r8 val_tw + r9 accuX + */ + PUSH {r4-r9} + + /* 44 cycles for 2 iterations = 22 cycles/iteration */ +dct_IV_loop1_start +/* First iteration */ + LDR r8, [r1], #4 // val_tw = *twiddle++; + LDR r5, [r2, #0] // accu2 = pDat_0[0] + LDR r4, [r3, #0] // accu1 = pDat_1[0] + + SMULWT r9, r5, r8 // accuX = accu2*val_tw.l + SMULWB r5, r5, r8 // accu2 = accu2*val_tw.h + RSB r9, r9, #0 // accuX =-accu2*val_tw.l + SMLAWT r5, r4, r8, r5 // accu2 = accu2*val_tw.h + accu1*val_tw.l + SMLAWB r4, r4, r8, r9 // accu1 = accu1*val_tw.h - accu2*val_tw.l + + LDR r8, [r1], #4 // val_tw = *twiddle++; + LDR r7, [r3, #-4] // accu4 = pDat_1[-1] + LDR r6, [r2, #4] // accu3 = pDat_0[1] + + SMULWB r9, r7, r8 // accuX = accu4*val_tw.h + SMULWT r7, r7, r8 // accu4 = accu4*val_tw.l + RSB r9, r9, #0 // accuX =-accu4*val_tw.h + SMLAWB r7, r6, r8, r7 // accu4 = accu4*val_tw.l+accu3*val_tw.h + SMLAWT r6, r6, r8, r9 // accu3 = accu3*val_tw.l-accu4*val_tw.h + + STR r5, [r2], #4 // *pDat_0++ = accu2 + STR r4, [r2], #4 // *pDat_0++ = accu1 + STR r6, [r3], #-4 // *pDat_1-- = accu3 + STR r7, [r3], #-4 // *pDat_1-- = accu4 + +/* Second iteration */ + LDR r8, [r1], #4 // val_tw = *twiddle++; + LDR r5, [r2, #0] // accu2 = pDat_0[0] + LDR r4, [r3, #0] // accu1 = pDat_1[0] + + SMULWT r9, r5, r8 // accuX = accu2*val_tw.l + SMULWB r5, r5, r8 // accu2 = accu2*val_tw.h + RSB r9, r9, #0 // accuX =-accu2*val_tw.l + SMLAWT r5, r4, r8, r5 // accu2 = accu2*val_tw.h + accu1*val_tw.l + SMLAWB r4, r4, r8, r9 // accu1 = accu1*val_tw.h - accu2*val_tw.l + + LDR r8, [r1], #4 // val_tw = *twiddle++; + LDR r7, [r3, #-4] // accu4 = pDat_1[-1] + LDR r6, [r2, #4] // accu3 = pDat_0[1] + + SMULWB r9, r7, r8 // accuX = accu4*val_tw.h + SMULWT r7, r7, r8 // accu4 = accu4*val_tw.l + RSB r9, r9, #0 // accuX =-accu4*val_tw.h + SMLAWB r7, r6, r8, r7 // accu4 = accu4*val_tw.l+accu3*val_tw.h + SMLAWT r6, r6, r8, r9 // accu3 = accu3*val_tw.l-accu4*val_tw.h + + STR r5, [r2], #4 // *pDat_0++ = accu2 + STR r4, [r2], #4 // *pDat_0++ = accu1 + STR r6, [r3], #-4 // *pDat_1-- = accu3 + STR r7, [r3], #-4 // *pDat_1-- = accu4 + + SUBS r0, r0, #1 + BNE dct_IV_loop1_start + + POP {r4-r9} + + BX lr +} + +#endif /* FUNCTION_dct_IV_func1 */ + + +#ifdef FUNCTION_dct_IV_func2 + +FDK_INLINE +/* __attribute__((noinline)) */ +static void dct_IV_func2( + int i, + const FIXP_SPK *twiddle, + FIXP_DBL *pDat_0, + FIXP_DBL *pDat_1, + int inc) +{ + FIXP_DBL accu1, accu2, accu3, accu4, accuX; + LONG val_tw; + + accu1 = pDat_1[-2]; + accu2 = pDat_1[-1]; + + *--pDat_1 = -(pDat_0[1]>>1); + *pDat_0++ = (pDat_0[0]>>1); + + twiddle += inc; + +__asm + { + LDR val_tw, [twiddle], inc, LSL #2 // val_tw = *twiddle; twiddle += inc + B dct_IV_loop2_2nd_part + + /* 42 cycles for 2 iterations = 21 cycles/iteration */ +dct_IV_loop2: + SMULWT accuX, accu2, val_tw + SMULWB accu2, accu2, val_tw + RSB accuX, accuX, #0 + SMLAWB accuX, accu1, val_tw, accuX + SMLAWT accu2, accu1, val_tw, accu2 + STR accuX, [pDat_0], #4 + STR accu2, [pDat_1, #-4] ! + + LDR accu4, [pDat_0, #4] + LDR accu3, [pDat_0] + SMULWB accuX, accu4, val_tw + SMULWT accu4, accu4, val_tw + RSB accuX, accuX, #0 + SMLAWT accuX, accu3, val_tw, accuX + SMLAWB accu4, accu3, val_tw, accu4 + + LDR accu1, [pDat_1, #-8] + LDR accu2, [pDat_1, #-4] + + LDR val_tw, [twiddle], inc, LSL #2 // val_tw = *twiddle; twiddle += inc + + STR accuX, [pDat_1, #-4] ! + STR accu4, [pDat_0], #4 + +dct_IV_loop2_2nd_part: + SMULWT accuX, accu2, val_tw + SMULWB accu2, accu2, val_tw + RSB accuX, accuX, #0 + SMLAWB accuX, accu1, val_tw, accuX + SMLAWT accu2, accu1, val_tw, accu2 + STR accuX, [pDat_0], #4 + STR accu2, [pDat_1, #-4] ! + + LDR accu4, [pDat_0, #4] + LDR accu3, [pDat_0] + SMULWB accuX, accu4, val_tw + SMULWT accu4, accu4, val_tw + RSB accuX, accuX, #0 + SMLAWT accuX, accu3, val_tw, accuX + SMLAWB accu4, accu3, val_tw, accu4 + + LDR accu1, [pDat_1, #-8] + LDR accu2, [pDat_1, #-4] + + STR accuX, [pDat_1, #-4] ! + STR accu4, [pDat_0], #4 + + LDR val_tw, [twiddle], inc, LSL #2 // val_tw = *twiddle; twiddle += inc + + SUBS i, i, #1 + BNE dct_IV_loop2 + } + + /* Last Sin and Cos value pair are the same */ + accu1 = fMultDiv2(accu1, WTC(0x5a82799a)); + accu2 = fMultDiv2(accu2, WTC(0x5a82799a)); + + *--pDat_1 = accu1 + accu2; + *pDat_0++ = accu1 - accu2; +} +#endif /* FUNCTION_dct_IV_func2 */ + + +#ifdef FUNCTION_dst_IV_func1 + +__asm void dst_IV_func1( + int i, + const FIXP_SPK *twiddle, + FIXP_DBL *pDat_0, + FIXP_DBL *pDat_1) +{ + /* Register map: + r0 i + r1 twiddle + r2 pDat_0 + r3 pDat_1 + r4 accu1 + r5 accu2 + r6 accu3 + r7 accu4 + r8 val_tw + r9 accuX + */ + PUSH {r4-r9} + +dst_IV_loop1 + LDR r8, [r1], #4 // val_tw = *twiddle++ + LDR r5, [r2] // accu2 = pDat_0[0] + LDR r6, [r2, #4] // accu3 = pDat_0[1] + RSB r5, r5, #0 // accu2 = -accu2 + SMULWT r9, r5, r8 // accuX = (-accu2)*val_tw.l + LDR r4, [r3, #-4] // accu1 = pDat_1[-1] + RSB r9, r9, #0 // accuX = -(-accu2)*val_tw.l + SMLAWB r9, r4, r8, r9 // accuX = accu1*val_tw.h-(-accu2)*val_tw.l + SMULWT r4, r4, r8 // accu1 = accu1*val_tw.l + LDR r7, [r3, #-8] // accu4 = pDat_1[-2] + SMLAWB r5, r5, r8, r4 // accu2 = (-accu2)*val_tw.t+accu1*val_tw.l + LDR r8, [r1], #4 // val_tw = *twiddle++ + STR r5, [r2], #4 // *pDat_0++ = accu2 + STR r9, [r2], #4 // *pDat_0++ = accu1 (accuX) + RSB r7, r7, #0 // accu4 = -accu4 + SMULWB r5, r7, r8 // accu2 = (-accu4)*val_tw.h + SMULWB r4, r6, r8 // accu1 = (-accu4)*val_tw.l + RSB r5, r5, #0 // accu2 = -(-accu4)*val_tw.h + SMLAWT r6, r6, r8, r5 // accu3 = (-accu4)*val_tw.l-(-accu3)*val_tw.h + SMLAWT r7, r7, r8, r4 // accu4 = (-accu3)*val_tw.l+(-accu4)*val_tw.h + STR r6, [r3, #-4] ! // *--pDat_1 = accu3 + STR r7, [r3, #-4] ! // *--pDat_1 = accu4 + + LDR r8, [r1], #4 // val_tw = *twiddle++ + LDR r5, [r2] // accu2 = pDat_0[0] + LDR r6, [r2, #4] // accu3 = pDat_0[1] + RSB r5, r5, #0 // accu2 = -accu2 + SMULWT r9, r5, r8 // accuX = (-accu2)*val_tw.l + LDR r4, [r3, #-4] // accu1 = pDat_1[-1] + RSB r9, r9, #0 // accuX = -(-accu2)*val_tw.l + SMLAWB r9, r4, r8, r9 // accuX = accu1*val_tw.h-(-accu2)*val_tw.l + SMULWT r4, r4, r8 // accu1 = accu1*val_tw.l + LDR r7, [r3, #-8] // accu4 = pDat_1[-2] + SMLAWB r5, r5, r8, r4 // accu2 = (-accu2)*val_tw.t+accu1*val_tw.l + LDR r8, [r1], #4 // val_tw = *twiddle++ + STR r5, [r2], #4 // *pDat_0++ = accu2 + STR r9, [r2], #4 // *pDat_0++ = accu1 (accuX) + RSB r7, r7, #0 // accu4 = -accu4 + SMULWB r5, r7, r8 // accu2 = (-accu4)*val_tw.h + SMULWB r4, r6, r8 // accu1 = (-accu4)*val_tw.l + RSB r5, r5, #0 // accu2 = -(-accu4)*val_tw.h + SMLAWT r6, r6, r8, r5 // accu3 = (-accu4)*val_tw.l-(-accu3)*val_tw.h + SMLAWT r7, r7, r8, r4 // accu4 = (-accu3)*val_tw.l+(-accu4)*val_tw.h + STR r6, [r3, #-4] ! // *--pDat_1 = accu3 + STR r7, [r3, #-4] ! // *--pDat_1 = accu4 + + SUBS r0, r0, #4 // i-= 4 + BNE dst_IV_loop1 + + POP {r4-r9} + BX lr +} +#endif /* FUNCTION_dst_IV_func1 */ + +#ifdef FUNCTION_dst_IV_func2 + +FDK_INLINE +/* __attribute__((noinline)) */ +static void dst_IV_func2( + int i, + const FIXP_SPK *twiddle, + FIXP_DBL *RESTRICT pDat_0, + FIXP_DBL *RESTRICT pDat_1, + int inc) +{ + FIXP_DBL accu1,accu2,accu3,accu4; + LONG val_tw; + + accu4 = pDat_0[0]; + accu3 = pDat_0[1]; + accu4 >>= 1; + accu3 >>= 1; + accu4 = -accu4; + + accu1 = pDat_1[-1]; + accu2 = pDat_1[0]; + + *pDat_0++ = accu3; + *pDat_1-- = accu4; + + + __asm + { + B dst_IV_loop2_2nd_part + + /* 50 cycles for 2 iterations = 25 cycles/iteration */ + +dst_IV_loop2: + + LDR val_tw, [twiddle], inc, LSL #2 // val_tw = *twiddle; twiddle += inc + + RSB accu2, accu2, #0 // accu2 = -accu2 + RSB accu1, accu1, #0 // accu1 = -accu1 + SMULWT accu3, accu2, val_tw // accu3 = (-accu2)*val_tw.l + SMULWT accu4, accu1, val_tw // accu4 = (-accu1)*val_tw.l + RSB accu3, accu3, #0 // accu3 = -accu2*val_tw.l + SMLAWB accu1, accu1, val_tw, accu3 // accu1 = -accu1*val_tw.h-(-accu2)*val_tw.l + SMLAWB accu2, accu2, val_tw, accu4 // accu2 = (-accu1)*val_tw.l+(-accu2)*val_tw.h + STR accu1, [pDat_1], #-4 // *pDat_1-- = accu1 + STR accu2, [pDat_0], #4 // *pDat_0++ = accu2 + + LDR accu4, [pDat_0] // accu4 = pDat_0[0] + LDR accu3, [pDat_0, #4] // accu3 = pDat_0[1] + + RSB accu4, accu4, #0 // accu4 = -accu4 + RSB accu3, accu3, #0 // accu3 = -accu3 + + SMULWB accu1, accu3, val_tw // accu1 = (-accu3)*val_tw.h + SMULWT accu2, accu3, val_tw // accu2 = (-accu3)*val_tw.l + RSB accu1, accu1, #0 // accu1 = -(-accu3)*val_tw.h + SMLAWT accu3, accu4, val_tw, accu1 // accu3 = (-accu4)*val_tw.l-(-accu3)*val_tw.h + SMLAWB accu4, accu4, val_tw, accu2 // accu4 = (-accu3)*val_tw.l+(-accu4)*val_tw.h + + LDR accu1, [pDat_1, #-4] // accu1 = pDat_1[-1] + LDR accu2, [pDat_1] // accu2 = pDat_1[0] + + STR accu3, [pDat_0], #4 // *pDat_0++ = accu3 + STR accu4, [pDat_1], #-4 // *pDat_1-- = accu4 + +dst_IV_loop2_2nd_part: + + LDR val_tw, [twiddle], inc, LSL #2 // val_tw = *twiddle; twiddle += inc + + RSB accu2, accu2, #0 // accu2 = -accu2 + RSB accu1, accu1, #0 // accu1 = -accu1 + SMULWT accu3, accu2, val_tw // accu3 = (-accu2)*val_tw.l + SMULWT accu4, accu1, val_tw // accu4 = (-accu1)*val_tw.l + RSB accu3, accu3, #0 // accu3 = -accu2*val_tw.l + SMLAWB accu1, accu1, val_tw, accu3 // accu1 = -accu1*val_tw.h-(-accu2)*val_tw.l + SMLAWB accu2, accu2, val_tw, accu4 // accu2 = (-accu1)*val_tw.l+(-accu2)*val_tw.h + STR accu1, [pDat_1], #-4 // *pDat_1-- = accu1 + STR accu2, [pDat_0], #4 // *pDat_0++ = accu2 + + LDR accu4, [pDat_0] // accu4 = pDat_0[0] + LDR accu3, [pDat_0, #4] // accu3 = pDat_0[1] + + RSB accu4, accu4, #0 // accu4 = -accu4 + RSB accu3, accu3, #0 // accu3 = -accu3 + + SMULWB accu1, accu3, val_tw // accu1 = (-accu3)*val_tw.h + SMULWT accu2, accu3, val_tw // accu2 = (-accu3)*val_tw.l + RSB accu1, accu1, #0 // accu1 = -(-accu3)*val_tw.h + SMLAWT accu3, accu4, val_tw, accu1 // accu3 = (-accu4)*val_tw.l-(-accu3)*val_tw.h + SMLAWB accu4, accu4, val_tw, accu2 // accu4 = (-accu3)*val_tw.l+(-accu4)*val_tw.h + + LDR accu1, [pDat_1, #-4] // accu1 = pDat_1[-1] + LDR accu2, [pDat_1] // accu2 = pDat_1[0] + + STR accu3, [pDat_0], #4 // *pDat_0++ = accu3 + STR accu4, [pDat_1], #-4 // *pDat_1-- = accu4 + + SUBS i, i, #1 + BNE dst_IV_loop2 + } + + /* Last Sin and Cos value pair are the same */ + accu1 = fMultDiv2(-accu1, WTC(0x5a82799a)); + accu2 = fMultDiv2(-accu2, WTC(0x5a82799a)); + + *pDat_0 = accu1 + accu2; + *pDat_1 = accu1 - accu2; +} +#endif /* FUNCTION_dst_IV_func2 */ diff --git a/libFDK/src/arm/fft_rad2_arm.cpp b/libFDK/src/arm/fft_rad2_arm.cpp new file mode 100644 index 0000000..f40961a --- /dev/null +++ b/libFDK/src/arm/fft_rad2_arm.cpp @@ -0,0 +1,259 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: dit_fft ARM assembler replacements. + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +/* NEON optimized FFT currently builds only with RVCT toolchain */ + +#ifndef FUNCTION_dit_fft + +/* If dit_fft was not yet defined by ARM-Cortex ... */ + +#if defined(SINETABLE_16BIT) + +#define FUNCTION_dit_fft + +/***************************************************************************** + + date: 28.07.2005 srl + + Contents/description: dit-tukey-FFT-algorithm + +******************************************************************************/ + +#if defined(FUNCTION_dit_fft) + + +void dit_fft(FIXP_DBL *x, const INT ldn, const FIXP_STP *trigdata, const INT trigDataSize) +{ + const INT n=1<<ldn; + INT i; + + scramble(x,n); + /* + * 1+2 stage radix 4 + */ + + for (i=0;i<n*2;i+=8) + { + FIXP_DBL a00, a10, a20, a30; + a00 = (x[i + 0] + x[i + 2])>>1; /* Re A + Re B */ + a10 = (x[i + 4] + x[i + 6])>>1; /* Re C + Re D */ + a20 = (x[i + 1] + x[i + 3])>>1; /* Im A + Im B */ + a30 = (x[i + 5] + x[i + 7])>>1; /* Im C + Im D */ + + x[i + 0] = a00 + a10; /* Re A' = Re A + Re B + Re C + Re D */ + x[i + 4] = a00 - a10; /* Re C' = Re A + Re B - Re C - Re D */ + x[i + 1] = a20 + a30; /* Im A' = Im A + Im B + Im C + Im D */ + x[i + 5] = a20 - a30; /* Im C' = Im A + Im B - Im C - Im D */ + + a00 = a00 - x[i + 2]; /* Re A - Re B */ + a10 = a10 - x[i + 6]; /* Re C - Re D */ + a20 = a20 - x[i + 3]; /* Im A - Im B */ + a30 = a30 - x[i + 7]; /* Im C - Im D */ + + x[i + 2] = a00 + a30; /* Re B' = Re A - Re B + Im C - Im D */ + x[i + 6] = a00 - a30; /* Re D' = Re A - Re B - Im C + Im D */ + x[i + 3] = a20 - a10; /* Im B' = Im A - Im B - Re C + Re D */ + x[i + 7] = a20 + a10; /* Im D' = Im A - Im B + Re C - Re D */ + } + + INT mh = 1 << 1; + INT ldm = ldn - 2; + INT trigstep = trigDataSize; + + do + { + const FIXP_STP *pTrigData = trigdata; + INT j; + + mh <<= 1; + trigstep >>= 1; + + FDK_ASSERT(trigstep > 0); + + /* Do first iteration with c=1.0 and s=0.0 separately to avoid loosing to much precision. + Beware: The impact on the overal FFT precision is rather large. */ + { + FIXP_DBL *xt1 = x; + int r = n; + + do { + FIXP_DBL *xt2 = xt1 + (mh<<1); + /* + FIXP_DBL *xt1 = x+ ((r)<<1); + FIXP_DBL *xt2 = xt1 + (mh<<1); + */ + FIXP_DBL vr,vi,ur,ui; + + //cplxMultDiv2(&vi, &vr, x[t2+1], x[t2], (FIXP_SGL)1.0, (FIXP_SGL)0.0); + vi = xt2[1]>>1; + vr = xt2[0]>>1; + + ur = xt1[0]>>1; + ui = xt1[1]>>1; + + xt1[0] = ur+vr; + xt1[1] = ui+vi; + + xt2[0] = ur-vr; + xt2[1] = ui-vi; + + xt1 += mh; + xt2 += mh; + + //cplxMultDiv2(&vr, &vi, x[t2+1], x[t2], (FIXP_SGL)1.0, (FIXP_SGL)0.0); + vr = xt2[1]>>1; + vi = xt2[0]>>1; + + ur = xt1[0]>>1; + ui = xt1[1]>>1; + + xt1[0] = ur+vr; + xt1[1] = ui-vi; + + xt2[0] = ur-vr; + xt2[1] = ui+vi; + + xt1 = xt2 + mh; + } while ((r=r-(mh<<1)) != 0); + } + for(j=4; j<mh; j+=4) + { + FIXP_DBL *xt1 = x + (j>>1); + FIXP_SPK cs; + int r = n; + + pTrigData += trigstep; + cs = *pTrigData; + + do + { + FIXP_DBL *xt2 = xt1 + (mh<<1); + FIXP_DBL vr,vi,ur,ui; + + cplxMultDiv2(&vi, &vr, xt2[1], xt2[0], cs); + + ur = xt1[0]>>1; + ui = xt1[1]>>1; + + xt1[0] = ur+vr; + xt1[1] = ui+vi; + + xt2[0] = ur-vr; + xt2[1] = ui-vi; + + xt1 += mh; + xt2 += mh; + + cplxMultDiv2(&vr, &vi, xt2[1], xt2[0], cs); + + ur = xt1[0]>>1; + ui = xt1[1]>>1; + + xt1[0] = ur+vr; + xt1[1] = ui-vi; + + xt2[0] = ur-vr; + xt2[1] = ui+vi; + + /* Same as above but for t1,t2 with j>mh/4 and thus cs swapped */ + xt1 = xt1 - (j); + xt2 = xt1 + (mh<<1); + + cplxMultDiv2(&vi, &vr, xt2[0], xt2[1], cs); + + ur = xt1[0]>>1; + ui = xt1[1]>>1; + + xt1[0] = ur+vr; + xt1[1] = ui-vi; + + xt2[0] = ur-vr; + xt2[1] = ui+vi; + + xt1 += mh; + xt2 += mh; + + cplxMultDiv2(&vr, &vi, xt2[0], xt2[1], cs); + + ur = xt1[0]>>1; + ui = xt1[1]>>1; + + xt1[0] = ur-vr; + xt1[1] = ui-vi; + + xt2[0] = ur+vr; + xt2[1] = ui+vi; + + xt1 = xt2 + (j); + } while ((r=r-(mh<<1)) != 0); + } + { + FIXP_DBL *xt1 = x + (mh>>1); + int r = n; + + do + { + FIXP_DBL *xt2 = xt1 + (mh<<1); + FIXP_DBL vr,vi,ur,ui; + + cplxMultDiv2(&vi, &vr, xt2[1], xt2[0], STC(0x5a82799a), STC(0x5a82799a)); + + ur = xt1[0]>>1; + ui = xt1[1]>>1; + + xt1[0] = ur+vr; + xt1[1] = ui+vi; + + xt2[0] = ur-vr; + xt2[1] = ui-vi; + + xt1 += mh; + xt2 += mh; + + cplxMultDiv2(&vr, &vi, xt2[1], xt2[0], STC(0x5a82799a), STC(0x5a82799a)); + + ur = xt1[0]>>1; + ui = xt1[1]>>1; + + xt1[0] = ur+vr; + xt1[1] = ui-vi; + + xt2[0] = ur-vr; + xt2[1] = ui+vi; + + xt1 = xt2 + mh; + } while ((r=r-(mh<<1)) != 0); + } + } while (--ldm != 0); +} + +#endif /* if defined(FUNCTION_dit_fft) */ + +#endif /* if defined(SINETABLE_16BIT) */ + +#endif /* ifndef FUNCTION_dit_fft */ diff --git a/libFDK/src/arm/qmf_arm.cpp b/libFDK/src/arm/qmf_arm.cpp new file mode 100644 index 0000000..df538a4 --- /dev/null +++ b/libFDK/src/arm/qmf_arm.cpp @@ -0,0 +1,710 @@ +/**************************************************************************** + + (C) Copyright Fraunhofer IIS (2004) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + + $Id$ + + History: 04-NOV-2009 A. Tritthart Optimized qmfSynPrototypeFirSlot1 + +****************************************************************************/ +#if (QMF_NO_POLY==5) + +#define FUNCTION_qmfForwardModulationLP_odd + +#ifdef FUNCTION_qmfForwardModulationLP_odd +static void +qmfForwardModulationLP_odd( HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Analysis Bank */ + const FIXP_QMF *timeIn, /*!< Time Signal */ + FIXP_QMF *rSubband ) /*!< Real Output */ +{ + int i; + int L = anaQmf->no_channels; + int M = L>>1; + int shift = (anaQmf->no_channels>>6) + 1; + int rSubband_e = 0; + + FIXP_QMF *rSubbandPtr0 = &rSubband[M+0]; /* runs with increment */ + FIXP_QMF *rSubbandPtr1 = &rSubband[M-1]; /* runs with decrement */ + FIXP_QMF *timeIn0 = (FIXP_DBL *) &timeIn[0]; /* runs with increment */ + FIXP_QMF *timeIn1 = (FIXP_DBL *) &timeIn[L]; /* runs with increment */ + FIXP_QMF *timeIn2 = (FIXP_DBL *) &timeIn[L-1]; /* runs with decrement */ + FIXP_QMF *timeIn3 = (FIXP_DBL *) &timeIn[2*L-1]; /* runs with decrement */ + + for (i = 0; i < M; i++) + { + *rSubbandPtr0++ = (*timeIn2-- >> 1) - (*timeIn0++ >> shift); + *rSubbandPtr1-- = (*timeIn1++ >> 1) + (*timeIn3-- >> shift); + } + + dct_IV(rSubband,L, &rSubband_e); +} +#endif /* FUNCTION_qmfForwardModulationLP_odd */ + + +/* NEON optimized QMF currently builts only with RVCT toolchain */ + +#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_5TE__) + +#if (SAMPLE_BITS == 16) +#define FUNCTION_qmfAnaPrototypeFirSlot +#endif + +#ifdef FUNCTION_qmfAnaPrototypeFirSlot + +#if defined(__GNUC__) /* cppp replaced: elif */ + +inline INT SMULBB (const SHORT a, const LONG b) +{ + INT result ; + __asm__ ("smulbb %0, %1, %2" + : "=r" (result) + : "r" (a), "r" (b)) ; + return result ; +} +inline INT SMULBT (const SHORT a, const LONG b) +{ + INT result ; + __asm__ ("smulbt %0, %1, %2" + : "=r" (result) + : "r" (a), "r" (b)) ; + return result ; +} + +inline INT SMLABB(const LONG accu, const SHORT a, const LONG b) +{ + INT result ; + __asm__ ("smlabb %0, %1, %2,%3" + : "=r" (result) + : "r" (a), "r" (b), "r" (accu)) ; + return result; +} +inline INT SMLABT(const LONG accu, const SHORT a, const LONG b) +{ + INT result ; + __asm__ ("smlabt %0, %1, %2,%3" + : "=r" (result) + : "r" (a), "r" (b), "r" (accu)) ; + return result; +} +#endif /* compiler selection */ + + +void qmfAnaPrototypeFirSlot( FIXP_QMF *analysisBuffer, + int no_channels, /*!< Number channels of analysis filter */ + const FIXP_PFT *p_filter, + int p_stride, /*!< Stide of analysis filter */ + FIXP_QAS *RESTRICT pFilterStates + ) +{ + LONG *p_flt = (LONG *) p_filter; + LONG flt; + FIXP_QMF *RESTRICT pData_0 = analysisBuffer + 2*no_channels - 1; + FIXP_QMF *RESTRICT pData_1 = analysisBuffer; + + FIXP_QAS *RESTRICT sta_0 = (FIXP_QAS *)pFilterStates; + FIXP_QAS *RESTRICT sta_1 = (FIXP_QAS *)pFilterStates + (2*QMF_NO_POLY*no_channels) - 1; + + FIXP_DBL accu0, accu1; + FIXP_QAS sta0, sta1; + + int staStep1 = no_channels<<1; + int staStep2 = (no_channels<<3) - 1; /* Rewind one less */ + + if (p_stride == 1) + { + /* FIR filter 0 */ + flt = *p_flt++; + sta1 = *sta_1; sta_1 -= staStep1; + accu1 = SMULBB( sta1, flt); + sta1 = *sta_1; sta_1 -= staStep1; + accu1 = SMLABT( accu1, sta1, flt); + + flt = *p_flt++; + sta1 = *sta_1; sta_1 -= staStep1; + accu1 = SMLABB( accu1, sta1, flt); + sta1 = *sta_1; sta_1 -= staStep1; + accu1 = SMLABT( accu1, sta1, flt); + + flt = *p_flt++; + sta1 = *sta_1; sta_1 += staStep2; + accu1 = SMLABB( accu1, sta1, flt); + *pData_1++ = FX_DBL2FX_QMF(accu1<<1); + + /* FIR filters 1..63 127..65 or 1..31 63..33 */ + no_channels >>= 1; + for (; --no_channels; ) + { + sta0 = *sta_0; sta_0 += staStep1; /* 1,3,5, ... 29/61 */ + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMULBT( sta0, flt); + accu1 = SMULBT( sta1, flt); + + flt = *p_flt++; + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABB( accu0, sta0, flt); + accu1 = SMLABB( accu1, sta1, flt); + + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABT( accu0, sta0, flt); + accu1 = SMLABT( accu1, sta1, flt); + + flt = *p_flt++; + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABB( accu0, sta0, flt); + accu1 = SMLABB( accu1, sta1, flt); + + sta0 = *sta_0; sta_0 -= staStep2; + sta1 = *sta_1; sta_1 += staStep2; + accu0 = SMLABT( accu0, sta0, flt); + accu1 = SMLABT( accu1, sta1, flt); + + *pData_0-- = FX_DBL2FX_QMF(accu0<<1); + *pData_1++ = FX_DBL2FX_QMF(accu1<<1); + + /* Same sequence as above, but mix B=bottom with T=Top */ + + flt = *p_flt++; + sta0 = *sta_0; sta_0 += staStep1; /* 2,4,6, ... 30/62 */ + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMULBB( sta0, flt); + accu1 = SMULBB( sta1, flt); + + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABT( accu0, sta0, flt); + accu1 = SMLABT( accu1, sta1, flt); + + flt = *p_flt++; + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABB( accu0, sta0, flt); + accu1 = SMLABB( accu1, sta1, flt); + + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABT( accu0, sta0, flt); + accu1 = SMLABT( accu1, sta1, flt); + + flt = *p_flt++; + sta0 = *sta_0; sta_0 -= staStep2; + sta1 = *sta_1; sta_1 += staStep2; + accu0 = SMLABB( accu0, sta0, flt); + accu1 = SMLABB( accu1, sta1, flt); + + *pData_0-- = FX_DBL2FX_QMF(accu0<<1); + *pData_1++ = FX_DBL2FX_QMF(accu1<<1); + } + + /* FIR filter 31/63 and 33/65 */ + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMULBT( sta0, flt); + accu1 = SMULBT( sta1, flt); + + flt = *p_flt++; + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABB( accu0, sta0, flt); + accu1 = SMLABB( accu1, sta1, flt); + + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABT( accu0, sta0, flt); + accu1 = SMLABT( accu1, sta1, flt); + + flt = *p_flt++; + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABB( accu0, sta0, flt); + accu1 = SMLABB( accu1, sta1, flt); + + sta0 = *sta_0; sta_0 -= staStep2; + sta1 = *sta_1; sta_1 += staStep2; + accu0 = SMLABT( accu0, sta0, flt); + accu1 = SMLABT( accu1, sta1, flt); + + *pData_0-- = FX_DBL2FX_QMF(accu0<<1); + *pData_1++ = FX_DBL2FX_QMF(accu1<<1); + + /* FIR filter 32/64 */ + flt = *p_flt++; + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMULBB( sta0, flt); + accu1 = SMULBB( sta1, flt); + + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABT( accu0, sta0, flt); + accu1 = SMLABT( accu1, sta1, flt); + + flt = *p_flt++; + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABB( accu0, sta0, flt); + accu1 = SMLABB( accu1, sta1, flt); + + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABT( accu0, sta0, flt); + accu1 = SMLABT( accu1, sta1, flt); + + flt = *p_flt; + sta0 = *sta_0; + sta1 = *sta_1; + accu0 = SMLABB( accu0, sta0, flt); + accu1 = SMLABB( accu1, sta1, flt); + + *pData_0-- = FX_DBL2FX_QMF(accu0<<1); + *pData_1++ = FX_DBL2FX_QMF(accu1<<1); + } + else + { + int pfltStep = QMF_NO_POLY * (p_stride-1); + + flt = p_flt[0]; + sta1 = *sta_1; sta_1 -= staStep1; + accu1 = SMULBB( sta1, flt); + sta1 = *sta_1; sta_1 -= staStep1; + accu1 = SMLABT( accu1, sta1, flt); + + flt = p_flt[1]; + sta1 = *sta_1; sta_1 -= staStep1; + accu1 = SMLABB( accu1, sta1, flt); + sta1 = *sta_1; sta_1 -= staStep1; + accu1 = SMLABT( accu1, sta1, flt); + + flt = p_flt[2]; p_flt += pfltStep; + sta1 = *sta_1; sta_1 += staStep2; + accu1 = SMLABB( accu1, sta1, flt); + *pData_1++ = FX_DBL2FX_QMF(accu1<<1); + + /* FIR filters 1..63 127..65 or 1..31 63..33 */ + for (; --no_channels; ) + { + flt = p_flt[0]; + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMULBB( sta0, flt); + accu1 = SMULBB( sta1, flt); + + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABT( accu0, sta0, flt); + accu1 = SMLABT( accu1, sta1, flt); + + flt = p_flt[1]; + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABB( accu0, sta0, flt); + accu1 = SMLABB( accu1, sta1, flt); + + sta0 = *sta_0; sta_0 += staStep1; + sta1 = *sta_1; sta_1 -= staStep1; + accu0 = SMLABT( accu0, sta0, flt); + accu1 = SMLABT( accu1, sta1, flt); + + flt = p_flt[2]; p_flt += pfltStep; + sta0 = *sta_0; sta_0 -= staStep2; + sta1 = *sta_1; sta_1 += staStep2; + accu0 = SMLABB( accu0, sta0, flt); + accu1 = SMLABB( accu1, sta1, flt); + + *pData_0-- = FX_DBL2FX_QMF(accu0<<1); + *pData_1++ = FX_DBL2FX_QMF(accu1<<1); + } + + /* FIR filter 32/64 */ + flt = p_flt[0]; + sta0 = *sta_0; sta_0 += staStep1; + accu0 = SMULBB( sta0, flt); + sta0 = *sta_0; sta_0 += staStep1; + accu0 = SMLABT( accu0, sta0, flt); + + flt = p_flt[1]; + sta0 = *sta_0; sta_0 += staStep1; + accu0 = SMLABB( accu0, sta0, flt); + sta0 = *sta_0; sta_0 += staStep1; + accu0 = SMLABT( accu0, sta0, flt); + + flt = p_flt[2]; + sta0 = *sta_0; + accu0 = SMLABB( accu0, sta0, flt); + *pData_0-- = FX_DBL2FX_QMF(accu0<<1); + } +} +#endif /* FUNCTION_qmfAnaPrototypeFirSlot */ +#endif /* #if defined(__CC_ARM) && defined(__ARM_ARCH_6__) */ + +#if ( defined(__ARM_ARCH_5TE__) && (SAMPLE_BITS == 16) ) && !defined(QMF_TABLE_FULL) + +#define FUNCTION_qmfSynPrototypeFirSlot + +#if defined(FUNCTION_qmfSynPrototypeFirSlot) + +#if defined(__GNUC__) /* cppp replaced: elif */ + +inline INT SMULWB (const LONG a, const LONG b) +{ + INT result ; + __asm__ ("smulwb %0, %1, %2" + : "=r" (result) + : "r" (a), "r" (b)) ; + + return result ; +} +inline INT SMULWT (const LONG a, const LONG b) +{ + INT result ; + __asm__ ("smulwt %0, %1, %2" + : "=r" (result) + : "r" (a), "r" (b)) ; + + return result ; +} + +inline INT SMLAWB(const LONG accu, const LONG a, const LONG b) +{ + INT result; + asm("smlawb %0, %1, %2, %3 " + : "=r" (result) + : "r" (a), "r" (b), "r" (accu) ); + return result ; +} + +inline INT SMLAWT(const LONG accu, const LONG a, const LONG b) +{ + INT result; + asm("smlawt %0, %1, %2, %3 " + : "=r" (result) + : "r" (a), "r" (b), "r" (accu) ); + return result ; +} + +#endif /* ARM compiler selector */ + + +static void qmfSynPrototypeFirSlot1_filter(FIXP_QMF *RESTRICT realSlot, + FIXP_QMF *RESTRICT imagSlot, + const FIXP_DBL *RESTRICT p_flt, + FIXP_QSS *RESTRICT sta, + FIXP_DBL *pMyTimeOut, + int no_channels) +{ + /* This code was the base for the above listed assembler sequence */ + /* It can be used for debugging purpose or further optimizations */ + const FIXP_DBL *RESTRICT p_fltm = p_flt + 155; + + do + { + FIXP_DBL result; + FIXP_DBL A, B, real, imag, sta0; + + real = *--realSlot; + imag = *--imagSlot; + B = p_flt[4]; /* Bottom=[8] Top=[9] */ + A = p_fltm[3]; /* Bottom=[316] Top=[317] */ + sta0 = sta[0]; /* save state[0] */ + *sta++ = SMLAWT( sta[1], imag, B ); /* index=9...........319 */ + *sta++ = SMLAWB( sta[1], real, A ); /* index=316...........6 */ + *sta++ = SMLAWB( sta[1], imag, B ); /* index=8,18, ...318 */ + B = p_flt[3]; /* Bottom=[6] Top=[7] */ + *sta++ = SMLAWT( sta[1], real, A ); /* index=317...........7 */ + A = p_fltm[4]; /* Bottom=[318] Top=[319] */ + *sta++ = SMLAWT( sta[1], imag, B ); /* index=7...........317 */ + *sta++ = SMLAWB( sta[1], real, A ); /* index=318...........8 */ + *sta++ = SMLAWB( sta[1], imag, B ); /* index=6...........316 */ + B = p_flt[2]; /* Bottom=[X] Top=[5] */ + *sta++ = SMLAWT( sta[1], real, A ); /* index=9...........319 */ + A = p_fltm[2]; /* Bottom=[X] Top=[315] */ + *sta++ = SMULWT( imag, B ); /* index=5,15, ... 315 */ + result = SMLAWT( sta0, real, A ); /* index=315...........5 */ + + *pMyTimeOut++ = result; + + real = *--realSlot; + imag = *--imagSlot; + A = p_fltm[0]; /* Bottom=[310] Top=[311] */ + B = p_flt[7]; /* Bottom=[14] Top=[15] */ + result = SMLAWB( sta[0], real, A ); /* index=310...........0 */ + *sta++ = SMLAWB( sta[1], imag, B ); /* index=14..........324 */ + *pMyTimeOut++ = result; + B = p_flt[6]; /* Bottom=[12] Top=[13] */ + *sta++ = SMLAWT( sta[1], real, A ); /* index=311...........1 */ + A = p_fltm[1]; /* Bottom=[312] Top=[313] */ + *sta++ = SMLAWT( sta[1], imag, B ); /* index=13..........323 */ + *sta++ = SMLAWB( sta[1], real, A ); /* index=312...........2 */ + *sta++ = SMLAWB( sta[1], imag, B ); /* index=12..........322 */ + *sta++ = SMLAWT( sta[1], real, A ); /* index=313...........3 */ + A = p_fltm[2]; /* Bottom=[314] Top=[315] */ + B = p_flt[5]; /* Bottom=[10] Top=[11] */ + *sta++ = SMLAWT( sta[1], imag, B ); /* index=11..........321 */ + *sta++ = SMLAWB( sta[1], real, A ); /* index=314...........4 */ + *sta++ = SMULWB( imag, B ); /* index=10..........320 */ + + + p_flt += 5; + p_fltm -= 5; + } + while ((--no_channels) != 0); + +} + + + +INT qmfSynPrototypeFirSlot2( + HANDLE_QMF_FILTER_BANK qmf, + FIXP_QMF *RESTRICT realSlot, /*!< Input: Pointer to real Slot */ + FIXP_QMF *RESTRICT imagSlot, /*!< Input: Pointer to imag Slot */ + INT_PCM *RESTRICT timeOut, /*!< Time domain data */ + INT stride /*!< Time output buffer stride factor*/ + ) +{ + FIXP_QSS *RESTRICT sta = (FIXP_QSS*)qmf->FilterStates; + int no_channels = qmf->no_channels; + int scale = ((DFRACT_BITS-SAMPLE_BITS)-1-qmf->outScalefactor); + + /* We map an arry of 16-bit values upon an array of 2*16-bit values to read 2 values in one shot */ + const FIXP_DBL *RESTRICT p_flt = (FIXP_DBL *) qmf->p_filter; /* low=[0], high=[1] */ + const FIXP_DBL *RESTRICT p_fltm = (FIXP_DBL *) qmf->p_filter + 155; /* low=[310], high=[311] */ + + FDK_ASSERT(SAMPLE_BITS-1-qmf->outScalefactor >= 0); // (DFRACT_BITS-SAMPLE_BITS)-1-qmf->outScalefactor >= 0); + FDK_ASSERT(qmf->p_stride==2 && qmf->no_channels == 32); + + FDK_ASSERT((no_channels&3) == 0); /* should be a multiple of 4 */ + + realSlot += no_channels-1; // ~~"~~ + imagSlot += no_channels-1; // no_channels-1 .. 0 + + FIXP_DBL MyTimeOut[32]; + FIXP_DBL *pMyTimeOut = &MyTimeOut[0]; + + for (no_channels = no_channels; no_channels--;) + { + FIXP_DBL result; + FIXP_DBL A, B, real, imag; + + real = *realSlot--; + imag = *imagSlot--; + A = p_fltm[0]; /* Bottom=[310] Top=[311] */ + B = p_flt[7]; /* Bottom=[14] Top=[15] */ + result = SMLAWB( sta[0], real, A ); /* index=310...........0 */ + *sta++ = SMLAWB( sta[1], imag, B ); /* index=14..........324 */ + B = p_flt[6]; /* Bottom=[12] Top=[13] */ + *sta++ = SMLAWT( sta[1], real, A ); /* index=311...........1 */ + A = p_fltm[1]; /* Bottom=[312] Top=[313] */ + *sta++ = SMLAWT( sta[1], imag, B ); /* index=13..........323 */ + *sta++ = SMLAWB( sta[1], real, A ); /* index=312...........2 */ + *sta++ = SMLAWB( sta[1], imag, B ); /* index=12..........322 */ + *sta++ = SMLAWT( sta[1], real, A ); /* index=313...........3 */ + A = p_fltm[2]; /* Bottom=[314] Top=[315] */ + B = p_flt[5]; /* Bottom=[10] Top=[11] */ + *sta++ = SMLAWT( sta[1], imag, B ); /* index=11..........321 */ + *sta++ = SMLAWB( sta[1], real, A ); /* index=314...........4 */ + *sta++ = SMULWB( imag, B ); /* index=10..........320 */ + + *pMyTimeOut++ = result; + + p_fltm -= 5; + p_flt += 5; + } + + pMyTimeOut = &MyTimeOut[0]; +#if (SAMPLE_BITS == 16) + const FIXP_DBL max_pos = (FIXP_DBL) 0x00007FFF << scale; + const FIXP_DBL max_neg = (FIXP_DBL) 0xFFFF8001 << scale; +#else + scale = -scale; + const FIXP_DBL max_pos = (FIXP_DBL) 0x7FFFFFFF >> scale; + const FIXP_DBL max_neg = (FIXP_DBL) 0x80000001 >> scale; +#endif + const FIXP_DBL add_neg = (1 << scale) - 1; + + no_channels = qmf->no_channels; + + timeOut += no_channels*stride; + + FDK_ASSERT(scale >= 0); + + if (qmf->outGain != 0x80000000) + { + FIXP_DBL gain = qmf->outGain; + for (no_channels>>=2; no_channels--;) + { + FIXP_DBL result1, result2; + + result1 = *pMyTimeOut++; + result2 = *pMyTimeOut++; + + result1 = fMult(result1,gain); + timeOut -= stride; + if (result1 < 0) result1 += add_neg; + if (result1 < max_neg) result1 = max_neg; + if (result1 > max_pos) result1 = max_pos; +#if (SAMPLE_BITS == 16) + timeOut[0] = result1 >> scale; +#else + timeOut[0] = result1 << scale; +#endif + + result2 = fMult(result2,gain); + timeOut -= stride; + if (result2 < 0) result2 += add_neg; + if (result2 < max_neg) result2 = max_neg; + if (result2 > max_pos) result2 = max_pos; +#if (SAMPLE_BITS == 16) + timeOut[0] = result2 >> scale; +#else + timeOut[0] = result2 << scale; +#endif + + result1 = *pMyTimeOut++; + result2 = *pMyTimeOut++; + + result1 = fMult(result1,gain); + timeOut -= stride; + if (result1 < 0) result1 += add_neg; + if (result1 < max_neg) result1 = max_neg; + if (result1 > max_pos) result1 = max_pos; +#if (SAMPLE_BITS == 16) + timeOut[0] = result1 >> scale; +#else + timeOut[0] = result1 << scale; +#endif + + result2 = fMult(result2,gain); + timeOut -= stride; + if (result2 < 0) result2 += add_neg; + if (result2 < max_neg) result2 = max_neg; + if (result2 > max_pos) result2 = max_pos; +#if (SAMPLE_BITS == 16) + timeOut[0] = result2 >> scale; +#else + timeOut[0] = result2 << scale; +#endif + } + } + else + { + for (no_channels>>=2; no_channels--;) + { + FIXP_DBL result1, result2; + result1 = *pMyTimeOut++; + result2 = *pMyTimeOut++; + timeOut -= stride; + if (result1 < 0) result1 += add_neg; + if (result1 < max_neg) result1 = max_neg; + if (result1 > max_pos) result1 = max_pos; +#if (SAMPLE_BITS == 16) + timeOut[0] = result1 >> scale; +#else + timeOut[0] = result1 << scale; +#endif + + timeOut -= stride; + if (result2 < 0) result2 += add_neg; + if (result2 < max_neg) result2 = max_neg; + if (result2 > max_pos) result2 = max_pos; +#if (SAMPLE_BITS == 16) + timeOut[0] = result2 >> scale; +#else + timeOut[0] = result2 << scale; +#endif + + result1 = *pMyTimeOut++; + result2 = *pMyTimeOut++; + timeOut -= stride; + if (result1 < 0) result1 += add_neg; + if (result1 < max_neg) result1 = max_neg; + if (result1 > max_pos) result1 = max_pos; +#if (SAMPLE_BITS == 16) + timeOut[0] = result1 >> scale; +#else + timeOut[0] = result1 << scale; +#endif + + timeOut -= stride; + if (result2 < 0) result2 += add_neg; + if (result2 < max_neg) result2 = max_neg; + if (result2 > max_pos) result2 = max_pos; +#if (SAMPLE_BITS == 16) + timeOut[0] = result2 >> scale; +#else + timeOut[0] = result2 << scale; +#endif + } + } + return 0; +} + +static +void qmfSynPrototypeFirSlot_fallback( HANDLE_QMF_FILTER_BANK qmf, + FIXP_DBL *realSlot, /*!< Input: Pointer to real Slot */ + FIXP_DBL *imagSlot, /*!< Input: Pointer to imag Slot */ + INT_PCM *timeOut, /*!< Time domain data */ + const int stride + ); + +/*! + \brief Perform Synthesis Prototype Filtering on a single slot of input data. + + The filter takes 2 * #MAX_SYNTHESIS_CHANNELS of input data and + generates #MAX_SYNTHESIS_CHANNELS time domain output samples. +*/ + +static +void qmfSynPrototypeFirSlot( HANDLE_QMF_FILTER_BANK qmf, + FIXP_DBL *realSlot, /*!< Input: Pointer to real Slot */ + FIXP_DBL *imagSlot, /*!< Input: Pointer to imag Slot */ + INT_PCM *timeOut, /*!< Time domain data */ + const int stride + ) +{ + INT err = -1; + + switch (qmf->p_stride) { + case 2: + err = qmfSynPrototypeFirSlot2(qmf, realSlot, imagSlot, timeOut, stride); + break; + default: + err = -1; + } + + /* fallback if configuration not available or failed */ + if(err!=0) { + qmfSynPrototypeFirSlot_fallback(qmf, realSlot, imagSlot, timeOut, stride); + } +} +#endif /* FUNCTION_qmfSynPrototypeFirSlot */ + +#endif /* ( defined(__CC_ARM) && defined(__ARM_ARCH_5TE__) && (SAMPLE_BITS == 16) ) && !defined(QMF_TABLE_FULL) */ + + + +/* #####################################################################################*/ + + + +#endif /* (QMF_NO_POLY==5) */ + diff --git a/libFDK/src/arm/scale_arm.cpp b/libFDK/src/arm/scale_arm.cpp new file mode 100644 index 0000000..906766f --- /dev/null +++ b/libFDK/src/arm/scale_arm.cpp @@ -0,0 +1,110 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Arthur Tritthart + Description: Scaling operations for ARM + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +/* prevent multiple inclusion with re-definitions */ +#ifndef __INCLUDE_SCALE_ARM__ +#define __INCLUDE_SCALE_ARM__ + +#define FUNCTION_scaleValuesWithFactor_DBL + +SCALE_INLINE +void scaleValuesWithFactor( + FIXP_DBL *vector, + FIXP_DBL factor, + INT len, + INT scalefactor + ) +{ + /* This code combines the fMult with the scaling */ + /* It performs a fMultDiv2 and increments shift by 1 */ + int shift = scalefactor + 1; + FIXP_DBL *mySpec = vector; + + shift = fixmin_I(shift,(INT)DFRACT_BITS-1); + + if (shift >= 0) + { + for (int i=0; i<(len>>2); i++) + { + FIXP_DBL tmp0 = mySpec[0]; + FIXP_DBL tmp1 = mySpec[1]; + FIXP_DBL tmp2 = mySpec[2]; + FIXP_DBL tmp3 = mySpec[3]; + tmp0 = fMultDiv2(tmp0, factor); + tmp1 = fMultDiv2(tmp1, factor); + tmp2 = fMultDiv2(tmp2, factor); + tmp3 = fMultDiv2(tmp3, factor); + tmp0 <<= shift; + tmp1 <<= shift; + tmp2 <<= shift; + tmp3 <<= shift; + *mySpec++ = tmp0; + *mySpec++ = tmp1; + *mySpec++ = tmp2; + *mySpec++ = tmp3; + } + for (int i=len&3; i--;) + { + FIXP_DBL tmp0 = mySpec[0]; + tmp0 = fMultDiv2(tmp0, factor); + tmp0 <<= shift; + *mySpec++ = tmp0; + } + } + else + { + shift = -shift; + for (int i=0; i<(len>>2); i++) + { + FIXP_DBL tmp0 = mySpec[0]; + FIXP_DBL tmp1 = mySpec[1]; + FIXP_DBL tmp2 = mySpec[2]; + FIXP_DBL tmp3 = mySpec[3]; + tmp0 = fMultDiv2(tmp0, factor); + tmp1 = fMultDiv2(tmp1, factor); + tmp2 = fMultDiv2(tmp2, factor); + tmp3 = fMultDiv2(tmp3, factor); + tmp0 >>= shift; + tmp1 >>= shift; + tmp2 >>= shift; + tmp3 >>= shift; + *mySpec++ = tmp0; + *mySpec++ = tmp1; + *mySpec++ = tmp2; + *mySpec++ = tmp3; + } + for (int i=len&3; i--;) + { + FIXP_DBL tmp0 = mySpec[0]; + tmp0 = fMultDiv2(tmp0, factor); + tmp0 >>= shift; + *mySpec++ = tmp0; + } + } +} + +#endif /* #ifndef __INCLUDE_SCALE_ARM__ */ diff --git a/libFDK/src/autocorr2nd.cpp b/libFDK/src/autocorr2nd.cpp new file mode 100644 index 0000000..83ccc31 --- /dev/null +++ b/libFDK/src/autocorr2nd.cpp @@ -0,0 +1,216 @@ +/*************************** Fraunhofer IIS FDK Tools *********************** + + (C) Copyright Fraunhofer IIS (2009) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Lohwasser + Description: auto-correlation functions + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#include "autocorr2nd.h" + + + +/* If the accumulator does not provide enough overflow bits, + products have to be shifted down in the autocorrelation below. */ +#define SHIFT_FACTOR (5) +#define SHIFT >> (SHIFT_FACTOR) + + +#if defined(__CC_ARM) || defined(__arm__) +#include "arm/autocorr2nd.cpp" +#endif + + +/*! + * + * \brief Calculate second order autocorrelation using 2 accumulators + * + */ +#if !defined(FUNCTION_autoCorr2nd_real) +INT +autoCorr2nd_real (ACORR_COEFS *ac, /*!< Pointer to autocorrelation coeffs */ + const FIXP_DBL *reBuffer, /*!< Pointer to to real part of input samples */ + const int len /*!< Number input samples */ + ) +{ + int j, autoCorrScaling, mScale; + + FIXP_DBL accu1, accu2, accu3, accu4, accu5; + + const FIXP_DBL *pReBuf; + + const FIXP_DBL *realBuf = reBuffer; + + /* + r11r,r22r + r01r,r12r + r02r + */ + pReBuf = realBuf-2; + accu5 = ( (fMultDiv2(pReBuf[0], pReBuf[2]) + + fMultDiv2(pReBuf[1], pReBuf[3])) SHIFT); + pReBuf++; + + //len must be even + accu1 = fPow2Div2(pReBuf[0]) SHIFT; + accu3 = fMultDiv2(pReBuf[0], pReBuf[1]) SHIFT; + pReBuf++; + + for ( j = (len - 2)>>1; j != 0; j--,pReBuf+=2 ) { + + accu1 += ( (fPow2Div2(pReBuf[0]) + + fPow2Div2(pReBuf[1])) SHIFT); + + accu3 += ( (fMultDiv2(pReBuf[0], pReBuf[1]) + + fMultDiv2(pReBuf[1], pReBuf[2])) SHIFT); + + accu5 += ( (fMultDiv2(pReBuf[0], pReBuf[2]) + + fMultDiv2(pReBuf[1], pReBuf[3])) SHIFT); + + } + + accu2 = (fPow2Div2(realBuf[-2]) SHIFT); + accu2 += accu1; + + accu1 += (fPow2Div2(realBuf[len - 2]) SHIFT); + + accu4 = (fMultDiv2(realBuf[-1],realBuf[-2]) SHIFT); + accu4 += accu3; + + accu3 += (fMultDiv2(realBuf[len - 1],realBuf[len - 2]) SHIFT); + + mScale = CntLeadingZeros( (accu1 | accu2 | fAbs(accu3) | fAbs(accu4) | fAbs(accu5)) ) - 1; + autoCorrScaling = mScale - 1 - SHIFT_FACTOR; /* -1 because of fMultDiv2*/ + + /* Scale to common scale factor */ + ac->r11r = accu1 << mScale; + ac->r22r = accu2 << mScale; + ac->r01r = accu3 << mScale; + ac->r12r = accu4 << mScale; + ac->r02r = accu5 << mScale; + + ac->det = (fMultDiv2(ac->r11r,ac->r22r) - fMultDiv2(ac->r12r,ac->r12r)) ; + mScale = CountLeadingBits(fAbs(ac->det)); + + ac->det <<= mScale; + ac->det_scale = mScale - 1; + + return autoCorrScaling; +} +#endif + +#ifndef LOW_POWER_SBR_ONLY +#if !defined(FUNCTION_autoCorr2nd_cplx) +INT +autoCorr2nd_cplx (ACORR_COEFS *ac, /*!< Pointer to autocorrelation coeffs */ + const FIXP_DBL *reBuffer, /*!< Pointer to real part of input samples */ + const FIXP_DBL *imBuffer, /*!< Pointer to imag part of input samples */ + const int len /*!< Number of input samples */ + ) +{ + + int j, autoCorrScaling, mScale, len_scale; + + FIXP_DBL accu0, accu1,accu2, accu3, accu4, accu5, accu6, accu7, accu8; + + const FIXP_DBL *pReBuf, *pImBuf; + + const FIXP_DBL *realBuf = reBuffer; + const FIXP_DBL *imagBuf = imBuffer; + + (len>64) ? (len_scale = 6) : (len_scale = 5); + /* + r00r, + r11r,r22r + r01r,r12r + r01i,r12i + r02r,r02i + */ + accu1 = accu3 = accu5 = accu7 = accu8 = FL2FXCONST_DBL(0.0f); + + pReBuf = realBuf-2, pImBuf = imagBuf-2; + accu7 += ( (fMultDiv2(pReBuf[2], pReBuf[0]) + fMultDiv2(pImBuf[2], pImBuf[0])) >> len_scale); + accu8 += ( (fMultDiv2(pImBuf[2], pReBuf[0]) - fMultDiv2(pReBuf[2], pImBuf[0])) >> len_scale); + + pReBuf = realBuf-1, pImBuf = imagBuf-1; + for ( j = (len - 1); j != 0; j--,pReBuf++,pImBuf++ ){ + accu1 += ( (fPow2Div2(pReBuf[0] ) + fPow2Div2(pImBuf[0] )) >> len_scale); + accu3 += ( (fMultDiv2(pReBuf[0], pReBuf[1]) + fMultDiv2(pImBuf[0], pImBuf[1])) >> len_scale); + accu5 += ( (fMultDiv2(pImBuf[1], pReBuf[0]) - fMultDiv2(pReBuf[1], pImBuf[0])) >> len_scale); + accu7 += ( (fMultDiv2(pReBuf[2], pReBuf[0]) + fMultDiv2(pImBuf[2], pImBuf[0])) >> len_scale); + accu8 += ( (fMultDiv2(pImBuf[2], pReBuf[0]) - fMultDiv2(pReBuf[2], pImBuf[0])) >> len_scale); + } + + accu2 = ( (fPow2Div2(realBuf[-2]) + fPow2Div2(imagBuf[-2])) >> len_scale); + accu2 += accu1; + + accu1 += ( (fPow2Div2(realBuf[len-2]) + + fPow2Div2(imagBuf[len-2])) >> len_scale); + accu0 = ( (fPow2Div2(realBuf[len-1]) + + fPow2Div2(imagBuf[len-1])) >> len_scale) - + ( (fPow2Div2(realBuf[-1]) + + fPow2Div2(imagBuf[-1])) >> len_scale); + accu0 += accu1; + + accu4 = ( (fMultDiv2(realBuf[-1], realBuf[-2]) + + fMultDiv2(imagBuf[-1], imagBuf[-2])) >> len_scale); + accu4 += accu3; + + accu3 += ( (fMultDiv2(realBuf[len-1], realBuf[len-2]) + + fMultDiv2(imagBuf[len-1], imagBuf[len-2])) >> len_scale); + + accu6 = ( (fMultDiv2(imagBuf[-1], realBuf[-2]) - + fMultDiv2(realBuf[-1], imagBuf[-2])) >> len_scale); + accu6 += accu5; + + accu5 += ( (fMultDiv2(imagBuf[len - 1], realBuf[len - 2]) - + fMultDiv2(realBuf[len - 1], imagBuf[len - 2])) >> len_scale); + + mScale = CntLeadingZeros( (accu0 | accu1 | accu2 | fAbs(accu3) | fAbs(accu4) | fAbs(accu5) | + fAbs(accu6) | fAbs(accu7) | fAbs(accu8)) ) - 1; + autoCorrScaling = mScale - 1 - len_scale; /* -1 because of fMultDiv2*/ + + /* Scale to common scale factor */ + ac->r00r = (FIXP_DBL)accu0 << mScale; + ac->r11r = (FIXP_DBL)accu1 << mScale; + ac->r22r = (FIXP_DBL)accu2 << mScale; + ac->r01r = (FIXP_DBL)accu3 << mScale; + ac->r12r = (FIXP_DBL)accu4 << mScale; + ac->r01i = (FIXP_DBL)accu5 << mScale; + ac->r12i = (FIXP_DBL)accu6 << mScale; + ac->r02r = (FIXP_DBL)accu7 << mScale; + ac->r02i = (FIXP_DBL)accu8 << mScale; + + ac->det = ( fMultDiv2(ac->r11r,ac->r22r) >> 1 ) - + ( (fMultDiv2(ac->r12r,ac->r12r) + fMultDiv2(ac->r12i,ac->r12i)) >> 1 ); + mScale = CountLeadingBits(fAbs(ac->det)); + + ac->det <<= mScale; + ac->det_scale = mScale - 2; + + return autoCorrScaling; +} +#endif /* FUNCTION_autoCorr2nd_cplx */ +#endif /* LOW_POWER_SBR_ONLY */ + + diff --git a/libFDK/src/dct.cpp b/libFDK/src/dct.cpp new file mode 100644 index 0000000..d05a26f --- /dev/null +++ b/libFDK/src/dct.cpp @@ -0,0 +1,513 @@ +/**************************************************************************** + + (C) copyright Fraunhofer IIS (2004) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + + $Id$ + +*******************************************************************************/ +/*! + \file dct.cpp + \brief DCT Implementations $Revision: 36871 $ + Library functions to calculate standard DCTs. This will most likely be replaced by hand-optimized + functions for the specific target processor. + + Three different implementations of the dct type II and the dct type III transforms are provided. + + By default implementations which are based on a single, standard complex FFT-kernel are used (dctII_f() and dctIII_f()). + These are specifically helpful in cases where optimized FFT libraries are already available. The FFT used in these + implementation is FFT rad2 from FDK_tools. + + Of course, one might also use DCT-libraries should they be available. The DCT and DST + type IV implementations are only available in a version based on a complex FFT kernel. +*/ + +#include "dct.h" + + +#include "FDK_tools_rom.h" +#include "fft.h" + + +#if defined(__arm__) +#include "arm/dct_arm.cpp" +#endif + + +/*! + * + * \brief Perform dct type 3 + * The dct 3 is calculated by a inverse real fft, with + * some pre twiddeling before the inverse real fft, as discribed by Takuya OOURA. + * (http://momonga.t.u-tokyo.ac.jp/~ooura/fftman/ftmn2_32.html#sec2_3_2) + * The real inverse fft is calculated by a inverse complex fft, as described + * in numerical recipes in C, Cambridge University press + * the auxiliary function is built by reversing the odd samples + * + * Instead of doing 2 times the conjugation to calculate the + * inverse cfft with the cfft, one can also swap elements before + * calling the cfft to get the same result: + * swap + * r(1),i(1) with r(n-1),i(n-1), + * r(2),i(2) with r(n-2),i(n-2), ... + * r(n/2-1),i(n/2-1) with r(n/2+1),i(n/2+1) + * + * + * Scaling 1 shift in pre twiddeling, + * log2(L)-1 in cfft + */ +#if !defined(FUNCTION_dct_III) +void dct_III(FIXP_DBL *pDat, /*!< pointer to input/output */ + FIXP_DBL *tmp, /*!< pointer to temporal working buffer */ + int L, /*!< lenght of transform */ + int *pDat_e + ) +{ + FDK_ASSERT(L == 64 || L == 32); + int i; + FIXP_DBL xr, accu1, accu2; + int inc; + int M = L>>1; + int ld_M; + + if (L == 64) ld_M = 5; + else ld_M = 4; + + /* This loop performs multiplication for index i (i*inc) */ + inc = (64/2) >> ld_M; /* 64/L */ + + FIXP_DBL *pTmp_0 = &tmp[2]; + FIXP_DBL *pTmp_1 = &tmp[(M-1)*2]; + + for(i=1; i<M>>1; i++,pTmp_0+=2,pTmp_1-=2) { + + FIXP_DBL accu3,accu4,accu5,accu6; + + cplxMultDiv2(&accu2, &accu1, pDat[L - i], pDat[i], sin_twiddle_L64[i*inc]); + cplxMultDiv2(&accu4, &accu3, pDat[M+i], pDat[M-i], sin_twiddle_L64[(M-i)*inc]); + accu3 >>= 1; accu4 >>= 1; + + /* This method is better for ARM926, that uses operand2 shifted right by 1 always */ + cplxMultDiv2(&accu6, &accu5, (accu3 - (accu1>>1)), ((accu2>>1) + accu4), sin_twiddle_L64[(4*i)*inc]); + xr = (accu1>>1) + accu3; + pTmp_0[0] = (xr>>1) - accu5; + pTmp_1[0] = (xr>>1) + accu5; + + xr = (accu2>>1) - accu4; + pTmp_0[1] = (xr>>1) - accu6; + pTmp_1[1] = -((xr>>1) + accu6); + + } + + xr = fMultDiv2(pDat[M], sin_twiddle_L64[64/2].v.re );/* cos((PI/(2*L))*M); */ + tmp[0] = ((pDat[0]>>1) + xr)>>1; + tmp[1] = ((pDat[0]>>1) - xr)>>1; + + cplxMultDiv2(&accu2, &accu1, pDat[L - (M/2)], pDat[M/2], sin_twiddle_L64[64/4]); + tmp[M] = accu1>>1; + tmp[M+1] = accu2>>1; + + /* dit_fft expects 1 bit scaled input values */ + fft(M, tmp, pDat_e); + + /* ARM926: 12 cycles per 2-iteration, no overhead code by compiler */ + pTmp_1 = &tmp[L]; + for (i = M>>1; i--;) + { + FIXP_DBL tmp1, tmp2, tmp3, tmp4; + tmp1 = *tmp++; + tmp2 = *tmp++; + tmp3 = *--pTmp_1; + tmp4 = *--pTmp_1; + *pDat++ = tmp1; + *pDat++ = tmp3; + *pDat++ = tmp2; + *pDat++ = tmp4; + } + + *pDat_e += 2; +} +#endif + +/*! + * + * \brief Perform dct type 2 + * The dct 2 is calculated by a real inverse fft, with + * some pre twiddeling after the fft, as discribed by Takuya OOURA. + * (http://momonga.t.u-tokyo.ac.jp/~ooura/fftman/ftmn2_32.html#sec2_3_2) + * The real inverse fft is calculated by a inverse complex fft, as described + * in numerical recipes in C, Cambridge University press + * the auxilery function is build by reversing the odd samples + * + * Scaling 1 shift in pre twiddeling, + * 5 in cfft + */ +#if !defined(FUNCTION_dct_II) +void dct_II(FIXP_DBL *pDat, /*!< pointer to input/output */ + FIXP_DBL *tmp, /*!< pointer to temporal working buffer */ + int L, /*!< lenght of transform */ + int *pDat_e + ) +{ + FDK_ASSERT(L == 64 || L == 32); + FIXP_DBL accu1,accu2; + FIXP_DBL *pTmp_0, *pTmp_1; + + int i; + int inc; + int M = L>>1; + int ld_M; + + FDK_ASSERT(L == 64 || L == 32); + ld_M = 4 + (L >> 6); /* L=64: 5, L=32: 4 */ + + inc = (64/2) >> ld_M; /* L=64: 1, L=32: 2 */ + + FIXP_DBL *pdat = &pDat[0]; + FIXP_DBL accu3, accu4; + pTmp_0 = &tmp[0]; + pTmp_1 = &tmp[L-1]; + for (i = M>>1; i--; ) + { + accu1 = *pdat++; + accu2 = *pdat++; + accu3 = *pdat++; + accu4 = *pdat++; + accu1 >>= 1; + accu2 >>= 1; + accu3 >>= 1; + accu4 >>= 1; + *pTmp_0++ = accu1; + *pTmp_0++ = accu3; + *pTmp_1-- = accu2; + *pTmp_1-- = accu4; + } + + + fft(M, tmp, pDat_e); + + pTmp_0 = &tmp[2]; + pTmp_1 = &tmp[(M-1)*2]; + + for (i=1; i<M>>1; i++,pTmp_0+=2,pTmp_1-=2) { + + FIXP_DBL a1,a2; + FIXP_DBL accu3, accu4; + + a1 = ((pTmp_0[1]>>1) + (pTmp_1[1]>>1)); + a2 = ((pTmp_1[0]>>1) - (pTmp_0[0]>>1)); + + cplxMultDiv2(&accu1, &accu2, a2, a1, sin_twiddle_L64[(4*i)*inc]); + accu1<<=1; accu2<<=1; + + a1 = ((pTmp_0[0]>>1) + (pTmp_1[0]>>1)); + a2 = ((pTmp_0[1]>>1) - (pTmp_1[1]>>1)); + + cplxMultDiv2(&accu3, &accu4, (a1 + accu2), -(accu1 + a2), sin_twiddle_L64[i*inc]); + pDat[L - i] = accu4; + pDat[i] = accu3; + + cplxMultDiv2(&accu3, &accu4, (a1 - accu2), -(accu1 - a2), sin_twiddle_L64[(M-i)*inc]); + pDat[M + i] = accu4; + pDat[M - i] = accu3; + + } + + cplxMultDiv2(&accu1, &accu2, tmp[M], tmp[M+1], sin_twiddle_L64[(M/2)*inc]); + pDat[L - (M/2)] = accu2; + pDat[M/2] = accu1; + + pDat[0] = (tmp[0]>>1)+(tmp[1]>>1); + pDat[M] = fMult(((tmp[0]>>1)-(tmp[1]>>1)), sin_twiddle_L64[64/2].v.re);/* cos((PI/(2*L))*M); */ + + *pDat_e += 2; +} +#endif + +static +void getTables(const FIXP_WTP **twiddle, const FIXP_STP **sin_twiddle, int *sin_step, int length) +{ + int ld2_length; + + /* Get ld2 of length - 2 + 1 + -2: because first table entry is window of size 4 + +1: because we already include +1 because of ceil(log2(length)) */ + ld2_length = DFRACT_BITS-1-fNormz((FIXP_DBL)length) - 1; + + /* Extract sort of "eigenvalue" (the 4 left most bits) of length. */ + switch ( (length) >> (ld2_length-1) ) { + case 0x4: /* radix 2 */ + *sin_twiddle = SineTable512; + *sin_step = 1<<(9 - ld2_length); + *twiddle = windowSlopes[0][0][ld2_length-1]; + break; + case 0x7: /* 10 ms */ + *sin_twiddle = SineTable480; + *sin_step = 1<<(8 - ld2_length); + *twiddle = windowSlopes[0][1][ld2_length]; + break; + default: + *sin_twiddle = NULL; + *sin_step = 0; + *twiddle = NULL; + break; + } + + FDK_ASSERT(*twiddle != NULL); + + FDK_ASSERT(*sin_step > 0); + +} + +#if !defined(FUNCTION_dct_IV) + +void dct_IV(FIXP_DBL *pDat, + int L, + int *pDat_e) +{ + int sin_step = 0; + int M = L >> 1; + + const FIXP_WTP *twiddle; + const FIXP_STP *sin_twiddle; + + FDK_ASSERT(L >= 4); + + getTables(&twiddle, &sin_twiddle, &sin_step, L); + +#ifdef FUNCTION_dct_IV_func1 + if (M>=4 && (M&3) == 0) { + /* ARM926: 44 cycles for 2 iterations = 22 cycles/iteration */ + dct_IV_func1(M>>2, twiddle, &pDat[0], &pDat[L-1]); + } else +#endif /* FUNCTION_dct_IV_func1 */ + { + FIXP_DBL *RESTRICT pDat_0 = &pDat[0]; + FIXP_DBL *RESTRICT pDat_1 = &pDat[L - 2]; + register int i; + + /* 29 cycles on ARM926 */ + for (i = 0; i < M-1; i+=2,pDat_0+=2,pDat_1-=2) + { + register FIXP_DBL accu1,accu2,accu3,accu4; + + accu1 = pDat_1[1]; accu2 = pDat_0[0]; + accu3 = pDat_0[1]; accu4 = pDat_1[0]; + + cplxMultDiv2(&accu1, &accu2, accu1, accu2, twiddle[i]); + cplxMultDiv2(&accu3, &accu4, accu4, accu3, twiddle[i+1]); + + pDat_0[0] = accu2; pDat_0[1] = accu1; + pDat_1[0] = accu4; pDat_1[1] = -accu3; + } + if (M&1) + { + register FIXP_DBL accu1,accu2; + + accu1 = pDat_1[1]; accu2 = pDat_0[0]; + + cplxMultDiv2(&accu1, &accu2, accu1, accu2, twiddle[i]); + + pDat_0[0] = accu2; pDat_0[1] = accu1; + } + } + + fft(M, pDat, pDat_e); + +#ifdef FUNCTION_dct_IV_func2 + if (M>=4 && (M&3) == 0) { + /* ARM926: 42 cycles for 2 iterations = 21 cycles/iteration */ + dct_IV_func2(M>>2, sin_twiddle, &pDat[0], &pDat[L], sin_step); + } else +#endif /* FUNCTION_dct_IV_func2 */ + { + FIXP_DBL *RESTRICT pDat_0 = &pDat[0]; + FIXP_DBL *RESTRICT pDat_1 = &pDat[L - 2]; + register FIXP_DBL accu1,accu2,accu3,accu4; + int idx, i; + + /* Sin and Cos values are 0.0f and 1.0f */ + accu1 = pDat_1[0]; + accu2 = pDat_1[1]; + + pDat_1[1] = -(pDat_0[1]>>1); + pDat_0[0] = (pDat_0[0]>>1); + + + /* 28 cycles for ARM926 */ + for (idx = sin_step,i=1; i<(M+1)>>1; i++, idx+=sin_step) + { + FIXP_STP twd = sin_twiddle[idx]; + cplxMultDiv2(&accu3, &accu4, accu1, accu2, twd); + pDat_0[1] = accu3; + pDat_1[0] = accu4; + + pDat_0+=2; + pDat_1-=2; + + cplxMultDiv2(&accu3, &accu4, pDat_0[1], pDat_0[0], twd); + + accu1 = pDat_1[0]; + accu2 = pDat_1[1]; + + pDat_1[1] = -accu3; + pDat_0[0] = accu4; + } + + if ( (M&1) == 0 ) + { + /* Last Sin and Cos value pair are the same */ + accu1 = fMultDiv2(accu1, WTC(0x5a82799a)); + accu2 = fMultDiv2(accu2, WTC(0x5a82799a)); + + pDat_1[0] = accu1 + accu2; + pDat_0[1] = accu1 - accu2; + } + } + + /* Add twiddeling scale. */ + *pDat_e += 2; +} +#endif /* defined (FUNCTION_dct_IV) */ + +#if !defined(FUNCTION_dst_IV) +void dst_IV(FIXP_DBL *pDat, + int L, + int *pDat_e ) +{ + int sin_step = 0; + int M = L >> 1; + + const FIXP_WTP *twiddle; + const FIXP_STP *sin_twiddle; + +#ifdef DSTIV2_ENABLE + if (L == 2) { + const FIXP_STP tab = STCP(0x7641AF3D, 0x30FB9452); + FIXP_DBL tmp1, tmp2; + + cplxMultDiv2(&tmp2, &tmp1, pDat[0], pDat[1], tab); + + pDat[0] = tmp1; + pDat[1] = tmp2; + + *pDat_e += 1; + + return; + } +#else + FDK_ASSERT(L >= 4); +#endif + + getTables(&twiddle, &sin_twiddle, &sin_step, L); + +#ifdef FUNCTION_dst_IV_func1 + if ( (M>=4) && ((M&3) == 0) ) { + dst_IV_func1(M, twiddle, &pDat[0], &pDat[L]); + } else +#endif + { + FIXP_DBL *RESTRICT pDat_0 = &pDat[0]; + FIXP_DBL *RESTRICT pDat_1 = &pDat[L - 2]; + + register int i; + + /* 34 cycles on ARM926 */ + for (i = 0; i < M-1; i+=2,pDat_0+=2,pDat_1-=2) + { + register FIXP_DBL accu1,accu2,accu3,accu4; + + accu1 = pDat_1[1]; accu2 = -pDat_0[0]; + accu3 = pDat_0[1]; accu4 = -pDat_1[0]; + + cplxMultDiv2(&accu1, &accu2, accu1, accu2, twiddle[i]); + cplxMultDiv2(&accu3, &accu4, accu4, accu3, twiddle[i+1]); + + pDat_0[0] = accu2; pDat_0[1] = accu1; + pDat_1[0] = accu4; pDat_1[1] = -accu3; + } + if (M&1) + { + register FIXP_DBL accu1,accu2; + + accu1 = pDat_1[1]; accu2 = -pDat_0[0]; + + cplxMultDiv2(&accu1, &accu2, accu1, accu2, twiddle[i]); + + pDat_0[0] = accu2; pDat_0[1] = accu1; + } + } + + fft(M, pDat, pDat_e); + +#ifdef FUNCTION_dst_IV_func2 + if ( (M>=4) && ((M&3) == 0) ) { + dst_IV_func2(M>>2, sin_twiddle + sin_step, &pDat[0], &pDat[L - 1], sin_step); + } else +#endif /* FUNCTION_dst_IV_func2 */ + { + FIXP_DBL *RESTRICT pDat_0; + FIXP_DBL *RESTRICT pDat_1; + register FIXP_DBL accu1,accu2,accu3,accu4; + int idx, i; + + pDat_0 = &pDat[0]; + pDat_1 = &pDat[L - 2]; + + /* Sin and Cos values are 0.0f and 1.0f */ + accu1 = pDat_1[0]; + accu2 = pDat_1[1]; + + pDat_1[1] = -(pDat_0[0]>>1); + pDat_0[0] = (pDat_0[1]>>1); + + for (idx = sin_step,i=1; i<(M+1)>>1; i++, idx+=sin_step) + { + FIXP_STP twd = sin_twiddle[idx]; + + cplxMultDiv2(&accu3, &accu4, accu1, accu2, twd); + pDat_1[0] = -accu3; + pDat_0[1] = -accu4; + + pDat_0+=2; + pDat_1-=2; + + cplxMultDiv2(&accu3, &accu4, pDat_0[1], pDat_0[0], twd); + + accu1 = pDat_1[0]; + accu2 = pDat_1[1]; + + pDat_0[0] = accu3; + pDat_1[1] = -accu4; + } + + if ( (M&1) == 0 ) + { + /* Last Sin and Cos value pair are the same */ + accu1 = fMultDiv2(accu1, WTC(0x5a82799a)); + accu2 = fMultDiv2(accu2, WTC(0x5a82799a)); + + pDat_0[1] = - accu1 - accu2; + pDat_1[0] = accu2 - accu1; + } + } + + /* Add twiddeling scale. */ + *pDat_e += 2; +} +#endif /* !defined(FUNCTION_dst_IV) */ + + diff --git a/libFDK/src/fft.cpp b/libFDK/src/fft.cpp new file mode 100644 index 0000000..9f47807 --- /dev/null +++ b/libFDK/src/fft.cpp @@ -0,0 +1,1395 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2001) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Josef Hoepfl, DSP Solutions + Description: Fix point FFT + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + + History: + 20-APR-2010 A. Tritthart replaced modulo operations with comparisons in fft15 + to avoid failures with ARM RVCT 4.0 compiler + Tuned fft15 by 18% (Cortex-A8) to 25% (ARM926) by reprogramming + with merged loops. + +******************************************************************************/ + +#include "fft.h" + +#include "fft_rad2.h" +#include "FDK_tools_rom.h" + + + + + +#define F3C(x) STC(x) + +#define C31 (F3C(0x91261468)) /* FL2FXCONST_DBL(-0.86602540) */ + +/* Performs the FFT of length 3 according to the algorithm after winograd. + No scaling of the input vector because the scaling is already done in the rotation vector. */ +static FORCEINLINE void fft3(FIXP_DBL *RESTRICT pDat) +{ + FIXP_DBL r1,r2; + FIXP_DBL s1,s2; + /* real part */ + r1 = pDat[2] + pDat[4]; + r2 = fMult((pDat[2] - pDat[4]), C31); + pDat[0] = pDat[0] + r1; + r1 = pDat[0] - r1 - (r1>>1); + + /* imaginary part */ + s1 = pDat[3] + pDat[5]; + s2 = fMult((pDat[3] - pDat[5]), C31); + pDat[1] = pDat[1] + s1; + s1 = pDat[1] - s1 - (s1>>1); + + /* combination */ + pDat[2] = r1 - s2; + pDat[4] = r1 + s2; + pDat[3] = s1 + r2; + pDat[5] = s1 - r2; +} + + +//#define F5C(x) ((FIXP_DBL)x) +#define F5C(x) STC(x) + +#define C51 (F5C(0x79bc3854)) /* FL2FXCONST_DBL( 0.95105652) */ +#define C52 (F5C(0x9d839db0)) /* FL2FXCONST_DBL(-1.53884180/2) */ +#define C53 (F5C(0xd18053ce)) /* FL2FXCONST_DBL(-0.36327126) */ +#define C54 (F5C(0x478dde64)) /* FL2FXCONST_DBL( 0.55901699) */ +#define C55 (F5C(0xb0000001)) /* FL2FXCONST_DBL(-1.25/2) */ + +/* performs the FFT of length 5 according to the algorithm after winograd */ +static FORCEINLINE void fft5(FIXP_DBL *RESTRICT pDat) +{ + FIXP_DBL r1,r2,r3,r4; + FIXP_DBL s1,s2,s3,s4; + FIXP_DBL t; + + /* real part */ + r1 = pDat[2] + pDat[8]; + r4 = pDat[2] - pDat[8]; + r3 = pDat[4] + pDat[6]; + r2 = pDat[4] - pDat[6]; + t = fMult((r1-r3), C54); + r1 = r1 + r3; + pDat[0] = pDat[0] + r1; + /* Bit shift left because of the constant C55 which was scaled with the factor 0.5 because of the representation of + the values as fracts */ + r1 = pDat[0] + (fMultDiv2(r1, C55) <<(2)); + r3 = r1 - t; + r1 = r1 + t; + t = fMult((r4 + r2), C51); + /* Bit shift left because of the constant C55 which was scaled with the factor 0.5 because of the representation of + the values as fracts */ + r4 = t + (fMultDiv2(r4, C52) <<(2)); + r2 = t + fMult(r2, C53); + + /* imaginary part */ + s1 = pDat[3] + pDat[9]; + s4 = pDat[3] - pDat[9]; + s3 = pDat[5] + pDat[7]; + s2 = pDat[5] - pDat[7]; + t = fMult((s1 - s3), C54); + s1 = s1 + s3; + pDat[1] = pDat[1] + s1; + /* Bit shift left because of the constant C55 which was scaled with the factor 0.5 because of the representation of + the values as fracts */ + s1 = pDat[1] + (fMultDiv2(s1, C55) <<(2)); + s3 = s1 - t; + s1 = s1 + t; + t = fMult((s4 + s2), C51); + /* Bit shift left because of the constant C55 which was scaled with the factor 0.5 because of the representation of + the values as fracts */ + s4 = t + (fMultDiv2(s4, C52) <<(2)); + s2 = t + fMult(s2, C53); + + /* combination */ + pDat[2] = r1 + s2; + pDat[8] = r1 - s2; + pDat[4] = r3 - s4; + pDat[6] = r3 + s4; + + pDat[3] = s1 - r2; + pDat[9] = s1 + r2; + pDat[5] = s3 + r4; + pDat[7] = s3 - r4; +} + + + + +#define N3 3 +#define N5 5 +#define N6 6 +#define N15 15 + +/* Performs the FFT of length 15. It is split into FFTs of length 3 and length 5. */ +static inline void fft15(FIXP_DBL *pInput) +{ +#if FORCE_CRITICAL_CODE_FOR_RVCT4 + FIXP_DBL accu; + int j; +#endif + FIXP_DBL aDst[2*N15]; + FIXP_DBL aDst1[2*N15]; + int i,k,l; + + /* Sort input vector for fft's of length 3 + input3(0:2) = [input(0) input(5) input(10)]; + input3(3:5) = [input(3) input(8) input(13)]; + input3(6:8) = [input(6) input(11) input(1)]; + input3(9:11) = [input(9) input(14) input(4)]; + input3(12:14) = [input(12) input(2) input(7)]; */ +#if FORCE_CRITICAL_CODE_FOR_RVCT4 + /* This branch generate failures on RVCT 4.0 with ARM926/ARM1136/ARM1176/C-R4, but not on Cortex-A8 */ + pSrc = pInput; + pDst = aDst; + for(i=0,l=0,k=0; i<N5; i++) + { + for(j=0; j<N3; j++) + { + pDst[k] = pSrc[l]; + pDst[k+1] = pSrc[l+1]; + k += 2; + l += 2*N5; + if (l >= (2*N15)) + l -= (2*N15); + } + l += (2*N3); + if (l >= (2*N15)) + l -= (2*N15); + } + /* Perform 5 times the fft of length 3 + output3(0:2) = fft3(input3(0:2)); + output3(3:5) = fft3(input3(3:5)); + output3(6:8) = fft3(input3(6:8)); + output3(9:11) = fft3(input3(9:11)); + output3(12:14) = fft3(input3(12:14)); */ + pSrc=aDst; + for(i=0; i<N5; i++) + { + fft3(pSrc); + pSrc += (2*N3); + } + + /* Scaling of the input vector of the fft5 with the scale factor 0.125 */ + pSrc=aDst; + for(j=0; j<(2*N3*N5); j++) + { + accu = pSrc[j]; + /* 2 bit right shift */ + accu >>= 2; + pSrc[j] = accu; + } +#else + { + const FIXP_DBL *pSrc = pInput; + FIXP_DBL *RESTRICT pDst = aDst; + /* Merge 3 loops into one, skip call of fft3 */ + for(i=0,l=0,k=0; i<N5; i++, k+=6) + { + pDst[k+0] = pSrc[l]; + pDst[k+1] = pSrc[l+1]; + l += 2*N5; + if (l >= (2*N15)) + l -= (2*N15); + + pDst[k+2] = pSrc[l]; + pDst[k+3] = pSrc[l+1]; + l += 2*N5; + if (l >= (2*N15)) + l -= (2*N15); + pDst[k+4] = pSrc[l]; + pDst[k+5] = pSrc[l+1]; + l += (2*N5) + (2*N3); + if (l >= (2*N15)) + l -= (2*N15); + + /* fft3 merged with shift right by 2 loop */ + FIXP_DBL r1,r2,r3; + FIXP_DBL s1,s2; + /* real part */ + r1 = pDst[k+2] + pDst[k+4]; + r2 = fMult((pDst[k+2] - pDst[k+4]), C31); + s1 = pDst[k+0]; + pDst[k+0] = (s1 + r1)>>2; + r1 = s1 - (r1>>1); + + /* imaginary part */ + s1 = pDst[k+3] + pDst[k+5]; + s2 = fMult((pDst[k+3] - pDst[k+5]), C31); + r3 = pDst[k+1]; + pDst[k+1] = (r3 + s1)>>2; + s1 = r3 - (s1>>1); + + /* combination */ + pDst[k+2] = (r1 - s2)>>2; + pDst[k+4] = (r1 + s2)>>2; + pDst[k+3] = (s1 + r2)>>2; + pDst[k+5] = (s1 - r2)>>2; + } + } +#endif + /* Sort input vector for fft's of length 5 + input5(0:4) = [output3(0) output3(3) output3(6) output3(9) output3(12)]; + input5(5:9) = [output3(1) output3(4) output3(7) output3(10) output3(13)]; + input5(10:14) = [output3(2) output3(5) output3(8) output3(11) output3(14)]; */ + /* Merge 2 loops into one, brings about 10% */ + { + const FIXP_DBL *pSrc = aDst; + FIXP_DBL *RESTRICT pDst = aDst1; + for(i=0,l=0,k=0; i<N3; i++, k+=10) + { + l = 2*i; + pDst[k+0] = pSrc[l+0]; + pDst[k+1] = pSrc[l+1]; + pDst[k+2] = pSrc[l+0+(2*N3)]; + pDst[k+3] = pSrc[l+1+(2*N3)]; + pDst[k+4] = pSrc[l+0+(4*N3)]; + pDst[k+5] = pSrc[l+1+(4*N3)]; + pDst[k+6] = pSrc[l+0+(6*N3)]; + pDst[k+7] = pSrc[l+1+(6*N3)]; + pDst[k+8] = pSrc[l+0+(8*N3)]; + pDst[k+9] = pSrc[l+1+(8*N3)]; + fft5(&pDst[k]); + } + } + /* Sort output vector of length 15 + output = [out5(0) out5(6) out5(12) out5(3) out5(9) + out5(10) out5(1) out5(7) out5(13) out5(4) + out5(5) out5(11) out5(2) out5(8) out5(14)]; */ + /* optimize clumsy loop, brings about 5% */ + { + const FIXP_DBL *pSrc = aDst1; + FIXP_DBL *RESTRICT pDst = pInput; + for(i=0,l=0,k=0; i<N3; i++, k+=10) + { + pDst[k+0] = pSrc[l]; + pDst[k+1] = pSrc[l+1]; + l += (2*N6); + if (l >= (2*N15)) + l -= (2*N15); + pDst[k+2] = pSrc[l]; + pDst[k+3] = pSrc[l+1]; + l += (2*N6); + if (l >= (2*N15)) + l -= (2*N15); + pDst[k+4] = pSrc[l]; + pDst[k+5] = pSrc[l+1]; + l += (2*N6); + if (l >= (2*N15)) + l -= (2*N15); + pDst[k+6] = pSrc[l]; + pDst[k+7] = pSrc[l+1]; + l += (2*N6); + if (l >= (2*N15)) + l -= (2*N15); + pDst[k+8] = pSrc[l]; + pDst[k+9] = pSrc[l+1]; + l += 2; /* no modulo check needed, it cannot occur */ + } + } +} + +#define W_PiFOURTH STC(0x5a82799a) +#ifndef SUMDIFF_PIFOURTH +#define SUMDIFF_PIFOURTH(diff,sum,a,b) \ + { \ + FIXP_DBL wa, wb;\ + wa = fMultDiv2(a, W_PiFOURTH);\ + wb = fMultDiv2(b, W_PiFOURTH);\ + diff = wb - wa;\ + sum = wb + wa;\ + } +#endif + +/* This version is more overflow save, but less cycle optimal. */ +#define SUMDIFF_EIGTH(x, y, ix, iy, vr, vi, ur, ui) \ + vr = (x[ 0 + ix]>>1) + (x[16 + ix]>>1); /* Re A + Re B */ \ + vi = (x[ 8 + ix]>>1) + (x[24 + ix]>>1); /* Re C + Re D */ \ + ur = (x[ 1 + ix]>>1) + (x[17 + ix]>>1); /* Im A + Im B */ \ + ui = (x[ 9 + ix]>>1) + (x[25 + ix]>>1); /* Im C + Im D */ \ + y[ 0 + iy] = vr + vi; /* Re A' = ReA + ReB +ReC + ReD */ \ + y[ 4 + iy] = vr - vi; /* Re C' = -(ReC+ReD) + (ReA+ReB) */ \ + y[ 1 + iy] = ur + ui; /* Im A' = sum of imag values */ \ + y[ 5 + iy] = ur - ui; /* Im C' = -Im C -Im D +Im A +Im B */ \ + vr -= x[16 + ix]; /* Re A - Re B */ \ + vi = vi - x[24 + ix]; /* Re C - Re D */ \ + ur -= x[17 + ix]; /* Im A - Im B */ \ + ui = ui - x[25 + ix]; /* Im C - Im D */ \ + y[ 2 + iy] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ \ + y[ 6 + iy] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ \ + y[ 3 + iy] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ \ + y[ 7 + iy] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + +static const FIXP_SPK fft16_w16[2] = { {{STC(0x7641af3d), STC(0x30fbc54d)}}, {{ STC(0x30fbc54d), STC(0x7641af3d)}} }; + +LNK_SECTION_CODE_L1 +inline void fft_16(FIXP_DBL *RESTRICT x) +{ + FIXP_DBL vr, vi, ur, ui; + FIXP_DBL y[32]; + + SUMDIFF_EIGTH(x, y, 0, 0, vr, vi, ur, ui); + SUMDIFF_EIGTH(x, y, 4, 8, vr, vi, ur, ui); + SUMDIFF_EIGTH(x, y, 2, 16, vr, vi, ur, ui); + SUMDIFF_EIGTH(x, y, 6, 24, vr, vi, ur, ui); + +// xt1 = 0 +// xt2 = 8 + vr = y[ 8]; + vi = y[ 9]; + ur = y[ 0]>>1; + ui = y[ 1]>>1; + x[ 0] = ur + (vr>>1); + x[ 1] = ui + (vi>>1); + x[ 8] = ur - (vr>>1); + x[ 9] = ui - (vi>>1); + +// xt1 = 4 +// xt2 = 12 + vr = y[13]; + vi = y[12]; + ur = y[ 4]>>1; + ui = y[ 5]>>1; + x[ 4] = ur + (vr>>1); + x[ 5] = ui - (vi>>1); + x[12] = ur - (vr>>1); + x[13] = ui + (vi>>1); + +// xt1 = 16 +// xt2 = 24 + vr = y[24]; + vi = y[25]; + ur = y[16]>>1; + ui = y[17]>>1; + x[16] = ur + (vr>>1); + x[17] = ui + (vi>>1); + x[24] = ur - (vr>>1); + x[25] = ui - (vi>>1); + +// xt1 = 20 +// xt2 = 28 + vr = y[29]; + vi = y[28]; + ur = y[20]>>1; + ui = y[21]>>1; + x[20] = ur + (vr>>1); + x[21] = ui - (vi>>1); + x[28] = ur - (vr>>1); + x[29] = ui + (vi>>1); + + // xt1 = 2 +// xt2 = 10 + SUMDIFF_PIFOURTH(vi, vr, y[10], y[11]) + //vr = fMultDiv2((y[11] + y[10]),W_PiFOURTH); + //vi = fMultDiv2((y[11] - y[10]),W_PiFOURTH); + ur = y[ 2]; + ui = y[ 3]; + x[ 2] = (ur>>1) + vr; + x[ 3] = (ui>>1) + vi; + x[10] = (ur>>1) - vr; + x[11] = (ui>>1) - vi; + +// xt1 = 6 +// xt2 = 14 + SUMDIFF_PIFOURTH(vr, vi, y[14], y[15]) + ur = y[ 6]; + ui = y[ 7]; + x[ 6] = (ur>>1) + vr; + x[ 7] = (ui>>1) - vi; + x[14] = (ur>>1) - vr; + x[15] = (ui>>1) + vi; + +// xt1 = 18 +// xt2 = 26 + SUMDIFF_PIFOURTH(vi, vr, y[26], y[27]) + ur = y[18]; + ui = y[19]; + x[18] = (ur>>1) + vr; + x[19] = (ui>>1) + vi; + x[26] = (ur>>1) - vr; + x[27] = (ui>>1) - vi; + +// xt1 = 22 +// xt2 = 30 + SUMDIFF_PIFOURTH(vr, vi, y[30], y[31]) + ur = y[22]; + ui = y[23]; + x[22] = (ur>>1) + vr; + x[23] = (ui>>1) - vi; + x[30] = (ur>>1) - vr; + x[31] = (ui>>1) + vi; + +// xt1 = 0 +// xt2 = 16 + vr = x[16]; + vi = x[17]; + ur = x[ 0]>>1; + ui = x[ 1]>>1; + x[ 0] = ur + (vr>>1); + x[ 1] = ui + (vi>>1); + x[16] = ur - (vr>>1); + x[17] = ui - (vi>>1); + +// xt1 = 8 +// xt2 = 24 + vi = x[24]; + vr = x[25]; + ur = x[ 8]>>1; + ui = x[ 9]>>1; + x[ 8] = ur + (vr>>1); + x[ 9] = ui - (vi>>1); + x[24] = ur - (vr>>1); + x[25] = ui + (vi>>1); + +// xt1 = 2 +// xt2 = 18 + cplxMultDiv2(&vi, &vr, x[19], x[18], fft16_w16[0]); + ur = x[ 2]; + ui = x[ 3]; + x[ 2] = (ur>>1) + vr; + x[ 3] = (ui>>1) + vi; + x[18] = (ur>>1) - vr; + x[19] = (ui>>1) - vi; + +// xt1 = 10 +// xt2 = 26 + cplxMultDiv2(&vr, &vi, x[27], x[26], fft16_w16[0]); + ur = x[10]; + ui = x[11]; + x[10] = (ur>>1) + vr; + x[11] = (ui>>1) - vi; + x[26] = (ur>>1) - vr; + x[27] = (ui>>1) + vi; + +// xt1 = 4 +// xt2 = 20 + SUMDIFF_PIFOURTH(vi, vr, x[20], x[21]) + ur = x[ 4]; + ui = x[ 5]; + x[ 4] = (ur>>1) + vr; + x[ 5] = (ui>>1) + vi; + x[20] = (ur>>1) - vr; + x[21] = (ui>>1) - vi; + +// xt1 = 12 +// xt2 = 28 + SUMDIFF_PIFOURTH(vr, vi, x[28], x[29]) + ur = x[12]; + ui = x[13]; + x[12] = (ur>>1) + vr; + x[13] = (ui>>1) - vi; + x[28] = (ur>>1) - vr; + x[29] = (ui>>1) + vi; + +// xt1 = 6 +// xt2 = 22 + cplxMultDiv2(&vi, &vr, x[23], x[22], fft16_w16[1]); + ur = x[ 6]; + ui = x[ 7]; + x[ 6] = (ur>>1) + vr; + x[ 7] = (ui>>1) + vi; + x[22] = (ur>>1) - vr; + x[23] = (ui>>1) - vi; + +// xt1 = 14 +// xt2 = 30 + cplxMultDiv2(&vr, &vi, x[31], x[30], fft16_w16[1]); + ur = x[14]; + ui = x[15]; + x[14] = (ur>>1) + vr; + x[15] = (ui>>1) - vi; + x[30] = (ur>>1) - vr; + x[31] = (ui>>1) + vi; +} + +#ifndef FUNCTION_fft_32 +static const FIXP_SPK fft32_w32[6] = +{ + {{ STC(0x7641af3d), STC(0x30fbc54d)}}, {{ STC(0x30fbc54d), STC(0x7641af3d)}}, {{ STC(0x7d8a5f40), STC(0x18f8b83c)}}, + {{ STC(0x6a6d98a4), STC(0x471cece7)}}, {{ STC(0x471cece7), STC(0x6a6d98a4)}}, {{ STC(0x18f8b83c), STC(0x7d8a5f40)}} +}; + +LNK_SECTION_CODE_L1 +inline void fft_32(FIXP_DBL *x) +{ + +#define W_PiFOURTH STC(0x5a82799a) + + FIXP_DBL vr,vi,ur,ui; + FIXP_DBL y[64]; + + /* + * 1+2 stage radix 4 + */ + +///////////////////////////////////////////////////////////////////////////////////////// + + // i = 0 + vr = (x[ 0] + x[32])>>1; /* Re A + Re B */ + vi = (x[16] + x[48]); /* Re C + Re D */ + ur = (x[ 1] + x[33])>>1; /* Im A + Im B */ + ui = (x[17] + x[49]); /* Im C + Im D */ + + y[ 0] = vr + (vi>>1); /* Re A' = ReA + ReB +ReC + ReD */ + y[ 4] = vr - (vi>>1); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + y[ 1] = ur + (ui>>1); /* Im A' = sum of imag values */ + y[ 5] = ur - (ui>>1); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr -= x[32]; /* Re A - Re B */ + vi = (vi>>1) - x[48]; /* Re C - Re D */ + ur -= x[33]; /* Im A - Im B */ + ui = (ui>>1) - x[49]; /* Im C - Im D */ + + y[ 2] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ + y[ 6] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + y[ 3] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + y[ 7] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + + //i=8 + vr = (x[ 8] + x[40])>>1; /* Re A + Re B */ + vi = (x[24] + x[56]); /* Re C + Re D */ + ur = (x[ 9] + x[41])>>1; /* Im A + Im B */ + ui = (x[25] + x[57]); /* Im C + Im D */ + + y[ 8] = vr + (vi>>1); /* Re A' = ReA + ReB +ReC + ReD */ + y[12] = vr - (vi>>1); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + y[ 9] = ur + (ui>>1); /* Im A' = sum of imag values */ + y[13] = ur - (ui>>1); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr -= x[40]; /* Re A - Re B */ + vi = (vi>>1) - x[56]; /* Re C - Re D */ + ur -= x[41]; /* Im A - Im B */ + ui = (ui>>1) - x[57]; /* Im C - Im D */ + + y[10] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ + y[14] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + y[11] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + y[15] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + + //i=16 + vr = (x[ 4] + x[36])>>1; /* Re A + Re B */ + vi = (x[20] + x[52]); /* Re C + Re D */ + ur = (x[ 5] + x[37])>>1; /* Im A + Im B */ + ui = (x[21] + x[53]); /* Im C + Im D */ + + y[16] = vr + (vi>>1); /* Re A' = ReA + ReB +ReC + ReD */ + y[20] = vr - (vi>>1); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + y[17] = ur + (ui>>1); /* Im A' = sum of imag values */ + y[21] = ur - (ui>>1); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr -= x[36]; /* Re A - Re B */ + vi = (vi>>1) - x[52]; /* Re C - Re D */ + ur -= x[37]; /* Im A - Im B */ + ui = (ui>>1) - x[53]; /* Im C - Im D */ + + y[18] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ + y[22] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + y[19] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + y[23] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + + //i=24 + vr = (x[12] + x[44])>>1; /* Re A + Re B */ + vi = (x[28] + x[60]); /* Re C + Re D */ + ur = (x[13] + x[45])>>1; /* Im A + Im B */ + ui = (x[29] + x[61]); /* Im C + Im D */ + + y[24] = vr + (vi>>1); /* Re A' = ReA + ReB +ReC + ReD */ + y[28] = vr - (vi>>1); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + y[25] = ur + (ui>>1); /* Im A' = sum of imag values */ + y[29] = ur - (ui>>1); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr -= x[44]; /* Re A - Re B */ + vi = (vi>>1) - x[60]; /* Re C - Re D */ + ur -= x[45]; /* Im A - Im B */ + ui = (ui>>1) - x[61]; /* Im C - Im D */ + + y[26] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ + y[30] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + y[27] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + y[31] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + + // i = 32 + vr = (x[ 2] + x[34])>>1; /* Re A + Re B */ + vi = (x[18] + x[50]); /* Re C + Re D */ + ur = (x[ 3] + x[35])>>1; /* Im A + Im B */ + ui = (x[19] + x[51]); /* Im C + Im D */ + + y[32] = vr + (vi>>1); /* Re A' = ReA + ReB +ReC + ReD */ + y[36] = vr - (vi>>1); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + y[33] = ur + (ui>>1); /* Im A' = sum of imag values */ + y[37] = ur - (ui>>1); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr -= x[34]; /* Re A - Re B */ + vi = (vi>>1) - x[50]; /* Re C - Re D */ + ur -= x[35]; /* Im A - Im B */ + ui = (ui>>1) - x[51]; /* Im C - Im D */ + + y[34] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ + y[38] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + y[35] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + y[39] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + + //i=40 + vr = (x[10] + x[42])>>1; /* Re A + Re B */ + vi = (x[26] + x[58]); /* Re C + Re D */ + ur = (x[11] + x[43])>>1; /* Im A + Im B */ + ui = (x[27] + x[59]); /* Im C + Im D */ + + y[40] = vr + (vi>>1); /* Re A' = ReA + ReB +ReC + ReD */ + y[44] = vr - (vi>>1); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + y[41] = ur + (ui>>1); /* Im A' = sum of imag values */ + y[45] = ur - (ui>>1); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr -= x[42]; /* Re A - Re B */ + vi = (vi>>1) - x[58]; /* Re C - Re D */ + ur -= x[43]; /* Im A - Im B */ + ui = (ui>>1) - x[59]; /* Im C - Im D */ + + y[42] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ + y[46] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + y[43] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + y[47] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + + //i=48 + vr = (x[ 6] + x[38])>>1; /* Re A + Re B */ + vi = (x[22] + x[54]); /* Re C + Re D */ + ur = (x[ 7] + x[39])>>1; /* Im A + Im B */ + ui = (x[23] + x[55]); /* Im C + Im D */ + + y[48] = vr + (vi>>1); /* Re A' = ReA + ReB +ReC + ReD */ + y[52] = vr - (vi>>1); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + y[49] = ur + (ui>>1); /* Im A' = sum of imag values */ + y[53] = ur - (ui>>1); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr -= x[38]; /* Re A - Re B */ + vi = (vi>>1) - x[54]; /* Re C - Re D */ + ur -= x[39]; /* Im A - Im B */ + ui = (ui>>1) - x[55]; /* Im C - Im D */ + + y[50] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ + y[54] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + y[51] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + y[55] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + + //i=56 + vr = (x[14] + x[46])>>1; /* Re A + Re B */ + vi = (x[30] + x[62]); /* Re C + Re D */ + ur = (x[15] + x[47])>>1; /* Im A + Im B */ + ui = (x[31] + x[63]); /* Im C + Im D */ + + y[56] = vr + (vi>>1); /* Re A' = ReA + ReB +ReC + ReD */ + y[60] = vr - (vi>>1); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + y[57] = ur + (ui>>1); /* Im A' = sum of imag values */ + y[61] = ur - (ui>>1); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr -= x[46]; /* Re A - Re B */ + vi = (vi>>1) - x[62]; /* Re C - Re D */ + ur -= x[47]; /* Im A - Im B */ + ui = (ui>>1) - x[63]; /* Im C - Im D */ + + y[58] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ + y[62] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + y[59] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + y[63] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + + + FIXP_DBL *xt = &x[0]; + FIXP_DBL *yt = &y[0]; + + int j = 4; + do + { + vr = yt[8]; + vi = yt[9]; + ur = yt[0]>>1; + ui = yt[1]>>1; + xt[ 0] = ur + (vr>>1); + xt[ 1] = ui + (vi>>1); + xt[ 8] = ur - (vr>>1); + xt[ 9] = ui - (vi>>1); + + vr = yt[13]; + vi = yt[12]; + ur = yt[4]>>1; + ui = yt[5]>>1; + xt[ 4] = ur + (vr>>1); + xt[ 5] = ui - (vi>>1); + xt[12] = ur - (vr>>1); + xt[13] = ui + (vi>>1); + + SUMDIFF_PIFOURTH(vi, vr, yt[10], yt[11]) + ur = yt[2]; + ui = yt[3]; + xt[ 2] = (ur>>1) + vr; + xt[ 3] = (ui>>1) + vi; + xt[10] = (ur>>1) - vr; + xt[11] = (ui>>1) - vi; + + SUMDIFF_PIFOURTH(vr, vi, yt[14], yt[15]) + ur = yt[6]; + ui = yt[7]; + + xt[ 6] = (ur>>1) + vr; + xt[ 7] = (ui>>1) - vi; + xt[14] = (ur>>1) - vr; + xt[15] = (ui>>1) + vi; + xt += 16; + yt += 16; + } while (--j != 0); + + vr = x[16]; + vi = x[17]; + ur = x[ 0]>>1; + ui = x[ 1]>>1; + x[ 0] = ur + (vr>>1); + x[ 1] = ui + (vi>>1); + x[16] = ur - (vr>>1); + x[17] = ui - (vi>>1); + + vi = x[24]; + vr = x[25]; + ur = x[ 8]>>1; + ui = x[ 9]>>1; + x[ 8] = ur + (vr>>1); + x[ 9] = ui - (vi>>1); + x[24] = ur - (vr>>1); + x[25] = ui + (vi>>1); + + vr = x[48]; + vi = x[49]; + ur = x[32]>>1; + ui = x[33]>>1; + x[32] = ur + (vr>>1); + x[33] = ui + (vi>>1); + x[48] = ur - (vr>>1); + x[49] = ui - (vi>>1); + + vi = x[56]; + vr = x[57]; + ur = x[40]>>1; + ui = x[41]>>1; + x[40] = ur + (vr>>1); + x[41] = ui - (vi>>1); + x[56] = ur - (vr>>1); + x[57] = ui + (vi>>1); + + cplxMultDiv2(&vi, &vr, x[19], x[18], fft32_w32[0]); + ur = x[ 2]; + ui = x[ 3]; + x[ 2] = (ur>>1) + vr; + x[ 3] = (ui>>1) + vi; + x[18] = (ur>>1) - vr; + x[19] = (ui>>1) - vi; + + cplxMultDiv2(&vr, &vi, x[27], x[26], fft32_w32[0]); + ur = x[10]; + ui = x[11]; + x[10] = (ur>>1) + vr; + x[11] = (ui>>1) - vi; + x[26] = (ur>>1) - vr; + x[27] = (ui>>1) + vi; + + cplxMultDiv2(&vi, &vr, x[51], x[50], fft32_w32[0]); + ur = x[34]; + ui = x[35]; + x[34] = (ur>>1) + vr; + x[35] = (ui>>1) + vi; + x[50] = (ur>>1) - vr; + x[51] = (ui>>1) - vi; + + cplxMultDiv2(&vr, &vi, x[59], x[58], fft32_w32[0]); + ur = x[42]; + ui = x[43]; + x[42] = (ur>>1) + vr; + x[43] = (ui>>1) - vi; + x[58] = (ur>>1) - vr; + x[59] = (ui>>1) + vi; + + SUMDIFF_PIFOURTH(vi, vr, x[20], x[21]) + ur = x[ 4]; + ui = x[ 5]; + x[ 4] = (ur>>1) + vr; + x[ 5] = (ui>>1) + vi; + x[20] = (ur>>1) - vr; + x[21] = (ui>>1) - vi; + + SUMDIFF_PIFOURTH(vr, vi, x[28], x[29]) + ur = x[12]; + ui = x[13]; + x[12] = (ur>>1) + vr; + x[13] = (ui>>1) - vi; + x[28] = (ur>>1) - vr; + x[29] = (ui>>1) + vi; + + SUMDIFF_PIFOURTH(vi, vr, x[52], x[53]) + ur = x[36]; + ui = x[37]; + x[36] = (ur>>1) + vr; + x[37] = (ui>>1) + vi; + x[52] = (ur>>1) - vr; + x[53] = (ui>>1) - vi; + + SUMDIFF_PIFOURTH(vr, vi, x[60], x[61]) + ur = x[44]; + ui = x[45]; + x[44] = (ur>>1) + vr; + x[45] = (ui>>1) - vi; + x[60] = (ur>>1) - vr; + x[61] = (ui>>1) + vi; + + + cplxMultDiv2(&vi, &vr, x[23], x[22], fft32_w32[1]); + ur = x[ 6]; + ui = x[ 7]; + x[ 6] = (ur>>1) + vr; + x[ 7] = (ui>>1) + vi; + x[22] = (ur>>1) - vr; + x[23] = (ui>>1) - vi; + + cplxMultDiv2(&vr, &vi, x[31], x[30], fft32_w32[1]); + ur = x[14]; + ui = x[15]; + x[14] = (ur>>1) + vr; + x[15] = (ui>>1) - vi; + x[30] = (ur>>1) - vr; + x[31] = (ui>>1) + vi; + + cplxMultDiv2(&vi, &vr, x[55], x[54], fft32_w32[1]); + ur = x[38]; + ui = x[39]; + x[38] = (ur>>1) + vr; + x[39] = (ui>>1) + vi; + x[54] = (ur>>1) - vr; + x[55] = (ui>>1) - vi; + + cplxMultDiv2(&vr, &vi, x[63], x[62], fft32_w32[1]); + ur = x[46]; + ui = x[47]; + + x[46] = (ur>>1) + vr; + x[47] = (ui>>1) - vi; + x[62] = (ur>>1) - vr; + x[63] = (ui>>1) + vi; + + vr = x[32]; + vi = x[33]; + ur = x[ 0]>>1; + ui = x[ 1]>>1; + x[ 0] = ur + (vr>>1); + x[ 1] = ui + (vi>>1); + x[32] = ur - (vr>>1); + x[33] = ui - (vi>>1); + + vi = x[48]; + vr = x[49]; + ur = x[16]>>1; + ui = x[17]>>1; + x[16] = ur + (vr>>1); + x[17] = ui - (vi>>1); + x[48] = ur - (vr>>1); + x[49] = ui + (vi>>1); + + cplxMultDiv2(&vi, &vr, x[35], x[34], fft32_w32[2]); + ur = x[ 2]; + ui = x[ 3]; + x[ 2] = (ur>>1) + vr; + x[ 3] = (ui>>1) + vi; + x[34] = (ur>>1) - vr; + x[35] = (ui>>1) - vi; + + cplxMultDiv2(&vr, &vi, x[51], x[50], fft32_w32[2]); + ur = x[18]; + ui = x[19]; + x[18] = (ur>>1) + vr; + x[19] = (ui>>1) - vi; + x[50] = (ur>>1) - vr; + x[51] = (ui>>1) + vi; + + cplxMultDiv2(&vi, &vr, x[37], x[36], fft32_w32[0]); + ur = x[ 4]; + ui = x[ 5]; + x[ 4] = (ur>>1) + vr; + x[ 5] = (ui>>1) + vi; + x[36] = (ur>>1) - vr; + x[37] = (ui>>1) - vi; + + cplxMultDiv2(&vr, &vi, x[53], x[52], fft32_w32[0]); + ur = x[20]; + ui = x[21]; + x[20] = (ur>>1) + vr; + x[21] = (ui>>1) - vi; + x[52] = (ur>>1) - vr; + x[53] = (ui>>1) + vi; + + cplxMultDiv2(&vi, &vr, x[39], x[38], fft32_w32[3]); + ur = x[ 6]; + ui = x[ 7]; + x[ 6] = (ur>>1) + vr; + x[ 7] = (ui>>1) + vi; + x[38] = (ur>>1) - vr; + x[39] = (ui>>1) - vi; + + cplxMultDiv2(&vr, &vi, x[55], x[54], fft32_w32[3]); + ur = x[22]; + ui = x[23]; + x[22] = (ur>>1) + vr; + x[23] = (ui>>1) - vi; + x[54] = (ur>>1) - vr; + x[55] = (ui>>1) + vi; + + SUMDIFF_PIFOURTH(vi, vr, x[40], x[41]) + ur = x[ 8]; + ui = x[ 9]; + x[ 8] = (ur>>1) + vr; + x[ 9] = (ui>>1) + vi; + x[40] = (ur>>1) - vr; + x[41] = (ui>>1) - vi; + + SUMDIFF_PIFOURTH(vr, vi, x[56], x[57]) + ur = x[24]; + ui = x[25]; + x[24] = (ur>>1) + vr; + x[25] = (ui>>1) - vi; + x[56] = (ur>>1) - vr; + x[57] = (ui>>1) + vi; + + cplxMultDiv2(&vi, &vr, x[43], x[42], fft32_w32[4]); + ur = x[10]; + ui = x[11]; + + x[10] = (ur>>1) + vr; + x[11] = (ui>>1) + vi; + x[42] = (ur>>1) - vr; + x[43] = (ui>>1) - vi; + + cplxMultDiv2(&vr, &vi, x[59], x[58], fft32_w32[4]); + ur = x[26]; + ui = x[27]; + x[26] = (ur>>1) + vr; + x[27] = (ui>>1) - vi; + x[58] = (ur>>1) - vr; + x[59] = (ui>>1) + vi; + + cplxMultDiv2(&vi, &vr, x[45], x[44], fft32_w32[1]); + ur = x[12]; + ui = x[13]; + x[12] = (ur>>1) + vr; + x[13] = (ui>>1) + vi; + x[44] = (ur>>1) - vr; + x[45] = (ui>>1) - vi; + + cplxMultDiv2(&vr, &vi, x[61], x[60], fft32_w32[1]); + ur = x[28]; + ui = x[29]; + x[28] = (ur>>1) + vr; + x[29] = (ui>>1) - vi; + x[60] = (ur>>1) - vr; + x[61] = (ui>>1) + vi; + + cplxMultDiv2(&vi, &vr, x[47], x[46], fft32_w32[5]); + ur = x[14]; + ui = x[15]; + x[14] = (ur>>1) + vr; + x[15] = (ui>>1) + vi; + x[46] = (ur>>1) - vr; + x[47] = (ui>>1) - vi; + + cplxMultDiv2(&vr, &vi, x[63], x[62], fft32_w32[5]); + ur = x[30]; + ui = x[31]; + x[30] = (ur>>1) + vr; + x[31] = (ui>>1) - vi; + x[62] = (ur>>1) - vr; + x[63] = (ui>>1) + vi; +} +#endif /* #ifndef FUNCTION_fft_32 */ + + +/** + * \brief Apply rotation vectors to a data buffer. + * \param cl length of each row of input data. + * \param l total length of input data. + * \param pVecRe real part of rotation ceofficient vector. + * \param pVecIm imaginary part of rotation ceofficient vector. + */ +static inline void fft_apply_rot_vector(FIXP_DBL *RESTRICT pData, const int cl, const int l, const FIXP_STB *pVecRe, const FIXP_STB *pVecIm) +{ + FIXP_DBL re, im; + FIXP_STB vre, vim; + + int i, c; + + for(i=0; i<cl; i++) { + re = pData[2*i]; + im = pData[2*i+1]; + + pData[2*i] = re>>2; /* * 0.25 */ + pData[2*i+1] = im>>2; /* * 0.25 */ + } + for(; i<l; i+=cl) + { + re = pData[2*i]; + im = pData[2*i+1]; + + pData[2*i] = re>>2; /* * 0.25 */ + pData[2*i+1] = im>>2; /* * 0.25 */ + + for (c=i+1; c<i+cl; c++) + { + re = pData[2*c]>>1; + im = pData[2*c+1]>>1; + vre = *pVecRe++; + vim = *pVecIm++; + + cplxMultDiv2(&pData[2*c+1], &pData[2*c], im, re, vre, vim); + } + } +} + +#define FFT_TWO_STAGE_MACRO_ENABLE + + +#ifdef FFT_TWO_STAGE_MACRO_ENABLE + +#define fftN2(pInput, length, dim1, dim2, fft_func1, fft_func2, RotVectorReal, RotVectorImag) \ +{ \ + int i, j; \ + \ + C_ALLOC_SCRATCH_START(aDst, FIXP_DBL, length*2); \ + C_ALLOC_SCRATCH_START(aDst2, FIXP_DBL, dim2*2); \ + \ + FDK_ASSERT(length == dim1*dim2); \ + \ + /* Perform dim2 times the fft of length dim1. The input samples are at the address of pSrc and the \ + output samples are at the address of pDst. The input vector for the fft of length dim1 is built \ + of the interleaved samples in pSrc, the output samples are stored consecutively. \ + */ \ + { \ + const FIXP_DBL* pSrc = pInput; \ + FIXP_DBL *RESTRICT pDst = aDst; \ + \ + for(i=0; i<dim2; i++) \ + { \ + for(j=0; j<dim1; j++) \ + { \ + pDst[2*j] = pSrc[2*j*dim2]; \ + pDst[2*j+1] = pSrc[2*j*dim2+1]; \ + } \ + \ + fft_func1(pDst); \ + pSrc += 2; \ + pDst = pDst + 2*dim1; \ + } \ + } \ + \ + /* Perform the modulation of the output of the fft of length dim1 */ \ + fft_apply_rot_vector(aDst, dim1, length, RotVectorReal, RotVectorImag); \ + \ + /* Perform dim1 times the fft of length dim2. The input samples are at the address of aDst and the \ + output samples are at the address of pInput. The input vector for the fft of length dim2 is built \ + of the interleaved samples in aDst, the output samples are stored consecutively at the address \ + of pInput. \ + */ \ + { \ + const FIXP_DBL* pSrc = aDst; \ + FIXP_DBL *RESTRICT pDst = aDst2; \ + FIXP_DBL *RESTRICT pDstOut = pInput; \ + \ + for(i=0; i<dim1; i++) \ + { \ + for(j=0; j<dim2; j++) \ + { \ + pDst[2*j] = pSrc[2*j*dim1]; \ + pDst[2*j+1] = pSrc[2*j*dim1+1]; \ + } \ + \ + fft_func2(pDst); \ + \ + for(j=0; j<dim2; j++) \ + { \ + pDstOut[2*j*dim1] = pDst[2*j]; \ + pDstOut[2*j*dim1+1] = pDst[2*j+1]; \ + } \ + pSrc += 2; \ + pDstOut += 2; \ + } \ + } \ + \ + C_ALLOC_SCRATCH_END(aDst2, FIXP_DBL, dim2*2); \ + C_ALLOC_SCRATCH_END(aDst, FIXP_DBL, length*2); \ +} \ + +#else /* FFT_TWO_STAGE_MACRO_ENABLE */ + +/* select either switch case of function pointer. */ +//#define FFT_TWO_STAGE_SWITCH_CASE + +static inline void fftN2( + FIXP_DBL *pInput, + const int length, + const int dim1, + const int dim2, + void (* const fft1)(FIXP_DBL *), + void (* const fft2)(FIXP_DBL *), + const FIXP_STB *RotVectorReal, + const FIXP_STB *RotVectorImag + ) +{ + /* The real part of the input samples are at the addresses with even indices and the imaginary + part of the input samples are at the addresses with odd indices. The output samples are stored + at the address of pInput + */ + FIXP_DBL *pSrc, *pDst, *pDstOut; + int i, j; + + C_ALLOC_SCRATCH_START(aDst, FIXP_DBL, length*2); + C_ALLOC_SCRATCH_START(aDst2, FIXP_DBL, dim2*2); + + FDK_ASSERT(length == dim1*dim2); + + /* Perform dim2 times the fft of length dim1. The input samples are at the address of pSrc and the + output samples are at the address of pDst. The input vector for the fft of length dim1 is built + of the interleaved samples in pSrc, the output samples are stored consecutively. + */ + pSrc = pInput; + pDst = aDst; + for(i=0; i<length/dim1; i++) + { + for(j=0; j<length/dim2; j++) + { + pDst[2*j] = pSrc[2*j*dim2]; + pDst[2*j+1] = pSrc[2*j*dim2+1]; + } + + /* fft of size dim1 */ +#ifndef FFT_TWO_STAGE_SWITCH_CASE + fft1(pDst); +#else + switch (dim1) { + case 3: fft3(pDst); break; + case 4: fft_4(pDst); break; + case 5: fft5(pDst); break; + case 8: fft_8(pDst); break; + case 15: fft15(pDst); break; + case 16: fft_16(pDst); break; + case 32: fft_32(pDst); break; + /*case 64: fft_64(pDst); break;*/ + case 128: fft_128(pDst); break; + } +#endif + pSrc += 2; + pDst = pDst + 2*length/dim2; + } + + /* Perform the modulation of the output of the fft of length dim1 */ + pSrc=aDst; + fft_apply_rot_vector(pSrc, length/dim2, length, RotVectorReal, RotVectorImag); + + /* Perform dim1 times the fft of length dim2. The input samples are at the address of aDst and the + output samples are at the address of pInput. The input vector for the fft of length dim2 is built + of the interleaved samples in aDst, the output samples are stored consecutively at the address + of pInput. + */ + pSrc = aDst; + pDst = aDst2; + pDstOut = pInput; + for(i=0; i<length/dim2; i++) + { + for(j=0; j<length/dim1; j++) + { + pDst[2*j] = pSrc[2*j*dim1]; + pDst[2*j+1] = pSrc[2*j*dim1+1]; + } + +#ifndef FFT_TWO_STAGE_SWITCH_CASE + fft2(pDst); +#else + switch (dim2) { + case 3: fft3(pDst); break; + case 4: fft_4(pDst); break; + case 5: fft5(pDst); break; + case 8: fft_8(pDst); break; + case 15: fft15(pDst); break; + case 16: fft_16(pDst); break; + case 32: fft_32(pDst); break; + /*case 64: fft_64(pDst); break;*/ + case 128: fft_128(pDst); break; + } +#endif + + for(j=0; j<length/dim1; j++) + { + pDstOut[2*j*dim1] = pDst[2*j]; + pDstOut[2*j*dim1+1] = pDst[2*j+1]; + } + pSrc += 2; + pDstOut += 2; + } + + C_ALLOC_SCRATCH_END(aDst2, FIXP_DBL, dim2*2); + C_ALLOC_SCRATCH_END(aDst, FIXP_DBL, length*2); +} + +#endif /* FFT_TWO_STAGE_MACRO_ENABLE */ + + + + + + + + + + + + +#define SCALEFACTOR60 5 +/** +The function performs the fft of length 60. It is splittet into fft's of length 4 and fft's of +length 15. Between the fft's a modolation is calculated. +*/ +static inline void fft60(FIXP_DBL *pInput, INT *pScalefactor) +{ + fftN2( + pInput, 60, 4, 15, + fft_4, fft15, + RotVectorReal60, RotVectorImag60 + ); + *pScalefactor += SCALEFACTOR60; +} + + + +/* Fallback implementation in case of no better implementation available. */ + +#define SCALEFACTOR240 7 + +/** +The function performs the fft of length 240. It is splittet into fft's of length 16 and fft's of +length 15. Between the fft's a modulation is calculated. +*/ +static inline void fft240(FIXP_DBL *pInput, INT *pScalefactor) +{ + fftN2( + pInput, 240, 16, 15, + fft_16, fft15, + RotVectorReal240, RotVectorImag240 + ); + *pScalefactor += SCALEFACTOR240; +} + + +#define SCALEFACTOR480 8 +#define N32 32 +#define TABLE_SIZE_16 (32/2) + +/** +The function performs the fft of length 480. It is splittet into fft's of length 32 and fft's of +length 15. Between the fft's a modulation is calculated. +*/ +static inline void fft480(FIXP_DBL *pInput, INT *pScalefactor) +{ + fftN2( + pInput, 480, 32, 15, + fft_32, fft15, + RotVectorReal480, RotVectorImag480 + ); + *pScalefactor += SCALEFACTOR480; +} + +void fft(int length, FIXP_DBL *pInput, INT *pScalefactor) +{ + if (length == 32) + { + fft_32(pInput); + *pScalefactor += SCALEFACTOR32; + } + else + { + + switch (length) { + case 16: + fft_16(pInput); + *pScalefactor += SCALEFACTOR16; + break; + case 8: + fft_8(pInput); + *pScalefactor += SCALEFACTOR8; + break; + case 3: + fft3(pInput); + break; + case 4: + fft_4(pInput); + *pScalefactor += SCALEFACTOR4; + break; + case 5: + fft5(pInput); + break; + case 15: + fft15(pInput); + *pScalefactor += 2; + break; + case 60: + fft60(pInput, pScalefactor); + break; + case 64: + dit_fft(pInput, 6, SineTable512, 512); + *pScalefactor += SCALEFACTOR64; + break; + case 240: + fft240(pInput, pScalefactor); + break; + case 256: + dit_fft(pInput, 8, SineTable512, 512); + *pScalefactor += SCALEFACTOR256; + break; + case 480: + fft480(pInput, pScalefactor); + break; + case 512: + dit_fft(pInput, 9, SineTable512, 512); + *pScalefactor += SCALEFACTOR512; + break; + default: + FDK_ASSERT(0); /* FFT length not supported! */ + break; + } + } +} + + +void ifft(int length, FIXP_DBL *pInput, INT *scalefactor) +{ + switch (length) { + default: + FDK_ASSERT(0); /* IFFT length not supported! */ + break; + } +} + + diff --git a/libFDK/src/fft_rad2.cpp b/libFDK/src/fft_rad2.cpp new file mode 100644 index 0000000..80467ec --- /dev/null +++ b/libFDK/src/fft_rad2.cpp @@ -0,0 +1,450 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2003) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Lohwasser, M. Gayer + Description: + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#include "fft_rad2.h" + +#include "scramble.h" + +#define __FFT_RAD2_CPP__ + +#if defined(__arm__) /* cppp replaced: elif */ +#include "arm/fft_rad2_arm.cpp" + +#elif defined(__GNUC__) && defined(__mips__) && defined(__mips_dsp) /* cppp replaced: elif */ +#include "mips/fft_rad2_mips.cpp" + +#endif + + + +/***************************************************************************** + + functionname: dit_fft (analysis) + description: dit-tukey-algorithm + scrambles data at entry + i.e. loop is made with scrambled data + returns: + input: + output: + +*****************************************************************************/ + +#ifndef FUNCTION_dit_fft + +void dit_fft(FIXP_DBL *x, const INT ldn, const FIXP_STP *trigdata, const INT trigDataSize) +{ + const INT n=1<<ldn; + INT trigstep,i,ldm; + + scramble(x,n); + /* + * 1+2 stage radix 4 + */ + + for (i=0;i<n*2;i+=8) + { + FIXP_DBL a00, a10, a20, a30; + a00 = (x[i + 0] + x[i + 2])>>1; /* Re A + Re B */ + a10 = (x[i + 4] + x[i + 6])>>1; /* Re C + Re D */ + a20 = (x[i + 1] + x[i + 3])>>1; /* Im A + Im B */ + a30 = (x[i + 5] + x[i + 7])>>1; /* Im C + Im D */ + + x[i + 0] = a00 + a10; /* Re A' = Re A + Re B + Re C + Re D */ + x[i + 4] = a00 - a10; /* Re C' = Re A + Re B - Re C - Re D */ + x[i + 1] = a20 + a30; /* Im A' = Im A + Im B + Im C + Im D */ + x[i + 5] = a20 - a30; /* Im C' = Im A + Im B - Im C - Im D */ + + a00 = a00 - x[i + 2]; /* Re A - Re B */ + a10 = a10 - x[i + 6]; /* Re C - Re D */ + a20 = a20 - x[i + 3]; /* Im A - Im B */ + a30 = a30 - x[i + 7]; /* Im C - Im D */ + + x[i + 2] = a00 + a30; /* Re B' = Re A - Re B + Im C - Im D */ + x[i + 6] = a00 - a30; /* Re D' = Re A - Re B - Im C + Im D */ + x[i + 3] = a20 - a10; /* Im B' = Im A - Im B - Re C + Re D */ + x[i + 7] = a20 + a10; /* Im D' = Im A - Im B + Re C - Re D */ + } + + for(ldm=3; ldm<=ldn; ++ldm) + { + INT m=(1<<ldm); + INT mh=(m>>1); + INT j,r; + + trigstep=((trigDataSize << 2)>>ldm); + + FDK_ASSERT(trigstep > 0); + + /* Do first iteration with c=1.0 and s=0.0 separately to avoid loosing to much precision. + Beware: The impact on the overal FFT precision is rather large. */ + { + j = 0; + + for(r=0; r<n; r+=m) + { + INT t1 = (r+j)<<1; + INT t2 = t1 + (mh<<1); + FIXP_DBL vr,vi,ur,ui; + + //cplxMultDiv2(&vi, &vr, x[t2+1], x[t2], (FIXP_SGL)1.0, (FIXP_SGL)0.0); + vi = x[t2+1]>>1; + vr = x[t2]>>1; + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur+vr; + x[t1+1] = ui+vi; + + x[t2] = ur-vr; + x[t2+1] = ui-vi; + + t1 += mh; + t2 = t1+(mh<<1); + + //cplxMultDiv2(&vr, &vi, x[t2+1], x[t2], (FIXP_SGL)1.0, (FIXP_SGL)0.0); + vr = x[t2+1]>>1; + vi = x[t2]>>1; + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur+vr; + x[t1+1] = ui-vi; + + x[t2] = ur-vr; + x[t2+1] = ui+vi; + } + } + for(j=1; j<mh/4; ++j) + { + FIXP_STP cs; + + cs = trigdata[j*trigstep]; + + for(r=0; r<n; r+=m) + { + INT t1 = (r+j)<<1; + INT t2 = t1 + (mh<<1); + FIXP_DBL vr,vi,ur,ui; + + cplxMultDiv2(&vi, &vr, x[t2+1], x[t2], cs); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur+vr; + x[t1+1] = ui+vi; + + x[t2] = ur-vr; + x[t2+1] = ui-vi; + + t1 += mh; + t2 = t1+(mh<<1); + + cplxMultDiv2(&vr, &vi, x[t2+1], x[t2], cs); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur+vr; + x[t1+1] = ui-vi; + + x[t2] = ur-vr; + x[t2+1] = ui+vi; + + /* Same as above but for t1,t2 with j>mh/4 and thus cs swapped */ + t1 = (r+mh/2-j)<<1; + t2 = t1 + (mh<<1); + + cplxMultDiv2(&vi, &vr, x[t2], x[t2+1], cs); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur+vr; + x[t1+1] = ui-vi; + + x[t2] = ur-vr; + x[t2+1] = ui+vi; + + t1 += mh; + t2 = t1+(mh<<1); + + cplxMultDiv2(&vr, &vi, x[t2], x[t2+1], cs); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur-vr; + x[t1+1] = ui-vi; + + x[t2] = ur+vr; + x[t2+1] = ui+vi; + } + } + { + j = mh/4; + + for(r=0; r<n; r+=m) + { + INT t1 = (r+j)<<1; + INT t2 = t1 + (mh<<1); + FIXP_DBL vr,vi,ur,ui; + + cplxMultDiv2(&vi, &vr, x[t2+1], x[t2], STC(0x5a82799a), STC(0x5a82799a)); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur+vr; + x[t1+1] = ui+vi; + + x[t2] = ur-vr; + x[t2+1] = ui-vi; + + t1 += mh; + t2 = t1+(mh<<1); + + cplxMultDiv2(&vr, &vi, x[t2+1], x[t2], STC(0x5a82799a), STC(0x5a82799a)); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur+vr; + x[t1+1] = ui-vi; + + x[t2] = ur-vr; + x[t2+1] = ui+vi; + } + } + } +} +#endif + + +/***************************************************************************** + + functionname: dit_ifft (synthesis) + description: dit-tukey-algorithm + scrambles data at entry + i.e. loop is made with scrambled data + returns: + input: + output: + +*****************************************************************************/ + +#if !defined(FUNCTION_dit_ifft) +void dit_ifft(FIXP_DBL *x, const INT ldn, const FIXP_STP *trigdata, const INT trigDataSize) +{ + const INT n=1<<ldn; + INT trigstep,i,ldm; + + scramble(x,n); + + /* + 1+2 stage radix 4 + */ + + for (i=0;i<n*2;i+=8) + { + FIXP_DBL a0, a1, a2, a3, a00, a10, a20, a30; + + a00 = (x[i + 0] + x[i + 2])>>1; /* Re A + Re B */ + a10 = (x[i + 4] + x[i + 6])>>1; /* Re C + Re D */ + a20 = (x[i + 1] + x[i + 3])>>1; /* Im A + Im B */ + a30 = (x[i + 5] + x[i + 7])>>1; /* Im C + Im D */ + a0 = (x[i + 0] - x[i + 2])>>1; /* Re A - Re B */ + a2 = (x[i + 4] - x[i + 6])>>1; /* Re C - Re D */ + a3 = (x[i + 1] - x[i + 3])>>1; /* Im A - Im B */ + a1 = (x[i + 5] - x[i + 7])>>1; /* Im C - Im D */ + + x[i + 0] = a00 + a10; /* Re A' = Re A + Re B + Re C + Re D */ + x[i + 4] = a00 - a10; /* Re C' = Re A + Re B - Re C - Re D */ + x[i + 1] = a20 + a30; /* Im A' = Im A + Im B + Im C + Im D */ + x[i + 5] = a20 - a30; /* Im C' = Im A + Im B - Im C - Im D */ + x[i + 2] = a0 - a1; /* Re B' = Re A - Re B - Im C + Im D */ + x[i + 6] = a0 + a1; /* Re D' = Re A - Re B + Im C - Im D */ + x[i + 3] = a3 + a2; /* Im B' = Im A - Im B + Re C - Re D */ + x[i + 7] = a3 - a2; /* Im D' = Im A - Im B - Re C + Re D */ + } + + for(ldm=3; ldm<=ldn; ++ldm) + { + const INT m=(1<<ldm); + const INT mh=(m>>1); + + INT j,r; + + trigstep=((trigDataSize << 2)>>ldm); + + { + j = 0; + + for(r=0; r<n; r+=m) + { + INT t1 = (r+j)<<1; + INT t2 = t1 + (mh<<1); + FIXP_DBL vr,vi,ur,ui; + + //cplxMultDiv2(&vr, &vi, x[t2], x[t2+1], FL2FXCONST_SGL(1.0), (FIXP_SGL)0.0); + vi = x[t2+1]>>1; + vr = x[t2]>>1; + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur+vr; + x[t1+1] = ui+vi; + + x[t2] = ur-vr; + x[t2+1] = ui-vi; + + t1 += mh; + t2 = t1+(mh<<1); + + //cplxMultDiv2(&vi, &vr, x[t2], x[t2+1], FL2FXCONST_SGL(1.0), FL2FXCONST_SGL(0.0)); + vr = x[t2+1]>>1; + vi = x[t2]>>1; + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur-vr; + x[t1+1] = ui+vi; + + x[t2] = ur+vr; + x[t2+1] = ui-vi; + } + } + for(j=1; j<mh/4; ++j) + { + FIXP_STP cs; + + cs = trigdata[j*trigstep]; + + for(r=0; r<n; r+=m) + { + INT t1 = (r+j)<<1; + INT t2 = t1 + (mh<<1); + FIXP_DBL vr,vi,ur,ui; + + cplxMultDiv2(&vr, &vi, x[t2], x[t2+1], cs); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur+vr; + x[t1+1] = ui+vi; + + x[t2] = ur-vr; + x[t2+1] = ui-vi; + + t1 += mh; + t2 = t1+(mh<<1); + + cplxMultDiv2(&vi, &vr, x[t2], x[t2+1], cs); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur-vr; + x[t1+1] = ui+vi; + + x[t2] = ur+vr; + x[t2+1] = ui-vi; + + /* Same as above but for t1,t2 with j>mh/4 and thus cs swapped */ + t1 = (r+mh/2-j)<<1; + t2 = t1 + (mh<<1); + + cplxMultDiv2(&vr, &vi, x[t2+1], x[t2], cs); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur-vr; + x[t1+1] = ui+vi; + + x[t2] = ur+vr; + x[t2+1] = ui-vi; + + t1 += mh; + t2 = t1+(mh<<1); + + cplxMultDiv2(&vi, &vr, x[t2+1], x[t2], cs); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur-vr; + x[t1+1] = ui-vi; + + x[t2] = ur+vr; + x[t2+1] = ui+vi; + } + } + { + j = mh/4; + for(r=0; r<n; r+=m) + { + INT t1 = (r+mh/2-j)<<1; + INT t2 = t1 + (mh<<1); + FIXP_DBL vr,vi,ur,ui; + + cplxMultDiv2(&vr, &vi, x[t2], x[t2+1], STC(0x5a82799a), STC(0x5a82799a)); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur+vr; + x[t1+1] = ui+vi; + + x[t2] = ur-vr; + x[t2+1] = ui-vi; + + t1 += mh; + t2 = t1+(mh<<1); + + cplxMultDiv2(&vi, &vr, x[t2], x[t2+1], STC(0x5a82799a), STC(0x5a82799a)); + + ur = x[t1]>>1; + ui = x[t1+1]>>1; + + x[t1] = ur-vr; + x[t1+1] = ui+vi; + + x[t2] = ur+vr; + x[t2+1] = ui-vi; + } + } + } +} +#endif + diff --git a/libFDK/src/fixpoint_math.cpp b/libFDK/src/fixpoint_math.cpp new file mode 100644 index 0000000..45b3023 --- /dev/null +++ b/libFDK/src/fixpoint_math.cpp @@ -0,0 +1,1164 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (1999) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): M. Gayer + Description: Fixed point specific mathematical functions + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#include "fixpoint_math.h" + + +#define MAX_LD_PRECISION 10 +#define LD_PRECISION 10 + +/* Taylor series coeffcients for ln(1-x), centered at 0 (MacLaurin polinomial). */ +#ifndef LDCOEFF_16BIT +LNK_SECTION_CONSTDATA_L1 +static const FIXP_DBL ldCoeff[MAX_LD_PRECISION] = { + FL2FXCONST_DBL(-1.0), + FL2FXCONST_DBL(-1.0/2.0), + FL2FXCONST_DBL(-1.0/3.0), + FL2FXCONST_DBL(-1.0/4.0), + FL2FXCONST_DBL(-1.0/5.0), + FL2FXCONST_DBL(-1.0/6.0), + FL2FXCONST_DBL(-1.0/7.0), + FL2FXCONST_DBL(-1.0/8.0), + FL2FXCONST_DBL(-1.0/9.0), + FL2FXCONST_DBL(-1.0/10.0) +}; +#else +LNK_SECTION_CONSTDATA_L1 +static const FIXP_SGL ldCoeff[MAX_LD_PRECISION] = { + FL2FXCONST_SGL(-1.0), + FL2FXCONST_SGL(-1.0/2.0), + FL2FXCONST_SGL(-1.0/3.0), + FL2FXCONST_SGL(-1.0/4.0), + FL2FXCONST_SGL(-1.0/5.0), + FL2FXCONST_SGL(-1.0/6.0), + FL2FXCONST_SGL(-1.0/7.0), + FL2FXCONST_SGL(-1.0/8.0), + FL2FXCONST_SGL(-1.0/9.0), + FL2FXCONST_SGL(-1.0/10.0) +}; +#endif + +/***************************************************************************** + + functionname: CalcLdData + description: Delivers the Logarithm Dualis ld(op)/LD_DATA_SCALING with polynomial approximation. + input: Input op is assumed to be double precision fractional 0 < op < 1.0 + This function does not accept negative values. + output: For op == 0, the result is saturated to -1.0 + This function does not return positive values since input values are treated as fractional values. + It does not make sense to input an integer value into this function (and expect a positive output value) + since input values are treated as fractional values. + +*****************************************************************************/ + +LNK_SECTION_CODE_L1 +FIXP_DBL CalcLdData(FIXP_DBL op) +{ + return fLog2(op, 0); +} + + +/***************************************************************************** + functionname: LdDataVector +*****************************************************************************/ +LNK_SECTION_CODE_L1 +void LdDataVector( FIXP_DBL *srcVector, + FIXP_DBL *destVector, + INT n) +{ + INT i; + for ( i=0; i<n; i++) { + destVector[i] = CalcLdData(srcVector[i]); + } +} + + + +#define MAX_POW2_PRECISION 8 +#ifndef SINETABLE_16BIT + #define POW2_PRECISION MAX_POW2_PRECISION +#else + #define POW2_PRECISION 5 +#endif + +/* + Taylor series coefficients of the function x^2. The first coefficient is + ommited (equal to 1.0). + + pow2Coeff[i-1] = (1/i!) d^i(2^x)/dx^i, i=1..MAX_POW2_PRECISION + To evaluate the taylor series around x = 0, the coefficients are: 1/!i * ln(2)^i + */ +#ifndef POW2COEFF_16BIT +LNK_SECTION_CONSTDATA_L1 +static const FIXP_DBL pow2Coeff[MAX_POW2_PRECISION] = { + FL2FXCONST_DBL(0.693147180559945309417232121458177), /* ln(2)^1 /1! */ + FL2FXCONST_DBL(0.240226506959100712333551263163332), /* ln(2)^2 /2! */ + FL2FXCONST_DBL(0.0555041086648215799531422637686218), /* ln(2)^3 /3! */ + FL2FXCONST_DBL(0.00961812910762847716197907157365887), /* ln(2)^4 /4! */ + FL2FXCONST_DBL(0.00133335581464284434234122219879962), /* ln(2)^5 /5! */ + FL2FXCONST_DBL(1.54035303933816099544370973327423e-4), /* ln(2)^6 /6! */ + FL2FXCONST_DBL(1.52527338040598402800254390120096e-5), /* ln(2)^7 /7! */ + FL2FXCONST_DBL(1.32154867901443094884037582282884e-6) /* ln(2)^8 /8! */ +}; +#else +LNK_SECTION_CONSTDATA_L1 +static const FIXP_SGL pow2Coeff[MAX_POW2_PRECISION] = { + FL2FXCONST_SGL(0.693147180559945309417232121458177), /* ln(2)^1 /1! */ + FL2FXCONST_SGL(0.240226506959100712333551263163332), /* ln(2)^2 /2! */ + FL2FXCONST_SGL(0.0555041086648215799531422637686218), /* ln(2)^3 /3! */ + FL2FXCONST_SGL(0.00961812910762847716197907157365887), /* ln(2)^4 /4! */ + FL2FXCONST_SGL(0.00133335581464284434234122219879962), /* ln(2)^5 /5! */ + FL2FXCONST_SGL(1.54035303933816099544370973327423e-4), /* ln(2)^6 /6! */ + FL2FXCONST_SGL(1.52527338040598402800254390120096e-5), /* ln(2)^7 /7! */ + FL2FXCONST_SGL(1.32154867901443094884037582282884e-6) /* ln(2)^8 /8! */ +}; +#endif + + + +/***************************************************************************** + + functionname: mul_dbl_sgl_rnd + description: Multiply with round. +*****************************************************************************/ + +/* for rounding a dfract to fract */ +/* static LONG accu_r = (int64)((INT64(1)<<(DFRACT_BITS-1))>>FRACT_BITS); */ +//LNK_SECTION_CONSTDATA +//static const LONG accu_r = 0x00008000; +#define ACCU_R (LONG) 0x00008000 + +LNK_SECTION_CODE_L1 +FIXP_DBL mul_dbl_sgl_rnd (const FIXP_DBL op1, const FIXP_SGL op2) +{ + FIXP_DBL prod; + LONG v = (LONG)(op1); + SHORT u = (SHORT)(op2); + + LONG low = u*(v&SGL_MASK); + low = (low+(ACCU_R>>1)) >> (FRACT_BITS-1); /* round */ + LONG high = u * ((v>>FRACT_BITS)<<1); + + prod = (LONG)(high+low); + + return((FIXP_DBL)prod); +} + + +/***************************************************************************** + + functionname: CalcInvLdData + description: Delivers the inverse of function CalcLdData(). + Delivers 2^(op*LD_DATA_SCALING) + input: Input op is assumed to be fractional -1.0 < op < 1.0 + output: For op == 0, the result is MAXVAL_DBL (almost 1.0). + For negative input values the output should be treated as a positive fractional value. + For positive input values the output should be treated as a positive integer value. + This function does not output negative values. + +*****************************************************************************/ +LNK_SECTION_CODE_L1 +FIXP_DBL CalcInvLdData(FIXP_DBL op) +{ + FIXP_DBL result_m; + + if ( op == FL2FXCONST_DBL(0.0f) ) { + result_m = (FIXP_DBL)MAXVAL_DBL; + } + else if ( op < FL2FXCONST_DBL(0.0f) ) { + result_m = f2Pow(op, LD_DATA_SHIFT); + } + else { + int result_e; + + result_m = f2Pow(op, LD_DATA_SHIFT, &result_e); + result_e = fixMin(fixMax(result_e+1-(DFRACT_BITS-1), -(DFRACT_BITS-1)), (DFRACT_BITS-1)); /* rounding and saturation */ + + if ( (result_e>0) && ( result_m > (((FIXP_DBL)MAXVAL_DBL)>>result_e) ) ) { + result_m = (FIXP_DBL)MAXVAL_DBL; /* saturate to max representable value */ + } + else { + result_m = (scaleValue(result_m, result_e)+(FIXP_DBL)1)>>1; /* descale result + rounding */ + } + } + return result_m; +} + + + + + +/***************************************************************************** + functionname: InitLdInt and CalcLdInt + description: Create and access table with integer LdData (0 to 193) +*****************************************************************************/ + + + LNK_SECTION_CONSTDATA_L1 + static const FIXP_DBL ldIntCoeff[] = { + 0x80000001, 0x00000000, 0x02000000, 0x032b8034, 0x04000000, 0x04a4d3c2, 0x052b8034, 0x059d5da0, + 0x06000000, 0x06570069, 0x06a4d3c2, 0x06eb3a9f, 0x072b8034, 0x0766a009, 0x079d5da0, 0x07d053f7, + 0x08000000, 0x082cc7ee, 0x08570069, 0x087ef05b, 0x08a4d3c2, 0x08c8ddd4, 0x08eb3a9f, 0x090c1050, + 0x092b8034, 0x0949a785, 0x0966a009, 0x0982809d, 0x099d5da0, 0x09b74949, 0x09d053f7, 0x09e88c6b, + 0x0a000000, 0x0a16bad3, 0x0a2cc7ee, 0x0a423162, 0x0a570069, 0x0a6b3d79, 0x0a7ef05b, 0x0a92203d, + 0x0aa4d3c2, 0x0ab7110e, 0x0ac8ddd4, 0x0ada3f60, 0x0aeb3a9f, 0x0afbd42b, 0x0b0c1050, 0x0b1bf312, + 0x0b2b8034, 0x0b3abb40, 0x0b49a785, 0x0b584822, 0x0b66a009, 0x0b74b1fd, 0x0b82809d, 0x0b900e61, + 0x0b9d5da0, 0x0baa708f, 0x0bb74949, 0x0bc3e9ca, 0x0bd053f7, 0x0bdc899b, 0x0be88c6b, 0x0bf45e09, + 0x0c000000, 0x0c0b73cb, 0x0c16bad3, 0x0c21d671, 0x0c2cc7ee, 0x0c379085, 0x0c423162, 0x0c4caba8, + 0x0c570069, 0x0c6130af, 0x0c6b3d79, 0x0c7527b9, 0x0c7ef05b, 0x0c88983f, 0x0c92203d, 0x0c9b8926, + 0x0ca4d3c2, 0x0cae00d2, 0x0cb7110e, 0x0cc0052b, 0x0cc8ddd4, 0x0cd19bb0, 0x0cda3f60, 0x0ce2c97d, + 0x0ceb3a9f, 0x0cf39355, 0x0cfbd42b, 0x0d03fda9, 0x0d0c1050, 0x0d140ca0, 0x0d1bf312, 0x0d23c41d, + 0x0d2b8034, 0x0d3327c7, 0x0d3abb40, 0x0d423b08, 0x0d49a785, 0x0d510118, 0x0d584822, 0x0d5f7cff, + 0x0d66a009, 0x0d6db197, 0x0d74b1fd, 0x0d7ba190, 0x0d82809d, 0x0d894f75, 0x0d900e61, 0x0d96bdad, + 0x0d9d5da0, 0x0da3ee7f, 0x0daa708f, 0x0db0e412, 0x0db74949, 0x0dbda072, 0x0dc3e9ca, 0x0dca258e, + 0x0dd053f7, 0x0dd6753e, 0x0ddc899b, 0x0de29143, 0x0de88c6b, 0x0dee7b47, 0x0df45e09, 0x0dfa34e1, + 0x0e000000, 0x0e05bf94, 0x0e0b73cb, 0x0e111cd2, 0x0e16bad3, 0x0e1c4dfb, 0x0e21d671, 0x0e275460, + 0x0e2cc7ee, 0x0e323143, 0x0e379085, 0x0e3ce5d8, 0x0e423162, 0x0e477346, 0x0e4caba8, 0x0e51daa8, + 0x0e570069, 0x0e5c1d0b, 0x0e6130af, 0x0e663b74, 0x0e6b3d79, 0x0e7036db, 0x0e7527b9, 0x0e7a1030, + 0x0e7ef05b, 0x0e83c857, 0x0e88983f, 0x0e8d602e, 0x0e92203d, 0x0e96d888, 0x0e9b8926, 0x0ea03232, + 0x0ea4d3c2, 0x0ea96df0, 0x0eae00d2, 0x0eb28c7f, 0x0eb7110e, 0x0ebb8e96, 0x0ec0052b, 0x0ec474e4, + 0x0ec8ddd4, 0x0ecd4012, 0x0ed19bb0, 0x0ed5f0c4, 0x0eda3f60, 0x0ede8797, 0x0ee2c97d, 0x0ee70525, + 0x0eeb3a9f, 0x0eef69ff, 0x0ef39355, 0x0ef7b6b4, 0x0efbd42b, 0x0effebcd, 0x0f03fda9, 0x0f0809cf, + 0x0f0c1050, 0x0f10113b, 0x0f140ca0, 0x0f18028d, 0x0f1bf312, 0x0f1fde3d, 0x0f23c41d, 0x0f27a4c0, + 0x0f2b8034 + }; + + + LNK_SECTION_INITCODE + void InitLdInt() + { + /* nothing to do! Use preinitialized logarithm table */ + } + + + +LNK_SECTION_CODE_L1 +FIXP_DBL CalcLdInt(INT i) +{ + /* calculates ld(op)/LD_DATA_SCALING */ + /* op is assumed to be an integer value between 1 and 193 */ + + FDK_ASSERT((193>0) && ((FIXP_DBL)ldIntCoeff[0]==(FIXP_DBL)0x80000001)); /* tab has to be initialized */ + + if ((i>0)&&(i<193)) + return ldIntCoeff[i]; + else + { + return (0); + } +} + + +/***************************************************************************** + + functionname: invSqrtNorm2 + description: delivers 1/sqrt(op) normalized to .5...1 and the shift value of the OUTPUT + +*****************************************************************************/ +#define SQRT_BITS 7 +#define SQRT_VALUES 128 +#define SQRT_BITS_MASK 0x7f + +LNK_SECTION_CONSTDATA_L1 +static const FIXP_DBL invSqrtTab[SQRT_VALUES] = { + 0x5a827999, 0x5a287e03, 0x59cf8cbb, 0x5977a0ab, 0x5920b4de, 0x58cac480, 0x5875cade, 0x5821c364, + 0x57cea99c, 0x577c792f, 0x572b2ddf, 0x56dac38d, 0x568b3631, 0x563c81df, 0x55eea2c3, 0x55a19521, + 0x55555555, 0x5509dfd0, 0x54bf311a, 0x547545d0, 0x542c1aa3, 0x53e3ac5a, 0x539bf7cc, 0x5354f9e6, + 0x530eafa4, 0x52c91617, 0x52842a5e, 0x523fe9ab, 0x51fc513f, 0x51b95e6b, 0x51770e8e, 0x51355f19, + 0x50f44d88, 0x50b3d768, 0x5073fa4f, 0x5034b3e6, 0x4ff601df, 0x4fb7e1f9, 0x4f7a5201, 0x4f3d4fce, + 0x4f00d943, 0x4ec4ec4e, 0x4e8986e9, 0x4e4ea718, 0x4e144ae8, 0x4dda7072, 0x4da115d9, 0x4d683948, + 0x4d2fd8f4, 0x4cf7f31b, 0x4cc08604, 0x4c898fff, 0x4c530f64, 0x4c1d0293, 0x4be767f5, 0x4bb23df9, + 0x4b7d8317, 0x4b4935ce, 0x4b1554a6, 0x4ae1de2a, 0x4aaed0f0, 0x4a7c2b92, 0x4a49ecb3, 0x4a1812fa, + 0x49e69d16, 0x49b589bb, 0x4984d7a4, 0x49548591, 0x49249249, 0x48f4fc96, 0x48c5c34a, 0x4896e53c, + 0x48686147, 0x483a364c, 0x480c6331, 0x47dee6e0, 0x47b1c049, 0x4784ee5f, 0x4758701c, 0x472c447c, + 0x47006a80, 0x46d4e130, 0x46a9a793, 0x467ebcb9, 0x46541fb3, 0x4629cf98, 0x45ffcb80, 0x45d61289, + 0x45aca3d5, 0x45837e88, 0x455aa1ca, 0x45320cc8, 0x4509beb0, 0x44e1b6b4, 0x44b9f40b, 0x449275ec, + 0x446b3b95, 0x44444444, 0x441d8f3b, 0x43f71bbe, 0x43d0e917, 0x43aaf68e, 0x43854373, 0x435fcf14, + 0x433a98c5, 0x43159fdb, 0x42f0e3ae, 0x42cc6397, 0x42a81ef5, 0x42841527, 0x4260458d, 0x423caf8c, + 0x4219528b, 0x41f62df1, 0x41d3412a, 0x41b08ba1, 0x418e0cc7, 0x416bc40d, 0x4149b0e4, 0x4127d2c3, + 0x41062920, 0x40e4b374, 0x40c3713a, 0x40a261ef, 0x40818511, 0x4060da21, 0x404060a1, 0x40201814 +}; + +LNK_SECTION_INITCODE +void InitInvSqrtTab() +{ + /* nothing to do ! + use preinitialized square root table + */ +} + + + +#if !defined(FUNCTION_invSqrtNorm2) +/***************************************************************************** + delivers 1/sqrt(op) normalized to .5...1 and the shift value of the OUTPUT, + i.e. the denormalized result is 1/sqrt(op) = invSqrtNorm(op) * 2^(shift) + uses Newton-iteration for approximation + Q(n+1) = Q(n) + Q(n) * (0.5 - 2 * V * Q(n)^2) + with Q = 0.5* V ^-0.5; 0.5 <= V < 1.0 +*****************************************************************************/ +FIXP_DBL invSqrtNorm2(FIXP_DBL op, INT *shift) +{ + + FIXP_DBL val = op ; + FIXP_DBL reg1, reg2, regtmp ; + + if (val == FL2FXCONST_DBL(0.0)) { + *shift = 1 ; + return((LONG)1); /* minimum positive value */ + } + + + /* normalize input, calculate shift value */ + FDK_ASSERT(val > FL2FXCONST_DBL(0.0)); + *shift = fNormz(val) - 1; /* CountLeadingBits() is not necessary here since test value is always > 0 */ + val <<=*shift ; /* normalized input V */ + *shift+=2 ; /* bias for exponent */ + + /* Newton iteration of 1/sqrt(V) */ + reg1 = invSqrtTab[ (INT)(val>>(DFRACT_BITS-1-(SQRT_BITS+1))) & SQRT_BITS_MASK ]; + reg2 = FL2FXCONST_DBL(0.0625f); /* 0.5 >> 3 */ + + regtmp= fPow2Div2(reg1); /* a = Q^2 */ + regtmp= reg2 - fMultDiv2(regtmp, val); /* b = 0.5 - 2 * V * Q^2 */ + reg1 += (fMultDiv2(regtmp, reg1)<<4); /* Q = Q + Q*b */ + + /* calculate the output exponent = input exp/2 */ + if (*shift & 0x00000001) { /* odd shift values ? */ + reg2 = FL2FXCONST_DBL(0.707106781186547524400844362104849f); /* 1/sqrt(2); */ + reg1 = fMultDiv2(reg1, reg2) << 2; + } + + *shift = *shift>>1; + + return(reg1); +} +#endif /* !defined(FUNCTION_invSqrtNorm2) */ + +/***************************************************************************** + + functionname: sqrtFixp + description: delivers sqrt(op) + +*****************************************************************************/ +FIXP_DBL sqrtFixp(FIXP_DBL op) +{ + INT tmp_exp = 0; + FIXP_DBL tmp_inv = invSqrtNorm2(op, &tmp_exp); + + FDK_ASSERT(tmp_exp > 0) ; + return( (FIXP_DBL) ( fMultDiv2( (op<<(tmp_exp-1)), tmp_inv ) << 2 )); +} + + +#if !defined(FUNCTION_schur_div) +/***************************************************************************** + + functionname: schur_div + description: delivers op1/op2 with op3-bit accuracy + +*****************************************************************************/ + + +FIXP_DBL schur_div(FIXP_DBL num, FIXP_DBL denum, INT count) +{ + INT L_num = (LONG)num>>1; + INT L_denum = (LONG)denum>>1; + INT div = 0; + INT k = count; + + FDK_ASSERT (num>=(FIXP_DBL)0); + FDK_ASSERT (denum>(FIXP_DBL)0); + FDK_ASSERT (num <= denum); + + if (L_num != 0) + while (--k) + { + div <<= 1; + L_num <<= 1; + if (L_num >= L_denum) + { + L_num -= L_denum; + div++; + } + } + return (FIXP_DBL)(div << (DFRACT_BITS - count)); +} + + +#endif /* !defined(FUNCTION_schur_div) */ + + +#ifndef FUNCTION_fMultNorm +FIXP_DBL fMultNorm(FIXP_DBL f1, FIXP_DBL f2, INT *result_e) +{ + INT product = 0; + INT norm_f1, norm_f2; + + if ( (f1 == (FIXP_DBL)0) || (f2 == (FIXP_DBL)0) ) { + *result_e = 0; + return (FIXP_DBL)0; + } + norm_f1 = CountLeadingBits(f1); + f1 = f1 << norm_f1; + norm_f2 = CountLeadingBits(f2); + f2 = f2 << norm_f2; + + product = fMult(f1, f2); + *result_e = - (norm_f1 + norm_f2); + + return (FIXP_DBL)product; +} +#endif + +#ifndef FUNCTION_fDivNorm +FIXP_DBL fDivNorm(FIXP_DBL L_num, FIXP_DBL L_denum, INT *result_e) +{ + FIXP_DBL div; + INT norm_num, norm_den; + + FDK_ASSERT (L_num >= (FIXP_DBL)0); + FDK_ASSERT (L_denum > (FIXP_DBL)0); + + if(L_num == (FIXP_DBL)0) + { + *result_e = 0; + return ((FIXP_DBL)0); + } + + norm_num = CountLeadingBits(L_num); + L_num = L_num << norm_num; + L_num = L_num >> 1; + *result_e = - norm_num + 1; + + norm_den = CountLeadingBits(L_denum); + L_denum = L_denum << norm_den; + *result_e -= - norm_den; + + div = schur_div(L_num, L_denum, FRACT_BITS); + + return div; +} +#endif /* !FUNCTION_fDivNorm */ + +#ifndef FUNCTION_fDivNorm +FIXP_DBL fDivNorm(FIXP_DBL num, FIXP_DBL denom) +{ + INT e; + FIXP_DBL res; + + FDK_ASSERT (denom >= num); + + res = fDivNorm(num, denom, &e); + + /* Avoid overflow since we must output a value with exponent 0 + there is no other choice than saturating to almost 1.0f */ + if(res == (FIXP_DBL)(1<<(DFRACT_BITS-2)) && e == 1) + { + res = (FIXP_DBL)MAXVAL_DBL; + } + else + { + res = scaleValue(res, e); + } + + return res; +} +#endif /* !FUNCTION_fDivNorm */ + +#ifndef FUNCTION_fDivNormHighPrec +FIXP_DBL fDivNormHighPrec(FIXP_DBL num, FIXP_DBL denom, INT *result_e) +{ + FIXP_DBL div; + INT norm_num, norm_den; + + FDK_ASSERT (num >= (FIXP_DBL)0); + FDK_ASSERT (denom > (FIXP_DBL)0); + + if(num == (FIXP_DBL)0) + { + *result_e = 0; + return ((FIXP_DBL)0); + } + + norm_num = CountLeadingBits(num); + num = num << norm_num; + num = num >> 1; + *result_e = - norm_num + 1; + + norm_den = CountLeadingBits(denom); + denom = denom << norm_den; + *result_e -= - norm_den; + + div = schur_div(num, denom, 31); + return div; +} +#endif /* !FUNCTION_fDivNormHighPrec */ + + + +FIXP_DBL CalcLog2(FIXP_DBL base_m, INT base_e, INT *result_e) +{ + return fLog2(base_m, base_e, result_e); +} + +FIXP_DBL f2Pow( + const FIXP_DBL exp_m, const INT exp_e, + INT *result_e + ) +{ + FIXP_DBL frac_part, result_m; + INT int_part; + + if (exp_e > 0) + { + INT exp_bits = DFRACT_BITS-1 - exp_e; + int_part = exp_m >> exp_bits; + frac_part = exp_m - (FIXP_DBL)(int_part << exp_bits); + frac_part = frac_part << exp_e; + } + else + { + int_part = 0; + frac_part = exp_m >> -exp_e; + } + + /* Best accuracy is around 0, so try to get there with the fractional part. */ + if( frac_part > FL2FXCONST_DBL(0.5f) ) + { + int_part = int_part + 1; + frac_part = frac_part + FL2FXCONST_DBL(-1.0f); + } + if( frac_part < FL2FXCONST_DBL(-0.5f) ) + { + int_part = int_part - 1; + frac_part = -(FL2FXCONST_DBL(-1.0f) - frac_part); + } + + /* Evaluate taylor polynomial which approximates 2^x */ + { + FIXP_DBL p; + + /* result_m ~= 2^frac_part */ + p = frac_part; + /* First taylor series coefficient a_0 = 1.0, scaled by 0.5 due to fMultDiv2(). */ + result_m = FL2FXCONST_DBL(1.0f/2.0f); + for (INT i = 0; i < POW2_PRECISION; i++) { + /* next taylor series term: a_i * x^i, x=0 */ + result_m = fMultAddDiv2(result_m, pow2Coeff[i], p); + p = fMult(p, frac_part); + } + } + + /* "+ 1" compensates fMultAddDiv2() of the polynomial evaluation above. */ + *result_e = int_part + 1; + + return result_m; +} + +FIXP_DBL f2Pow( + const FIXP_DBL exp_m, const INT exp_e + ) +{ + FIXP_DBL result_m; + INT result_e; + + result_m = f2Pow(exp_m, exp_e, &result_e); + result_e = fixMin(DFRACT_BITS-1,fixMax(-(DFRACT_BITS-1),result_e)); + + return scaleValue(result_m, result_e); +} + +FIXP_DBL fPow( + FIXP_DBL base_m, INT base_e, + FIXP_DBL exp_m, INT exp_e, + INT *result_e + ) +{ + INT ans_lg2_e, baselg2_e; + FIXP_DBL base_lg2, ans_lg2, result; + + /* Calc log2 of base */ + base_lg2 = fLog2(base_m, base_e, &baselg2_e); + + /* Prepare exp */ + { + INT leadingBits; + + leadingBits = CountLeadingBits(fAbs(exp_m)); + exp_m = exp_m << leadingBits; + exp_e -= leadingBits; + } + + /* Calc base pow exp */ + ans_lg2 = fMult(base_lg2, exp_m); + ans_lg2_e = exp_e + baselg2_e; + + /* Calc antilog */ + result = f2Pow(ans_lg2, ans_lg2_e, result_e); + + return result; +} + +FIXP_DBL fLdPow( + FIXP_DBL baseLd_m, + INT baseLd_e, + FIXP_DBL exp_m, INT exp_e, + INT *result_e + ) +{ + INT ans_lg2_e; + FIXP_DBL ans_lg2, result; + + /* Prepare exp */ + { + INT leadingBits; + + leadingBits = CountLeadingBits(fAbs(exp_m)); + exp_m = exp_m << leadingBits; + exp_e -= leadingBits; + } + + /* Calc base pow exp */ + ans_lg2 = fMult(baseLd_m, exp_m); + ans_lg2_e = exp_e + baseLd_e; + + /* Calc antilog */ + result = f2Pow(ans_lg2, ans_lg2_e, result_e); + + return result; +} + +FIXP_DBL fLdPow( + FIXP_DBL baseLd_m, INT baseLd_e, + FIXP_DBL exp_m, INT exp_e + ) +{ + FIXP_DBL result_m; + int result_e; + + result_m = fLdPow(baseLd_m, baseLd_e, exp_m, exp_e, &result_e); + + return SATURATE_SHIFT(result_m, -result_e, DFRACT_BITS); +} + +FIXP_DBL fPowInt( + FIXP_DBL base_m, INT base_e, + INT exp, + INT *pResult_e + ) +{ + FIXP_DBL result; + + if (exp != 0) { + INT result_e = 0; + + if (base_m != (FIXP_DBL)0) { + { + INT leadingBits; + leadingBits = CountLeadingBits( base_m ); + base_m <<= leadingBits; + base_e -= leadingBits; + } + + result = base_m; + + { + int i; + for (i = 1; i < fAbs(exp); i++) { + result = fMult(result, base_m); + } + } + + if (exp < 0) { + /* 1.0 / ans */ + result = fDivNorm( FL2FXCONST_DBL(0.5f), result, &result_e ); + result_e++; + } else { + int ansScale = CountLeadingBits( result ); + result <<= ansScale; + result_e -= ansScale; + } + + result_e += exp * base_e; + + } else { + result = (FIXP_DBL)0; + } + *pResult_e = result_e; + } + else { + result = FL2FXCONST_DBL(0.5f); + *pResult_e = 1; + } + + return result; +} + +FIXP_DBL fLog2(FIXP_DBL x_m, INT x_e, INT *result_e) +{ + FIXP_DBL result_m; + + /* Short cut for zero and negative numbers. */ + if ( x_m <= FL2FXCONST_DBL(0.0f) ) { + *result_e = DFRACT_BITS-1; + return FL2FXCONST_DBL(-1.0f); + } + + /* Calculate log2() */ + { + FIXP_DBL px2_m, x2_m; + + /* Move input value x_m * 2^x_e toward 1.0, where the taylor approximation + of the function log(1-x) centered at 0 is most accurate. */ + { + INT b_norm; + + b_norm = fNormz(x_m)-1; + x2_m = x_m << b_norm; + x_e = x_e - b_norm; + } + + /* map x from log(x) domain to log(1-x) domain. */ + x2_m = - (x2_m + FL2FXCONST_DBL(-1.0) ); + + /* Taylor polinomial approximation of ln(1-x) */ + result_m = FL2FXCONST_DBL(0.0); + px2_m = x2_m; + for (int i=0; i<LD_PRECISION; i++) { + result_m = fMultAddDiv2(result_m, ldCoeff[i], px2_m); + px2_m = fMult(px2_m, x2_m); + } + /* Multiply result with 1/ln(2) = 1.0 + 0.442695040888 (get log2(x) from ln(x) result). */ + result_m = fMultAddDiv2(result_m, result_m, FL2FXCONST_DBL(2.0*0.4426950408889634073599246810019)); + + /* Add exponent part. log2(x_m * 2^x_e) = log2(x_m) + x_e */ + if (x_e != 0) + { + int enorm; + + enorm = DFRACT_BITS - fNorm((FIXP_DBL)x_e); + /* The -1 in the right shift of result_m compensates the fMultDiv2() above in the taylor polinomial evaluation loop.*/ + result_m = (result_m >> (enorm-1)) + ((FIXP_DBL)x_e << (DFRACT_BITS-1-enorm)); + + *result_e = enorm; + } else { + /* 1 compensates the fMultDiv2() above in the taylor polinomial evaluation loop.*/ + *result_e = 1; + } + } + + return result_m; +} + +FIXP_DBL fLog2(FIXP_DBL x_m, INT x_e) +{ + if ( x_m <= FL2FXCONST_DBL(0.0f) ) { + x_m = FL2FXCONST_DBL(-1.0f); + } + else { + INT result_e; + x_m = fLog2(x_m, x_e, &result_e); + x_m = scaleValue(x_m, result_e-LD_DATA_SHIFT); + } + return x_m; +} + + + + +#if TEST_ROUNDING +#include <math.h> + +void writeToFile( FDKFILE *fh, float v) { + FDKfprintf(fh, "%22.16f\n", v ); +} +FDKFILE* openAppend(CHAR* filNam) +{ + FDKFILE* fh = NULL; + fh = FDKfopen(filNam, "a"); + if (!fh) { + FDKprintf("\nError at fio_open\n"); + return NULL; + } + return fh; +} + +// loop version, long duration, huge output data +void checkRound() +{ + #define IN_INT 0 // all four rounding modes are bitexact for 0 and for 1 + + float inp; + FIXP_DBL f_inp; + float r, rnd; + FIXP_DBL f_trc,f_rnd; + float step; + + //step=0.1f; + step=0.001f; + //step=0.0001f; + //step=0.00001f; + //step=0.0000001f; // BEWARE output data of test might get huge! + //step=0.00000000005f; // BEWARE output data of test might get huge! + + double d_floor,d_ceil; + FIXP_DBL f_floor,f_ceil; + INT i,j,floorInt,ceilInt,roundInt,truncInt; + + FDKFILE *fpF_a = NULL; FDKFILE *fpC_a = NULL; + FDKFILE *fpF_b = NULL; FDKFILE *fpC_b = NULL; + FDKFILE *fpF_c = NULL; FDKFILE *fpC_c = NULL; + FDKFILE *fpF_d = NULL; FDKFILE *fpC_d = NULL; + FDKFILE *fpF_e = NULL; FDKFILE *fpC_e = NULL; + + fpF_a = openAppend("_FLT_a.txt"); fpC_a = openAppend("_FDK_a.txt"); + fpF_b = openAppend("_FLT_b.txt"); fpC_b = openAppend("_FDK_b.txt"); + fpF_c = openAppend("_FLT_c.txt"); fpC_c = openAppend("_FDK_c.txt"); + fpF_d = openAppend("_FLT_d.txt"); fpC_d = openAppend("_FDK_d.txt"); + fpF_e = openAppend("_FLT_e.txt"); fpC_e = openAppend("_FDK_e.txt"); + + + + #define INPUT_SF 3 // BEWARE at SF 0 !!! over/under-flow + #define INPUT_SCALE (float)(1<<INPUT_SF) + + for (inp = -3.1f; inp < 2.1f; inp=inp+step) + //for (inp = -0.9f; inp < 0.9f; inp=inp+step) + //for (inp = -0.0000000001f; inp < 0.0000000001f; inp=inp+step) + //for (inp = -3.1f; inp < 2.1f; inp=inp+step) + { // # # + // --- write input + writeToFile(fpF_a,(float) inp); + f_inp = (FIXP_DBL)(inp / INPUT_SCALE); writeToFile(fpC_a,(float)f_inp * (float)FDKpow(2,INPUT_SF)); + + + // --- floor + d_floor = FDKfloor(inp); writeToFile(fpF_b,(float) d_floor); + // --- floor fixedpoint + floorInt = fixp_floorToInt(f_inp,INPUT_SF); + f_floor = fixp_floor (f_inp,INPUT_SF); + #if IN_INT + writeToFile(fpC_b,(float) floorInt); + #else + writeToFile(fpC_b,(float) f_floor * (float)FDKpow(2,INPUT_SF)); + #endif + + + // --- ceil + d_ceil = FDKceil(inp); writeToFile(fpF_c,(float) d_ceil ); + // --- ceil fixedpoint + ceilInt = fixp_ceilToInt(f_inp,INPUT_SF); + f_ceil = fixp_ceil (f_inp,INPUT_SF); + #if IN_INT + writeToFile(fpC_c,(float) ceilInt); + #else + writeToFile(fpC_c,(float) f_ceil * (float)FDKpow(2,INPUT_SF)); + #endif + + + // --- truncate + i = (INT)inp; writeToFile(fpF_d,(float) i); + // --- truncate fixedpoint + truncInt = fixp_truncateToInt(f_inp,INPUT_SF); + f_trc = fixp_truncate (f_inp,INPUT_SF); + #if IN_INT + writeToFile(fpC_d,(float) truncInt); + #else + writeToFile(fpC_d,(float) f_trc * (float)FDKpow(2,INPUT_SF)); + #endif + + + // --- round + r = 0.5f; + if (inp > 0) rnd = inp + r; + if (inp < 0) rnd = -(-inp + r); // avoid offset; you might get offset with 'rnd = inp - r' + j = (INT)(rnd); writeToFile(fpF_e,(float) j); + // --- round fixedpoint + roundInt = fixp_roundToInt(f_inp,INPUT_SF); + f_rnd = fixp_round (f_inp,INPUT_SF); + #if IN_INT + writeToFile(fpC_e,(float) roundInt); + #else + writeToFile(fpC_e,(float) f_rnd * (float)FDKpow(2,INPUT_SF)); + #endif + } + + if (fpF_a) FDKfclose(fpF_a); if (fpC_a) FDKfclose(fpC_a); + if (fpF_b) FDKfclose(fpF_b); if (fpC_b) FDKfclose(fpC_b); + if (fpF_c) FDKfclose(fpF_c); if (fpC_c) FDKfclose(fpC_c); + if (fpF_d) FDKfclose(fpF_d); if (fpC_d) FDKfclose(fpC_d); + if (fpF_e) FDKfclose(fpF_e); if (fpC_e) FDKfclose(fpC_e); +} + + +// round only a few selected values (faster) +void checkRound2() +{ + // set point + #define BLOD 24 // left bits (of dot): number of bits _left_ of decimal point ==> Q 24.8 format (incl. sign bit) + #define BROD 8 // right bits (of dot): number of bits _right_ of decimal point ==> Q 24.8 format + FDK_ASSERT((BROD+BLOD)==DFRACT_BITS); + + // scale factors + #define FL_SF BLOD + #define FL_SCALE (1<<FL_SF) + + #define FR_SF BROD + #define FR_SCALE (1<<FR_SF) + + #define INL_SF 7 // bits at INput Left of dot + #define INL_SCALE (float)(1<<INL_SF) + + #define INR_SF (DFRACT_BITS-1-INL_SF) // bits at INput Right of dot 32-1-7 = 24 + #define INR_SCALE (float)(1<<INR_SF) + + + // testdata + #define X_MIN -128.0000f // + #define X0 -127.0000f // + + #define X1 -5.0000f // +//#define X1 -4.4999f // round +//#define X1 4.4999f // round + + #define X2 -4.9999f // + #define X3 -4.5000f // + #define X4 -0.1234f // + #define X_NULL 0.0f // + #define X5 0.1234f // + #define X6 4.5000f // + #define X7 4.9999f // + #define X8 5.0000f // + // subtract one LSB from 128.0f [this is needed AFTER hex values have been dumped --> this is needed to get a valid float reference for floor and trunc ] + #define X_MAX ((-0.0000000004656613f) + 128.0000f) + + + FIXP_DBL f_reg0, f_reg1, f_reg2, f_reg3, f_reg4, f_reg5, f_reg6, f_reg7, f_reg8, f_reg_min, f_reg_max, f_reg_null; + INT res0, res1, res2, res3, res4, res5, res6, res7, res8; + FIXP_DBL f_res0, f_res1, f_res2, f_res3, f_res4, f_res5, f_res6, f_res7, f_res8; + + f_reg_min = (LONG)0x80000000 ; // data taken from above dump; cast to LONG needed because of + f_reg0 = (LONG)0x81000000 ; // fract-class needs a sign; 0x######## is of type unsigned int. + f_reg1 = (LONG)0xfb000000 ; + f_reg2 = (LONG)0xfb000690 ; + f_reg3 = (LONG)0xfb800000 ; + f_reg4 = (LONG)0xffe068dc ; + f_reg_null = (LONG)0x00000000 ; + f_reg5 = (LONG)0x001f9724 ; + f_reg6 = (LONG)0x04800000 ; + f_reg7 = (LONG)0x04fff970 ; + f_reg8 = (LONG)0x05000000 ; + f_reg_max = (LONG)0x7fffffff ; + + + FDKprintf("---- input values ----\n"); + FDKprintf("%f %f %f %f %f %f %f %f %f\n", X0 + , X1 + , X2 + , X3 + , X4 + , X5 + , X6 + , X7 + , X8 + ); + FDKprintf("%f %f %f %f %f %f %f %f %f\n", (float)f_reg0 * (float)FDKpow(2,INL_SF) + , (float)f_reg1 * (float)FDKpow(2,INL_SF) + , (float)f_reg2 * (float)FDKpow(2,INL_SF) + , (float)f_reg3 * (float)FDKpow(2,INL_SF) + , (float)f_reg4 * (float)FDKpow(2,INL_SF) + , (float)f_reg5 * (float)FDKpow(2,INL_SF) + , (float)f_reg6 * (float)FDKpow(2,INL_SF) + , (float)f_reg7 * (float)FDKpow(2,INL_SF) + , (float)f_reg8 * (float)FDKpow(2,INL_SF) + ); + FDKprintf("---- min/max input values ----\n"); + FDKprintf("%f %f %f\n", X_MIN + , X_NULL + , X_MAX + ); + FDKprintf("%f %f %f\n", (float)f_reg_min * (float)FDKpow(2,INL_SF) + , (float)f_reg_null * (float)FDKpow(2,INL_SF) + , (float)f_reg_max * (float)FDKpow(2,INL_SF) + ); + FDKprintf("\n"); + + FDKprintf("\n---- floor ----\n"); + res0 = fixp_floorToInt(f_reg0, INL_SF); f_res0 = fixp_floor(f_reg0, INL_SF); + res1 = fixp_floorToInt(f_reg1, INL_SF); f_res1 = fixp_floor(f_reg1, INL_SF); + res2 = fixp_floorToInt(f_reg2, INL_SF); f_res2 = fixp_floor(f_reg2, INL_SF); + res3 = fixp_floorToInt(f_reg3, INL_SF); f_res3 = fixp_floor(f_reg3, INL_SF); + res4 = fixp_floorToInt(f_reg4, INL_SF); f_res4 = fixp_floor(f_reg4, INL_SF); + res5 = fixp_floorToInt(f_reg5, INL_SF); f_res5 = fixp_floor(f_reg5, INL_SF); + res6 = fixp_floorToInt(f_reg6, INL_SF); f_res6 = fixp_floor(f_reg6, INL_SF); + res7 = fixp_floorToInt(f_reg7, INL_SF); f_res7 = fixp_floor(f_reg7, INL_SF); + res8 = fixp_floorToInt(f_reg8, INL_SF); f_res8 = fixp_floor(f_reg8, INL_SF); + FDKprintf("reference %i %i %i %i %i %i %i %i %i\n", (int)floor(X0), (int)floor(X1), (int)floor(X2), (int)floor(X3), (int)floor(X4), (int)floor(X5), (int)floor(X6), (int)floor(X7), (int)floor(X8)); + FDKprintf("fixp_floorToInt %i %i %i %i %i %i %i %i %i\n", res0, res1, res2, res3, res4, res5, res6, res7, res8); + FDKprintf("fixp_floor %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f\n", (float)f_res0*(float)FDKpow(2,INL_SF), + (float)f_res1*(float)FDKpow(2,INL_SF), + (float)f_res2*(float)FDKpow(2,INL_SF), + (float)f_res3*(float)FDKpow(2,INL_SF), + (float)f_res4*(float)FDKpow(2,INL_SF), + (float)f_res5*(float)FDKpow(2,INL_SF), + (float)f_res6*(float)FDKpow(2,INL_SF), + (float)f_res7*(float)FDKpow(2,INL_SF), + (float)f_res8*(float)FDKpow(2,INL_SF)); + + FDKprintf("\n---- min/max floor ----\n"); + res1 = fixp_floorToInt(f_reg_min, INL_SF); f_res1 = fixp_floor(f_reg_min, INL_SF); + res2 = fixp_floorToInt(f_reg_null, INL_SF); f_res2 = fixp_floor(f_reg_null, INL_SF); + res3 = fixp_floorToInt(f_reg_max, INL_SF); f_res3 = fixp_floor(f_reg_max, INL_SF); + FDKprintf("reference %i %i %i\n", (int)floor(X_MIN), (int)floor(X_NULL), (int)floor(X_MAX)); + FDKprintf("fixp_floorToInt %i %i %i\n", res1, res2, res3); + FDKprintf("fixp_floor %10.7f %10.7f %10.7f\n", (float)f_res1*(float)FDKpow(2,INL_SF), + (float)f_res2*(float)FDKpow(2,INL_SF), + (float)f_res3*(float)FDKpow(2,INL_SF)); + FDKprintf("\n\n\n"); + + + FDKprintf("---- ceil ----\n"); + res0 = fixp_ceilToInt(f_reg0, INL_SF); f_res0 = fixp_ceil(f_reg0, INL_SF); + res1 = fixp_ceilToInt(f_reg1, INL_SF); f_res1 = fixp_ceil(f_reg1, INL_SF); + res2 = fixp_ceilToInt(f_reg2, INL_SF); f_res2 = fixp_ceil(f_reg2, INL_SF); + res3 = fixp_ceilToInt(f_reg3, INL_SF); f_res3 = fixp_ceil(f_reg3, INL_SF); + res4 = fixp_ceilToInt(f_reg4, INL_SF); f_res4 = fixp_ceil(f_reg4, INL_SF); + res5 = fixp_ceilToInt(f_reg5, INL_SF); f_res5 = fixp_ceil(f_reg5, INL_SF); + res6 = fixp_ceilToInt(f_reg6, INL_SF); f_res6 = fixp_ceil(f_reg6, INL_SF); + res7 = fixp_ceilToInt(f_reg7, INL_SF); f_res7 = fixp_ceil(f_reg7, INL_SF); + res8 = fixp_ceilToInt(f_reg8, INL_SF); f_res8 = fixp_ceil(f_reg8, INL_SF); + FDKprintf("reference %i %i %i %i %i %i %i %i %i\n", (int)ceil(X0), (int)ceil(X1), (int)ceil(X2), (int)ceil(X3), (int)ceil(X4), (int)ceil(X5), (int)ceil(X6), (int)ceil(X7), (int)ceil(X8)); + FDKprintf("fixp_ceilToInt %i %i %i %i %i %i %i %i %i\n", res0, res1, res2, res3, res4, res5, res6, res7, res8); + FDKprintf("fixp_ceil %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f\n", (float)f_res0*(float)FDKpow(2,INL_SF), + (float)f_res1*(float)FDKpow(2,INL_SF), + (float)f_res2*(float)FDKpow(2,INL_SF), + (float)f_res3*(float)FDKpow(2,INL_SF), + (float)f_res4*(float)FDKpow(2,INL_SF), + (float)f_res5*(float)FDKpow(2,INL_SF), + (float)f_res6*(float)FDKpow(2,INL_SF), + (float)f_res7*(float)FDKpow(2,INL_SF), + (float)f_res8*(float)FDKpow(2,INL_SF)); + + FDKprintf("\n---- min/max ceil ----\n"); + res1 = fixp_ceilToInt(f_reg_min, INL_SF); + res2 = fixp_ceilToInt(f_reg_null, INL_SF); + res3 = fixp_ceilToInt(f_reg_max, INL_SF); + + f_res1 = fixp_ceil(f_reg_min, INL_SF); + f_res2 = fixp_ceil(f_reg_null, INL_SF); + f_res3 = fixp_ceil(f_reg_max, INL_SF); + + FDKprintf("reference %i %i %i\n", (int)ceil(X_MIN), (int)ceil(X_NULL), (int)ceil(X_MAX)); + FDKprintf("fixp_ceilToInt %i %i %i\n", res1, res2, res3); + FDKprintf("fixp_ceil %10.7f %10.7f %10.7f\n", (float)f_res1*(float)FDKpow(2,INL_SF), + (float)f_res2*(float)FDKpow(2,INL_SF), + (float)f_res3*(float)FDKpow(2,INL_SF)); + FDKprintf("\n\n\n"); + + + FDKprintf("---- trunc ----\n"); + res0 = fixp_truncateToInt(f_reg0, INL_SF); f_res0 = fixp_truncate(f_reg0, INL_SF); + res1 = fixp_truncateToInt(f_reg1, INL_SF); f_res1 = fixp_truncate(f_reg1, INL_SF); + res2 = fixp_truncateToInt(f_reg2, INL_SF); f_res2 = fixp_truncate(f_reg2, INL_SF); + res3 = fixp_truncateToInt(f_reg3, INL_SF); f_res3 = fixp_truncate(f_reg3, INL_SF); + res4 = fixp_truncateToInt(f_reg4, INL_SF); f_res4 = fixp_truncate(f_reg4, INL_SF); + res5 = fixp_truncateToInt(f_reg5, INL_SF); f_res5 = fixp_truncate(f_reg5, INL_SF); + res6 = fixp_truncateToInt(f_reg6, INL_SF); f_res6 = fixp_truncate(f_reg6, INL_SF); + res7 = fixp_truncateToInt(f_reg7, INL_SF); f_res7 = fixp_truncate(f_reg7, INL_SF); + res8 = fixp_truncateToInt(f_reg8, INL_SF); f_res8 = fixp_truncate(f_reg8, INL_SF); + FDKprintf("reference %i %i %i %i %i %i %i %i %i\n", (int)(X0), (int)(X1), (int)(X2), (int)(X3), (int)(X4), (int)(X5), (int)(X6), (int)(X7), (int)(X8)); + FDKprintf("fixp_truncateToInt %i %i %i %i %i %i %i %i %i\n", res0, res1, res2, res3, res4, res5, res6, res7, res8); + FDKprintf("fixp_truncate %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f\n", (float)f_res0*(float)FDKpow(2,INL_SF), + (float)f_res1*(float)FDKpow(2,INL_SF), + (float)f_res2*(float)FDKpow(2,INL_SF), + (float)f_res3*(float)FDKpow(2,INL_SF), + (float)f_res4*(float)FDKpow(2,INL_SF), + (float)f_res5*(float)FDKpow(2,INL_SF), + (float)f_res6*(float)FDKpow(2,INL_SF), + (float)f_res7*(float)FDKpow(2,INL_SF), + (float)f_res8*(float)FDKpow(2,INL_SF)); + + FDKprintf("\n---- min/max trunc ----\n"); + res1 = fixp_truncateToInt(f_reg_min, INL_SF); f_res1 = fixp_truncate(f_reg_min, INL_SF); + res2 = fixp_truncateToInt(f_reg_null,INL_SF); f_res2 = fixp_truncate(f_reg_null,INL_SF); + res3 = fixp_truncateToInt(f_reg_max, INL_SF); f_res3 = fixp_truncate(f_reg_max, INL_SF); + FDKprintf("reference %i %i %i\n", (int)(X_MIN), (int)(X_NULL), (int)(X_MAX)); + FDKprintf("fixp_truncateToInt %i %i %i\n", res1, res2, res3); + FDKprintf("fixp_truncate %10.7f %10.7f %10.7f\n", (float)f_res1*(float)FDKpow(2,INL_SF), + (float)f_res2*(float)FDKpow(2,INL_SF), + (float)f_res3*(float)FDKpow(2,INL_SF)); + FDKprintf("\n\n\n"); + + + FDKprintf("---- round ----\n"); + res0 = fixp_roundToInt(f_reg0, INL_SF); f_res0 = fixp_round(f_reg0, INL_SF); + res1 = fixp_roundToInt(f_reg1, INL_SF); f_res1 = fixp_round(f_reg1, INL_SF); + res2 = fixp_roundToInt(f_reg2, INL_SF); f_res2 = fixp_round(f_reg2, INL_SF); + res3 = fixp_roundToInt(f_reg3, INL_SF); f_res3 = fixp_round(f_reg3, INL_SF); + res4 = fixp_roundToInt(f_reg4, INL_SF); f_res4 = fixp_round(f_reg4, INL_SF); + res5 = fixp_roundToInt(f_reg5, INL_SF); f_res5 = fixp_round(f_reg5, INL_SF); + res6 = fixp_roundToInt(f_reg6, INL_SF); f_res6 = fixp_round(f_reg6, INL_SF); + res7 = fixp_roundToInt(f_reg7, INL_SF); f_res7 = fixp_round(f_reg7, INL_SF); + res8 = fixp_roundToInt(f_reg8, INL_SF); f_res8 = fixp_round(f_reg8, INL_SF); + FDKprintf("reference %i %i %i %i %i %i %i %i %i\n", roundRef(X0), + roundRef(X1), + roundRef(X2), + roundRef(X3), + roundRef(X4), + roundRef(X5), + roundRef(X6), + roundRef(X7), + roundRef(X8)); + FDKprintf("fixp_roundToInt %i %i %i %i %i %i %i %i %i\n", res0, res1, res2, res3, res4, res5, res6, res7, res8); + FDKprintf("fixp_round %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f %10.7f\n", (float)f_res0*(float)FDKpow(2,INL_SF), + (float)f_res1*(float)FDKpow(2,INL_SF), + (float)f_res2*(float)FDKpow(2,INL_SF), + (float)f_res3*(float)FDKpow(2,INL_SF), + (float)f_res4*(float)FDKpow(2,INL_SF), + (float)f_res5*(float)FDKpow(2,INL_SF), + (float)f_res6*(float)FDKpow(2,INL_SF), + (float)f_res7*(float)FDKpow(2,INL_SF), + (float)f_res8*(float)FDKpow(2,INL_SF)); + + FDKprintf("\n---- min/max round ----\n"); + res1 = fixp_roundToInt(f_reg_min, INL_SF); f_res1 = fixp_round(f_reg_min, INL_SF); + res2 = fixp_roundToInt(f_reg_null,INL_SF); f_res2 = fixp_round(f_reg_null,INL_SF); + res3 = fixp_roundToInt(f_reg_max, INL_SF); f_res3 = fixp_round(f_reg_max, INL_SF); + + FDKprintf("reference %i %i %i\n", roundRef(X_MIN), + roundRef(X_NULL), + roundRef(X_MAX)); + FDKprintf("fixp_roundToInt %i %i %i\n", res1, res2, res3); + FDKprintf("fixp_round %10.7f %10.7f %10.7f\n", (float)f_res1*(float)FDKpow(2,INL_SF), + (float)f_res2*(float)FDKpow(2,INL_SF), + (float)f_res3*(float)FDKpow(2,INL_SF)); + FDKprintf("\n\n\n"); + +} +#endif diff --git a/libFDK/src/mdct.cpp b/libFDK/src/mdct.cpp new file mode 100644 index 0000000..ed8ec0c --- /dev/null +++ b/libFDK/src/mdct.cpp @@ -0,0 +1,339 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2011) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Josef Hoepfl, Manuel Jander + Description: MDCT routines + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#include "mdct.h" + + +#include "FDK_tools_rom.h" +#include "dct.h" +#include "fixpoint_math.h" + +#define OPT_OVERLAP_ADD + +void mdct_init( H_MDCT hMdct, + FIXP_DBL *overlap, + INT overlapBufferSize ) +{ + hMdct->overlap.freq = overlap; + //FDKmemclear(overlap, overlapBufferSize*sizeof(FIXP_DBL)); + hMdct->prev_fr = 0; + hMdct->prev_nr = 0; + hMdct->prev_tl = 0; + hMdct->ov_size = overlapBufferSize; +} + +INT mdct( H_MDCT hMdct, + FIXP_DBL *spectrum, + INT *scalefactor, + INT_PCM *input, + INT tl, + INT nr, + INT fr, + const FIXP_WTP *wrs ) +{ + /* Fold and windowing */ + + /* DCT IV */ + // dct_IV(); + return tl; +} + +void imdct_gain(FIXP_DBL *pGain_m, int *pGain_e, int tl) +{ + FIXP_DBL gain_m = *pGain_m; + int gain_e = *pGain_e; + int log2_tl; + + log2_tl = DFRACT_BITS-1-fNormz((FIXP_DBL)tl); + + gain_e += -MDCT_OUTPUT_GAIN - log2_tl - MDCT_OUT_HEADROOM + 1; + + /* Detect non-radix 2 transform length and add amplitude compensation factor + which cannot be included into the exponent above */ + switch ( (tl) >> (log2_tl - 2) ) { + case 0x7: /* 10 ms, 1/tl = 1.0/(FDKpow(2.0, -log2_tl) * 0.53333333333333333333) */ + if (gain_m == (FIXP_DBL)0) { + gain_m = FL2FXCONST_DBL(0.53333333333333333333f); + } else { + gain_m = fMult(gain_m, FL2FXCONST_DBL(0.53333333333333333333f)); + } + break; + case 0x6: /* 3/4 of radix 2, 1/tl = 1.0/(FDKpow(2.0, -log2_tl) * 2.0/3.0) */ + if (gain_m == (FIXP_DBL)0) { + gain_m = FL2FXCONST_DBL(2.0/3.0f); + } else { + gain_m = fMult(gain_m, FL2FXCONST_DBL(2.0/3.0f)); + } + break; + case 0x4: + /* radix 2, nothing to do. */ + break; + default: + /* unsupported */ + FDK_ASSERT(0); + break; + } + + *pGain_m = gain_m; + *pGain_e = gain_e; +} + +INT imdct_drain( + H_MDCT hMdct, + FIXP_DBL *output, + INT nrSamplesRoom + ) +{ + int buffered_samples = 0; + + if (nrSamplesRoom > 0) { + buffered_samples = hMdct->ov_offset; + + FDK_ASSERT(buffered_samples <= nrSamplesRoom); + + if (buffered_samples > 0) { + FDKmemcpy(output, hMdct->overlap.time, buffered_samples*sizeof(FIXP_DBL)); + hMdct->ov_offset = 0; + } + } + return buffered_samples; +} + +INT imdct_copy_ov_and_nr( + H_MDCT hMdct, + FIXP_DBL * pTimeData, + INT nrSamples + ) +{ + FIXP_DBL *pOvl; + int nt, nf, i; + + nt = fMin(hMdct->ov_offset, nrSamples); + nrSamples -= nt; + nf = fMin(hMdct->prev_nr, nrSamples); + nrSamples -= nf; + FDKmemcpy(pTimeData, hMdct->overlap.time, nt*sizeof(FIXP_DBL)); + pTimeData += nt; + + pOvl = hMdct->overlap.freq + hMdct->ov_size - 1; + for (i=0; i<nf; i++) { + FIXP_DBL x = - (*pOvl--); + *pTimeData = IMDCT_SCALE_DBL(x); + pTimeData ++; + } + + return (nt+nf); +} + +void imdct_adapt_parameters(H_MDCT hMdct, int *pfl, int *pnl, int tl, const FIXP_WTP *wls, int noOutSamples) +{ + int fl = *pfl, nl = *pnl; + int window_diff, use_current = 0, use_previous = 0; + if (hMdct->prev_tl == 0) { + hMdct->prev_wrs = wls; + hMdct->prev_fr = fl; + hMdct->prev_nr = (noOutSamples-fl)>>1; + hMdct->prev_tl = noOutSamples; + hMdct->ov_offset = 0; + use_current = 1; + } + + window_diff = (hMdct->prev_fr - fl)>>1; + + /* check if the previous window slope can be adjusted to match the current window slope */ + if (hMdct->prev_nr + window_diff > 0) { + use_current = 1; + } + /* check if the current window slope can be adjusted to match the previous window slope */ + if (nl - window_diff > 0 ) { + use_previous = 1; + } + + /* if both is possible choose the larger of both window slope lengths */ + if (use_current && use_previous) { + if (fl < hMdct->prev_fr) { + use_current = 0; + } else { + use_previous = 0; + } + } + /* + * If the previous transform block is big enough, enlarge previous window overlap, + * if not, then shrink current window overlap. + */ + if (use_current) { + hMdct->prev_nr += window_diff; + hMdct->prev_fr = fl; + hMdct->prev_wrs = wls; + } else { + nl -= window_diff; + fl = hMdct->prev_fr; + } + + *pfl = fl; + *pnl = nl; +} + +INT imdct_block( + H_MDCT hMdct, + FIXP_DBL *output, + FIXP_DBL *spectrum, + const SHORT scalefactor[], + const INT nSpec, + const INT noOutSamples, + const INT tl, + const FIXP_WTP *wls, + INT fl, + const FIXP_WTP *wrs, + const INT fr, + FIXP_DBL gain + ) +{ + FIXP_DBL *pOvl; + FIXP_DBL *pOut0 = output, *pOut1; + INT nl, nr; + int w, i, nrSamples = 0, specShiftScale, transform_gain_e = 0; + + /* Derive NR and NL */ + nr = (tl - fr)>>1; + nl = (tl - fl)>>1; + + /* Include 2/N IMDCT gain into gain factor and exponent. */ + imdct_gain(&gain, &transform_gain_e, tl); + + /* Detect FRprevious / FL mismatches and override parameters accordingly */ + if (hMdct->prev_fr != fl) { + imdct_adapt_parameters(hMdct, &fl, &nl, tl, wls, noOutSamples); + } + + pOvl = hMdct->overlap.freq + hMdct->ov_size - 1; + + if ( noOutSamples > nrSamples ) { + /* Purge buffered output. */ + for (i=0; i<hMdct->ov_offset; i++) { + *pOut0 = hMdct->overlap.time[i]; + pOut0 ++; + } + nrSamples = hMdct->ov_offset; + hMdct->ov_offset = 0; + } + + for (w=0; w<nSpec; w++) + { + FIXP_DBL *pSpec, *pCurr; + const FIXP_WTP *pWindow; + + specShiftScale = transform_gain_e; + + /* Setup window pointers */ + pWindow = hMdct->prev_wrs; + + /* Current spectrum */ + pSpec = spectrum+w*tl; + + /* DCT IV of current spectrum. */ + dct_IV(pSpec, tl, &specShiftScale); + + /* Optional scaling of time domain - no yet windowed - of current spectrum */ + /* and de-scale current spectrum signal (time domain, no yet windowed) */ + if (gain != (FIXP_DBL)0) { + scaleValuesWithFactor(pSpec, gain, tl, scalefactor[w] + specShiftScale); + } else { + scaleValues(pSpec, tl, scalefactor[w] + specShiftScale); + } + + if ( noOutSamples <= nrSamples ) { + /* Divert output first half to overlap buffer if we already got enough output samples. */ + pOut0 = hMdct->overlap.time + hMdct->ov_offset; + hMdct->ov_offset += hMdct->prev_nr + fl/2; + } else { + /* Account output samples */ + nrSamples += hMdct->prev_nr + fl/2; + } + + /* NR output samples 0 .. NR. -overlap[TL/2..TL/2-NR] */ + for (i=0; i<hMdct->prev_nr; i++) { + FIXP_DBL x = - (*pOvl--); + *pOut0 = IMDCT_SCALE_DBL(x); + pOut0 ++; + } + + if ( noOutSamples <= nrSamples ) { + /* Divert output second half to overlap buffer if we already got enough output samples. */ + pOut1 = hMdct->overlap.time + hMdct->ov_offset + fl/2 - 1; + hMdct->ov_offset += fl/2 + nl; + } else { + pOut1 = pOut0 + (fl - 1); + nrSamples += fl/2 + nl; + } + + /* output samples before window crossing point NR .. TL/2. -overlap[TL/2-NR..TL/2-NR-FL/2] + current[NR..TL/2] */ + /* output samples after window crossing point TL/2 .. TL/2+FL/2. -overlap[0..FL/2] - current[TL/2..FL/2] */ + pCurr = pSpec + tl - fl/2; + for (i=0; i<fl/2; i++) { + FIXP_DBL x0, x1; + + cplxMult(&x1, &x0, *pCurr++, - *pOvl--, pWindow[i]); + *pOut0 = IMDCT_SCALE_DBL(x0); + *pOut1 = IMDCT_SCALE_DBL(-x1); + pOut0 ++; + pOut1 --; + } + pOut0 += (fl/2); + + /* NL output samples TL/2+FL/2..TL. - current[FL/2..0] */ + pOut1 += (fl/2) + 1; + pCurr = pSpec + tl - fl/2 - 1; + for (i=0; i<nl; i++) { + FIXP_DBL x = - (*pCurr--); + *pOut1 = IMDCT_SCALE_DBL(x); + pOut1 ++; + } + + /* Set overlap source pointer for next window pOvl = pSpec + tl/2 - 1; */ + pOvl = pSpec + tl/2 - 1; + + /* Previous window values. */ + hMdct->prev_nr = nr; + hMdct->prev_fr = fr; + hMdct->prev_tl = tl; + hMdct->prev_wrs = wrs; + } + + /* Save overlap */ + + pOvl = hMdct->overlap.freq + hMdct->ov_size - tl/2; + FDK_ASSERT(pOvl >= hMdct->overlap.time + hMdct->ov_offset); + FDK_ASSERT(tl/2 <= hMdct->ov_size); + for (i=0; i<tl/2; i++) { + pOvl[i] = spectrum[i+(nSpec-1)*tl]; + } + + return nrSamples; +} + diff --git a/libFDK/src/mips/fft_rad2_mips.cpp b/libFDK/src/mips/fft_rad2_mips.cpp new file mode 100644 index 0000000..2d40521 --- /dev/null +++ b/libFDK/src/mips/fft_rad2_mips.cpp @@ -0,0 +1,72 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2007) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: dit_fft MIPS assembler replacements. + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#if defined(MIPS_DSP_LIB) + +#include "dsplib_util.h" +#include "dsplib_dsp.h" + +#define FUNCTION_dit_fft + +#ifdef FUNCTION_dit_fft + +#include "mips_fft_twiddles.cpp" + +void dit_fft(FIXP_DBL *x, const INT ldn, const FIXP_STP *trigdata, const INT trigDataSize) +{ + int i; + + int32c *din = (int32c*)x; + int32c *dout = (int32c*)x; + + int32c scratch[1024]; + int32c *twiddles; + + switch (ldn) { + case 4: twiddles = (int32c*)__twiddles_mips_fft32_16; break; + case 5: twiddles = (int32c*)__twiddles_mips_fft32_32; break; + case 6: twiddles = (int32c*)__twiddles_mips_fft32_64; break; + case 7: twiddles = (int32c*)__twiddles_mips_fft32_128; break; + case 8: twiddles = (int32c*)__twiddles_mips_fft32_256; break; + case 9: twiddles = (int32c*)__twiddles_mips_fft32_512; break; + case 10: twiddles = (int32c*)__twiddles_mips_fft32_1024; break; + //case 11: twiddles = (int32c*)__twiddles_mips_fft32_2048; break; + default: FDK_ASSERT(0); break; + } + + mips_fft32(dout, din, twiddles, scratch, ldn); + + for(i=0;i<(1<<ldn);i++) { + x[2*i] = dout[i].re<<1; + x[2*i+1] = dout[i].im<<1; + } +} +#endif + + +#endif /* defined(MIPS_DSP_LIB) */ diff --git a/libFDK/src/mips/mips_fft_twiddles.cpp b/libFDK/src/mips/mips_fft_twiddles.cpp new file mode 100644 index 0000000..2272d37 --- /dev/null +++ b/libFDK/src/mips/mips_fft_twiddles.cpp @@ -0,0 +1,516 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +static const INT __twiddles_mips_fft32_16[] = +{ +(0x7FFFFFFF), (0x00000000), (0x7641AF32), (0xCF043A9E), (0x5A827978), (0xA57D8646), (0x30FBC547), (0x89BE50C2), (0xFFFFFFA3), (0x80000002), (0xCF043AF8), (0x89BE50A8), (0xA57D865E), (0xA57D8670), (0x89BE5100), (0xCF043A24), (0x00000000), (0x00000000), +(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000) +}; + +static const INT __twiddles_mips_fft32_32[] = +{ +(0x7FFFFFFF), (0x00000000), (0x7D8A5F3C), (0xE70747B9), (0x7641AF32), (0xCF043A9E), (0x6A6D98A1), (0xB8E31318), (0x5A827978), (0xA57D8646), (0x471CED05), (0x95926772), (0x30FBC547), (0x89BE50C2), (0x18F8B888), (0x8275A0D1), (0xFFFFFFA3), (0x80000002), +(0xE70747BB), (0x8275A0C3), (0xCF043AF8), (0x89BE50A8), (0xB8E3139E), (0x95926705), (0xA57D865E), (0xA57D8670), (0x959266F7), (0xB8E313B4), (0x89BE5100), (0xCF043A24), (0x8275A0BE), (0xE70747D4), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x37000000), (0x000080A3), +(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000) +}; + +static const INT __twiddles_mips_fft32_64[] = +{ +(0x7FFFFFFF), (0x00000000), (0x7F62368D), (0xF3742C9D), (0x7D8A5F3C), (0xE70747B9), (0x7A7D0559), (0xDAD7F3A2), (0x7641AF32), (0xCF043A9E), (0x70E2CBCD), (0xC3A945A1), (0x6A6D98A1), (0xB8E31318), (0x62F201C4), (0xAECC338B), (0x5A827978), (0xA57D8646), +(0x5133CC8F), (0x9D0DFE52), (0x471CED05), (0x95926772), (0x3C56BAB5), (0x8F1D3461), (0x30FBC547), (0x89BE50C2), (0x25280C05), (0x8582FA8C), (0x18F8B888), (0x8275A0D1), (0x0C8BD356), (0x809DC971), (0xFFFFFFA3), (0x80000002), (0xF3742CEE), (0x809DC96B), +(0xE70747BB), (0x8275A0C3), (0xDAD7F348), (0x8582FAC2), (0xCF043AF8), (0x89BE50A8), (0xC3A94669), (0x8F1D33C8), (0xB8E3139E), (0x95926705), (0xAECC33A5), (0x9D0DFE27), (0xA57D865E), (0xA57D8670), (0x9D0DFE16), (0xAECC33B9), (0x959266F7), (0xB8E313B4), +(0x8F1D34AD), (0xC3A944BC), (0x89BE5100), (0xCF043A24), (0x8582FABB), (0xDAD7F360), (0x8275A0BE), (0xE70747D4), (0x809DC968), (0xF3742D08), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +(0x00000000), (0x00000000), (0xFF7B0000), (0x2E8050F1), (0x10214482), (0x1BA00005), (0x0000C0FF), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +(0x00000000), (0x00000000) +}; + +static const INT __twiddles_mips_fft32_128[] = +{ +(0x7FFFFFFF), (0x00000000), (0x7FD8878C), (0xF9B82681), (0x7F62368D), (0xF3742C9D), (0x7E9D55FB), (0xED37EF91), (0x7D8A5F3C), (0xE70747B9), (0x7C29FBEF), (0xE0E6068F), (0x7A7D0559), (0xDAD7F3A2), (0x78848419), (0xD4E0CB28), (0x7641AF32), (0xCF043A9E), +(0x73B5EBCF), (0xC945DFEB), (0x70E2CBCD), (0xC3A945A1), (0x6DCA0D27), (0xBE31E1BF), (0x6A6D98A1), (0xB8E31318), (0x66CF8103), (0xB3C01FE9), (0x62F201C4), (0xAECC338B), (0x5ED77C86), (0xAA0A5B2C), (0x5A827978), (0xA57D8646), (0x55F5A4ED), (0xA1288391), +(0x5133CC8F), (0x9D0DFE52), (0x4C3FDFCC), (0x99307EC5), (0x471CED05), (0x95926772), (0x41CE1ECD), (0x9235F32C), (0x3C56BAB5), (0x8F1D3461), (0x36BA2034), (0x8C4A1440), (0x30FBC547), (0x89BE50C2), (0x2B1F34BC), (0x877B7BDD), (0x25280C05), (0x8582FA8C), +(0x1F19F9F0), (0x83D60431), (0x18F8B888), (0x8275A0D1), (0x12C81090), (0x8162AA0A), (0x0C8BD356), (0x809DC971), (0x0647D949), (0x80277871), (0xFFFFFFA3), (0x80000002), (0xF9B826FB), (0x8027786E), (0xF3742CEE), (0x809DC96B), (0xED37EFB3), (0x8162AA00), +(0xE70747BB), (0x8275A0C3), (0xE0E60653), (0x83D60420), (0xDAD7F348), (0x8582FAC2), (0xD4E0CB84), (0x877B7BC6), (0xCF043AF8), (0x89BE50A8), (0xC945E00A), (0x8C4A1423), (0xC3A94669), (0x8F1D33C8), (0xBE31E16E), (0x9235F309), (0xB8E3139E), (0x95926705), +(0xB3C01F9D), (0x99307F35), (0xAECC33A5), (0x9D0DFE27), (0xAA0A5A88), (0xA128840F), (0xA57D865E), (0xA57D8670), (0xA12883FE), (0xAA0A5A9B), (0x9D0DFE16), (0xAECC33B9), (0x99307F26), (0xB3C01FB2), (0x959266F7), (0xB8E313B4), (0x9235F2FC), (0xBE31E184), +(0x8F1D34AD), (0xC3A944BC), (0x8C4A1418), (0xC945E021), (0x89BE5100), (0xCF043A24), (0x877B7BBD), (0xD4E0CB9C), (0x8582FABB), (0xDAD7F360), (0x83D603DC), (0xE0E60764), (0x8275A0BE), (0xE70747D4), (0x8162AA22), (0xED37EECF), (0x809DC968), (0xF3742D08), +(0x80277879), (0xF9B82615), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +(0x00000000), (0xA4370000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0xFF770000), (0x2E8050F1), (0x1A214462), (0x04D6D583), (0x40031282), (0x6469A735), (0x0B4C99A3), (0x0AF88594), (0xF90969D7), (0x96131C92), (0x025EEA10), (0x3A1FE421), (0x614FF390), +(0x1CFDC327), (0xC177E04F), (0xF4D87E82), (0x78253F39), (0xBB839F94), (0x998B3EB1), (0x0CBCC021), (0x41BEC843), (0xAC0EE121), (0x52719643), (0x909A2B1D), (0xF38931E1), (0xF41327FF), (0xF6099847), (0xA70D219C), (0x7BD52135), (0x78060F71), (0xEA3C87D8), +(0x3FAF3A24), (0xE4B2C421), (0xB99D1453), (0x2741E264), (0x2239813A), (0x2944DA20), (0x441EF7C4), (0x0BD0B720), (0xED84EA26), (0x73E0C0D2), (0x678E3039), (0x21420109), (0x8607492E), (0x28CEF440), (0x022768C8), (0xF68E3611), (0x84E84D55), (0x73004C04), +(0xF9B6630E), (0x677FFA8F), (0x530CB18F), (0x2C4EE310), (0xABC7537C), (0x82CFDBCB), (0x100C63A2), (0x876D75BA), (0xC683F888), (0x0CDC1E1E), (0xA600E833), (0x33036066), (0x4305049C), (0x40890713), (0x9D12532E), (0x7B6E2FE2), (0xE244CC09), (0x9FFB2082), +(0xAB3735D3), (0x00000080), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +(0x00000000), (0x00000000), (0x00000000), (0x00000000) +}; + + +static const INT __twiddles_mips_fft32_256[] = +{ +(0x7FFFFFFF), (0x00000000), (0x7FF62181), (0xFCDBD540), (0x7FD8878C), (0xF9B82681), (0x7FA736B2), (0xF6956FB7), (0x7F62368D), (0xF3742C9D), (0x7F0991C3), (0xF054D8DA), (0x7E9D55FB), (0xED37EF91), (0x7E1D93EA), (0xEA1DEBC6), (0x7D8A5F3C), (0xE70747B9), +(0x7CE3CEB0), (0xE3F47D95), (0x7C29FBEF), (0xE0E6068F), (0x7B5D03A1), (0xDDDC5B4F), (0x7A7D0559), (0xDAD7F3A2), (0x798A23A8), (0xD7D946C3), (0x78848419), (0xD4E0CB28), (0x776C4ED9), (0xD1EEF59D), (0x7641AF32), (0xCF043A9E), (0x7504D34C), (0xCC210D8B), +(0x73B5EBCF), (0xC945DFEB), (0x72552C79), (0xC67322B9), (0x70E2CBCD), (0xC3A945A1), (0x6F5F02CF), (0xC0E8B67E), (0x6DCA0D27), (0xBE31E1BF), (0x6C242969), (0xBB8532C0), (0x6A6D98A1), (0xB8E31318), (0x68A69E72), (0xB64BEAB9), (0x66CF8103), (0xB3C01FE9), +(0x64E8894A), (0xB140178C), (0x62F201C4), (0xAECC338B), (0x60EC383A), (0xAC64D51F), (0x5ED77C86), (0xAA0A5B2C), (0x5CB420CD), (0xA7BD229A), (0x5A827978), (0xA57D8646), (0x5842DD7E), (0xA34BDF4B), (0x55F5A4ED), (0xA1288391), (0x539B2AFB), (0x9F13C7DC), +(0x5133CC8F), (0x9D0DFE52), (0x4EBFE88F), (0x9B1776CB), (0x4C3FDFCC), (0x99307EC5), (0x49B41562), (0x975961A2), (0x471CED05), (0x95926772), (0x447ACD5D), (0x93DBD6AA), (0x41CE1ECD), (0x9235F32C), (0x3F17499F), (0x90A0FD42), (0x3C56BAB5), (0x8F1D3461), +(0x398CDCF3), (0x8DAAD35D), (0x36BA2034), (0x8C4A1440), (0x33DEF21F), (0x8AFB2C8E), (0x30FBC547), (0x89BE50C2), (0x2E110ABF), (0x8893B14A), (0x2B1F34BC), (0x877B7BDD), (0x2826B95E), (0x8675DC62), (0x25280C05), (0x8582FA8C), (0x2223A4D2), (0x84A2FC68), +(0x1F19F9F0), (0x83D60431), (0x1C0B824E), (0x831C314A), (0x18F8B888), (0x8275A0D1), (0x15E213FD), (0x81E26C0B), (0x12C81090), (0x8162AA0A), (0x0FAB26B9), (0x80F66E30), (0x0C8BD356), (0x809DC971), (0x096A90AB), (0x8058C955), (0x0647D949), (0x80277871), +(0x03242AF6), (0x8009DE81), (0xFFFFFFA3), (0x80000002), (0xFCDBD54E), (0x8009DE7F), (0xF9B826FB), (0x8027786E), (0xF6956F99), (0x8058C950), (0xF3742CEE), (0x809DC96B), (0xF054D88D), (0x80F66E47), (0xED37EFB3), (0x8162AA00), (0xEA1DEB4A), (0x81E26C2C), +(0xE70747BB), (0x8275A0C3), (0xE3F47DF5), (0x831C313B), (0xE0E60653), (0x83D60420), (0xDDDC5B6F), (0x84A2FC55), (0xDAD7F348), (0x8582FAC2), (0xD7D946E3), (0x8675DC4D), (0xD4E0CB84), (0x877B7BC6), (0xD1EEF581), (0x8893B132), (0xCF043AF8), (0x89BE50A8), +(0xCC210D35), (0x8AFB2CDB), (0xC945E00A), (0x8C4A1423), (0xC6732265), (0x8DAAD3B2), (0xC3A94669), (0x8F1D33C8), (0xC0E8B69C), (0x90A0FD21), (0xBE31E16E), (0x9235F309), (0xBB853205), (0x93DBD70E), (0xB8E3139E), (0x95926705), (0xB64BEAD5), (0x9759617B), +(0xB3C01F9D), (0x99307F35), (0xB140180C), (0x9B177652), (0xAECC33A5), (0x9D0DFE27), (0xAC64D4D8), (0x9F13C803), (0xAA0A5A88), (0xA128840F), (0xA7BD2310), (0xA34BDEC3), (0xA57D865E), (0xA57D8670), (0xA34BDEB2), (0xA7BD2322), (0xA12883FE), (0xAA0A5A9B), +(0x9F13C7F2), (0xAC64D4EB), (0x9D0DFE16), (0xAECC33B9), (0x9B177642), (0xB1401820), (0x99307F26), (0xB3C01FB2), (0x9759616C), (0xB64BEAEA), (0x959266F7), (0xB8E313B4), (0x93DBD700), (0xBB85321A), (0x9235F2FC), (0xBE31E184), (0x90A0FD14), (0xC0E8B6B2), +(0x8F1D34AD), (0xC3A944BC), (0x8DAAD3A6), (0xC673227C), (0x8C4A1418), (0xC945E021), (0x8AFB2C68), (0xCC210E37), (0x89BE5100), (0xCF043A24), (0x8893B128), (0xD1EEF599), (0x877B7BBD), (0xD4E0CB9C), (0x8675DC95), (0xD7D94608), (0x8582FABB), (0xDAD7F360), +(0x84A2FC4F), (0xDDDC5B88), (0x83D603DC), (0xE0E60764), (0x831C316D), (0xE3F47D14), (0x8275A0BE), (0xE70747D4), (0x81E26BFB), (0xEA1DEC5F), (0x8162AA22), (0xED37EECF), (0x80F66E44), (0xF054D8A6), (0x809DC968), (0xF3742D08), (0x8058C93B), (0xF69570B2), +(0x80277879), (0xF9B82615), (0x8009DE7E), (0xFCDBD568), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0xF1FF7A00), (0xE23A8050), (0x841A2114), (0xC588DA75), (0x02400143), (0xAED6AAD7), (0x94C2545B), (0x3E46156C), (0x05BFDF27), (0xB0822075), +(0xD24C7BC4), (0x62122054), (0x8CC41C49), (0x2C414972), (0x718D7C5E), (0xDEE2A3D8), (0x4544C135), (0x64292573), (0x76B51F8A), (0x4B7D6557), (0x87164907), (0xF59DBFEC), (0x04CEE9DE), (0xB4BC4C90), (0x9AFCCD30), (0x8C7A316F), (0x90FDACA7), (0x4E0D6383), +(0xAEF16C0B), (0x0622020A), (0x37B6A738), (0xFFBB7D71), (0x5FEDD12F), (0xEE47FDC8), (0x3DC7913F), (0xEAEEF7FD), (0x219DADEC), (0xF9E53F5F), (0xB3D82D9E), (0xBBB79BCB), (0x43AD2AAB), (0x0E7ADBC0), (0xABBD0952), (0x1A6EF43A), (0xCD9B2A9D), (0x7222B366), +(0x979E89E9), (0x02C9113F), (0x1D511466), (0x57A92206), (0x4A412075), (0xFD31D783), (0xA7542EFC), (0x24B76975), (0xB99962C7), (0x19F1D356), (0x9D12C3CB), (0x6D37D542), (0x29E7214D), (0x8900F645), (0xB154AD4A), (0xF047D988), (0x3F2E5E77), (0xAFB68C49), +(0xC9F19E51), (0x6192F53A), (0x5AE3D080), (0x1DA6C677), (0xD485D50C), (0x9AA7E8B2), (0xF55EE1D5), (0xC00B6932), (0x85ACE912), (0x8208B1B9), (0x80E14170), (0xA1D67C3F), (0x058035B3), (0xA4FE36CA), (0xBEE547E4), (0xEF276052), (0x42AA4388), (0x9C11A2ED), +(0x10202541), (0x2D480910), (0xB09B1AC4), (0x19E7D17D), (0x52082450), (0x3EED1705), (0xF20FF8A1), (0x89F6E17F), (0x17D7DC00), (0x09B9F2C3), (0x6378968C), (0xAF0607F6), (0xFDFDE0C9), (0x3CE3DFEE), (0x5168229E), (0x7CF79734), (0xF5FFF56F), (0x30700093), +(0x135F5C75), (0xE6D73EEE), (0x6E400DF9), (0x58252ACB), (0x557311CA), (0x5539B303), (0x56557355), (0xB6BDACEF), (0x59F9428D), (0x9AE63020), (0x558FF7E7), (0x7955806D), (0x09D549F3), (0x603BF5B7), (0x3134413B), (0xBCA7C1AA), (0xA98D1339), (0x57B29C97), +(0x50F1FF07), (0xE4A13980), (0xD0881A21), (0xC1FFE30A), (0xB0A66C19), (0x18416490), (0x160E0214), (0xA584CBB5), (0x02AAA82A), (0x73981340), (0x964A24DE), (0x6E829FC4), (0xDFD62360), (0x4C3BF152), (0x38721574), (0xD46BC912), (0x1EB7FDD8), (0x1CA6CBC0), +(0xBBCBC111), (0xA6FD1403), (0x76C688D9), (0xB47186CB), (0x5E98936D), (0x9BBF7E2E), (0x8B7FBCEC), (0x9DAF7EF5), (0x7E3A79F1), (0x9C896ACD), (0x628F249A), (0xDD6E51AF), (0xAF73994B), (0x5966995D), (0xB7620597), (0x369B1E54), (0x7CEDC787), (0xE7B15B1F), +(0xB36F5F7D), (0xB5B73EF6), (0xD76EEEE2), (0x14E86186), (0xCC159291), (0x4EC85CA3), (0xEC3C704E), (0x0B6633B3), (0x4D992D4B), (0xEB1B5774), (0xDFB9D508), (0x11783719), (0x77BB10B0), (0xFCDF8350), (0xD34A7C65), (0xEF6E57BB), (0xECD56C68), (0x8EB7CA36), +(0x2F26B136), (0x55631269), (0xEF1213E1), (0xA56AB844), (0xAA4B1D64), (0x64341EA9), (0x0CE9DB48), (0x460C2144), (0xADC50205), (0x515C472F), (0x304C29BD), (0x76AF8711), (0x557CADB7), (0x2A9BBC8E), (0xE50E145B), (0x9C2031FD), (0xD9121A8C), (0xF51A96FD), +(0x45CCBEBF), (0x5F884871), (0x66DAE291), (0x95ADC9E5), (0x33CF304D), (0x23C87DCE), (0xA7014FB3), (0xFB351E71), (0x8D60F66F), (0xBFD6DDD5), (0x151FE6F1), (0xDCC7935A), (0x0CACFBF0), (0xEE55A371), (0xBE46B755), (0x0F79DCD2), (0x23DFF76D), (0x83DE76D7), +(0x8B0E3AEE), (0xB01BFB44), (0x4E3619FA), (0xA19F9E64), (0xBD492AD9), (0x0899E45F), (0x8156E41D), (0x5DA539BA), (0x0AF35B2C), (0xDB89BAAE), (0xA128C966), (0xA02CEAEE), (0xC5A1B291), (0x08CBA93E), (0x90FD887A), (0x60304386), (0x6A59F1EA), (0xA461E67B), +(0xC1622B76), (0x6FA2F906), (0xAA3A401A), (0xB68EA47B), (0xC617A889), (0x6024A57B), (0x2DD53555), (0xF1FFEA30), (0x813A8050), (0x8D1A21B4), (0xFFE72CF7), (0xA37415E1), (0x30A2C830), (0xA3A1CA28), (0x4C5E3586), (0x309861B9), (0x1F49850D), (0x6164C748), +(0x9D7048E5), (0xC124569E), (0xCCB0E111), (0x15B2BB86), (0x18371D9C), (0xB2ABD94D), (0x8EC656B3), (0xBF010995) +}; + + + +static const INT __twiddles_mips_fft32_512[] = +{ +(0x7FFFFFFF), (0x00000000), (0x7FFD8859), (0xFE6DE2E0), (0x7FF62181), (0xFCDBD540), (0x7FE9CBBE), (0xFB49E6A3), (0x7FD8878C), (0xF9B82681), (0x7FC25595), (0xF826A464), (0x7FA736B2), (0xF6956FB7), (0x7F872BF2), (0xF5049800), (0x7F62368D), (0xF3742C9D), +(0x7F3857F4), (0xF1E43D1C), (0x7F0991C3), (0xF054D8DA), (0x7ED5E5C6), (0xEEC60F3C), (0x7E9D55FB), (0xED37EF91), (0x7E5FE490), (0xEBAA8944), (0x7E1D93EA), (0xEA1DEBC6), (0x7DD6668D), (0xE8922621), (0x7D8A5F3C), (0xE70747B9), (0x7D3980ED), (0xE57D5FE4), +(0x7CE3CEB0), (0xE3F47D95), (0x7C894BDA), (0xE26CB010), (0x7C29FBEF), (0xE0E6068F), (0x7BC5E296), (0xDF609002), (0x7B5D03A1), (0xDDDC5B4F), (0x7AEF6325), (0xDC59778B), (0x7A7D0559), (0xDAD7F3A2), (0x7A05EEA8), (0xD957DE6F), (0x798A23A8), (0xD7D946C3), +(0x7909A935), (0xD65C3B98), (0x78848419), (0xD4E0CB28), (0x77FAB98A), (0xD367044F), (0x776C4ED9), (0xD1EEF59D), (0x76D94983), (0xD078AD93), (0x7641AF32), (0xCF043A9E), (0x75A585D9), (0xCD91AB55), (0x7504D34C), (0xCC210D8B), (0x745F9DD3), (0xCAB26FB2), +(0x73B5EBCF), (0xC945DFEB), (0x7307C3C9), (0xC7DB6C45), (0x72552C79), (0xC67322B9), (0x719E2CDE), (0xC50D1164), (0x70E2CBCD), (0xC3A945A1), (0x7023109C), (0xC247CD62), (0x6F5F02CF), (0xC0E8B67E), (0x6E96A995), (0xBF8C0DD8), (0x6DCA0D27), (0xBE31E1BF), +(0x6CF934E8), (0xBCDA3EAE), (0x6C242969), (0xBB8532C0), (0x6B4AF258), (0xBA32CA42), (0x6A6D98A1), (0xB8E31318), (0x698C2487), (0xB79619C6), (0x68A69E72), (0xB64BEAB9), (0x67BD0FCC), (0xB5049380), (0x66CF8103), (0xB3C01FE9), (0x65DDFBD6), (0xB27E9D43), +(0x64E8894A), (0xB140178C), (0x63EF3286), (0xB0049AA9), (0x62F201C4), (0xAECC338B), (0x61F10027), (0xAD96ED77), (0x60EC383A), (0xAC64D51F), (0x5FE3B366), (0xAB35F58C), (0x5ED77C86), (0xAA0A5B2C), (0x5DC79D9C), (0xA8E2112C), (0x5CB420CD), (0xA7BD229A), +(0x5B9D1166), (0xA69B9B7D), (0x5A827978), (0xA57D8646), (0x5964649B), (0xA462EEB2), (0x5842DD7E), (0xA34BDF4B), (0x571DEEED), (0xA238627B), (0x55F5A4ED), (0xA1288391), (0x54CA0A2E), (0xA01C4C5C), (0x539B2AFB), (0x9F13C7DC), (0x52691241), (0x9E0EFF9D), +(0x5133CC8F), (0x9D0DFE52), (0x4FFB6572), (0x9C10CD90), (0x4EBFE88F), (0x9B1776CB), (0x4D8162D8), (0x9A22043F), (0x4C3FDFCC), (0x99307EC5), (0x4AFB6C9B), (0x9842F048), (0x49B41562), (0x975961A2), (0x4869E657), (0x9673DB8C), (0x471CED05), (0x95926772), +(0x45CD356F), (0x94B50D74), (0x447ACD5D), (0x93DBD6AA), (0x4325C102), (0x9306CAE7), (0x41CE1ECD), (0x9235F32C), (0x4073F245), (0x9169567D), (0x3F17499F), (0x90A0FD42), (0x3DB8324C), (0x8FDCEF37), (0x3C56BAB5), (0x8F1D3461), (0x3AF2EEBA), (0x8E61D331), +(0x398CDCF3), (0x8DAAD35D), (0x38249413), (0x8CF83C62), (0x36BA2034), (0x8C4A1440), (0x354D9033), (0x8BA06221), (0x33DEF21F), (0x8AFB2C8E), (0x326E5505), (0x8A5A7A4D), (0x30FBC547), (0x89BE50C2), (0x2F875216), (0x8926B65A), (0x2E110ABF), (0x8893B14A), +(0x2C98FBD1), (0x88054682), (0x2B1F34BC), (0x877B7BDD), (0x29A3C40F), (0x86F656AC), (0x2826B95E), (0x8675DC62), (0x26A82174), (0x85FA114F), (0x25280C05), (0x8582FA8C), (0x23A688D3), (0x85109CF7), (0x2223A4D2), (0x84A2FC68), (0x209F6FE1), (0x843A1D62), +(0x1F19F9F0), (0x83D60431), (0x1D935011), (0x8376B42E), (0x1C0B824E), (0x831C314A), (0x1A829FC0), (0x82C67F00), (0x18F8B888), (0x8275A0D1), (0x176DD9E1), (0x82299974), (0x15E213FD), (0x81E26C0B), (0x1455771D), (0x81A01B80), (0x12C81090), (0x8162AA0A), +(0x1139F0A7), (0x812A1A36), (0x0FAB26B9), (0x80F66E30), (0x0E1BC326), (0x80C7A813), (0x0C8BD356), (0x809DC971), (0x0AFB67B2), (0x8078D407), (0x096A90AB), (0x8058C955), (0x07D95BB6), (0x803DAA6D), (0x0647D949), (0x80277871), (0x04B618DF), (0x8016343D), +(0x03242AF6), (0x8009DE81), (0x01921D0C), (0x800277A7), (0xFFFFFFA3), (0x80000002), (0xFE6DE338), (0x800277A6), (0xFCDBD54E), (0x8009DE7F), (0xFB49E665), (0x80163444), (0xF9B826FB), (0x8027786E), (0xF826A48E), (0x803DAA69), (0xF6956F99), (0x8058C950), +(0xF5049793), (0x8078D418), (0xF3742CEE), (0x809DC96B), (0xF1E43D1E), (0x80C7A80C), (0xF054D88D), (0x80F66E47), (0xEEC60F9D), (0x812A1A2D), (0xED37EFB3), (0x8162AA00), (0xEBAA8927), (0x81A01B75), (0xEA1DEB4A), (0x81E26C2C), (0xE8922662), (0x82299967), +(0xE70747BB), (0x8275A0C3), (0xE57D5F89), (0x82C67F27), (0xE3F47DF5), (0x831C313B), (0xE26CB031), (0x8376B41E), (0xE0E60653), (0x83D60420), (0xDF608F69), (0x843A1D92), (0xDDDC5B6F), (0x84A2FC55), (0xDC59776E), (0x85109CE4), (0xDAD7F348), (0x8582FAC2), +(0xD957DECD), (0x85FA113A), (0xD7D946E3), (0x8675DC4D), (0xD65C3B40), (0x86F656E9), (0xD4E0CB84), (0x877B7BC6), (0xD367046F), (0x8805466A), (0xD1EEF581), (0x8893B132), (0xD078AD3C), (0x8926B6A0), (0xCF043AF8), (0x89BE50A8), (0xCD91AB39), (0x8A5A7A32), +(0xCC210D35), (0x8AFB2CDB), (0xCAB2700B), (0x8BA06204), (0xC945E00A), (0x8C4A1423), (0xC7DB6C2A), (0x8CF83C44), (0xC6732265), (0x8DAAD3B2), (0xC50D109F), (0x8E61D388), (0xC3A94669), (0x8F1D33C8), (0xC247CDF0), (0x8FDCEF16), (0xC0E8B69C), (0x90A0FD21), +(0xBF8C0DF6), (0x9169565A), (0xBE31E16E), (0x9235F309), (0xBCDA3E5E), (0x9306CB49), (0xBB853205), (0x93DBD70E), (0xBA32CB35), (0x94B50D09), (0xB8E3139E), (0x95926705), (0xB79619E2), (0x9673DB66), (0xB64BEAD5), (0x9759617B), (0xB5049334), (0x9842F06B), +(0xB3C01F9D), (0x99307F35), (0xB27E9C92), (0x9A2204B0), (0xB140180C), (0x9B177652), (0xB0049B27), (0x9C10CD15), (0xAECC33A5), (0x9D0DFE27), (0xAD96ED91), (0x9E0EFFC3), (0xAC64D4D8), (0x9F13C803), (0xAB35F545), (0xA01C4CD8), (0xAA0A5A88), (0xA128840F), +(0xA8E211A2), (0xA23861F5), (0xA7BD2310), (0xA34BDEC3), (0xA69B9B96), (0xA462EE82), (0xA57D865E), (0xA57D8670), (0xA462EE70), (0xA69B9BA8), (0xA34BDEB2), (0xA7BD2322), (0xA23861E4), (0xA8E211B5), (0xA12883FE), (0xAA0A5A9B), (0xA01C4CC7), (0xAB35F559), +(0x9F13C7F2), (0xAC64D4EB), (0x9E0EFFB3), (0xAD96EDA5), (0x9D0DFE16), (0xAECC33B9), (0x9C10CD05), (0xB0049B3B), (0x9B177642), (0xB1401820), (0x9A2204A1), (0xB27E9CA6), (0x99307F26), (0xB3C01FB2), (0x9842F05C), (0xB5049349), (0x9759616C), (0xB64BEAEA), +(0x9673DB57), (0xB79619F7), (0x959266F7), (0xB8E313B4), (0x94B50E13), (0xBA32C99E), (0x93DBD700), (0xBB85321A), (0x9306CB3C), (0xBCDA3E74), (0x9235F2FC), (0xBE31E184), (0x9169564D), (0xBF8C0E0C), (0x90A0FD14), (0xC0E8B6B2), (0x8FDCEF09), (0xC247CE07), +(0x8F1D34AD), (0xC3A944BC), (0x8E61D37C), (0xC50D10B6), (0x8DAAD3A6), (0xC673227C), (0x8CF83C39), (0xC7DB6C41), (0x8C4A1418), (0xC945E021), (0x8BA061F9), (0xCAB27022), (0x8AFB2C68), (0xCC210E37), (0x8A5A7A8D), (0xCD91AA66), (0x89BE5100), (0xCF043A24), +(0x8926B697), (0xD078AD53), (0x8893B128), (0xD1EEF599), (0x88054661), (0xD3670487), (0x877B7BBD), (0xD4E0CB9C), (0x86F6568E), (0xD65C3C4A), (0x8675DC95), (0xD7D94608), (0x85FA1180), (0xD957DDF1), (0x8582FABB), (0xDAD7F360), (0x85109CDD), (0xDC597787), +(0x84A2FC4F), (0xDDDC5B88), (0x843A1D4B), (0xDF60907A), (0x83D603DC), (0xE0E60764), (0x8376B454), (0xE26CAF51), (0x831C316D), (0xE3F47D14), (0x82C67F21), (0xE57D5FA2), (0x8275A0BE), (0xE70747D4), (0x82299962), (0xE892267C), (0x81E26BFB), (0xEA1DEC5F), +(0x81A01B48), (0xEBAA8A3D), (0x8162AA22), (0xED37EECF), (0x812A1A4C), (0xEEC60EB9), (0x80F66E44), (0xF054D8A6), (0x80C7A809), (0xF1E43D38), (0x809DC968), (0xF3742D08), (0x8078D3FF), (0xF50498AB), (0x8058C93B), (0xF69570B2), (0x803DAA77), (0xF826A3A8), +(0x80277879), (0xF9B82615), (0x80163443), (0xFB49E67F), (0x8009DE7E), (0xFCDBD568), (0x800277A6), (0xFE6DE352), (0x465220BB), (0xC66E1FFC), (0x2C61D356), (0xAFFB176D), (0x88067E23), (0x3796F008), (0xC8D128F3), (0xB661A5FA), (0xF19CE4F0), (0x3F7D0345), +(0xE97E6030), (0x4ABA91CF), (0xDEEDAB0C), (0x35FD1D77), (0xDD636439), (0x2F8B794C), (0x764E1D32), (0x7A8D0B1B), (0x8EACB27F), (0x577AD67B), (0x2B3FE2C5), (0x8ACD024A), (0xEDF5C42C), (0xF1CA951C), (0xB98B6D04), (0x6D12B864), (0x50E74D08), (0x73D1503B), +(0xC7D3F6A9), (0x1F365E97), (0xE1340E59), (0x89D21B9D), (0x9B756733), (0x9024CD50), (0xE2C7FF52), (0xD9F061EF), (0x77151392), (0xA0E4A004), (0x60BE820F), (0xC7603BAF), (0xA62E3DA9), (0xA400E11F), (0x155111D4), (0x9030A374), (0x14185124), (0x8D043A00), +(0x50945258), (0x20A6653E), (0xA19BA8B9), (0x3CFBE692), (0x91471D98), (0x0B9D03FF), (0xA5BA8E29), (0xFFC8EB22), (0x142CB1B0), (0x55317319), (0x33ADC77C), (0xF69BADCE), (0x78423D3C), (0xBE67BBF0), (0x7D88BD15), (0x1E9EF673), (0x512098B3), (0x326A3D3D), +(0x161EF3B6), (0x0E4C4ED5), (0x4E9F9982), (0xD0AB6A36), (0xF17DD377), (0x5E53F31C), (0xBE9112EA), (0x3DE1B0FF), (0xD7F39AE7), (0xA34B9635), (0x49CFEE6C), (0x8A063AC6), (0xBA79BC0D), (0x6A588782), (0x439BE593), (0x0A5F7E8D), (0xD2FC2561), (0x4698AC8F), +(0x247C3BC2), (0x5826523D), (0x4D2BD753), (0x4B8BCC17), (0x9B743503), (0x9F84E434), (0x8B97B41A), (0x3CFCE75F), (0x32D2D487), (0x3E80B4AF), (0x42F8B0EA), (0xEC0C81EE), (0x17279309), (0x681FA0F3), (0x8BAD208E), (0xD11792C6), (0xF1FF07B3), (0x21338050), +(0x8A1A21A4), (0xFF0358D8), (0x416C13C1), (0x46348858), (0x83820519), (0xABC08822), (0x6A1A5200), (0x0C83122A), (0xA67FDF06), (0x0629F970), (0xEFAA2743), (0x0C00AD95), (0xFF09F5CF), (0xC784DB8B), (0xCB00BA7D), (0x6220909F), (0x7149B7DF), (0x5BD3EBEC), +(0x0485EF71), (0x07FE23B1), (0x80737668), (0x42A32645), (0xD6EDBB18), (0x407E72C5), (0x901402E0), (0x0C1B7905), (0x01CE11FC), (0x00C64914), (0x3037978A), (0xFABC9190), (0x43A0AC89), (0xB9998370), (0xD6D69209), (0xF132455E), (0x9DAFF482), (0xA2D635C2), +(0xBD976B5E), (0x79ED93ED), (0x7D42CA22), (0x2E23F9C1), (0xCF0E7521), (0x96D88AC1), (0x420C2845), (0x1E19573D), (0xF8FE9279), (0xC1495100), (0x201249C2), (0x8B183723), (0x450615A5), (0x004C0112), (0x85EB5235), (0x1BD8BD48), (0xA2914F03), (0x51420EAC), +(0xCE788470), (0x0508030B), (0xA4CD2A6C), (0x9626C062), (0xF88D2DE5), (0xA9D6B399), (0xB3C57BFD), (0xCB1E9C4C), (0x004A5094), (0xD0CBC42A), (0x3BE1A694), (0x3C353FA7), (0xA5697C57), (0xFE961665), (0xED6B7C7D), (0x433DCF8D), (0xDA7D6C24), (0x407112C1), +(0x4B9D285D), (0x6C9A2F57), (0x1BF9FAEF), (0x4EE3E2E9), (0xE5AE7E92), (0x60A11D3F), (0x4B441B63), (0xC8419BB1), (0x2C4F6DDD), (0xCEC3CF6D), (0x325A65CA), (0x818FC6A4), (0xC55E5E5B), (0x277445A3), (0x6B3289F7), (0x09147D55), (0x4F378D53), (0x588B0DC8), +(0xF70BA347), (0xCBC43FAE), (0xD98E6639), (0x07AF9ED0), (0xE2E6305A), (0x5E003571), (0x18523E7A), (0xF70D1E27), (0xD7288950), (0x12C11132), (0xFF1C9D17), (0x318050F1), (0x1A219821), (0xBF21998A), (0x6C13C1FF), (0x8C605861), (0x0A183954), (0x7BE4C1B6), +(0xA2CBC410), (0x7CC00A55), (0x5E58A973), (0x1122EF86), (0x80568E39), (0x2310C300), (0x0E152D0E), (0x9E017C1C), (0x851DFC26), (0xD1B1E662), (0x81BA10B0), (0x96C2E977), (0x8688E419), (0x97C94989), (0x250D535E), (0x35FDE732), (0x147AD183), (0xCF9D75C0), +(0x6B2C183C), (0x1D326489), (0xC0807D98), (0xC081622E), (0x15C87B87), (0x7404598C), (0xFC3C7FA6), (0x28BA8CF5), (0xE311EA9B), (0xEABFD4A5), (0x8768834A), (0x0F7D7440), (0x40593152), (0xCF1E8BF5), (0xE32017B6), (0x39E66070), (0x560ECE9D), (0xF4132C77), +(0x722945C1), (0x96ECB5D5), (0x0C100C06), (0x30E96C02), (0xE0B0159B), (0x163A40CB), (0x1B28B750), (0x11420E11), (0x34DC5981), (0xD2769C3C), (0x569402D0), (0xE4F157C0), (0x120DF24C), (0x40D86153), (0x1942CD11), (0x22484C3B), (0x8B299144), (0x58F1AAF8), +(0xB2CD4777), (0x4A53AB02), (0x55A5DAD4), (0xC8D58D79), (0x6CAEC011), (0x1C955C84), (0xDE08A6C6), (0xD402AF7D), (0x695E6FA4), (0x4DA863B9), (0x5118070C), (0x5A97EF1C), (0x8880B388), (0x4D596B2D), (0x37D74DCF), (0x58138B38), (0x5B7BCD4E), (0xAE6C4422), +(0x4E5D1AF1), (0xDE7396A5), (0xB442F217), (0x0DF7A006), (0x96EEF8A2), (0xE2847B26), (0x68B9F67B), (0x8FE1FA65), (0xE0A87E56), (0x1BE8FC4C), (0xBBD65F9D), (0xE6F02C9D), (0x867C6EEC), (0x43FAB725), (0xA4144419), (0x69BB6AAF), (0xCE27B744), (0x022241A9), +(0xC05DF14E), (0x8050F1FF), (0x218C2131), (0xBE25941A), (0x9041CD06), (0x1EE8A9C0), (0xD530FEDD), (0x7495C808), (0x050918A6), (0x3CE732E9), (0xF87262FC), (0x01B812F1), (0x1FBA4842), (0x3E86C7F2), (0x270DB358), (0xF9D22834), (0x74D4F469), (0x9A6E87D2), +(0x8CBB0A50), (0xC0784B92), (0x278DA581), (0x9221A7D5), (0xDE801B54), (0x4B531FDA), (0xC8B91F91), (0x7A90DA40), (0x2967A429), (0x50CC1D8D), (0x9AE9110E), (0x50F250EE), (0xD695B072), (0xFC7A5718), (0x1F1A26E6), (0x7D5ADD4D), (0xC8978597), (0xEB326DC3), +(0x384E9824), (0xC3B9D78C), (0xD8D2E214), (0xEFFBB048), (0x00AB7714), (0x9D89CA13), (0xF70688D0), (0xADDA3A37), (0x5FBE5943), (0x4ED9D613), (0x8A9DCC93), (0x19814236), (0x09A68BCC), (0xCEAC33AC), (0x0BA70BB3), (0x326272E1), (0x2A8C6D20), (0x23083D0B), +(0xFA809C02), (0x5825C6C2), (0x061B4695), (0x8DB97748), (0x5071E584), (0x08760959), (0x44EA8D04), (0x5CE6E2AA), (0x009AD176), (0xAEC64F19), (0xCADDA632), (0x8D795445), (0x16E3EA24), (0xF12648CA), (0xD5CC350C), (0x615EBAD7), (0x4E769FB6), (0x6C5EB380), +(0x5BB46425), (0xEAB6C77C), (0x10945408), (0xC1291B86), (0x913B71A5), (0x003BA329), (0x91812854), (0xE200CB12), (0x7A4696A8), (0x76E55D25), (0xD6D3C577), (0x8B1B79B1), (0x296B04CD), (0xA024CC35), (0x3341A477), (0x8EC12358), (0xF5982B2F), (0x36F120C9), +(0x79DBE799), (0xED74F092), (0xA1031AE3), (0xB2D98C6B), (0x358CAB73), (0x41153C19), (0x474D4548), (0xA7E834A9), (0x999738AE), (0x50F1FFE8), (0x88612F80), (0xFD931A21), (0x23839ABD), (0xBE604701), (0x812274B9), (0x4CA9EA32), (0xE5F2D207), (0xC1CF4653), +(0x43561B23), (0x53B2E277), (0x4F2B00EC), (0xF2B3BA80), (0xFC708CC5), (0xE7F63F00), (0x26120342), (0x1A49C7A8), (0xA9350A7C), (0xE530A06C), (0x5CB9E550), (0xB1672913), (0x65FA76F9), (0xC9F92DCA), (0x7D4E9195), (0x4DBB8265), (0x2036E26C), (0xEDC026E6), +(0xB9A617E0), (0x6469F0EE), (0xE9DAABB2), (0x26063210), (0xAC545DF4), (0x134E035A), (0x216EDE10), (0xEC81158D), (0x122A2CAE), (0xA263D0E1), (0x6CA1FB28), (0xBE287DF0), (0x548104E8), (0x35987D93), (0xBC3E549C), (0x3ACEFD64), (0x3348CD92), (0x914472FD), +(0x80F28098), (0xDF3FABCD), (0x24D840AC), (0xBA95321C), (0xDC211D20), (0x15041942), (0x61858ABD), (0x546084A1), (0xCEDC07F4), (0xEAB2DE00), (0x045BC1E8), (0x82B2AE86), (0xE4BF2823), (0x9A01B47A), (0x1769438E), (0x015C7986), (0x5FDFF97D), (0x5F28D62C), +(0x83C84C8C), (0xDBAC601A), (0x1AE2844F), (0x79F9DC1C), (0x01C3AB5C), (0xC971D839), (0x44DEA398), (0xC0A64EA1), (0x387E24A5), (0x0600D59F), (0x5169B371), (0xEC782B6B), (0xF7FF769D), (0x317B0AE8), (0xE33846C7), (0x2FE05849), (0x03273853), (0x2ED27A88), +(0x24DF4343), (0xFB03C70F), (0x82783231), (0xD31C0D29), (0xADC5BD8B), (0x7D024F1B), (0x91C18D19), (0xA8EE58E2), (0x4C23A59F), (0xC61DCA9F), (0x03BC91EC), (0x51986147), (0x05B8BE24), (0x872AC918), (0x8050F1FF), (0x2184812F), (0xB20D941A), (0x9141CB0C), +(0xF600A340), (0x80E82AC2), (0x66028631), (0x120FFA45), (0x889F24CB), (0x81F0BB27), (0x3100D51A), (0x2309A0B3), (0xAE004718), (0xAA584A8D), (0x9432DD2E), (0xDD0E93FA), (0xC12993A6), (0x6E28035D), (0x9BF7772B), (0x1D608C32) +}; + + +static const INT __twiddles_mips_fft32_1024[] = +{ +(0x7FFFFFFF), (0x00000000), (0x7FFF6215), (0xFF36F078), (0x7FFD8859), (0xFE6DE2E0), (0x7FFA72D0), (0xFDA4D929), (0x7FF62181), (0xFCDBD540), (0x7FF09476), (0xFC12D91B), (0x7FE9CBBE), (0xFB49E6A3), (0x7FE1C76A), (0xFA80FFCE), (0x7FD8878C), (0xF9B82681), +(0x7FCE0C3D), (0xF8EF5CBC), (0x7FC25595), (0xF826A464), (0x7FB563B2), (0xF75DFF6B), (0x7FA736B2), (0xF6956FB7), (0x7F97CEBB), (0xF5CCF73E), (0x7F872BF2), (0xF5049800), (0x7F754E7E), (0xF43C53CB), (0x7F62368D), (0xF3742C9D), (0x7F4DE450), (0xF2AC2473), +(0x7F3857F4), (0xF1E43D1C), (0x7F2191B2), (0xF11C7895), (0x7F0991C3), (0xF054D8DA), (0x7EF05860), (0xEF8D5FC8), (0x7ED5E5C6), (0xEEC60F3C), (0x7EBA3A38), (0xEDFEE930), (0x7E9D55FB), (0xED37EF91), (0x7E7F3954), (0xEC71244A), (0x7E5FE490), (0xEBAA8944), +(0x7E3F5800), (0xEAE4208A), (0x7E1D93EA), (0xEA1DEBC6), (0x7DFA98A7), (0xE957ED00), (0x7DD6668D), (0xE8922621), (0x7DB0FDF5), (0xE7CC9912), (0x7D8A5F3C), (0xE70747B9), (0x7D628AC7), (0xE642341C), (0x7D3980ED), (0xE57D5FE4), (0x7D0F4217), (0xE4B8CD16), +(0x7CE3CEB0), (0xE3F47D95), (0x7CB72721), (0xE3307347), (0x7C894BDA), (0xE26CB010), (0x7C5A3D52), (0xE1A935F1), (0x7C29FBEF), (0xE0E6068F), (0x7BF88830), (0xE02323EA), (0x7BC5E296), (0xDF609002), (0x7B920B86), (0xDE9E4C5B), (0x7B5D03A1), (0xDDDC5B4F), +(0x7B26CB49), (0xDD1ABE41), (0x7AEF6325), (0xDC59778B), (0x7AB6CB9A), (0xDB98888E), (0x7A7D0559), (0xDAD7F3A2), (0x7A4210DE), (0xDA17BA63), (0x7A05EEA8), (0xD957DE6F), (0x79C89F71), (0xD898621A), (0x798A23A8), (0xD7D946C3), (0x794A7C11), (0xD71A8EBA), +(0x7909A935), (0xD65C3B98), (0x78C7AB9E), (0xD59E4EF9), (0x78848419), (0xD4E0CB28), (0x78403321), (0xD423B181), (0x77FAB98A), (0xD367044F), (0x77B417D4), (0xD2AAC4EB), (0x776C4ED9), (0xD1EEF59D), (0x77235F35), (0xD13397FA), (0x76D94983), (0xD078AD93), +(0x768E0EA9), (0xCFBE38AD), (0x7641AF32), (0xCF043A9E), (0x75F42C0B), (0xCE4AB5A6), (0x75A585D9), (0xCD91AB55), (0x7555BD47), (0xCCD91D37), (0x7504D34C), (0xCC210D8B), (0x74B2C87B), (0xCB697DA0), (0x745F9DD3), (0xCAB26FB2), (0x740B53ED), (0xC9FBE50E), +(0x73B5EBCF), (0xC945DFEB), (0x735F662F), (0xC89061D1), (0x7307C3C9), (0xC7DB6C45), (0x72AF05AB), (0xC727017A), (0x72552C79), (0xC67322B9), (0x71FA3948), (0xC5BFD232), (0x719E2CDE), (0xC50D1164), (0x71410800), (0xC45AE1D1), (0x70E2CBCD), (0xC3A945A1), +(0x708378F4), (0xC2F83E1B), (0x7023109C), (0xC247CD62), (0x6FC19376), (0xC197F4BB), (0x6F5F02CF), (0xC0E8B67E), (0x6EFB5F1D), (0xC03A137E), (0x6E96A995), (0xBF8C0DD8), (0x6E30E32F), (0xBEDEA73A), (0x6DCA0D27), (0xBE31E1BF), (0x6D6227FA), (0xBD85BE33), +(0x6CF934E8), (0xBCDA3EAE), (0x6C8F3538), (0xBC2F6544), (0x6C242969), (0xBB8532C0), (0x6BB812C5), (0xBADBA934), (0x6B4AF258), (0xBA32CA42), (0x6ADCC976), (0xB98A97F6), (0x6A6D98A1), (0xB8E31318), (0x69FD6132), (0xB83C3DB1), (0x698C2487), (0xB79619C6), +(0x6919E326), (0xB6F0A81D), (0x68A69E72), (0xB64BEAB9), (0x68325786), (0xB5A7E331), (0x67BD0FCC), (0xB5049380), (0x6746C7D1), (0xB461FC6A), (0x66CF8103), (0xB3C01FE9), (0x66573CD5), (0xB31EFFF0), (0x65DDFBD6), (0xB27E9D43), (0x6563BF7E), (0xB1DEF9D2), +(0x64E8894A), (0xB140178C), (0x646C59CC), (0xB0A1F730), (0x63EF3286), (0xB0049AA9), (0x637114AB), (0xAF68037B), (0x62F201C4), (0xAECC338B), (0x6271FA69), (0xAE312B94), (0x61F10027), (0xAD96ED77), (0x616F148E), (0xACFD7B13), (0x60EC383A), (0xAC64D51F), +(0x60686CC0), (0xABCCFD75), (0x5FE3B366), (0xAB35F58C), (0x5F5E0DC8), (0xAA9FBF38), (0x5ED77C86), (0xAA0A5B2C), (0x5E500140), (0xA975CB39), (0x5DC79D9C), (0xA8E2112C), (0x5D3E523E), (0xA84F2DB4), (0x5CB420CD), (0xA7BD229A), (0x5C290AA0), (0xA72BF148), +(0x5B9D1166), (0xA69B9B7D), (0x5B1035C7), (0xA60C21E8), (0x5A827978), (0xA57D8646), (0x59F3DE30), (0xA4EFCA51), (0x5964649B), (0xA462EEB2), (0x58D40E75), (0xA3D6F51F), (0x5842DD7E), (0xA34BDF4B), (0x57B0D265), (0xA2C1ADDA), (0x571DEEED), (0xA238627B), +(0x568A3482), (0xA1AFFE81), (0x55F5A4ED), (0xA1288391), (0x556040E2), (0xA0A1F24F), (0x54CA0A2E), (0xA01C4C5C), (0x543302A5), (0x9F979356), (0x539B2AFB), (0x9F13C7DC), (0x53028507), (0x9E90EB88), (0x52691241), (0x9E0EFF9D), (0x51CED486), (0x9D8E05AD), +(0x5133CC8F), (0x9D0DFE52), (0x5097FC3C), (0x9C8EEB1A), (0x4FFB6572), (0x9C10CD90), (0x4F5E08EB), (0x9B93A649), (0x4EBFE88F), (0x9B1776CB), (0x4E2105E4), (0x9A9C4048), (0x4D8162D8), (0x9A22043F), (0x4CE1002B), (0x99A8C340), (0x4C3FDFCC), (0x99307EC5), +(0x4B9E03B1), (0x98B93843), (0x4AFB6C9B), (0x9842F048), (0x4A581C83), (0x97CDA844), (0x49B41562), (0x975961A2), (0x490F57FF), (0x96E61CED), (0x4869E657), (0x9673DB8C), (0x47C3C202), (0x96029E99), (0x471CED05), (0x95926772), (0x46756827), (0x9523369D), +(0x45CD356F), (0x94B50D74), (0x452456E9), (0x9447ED4D), (0x447ACD5D), (0x93DBD6AA), (0x43D09AD9), (0x9370CADA), (0x4325C102), (0x9306CAE7), (0x427A417D), (0x929DD7D5), (0x41CE1ECD), (0x9235F32C), (0x412158E3), (0x91CF1CE3), (0x4073F245), (0x9169567D), +(0x3FC5ECA0), (0x9104A0F4), (0x3F17499F), (0x90A0FD42), (0x3E680AF3), (0x903E6C5D), (0x3DB8324C), (0x8FDCEF37), (0x3D07C23C), (0x8F7C873A), (0x3C56BAB5), (0x8F1D3461), (0x3BA51E4D), (0x8EBEF810), (0x3AF2EEBA), (0x8E61D331), (0x3A402DB4), (0x8E05C6AA), +(0x398CDCF3), (0x8DAAD35D), (0x38D8FE32), (0x8D50FA2B), (0x38249413), (0x8CF83C62), (0x376F9E88), (0x8CA099FB), (0x36BA2034), (0x8C4A1440), (0x36041AD7), (0x8BF4AC06), (0x354D9033), (0x8BA06221), (0x3496820A), (0x8B4D375F), (0x33DEF21F), (0x8AFB2C8E), +(0x3326E323), (0x8AAA42E0), (0x326E5505), (0x8A5A7A4D), (0x31B54A79), (0x8A0BD403), (0x30FBC547), (0x89BE50C2), (0x3041C737), (0x8971F14B), (0x2F875216), (0x8926B65A), (0x2ECC67AF), (0x88DCA0A9), (0x2E110ABF), (0x8893B14A), (0x2D553B35), (0x884BE838), +(0x2C98FBD1), (0x88054682), (0x2BDC4E63), (0x87BFCCD5), (0x2B1F34BC), (0x877B7BDD), (0x2A61B0AF), (0x87385443), (0x29A3C40F), (0x86F656AC), (0x28E571A3), (0x86B5840E), (0x2826B95E), (0x8675DC62), (0x27679E06), (0x8637609A), (0x26A82174), (0x85FA114F), +(0x25E84581), (0x85BDEF19), (0x25280C05), (0x8582FA8C), (0x246777D0), (0x85493482), (0x23A688D3), (0x85109CF7), (0x22E541E0), (0x84D934C0), (0x2223A4D2), (0x84A2FC68), (0x2161B389), (0x846DF472), (0x209F6FE1), (0x843A1D62), (0x1FDCDBBB), (0x840777B9), +(0x1F19F9F0), (0x83D60431), (0x1E56CA6E), (0x83A5C2C5), (0x1D935011), (0x8376B42E), (0x1CCF8CBB), (0x8348D8DF), (0x1C0B824E), (0x831C314A), (0x1B4732AE), (0x82F0BDDB), (0x1A829FC0), (0x82C67F00), (0x19BDCC63), (0x829D7553), (0x18F8B888), (0x8275A0D1), +(0x18336710), (0x824F0211), (0x176DD9E1), (0x82299974), (0x16A812E3), (0x82056754), (0x15E213FD), (0x81E26C0B), (0x151BDF19), (0x81C0A7F1), (0x1455771D), (0x81A01B80), (0x138EDBF8), (0x8180C6B6), (0x12C81090), (0x8162AA0A), (0x120116D2), (0x8145C5C8), +(0x1139F0A7), (0x812A1A36), (0x10729FFB), (0x810FA798), (0x0FAB26B9), (0x80F66E30), (0x0EE387CD), (0x80DE6E5A), (0x0E1BC326), (0x80C7A813), (0x0D53DBAF), (0x80B21BB4), (0x0C8BD356), (0x809DC971), (0x0BC3AC07), (0x808AB17E), (0x0AFB67B2), (0x8078D407), +(0x0A330844), (0x8068313B), (0x096A90AB), (0x8058C955), (0x08A200D7), (0x804A9C53), (0x07D95BB6), (0x803DAA6D), (0x0710A337), (0x8031F3C3), (0x0647D949), (0x80277871), (0x057EFFDC), (0x801E3892), (0x04B618DF), (0x8016343D), (0x03ED2743), (0x800F6B8D), +(0x03242AF6), (0x8009DE81), (0x025B26E9), (0x80058D31), (0x01921D0C), (0x800277A7), (0x00C90F4F), (0x80009DEB), (0xFFFFFFA3), (0x80000002), (0xFF36F0F5), (0x80009DEB), (0xFE6DE338), (0x800277A6), (0xFDA4D95B), (0x80058D2F), (0xFCDBD54E), (0x8009DE7F), +(0xFC12D902), (0x800F6B8A), (0xFB49E665), (0x80163444), (0xFA80FF69), (0x801E389A), (0xF9B826FB), (0x8027786E), (0xF8EF5D0E), (0x8031F3BF), (0xF826A48E), (0x803DAA69), (0xF75DFF6D), (0x804A9C4E), (0xF6956F99), (0x8058C950), (0xF5CCF701), (0x8068314A), +(0xF5049793), (0x8078D418), (0xF43C543D), (0x808AB177), (0xF3742CEE), (0x809DC96B), (0xF2AC2495), (0x80B21BAD), (0xF1E43D1E), (0x80C7A80C), (0xF11C7877), (0x80DE6E52), (0xF054D88D), (0x80F66E47), (0xEF8D5F4B), (0x810FA7B0), (0xEEC60F9D), (0x812A1A2D), +(0xEDFEE972), (0x8145C5BE), (0xED37EFB3), (0x8162AA00), (0xEC71244C), (0x8180C6AB), (0xEBAA8927), (0x81A01B75), (0xEAE4202D), (0x81C0A810), (0xEA1DEB4A), (0x81E26C2C), (0xE957ED61), (0x82056748), (0xE8922662), (0x82299967), (0xE7CC9933), (0x824F0204), +(0xE70747BB), (0x8275A0C3), (0xE64233E0), (0x829D7545), (0xE57D5F89), (0x82C67F27), (0xE4B8CC9B), (0x82F0BE03), (0xE3F47DF5), (0x831C313B), (0xE3307388), (0x8348D8D0), (0xE26CB031), (0x8376B41E), (0xE1A935D4), (0x83A5C2B5), (0xE0E60653), (0x83D60420), +(0xE023238F), (0x840777E8), (0xDF608F69), (0x843A1D92), (0xDE9E4CB9), (0x846DF460), (0xDDDC5B6F), (0x84A2FC55), (0xDD1ABE62), (0x84D934AE), (0xDC59776E), (0x85109CE4), (0xDB988872), (0x8549346E), (0xDAD7F348), (0x8582FAC2), (0xDA17BAC1), (0x85BDEF05), +(0xD957DECD), (0x85FA113A), (0xD898623B), (0x86376085), (0xD7D946E3), (0x8675DC4D), (0xD71A8E9D), (0x86B583F8), (0xD65C3B40), (0x86F656E9), (0xD59E4EA0), (0x87385481), (0xD4E0CB84), (0x877B7BC6), (0xD423B1DD), (0x87BFCCBD), (0xD367046F), (0x8805466A), +(0xD2AAC50A), (0x884BE820), (0xD1EEF581), (0x8893B132), (0xD13397A2), (0x88DCA0EE), (0xD078AD3C), (0x8926B6A0), (0xCFBE3908), (0x8971F132), (0xCF043AF8), (0x89BE50A8), (0xCE4AB5C6), (0x8A0BD3E8), (0xCD91AB39), (0x8A5A7A32), (0xCCD91D1C), (0x8AAA42C5), +(0xCC210D35), (0x8AFB2CDB), (0xCB697D4B), (0x8B4D37AC), (0xCAB2700B), (0x8BA06204), (0xC9FBE567), (0x8BF4ABE9), (0xC945E00A), (0x8C4A1423), (0xC89061B6), (0x8CA099DE), (0xC7DB6C2A), (0x8CF83C44), (0xC7270126), (0x8D50FA7F), (0xC6732265), (0x8DAAD3B2), +(0xC5BFD1A5), (0x8E05C6FF), (0xC50D109F), (0x8E61D388), (0xC45AE10D), (0x8EBEF868), (0xC3A94669), (0x8F1D33C8), (0xC2F83EE1), (0x8F7C86A0), (0xC247CDF0), (0x8FDCEF16), (0xC197F548), (0x903E6C3B), (0xC0E8B69C), (0x90A0FD21), (0xC03A139B), (0x9104A0D2), +(0xBF8C0DF6), (0x9169565A), (0xBEDEA758), (0x91CF1CC0), (0xBE31E16E), (0x9235F309), (0xBD85BDE2), (0x929DD837), (0xBCDA3E5E), (0x9306CB49), (0xBC2F6487), (0x9370CB3D), (0xBB853205), (0x93DBD70E), (0xBADBA879), (0x9447EDB3), (0xBA32CB35), (0x94B50D09), +(0xB98A987D), (0x95233631), (0xB8E3139E), (0x95926705), (0xB83C3E37), (0x96029E73), (0xB79619E2), (0x9673DB66), (0xB6F0A839), (0x96E61CC6), (0xB64BEAD5), (0x9759617B), (0xB5A7E34D), (0x97CDA867), (0xB5049334), (0x9842F06B), (0xB461FC1F), (0x98B93866), +(0xB3C01F9D), (0x99307F35), (0xB31EFF3F), (0x99A8C3B0), (0xB27E9C92), (0x9A2204B0), (0xB1DEF922), (0x9A9C4109), (0xB140180C), (0x9B177652), (0xB0A1F7AF), (0x9B93A5CF), (0xB0049B27), (0x9C10CD15), (0xAF6803F9), (0x9C8EEAEF), (0xAECC33A5), (0x9D0DFE27), +(0xAE312BAE), (0x9D8E0581), (0xAD96ED91), (0x9E0EFFC3), (0xACFD7ACC), (0x9E90EBAF), (0xAC64D4D8), (0x9F13C803), (0xABCCFD2E), (0x9F97937D), (0xAB35F545), (0xA01C4CD8), (0xAA9FBE92), (0xA0A1F2CC), (0xAA0A5A88), (0xA128840F), (0xA975CC0F), (0xA1AFFDFC), +(0xA8E211A2), (0xA23861F5), (0xA84F2E2A), (0xA2C1AD53), (0xA7BD2310), (0xA34BDEC3), (0xA72BF1BC), (0xA3D6F4F0), (0xA69B9B96), (0xA462EE82), (0xA60C2200), (0xA4EFCA21), (0xA57D865E), (0xA57D8670), (0xA4EFCA0F), (0xA60C2213), (0xA462EE70), (0xA69B9BA8), +(0xA3D6F4DE), (0xA72BF1CF), (0xA34BDEB2), (0xA7BD2322), (0xA2C1AD42), (0xA84F2E3D), (0xA23861E4), (0xA8E211B5), (0xA1AFFF45), (0xA975CAA9), (0xA12883FE), (0xAA0A5A9B), (0xA0A1F2BB), (0xAA9FBEA5), (0xA01C4CC7), (0xAB35F559), (0x9F97936C), (0xABCCFD41), +(0x9F13C7F2), (0xAC64D4EB), (0x9E90EB9E), (0xACFD7ADF), (0x9E0EFFB3), (0xAD96EDA5), (0x9D8E0571), (0xAE312BC2), (0x9D0DFE16), (0xAECC33B9), (0x9C8EEADF), (0xAF68040D), (0x9C10CD05), (0xB0049B3B), (0x9B93A5BF), (0xB0A1F7C3), (0x9B177642), (0xB1401820), +(0x9A9C40F9), (0xB1DEF936), (0x9A2204A1), (0xB27E9CA6), (0x99A8C3A1), (0xB31EFF54), (0x99307F26), (0xB3C01FB2), (0x98B93857), (0xB461FC33), (0x9842F05C), (0xB5049349), (0x97CDA858), (0xB5A7E362), (0x9759616C), (0xB64BEAEA), (0x96E61CB8), (0xB6F0A84E), +(0x9673DB57), (0xB79619F7), (0x96029E64), (0xB83C3E4C), (0x959266F7), (0xB8E313B4), (0x95233623), (0xB98A9893), (0x94B50E13), (0xBA32C99E), (0x9447EDA5), (0xBADBA88F), (0x93DBD700), (0xBB85321A), (0x9370CB30), (0xBC2F649D), (0x9306CB3C), (0xBCDA3E74), +(0x929DD829), (0xBD85BDF8), (0x9235F2FC), (0xBE31E184), (0x91CF1CB3), (0xBEDEA76E), (0x9169564D), (0xBF8C0E0C), (0x9104A0C5), (0xC03A13B2), (0x90A0FD14), (0xC0E8B6B2), (0x903E6C2F), (0xC197F55F), (0x8FDCEF09), (0xC247CE07), (0x8F7C8694), (0xC2F83EF8), +(0x8F1D34AD), (0xC3A944BC), (0x8EBEF85C), (0xC45AE123), (0x8E61D37C), (0xC50D10B6), (0x8E05C6F4), (0xC5BFD1BC), (0x8DAAD3A6), (0xC673227C), (0x8D50FA73), (0xC727013D), (0x8CF83C39), (0xC7DB6C41), (0x8CA099D3), (0xC89061CD), (0x8C4A1418), (0xC945E021), +(0x8BF4ABDF), (0xC9FBE57E), (0x8BA061F9), (0xCAB27022), (0x8B4D3738), (0xCB697E4C), (0x8AFB2C68), (0xCC210E37), (0x8AAA4254), (0xCCD91E1E), (0x8A5A7A8D), (0xCD91AA66), (0x8A0BD442), (0xCE4AB4F1), (0x89BE5100), (0xCF043A24), (0x8971F188), (0xCFBE3833), +(0x8926B697), (0xD078AD53), (0x88DCA0E4), (0xD13397BA), (0x8893B128), (0xD1EEF599), (0x884BE817), (0xD2AAC522), (0x88054661), (0xD3670487), (0x87BFCCB5), (0xD423B1F5), (0x877B7BBD), (0xD4E0CB9C), (0x87385424), (0xD59E4FAA), (0x86F6568E), (0xD65C3C4A), +(0x86B5839E), (0xD71A8FA8), (0x8675DC95), (0xD7D94608), (0x863760CC), (0xD8986160), (0x85FA1180), (0xD957DDF1), (0x85BDEF49), (0xDA17B9E5), (0x8582FABB), (0xDAD7F360), (0x85493467), (0xDB98888A), (0x85109CDD), (0xDC597787), (0x84D934A7), (0xDD1ABE7A), +(0x84A2FC4F), (0xDDDC5B88), (0x846DF45A), (0xDE9E4CD2), (0x843A1D4B), (0xDF60907A), (0x840777A2), (0xE02324A0), (0x83D603DC), (0xE0E60764), (0x83A5C2EC), (0xE1A934F4), (0x8376B454), (0xE26CAF51), (0x8348D904), (0xE33072A7), (0x831C316D), (0xE3F47D14), +(0x82F0BDFE), (0xE4B8CCB4), (0x82C67F21), (0xE57D5FA2), (0x829D7540), (0xE64233F9), (0x8275A0BE), (0xE70747D4), (0x824F0200), (0xE7CC994C), (0x82299962), (0xE892267C), (0x82056743), (0xE957ED7A), (0x81E26BFB), (0xEA1DEC5F), (0x81C0A7E1), (0xEAE42143), +(0x81A01B48), (0xEBAA8A3D), (0x8180C6CF), (0xEC712368), (0x8162AA22), (0xED37EECF), (0x8145C5DF), (0xEDFEE88E), (0x812A1A4C), (0xEEC60EB9), (0x810FA7AD), (0xEF8D5F65), (0x80F66E44), (0xF054D8A6), (0x80DE6E4F), (0xF11C7891), (0x80C7A809), (0xF1E43D38), +(0x80B21BAA), (0xF2AC24AF), (0x809DC968), (0xF3742D08), (0x808AB175), (0xF43C5456), (0x8078D3FF), (0xF50498AB), (0x80683134), (0xF5CCF819), (0x8058C93B), (0xF69570B2), (0x804A9C5E), (0xF75DFE87), (0x803DAA77), (0xF826A3A8), (0x8031F3CB), (0xF8EF5C28), +(0x80277879), (0xF9B82615), (0x801E3899), (0xFA80FF82), (0x80163443), (0xFB49E67F), (0x800F6B8A), (0xFC12D91B), (0x8009DE7E), (0xFCDBD568), (0x80058D2F), (0xFDA4D975), (0x800277A6), (0xFE6DE352), (0x80009DEA), (0xFF36F10F), (0x656DBCC8), (0x7A9108CA), +(0xBA3670F0), (0x699195A2), (0x172D2FD0), (0xBE386D51), (0xC4AEA51C), (0x2AA77D7D), (0x8B51D3B4), (0xCF490FD9), (0x4A7BEBCA), (0x91072E04), (0xA175872D), (0x54464A9E), (0x67A6CD02), (0x9E8204A8), (0x10C14BF6), (0x75ACDA16), (0xF78D7B3E), (0x6AB3CF69), +(0xA4D8C756), (0xCB8FCD24), (0x75CC5713), (0xC13E5AE3), (0xA8C3176D), (0x5EE6D416), (0x80C5DA0E), (0xD84A007C), (0x719E73C0), (0x765014B0), (0x0A391BC8), (0x60A70223), (0x54CDA46B), (0x4606D455), (0xA606FB2A), (0xE4CE1557), (0x73240820), (0x8037A8B4), +(0xA1D88032), (0x75A3F1C7), (0x32BB0370), (0x5F850242), (0x85EC8F5B), (0x8AA2B33C), (0x91B370C2), (0x938E9DDB), (0xE6B6983E), (0x49602AA9), (0x6C2D9965), (0x5B16AE72), (0x69579B6B), (0xCD3AB415), (0x5B7CF03C), (0xD7B27637), (0x2D69B79A), (0x3237B468), +(0x5F94D650), (0xAB37106D), (0x0B831457), (0xAFD80334), (0xB5A0B27B), (0x16B763E9), (0x3B454756), (0x3167CD98), (0x707239AF), (0x0A4F132A), (0x2782C8CA), (0x1AC1DD4E), (0x121CADFE), (0x9A911D90), (0x0157ADD6), (0x1559BB95), (0x2854C84A), (0xD97E3685), +(0x76308AA0), (0x8050F1FF), (0x2180612F), (0xFFFB8A1A), (0x0BC1FFFF), (0x1032846C), (0x002A30C2), (0x654C58F2), (0xA58ABACC), (0xC3E9831C), (0x27531B8C), (0xADBB8698), (0x06801C12), (0xAFAEEC8E), (0xC3269291), (0x5C2E01A0), (0x4A61087C), (0x60F21E7B), +(0x6B92C670), (0xC9872364), (0x48464C97), (0x342E6499), (0xA6849A48), (0xF034002D), (0x442B4488), (0x160B0442), (0xED52CF50), (0x4D436C05), (0x6841C602), (0xA14F8A82), (0x9AC20DDE), (0x5B9251EE), (0x8ED998D5), (0x92B6EA22), (0x5B136C4B), (0x97C0A45B), +(0x459C94A4), (0xCD9583C0), (0x6C589DF8), (0x3C9A17CD), (0x906601BF), (0x84D612E1), (0x67176F5F), (0xE47D5A44), (0x37386D5E), (0x92A4D61B), (0x28C513FB), (0x6E91599A), (0x653DA16D), (0xA19C39C0), (0x427690AD), (0x7005461C), (0xAB6C1EE4), (0x80BACC2D), +(0x780A18C5), (0x822DC774), (0xB6043036), (0x00789C18), (0x106C9507), (0x4103A864), (0xC511585B), (0xF3E9B7F8), (0x24D79C4D), (0x31B20EB5), (0xB1C0483E), (0xE25C56B9), (0x96991096), (0x7CD4121F), (0x8A3B83F4), (0x704271C2), (0xB5C26ACC), (0x2B131AF0), +(0x549CB16C), (0x74649E69), (0xD8D48ADE), (0x1253AEDD), (0x80410FD2), (0x5B36889D), (0x880CE1E7), (0x56C498E7), (0xFA2BAAB2), (0xD4154F5C), (0x79516EED), (0xA42FDA7D), (0x278D2873), (0x19121535), (0x9C6EC6C7), (0x402340CB), (0x5A6A32B3), (0xE4345F27), +(0x8DC2D901), (0x02E7F88E), (0x7B3C6BEB), (0xE0946A4F), (0x9452886C), (0xFF2F6187), (0x2F8050F1), (0x2A217C61), (0x0AB21594), (0x801145C4), (0x1CF200A5), (0x82C544F1), (0xCF3C50B0), (0xD577FEF7), (0x60AD3C6E), (0x91AFF79E), (0x070723B3), (0x5870ECF6), +(0x64C224E2), (0x24FB1EC8), (0xC3481048), (0x151ABF3C), (0x136AC219), (0x4716CED1), (0xC8B8CE4E), (0x1D168210), (0x92334A81), (0x90DC910C), (0x49A00220), (0xE5F2C831), (0xB67DC785), (0x3C495174), (0x0D1F4C2A), (0x3AD787FD), (0xE9C9FB27), (0x7DFC2713), +(0xEB39C4B3), (0x96F75F18), (0x883CCC47), (0x91390BD1), (0x0EE25F6D), (0x6B688EF0), (0x2C8557DC), (0xE80C9172), (0xDE63DE06), (0x3E1B707B), (0xB2CF2E76), (0x490D1DF3), (0xCD1B51E1), (0xC228F0F9), (0xEEE2A00A), (0x081D834A), (0x1D2C1403), (0x083FE940), +(0x7614EDA0), (0x8282095A), (0xA7C08821), (0x4CD47D20), (0x32299191), (0x52A030E6), (0xDF7CB76E), (0x232ED44B), (0x8DAA150A), (0x1B593C51), (0x449CBA82), (0xABE6D3C4), (0xCCF6F5C3), (0x9064C1C2), (0x031FF59C), (0x4159FE4E), (0x421482C0), (0x20F6F00A), +(0xB866CA49), (0x75A66FAA), (0x5453515F), (0xB545D486), (0x885D9493), (0xEEC4EEB4), (0x88F9C893), (0xBBAA38B4), (0x5A57BA83), (0x12E848CC), (0x2FB62160), (0x840A1A54), (0x2A7AEDD6), (0x89AF2DBD), (0xC8BAAE2E), (0x56EEBD75), (0xE595B86D), (0xEEB123C6), +(0x3F94EBC1), (0x78CFBEE2), (0xCF901F11), (0x5A35A350), (0xDA22CB58), (0xBE4B8287), (0x25E078C0), (0x2BD4F0D3), (0x6A464B99), (0x4884B156), (0xF1FF7630), (0xC1328050), (0xD84C216C), (0x84A4D942), (0x2157A0A0), (0xF30A1412), (0x54AF6011), (0x00D70542), +(0xBDABE7DB), (0x1FF3534C), (0xD8672B4E), (0x7BE3BB3A), (0xC5595540), (0x161E1BFF), (0xD4372309), (0x7BC2ED52), (0xC1C636ED), (0x4DD32AA4), (0x86163246), (0x614EF688), (0x4EB44270), (0x88ED077C), (0x2F229466), (0x1A585201), (0x65BB2EE2), (0xDBADA0DD), +(0xE50995CB), (0xCA1E2760), (0x583FD81F), (0xE48D4859), (0xC2006152), (0x8F1F770C), (0x27CAA86F), (0x9610B845), (0xFC25BCE3), (0x37B8B39F), (0x10DCCDD1), (0xD57A4CAB), (0x7D543DE8), (0x6F45B958), (0x12F0B979), (0x818E79F9), (0xB4B2B01F), (0xF3035901), +(0x372F7BD9), (0x5D592E67), (0xDB5A552F), (0x6E61E625), (0x4E8A6A42), (0x2458ADB8), (0x5F12528C), (0x272B3ADE), (0xDE666A83), (0x7F18CFD7), (0x2F877DD8), (0xD73FFFB6), (0x79867956), (0x4E05FCAD), (0x19E78EEE), (0xE1BA6512), (0x99F6F091), (0x91690516), +(0x16AE4041), (0x04B96805), (0x7CA052FC), (0xA4D05EFD), (0x413D1F04), (0x53E91CC0), (0x6F87A082), (0x604FD202), (0x0B368D9F), (0xD5F22E5C), (0x2BE5A74E), (0x2F69EADE), (0x8BE537E1), (0x96975789), (0x3675A3A0), (0x0A272B71), (0x754B1D61), (0x98600581), +(0x659A2BE3), (0xB21BEF54), (0xF26351B0), (0x1C599573), (0x6B423B59), (0xEA371C96), (0xC9BDA499), (0xDDF25F37), (0xFBCAC4AD), (0x40CA788B), (0x13BC3981), (0x4176DA58), (0xD848DA74), (0x94740642), (0x54FD5479), (0x71502362), (0x25E81CF9), (0x53249562), +(0x52814827), (0x55DC5F2C), (0x8825BC50), (0x8E4D04D9), (0x8050F1FF), (0x212CC13E), (0x00C0D84C), (0x07711003), (0x406A5F45), (0xED0A98DE), (0x8A619731), (0x796A3B04), (0x7EAECF71), (0x7DF3DABE), (0x2B0FFB4A), (0xBA8A3FB8), (0x6202F8F2), (0x632C37B2), +(0x205271AA), (0xBA1C438C), (0xAA1C1182), (0xE6442A65), (0xD736E043), (0x95715C5C), (0x3D604C28), (0xD21D0D74), (0xA1FB0C21), (0xCE8F065D), (0xB8B36463), (0x7F788C33), (0x84AB53A5), (0x4B33AF46), (0x40C2736A), (0x0D6571B7), (0xFC8D8292), (0x9D1C5182), +(0xF7B670E2), (0xBB2B9E91), (0x137851D5), (0xBCF87CA8), (0xE082A7A6), (0x502404E5), (0x5025A6E0), (0x25494EA6), (0x5A6A8A14), (0xE301A689), (0x70CBEE6B), (0xC80644C1), (0xE9914CE6), (0x9481F1E6), (0xB9E4DA34), (0x584B1ED8), (0xACC39648), (0x31EFCD62), +(0x07C82AE9), (0xEE9D90E5), (0x59BAEC75), (0x40178B0E), (0x9FDC1C9C), (0xF3A6488F), (0x4B6C1367), (0x9F7DF109), (0xCBDF8EDF), (0xBA76ED33), (0xF15DBB9F), (0xD48A197F), (0xF11E75EE), (0xA76B479B), (0x706DE78B), (0x6559AC65), (0xC013C182), (0x461E93C7), +(0xA989EAF1), (0x59448C00), (0x721FAC38), (0x546DEA79), (0x223F67C0), (0x5434647C), (0xB3EF4F0A), (0xD4FAF1F1), (0x0BD4E38A), (0xFF61527E), (0xD6EA5DD2), (0x644C7105), (0x31AE2189), (0x11EC0A1A), (0x18B3AD80), (0x47D0E80A), (0x773D8BB2), (0xEFA6747E), +(0xF23DE8B0), (0x026BB1E7), (0x03C14060), (0xC1997DF7), (0x95986B9C), (0x8A5D6170), (0x54DB3A56), (0x22961D41), (0x46813471), (0xABED16A4), (0xD1F83E8C), (0x2594ACAC), (0x1D5560EA), (0x0432EFF4), (0xA389D7E8), (0xAFE92C62), (0xFBBAF1E7), (0x42D0D0A1), +(0xA2C3ECB2), (0x603DD635), (0xEBBC5915), (0x5B0C7CE0), (0x8D03640C), (0x22E298DB), (0x38CE3BDC), (0x21E6B6B4), (0xC9742C3F), (0x4BDF7448), (0xBAD09D00), (0xED6A8397), (0xF6F8001A), (0x31E3591E), (0xAEC37EFE), (0x22D9AD06), (0x5E254AEC), (0xD852D32E), +(0xE1C968AE), (0xA3C3C265), (0xD67BD78A), (0xF1FF9D8C), (0xC03A8050), (0x847A21FC), (0x810EDA5D), (0x63808951), (0xC8FE9E9E), (0xFB6DD3E5), (0x77BD7A03), (0x6DC14677), (0xFF81D831), (0x43201100), (0xA78E16FE), (0x393CD0A0), (0x514F6DDD), (0x427BA4BC), +(0xEBE7A676), (0xB771639B), (0x8DABB9E7), (0x812FA5AD), (0x3F102120), (0x60E42454), (0xEFFBFFC5), (0xBEB1D5DD), (0x7A59DDFD), (0xE8968D7A), (0x8AAD3462), (0xAB65327D), (0x0CF2ECFB), (0xFA3249A4), (0x97FC3A42), (0x314A7089), (0x2991E6DC), (0xA98693C4), +(0x65EB2011), (0xCB4D8594), (0x1AAFF14E), (0x1D0D0492), (0x2E5A784D), (0xAE4EC738), (0xF16D667A), (0xB0C26030), (0xADA3DFC9), (0x4ED874E5), (0xD441A6AE), (0x19E3AC05), (0xC6B865DC), (0xE8E4285A), (0x99248C2B), (0xC2981122), (0x1B014288), (0x442A0580), +(0x84A0A1C1), (0x216F0248), (0x202E5602), (0xEAEBAACA), (0xDD5ABEE7), (0x8B9C4B43), (0x5D5D46D7), (0x8FBE7C1D), (0x6F9CAB87), (0xB0AB0AAE), (0x98BC7936), (0xF251B911), (0x4469F2D1), (0xA9099088), (0xD219BD66), (0x7490AE22), (0xBC0A9820), (0x119D0136), +(0x8592661C), (0x260C0D18), (0xB9A1C5B1), (0xA68591E4), (0xFCBD4F29), (0x5965A3C7), (0x7D1ED664), (0x9BDDEEE3), (0x92237D5A), (0xB7332DA6), (0xEA5632E5), (0x9BFE1624), (0x6A2BB18A), (0x8C0DD72C), (0x4F319F56), (0xEE8B5B03), (0x60967BC8), (0xB4918F75), +(0xF295D5F6), (0x652AD80D), (0x0CCE9552), (0x0BCAA0A6), (0x3CF2D28E), (0x1853956E), (0x7B38DEAA), (0xEAAB970B), (0x64086D1F), (0x3E7645DD), (0x986F1342), (0xBBB0E188), (0x7D6D5642), (0x6821827D), (0xFCBC4729), (0x3D114FB9), (0x2D2542E5), (0x654CC1F0), +(0x04F1B75E), (0x290B54AF), (0x7D79AB1A), (0xF34E31A2), (0x73A9F300), (0x7ABCA89E), (0xB56DA974), (0xCACDB07C), (0x4EE1ADD4), (0xEF859B34), (0x89F47B47), (0x515C155A), (0x38D06757), (0x8050F1FF), (0x21C8E03A), (0xB155841A), (0x30716685), (0x0A2B48AC), +(0x7041C40A), (0x104C44D0), (0x1F51B618), (0xF0D4F39B), (0xFCAEBA52), (0x30EA62CD), (0xA294B772), (0x221E0417), (0xAA8EF192), (0x3E568C78), (0xD386EF9A), (0x13B54FB1), (0x84818EC3), (0xB87669F8), (0xCD90565A), (0x73D7C876), (0xD6191512), (0xAC228704), +(0xA7785D48), (0x17CF34DD), (0x8AF5AB40), (0x365C6AFA), (0x17DFD59E), (0xB924C26E), (0xE9DE5844), (0x3DCDDCD9), (0xCDA2DFB4), (0x8A5B534E), (0xA2D9DACA), (0x11679569), (0xAEF6E7E9), (0xC9D2417C), (0x515DC9C3), (0x157A5B12), (0x4C960DD6), (0xD413CC01), +(0x65319545), (0x6CF1309D), (0x000338C7), (0x460AA7FC), (0xC1FA4440), (0x0E3AE048), (0xF4B212B5), (0xC7895D2B), (0x676AFAF3), (0xEF404F75), (0xBFCDB17C), (0xA37FE6C6), (0x20123DD5), (0xEE96BD3B), (0x3EB8A62E), (0x068845E1), (0xC4960216), (0x7BB11D8D), +(0x2D657467), (0xFC6FACC5), (0xC21AAD31), (0x642745F4), (0x4507E139), (0xF7369DC9), (0x6198ADEB), (0x63B98B10), (0xDEE585AB), (0xA38EFFAC), (0x30AE1E41), (0x820667A9), (0x6B77A007), (0x240040A7), (0xB77A7D95), (0x208893CA), (0x085B4610), (0x14234854), +(0xAC022786), (0x2D57346F), (0xB64A1A67), (0x605D45B2), (0xE051C001), (0x9176C11D), (0x23BBE945), (0x2C03E26A), (0xC2811BAD), (0x1DD814D4), (0x3C674B68), (0x28EC33C7), (0xD9EDE5E4), (0x5C46C248), (0x4098898F), (0x5BA96280), (0xEFF77B91), (0x3332CA5B), +(0x661CAF6B), (0x6E0D564E), (0xB70D0863), (0x240285C0), (0xBBBD3EA7), (0xCA2E568D), (0xD1D3F612), (0xC916115E), (0xB7FC0A6C), (0x1961AE9A), (0xB5DF3965), (0xC1B95065), (0x89E29665), (0x3F29FBED), (0x3F1BED73), (0xC155BE1D), (0x7256AE4C), (0x4A59797B), +(0x6009D13B), (0x91850385), (0xE4545920), (0x15ECCDA1), (0xFFC7BA20), (0x2B8050F1), (0x1A21D4C0), (0x3008BE89), (0x6C0FF317), (0x7444D852), (0x05841411), (0x84C80022), (0x07C630E0), (0x7E6F8FA3), (0xF3BDF3C7), (0x4C55DFF7), (0xE0B1C8D1), (0xC3F5CF4D), +(0x1C22A836), (0xB29D3315), (0xD4966541), (0x45C85800), (0xAD8DBD46), (0x2C19CFAA), (0x540FA674), (0xC3C913D8), (0xD2183753), (0xCB9FCF26), (0x8346FC89), (0xA3408078), (0xCFD84CC1), (0xF580F035), (0x7FD067A7), (0x87E7FCB8), (0x09C09406), (0xDDBB3131), +(0xFF79FFE1), (0xEAFBEEF1), (0xB660BCE8), (0x99899C31), (0x9FEB22C1), (0xC75EF68F), (0x13800B99), (0xCD7F3100), (0x09502ADC), (0x101E00E8), (0x406CB945), (0x820A1B2B), (0x68A0B082), (0x0C1B1864), (0xB3690354), (0x63C5B5A3), (0x535EB4C8), (0xF7D86918), +(0xD1BA58FC), (0xF42910FA), (0xFBDB1929), (0xC7C0C2A4), (0xD2074752), (0xB96803B4), (0x84065E38), (0x819AF48E), (0xE9864FF3), (0xA6E41D0E), (0x50E7442B), (0xC7574D7B), (0x196B6AB3), (0x041D5854), (0x629162D3), (0x042713E0), (0x9AE31297), (0x4B2F4E36), +(0xCB8CE0E0), (0xB2F0682A), (0xAB33D6F5), (0x2F53D82E), (0x66A43815), (0x4433AAA8), (0x82EA0ED5), (0x457876F2), (0xD30BD36C), (0x8D49D28C), (0x0E68260E), (0xD056512C), (0x7B86DB11), (0x64633661), (0x8265FF25), (0x6D2B7148), (0x529DA0D8), (0xBC180017), +(0x19AB803B), (0x83F00020), (0x50F1FF07), (0xD4C02D80), (0xFC881A21), (0xC1BF0100), (0x5841680B), (0x103B2CC0), (0xB042C28A), (0x2324E8A8), (0x31531430), (0xEF71DD0E), (0x7C1B9D8E), (0x0998C228), (0xD9EC6548), (0x8EEF8448), (0x0C561CAF), (0x4BA39DFD), +(0x58947FE2), (0x959B12A2), (0x6D52EAEC), (0x1D95DDD5), (0x310C222B), (0x63634B18), (0x4DE6C5B8), (0x526C9106), (0x49B5E8CC), (0xC3C33004), (0x605CD287), (0x09A6390C), (0x350C33BC), (0x953050CC), (0x960552A3), (0x54F01186), (0x0E8D7CFE), (0x459A0022), +(0xC3576966), (0xB0D6F6E8), (0xB8F13AAC), (0xE440034C), (0x36118851), (0xF51BE727), (0x2E1689A0), (0xE82CCF55), (0x6DF4E3CB), (0xEA665663), (0xC2E53D6F), (0x9DC1F06B), (0xFCC2E878), (0x4292D162), (0x4840C433), (0xB618DB43), (0x06092C15), (0x500134C1), +(0xA6DB8955), (0xD5E8A5BB), (0x142B7829), (0x75F42939), (0x0EBF4D10), (0x1A2B078C), (0x7C2A5A46), (0x3EA1B9A7), (0x31AAC898), (0x1327B852), (0x277C65A1), (0x5280CE27), (0xFF512213), (0x39B47EBF), (0x154CA000), (0x106E7DA2), (0xAFA4C925), (0xC48CE379), +(0xAB2E4573), (0x5E44B8FD), (0xECD2A424), (0x8C5300AA), (0xE425A180), (0x6D5D0D3B), (0xA70540A8), (0xF8ECF432), (0x884696B0), (0xB79755BF), (0x62CAD419), (0x4BBB38B6), (0xCD5C79D7), (0x82D4E29B), (0x6DD48E91), (0xA128A3A9), (0xF2ED6726), (0x339A63F6), +(0x35D6F4EA), (0x8DC8B491), (0xCA04D09C), (0xFF074FD0), (0x2D8050F1), (0x1A21D880), (0x1900FE88), (0x6C09D1BF), (0x56483001), (0xC20A1A29), (0x449180A3), (0x028C5160), (0x75FAECDD), (0x6250705B), (0x89EA010A), (0x7B9F9851), (0x9D6C5994), (0x8602C3E4), +(0x03D0E863), (0x04322251), (0x116095B7), (0x789276CA), (0x00000000), (0x00000978), (0x8000C688), (0x8000BCD8), (0x80010000), (0x9FC3F7B8), (0xDE47BC1B), (0xE60FB4F8), (0xEA27469D), (0xCCA1E66D), (0x8FFF7010), (0x8000BCD8), (0x000000D0), (0x8000B4B0), +(0x8FFFFB24), (0x9FC3F7B8), (0x00000000), (0x8000B418), (0x8FFF7010), (0x8000C688), (0x000000D0), (0x9FC3FD3C), (0xD625F8C0), (0x478D832A), (0xF693D922), (0x3617D816), (0x80000648), (0x00000000), (0x00000003), (0x00000012), (0x9FC49964), (0x46141924), +(0x4D834205), (0x16B799A6), (0xA39494A6), (0xCCF23C60), (0x00000001), (0x9FC47468), (0x00000000), (0x00000072), (0x00008001), (0x8FFFFB58), (0x00000003), (0x402C7413), (0x00000016), (0x402C7413), (0x9FC48498), (0x00000000), (0x00000002), (0x00000001), +(0x00000072), (0x9FC4783C), (0x8000C690), (0x0358CDD5), (0x00000000), (0x00008001), (0x00000072), (0x80000648), (0x00000000), (0x00008001), (0x8000BD40), (0x1A19F8D8), (0x00008001), (0x800003C0), (0x00000003), (0x9FC428CC), (0xF6192015), (0xFBB77F92), +(0x8F2C8BFC), (0x3C391923), (0x4014428C), (0x140045AE), (0xFFFD2BB6), (0x2D8050F1), (0x8000BD40), (0x00000003), (0x00000000), (0x2CC05811), (0x00008001), (0x800003C0), (0x80000648), (0x80000648), (0x9FC4206C), (0x8FFFFD78), (0x8FFFFEEC), (0x8000C668), +(0x80000648), (0x8FFFFD78), (0x00000000), (0x00003040), (0x8000FFC0), (0x8000BCD8), (0x80010000), (0x9FC3F7B8), (0x00000000), (0x00002CC0), (0x80013340), (0x8000BCD8), (0x80010FD0), (0x80012548) +}; + +//static const INT __twiddles_mips_fft32_2048[] = +//{ +//(0x7FFFFFFF), (0x00000000), (0x7FFFD884), (0xFF9B781D), (0x7FFF6215), (0xFF36F078), (0x7FFE9CB1), (0xFED26950), (0x7FFD8859), (0xFE6DE2E0), (0x7FFC250E), (0xFE095D6A), (0x7FFA72D0), (0xFDA4D929), (0x7FF871A0), (0xFD40565D), (0x7FF62181), (0xFCDBD540), +//(0x7FF38272), (0xFC775617), (0x7FF09476), (0xFC12D91B), (0x7FED578F), (0xFBAE5E8C), (0x7FE9CBBE), (0xFB49E6A3), (0x7FE5F107), (0xFAE571A2), (0x7FE1C76A), (0xFA80FFCE), (0x7FDD4EEB), (0xFA1C9157), (0x7FD8878C), (0xF9B82681), (0x7FD37151), (0xF953BF94), +//(0x7FCE0C3D), (0xF8EF5CBC), (0x7FC85852), (0xF88AFE3F), (0x7FC25595), (0xF826A464), (0x7FBC0409), (0xF7C24F61), (0x7FB563B2), (0xF75DFF6B), (0x7FAE7493), (0xF6F9B4C8), (0x7FA736B2), (0xF6956FB7), (0x7F9FAA13), (0xF6313074), (0x7F97CEBB), (0xF5CCF73E), +//(0x7F8FA4AF), (0xF568C463), (0x7F872BF2), (0xF5049800), (0x7F7E648B), (0xF4A07264), (0x7F754E7E), (0xF43C53CB), (0x7F6BE9D3), (0xF3D83C74), (0x7F62368D), (0xF3742C9D), (0x7F5834B6), (0xF3102492), (0x7F4DE450), (0xF2AC2473), (0x7F434562), (0xF2482C8D), +//(0x7F3857F4), (0xF1E43D1C), (0x7F2D1C0C), (0xF1805660), (0x7F2191B2), (0xF11C7895), (0x7F15B8ED), (0xF0B8A409), (0x7F0991C3), (0xF054D8DA), (0x7EFD1C3B), (0xEFF11755), (0x7EF05860), (0xEF8D5FC8), (0x7EE34634), (0xEF29B241), (0x7ED5E5C6), (0xEEC60F3C), +//(0x7EC83717), (0xEE6276B7), (0x7EBA3A38), (0xEDFEE930), (0x7EABEF29), (0xED9B66A5), (0x7E9D55FB), (0xED37EF91), (0x7E8E6EB2), (0xECD48414), (0x7E7F3954), (0xEC71244A), (0x7E6FB5F4), (0xEC0DD0B0), (0x7E5FE490), (0xEBAA8944), (0x7E4FC53D), (0xEB474E83), +//(0x7E3F5800), (0xEAE4208A), (0x7E2E9CDD), (0xEA80FF77), (0x7E1D93EA), (0xEA1DEBC6), (0x7E0C3D26), (0xE9BAE575), (0x7DFA98A7), (0xE957ED00), (0x7DE8A66C), (0xE8F50266), (0x7DD6668D), (0xE8922621), (0x7DC3D90E), (0xE82F5851), (0x7DB0FDF5), (0xE7CC9912), +//(0x7D9DD55A), (0xE769E8E0), (0x7D8A5F3C), (0xE70747B9), (0x7D769BB4), (0xE6A4B619), (0x7D628AC7), (0xE642341C), (0x7D4E2C7C), (0xE5DFC1E2), (0x7D3980ED), (0xE57D5FE4), (0x7D248818), (0xE51B0E22), (0x7D0F4217), (0xE4B8CD16), (0x7CF9AEEC), (0xE4569CBE), +//(0x7CE3CEB0), (0xE3F47D95), (0x7CCDA16A), (0xE3926FB9), (0x7CB72721), (0xE3307347), (0x7CA05FF1), (0xE2CE88BA), (0x7C894BDA), (0xE26CB010), (0x7C71EAF7), (0xE20AE9C3), (0x7C5A3D52), (0xE1A935F1), (0x7C4242F0), (0xE14794B7), (0x7C29FBEF), (0xE0E6068F), +//(0x7C11684F), (0xE0848B77), (0x7BF88830), (0xE02323EA), (0x7BDF5B8F), (0xDFC1CFE5), (0x7BC5E296), (0xDF609002), (0x7BAC1D33), (0xDEFF6400), (0x7B920B86), (0xDE9E4C5B), (0x7B77ADA0), (0xDE3D494C), (0x7B5D03A1), (0xDDDC5B4F), (0x7B420D79), (0xDD7B8222), +//(0x7B26CB49), (0xDD1ABE41), (0x7B0B3D33), (0xDCBA1024), (0x7AEF6325), (0xDC59778B), (0x7AD33D41), (0xDBF8F4F0), (0x7AB6CB9A), (0xDB98888E), (0x7A9A0E53), (0xDB3832DE), (0x7A7D0559), (0xDAD7F3A2), (0x7A5FB0D1), (0xDA77CB50), (0x7A4210DE), (0xDA17BA63), +//(0x7A24256F), (0xD9B7C09A), (0x7A05EEA8), (0xD957DE6F), (0x79E76C9C), (0xD8F8141D), (0x79C89F71), (0xD898621A), (0x79A98713), (0xD838C82A), (0x798A23A8), (0xD7D946C3), (0x796A755A), (0xD779DE5D), (0x794A7C11), (0xD71A8EBA), (0x792A37F8), (0xD6BB5850), +//(0x7909A935), (0xD65C3B98), (0x78E8CFB4), (0xD5FD3854), (0x78C7AB9E), (0xD59E4EF9), (0x78A63D07), (0xD53F7FC3), (0x78848419), (0xD4E0CB28), (0x786280BE), (0xD48230EA), (0x78403321), (0xD423B181), (0x781D9B6D), (0xD3C54D62), (0x77FAB98A), (0xD367044F), +//(0x77D78DA6), (0xD308D6BE), (0x77B417D4), (0xD2AAC4EB), (0x77905842), (0xD24CCF49), (0x776C4ED9), (0xD1EEF59D), (0x7747FBC5), (0xD191385B), (0x77235F35), (0xD13397FA), (0x76FE790F), (0xD0D6143A), (0x76D94983), (0xD078AD93), (0x76B3D0A6), (0xD01B643D), +//(0x768E0EA9), (0xCFBE38AD), (0x76680373), (0xCF612AA7), (0x7641AF32), (0xCF043A9E), (0x761B1218), (0xCEA76907), (0x75F42C0B), (0xCE4AB5A6), (0x75CCFD3B), (0xCDEE20EF), (0x75A585D9), (0xCD91AB55), (0x757DC5CD), (0xCD35549C), (0x7555BD47), (0xCCD91D37), +//(0x752D6C60), (0xCC7D0561), (0x7504D34C), (0xCC210D8B), (0x74DBF1EE), (0xCBC5357A), (0x74B2C87B), (0xCB697DA0), (0x74895725), (0xCB0DE672), (0x745F9DD3), (0xCAB26FB2), (0x74359CB8), (0xCA5719D3), (0x740B53ED), (0xC9FBE50E), (0x73E0C3A9), (0xC9A0D1D4), +//(0x73B5EBCF), (0xC945DFEB), (0x738ACC94), (0xC8EB0FC4), (0x735F662F), (0xC89061D1), (0x7333B884), (0xC835D5D6), (0x7307C3C9), (0xC7DB6C45), (0x72DB8819), (0xC7812556), (0x72AF05AB), (0xC727017A), (0x72823C63), (0xC6CD0075), (0x72552C79), (0xC67322B9), +//(0x7227D624), (0xC61968B6), (0x71FA3948), (0xC5BFD232), (0x71CC561E), (0xC5665F9B), (0x719E2CDE), (0xC50D1164), (0x716FBD6C), (0xC4B3E751), (0x71410800), (0xC45AE1D1), (0x71120CB7), (0xC402011C), (0x70E2CBCD), (0xC3A945A1), (0x70B34523), (0xC350AF26), +//(0x708378F4), (0xC2F83E1B), (0x7053677C), (0xC29FF2EC), (0x7023109C), (0xC247CD62), (0x6FF27490), (0xC1EFCDEA), (0x6FC19376), (0xC197F4BB), (0x6F906D6B), (0xC140420A), (0x6F5F02CF), (0xC0E8B67E), (0x6F2D5340), (0xC091516E), (0x6EFB5F1D), (0xC03A137E), +//(0x6EC92684), (0xBFE2FCE5), (0x6E96A995), (0xBF8C0DD8), (0x6E63E86E), (0xBF35468E), (0x6E30E32F), (0xBEDEA73A), (0x6DFD9A38), (0xBE883082), (0x6DCA0D27), (0xBE31E1BF), (0x6D963C5D), (0xBDDBBB92), (0x6D6227FA), (0xBD85BE33), (0x6D2DD01E), (0xBD2FE9D5), +//(0x6CF934E8), (0xBCDA3EAE), (0x6CC4567A), (0xBC84BCF2), (0x6C8F3538), (0xBC2F6544), (0x6C59D0BC), (0xBBDA36FD), (0x6C242969), (0xBB8532C0), (0x6BEE3F61), (0xBB3058C1), (0x6BB812C5), (0xBADBA934), (0x6B81A3B7), (0xBA87244E), (0x6B4AF258), (0xBA32CA42), +//(0x6B13FF11), (0xB9DE9BB0), (0x6ADCC976), (0xB98A97F6), (0x6AA551F0), (0xB936BFB2), (0x6A6D98A1), (0xB8E31318), (0x6A359DAC), (0xB88F925B), (0x69FD6132), (0xB83C3DB1), (0x69C4E358), (0xB7E9154A), (0x698C2487), (0xB79619C6), (0x69532453), (0xB7434A82), +//(0x6919E326), (0xB6F0A81D), (0x68E06125), (0xB69E32C9), (0x68A69E72), (0xB64BEAB9), (0x686C9B31), (0xB5F9D021), (0x68325786), (0xB5A7E331), (0x67F7D3DF), (0xB5562486), (0x67BD0FCC), (0xB5049380), (0x67820BBB), (0xB4B330BC), (0x6746C7D1), (0xB461FC6A), +//(0x670B4432), (0xB410F6BE), (0x66CF8103), (0xB3C01FE9), (0x66937EB5), (0xB36F7883), (0x66573CD5), (0xB31EFFF0), (0x661ABBD3), (0xB2CEB6CB), (0x65DDFBD6), (0xB27E9D43), (0x65A0FD03), (0xB22EB38A), (0x6563BF7E), (0xB1DEF9D2), (0x6526436F), (0xB18F704B), +//(0x64E8894A), (0xB140178C), (0x64AA9098), (0xB0F0EEFC), (0x646C59CC), (0xB0A1F730), (0x642DE50F), (0xB053305A), (0x63EF3286), (0xB0049AA9), (0x63B04257), (0xAFB6364E), (0x637114AB), (0xAF68037B), (0x6331A9F8), (0xAF1A02C1), (0x62F201C4), (0xAECC338B), +//(0x62B21C87), (0xAE7E966C), (0x6271FA69), (0xAE312B94), (0x62319B91), (0xADE3F333), (0x61F10027), (0xAD96ED77), (0x61B02852), (0xAD4A1A92), (0x616F148E), (0xACFD7B13), (0x612DC45D), (0xACB10E67), (0x60EC383A), (0xAC64D51F), (0x60AA704E), (0xAC18CF69), +//(0x60686CC0), (0xABCCFD75), (0x60262DBB), (0xAB815F71), (0x5FE3B366), (0xAB35F58C), (0x5FA0FE40), (0xAAEAC054), (0x5F5E0DC8), (0xAA9FBF38), (0x5F1AE27C), (0xAA54F2C6), (0x5ED77C86), (0xAA0A5B2C), (0x5E93DC0E), (0xA9BFF899), (0x5E500140), (0xA975CB39), +//(0x5E0BEC44), (0xA92BD33C), (0x5DC79D9C), (0xA8E2112C), (0x5D8314C4), (0xA898847B), (0x5D3E523E), (0xA84F2DB4), (0x5CF95632), (0xA8060D05), (0x5CB420CD), (0xA7BD229A), (0x5C6EB238), (0xA7746EA2), (0x5C290AA0), (0xA72BF148), (0x5BE32A86), (0xA6E3AB15), +//(0x5B9D1166), (0xA69B9B7D), (0x5B56BFC2), (0xA653C30A), (0x5B1035C7), (0xA60C21E8), (0x5AC973A0), (0xA5C4B843), (0x5A827978), (0xA57D8646), (0x5A3B47D6), (0xA5368C78), (0x59F3DE30), (0xA4EFCA51), (0x59AC3D0E), (0xA4A94056), (0x5964649B), (0xA462EEB2), +//(0x591C5504), (0xA41CD591), (0x58D40E75), (0xA3D6F51F), (0x588B911B), (0xA3914D87), (0x5842DD7E), (0xA34BDF4B), (0x57F9F314), (0xA306A9E5), (0x57B0D265), (0xA2C1ADDA), (0x57677B9E), (0xA27CEB53), (0x571DEEED), (0xA238627B), (0x56D42C7F), (0xA1F4137C), +//(0x568A3482), (0xA1AFFE81), (0x56400781), (0xA16C2409), (0x55F5A4ED), (0xA1288391), (0x55AB0D54), (0xA0E51D9B), (0x556040E2), (0xA0A1F24F), (0x55153FC6), (0xA05F01D7), (0x54CA0A2E), (0xA01C4C5C), (0x547EA049), (0x9FD9D207), (0x543302A5), (0x9F979356), +//(0x53E730B1), (0x9F558FC9), (0x539B2AFB), (0x9F13C7DC), (0x534EF1B3), (0x9ED23BB9), (0x53028507), (0x9E90EB88), (0x52B5E526), (0x9E4FD771), (0x52691241), (0x9E0EFF9D), (0x521C0CE8), (0x9DCE6485), (0x51CED486), (0x9D8E05AD), (0x518169AE), (0x9D4DE38F), +//(0x5133CC8F), (0x9D0DFE52), (0x50E5FD59), (0x9CCE561E), (0x5097FC3C), (0x9C8EEB1A), (0x5049C968), (0x9C4FBD6E), (0x4FFB6572), (0x9C10CD90), (0x4FACCFC1), (0x9BD21B06), (0x4F5E08EB), (0x9B93A649), (0x4F0F111F), (0x9B556F7E), (0x4EBFE88F), (0x9B1776CB), +//(0x4E708F6B), (0x9AD9BC57), (0x4E2105E4), (0x9A9C4048), (0x4DD14C91), (0x9A5F0312), (0x4D8162D8), (0x9A22043F), (0x4D314951), (0x99E54441), (0x4CE1002B), (0x99A8C340), (0x4C908799), (0x996C815F), (0x4C3FDFCC), (0x99307EC5), (0x4BEF095E), (0x98F4BBE2), +//(0x4B9E03B1), (0x98B93843), (0x4B4CCF60), (0x987DF459), (0x4AFB6C9B), (0x9842F048), (0x4AA9DB96), (0x98082C35), (0x4A581C83), (0x97CDA844), (0x4A062F93), (0x97936499), (0x49B41562), (0x975961A2), (0x4961CD53), (0x971F9EEF), (0x490F57FF), (0x96E61CED), +//(0x48BCB59A), (0x96ACDBC1), (0x4869E657), (0x9673DB8C), (0x4816EA68), (0x963B1C73), (0x47C3C202), (0x96029E99), (0x47706DC1), (0x95CA6267), (0x471CED05), (0x95926772), (0x46C9406B), (0x955AAE23), (0x46756827), (0x9523369D), (0x4621646C), (0x94EC0102), +//(0x45CD356F), (0x94B50D74), (0x4578DB63), (0x947E5C16), (0x452456E9), (0x9447ED4D), (0x44CFA75C), (0x9411C0B1), (0x447ACD5D), (0x93DBD6AA), (0x4425C920), (0x93A62F57), (0x43D09AD9), (0x9370CADA), (0x437B42BE), (0x933BA954), (0x4325C102), (0x9306CAE7), +//(0x42D015DB), (0x92D22FB1), (0x427A417D), (0x929DD7D5), (0x4224441D), (0x9269C372), (0x41CE1ECD), (0x9235F32C), (0x4177D009), (0x9202661B), (0x412158E3), (0x91CF1CE3), (0x40CAB990), (0x919C17A4), (0x4073F245), (0x9169567D), (0x401D0339), (0x9136D98D), +//(0x3FC5ECA0), (0x9104A0F4), (0x3F6EAEB0), (0x90D2ACD1), (0x3F17499F), (0x90A0FD42), (0x3EBFBDA4), (0x906F9267), (0x3E680AF3), (0x903E6C5D), (0x3E1031C4), (0x900D8B43), (0x3DB8324C), (0x8FDCEF37), (0x3D600CC1), (0x8FAC9857), (0x3D07C23C), (0x8F7C873A), +//(0x3CAF5130), (0x8F4CBB0B), (0x3C56BAB5), (0x8F1D3461), (0x3BFDFF02), (0x8EEDF359), (0x3BA51E4D), (0x8EBEF810), (0x3B4C18CE), (0x8E9042A4), (0x3AF2EEBA), (0x8E61D331), (0x3A99A04A), (0x8E33A9D5), (0x3A402DB4), (0x8E05C6AA), (0x39E6972F), (0x8DD829CE), +//(0x398CDCF3), (0x8DAAD35D), (0x3932FF37), (0x8D7DC373), (0x38D8FE32), (0x8D50FA2B), (0x387EDA1C), (0x8D2477A2), (0x38249413), (0x8CF83C62), (0x37CA2A82), (0x8CCC47A7), (0x376F9E88), (0x8CA099FB), (0x3714F05B), (0x8C75337B), (0x36BA2034), (0x8C4A1440), +//(0x365F2E4B), (0x8C1F3C66), (0x36041AD7), (0x8BF4AC06), (0x35A8E612), (0x8BCA633C), (0x354D9033), (0x8BA06221), (0x34F21973), (0x8B76A8CE), (0x3496820A), (0x8B4D375F), (0x343ACA30), (0x8B240DEC), (0x33DEF21F), (0x8AFB2C8E), (0x3382FAF9), (0x8AD293C7), +//(0x3326E323), (0x8AAA42E0), (0x32CAABBE), (0x8A823A5A), (0x326E5505), (0x8A5A7A4D), (0x3211DF31), (0x8A3302D3), (0x31B54A79), (0x8A0BD403), (0x31589718), (0x89E4EDF5), (0x30FBC547), (0x89BE50C2), (0x309ED53E), (0x8997FC82), (0x3041C737), (0x8971F14B), +//(0x2FE49B6C), (0x894C2F36), (0x2F875216), (0x8926B65A), (0x2F29EB6E), (0x890186CE), (0x2ECC67AF), (0x88DCA0A9), (0x2E6EC800), (0x88B8045E), (0x2E110ABF), (0x8893B14A), (0x2DB33112), (0x886FA7E1), (0x2D553B35), (0x884BE838), (0x2CF72962), (0x88287266), +//(0x2C98FBD1), (0x88054682), (0x2C3AB2BF), (0x87E2649F), (0x2BDC4E63), (0x87BFCCD5), (0x2B7DCEFA), (0x879D7F38), (0x2B1F34BC), (0x877B7BDD), (0x2AC07FE5), (0x8759C2DA), (0x2A61B0AF), (0x87385443), (0x2A02C754), (0x8717302D), (0x29A3C40F), (0x86F656AC), +//(0x2944A80D), (0x86D5C828), (0x28E571A3), (0x86B5840E), (0x28862200), (0x86958AC5), (0x2826B95E), (0x8675DC62), (0x27C737F7), (0x865678F8), (0x27679E06), (0x8637609A), (0x2707EBC7), (0x8618935B), (0x26A82174), (0x85FA114F), (0x26483F49), (0x85DBDA88), +//(0x25E84581), (0x85BDEF19), (0x25883456), (0x85A04F14), (0x25280C05), (0x8582FA8C), (0x24C7CCC8), (0x8565F192), (0x246777D0), (0x85493482), (0x24070B6E), (0x852CC2DA), (0x23A688D3), (0x85109CF7), (0x2345F03B), (0x84F4C2E8), (0x22E541E0), (0x84D934C0), +//(0x22847DFF), (0x84BDF290), (0x2223A4D2), (0x84A2FC68), (0x21C2B697), (0x84885258), (0x2161B389), (0x846DF472), (0x21009BE3), (0x8453E2C5), (0x209F6FE1), (0x843A1D62), (0x203E2FC0), (0x8420A459), (0x1FDCDBBB), (0x840777B9), (0x1F7B740F), (0x83EE9792), +//(0x1F19F9F0), (0x83D60431), (0x1EB86BA9), (0x83BDBD28), (0x1E56CA6E), (0x83A5C2C5), (0x1DF5167D), (0x838E1518), (0x1D935011), (0x8376B42E), (0x1D317767), (0x835FA017), (0x1CCF8CBB), (0x8348D8DF), (0x1C6D9049), (0x83325E96), (0x1C0B824E), (0x831C314A), +//(0x1BA96306), (0x83065107), (0x1B4732AE), (0x82F0BDDB), (0x1AE4F182), (0x82DB77D5), (0x1A829FC0), (0x82C67F00), (0x1A203DA3), (0x82B1D36A), (0x19BDCC63), (0x829D7553), (0x195B4A48), (0x82896460), (0x18F8B888), (0x8275A0D1), (0x18961761), (0x82622AB3), +//(0x18336710), (0x824F0211), (0x17D0A7D1), (0x823C26F8), (0x176DD9E1), (0x82299974), (0x170AFD7D), (0x8217598E), (0x16A812E3), (0x82056754), (0x16451A4E), (0x81F3C2CF), (0x15E213FD), (0x81E26C0B), (0x157F002D), (0x81D16313), (0x151BDF19), (0x81C0A7F1), +//(0x14B8B101), (0x81B03AAF), (0x1455771D), (0x81A01B80), (0x13F22FB1), (0x81904A1C), (0x138EDBF8), (0x8180C6B6), (0x132B7C2E), (0x81719158), (0x12C81090), (0x8162AA0A), (0x1264995D), (0x815410D8), (0x120116D2), (0x8145C5C8), (0x119D892B), (0x8137C8E5), +//(0x1139F0A7), (0x812A1A36), (0x10D64D82), (0x811CB9C4), (0x10729FFB), (0x810FA798), (0x100EE84E), (0x8102E3B9), (0x0FAB26B9), (0x80F66E30), (0x0F475C78), (0x80EA4722), (0x0EE387CD), (0x80DE6E5A), (0x0E7FA9F2), (0x80D2E3FD), (0x0E1BC326), (0x80C7A813), +//(0x0DB7D3A5), (0x80BCBAA3), (0x0D53DBAF), (0x80B21BB4), (0x0CEFDB80), (0x80A7CB4C), (0x0C8BD356), (0x809DC971), (0x0C27C36E), (0x8094162B), (0x0BC3AC07), (0x808AB17E), (0x0B5F8D5F), (0x80819B70), (0x0AFB67B2), (0x8078D407), (0x0A973B3F), (0x80705B49), +//(0x0A330844), (0x8068313B), (0x09CECFFE), (0x806055F5), (0x096A90AB), (0x8058C955), (0x09064B8A), (0x80518B72), (0x08A200D7), (0x804A9C53), (0x083DB0D1), (0x8043FBFA), (0x07D95BB6), (0x803DAA6D), (0x077501C3), (0x8037A7AE), (0x0710A337), (0x8031F3C3), +//(0x06AC404F), (0x802C8EAD), (0x0647D949), (0x80277871), (0x05E36E63), (0x8022B112), (0x057EFFDC), (0x801E3892), (0x051A8DF1), (0x801A0EF5), (0x04B618DF), (0x8016343D), (0x0451A1E6), (0x8012A875), (0x03ED2743), (0x800F6B8D), (0x0388AA33), (0x800C7D90), +//(0x03242AF6), (0x8009DE81), (0x02BFA9C9), (0x80078E61), (0x025B26E9), (0x80058D31), (0x01F6A296), (0x8003DAF2), (0x01921D0C), (0x800277A7), (0x012D968B), (0x8001634F), (0x00C90F4F), (0x80009DEB), (0x00648797), (0x8000277C), (0xFFFFFFA3), (0x80000002), +//(0xFF9B77AD), (0x8000277C), (0xFF36F0F5), (0x80009DEB), (0xFED269BA), (0x8001634E), (0xFE6DE338), (0x800277A6), (0xFE095DAF), (0x8003DAF1), (0xFDA4D95B), (0x80058D2F), (0xFD40567C), (0x80078E5F), (0xFCDBD54E), (0x8009DE7F), (0xFC775611), (0x800C7D8E), +//(0xFC12D902), (0x800F6B8A), (0xFBAE5E5E), (0x8012A872), (0xFB49E665), (0x80163444), (0xFAE57154), (0x801A0EFD), (0xFA80FF69), (0x801E389A), (0xFA1C90E1), (0x8022B11B), (0xF9B826FB), (0x8027786E), (0xF953BFF6), (0x802C8EA9), (0xF8EF5D0E), (0x8031F3BF), +//(0xF88AFE81), (0x8037A7AA), (0xF826A48E), (0x803DAA69), (0xF7C24F73), (0x8043FBF6), (0xF75DFF6D), (0x804A9C4E), (0xF6F9B4BB), (0x80518B6E), (0xF6956F99), (0x8058C950), (0xF6313046), (0x806055F0), (0xF5CCF701), (0x8068314A), (0xF568C405), (0x80705B59), +//(0xF5049793), (0x8078D418), (0xF4A071E6), (0x80819B81), (0xF43C543D), (0x808AB177), (0xF3D83CD6), (0x80941624), (0xF3742CEE), (0x809DC96B), (0xF31024C4), (0x80A7CB45), (0xF2AC2495), (0x80B21BAD), (0xF2482C9F), (0x80BCBA9C), (0xF1E43D1E), (0x80C7A80C), +//(0xF1805652), (0x80D2E3F5), (0xF11C7877), (0x80DE6E52), (0xF0B8A3CC), (0x80EA471A), (0xF054D88D), (0x80F66E47), (0xEFF116F8), (0x8102E3D1), (0xEF8D5F4B), (0x810FA7B0), (0xEF29B2C2), (0x811CB9BB), (0xEEC60F9D), (0x812A1A2D), (0xEE627718), (0x8137C8DB), +//(0xEDFEE972), (0x8145C5BE), (0xED9B66E6), (0x815410CE), (0xED37EFB3), (0x8162AA00), (0xECD48416), (0x8171914D), (0xEC71244C), (0x8180C6AB), (0xEC0DD092), (0x81904A11), (0xEBAA8927), (0x81A01B75), (0xEB474E46), (0x81B03ACD), (0xEAE4202D), (0x81C0A810), +//(0xEA80FF1A), (0x81D16333), (0xEA1DEB4A), (0x81E26C2C), (0xE9BAE5F5), (0x81F3C2C3), (0xE957ED61), (0x82056748), (0xE8F502C6), (0x82175982), (0xE8922662), (0x82299967), (0xE82F5872), (0x823C26EC), (0xE7CC9933), (0x824F0204), (0xE769E8E2), (0x82622AA6), +//(0xE70747BB), (0x8275A0C3), (0xE6A4B5FB), (0x82896452), (0xE64233E0), (0x829D7545), (0xE5DFC1A5), (0x82B1D390), (0xE57D5F89), (0x82C67F27), (0xE51B0DC6), (0x82DB77FC), (0xE4B8CC9B), (0x82F0BE03), (0xE4569D3D), (0x830650F8), (0xE3F47DF5), (0x831C313B), +//(0xE3926FFA), (0x83325E87), (0xE3307388), (0x8348D8D0), (0xE2CE88DB), (0x835FA007), (0xE26CB031), (0x8376B41E), (0xE20AE9C5), (0x838E1508), (0xE1A935D4), (0x83A5C2B5), (0xE147949A), (0x83BDBD17), (0xE0E60653), (0x83D60420), (0xE0848B3B), (0x83EE97C0), +//(0xE023238F), (0x840777E8), (0xDFC1CF8A), (0x8420A488), (0xDF608F69), (0x843A1D92), (0xDEFF645F), (0x8453E2B4), (0xDE9E4CB9), (0x846DF460), (0xDE3D49AB), (0x84885246), (0xDDDC5B6F), (0x84A2FC55), (0xDD7B8243), (0x84BDF27E), (0xDD1ABE62), (0x84D934AE), +//(0xDCBA1007), (0x84F4C2D6), (0xDC59776E), (0x85109CE4), (0xDBF8F4D3), (0x852CC2C7), (0xDB988872), (0x8549346E), (0xDB383285), (0x8565F1C8), (0xDAD7F348), (0x8582FAC2), (0xDA77CAF6), (0x85A04F4B), (0xDA17BAC1), (0x85BDEF05), (0xD9B7C0F8), (0x85DBDA73), +//(0xD957DECD), (0x85FA113A), (0xD8F8147A), (0x86189346), (0xD898623B), (0x86376085), (0xD838C84A), (0x865678E3), (0xD7D946E3), (0x8675DC4D), (0xD779DE41), (0x86958AB0), (0xD71A8E9D), (0x86B583F8), (0xD6BB5834), (0x86D5C812), (0xD65C3B40), (0x86F656E9), +//(0xD5FD37FB), (0x8717306B), (0xD59E4EA0), (0x87385481), (0xD53F7F6A), (0x8759C319), (0xD4E0CB84), (0x877B7BC6), (0xD4823147), (0x879D7F20), (0xD423B1DD), (0x87BFCCBD), (0xD3C54D82), (0x87E26488), (0xD367046F), (0x8805466A), (0xD308D6DE), (0x8828724F), +//(0xD2AAC50A), (0x884BE820), (0xD24CCF2D), (0x886FA7C8), (0xD1EEF581), (0x8893B132), (0xD191383F), (0x88B80446), (0xD13397A2), (0x88DCA0EE), (0xD0D613E3), (0x89018713), (0xD078AD3C), (0x8926B6A0), (0xD01B63E6), (0x894C2F7D), (0xCFBE3908), (0x8971F132), +//(0xCF612B01), (0x8997FC68), (0xCF043AF8), (0x89BE50A8), (0xCEA76927), (0x89E4EDDB), (0xCE4AB5C6), (0x8A0BD3E8), (0xCDEE210E), (0x8A3302B8), (0xCD91AB39), (0x8A5A7A32), (0xCD355480), (0x8A823A3F), (0xCCD91D1C), (0x8AAA42C5), (0xCC7D0545), (0x8AD293AC), +//(0xCC210D35), (0x8AFB2CDB), (0xCBC53524), (0x8B240E38), (0xCB697D4B), (0x8B4D37AC), (0xCB0DE6CB), (0x8B76A8B2), (0xCAB2700B), (0x8BA06204), (0xCA571A2C), (0x8BCA631F), (0xC9FBE567), (0x8BF4ABE9), (0xC9A0D1F3), (0x8C1F3C49), (0xC945E00A), (0x8C4A1423), +//(0xC8EB0FE3), (0x8C75335D), (0xC89061B6), (0x8CA099DE), (0xC835D5BB), (0x8CCC4789), (0xC7DB6C2A), (0x8CF83C44), (0xC781253B), (0x8D2477F5), (0xC7270126), (0x8D50FA7F), (0xC6CD0021), (0x8D7DC3C7), (0xC6732265), (0x8DAAD3B2), (0xC619682A), (0x8DD82A23), +//(0xC5BFD1A5), (0x8E05C6FF), (0xC5665F0F), (0x8E33AA2A), (0xC50D109F), (0x8E61D388), (0xC4B3E68C), (0x8E9042FB), (0xC45AE10D), (0x8EBEF868), (0xC4020058), (0x8EEDF3B1), (0xC3A94669), (0x8F1D33C8), (0xC350AFEE), (0x8F4CBA71), (0xC2F83EE1), (0x8F7C86A0), +//(0xC29FF37B), (0x8FAC9836), (0xC247CDF0), (0x8FDCEF16), (0xC1EFCE78), (0x900D8B21), (0xC197F548), (0x903E6C3B), (0xC1404298), (0x906F9245), (0xC0E8B69C), (0x90A0FD21), (0xC091518B), (0x90D2ACAF), (0xC03A139B), (0x9104A0D2), (0xBFE2FD02), (0x9136D96B), +//(0xBF8C0DF6), (0x9169565A), (0xBF3546AB), (0x919C1781), (0xBEDEA758), (0x91CF1CC0), (0xBE883032), (0x920265F8), (0xBE31E16E), (0x9235F309), (0xBDDBBB42), (0x9269C3D3), (0xBD85BDE2), (0x929DD837), (0xBD2FE985), (0x92D23013), (0xBCDA3E5E), (0x9306CB49), +//(0xBC84BCA2), (0x933BA9B7), (0xBC2F6487), (0x9370CB3D), (0xBBDA3641), (0x93A62FBB), (0xBB853205), (0x93DBD70E), (0xBB305806), (0x9411C116), (0xBADBA879), (0x9447EDB3), (0xBA872542), (0x947E5BAB), (0xBA32CB35), (0x94B50D09), (0xB9DE9C38), (0x94EC0097), +//(0xB98A987D), (0x95233631), (0xB936C039), (0x955AADB6), (0xB8E3139E), (0x95926705), (0xB88F92E2), (0x95CA61FA), (0xB83C3E37), (0x96029E73), (0xB7E915D0), (0x963B1C4D), (0xB79619E2), (0x9673DB66), (0xB7434A9E), (0x96ACDB9A), (0xB6F0A839), (0x96E61CC6), +//(0xB69E32E5), (0x971F9EC8), (0xB64BEAD5), (0x9759617B), (0xB5F9D03C), (0x979364BC), (0xB5A7E34D), (0x97CDA867), (0xB5562439), (0x98082C58), (0xB5049334), (0x9842F06B), (0xB4B33070), (0x987DF47C), (0xB461FC1F), (0x98B93866), (0xB410F672), (0x98F4BC06), +//(0xB3C01F9D), (0x99307F35), (0xB36F77D1), (0x996C81D0), (0xB31EFF3F), (0x99A8C3B0), (0xB2CEB61A), (0x99E544B2), (0xB27E9C92), (0x9A2204B0), (0xB22EB2DA), (0x9A5F0384), (0xB1DEF922), (0x9A9C4109), (0xB18F7130), (0x9AD9BBDF), (0xB140180C), (0x9B177652), +//(0xB0F0EF7B), (0x9B556F04), (0xB0A1F7AF), (0x9B93A5CF), (0xB05330D8), (0x9BD21A8C), (0xB0049B27), (0x9C10CD15), (0xAFB636CD), (0x9C4FBD43), (0xAF6803F9), (0x9C8EEAEF), (0xAF1A02DC), (0x9CCE55F3), (0xAECC33A5), (0x9D0DFE27), (0xAE7E9686), (0x9D4DE363), +//(0xAE312BAE), (0x9D8E0581), (0xADE3F34D), (0x9DCE6459), (0xAD96ED91), (0x9E0EFFC3), (0xAD4A1AAC), (0x9E4FD798), (0xACFD7ACC), (0x9E90EBAF), (0xACB10E20), (0x9ED23BE0), (0xAC64D4D8), (0x9F13C803), (0xAC18CF22), (0x9F558FF0), (0xABCCFD2E), (0x9F97937D), +//(0xAB815F2A), (0x9FD9D283), (0xAB35F545), (0xA01C4CD8), (0xAAEABFAE), (0xA05F0253), (0xAA9FBE92), (0xA0A1F2CC), (0xAA54F221), (0xA0E51E18), (0xAA0A5A88), (0xA128840F), (0xA9BFF7F5), (0xA16C2487), (0xA975CC0F), (0xA1AFFDFC), (0xA92BD411), (0xA1F412F7), +//(0xA8E211A2), (0xA23861F5), (0xA89884F1), (0xA27CEACD), (0xA84F2E2A), (0xA2C1AD53), (0xA8060D7A), (0xA306A95E), (0xA7BD2310), (0xA34BDEC3), (0xA7746F17), (0xA3914D57), (0xA72BF1BC), (0xA3D6F4F0), (0xA6E3AB2D), (0xA41CD562), (0xA69B9B96), (0xA462EE82), +//(0xA653C323), (0xA4A94026), (0xA60C2200), (0xA4EFCA21), (0xA5C4B85B), (0xA5368C48), (0xA57D865E), (0xA57D8670), (0xA5368C36), (0xA5C4B86D), (0xA4EFCA0F), (0xA60C2213), (0xA4A94014), (0xA653C335), (0xA462EE70), (0xA69B9BA8), (0xA41CD550), (0xA6E3AB3F), +//(0xA3D6F4DE), (0xA72BF1CF), (0xA3914D46), (0xA7746F29), (0xA34BDEB2), (0xA7BD2322), (0xA306A94D), (0xA8060D8D), (0xA2C1AD42), (0xA84F2E3D), (0xA27CEABB), (0xA8988504), (0xA23861E4), (0xA8E211B5), (0xA1F412E6), (0xA92BD424), (0xA1AFFF45), (0xA975CAA9), +//(0xA16C2476), (0xA9BFF808), (0xA12883FE), (0xAA0A5A9B), (0xA0E51E07), (0xAA54F234), (0xA0A1F2BB), (0xAA9FBEA5), (0xA05F0242), (0xAAEABFC1), (0xA01C4CC7), (0xAB35F559), (0x9FD9D272), (0xAB815F3E), (0x9F97936C), (0xABCCFD41), (0x9F558FDF), (0xAC18CF35), +//(0x9F13C7F2), (0xAC64D4EB), (0x9ED23BCF), (0xACB10E33), (0x9E90EB9E), (0xACFD7ADF), (0x9E4FD787), (0xAD4A1AC0), (0x9E0EFFB3), (0xAD96EDA5), (0x9DCE6449), (0xADE3F360), (0x9D8E0571), (0xAE312BC2), (0x9D4DE353), (0xAE7E969A), (0x9D0DFE16), (0xAECC33B9), +//(0x9CCE55E3), (0xAF1A02EF), (0x9C8EEADF), (0xAF68040D), (0x9C4FBD33), (0xAFB636E1), (0x9C10CD05), (0xB0049B3B), (0x9BD21A7C), (0xB05330EC), (0x9B93A5BF), (0xB0A1F7C3), (0x9B556EF4), (0xB0F0EF90), (0x9B177642), (0xB1401820), (0x9AD9BD09), (0xB18F6FB0), +//(0x9A9C40F9), (0xB1DEF936), (0x9A5F0375), (0xB22EB2EE), (0x9A2204A1), (0xB27E9CA6), (0x99E544A3), (0xB2CEB62E), (0x99A8C3A1), (0xB31EFF54), (0x996C81C0), (0xB36F77E5), (0x99307F26), (0xB3C01FB2), (0x98F4BBF6), (0xB410F687), (0x98B93857), (0xB461FC33), +//(0x987DF46D), (0xB4B33085), (0x9842F05C), (0xB5049349), (0x98082C49), (0xB556244E), (0x97CDA858), (0xB5A7E362), (0x979364AD), (0xB5F9D051), (0x9759616C), (0xB64BEAEA), (0x971F9EB9), (0xB69E32FA), (0x96E61CB8), (0xB6F0A84E), (0x96ACDB8B), (0xB7434AB3), +//(0x9673DB57), (0xB79619F7), (0x963B1C3F), (0xB7E915E5), (0x96029E64), (0xB83C3E4C), (0x95CA61EB), (0xB88F92F7), (0x959266F7), (0xB8E313B4), (0x955AADA8), (0xB936C04E), (0x95233623), (0xB98A9893), (0x94EC0089), (0xB9DE9C4D), (0x94B50E13), (0xBA32C99E), +//(0x947E5CB3), (0xBA8723A9), (0x9447EDA5), (0xBADBA88F), (0x9411C109), (0xBB30581B), (0x93DBD700), (0xBB85321A), (0x93A62FAD), (0xBBDA3657), (0x9370CB30), (0xBC2F649D), (0x933BA9AA), (0xBC84BCB8), (0x9306CB3C), (0xBCDA3E74), (0x92D23006), (0xBD2FE99B), +//(0x929DD829), (0xBD85BDF8), (0x9269C3C6), (0xBDDBBB58), (0x9235F2FC), (0xBE31E184), (0x920265EB), (0xBE883048), (0x91CF1CB3), (0xBEDEA76E), (0x919C1774), (0xBF3546C1), (0x9169564D), (0xBF8C0E0C), (0x9136D95E), (0xBFE2FD18), (0x9104A0C5), (0xC03A13B2), +//(0x90D2ACA2), (0xC09151A2), (0x90A0FD14), (0xC0E8B6B2), (0x906F9239), (0xC14042AE), (0x903E6C2F), (0xC197F55F), (0x900D8B15), (0xC1EFCE8E), (0x8FDCEF09), (0xC247CE07), (0x8FAC9829), (0xC29FF391), (0x8F7C8694), (0xC2F83EF8), (0x8F4CBA65), (0xC350B004), +//(0x8F1D34AD), (0xC3A944BC), (0x8EEDF3A5), (0xC402006F), (0x8EBEF85C), (0xC45AE123), (0x8E9042EF), (0xC4B3E6A3), (0x8E61D37C), (0xC50D10B6), (0x8E33AA1F), (0xC5665F26), (0x8E05C6F4), (0xC5BFD1BC), (0x8DD82A17), (0xC6196840), (0x8DAAD3A6), (0xC673227C), +//(0x8D7DC3BB), (0xC6CD0038), (0x8D50FA73), (0xC727013D), (0x8D2477E9), (0xC7812552), (0x8CF83C39), (0xC7DB6C41), (0x8CCC477E), (0xC835D5D2), (0x8CA099D3), (0xC89061CD), (0x8C753352), (0xC8EB0FFA), (0x8C4A1418), (0xC945E021), (0x8C1F3C3E), (0xC9A0D20A), +//(0x8BF4ABDF), (0xC9FBE57E), (0x8BCA6314), (0xCA571A43), (0x8BA061F9), (0xCAB27022), (0x8B76A8A7), (0xCB0DE6E2), (0x8B4D3738), (0xCB697E4C), (0x8B240DC5), (0xCBC53625), (0x8AFB2C68), (0xCC210E37), (0x8AD2933A), (0xCC7D0647), (0x8AAA4254), (0xCCD91E1E), +//(0x8A823A9A), (0xCD3553AD), (0x8A5A7A8D), (0xCD91AA66), (0x8A330312), (0xCDEE203A), (0x8A0BD442), (0xCE4AB4F1), (0x89E4EE34), (0xCEA76852), (0x89BE5100), (0xCF043A24), (0x8997FCBF), (0xCF612A2C), (0x8971F188), (0xCFBE3833), (0x894C2F73), (0xD01B63FE), +//(0x8926B697), (0xD078AD53), (0x8901870A), (0xD0D613FB), (0x88DCA0E4), (0xD13397BA), (0x88B8043C), (0xD1913857), (0x8893B128), (0xD1EEF599), (0x886FA7BF), (0xD24CCF45), (0x884BE817), (0xD2AAC522), (0x88287246), (0xD308D6F6), (0x88054661), (0xD3670487), +//(0x87E2647F), (0xD3C54D9A), (0x87BFCCB5), (0xD423B1F5), (0x879D7F18), (0xD482315F), (0x877B7BBD), (0xD4E0CB9C), (0x8759C2BA), (0xD53F8074), (0x87385424), (0xD59E4FAA), (0x8717300E), (0xD5FD3905), (0x86F6568E), (0xD65C3C4A), (0x86D5C7B7), (0xD6BB593F), +//(0x86B5839E), (0xD71A8FA8), (0x86958AF9), (0xD779DD66), (0x8675DC95), (0xD7D94608), (0x8656792A), (0xD838C76F), (0x863760CC), (0xD8986160), (0x8618938D), (0xD8F8139F), (0x85FA1180), (0xD957DDF1), (0x85DBDAB8), (0xD9B7C01C), (0x85BDEF49), (0xDA17B9E5), +//(0x85A04F43), (0xDA77CB0F), (0x8582FABB), (0xDAD7F360), (0x8565F1C1), (0xDB38329D), (0x85493467), (0xDB98888A), (0x852CC2C0), (0xDBF8F4EC), (0x85109CDD), (0xDC597787), (0x84F4C2CF), (0xDCBA1020), (0x84D934A7), (0xDD1ABE7A), (0x84BDF277), (0xDD7B825C), +//(0x84A2FC4F), (0xDDDC5B88), (0x8488523F), (0xDE3D49C3), (0x846DF45A), (0xDE9E4CD2), (0x8453E2AD), (0xDEFF6478), (0x843A1D4B), (0xDF60907A), (0x8420A441), (0xDFC1D09B), (0x840777A2), (0xE02324A0), (0x83EE977A), (0xE0848C4C), (0x83D603DC), (0xE0E60764), +//(0x83BDBCD4), (0xE14795AB), (0x83A5C2EC), (0xE1A934F4), (0x838E153E), (0xE20AE8E5), (0x8376B454), (0xE26CAF51), (0x835FA03C), (0xE2CE87FB), (0x8348D904), (0xE33072A7), (0x83325EBA), (0xE3926F19), (0x831C316D), (0xE3F47D14), (0x8306512A), (0xE4569C5C), +//(0x82F0BDFE), (0xE4B8CCB4), (0x82DB77F7), (0xE51B0DDF), (0x82C67F21), (0xE57D5FA2), (0x82B1D38B), (0xE5DFC1BE), (0x829D7540), (0xE64233F9), (0x8289644D), (0xE6A4B614), (0x8275A0BE), (0xE70747D4), (0x82622AA1), (0xE769E8FB), (0x824F0200), (0xE7CC994C), +//(0x823C26E7), (0xE82F588C), (0x82299962), (0xE892267C), (0x8217597D), (0xE8F502DF), (0x82056743), (0xE957ED7A), (0x81F3C2BF), (0xE9BAE60E), (0x81E26BFB), (0xEA1DEC5F), (0x81D16303), (0xEA810030), (0x81C0A7E1), (0xEAE42143), (0x81B03AA0), (0xEB474F5C), +//(0x81A01B48), (0xEBAA8A3D), (0x81904A35), (0xEC0DCFAF), (0x8180C6CF), (0xEC712368), (0x81719170), (0xECD48332), (0x8162AA22), (0xED37EECF), (0x815410EF), (0xED9B6602), (0x8145C5DF), (0xEDFEE88E), (0x8137C8FB), (0xEE627634), (0x812A1A4C), (0xEEC60EB9), +//(0x811CB9DA), (0xEF29B1DD), (0x810FA7AD), (0xEF8D5F65), (0x8102E3CE), (0xEFF11711), (0x80F66E44), (0xF054D8A6), (0x80EA4717), (0xF0B8A3E5), (0x80DE6E4F), (0xF11C7891), (0x80D2E3F2), (0xF180566B), (0x80C7A809), (0xF1E43D38), (0x80BCBA99), (0xF2482CB8), +//(0x80B21BAA), (0xF2AC24AF), (0x80A7CB42), (0xF31024DE), (0x809DC968), (0xF3742D08), (0x80941622), (0xF3D83CEF), (0x808AB175), (0xF43C5456), (0x80819B68), (0xF4A072FF), (0x8078D3FF), (0xF50498AB), (0x80705B42), (0xF568C51E), (0x80683134), (0xF5CCF819), +//(0x806055DB), (0xF631315F), (0x8058C93B), (0xF69570B2), (0x80518B7E), (0xF6F9B3D5), (0x804A9C5E), (0xF75DFE87), (0x8043FC05), (0xF7C24E8D), (0x803DAA77), (0xF826A3A8), (0x8037A7B8), (0xF88AFD9B), (0x8031F3CB), (0xF8EF5C28), (0x802C8EB5), (0xF953BF10), +//(0x80277879), (0xF9B82615), (0x8022B119), (0xFA1C90FB), (0x801E3899), (0xFA80FF82), (0x801A0EFC), (0xFAE5716D), (0x80163443), (0xFB49E67F), (0x8012A872), (0xFBAE5E78), (0x800F6B8A), (0xFC12D91B), (0x800C7D8D), (0xFC77562A), (0x8009DE7E), (0xFCDBD568), +//(0x80078E5F), (0xFD405695), (0x80058D2F), (0xFDA4D975), (0x8003DAF1), (0xFE095DC8), (0x800277A6), (0xFE6DE352), (0x8001634E), (0xFED269D3), (0x80009DEA), (0xFF36F10F), (0x8000277B), (0xFF9B78C7), (0x00000009), (0x9FC5AC28), (0x00000001), (0x00000200), +//(0x00000400), (0x8000FFD0), (0x0000000A), (0x00000009), (0x9FC5E1D8), (0x9FC56DCC), (0x800022D8), (0x9FC2CCEC), (0x8000FFD0), (0x00000000), (0x000000A0), (0x8000FF68), (0x00000000), (0xFFFFFFFF), (0x8FFFFC60), (0x00000400), (0x80012B08), (0x8000FFD0), +//(0x8000F3A0), (0x80012990), (0x9FC57FCC), (0x9FC181E8), (0x00000004), (0x8000F3C4), (0x800127D9), (0x80010FD0), (0x00000009), (0xFFFFFFFF), (0x800120E8), (0x9FC0E9E0), (0x8000F3C8), (0x00000002), (0x80012378), (0x8000F3C4), (0x8000F3A0), (0xFFFFFFFF), +//(0x8000C774), (0x00000000), (0x00000000), (0x9FC134A4), (0x00000002), (0x9FC5AC28), (0x8000F3A0), (0x00000002), (0x800022D8), (0x00000001), (0x8000F3A0), (0x00000000), (0x80012AF8), (0x00000002), (0x00000001), (0x9FC0D3BC), (0x8000C774), (0x9FC07600), +//(0x00000003), (0x8FFFFCB0), (0x00000002), (0x8000C9A0), (0x8FFFFC00), (0x00000000), (0x01010000), (0x00000000), (0x8000F420), (0x00000000), (0x00000001), (0x00000000), (0x0000FFC8), (0x00000007), (0x8000F3E8), (0x800042D8), (0x00000000), (0x8000C76C), +//(0x8000F3A0), (0x8000C774), (0x00000000), (0x00010000), (0x00000001), (0x800022D8), (0x80000548), (0x9FC06E18), (0x9FC06380), (0x00000000), (0x800022D8), (0x00000001), (0x8000F3A0), (0x8FFFFD60), (0x8000F3A0), (0x8000C760), (0x00000000), (0x80000648), +//(0x8000F3A0), (0x8FFFFF88), (0x00000000), (0x00002000), (0x800042D8), (0x800022D8), (0x9FC0386C), (0x9FC0385C), (0x00000005), (0x8FFFFF88), (0x9FC60B99), (0x80000548), (0x80002108), (0x80002100), (0x80002104), (0x8FFFFEE8), (0x80000648), (0x9FC3FD3C), +//(0x00000000), (0x80001698), (0x9FC47D40), (0x00000000), (0x00000004), (0x800018C0), (0x8FFFFE00), (0x800018C4), (0x9FC60A50), (0x01040200), (0x2E342E31), (0x00000032), (0x00000011), (0x8FFFFE00), (0x9FC52984), (0x9FC60A5C), (0x00000000), (0x8FFFFE00), +//(0x9FC52978), (0x01040400), (0x2E342E31), (0x9FC60034), (0x00000000), (0x00000000), (0x9FC52984), (0x9FC52990), (0x0001F31F), (0x9FC630C4), (0x9FC49524), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x9FC6310C), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x9FC4A214), (0x800018C0), (0x00000001), (0x9FC47468), (0x00000000), (0x00000000), (0x00000001), (0x8FFFFEC8), (0x00000000), (0x80001978), +//(0x9FC47D40), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x9FC4783C), (0x00000000), (0x00000000), (0x80001978), (0x00000003), (0x9FC63030), (0x9FC60000), (0x00000000), (0x10000000), (0x80001614), (0x80001698), (0x9FC48B08), (0x9FC63010), +//(0x9FC6307C), (0x9FC63001), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x9FC6372C), (0x00000007), (0x8000BD68), (0x00000000), (0x00000005), (0x8FFFFF88), (0x00000000), (0x9FC4D5EC), (0x00000000), (0x10000000), +//(0x9FC49264), (0x9FC49258), (0x00000000), (0x00000002), (0x00000000), (0x00000000), (0x00000001), (0xFFFFFFFF), (0x00000005), (0x8FFFFF88), (0x00000000), (0x10000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x20000000), (0x9FC014BC), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x8FFFFFA1), (0x8FFFFFDD), (0x8FFFFFE1), (0x8FFFFFF4), (0x8FFFFFF8), (0x00000000), (0x6F682F00), (0x6C2F656D), (0x6D2F686F), (0x532F746E), (0x732F4E56), (0x432F6564), +//(0x685F4B44), (0x63616165), (0x2F636564), (0x2F6E6962), (0x44636161), (0x646F6365), (0x735F7265), (0x4C5F6564), (0x78756E69), (0x66692D00), (0x65687400), (0x74736574), (0x5F313434), (0x612E636C), (0x00737464), (0x00666F2D), (0x2E706D74), (0x00766177), +//(0x8FB40060), (0x10000008), (0x8FB50064), (0x02403021), (0x0FF13E42), (0x02603821), (0x0040A021), (0x0060A821), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x15000007), (0x00000000), +//(0x106B0007), (0x00000000), (0x0BF14379), (0x00000000), (0x1080FFF7), (0x00000000), (0x02E03821), (0x02C02021), (0x1440FF96), (0x02E02821), (0x02802021), (0x1000FF93), (0x02A02821), (0x8FA60028), (0x8FA60028), (0x8FA7002C), (0x00402021), (0x00602821), +//(0x00409021), (0x00609821), (0xAFA20060), (0x0FF141EE), (0x8CC42D48), (0x8CC52D4C), (0x0FF144AE), (0x24060036), (0x8FA40068), (0x8FA5006C), (0x00403021), (0x00603821), (0x8FB20040), (0x8FB1003C), (0x8FB00038), (0x00801021), (0x00A01821), (0x03E00008), +//(0x27BD0060), (0x00002821), (0x00000000), (0x00000000), (0x00000000), (0x8000C668), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x52082450), (0x3EED1705), (0xF20FF8A1), (0x89F6E17F), (0x17D7DC00), (0x09B9F2C3), (0x6378968C), (0xAF0607F6), +//(0xFDFDE0C9), (0x3CE3DFEE), (0x5168229E), (0x7CF79734), (0xF5FFF56F), (0x30700093), (0x135F5C75), (0xE6D73EEE), (0x6E400DF9), (0x58252ACB), (0x557311CA), (0x5539B303), (0x56557355), (0xB6BDACEF), (0x59F9428D), (0x9AE63020), (0x558FF7E7), (0x7955806D), +//(0x09D549F3), (0x603BF5B7), (0x3134413B), (0xBCA7C1AA), (0xA98D1339), (0x57B29C97), (0x50F1FF07), (0xE4A13980), (0xD0881A21), (0xC1FFE30A), (0xB0A66C19), (0x18416490), (0x160E0214), (0xA584CBB5), (0x02AAA82A), (0x73981340), (0x964A24DE), (0x6E829FC4), +//(0xDFD62360), (0x4C3BF152), (0x38721574), (0xD46BC912), (0xBBD65F9D), (0xE6F02C9D), (0x867C6EEC), (0x43FAB725), (0xA4144419), (0x69BB6AAF), (0xCE27B744), (0x022241A9), (0x1EB7FDD8), (0x1CA6CBC0), (0xBBCBC111), (0xA6FD1403), (0x76C688D9), (0xB47186CB), +//(0x5E98936D), (0x9BBF7E2E), (0x8B7FBCEC), (0x9DAF7EF5), (0x7E3A79F1), (0x9C896ACD), (0x628F249A), (0xDD6E51AF), (0xAF73994B), (0x5966995D), (0xB7620597), (0x369B1E54), (0x7CEDC787), (0xE7B15B1F), (0xB36F5F7D), (0xB5B73EF6), (0xD76EEEE2), (0x14E86186), +//(0xC05DF14E), (0x8050F1FF), (0x218C2131), (0xBE25941A), (0x9041CD06), (0x1EE8A9C0), (0xD530FEDD), (0x7495C808), (0xCC159291), (0x4EC85CA3), (0xEC3C704E), (0x0B6633B3), (0x4D992D4B), (0xEB1B5774), (0xDFB9D508), (0x11783719), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x37000000), (0x000080A3), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x8C872F24), (0x0FF11B13), (0x02002021), (0x3C069FC6), +//(0x00602821), (0x0060A821), (0x24C32D48), (0x8C660000), (0x00803021), (0x0FF13AA0), (0x00A03821), (0x1000FFEC), (0x00402021), (0x8FA60068), (0x0FF13E42), (0x8FA7006C), (0x02002021), (0x00602821), (0x0FF141EE), (0x00608821), (0x04400016), (0x02002021), +//(0x3C059FC6), (0x8CA62E78), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x5C5D4A7F), (0x5C8016FF), (0x5CA2CA7F), (0x5CC575FF), (0x5CE80FFF), (0x5D0A997F), (0x5D2D1AFF), (0x5D4F8B7F), +//(0x8F87815C), (0x00402021), (0x0FF13BD0), (0x00602821), (0x00402021), (0x0FF13E45), (0x00602821), (0x0276202A), (0x004B500B), (0x24030001), (0x1543FFE9), (0x714B5820), (0x000F3D00), (0x00003021), (0x00C01021), (0x03E00008), (0x014B6825), (0x000860C0), +//(0x00007021), (0x00007821), (0x00005021), (0x10000013), (0x3C0B0040), (0x008C182B), (0x8FFF7570), (0xAE290094), (0xAE1100A8), (0x15070023), (0x8FFF7580), (0x8E0F0098), (0x8DE50020), (0x50A00020), (0xAFB20020), (0xAFB1001C), (0xAFBF0028), (0xAFB00018), +//(0x8C900020), (0x00A08821), (0x8E020008), (0x8CA50008), (0x0FF003A4), (0x00003021), (0x04400031), (0x2403001D), (0x8E260008), (0x8E25000C), (0xAE060008), (0xAE05000C), (0x0FF123AB), (0x00000000), (0x00409021), (0x8E2A0010), (0x2E490001), (0x000A402B), +//(0x1000FFEA), (0x01091024), (0x8E240008), (0x8E25000C), (0x8E660018), (0xAE05000C), (0xAE040008), (0x8E07000C), (0x8CC30094), (0x0067582A), (0x8FBF0028), (0xACC40090), (0xACC50094), (0x02401821), (0x8FBF0028), (0x8FB30024), (0x8FB20020), (0x8FB1001C), +//(0x27A40070), (0x12000005), (0x8FA20094), (0x0FF11CDB), (0x00000000), (0xAC500000), (0x2402FFFF), (0x8FBF00BC), (0x00000000), (0x10000009), (0x8E430000), (0x12200006), (0x00000000), (0x964E0010), (0x2403FFFF), (0x35CD0040), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0xFF7B0000), (0x2E8050F1), (0x10214482), (0x1BA00005), (0x0000C0FF), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x2463FFF8), (0x1060000E), (0x270703FF), (0x00601027), (0x00692804), (0x00481006), (0x00682004), (0x00021042), (0xB56DA974), (0xCACDB07C), (0x4EE1ADD4), (0xEF859B34), (0x89F47B47), (0x515C155A), (0x38D06757), (0x8050F1FF), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x8FFF6F50), (0x54414C20), (0x7573204D), (0x726F7070), (0x8FFF6F60), (0x0000000A), (0x2D2D202A), (0x57415220), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00602821), (0x02403021), (0x0FF13D01), (0x02603821), (0x1000FEEF), (0x00402021), (0x02002021), (0x02202821), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0xA4370000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0xFF770000), (0x2E8050F1), (0x1A214462), (0x04D6D583), (0x40031282), +//(0x6469A735), (0x0B4C99A3), (0x0AF88594), (0xF90969D7), (0x96131C92), (0x025EEA10), (0x3A1FE421), (0x614FF390), (0x1CFDC327), (0xC177E04F), (0xF4D87E82), (0x78253F39), (0xBB839F94), (0x998B3EB1), (0x80F28098), (0xDF3FABCD), (0x24D840AC), (0xBA95321C), +//(0xDC211D20), (0x15041942), (0x61858ABD), (0x546084A1), (0xA70D219C), (0x7BD52135), (0x78060F71), (0xEA3C87D8), (0x3FAF3A24), (0xE4B2C421), (0xB99D1453), (0x2741E264), (0x2239813A), (0x2944DA20), (0x441EF7C4), (0x0BD0B720), (0xED84EA26), (0x73E0C0D2), +//(0x678E3039), (0x21420109), (0x8607492E), (0x28CEF440), (0x022768C8), (0xF68E3611), (0x84E84D55), (0x73004C04), (0xF9B6630E), (0x677FFA8F), (0x530CB18F), (0x2C4EE310), (0xABC7537C), (0x82CFDBCB), (0x100C63A2), (0x876D75BA), (0xC683F888), (0x0CDC1E1E), +//(0xA600E833), (0x33036066), (0x4305049C), (0x40890713), (0x9D12532E), (0x7B6E2FE2), (0xE244CC09), (0x9FFB2082), (0xAB3735D3), (0x00000080), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x8D062F90), (0x8D072F94), (0x00402021), (0x0FF13D01), +//(0x00602821), (0x00403021), (0x02002021), (0x02202821), (0x00000000), (0x00000000), (0xF1FF7A00), (0xE23A8050), (0x841A2114), (0xC588DA75), (0x02400143), (0xAED6AAD7), (0x94C2545B), (0x3E46156C), (0x05BFDF27), (0xB0822075), (0xD24C7BC4), (0x62122054), +//(0x8CC41C49), (0x2C414972), (0x80C5DA0E), (0xD84A007C), (0x719E73C0), (0x765014B0), (0x0A391BC8), (0x60A70223), (0x54CDA46B), (0x4606D455), (0x37B6A738), (0xFFBB7D71), (0x5FEDD12F), (0xEE47FDC8), (0x3DC7913F), (0xEAEEF7FD), (0x219DADEC), (0xF9E53F5F), +//(0xB3D82D9E), (0xBBB79BCB), (0x43AD2AAB), (0x0E7ADBC0), (0xABBD0952), (0x1A6EF43A), (0xCD9B2A9D), (0x7222B366), (0x979E89E9), (0x02C9113F), (0x1D511466), (0x57A92206), (0x4A412075), (0xFD31D783), (0xA7542EFC), (0x24B76975), (0xB99962C7), (0x19F1D356), +//(0x9D12C3CB), (0x6D37D542), (0x29E7214D), (0x8900F645), (0xB154AD4A), (0xF047D988), (0xF55EE1D5), (0xC00B6932), (0x85ACE912), (0x8208B1B9), (0x80E14170), (0xA1D67C3F), (0x058035B3), (0xA4FE36CA), (0xA58ABACC), (0xC3E9831C), (0x27531B8C), (0xADBB8698), +//(0x06801C12), (0xAFAEEC8E), (0xC3269291), (0x5C2E01A0), (0x4A61087C), (0x60F21E7B), (0x6B92C670), (0xC9872364), (0x48464C97), (0x342E6499), (0xA6849A48), (0xF034002D), (0x442B4488), (0x160B0442), (0xED52CF50), (0x4D436C05), (0x6841C602), (0xA14F8A82), +//(0x9AC20DDE), (0x5B9251EE), (0x8ED998D5), (0x92B6EA22), (0x5B136C4B), (0x97C0A45B), (0x459C94A4), (0xCD9583C0), (0x6C589DF8), (0x3C9A17CD), (0x906601BF), (0x84D612E1), (0x67176F5F), (0xE47D5A44), (0x37386D5E), (0x92A4D61B), (0x28C513FB), (0x6E91599A), +//(0x653DA16D), (0xA19C39C0), (0x427690AD), (0x7005461C), (0xAB6C1EE4), (0x80BACC2D), (0x780A18C5), (0x822DC774), (0xB6043036), (0x00789C18), (0x106C9507), (0x4103A864), (0xC511585B), (0xF3E9B7F8), (0x24D79C4D), (0x31B20EB5), (0xB1C0483E), (0xE25C56B9), +//(0x96991096), (0x7CD4121F), (0x8A3B83F4), (0x704271C2), (0xB5C26ACC), (0x2B131AF0), (0x8B7FBCEC), (0x9DAF7EF5), (0x7E3A79F1), (0x9C896ACD), (0x628F249A), (0xDD6E51AF), (0xAF73994B), (0x5966995D), (0xB7620597), (0x369B1E54), (0x7CEDC787), (0xE7B15B1F), +//(0xB36F5F7D), (0xB5B73EF6), (0xD76EEEE2), (0x14E86186), (0xCC159291), (0x4EC85CA3), (0xEC3C704E), (0x0B6633B3), (0x4D992D4B), (0xEB1B5774), (0xDFB9D508), (0x11783719), (0x77BB10B0), (0xFCDF8350), (0xD34A7C65), (0xEF6E57BB), (0xECD56C68), (0x8EB7CA36), +//(0x2F26B136), (0x55631269), (0xEF1213E1), (0xA56AB844), (0xAA4B1D64), (0x64341EA9), (0x0CE9DB48), (0x460C2144), (0xADC50205), (0x515C472F), (0x136AC219), (0x4716CED1), (0xC8B8CE4E), (0x1D168210), (0x92334A81), (0x90DC910C), (0x49A00220), (0xE5F2C831), +//(0xB67DC785), (0x3C495174), (0x0D1F4C2A), (0x3AD787FD), (0xE9C9FB27), (0x7DFC2713), (0xEB39C4B3), (0x96F75F18), (0xACC3B410), (0x0FF127C3), (0x00000000), (0x8E2AB3FC), (0x000A4827), (0x004A4021), (0x01092824), (0x00A28823), (0xAFBF0034), (0xAFB7002C), +//(0xAFB60028), (0xAFB50024), (0xAFB40020), (0xAFB3001C), (0xAFB20018), (0x3C1E9FC6), (0x006B502B), (0x51400002), (0xAE23BDA0), (0x24120016), (0x0FF007E8), (0x02802021), (0x12400005), (0x02001021), (0x02118021), (0x0FF127C3), (0x02002021), (0x2407FFFF), +//(0x00502021), (0x10470004), (0x00002821), (0x3C0B8001), (0x8C630004), (0xAC860000), (0x00C02021), (0x1000FFEB), (0x8CC60000), (0xAC800000), (0x0FF0FD25), (0x24040002), (0x1C0B8260), (0x00000000), (0x33C7F780), (0x33F5E840), (0x3423D940), (0x3451B940), +//(0x347F9940), (0x34AD6880), (0x8E080008), (0xAE080004), (0x960C0010), (0xAE040000), (0x358A0002), (0x314BFFFF), (0x31691000), (0x31640008), (0x960D0010), (0x31A4FFF7), (0xA6040010), (0x960F0010), (0x31EEEFFF), (0xA60E0010), (0x8FBF0014), (0x8FB00010), +//(0x964E0010), (0x8E4A0000), (0x1540001F), (0x00C08821), (0x8E530008), (0xAE530004), (0xAE460000), (0x86440012), (0x10000013), (0xA64D0010), (0x8E430000), (0x8E510004), (0x2462FFFF), (0xAE420000), (0xA2340000), (0x965F0010), (0x529DA0D8), (0xBC180017), +//(0x19AB803B), (0x83F00020), (0x50F1FF07), (0xD4C02D80), (0xFC881A21), (0xC1BF0100), (0x5841680B), (0x103B2CC0), (0xB042C28A), (0x2324E8A8), (0x31531430), (0xEF71DD0E), (0x7C1B9D8E), (0x0998C228), (0x8FFF76F0), (0x00000000), (0x00000000), (0x00000000), +//(0x8FFF7700), (0x00000000), (0x00000000), (0x00000000), (0x03E00008), (0x2402FFFF), (0x1580FFFD), (0x00000000), (0x0BF14379), (0x00000000), (0x3C0F7FFF), (0x35EFFFFF), (0x12000024), (0x8FAA049C), (0x27A40020), (0x8FB50498), (0x02449823), (0x02B32821), +//(0x31110008), (0x1220000C), (0xB56DA974), (0xCACDB07C), (0x4EE1ADD4), (0xEF859B34), (0x89F47B47), (0x515C155A), (0x38D06757), (0x8050F1FF), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x8FFF76B0), (0x00601021), (0x03E00008), (0x27BD0028), (0x8FFF76C0), (0x00A04021), (0x00C03821), (0x1460003A), (0x8FB40020), (0x8FB3001C), (0x8FB20018), (0x8FB10014), (0x8FB00010), (0x03E00008), (0x27BD0028), (0x27BDFFE0), (0x02402021), (0x02602821), +//(0x0FF01178), (0x2631FFFF), (0x1620FFF9), (0x26100008), (0x26940001), (0x2A83000C), (0x80000948), (0x3FFFFFFF), (0x7FFFFFFD), (0x80000748), (0x9FC5DFC8), (0x764230FC), (0x30FC7642), (0x00000000), (0x8FB304EC), (0x26B20003), (0x26710001), (0x2414FFFC), +//(0x02548024), (0xAFB104EC), (0x92320000), (0x8E060000), (0x70C3F802), (0x24590001), (0xAFB904EC), (0x03F2C021), (0x93320000), (0x265EFFD0), (0x2FD7000A), (0x16E0FFF7), (0x9FC409DC), (0x9FC41AE4), (0x9FC41AE4), (0x9FC41AE4), (0x9FC41AE4), (0x9FC41AE4), +//(0x9FC41AE4), (0x9FC41AE4), (0xA600E833), (0x33036066), (0x4305049C), (0x40890713), (0x9D12532E), (0x7B6E2FE2), (0xE244CC09), (0x9FFB2082), (0x1460FFE9), (0x02A02021), (0x0FF0121E), (0x02402021), (0x0FF0118C), (0x00002021), (0x8FA54018), (0x0FF1445E), +//(0x00004812), (0x00008810), (0x000D6AC0), (0x00830019), (0x01A88025), (0x00106002), (0x00003810), (0x00001012), (0x71830001), (0x01625021), (0x014E2821), (0x00008812), (0x014B402B), (0x00AA302B), (0x000F7002), (0x00005010), (0xBA3670F0), (0x699195A2), +//(0x172D2FD0), (0xBE386D51), (0xC4AEA51C), (0x2AA77D7D), (0x8B51D3B4), (0xCF490FD9), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x8880B388), (0x4D596B2D), (0x37D74DCF), (0x58138B38), +//(0x5B7BCD4E), (0xAE6C4422), (0x4E5D1AF1), (0xDE7396A5), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x0100FEF7), (0x000000C8), (0x8000C0C0), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000001), (0x000021B2), (0x00000000), (0x00000000), (0x00000000), (0x9FC6307C), (0x00000000), +//(0x00060001), (0x00000001), (0x00000000), (0x8000C0D0), (0x8000C008), (0x00000000), (0x736E6F63), (0x00656C6F), (0x0100FEF7), (0x000000C8), (0x8000C188), (0x00000000), (0x00000000), (0x00000000), (0x00402021), (0x00602821), (0x02C03021), (0x0FF11ABF), +//(0x02E03821), (0x00408021), (0x3C029FC6), (0x8C462E70), (0x00000000), (0x00000000), (0x00000000), (0x8000C668), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x52082450), (0x3EED1705), (0xF20FF8A1), (0x89F6E17F), (0x17D7DC00), (0x09B9F2C3), +//(0x6378968C), (0xAF0607F6), (0xFDFDE0C9), (0x3CE3DFEE), (0x5168229E), (0x7CF79734), (0xF5FFF56F), (0x30700093), (0x135F5C75), (0xE6D73EEE), (0x6E400DF9), (0x58252ACB), (0x557311CA), (0x5539B303), (0x56557355), (0xB6BDACEF), (0x59F9428D), (0x9AE63020), +//(0x8000C0D0), (0x00000000), (0x00797474), (0x24030001), (0x0100FEF7), (0x000000C8), (0x8000C250), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x000021B2), (0x00000000), (0x00000000), (0x00000000), (0x9FC6307C), (0x00000000), (0x00080001), (0x00000001), (0x00000000), (0x00000000), (0x8000C198), (0x00000000), (0x30797474), (0x10470000), +//(0x0100FEF7), (0x00000408), (0x2A2A2A2A), (0x2A2A2A2A), (0x2A2A2A2A), (0x2A2A2A2A), (0x2A2A2A2A), (0x2A2A2A2A), (0x2A2A2A2A), (0x2A2A2A2A), (0x77BB10B0), (0xFCDF8350), (0xD34A7C65), (0xEF6E57BB), (0xECD56C68), (0x8EB7CA36), (0x2F26B136), (0x55631269), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x37000000), (0x000080A3), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x8C872F24), (0x0FF11B13), +//(0x02002021), (0x3C069FC6), (0x00602821), (0x0060A821), (0x24C32D48), (0x8C660000), (0x00803021), (0x0FF13AA0), (0x00A03821), (0x1000FFEC), (0x00402021), (0x8FA60068), (0x0FF13E42), (0x8FA7006C), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000001), (0x00000001), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000001), (0x10800004), (0x0100FEF7), (0x00000168), (0x80012538), (0x80012548), (0x80012648), (0x80012748), (0x80010FD0), (0x80010FD0), (0x800111D0), (0x800113D0), (0x800115D0), (0x800117D0), (0x800119D0), (0x80011BD0), (0x80011DD0), (0x800127C8), +//(0x800127D9), (0x8001297A), (0x80012985), (0x8000FF78), (0x8000FF08), (0x80011FE0), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x37000000), (0x000080A3), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x8E040000), (0x8CE50000), (0x8CE60004), (0x0FF003A2), (0x24120005), (0x00402021), (0x10400004), (0x02202821), (0x0FF123AB), (0x00000000), (0x00409021), (0x8E2A0010), +//(0x2E490001), (0x000A402B), (0x1000FFEA), (0x01091024), (0x8E240008), (0x8E25000C), (0x8E660018), (0xAE05000C), (0xAE040008), (0x8E07000C), (0x8CC30094), (0x0067582A), (0x8FBF0028), (0xACC40090), (0xACC50094), (0x02401821), (0x8FBF0028), (0x8FB30024), +//(0x8FB20020), (0x8FB1001C), (0x27A40070), (0x12000005), (0x8FA20094), (0x0FF11CDB), (0x00000000), (0xAC500000), (0x2402FFFF), (0x8FBF00BC), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0xA4370000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0xFF770000), (0x02203821), (0x0FF13BD0), (0x00602821), (0x3C049FC6), (0x8C862F40), (0x8C872F44), (0x00602821), (0x0FF13D01), (0x8FFF6F50), (0x54414C20), (0x7573204D), (0x726F7070), (0x8FFF6F60), (0x0000000A), (0x2D2D202A), (0x57415220), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x678E3039), (0x21420109), (0x8607492E), (0x28CEF440), (0x022768C8), (0xF68E3611), (0x84E84D55), (0x73004C04), (0xF9B6630E), (0x677FFA8F), (0x530CB18F), (0x2C4EE310), +//(0xABC7537C), (0x82CFDBCB), (0x100C63A2), (0x876D75BA), (0xC683F888), (0x0CDC1E1E), (0xA600E833), (0x33036066), (0x4305049C), (0x40890713), (0x9D12532E), (0x7B6E2FE2), (0xE244CC09), (0x9FFB2082), (0xAB3735D3), (0x00000080), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0xF1FF7A00), (0xE23A8050), (0x841A2114), (0xC588DA75), (0x02400143), (0xAED6AAD7), (0x94C2545B), (0x3E46156C), (0x05BFDF27), (0xB0822075), (0xD24C7BC4), (0x62122054), (0xCEDC07F4), (0xEAB2DE00), +//(0x045BC1E8), (0x82B2AE86), (0xE4BF2823), (0x9A01B47A), (0x1769438E), (0x015C7986), (0xA70D219C), (0x7BD52135), (0x78060F71), (0xEA3C87D8), (0x3FAF3A24), (0xE4B2C421), (0xB99D1453), (0x2741E264), (0x2239813A), (0x2944DA20), (0x441EF7C4), (0x0BD0B720), +//(0xED84EA26), (0x73E0C0D2), (0x678E3039), (0x21420109), (0x8607492E), (0x28CEF440), (0x022768C8), (0xF68E3611), (0x84E84D55), (0x73004C04), (0xF9B6630E), (0x677FFA8F), (0x530CB18F), (0x2C4EE310), (0xABC7537C), (0x82CFDBCB), (0x100C63A2), (0x876D75BA), +//(0xC683F888), (0x0CDC1E1E), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0xA606FB2A), (0xE4CE1557), (0x73240820), (0x8037A8B4), (0xA1D88032), (0x75A3F1C7), (0x32BB0370), (0x5F850242), (0x37B6A738), (0xFFBB7D71), (0x5FEDD12F), (0xEE47FDC8), (0x3DC7913F), (0xEAEEF7FD), +//(0x219DADEC), (0xF9E53F5F), (0xB3D82D9E), (0xBBB79BCB), (0x43AD2AAB), (0x0E7ADBC0), (0xABBD0952), (0x1A6EF43A), (0xCD9B2A9D), (0x7222B366), (0x979E89E9), (0x02C9113F), (0x1D511466), (0x57A92206), (0x4A412075), (0xFD31D783), (0xA7542EFC), (0x24B76975), +//(0xB99962C7), (0x19F1D356), (0x9D12C3CB), (0x6D37D542), (0x29E7214D), (0x8900F645), (0xB154AD4A), (0xF047D988), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x00010100), (0x00000000), (0x8000C9E8), (0x8000CBF0), (0x8000CCD0), (0x8000CDB0), (0x8000CE90), (0x00000000), (0x2F26B136), (0x55631269), (0xEF1213E1), (0xA56AB844), +//(0xAA4B1D64), (0x64341EA9), (0x0CE9DB48), (0x460C2144), (0xADC50205), (0x515C472F), (0x304C29BD), (0x76AF8711), (0x557CADB7), (0x2A9BBC8E), (0xE50E145B), (0x9C2031FD), (0xD9121A8C), (0xF51A96FD), (0x45CCBEBF), (0x5F884871), (0x66DAE291), (0x95ADC9E5), +//(0x33CF304D), (0x23C87DCE), (0xA7014FB3), (0xFB351E71), (0x8D60F66F), (0xBFD6DDD5), (0x151FE6F1), (0xDCC7935A), (0x0CACFBF0), (0xEE55A371), (0xBE46B755), (0x0F79DCD2), (0x23DFF76D), (0x83DE76D7), (0x8B0E3AEE), (0xB01BFB44), (0x4E3619FA), (0xA19F9E64), +//(0x549CB16C), (0x74649E69), (0xD8D48ADE), (0x1253AEDD), (0x80410FD2), (0x5B36889D), (0x880CE1E7), (0x56C498E7), (0xBD492AD9), (0x0899E45F), (0x8156E41D), (0x5DA539BA), (0x0AF35B2C), (0xDB89BAAE), (0xA128C966), (0xA02CEAEE), (0x8B7FBCEC), (0x9DAF7EF5), +//(0x7E3A79F1), (0x9C896ACD), (0x628F249A), (0xDD6E51AF), (0xAF73994B), (0x5966995D), (0xB7620597), (0x369B1E54), (0x7CEDC787), (0xE7B15B1F), (0xB36F5F7D), (0xB5B73EF6), (0xD76EEEE2), (0x14E86186), (0xCC159291), (0x4EC85CA3), (0xEC3C704E), (0x0B6633B3), +//(0x4D992D4B), (0xEB1B5774), (0xDFB9D508), (0x11783719), (0x9D7048E5), (0xC124569E), (0xCCB0E111), (0x15B2BB86), (0x18371D9C), (0xB2ABD94D), (0x8EC656B3), (0xBF010995), (0x465220BB), (0xC66E1FFC), (0x2C61D356), (0xAFFB176D), (0x88067E23), (0x3796F008), +//(0xC8D128F3), (0xB661A5FA), (0xF19CE4F0), (0x3F7D0345), (0xE97E6030), (0x4ABA91CF), (0xDEEDAB0C), (0x35FD1D77), (0xDD636439), (0x2F8B794C), (0x764E1D32), (0x7A8D0B1B), (0x8EACB27F), (0x577AD67B), (0x2B3FE2C5), (0x8ACD024A), (0xEDF5C42C), (0xF1CA951C), +//(0xB98B6D04), (0x6D12B864), (0x50E74D08), (0x73D1503B), (0xC7D3F6A9), (0x1F365E97), (0xE1340E59), (0x89D21B9D), (0x9B756733), (0x9024CD50), (0xE2C7FF52), (0xD9F061EF), (0x77151392), (0xA0E4A004), (0x60BE820F), (0xC7603BAF), (0xA62E3DA9), (0xA400E11F), +//(0x155111D4), (0x9030A374), (0x14185124), (0x8D043A00), (0x50945258), (0x20A6653E), (0x820D0208), (0x02028207), (0x0100FEF7), (0x000000E0), (0x00000000), (0x00000007), (0x00000038), (0x00000000), (0x00000038), (0x00010000), (0x00000000), (0x00000000), +//(0x00000000), (0x00000000), (0x00000000), (0x00000000), (0x54442D18), (0x401921FB), (0x86B2A52E), (0xBDA8BD59), (0x60DDDC8C), (0x3E21EE3B) +//}; diff --git a/libFDK/src/mips/scale.cpp b/libFDK/src/mips/scale.cpp new file mode 100644 index 0000000..31d1f7e --- /dev/null +++ b/libFDK/src/mips/scale.cpp @@ -0,0 +1,57 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2007) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#if defined(__mips_dsp) + +#ifndef FUNCTION_getScalefactor_DBL +#define FUNCTION_getScalefactor_DBL +/*! + * + * \brief Calculate max possible scale factor for input vector + * + * \return Maximum scale factor + * + * This function can constitute a significant amount of computational complexity - very much depending on the + * bitrate. Since it is a rather small function, effective assembler optimization might be possible. + * + */ +inline INT getScalefactor(const FIXP_DBL *vector, /*!< Pointer to input vector */ + INT len) /*!< Length of input vector */ +{ + INT i; + FIXP_DBL maxVal = FL2FX_DBL(0.0f); + + for(i=len;i!=0;i--){ + maxVal |= __builtin_mips_absq_s_w(*vector++); + } + + return fixMax((INT)0,(CntLeadingZeros(maxVal) - 1)); +} +#endif + +#endif /*__mips_dsp */ diff --git a/libFDK/src/qmf.cpp b/libFDK/src/qmf.cpp new file mode 100644 index 0000000..b02a066 --- /dev/null +++ b/libFDK/src/qmf.cpp @@ -0,0 +1,1125 @@ +/******************************** Fraunhofer IIS *************************** + + (C) Copyright Fraunhofer IIS (2006) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): Markus Lohwasser, Josef Hoepfl, Manuel Jander + Description: QMF filterbank + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ +/*! + \file + \brief Complex qmf analysis/synthesis, $Revision: 36871 $ + This module contains the qmf filterbank for analysis [ cplxAnalysisQmfFiltering() ] and + synthesis [ cplxSynthesisQmfFiltering() ]. It is a polyphase implementation of a complex + exponential modulated filter bank. The analysis part usually runs at half the sample rate + than the synthesis part. (So called "dual-rate" mode.) + + The coefficients of the prototype filter are specified in #sbr_qmf_64_640 (in sbr_rom.cpp). + Thus only a 64 channel version (32 on the analysis side) with a 640 tap prototype filter + are used. + + \anchor PolyphaseFiltering <h2>About polyphase filtering</h2> + The polyphase implementation of a filterbank requires filtering at the input and output. + This is implemented as part of cplxAnalysisQmfFiltering() and cplxSynthesisQmfFiltering(). + The implementation requires the filter coefficients in a specific structure as described in + #sbr_qmf_64_640_qmf (in sbr_rom.cpp). + + This module comprises the computationally most expensive functions of the SBR decoder. The accuracy of + computations is also important and has a direct impact on the overall sound quality. Therefore a special + test program is available which can be used to only test the filterbank: main_audio.cpp + + This modules also uses scaling of data to provide better SNR on fixed-point processors. See #QMF_SCALE_FACTOR (in sbr_scale.h) for details. + An interesting note: The function getScalefactor() can constitute a significant amount of computational complexity - very much depending on the + bitrate. Since it is a rather small function, effective assembler optimization might be possible. + +*/ + +#include "qmf.h" + + +#include "fixpoint_math.h" +#include "dct.h" + +#ifdef QMFSYN_STATES_16BIT +#define QSSCALE (7) +#define FX_DBL2FX_QSS(x) ((FIXP_QSS) ((x)>>(DFRACT_BITS-QSS_BITS-QSSCALE) )) +#define FX_QSS2FX_DBL(x) ((FIXP_DBL)((LONG)x)<<(DFRACT_BITS-QSS_BITS-QSSCALE)) +#else +#define QSSCALE (0) +#define FX_DBL2FX_QSS(x) (x) +#define FX_QSS2FX_DBL(x) (x) +#endif + + +#if defined(__arm__) +#include "arm/qmf_arm.cpp" + +#endif + +/*! + * \brief Algorithmic scaling in sbrForwardModulation() + * + * The scaling in sbrForwardModulation() is caused by: + * + * \li 1 R_SHIFT in sbrForwardModulation() + * \li 5/6 R_SHIFT in dct3() if using 32/64 Bands + * \li 1 ommited gain of 2.0 in qmfForwardModulation() + */ +#define ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK 7 + +/*! + * \brief Algorithmic scaling in cplxSynthesisQmfFiltering() + * + * The scaling in cplxSynthesisQmfFiltering() is caused by: + * + * \li 5/6 R_SHIFT in dct2() if using 32/64 Bands + * \li 1 ommited gain of 2.0 in qmfInverseModulation() + * \li -6 division by 64 in synthesis filterbank + * \li x bits external influence + */ +#define ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK 1 + + +/*! + \brief Perform Synthesis Prototype Filtering on a single slot of input data. + + The filter takes 2 * qmf->no_channels of input data and + generates qmf->no_channels time domain output samples. +*/ +static +#ifndef FUNCTION_qmfSynPrototypeFirSlot +void qmfSynPrototypeFirSlot( +#else +void qmfSynPrototypeFirSlot_fallback( +#endif + HANDLE_QMF_FILTER_BANK qmf, + FIXP_QMF *RESTRICT realSlot, /*!< Input: Pointer to real Slot */ + FIXP_QMF *RESTRICT imagSlot, /*!< Input: Pointer to imag Slot */ + INT_PCM *RESTRICT timeOut, /*!< Time domain data */ + int stride + ) +{ + FIXP_QSS* FilterStates = (FIXP_QSS*)qmf->FilterStates; + int no_channels = qmf->no_channels; + const FIXP_PFT *p_Filter = qmf->p_filter; + int p_stride = qmf->p_stride; + int j; + FIXP_QSS *RESTRICT sta = FilterStates; + const FIXP_PFT *RESTRICT p_flt, *RESTRICT p_fltm; + int scale = ((DFRACT_BITS-SAMPLE_BITS)-1-qmf->outScalefactor); + + p_flt = p_Filter+p_stride*QMF_NO_POLY; /* 5-ter von 330 */ + p_fltm = p_Filter+(qmf->FilterSize/2)-p_stride*QMF_NO_POLY; /* 5 + (320 - 2*5) = 315-ter von 330 */ + + FDK_ASSERT(SAMPLE_BITS-1-qmf->outScalefactor >= 0); // (DFRACT_BITS-SAMPLE_BITS)-1-qmf->outScalefactor >= 0); + + for (j = no_channels-1; j >= 0; j--) { /* ---- läuft ueber alle Linien eines Slots ---- */ + FIXP_QMF imag = imagSlot[j]; // no_channels-1 .. 0 + FIXP_QMF real = realSlot[j]; // ~~"~~ + { + INT_PCM tmp; + FIXP_DBL Are = FX_QSS2FX_DBL(sta[0]) + fMultDiv2( p_fltm[0] , real); + + if (qmf->outGain!=(FIXP_DBL)0x80000000) { + Are = fMult(Are,qmf->outGain); + } + + #if SAMPLE_BITS > 16 + tmp = (INT_PCM)(SATURATE_SHIFT(fAbs(Are), scale, SAMPLE_BITS)); + #else + tmp = (INT_PCM)(SATURATE_RIGHT_SHIFT(fAbs(Are), scale, SAMPLE_BITS)); + #endif + if (Are < (FIXP_QMF)0) { + tmp = -tmp; + } + timeOut[ (j)*stride ] = tmp; + } + + sta[0] = sta[1] + FX_DBL2FX_QSS(fMultDiv2( p_flt [4] , imag )); + sta[1] = sta[2] + FX_DBL2FX_QSS(fMultDiv2( p_fltm[1] , real )); + sta[2] = sta[3] + FX_DBL2FX_QSS(fMultDiv2( p_flt [3] , imag )); + sta[3] = sta[4] + FX_DBL2FX_QSS(fMultDiv2( p_fltm[2] , real )); + sta[4] = sta[5] + FX_DBL2FX_QSS(fMultDiv2( p_flt [2] , imag )); + sta[5] = sta[6] + FX_DBL2FX_QSS(fMultDiv2( p_fltm[3] , real )); + sta[6] = sta[7] + FX_DBL2FX_QSS(fMultDiv2( p_flt [1] , imag )); + sta[7] = sta[8] + FX_DBL2FX_QSS(fMultDiv2( p_fltm[4] , real )); + sta[8] = FX_DBL2FX_QSS(fMultDiv2( p_flt [0] , imag )); + + p_flt += (p_stride*QMF_NO_POLY); + p_fltm -= (p_stride*QMF_NO_POLY); + sta += 9; // = (2*QMF_NO_POLY-1); + } +} + +#ifndef FUNCTION_qmfSynPrototypeFirSlot_NonSymmetric +/*! + \brief Perform Synthesis Prototype Filtering on a single slot of input data. + + The filter takes 2 * qmf->no_channels of input data and + generates qmf->no_channels time domain output samples. +*/ +static +void qmfSynPrototypeFirSlot_NonSymmetric( + HANDLE_QMF_FILTER_BANK qmf, + FIXP_QMF *RESTRICT realSlot, /*!< Input: Pointer to real Slot */ + FIXP_QMF *RESTRICT imagSlot, /*!< Input: Pointer to imag Slot */ + INT_PCM *RESTRICT timeOut, /*!< Time domain data */ + int stride + ) +{ + FIXP_QSS* FilterStates = (FIXP_QSS*)qmf->FilterStates; + int no_channels = qmf->no_channels; + const FIXP_PFT *p_Filter = qmf->p_filter; + int p_stride = qmf->p_stride; + int j; + FIXP_QSS *RESTRICT sta = FilterStates; + const FIXP_PFT *RESTRICT p_flt, *RESTRICT p_fltm; + int scale = ((DFRACT_BITS-SAMPLE_BITS)-1-qmf->outScalefactor); + + p_flt = p_Filter; /*!< Pointer to first half of filter coefficients */ + p_fltm = &p_flt[qmf->FilterSize/2]; /* at index 320, overall 640 coefficients */ + + FDK_ASSERT(SAMPLE_BITS-1-qmf->outScalefactor >= 0); // (DFRACT_BITS-SAMPLE_BITS)-1-qmf->outScalefactor >= 0); + + for (j = no_channels-1; j >= 0; j--) { /* ---- läuft ueber alle Linien eines Slots ---- */ + + FIXP_QMF imag = imagSlot[j]; // no_channels-1 .. 0 + FIXP_QMF real = realSlot[j]; // ~~"~~ + { + INT_PCM tmp; + FIXP_QMF Are = sta[0] + FX_DBL2FX_QSS(fMultDiv2( p_fltm[4] , real )); + + #if SAMPLE_BITS > 16 + tmp = (INT_PCM)(SATURATE_SHIFT(fAbs(Are), scale, SAMPLE_BITS)); + #else + tmp = (INT_PCM)(SATURATE_RIGHT_SHIFT(fAbs(Are), scale, SAMPLE_BITS)); + #endif + if (Are < (FIXP_QMF)0) { + tmp = -tmp; + } + timeOut[j*stride] = tmp; + } + + sta[0] = sta[1] + FX_DBL2FX_QSS(fMultDiv2( p_flt [4] , imag )); + sta[1] = sta[2] + FX_DBL2FX_QSS(fMultDiv2( p_fltm[3] , real )); + sta[2] = sta[3] + FX_DBL2FX_QSS(fMultDiv2( p_flt [3] , imag )); + + sta[3] = sta[4] + FX_DBL2FX_QSS(fMultDiv2( p_fltm[2] , real )); + sta[4] = sta[5] + FX_DBL2FX_QSS(fMultDiv2( p_flt [2] , imag )); + sta[5] = sta[6] + FX_DBL2FX_QSS(fMultDiv2( p_fltm[1] , real )); + sta[6] = sta[7] + FX_DBL2FX_QSS(fMultDiv2( p_flt [1] , imag )); + + sta[7] = sta[8] + FX_DBL2FX_QSS(fMultDiv2( p_fltm[0] , real )); + sta[8] = FX_DBL2FX_QSS(fMultDiv2( p_flt [0] , imag )); + + p_flt += (p_stride*QMF_NO_POLY); + p_fltm += (p_stride*QMF_NO_POLY); + sta += 9; // = (2*QMF_NO_POLY-1); + } + +} +#endif /* FUNCTION_qmfSynPrototypeFirSlot_NonSymmetric */ + +#ifndef FUNCTION_qmfAnaPrototypeFirSlot +/*! + \brief Perform Analysis Prototype Filtering on a single slot of input data. +*/ +static +void qmfAnaPrototypeFirSlot( FIXP_QMF *analysisBuffer, + int no_channels, /*!< Number channels of analysis filter */ + const FIXP_PFT *p_filter, + int p_stride, /*!< Stide of analysis filter */ + FIXP_QAS *RESTRICT pFilterStates + ) +{ + int k; + + FIXP_DBL accu; + const FIXP_PFT *RESTRICT p_flt = p_filter; + FIXP_QMF *RESTRICT pData_0 = analysisBuffer + 2*no_channels - 1; + FIXP_QMF *RESTRICT pData_1 = analysisBuffer; + + FIXP_QAS *RESTRICT sta_0 = (FIXP_QAS *)pFilterStates; + FIXP_QAS *RESTRICT sta_1 = (FIXP_QAS *)pFilterStates + (2*QMF_NO_POLY*no_channels) - 1; + int pfltStep = QMF_NO_POLY * (p_stride); + int staStep1 = no_channels<<1; + int staStep2 = (no_channels<<3) - 1; /* Rewind one less */ + + /* FIR filter 0 */ + accu = fMultDiv2( p_flt[0], *sta_1); sta_1 -= staStep1; + accu += fMultDiv2( p_flt[1], *sta_1); sta_1 -= staStep1; + accu += fMultDiv2( p_flt[2], *sta_1); sta_1 -= staStep1; + accu += fMultDiv2( p_flt[3], *sta_1); sta_1 -= staStep1; + accu += fMultDiv2( p_flt[4], *sta_1); + *pData_1++ = FX_DBL2FX_QMF(accu<<1); + sta_1 += staStep2; + + p_flt += pfltStep; + + /* FIR filters 1..63 127..65 */ + for (k=0; k<no_channels-1; k++) + { + accu = fMultDiv2( p_flt[0], *sta_0); sta_0 += staStep1; + accu += fMultDiv2( p_flt[1], *sta_0); sta_0 += staStep1; + accu += fMultDiv2( p_flt[2], *sta_0); sta_0 += staStep1; + accu += fMultDiv2( p_flt[3], *sta_0); sta_0 += staStep1; + accu += fMultDiv2( p_flt[4], *sta_0); + *pData_0-- = FX_DBL2FX_QMF(accu<<1); + sta_0 -= staStep2; + + accu = fMultDiv2( p_flt[0], *sta_1); sta_1 -= staStep1; + accu += fMultDiv2( p_flt[1], *sta_1); sta_1 -= staStep1; + accu += fMultDiv2( p_flt[2], *sta_1); sta_1 -= staStep1; + accu += fMultDiv2( p_flt[3], *sta_1); sta_1 -= staStep1; + accu += fMultDiv2( p_flt[4], *sta_1); + *pData_1++ = FX_DBL2FX_QMF(accu<<1); + sta_1 += staStep2; + + p_flt += pfltStep; + } + + /* FIR filter 64 */ + accu = fMultDiv2( p_flt[0], *sta_0); sta_0 += staStep1; + accu += fMultDiv2( p_flt[1], *sta_0); sta_0 += staStep1; + accu += fMultDiv2( p_flt[2], *sta_0); sta_0 += staStep1; + accu += fMultDiv2( p_flt[3], *sta_0); sta_0 += staStep1; + accu += fMultDiv2( p_flt[4], *sta_0); + *pData_0-- = FX_DBL2FX_QMF(accu<<1); + sta_0 -= staStep2; +} +#endif /* !defined(FUNCTION_qmfAnaPrototypeFirSlot) */ + + +#ifndef FUNCTION_qmfAnaPrototypeFirSlot_NonSymmetric +/*! + \brief Perform Analysis Prototype Filtering on a single slot of input data. +*/ +static +void qmfAnaPrototypeFirSlot_NonSymmetric( + FIXP_QMF *analysisBuffer, + int no_channels, /*!< Number channels of analysis filter */ + const FIXP_PFT *p_filter, + int p_stride, /*!< Stide of analysis filter */ + FIXP_QAS *RESTRICT pFilterStates + ) +{ + const FIXP_PFT *RESTRICT p_flt = p_filter; + int p, k; + + for (k = 0; k < 2*no_channels; k++) + { + FIXP_DBL accu = (FIXP_DBL)0; + + p_flt += QMF_NO_POLY * (p_stride - 1); + + /* + Perform FIR-Filter + */ + for (p = 0; p < QMF_NO_POLY; p++) { + accu += fMultDiv2(*p_flt++, pFilterStates[2*no_channels * p]); + } + analysisBuffer[2*no_channels - 1 - k] = FX_DBL2FX_QMF(accu<<1); + pFilterStates++; + } +} +#endif /* FUNCTION_qmfAnaPrototypeFirSlot_NonSymmetric */ + +/*! + * + * \brief Perform real-valued forward modulation of the time domain + * data of timeIn and stores the real part of the subband + * samples in rSubband + * + */ +static void +qmfForwardModulationLP_even( HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Analysis Bank */ + FIXP_QMF *timeIn, /*!< Time Signal */ + FIXP_QMF *rSubband ) /*!< Real Output */ +{ + int i; + int L = anaQmf->no_channels; + int M = L>>1; + int scale; + FIXP_QMF accu; + + const FIXP_QMF *timeInTmp1 = (FIXP_QMF *) &timeIn[3 * M]; + const FIXP_QMF *timeInTmp2 = timeInTmp1; + FIXP_QMF *rSubbandTmp = rSubband; + + rSubband[0] = timeIn[3 * M] >> 1; + + for (i = M-1; i != 0; i--) { + accu = ((*--timeInTmp1) >> 1) + ((*++timeInTmp2) >> 1); + *++rSubbandTmp = accu; + } + + timeInTmp1 = &timeIn[2 * M]; + timeInTmp2 = &timeIn[0]; + rSubbandTmp = &rSubband[M]; + + for (i = L-M; i != 0; i--) { + accu = ((*timeInTmp1--) >> 1) - ((*timeInTmp2++) >> 1); + *rSubbandTmp++ = accu; + } + + dct_III(rSubband, timeIn, L, &scale); +} + +#if !defined(FUNCTION_qmfForwardModulationLP_odd) +static void +qmfForwardModulationLP_odd( HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Analysis Bank */ + const FIXP_QMF *timeIn, /*!< Time Signal */ + FIXP_QMF *rSubband ) /*!< Real Output */ +{ + int i; + int L = anaQmf->no_channels; + int M = L>>1; + int shift = (anaQmf->no_channels>>6) + 1; + + for (i = 0; i < M; i++) { + rSubband[M + i] = (timeIn[L - 1 - i]>>1) - (timeIn[i]>>shift); + rSubband[M - 1 - i] = (timeIn[L + i]>>1) + (timeIn[2 * L - 1 - i]>>shift); + } + + dct_IV(rSubband, L, &shift); +} +#endif /* !defined(FUNCTION_qmfForwardModulationLP_odd) */ + + + +/*! + * + * \brief Perform complex-valued forward modulation of the time domain + * data of timeIn and stores the real part of the subband + * samples in rSubband, and the imaginary part in iSubband + * + * Only the lower bands are obtained (upto anaQmf->lsb). For + * a full bandwidth analysis it is required to set both anaQmf->lsb + * and anaQmf->usb to the amount of QMF bands. + * + */ +static void +qmfForwardModulationHQ( HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Analysis Bank */ + const FIXP_QMF *RESTRICT timeIn, /*!< Time Signal */ + FIXP_QMF *RESTRICT rSubband, /*!< Real Output */ + FIXP_QMF *RESTRICT iSubband /*!< Imaginary Output */ + ) +{ + int i; + int L = anaQmf->no_channels; + int L2 = L<<1; + int shift = 0; + + for (i = 0; i < L; i+=2) { + FIXP_QMF x0, x1, y0, y1; + + x0 = timeIn[i] >> 1; + x1 = timeIn[i+1] >> 1; + y0 = timeIn[L2 - 1 - i] >> 1; + y1 = timeIn[L2 - 2 - i] >> 1; + + rSubband[i] = x0 - y0; + rSubband[i+1] = x1 - y1; + iSubband[i] = x0 + y0; + iSubband[i+1] = x1 + y1; + } + + dct_IV(rSubband, L, &shift); + dst_IV(iSubband, L, &shift); + + { + { + const FIXP_QTW *RESTRICT sbr_t_cos; + const FIXP_QTW *RESTRICT sbr_t_sin; + sbr_t_cos = anaQmf->t_cos; + sbr_t_sin = anaQmf->t_sin; + + for (i = 0; i < anaQmf->lsb; i++) { + cplxMult(&iSubband[i], &rSubband[i], iSubband[i], rSubband[i], sbr_t_cos[i], sbr_t_sin[i]); + } + } + } +} + +/* + * \brief Perform one QMF slot analysis of the time domain data of timeIn + * with specified stride and stores the real part of the subband + * samples in rSubband, and the imaginary part in iSubband + * + * Only the lower bands are obtained (upto anaQmf->lsb). For + * a full bandwidth analysis it is required to set both anaQmf->lsb + * and anaQmf->usb to the amount of QMF bands. + */ +void +qmfAnalysisFilteringSlot( HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_QMF *qmfReal, /*!< Low and High band, real */ + FIXP_QMF *qmfImag, /*!< Low and High band, imag */ + const INT_PCM *RESTRICT timeIn, /*!< Pointer to input */ + const int stride, /*!< stride factor of input */ + FIXP_QMF *pWorkBuffer /*!< pointer to temporal working buffer */ + ) +{ + int i; + int offset = anaQmf->no_channels*(QMF_NO_POLY*2-1); + /* + Feed time signal into oldest anaQmf->no_channels states + */ + { + FIXP_QAS *RESTRICT FilterStatesAnaTmp = ((FIXP_QAS*)anaQmf->FilterStates)+offset; + + /* Feed and scale actual time in slot */ + for(i=anaQmf->no_channels>>1; i!=0; i--) { + /* Place INT_PCM value left aligned in scaledTimeIn */ +#if (QAS_BITS==SAMPLE_BITS) + *FilterStatesAnaTmp++ = (FIXP_QAS)*timeIn; timeIn += stride; + *FilterStatesAnaTmp++ = (FIXP_QAS)*timeIn; timeIn += stride; +#elif (QAS_BITS>SAMPLE_BITS) + *FilterStatesAnaTmp++ = (FIXP_QAS)((*timeIn)<<(QAS_BITS-SAMPLE_BITS)); timeIn += stride; + *FilterStatesAnaTmp++ = (FIXP_QAS)((*timeIn)<<(QAS_BITS-SAMPLE_BITS)); timeIn += stride; +#else + *FilterStatesAnaTmp++ = (FIXP_QAS)((*timeIn)>>(SAMPLE_BITS-QAS_BITS)); timeIn += stride; + *FilterStatesAnaTmp++ = (FIXP_QAS)((*timeIn)>>(SAMPLE_BITS-QAS_BITS)); timeIn += stride; +#endif + } + } + + if (anaQmf->flags & QMF_FLAG_NONSYMMETRIC) { + qmfAnaPrototypeFirSlot_NonSymmetric( + pWorkBuffer, + anaQmf->no_channels, + anaQmf->p_filter, + anaQmf->p_stride, + (FIXP_QAS*)anaQmf->FilterStates + ); + } else { + qmfAnaPrototypeFirSlot( pWorkBuffer, + anaQmf->no_channels, + anaQmf->p_filter, + anaQmf->p_stride, + (FIXP_QAS*)anaQmf->FilterStates + ); + } + + if (anaQmf->flags & QMF_FLAG_LP) { + if (anaQmf->flags & QMF_FLAG_CLDFB) + qmfForwardModulationLP_odd( anaQmf, + pWorkBuffer, + qmfReal ); + else + qmfForwardModulationLP_even( anaQmf, + pWorkBuffer, + qmfReal ); + + } else { + qmfForwardModulationHQ( anaQmf, + pWorkBuffer, + qmfReal, + qmfImag + ); + } + /* + Shift filter states + + Should be realized with modulo adressing on a DSP instead of a true buffer shift + */ + FDKmemmove ((FIXP_QAS*)anaQmf->FilterStates, (FIXP_QAS*)anaQmf->FilterStates+anaQmf->no_channels, offset*sizeof(FIXP_QAS)); +} + + +/*! + * + * \brief Perform complex-valued subband filtering of the time domain + * data of timeIn and stores the real part of the subband + * samples in rAnalysis, and the imaginary part in iAnalysis + * The qmf coefficient table is symmetric. The symmetry is expoited by + * shrinking the coefficient table to half the size. The addressing mode + * takes care of the symmetries. + * + * Only the lower bands are obtained (upto anaQmf->lsb). For + * a full bandwidth analysis it is required to set both anaQmf->lsb + * and anaQmf->usb to the amount of QMF bands. + * + * \sa PolyphaseFiltering + */ + +void +qmfAnalysisFiltering( HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Analysis Bank */ + FIXP_QMF **qmfReal, /*!< Pointer to real subband slots */ + FIXP_QMF **qmfImag, /*!< Pointer to imag subband slots */ + QMF_SCALE_FACTOR *scaleFactor, + const INT_PCM *timeIn, /*!< Time signal */ + const int stride, + FIXP_QMF *pWorkBuffer /*!< pointer to temporal working buffer */ + ) +{ + int i; + int no_channels = anaQmf->no_channels; + + scaleFactor->lb_scale = -ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK; + scaleFactor->lb_scale -= anaQmf->filterScale; + + for (i = 0; i < anaQmf->no_col; i++) + { + FIXP_QMF *qmfImagSlot = NULL; + + if (!(anaQmf->flags & QMF_FLAG_LP)) { + qmfImagSlot = qmfImag[i]; + } + + qmfAnalysisFilteringSlot( anaQmf, qmfReal[i], qmfImagSlot, timeIn , stride, pWorkBuffer ); + + timeIn += no_channels*stride; + + } /* no_col loop i */ +} + +/*! + * + * \brief Perform low power inverse modulation of the subband + * samples stored in rSubband (real part) and iSubband (imaginary + * part) and stores the result in pWorkBuffer. + * + */ +inline +static void +qmfInverseModulationLP_even( HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + const FIXP_QMF *qmfReal, /*!< Pointer to qmf real subband slot (input) */ + const int scaleFactorLowBand, /*!< Scalefactor for Low band */ + const int scaleFactorHighBand, /*!< Scalefactor for High band */ + FIXP_QMF *pTimeOut /*!< Pointer to qmf subband slot (output)*/ + ) +{ + int i; + int L = synQmf->no_channels; + int M = L>>1; + int scale; + FIXP_QMF tmp; + FIXP_QMF *RESTRICT tReal = pTimeOut; + FIXP_QMF *RESTRICT tImag = pTimeOut + L; + + /* Move input to output vector with offset */ + scaleValues(&tReal[0], &qmfReal[0], synQmf->lsb, scaleFactorLowBand); + scaleValues(&tReal[0+synQmf->lsb], &qmfReal[0+synQmf->lsb], synQmf->usb-synQmf->lsb, scaleFactorHighBand); + FDKmemclear(&tReal[0+synQmf->usb], (L-synQmf->usb)*sizeof(FIXP_QMF)); + + /* Dct type-2 transform */ + dct_II(tReal, tImag, L, &scale); + + /* Expand output and replace inplace the output buffers */ + tImag[0] = tReal[M]; + tImag[M] = (FIXP_QMF)0; + tmp = tReal [0]; + tReal [0] = tReal[M]; + tReal [M] = tmp; + + for (i = 1; i < M/2; i++) { + /* Imag */ + tmp = tReal[L - i]; + tImag[M - i] = tmp; + tImag[i + M] = -tmp; + + tmp = tReal[M + i]; + tImag[i] = tmp; + tImag[L - i] = -tmp; + + /* Real */ + tReal [M + i] = tReal[i]; + tReal [L - i] = tReal[M - i]; + tmp = tReal[i]; + tReal[i] = tReal [M - i]; + tReal [M - i] = tmp; + + } + /* Remaining odd terms */ + tmp = tReal[M + M/2]; + tImag[M/2] = tmp; + tImag[M/2 + M] = -tmp; + + tReal [M + M/2] = tReal[M/2]; +} + +inline +static void +qmfInverseModulationLP_odd( HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + const FIXP_QMF *qmfReal, /*!< Pointer to qmf real subband slot (input) */ + const int scaleFactorLowBand, /*!< Scalefactor for Low band */ + const int scaleFactorHighBand, /*!< Scalefactor for High band */ + FIXP_QMF *pTimeOut /*!< Pointer to qmf subband slot (output)*/ + ) +{ + int i; + int L = synQmf->no_channels; + int M = L>>1; + int shift = 0; + + /* Move input to output vector with offset */ + scaleValues(pTimeOut+M, qmfReal, synQmf->lsb, scaleFactorLowBand); + scaleValues(pTimeOut+M+synQmf->lsb, qmfReal+synQmf->lsb, synQmf->usb-synQmf->lsb, scaleFactorHighBand); + FDKmemclear(pTimeOut+M+synQmf->usb, (L-synQmf->usb)*sizeof(FIXP_QMF)); + + dct_IV(pTimeOut+M, L, &shift); + for (i = 0; i < M; i++) { + pTimeOut[i] = pTimeOut[L - 1 - i]; + pTimeOut[2 * L - 1 - i] = -pTimeOut[L + i]; + } +} + + +/*! + * + * \brief Perform complex-valued inverse modulation of the subband + * samples stored in rSubband (real part) and iSubband (imaginary + * part) and stores the result in pWorkBuffer. + * + */ +inline +static void +qmfInverseModulationHQ( HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + const FIXP_QMF *qmfReal, /*!< Pointer to qmf real subband slot */ + const FIXP_QMF *qmfImag, /*!< Pointer to qmf imag subband slot */ + const int scaleFactorLowBand, /*!< Scalefactor for Low band */ + const int scaleFactorHighBand,/*!< Scalefactor for High band */ + FIXP_QMF *pWorkBuffer /*!< WorkBuffer (output) */ + ) +{ + int i; + int L = synQmf->no_channels; + int M = L>>1; + int shift = 0; + FIXP_QMF *RESTRICT tReal = pWorkBuffer; + FIXP_QMF *RESTRICT tImag = pWorkBuffer+L; + + if (synQmf->flags & QMF_FLAG_CLDFB){ + for (i = 0; i < synQmf->lsb; i++) { + cplxMult(&tImag[i], &tReal[i], + scaleValue(qmfImag[i],scaleFactorLowBand), scaleValue(qmfReal[i],scaleFactorLowBand), + synQmf->t_cos[i], synQmf->t_sin[i]); + } + for (; i < synQmf->usb; i++) { + cplxMult(&tImag[i], &tReal[i], + scaleValue(qmfImag[i],scaleFactorHighBand), scaleValue(qmfReal[i],scaleFactorHighBand), + synQmf->t_cos[i], synQmf->t_sin[i]); + } + } + + if ( (synQmf->flags & QMF_FLAG_CLDFB) == 0) { + scaleValues(&tReal[0], &qmfReal[0], synQmf->lsb, scaleFactorLowBand); + scaleValues(&tReal[0+synQmf->lsb], &qmfReal[0+synQmf->lsb], synQmf->usb-synQmf->lsb, scaleFactorHighBand); + scaleValues(&tImag[0], &qmfImag[0], synQmf->lsb, scaleFactorLowBand); + scaleValues(&tImag[0+synQmf->lsb], &qmfImag[0+synQmf->lsb], synQmf->usb-synQmf->lsb, scaleFactorHighBand); + } + + FDKmemclear(&tReal[synQmf->usb], (synQmf->no_channels-synQmf->usb)*sizeof(FIXP_QMF)); + FDKmemclear(&tImag[synQmf->usb], (synQmf->no_channels-synQmf->usb)*sizeof(FIXP_QMF)); + + dct_IV(tReal, L, &shift); + dst_IV(tImag, L, &shift); + + if (synQmf->flags & QMF_FLAG_CLDFB){ + for (i = 0; i < M; i++) { + FIXP_QMF r1, i1, r2, i2; + r1 = tReal[i]; + i2 = tImag[L - 1 - i]; + r2 = tReal[L - i - 1]; + i1 = tImag[i]; + + tReal[i] = (r1 - i1)>>1; + tImag[L - 1 - i] = -(r1 + i1)>>1; + tReal[L - i - 1] = (r2 - i2)>>1; + tImag[i] = -(r2 + i2)>>1; + } + } else + { + /* The array accesses are negative to compensate the missing minus sign in the low and hi band gain. */ + /* 26 cycles on ARM926 */ + for (i = 0; i < M; i++) { + FIXP_QMF r1, i1, r2, i2; + r1 = -tReal[i]; + i2 = -tImag[L - 1 - i]; + r2 = -tReal[L - i - 1]; + i1 = -tImag[i]; + + tReal[i] = (r1 - i1)>>1; + tImag[L - 1 - i] = -(r1 + i1)>>1; + tReal[L - i - 1] = (r2 - i2)>>1; + tImag[i] = -(r2 + i2)>>1; + } + } +} + +void qmfSynthesisFilteringSlot( HANDLE_QMF_FILTER_BANK synQmf, + const FIXP_QMF *realSlot, + const FIXP_QMF *imagSlot, + const int scaleFactorLowBand, + const int scaleFactorHighBand, + INT_PCM *timeOut, + const int stride, + FIXP_QMF *pWorkBuffer) +{ + if (!(synQmf->flags & QMF_FLAG_LP)) + qmfInverseModulationHQ ( synQmf, + realSlot, + imagSlot, + scaleFactorLowBand, + scaleFactorHighBand, + pWorkBuffer + ); + else + { + if (synQmf->flags & QMF_FLAG_CLDFB) { + qmfInverseModulationLP_odd ( synQmf, + realSlot, + scaleFactorLowBand, + scaleFactorHighBand, + pWorkBuffer + ); + } else { + qmfInverseModulationLP_even ( synQmf, + realSlot, + scaleFactorLowBand, + scaleFactorHighBand, + pWorkBuffer + ); + } + } + + if (synQmf->flags & QMF_FLAG_NONSYMMETRIC) { + qmfSynPrototypeFirSlot_NonSymmetric ( + synQmf, + pWorkBuffer, + pWorkBuffer+synQmf->no_channels, + timeOut, + stride + ); + } else { + qmfSynPrototypeFirSlot ( synQmf, + pWorkBuffer, + pWorkBuffer+synQmf->no_channels, + timeOut, + stride + ); + } +} + + +/*! + * + * + * \brief Perform complex-valued subband synthesis of the + * low band and the high band and store the + * time domain data in timeOut + * + * First step: Calculate the proper scaling factor of current + * spectral data in qmfReal/qmfImag, old spectral data in the overlap + * range and filter states. + * + * Second step: Perform Frequency-to-Time mapping with inverse + * Modulation slot-wise. + * + * Third step: Perform FIR-filter slot-wise. To save space for filter + * states, the MAC operations are executed directly on the filter states + * instead of accumulating several products in the accumulator. The + * buffer shift at the end of the function should be replaced by a + * modulo operation, which is available on some DSPs. + * + * Last step: Copy the upper part of the spectral data to the overlap buffer. + * + * The qmf coefficient table is symmetric. The symmetry is exploited by + * shrinking the coefficient table to half the size. The addressing mode + * takes care of the symmetries. If the #define #QMFTABLE_FULL is set, + * coefficient addressing works on the full table size. The code will be + * slightly faster and slightly more compact. + * + * Workbuffer requirement: 2 x sizeof(**QmfBufferReal) * synQmf->no_channels + */ +void +qmfSynthesisFiltering( HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_QMF **QmfBufferReal, /*!< Low and High band, real */ + FIXP_QMF **QmfBufferImag, /*!< Low and High band, imag */ + const QMF_SCALE_FACTOR *scaleFactor, + const INT ov_len, /*!< split Slot of overlap and actual slots */ + INT_PCM *timeOut, /*!< Pointer to output */ + const INT stride, /*!< stride factor of output */ + FIXP_QMF *pWorkBuffer /*!< pointer to temporal working buffer */ + ) +{ + int i; + int L = synQmf->no_channels; + SCHAR scaleFactorHighBand; + SCHAR scaleFactorLowBand_ov, scaleFactorLowBand_no_ov; + + /* adapt scaling */ + scaleFactorHighBand = -ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK - scaleFactor->hb_scale; + scaleFactorLowBand_ov = - ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK - scaleFactor->ov_lb_scale; + scaleFactorLowBand_no_ov = - ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK - scaleFactor->lb_scale; + + for (i = 0; i < synQmf->no_col; i++) /* ----- no_col loop ----- */ + { + const FIXP_DBL *QmfBufferImagSlot = NULL; + + SCHAR scaleFactorLowBand = (i<ov_len) ? scaleFactorLowBand_ov : scaleFactorLowBand_no_ov; + + if (!(synQmf->flags & QMF_FLAG_LP)) + QmfBufferImagSlot = QmfBufferImag[i]; + + qmfSynthesisFilteringSlot( synQmf, + QmfBufferReal[i], + QmfBufferImagSlot, + scaleFactorLowBand, + scaleFactorHighBand, + timeOut+(i*L*stride), + stride, + pWorkBuffer); + } /* no_col loop i */ + +} + + +/*! + * + * \brief Create QMF filter bank instance + * + * \return 0 if successful + * + */ +static int +qmfInitFilterBank (HANDLE_QMF_FILTER_BANK h_Qmf, /*!< Handle to return */ + void *pFilterStates, /*!< Handle to filter states */ + int noCols, /*!< Number of timeslots per frame */ + int lsb, /*!< Lower end of QMF frequency range */ + int usb, /*!< Upper end of QMF frequency range */ + int no_channels, /*!< Number of channels (bands) */ + UINT flags) /*!< flags */ +{ + FDKmemclear(h_Qmf,sizeof(QMF_FILTER_BANK)); + + if (flags & QMF_FLAG_MPSLDFB) + { + return -1; + } + + if ( !(flags & QMF_FLAG_MPSLDFB) && (flags & QMF_FLAG_CLDFB) ) + { + flags |= QMF_FLAG_NONSYMMETRIC; + h_Qmf->filterScale = QMF_CLDFB_PFT_SCALE; + + h_Qmf->p_stride = 1; + switch (no_channels) { + case 64: + h_Qmf->t_cos = qmf_phaseshift_cos64_cldfb; + h_Qmf->t_sin = qmf_phaseshift_sin64_cldfb; + h_Qmf->p_filter = qmf_cldfb_640; + h_Qmf->FilterSize = 640; + break; + case 32: + h_Qmf->t_cos = qmf_phaseshift_cos32_cldfb; + h_Qmf->t_sin = qmf_phaseshift_sin32_cldfb; + h_Qmf->p_filter = qmf_cldfb_320; + h_Qmf->FilterSize = 320; + break; + default: + return -1; + } + } + + if ( !(flags & QMF_FLAG_MPSLDFB) && ((flags & QMF_FLAG_CLDFB) == 0) ) + { + switch (no_channels) { + case 64: + h_Qmf->p_filter = qmf_64; + h_Qmf->t_cos = qmf_phaseshift_cos64; + h_Qmf->t_sin = qmf_phaseshift_sin64; + h_Qmf->p_stride = 1; + h_Qmf->FilterSize = 640; + h_Qmf->filterScale = 0; + break; + case 32: + h_Qmf->p_filter = qmf_64; + h_Qmf->t_cos = qmf_phaseshift_cos32; + h_Qmf->t_sin = qmf_phaseshift_sin32; + h_Qmf->p_stride = 2; + h_Qmf->FilterSize = 640; + h_Qmf->filterScale = 0; + break; + default: + return -1; + } + } + + h_Qmf->flags = flags; + + h_Qmf->no_channels = no_channels; + h_Qmf->no_col = noCols; + + h_Qmf->lsb = lsb; + h_Qmf->usb = fMin(usb, h_Qmf->no_channels); + + h_Qmf->FilterStates = (void*)pFilterStates; + + h_Qmf->outScalefactor = ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK + ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK + h_Qmf->filterScale; + + if (h_Qmf->p_stride == 2) { + h_Qmf->outScalefactor -= 1; + } + h_Qmf->outGain = (FIXP_DBL)0x80000000; /* default init value will be not applied */ + + return (0); +} + +/*! + * + * \brief Adjust synthesis qmf filter states + * + * \return void + * + */ +static inline void +qmfAdaptFilterStates (HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Filter Bank */ + int scaleFactorDiff) /*!< Scale factor difference to be applied */ +{ + if (synQmf == NULL || synQmf->FilterStates == NULL) { + return; + } + scaleValues((FIXP_QSS*)synQmf->FilterStates, synQmf->no_channels*(QMF_NO_POLY*2 - 1), scaleFactorDiff); +} + +/*! + * + * \brief Create QMF filter bank instance + * + * Only the lower bands are obtained (upto anaQmf->lsb). For + * a full bandwidth analysis it is required to set both anaQmf->lsb + * and anaQmf->usb to the amount of QMF bands. + * + * \return 0 if succesful + * + */ +int +qmfInitAnalysisFilterBank (HANDLE_QMF_FILTER_BANK h_Qmf, /*!< Returns handle */ + FIXP_QAS *pFilterStates, /*!< Handle to filter states */ + int noCols, /*!< Number of timeslots per frame */ + int lsb, /*!< lower end of QMF */ + int usb, /*!< upper end of QMF */ + int no_channels, /*!< Number of channels (bands) */ + int flags) /*!< Low Power flag */ +{ + int err = qmfInitFilterBank(h_Qmf, pFilterStates, noCols, lsb, usb, no_channels, flags); + if ( !(flags & QMF_FLAG_KEEP_STATES) && (h_Qmf->FilterStates != NULL) ) { + FDKmemclear(h_Qmf->FilterStates, (2*QMF_NO_POLY-1)*h_Qmf->no_channels*sizeof(FIXP_QAS)); + } + + return err; +} + +/*! + * + * \brief Create QMF filter bank instance + * + * Only the lower bands are obtained (upto anaQmf->lsb). For + * a full bandwidth analysis it is required to set both anaQmf->lsb + * and anaQmf->usb to the amount of QMF bands. + * + * \return 0 if succesful + * + */ +int +qmfInitSynthesisFilterBank (HANDLE_QMF_FILTER_BANK h_Qmf, /*!< Returns handle */ + FIXP_QSS *pFilterStates, /*!< Handle to filter states */ + int noCols, /*!< Number of timeslots per frame */ + int lsb, /*!< lower end of QMF */ + int usb, /*!< upper end of QMF */ + int no_channels, /*!< Number of channels (bands) */ + int flags) /*!< Low Power flag */ +{ + int oldOutScale = h_Qmf->outScalefactor; + int err = qmfInitFilterBank(h_Qmf, pFilterStates, noCols, lsb, usb, no_channels, flags); + if ( h_Qmf->FilterStates != NULL ) { + if ( !(flags & QMF_FLAG_KEEP_STATES) ) { + FDKmemclear(h_Qmf->FilterStates, (2*QMF_NO_POLY-1)*h_Qmf->no_channels*sizeof(FIXP_QSS)); + } else { + qmfAdaptFilterStates(h_Qmf, oldOutScale-h_Qmf->outScalefactor); + } + } + return err; +} + + + + +/*! + * + * \brief Change scale factor for output data and adjust qmf filter states + * + * \return void + * + */ +void +qmfChangeOutScalefactor (HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + int outScalefactor /*!< New scaling factor for output data */ + ) +{ + if (synQmf == NULL || synQmf->FilterStates == NULL) { + return; + } + + /* Add internal filterbank scale */ + outScalefactor += ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK + ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK + synQmf->filterScale; + + if (synQmf->p_stride == 2) { + outScalefactor -= 1; + } + + /* adjust filter states when scale factor has been changed */ + if (synQmf->outScalefactor != outScalefactor) + { + int diff; + + if (outScalefactor > (SAMPLE_BITS - 1)) { + outScalefactor = SAMPLE_BITS - 1; + } else if (outScalefactor < (1 - SAMPLE_BITS)) { + outScalefactor = 1 - SAMPLE_BITS; + } + + diff = synQmf->outScalefactor - outScalefactor; + + qmfAdaptFilterStates(synQmf, diff); + + /* save new scale factor */ + synQmf->outScalefactor = outScalefactor; + } +} + +/*! + * + * \brief Change gain for output data + * + * \return void + * + */ +void +qmfChangeOutGain (HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_DBL outputGain /*!< New gain for output data */ + ) +{ + synQmf->outGain = outputGain; +} + diff --git a/libFDK/src/scale.cpp b/libFDK/src/scale.cpp new file mode 100644 index 0000000..174677d --- /dev/null +++ b/libFDK/src/scale.cpp @@ -0,0 +1,399 @@ +/*************************** Fraunhofer IIS FDK Tools ********************** + + (C) Copyright Fraunhofer IIS (2005) + All Rights Reserved + + Please be advised that this software and/or program delivery is + Confidential Information of Fraunhofer and subject to and covered by the + + Fraunhofer IIS Software Evaluation Agreement + between Google Inc. and Fraunhofer + effective and in full force since March 1, 2012. + + You may use this software and/or program only under the terms and + conditions described in the above mentioned Fraunhofer IIS Software + Evaluation Agreement. Any other and/or further use requires a separate agreement. + + + $Id$ + Author(s): + Description: Scaling operations + + This software and/or program is protected by copyright law and international + treaties. Any reproduction or distribution of this software and/or program, + or any portion of it, may result in severe civil and criminal penalties, and + will be prosecuted to the maximum extent possible under law. + +******************************************************************************/ + +#include "common_fix.h" + +#include "genericStds.h" + +/************************************************** + * Inline definitions + **************************************************/ + +#define SCALE_INLINE inline + + +#if defined(__mips__) /* cppp replaced: elif */ +#include "mips/scale.cpp" + +#elif defined(__arm__) +#include "arm/scale_arm.cpp" + +#endif + +#ifndef FUNCTION_scaleValues_SGL +/*! + * + * \brief Multiply input vector by \f$ 2^{scalefactor} \f$ + * \param len must be larger than 4 + * \return void + * + */ +#define FUNCTION_scaleValues_SGL +SCALE_INLINE +void scaleValues(FIXP_SGL *vector, /*!< Vector */ + INT len, /*!< Length */ + INT scalefactor /*!< Scalefactor */ + ) +{ + INT i; + + /* Return if scalefactor is Zero */ + if (scalefactor==0) return; + + if(scalefactor > 0){ + scalefactor = fixmin_I(scalefactor,(INT)(DFRACT_BITS-1)); + for (i = len&3; i--; ) + { + *(vector++) <<= scalefactor; + } + for (i = len>>2; i--; ) + { + *(vector++) <<= scalefactor; + *(vector++) <<= scalefactor; + *(vector++) <<= scalefactor; + *(vector++) <<= scalefactor; + } + } else { + INT negScalefactor = fixmin_I(-scalefactor,(INT)DFRACT_BITS-1); + for (i = len&3; i--; ) + { + *(vector++) >>= negScalefactor; + } + for (i = len>>2; i--; ) + { + *(vector++) >>= negScalefactor; + *(vector++) >>= negScalefactor; + *(vector++) >>= negScalefactor; + *(vector++) >>= negScalefactor; + } + } +} +#endif + +#ifndef FUNCTION_scaleValues_DBL +/*! + * + * \brief Multiply input vector by \f$ 2^{scalefactor} \f$ + * \param len must be larger than 4 + * \return void + * + */ +#define FUNCTION_scaleValues_DBL +SCALE_INLINE +void scaleValues(FIXP_DBL *vector, /*!< Vector */ + INT len, /*!< Length */ + INT scalefactor /*!< Scalefactor */ + ) +{ + INT i; + + /* Return if scalefactor is Zero */ + if (scalefactor==0) return; + + if(scalefactor > 0){ + scalefactor = fixmin_I(scalefactor,(INT)DFRACT_BITS-1); + for (i = len&3; i--; ) + { + *(vector++) <<= scalefactor; + } + for (i = len>>2; i--; ) + { + *(vector++) <<= scalefactor; + *(vector++) <<= scalefactor; + *(vector++) <<= scalefactor; + *(vector++) <<= scalefactor; + } + } else { + INT negScalefactor = fixmin_I(-scalefactor,(INT)DFRACT_BITS-1); + for (i = len&3; i--; ) + { + *(vector++) >>= negScalefactor; + } + for (i = len>>2; i--; ) + { + *(vector++) >>= negScalefactor; + *(vector++) >>= negScalefactor; + *(vector++) >>= negScalefactor; + *(vector++) >>= negScalefactor; + } + } +} +#endif + +#ifndef FUNCTION_scaleValues_DBLDBL +/*! + * + * \brief Multiply input vector src by \f$ 2^{scalefactor} \f$ + * and place result into dst + * \param dst detination buffer + * \param src source buffer + * \param len must be larger than 4 + * \param scalefactor amount of left shifts to be applied + * \return void + * + */ +#define FUNCTION_scaleValues_DBLDBL +SCALE_INLINE +void scaleValues(FIXP_DBL *dst, /*!< dst Vector */ + const FIXP_DBL *src, /*!< src Vector */ + INT len, /*!< Length */ + INT scalefactor /*!< Scalefactor */ + ) +{ + INT i; + + /* Return if scalefactor is Zero */ + if (scalefactor==0) { + if (dst != src) + FDKmemmove(dst, src, len*sizeof(FIXP_DBL)); + } + else { + + if(scalefactor > 0){ + scalefactor = fixmin_I(scalefactor,(INT)DFRACT_BITS-1); + for (i = len&3; i--; ) + { + *(dst++) = *(src++) << scalefactor; + } + for (i = len>>2; i--; ) + { + *(dst++) = *(src++) << scalefactor; + *(dst++) = *(src++) << scalefactor; + *(dst++) = *(src++) << scalefactor; + *(dst++) = *(src++) << scalefactor; + } + } else { + INT negScalefactor = fixmin_I(-scalefactor,(INT)DFRACT_BITS-1); + for (i = len&3; i--; ) + { + *(dst++) = *(src++) >> negScalefactor; + } + for (i = len>>2; i--; ) + { + *(dst++) = *(src++) >> negScalefactor; + *(dst++) = *(src++) >> negScalefactor; + *(dst++) = *(src++) >> negScalefactor; + *(dst++) = *(src++) >> negScalefactor; + } + } + } +} +#endif + +#ifndef FUNCTION_scaleValuesWithFactor_DBL +/*! + * + * \brief Multiply input vector by \f$ 2^{scalefactor} \f$ + * \param len must be larger than 4 + * \return void + * + */ +#define FUNCTION_scaleValuesWithFactor_DBL +SCALE_INLINE +void scaleValuesWithFactor( + FIXP_DBL *vector, + FIXP_DBL factor, + INT len, + INT scalefactor + ) +{ + INT i; + + /* Compensate fMultDiv2 */ + scalefactor++; + + if(scalefactor > 0){ + scalefactor = fixmin_I(scalefactor,(INT)DFRACT_BITS-1); + for (i = len&3; i--; ) + { + *vector = fMultDiv2(*vector, factor) << scalefactor; + vector++; + } + for (i = len>>2; i--; ) + { + *vector = fMultDiv2(*vector, factor) << scalefactor; vector++; + *vector = fMultDiv2(*vector, factor) << scalefactor; vector++; + *vector = fMultDiv2(*vector, factor) << scalefactor; vector++; + *vector = fMultDiv2(*vector, factor) << scalefactor; vector++; + } + } else { + INT negScalefactor = fixmin_I(-scalefactor,(INT)DFRACT_BITS-1); + for (i = len&3; i--; ) + { + *vector = fMultDiv2(*vector, factor) >> negScalefactor; + vector++; + } + for (i = len>>2; i--; ) + { + *vector = fMultDiv2(*vector, factor) >> negScalefactor; vector++; + *vector = fMultDiv2(*vector, factor) >> negScalefactor; vector++; + *vector = fMultDiv2(*vector, factor) >> negScalefactor; vector++; + *vector = fMultDiv2(*vector, factor) >> negScalefactor; vector++; + } + } +} +#endif /* FUNCTION_scaleValuesWithFactor_DBL */ + + +/******************************************* + +IMPORTANT NOTE for usage of getScalefactor() + +If the input array contains negative values too, then these functions may sometimes return +the actual maximum value minus 1, due to the nature of the applied algorithm. +So be careful with possible fractional -1 values that may lead to overflows when being fPow2()'ed. + +********************************************/ + + + +#ifndef FUNCTION_getScalefactorShort +/*! + * + * \brief Calculate max possible scale factor for input vector of shorts + * + * \return Maximum scale factor / possible left shift + * + */ +#define FUNCTION_getScalefactorShort +SCALE_INLINE +INT getScalefactorShort(const SHORT *vector, /*!< Pointer to input vector */ + INT len /*!< Length of input vector */ + ) +{ + INT i; + SHORT temp, maxVal = 0; + + for(i=len;i!=0;i--){ + temp = (SHORT)(*vector++); + maxVal |= (temp^(temp>>(SHORT_BITS-1))); + } + + return fixmax_I((INT)0,(INT)(fixnormz_D((INT)maxVal) - (INT)1 - (INT)(DFRACT_BITS - SHORT_BITS))); +} +#endif + +#ifndef FUNCTION_getScalefactorPCM +/*! + * + * \brief Calculate max possible scale factor for input vector of shorts + * + * \return Maximum scale factor + * + */ +#define FUNCTION_getScalefactorPCM +SCALE_INLINE +INT getScalefactorPCM(const INT_PCM *vector, /*!< Pointer to input vector */ + INT len, /*!< Length of input vector */ + INT stride + ) +{ + INT i; + INT_PCM temp, maxVal = 0; + + for(i=len;i!=0;i--){ + temp = (INT_PCM)(*vector); vector+=stride; + maxVal |= (temp^(temp>>((sizeof(INT_PCM)*8)-1))); + } + return fixmax_I((INT)0,(INT)(fixnormz_D((INT)maxVal) - (INT)1 - (INT)(DFRACT_BITS - SAMPLE_BITS))); +} +#endif + +#ifndef FUNCTION_getScalefactorShort +/*! + * + * \brief Calculate max possible scale factor for input vector of shorts + * \param stride, item increment between verctor members. + * \return Maximum scale factor + * + */ +#define FUNCTION_getScalefactorShort +SCALE_INLINE +INT getScalefactorShort(const SHORT *vector, /*!< Pointer to input vector */ + INT len, /*!< Length of input vector */ + INT stride + ) +{ + INT i; + SHORT temp, maxVal = 0; + + for(i=len;i!=0;i--){ + temp = (SHORT)(*vector); vector+=stride; + maxVal |= (temp^(temp>>(SHORT_BITS-1))); + } + + return fixmax_I((INT)0,(INT)(fixnormz_D((INT)maxVal) - (INT)1 - (INT)(DFRACT_BITS - SHORT_BITS))); +} +#endif + +#ifndef FUNCTION_getScalefactor_DBL +/*! + * + * \brief Calculate max possible scale factor for input vector + * + * \return Maximum scale factor + * + * This function can constitute a significant amount of computational complexity - very much depending on the + * bitrate. Since it is a rather small function, effective assembler optimization might be possible. + * + */ +#define FUNCTION_getScalefactor_DBL +SCALE_INLINE +INT getScalefactor(const FIXP_DBL *vector, /*!< Pointer to input vector */ + INT len) /*!< Length of input vector */ +{ + INT i; + FIXP_DBL temp, maxVal = (FIXP_DBL)0; + + for(i=len;i!=0;i--){ + temp = (LONG)(*vector++); + maxVal |= (FIXP_DBL)((LONG)temp^(LONG)(temp>>(DFRACT_BITS-1))); + } + + return fixmax_I((INT)0,(INT)(fixnormz_D(maxVal) - 1)); +} +#endif + +#ifndef FUNCTION_getScalefactor_SGL +#define FUNCTION_getScalefactor_SGL +SCALE_INLINE +INT getScalefactor(const FIXP_SGL *vector, /*!< Pointer to input vector */ + INT len) /*!< Length of input vector */ +{ + INT i; + SHORT temp, maxVal = (FIXP_SGL)0; + + for(i=len;i!=0;i--){ + temp = (SHORT)(*vector++); + maxVal |= (temp^(temp>>(FRACT_BITS-1))); + } + + return fixmax_I((INT)0,(INT)(fixnormz_D(FX_SGL2FX_DBL((FIXP_SGL)maxVal)) - 1)); +} +#endif + |