From 0e5af65c467b2423a0b857ae3ad98c91acc1e190 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 11 Nov 2019 11:38:02 +0100 Subject: Include patched FDK-AAC in the repository The initial idea was to get the DAB+ patch into upstream, but since that follows the android source releases, there is no place for a custom DAB+ patch there. So instead of having to maintain a patched fdk-aac that has to have the same .so version as the distribution package on which it is installed, we prefer having a separate fdk-aac-dab library to avoid collision. At that point, there's no reason to keep fdk-aac in a separate repository, as odr-audioenc is the only tool that needs DAB+ encoding support. Including it here simplifies installation, and makes it consistent with toolame-dab, also shipped in this repository. DAB+ decoding support (needed by ODR-SourceCompanion, dablin, etisnoop, welle.io and others) can be done using upstream FDK-AAC. --- fdk-aac/libFDK/include/FDK_archdef.h | 270 + fdk-aac/libFDK/include/FDK_bitbuffer.h | 177 + fdk-aac/libFDK/include/FDK_bitstream.h | 642 +++ fdk-aac/libFDK/include/FDK_core.h | 122 + fdk-aac/libFDK/include/FDK_crc.h | 225 + fdk-aac/libFDK/include/FDK_decorrelate.h | 314 + fdk-aac/libFDK/include/FDK_hybrid.h | 255 + fdk-aac/libFDK/include/FDK_lpc.h | 218 + fdk-aac/libFDK/include/FDK_matrixCalloc.h | 230 + fdk-aac/libFDK/include/FDK_qmf_domain.h | 416 ++ fdk-aac/libFDK/include/FDK_tools_rom.h | 398 ++ fdk-aac/libFDK/include/FDK_trigFcts.h | 258 + fdk-aac/libFDK/include/abs.h | 136 + fdk-aac/libFDK/include/arm/clz_arm.h | 164 + fdk-aac/libFDK/include/arm/cplx_mul_arm.h | 201 + fdk-aac/libFDK/include/arm/fixmadd_arm.h | 220 + fdk-aac/libFDK/include/arm/fixmul_arm.h | 198 + fdk-aac/libFDK/include/arm/scale_arm.h | 163 + fdk-aac/libFDK/include/arm/scramble_arm.h | 174 + fdk-aac/libFDK/include/autocorr2nd.h | 137 + fdk-aac/libFDK/include/clz.h | 205 + fdk-aac/libFDK/include/common_fix.h | 449 ++ fdk-aac/libFDK/include/cplx_mul.h | 266 + fdk-aac/libFDK/include/dct.h | 171 + fdk-aac/libFDK/include/fft.h | 263 + fdk-aac/libFDK/include/fft_rad2.h | 121 + fdk-aac/libFDK/include/fixmadd.h | 333 ++ fdk-aac/libFDK/include/fixminmax.h | 131 + fdk-aac/libFDK/include/fixmul.h | 298 + fdk-aac/libFDK/include/fixpoint_math.h | 921 +++ fdk-aac/libFDK/include/huff_nodes.h | 258 + fdk-aac/libFDK/include/mdct.h | 253 + fdk-aac/libFDK/include/mips/abs_mips.h | 125 + fdk-aac/libFDK/include/mips/clz_mips.h | 134 + fdk-aac/libFDK/include/mips/cplx_mul_mips.h | 133 + fdk-aac/libFDK/include/mips/fixmul_mips.h | 130 + fdk-aac/libFDK/include/mips/scale_mips.h | 122 + fdk-aac/libFDK/include/mips/scramble_mips.h | 133 + fdk-aac/libFDK/include/nlc_dec.h | 187 + fdk-aac/libFDK/include/ppc/clz_ppc.h | 102 + fdk-aac/libFDK/include/ppc/fixmul_ppc.h | 115 + fdk-aac/libFDK/include/qmf.h | 301 + fdk-aac/libFDK/include/qmf_pcm.h | 405 ++ fdk-aac/libFDK/include/scale.h | 298 + fdk-aac/libFDK/include/scramble.h | 153 + fdk-aac/libFDK/include/x86/abs_x86.h | 123 + fdk-aac/libFDK/include/x86/clz_x86.h | 165 + fdk-aac/libFDK/include/x86/fixmul_x86.h | 187 + fdk-aac/libFDK/include/x86/fixpoint_math_x86.h | 208 + fdk-aac/libFDK/src/FDK_bitbuffer.cpp | 489 ++ fdk-aac/libFDK/src/FDK_core.cpp | 145 + fdk-aac/libFDK/src/FDK_crc.cpp | 526 ++ fdk-aac/libFDK/src/FDK_decorrelate.cpp | 1746 ++++++ fdk-aac/libFDK/src/FDK_hybrid.cpp | 813 +++ fdk-aac/libFDK/src/FDK_lpc.cpp | 487 ++ fdk-aac/libFDK/src/FDK_matrixCalloc.cpp | 315 + fdk-aac/libFDK/src/FDK_qmf_domain.cpp | 1018 ++++ fdk-aac/libFDK/src/FDK_tools_rom.cpp | 7274 ++++++++++++++++++++++++ fdk-aac/libFDK/src/FDK_trigFcts.cpp | 340 ++ fdk-aac/libFDK/src/arm/fft_rad2_arm.cpp | 321 ++ fdk-aac/libFDK/src/arm/scale_arm.cpp | 174 + fdk-aac/libFDK/src/autocorr2nd.cpp | 293 + fdk-aac/libFDK/src/dct.cpp | 568 ++ fdk-aac/libFDK/src/fft.cpp | 1922 +++++++ fdk-aac/libFDK/src/fft_rad2.cpp | 324 ++ fdk-aac/libFDK/src/fixpoint_math.cpp | 900 +++ fdk-aac/libFDK/src/huff_nodes.cpp | 1084 ++++ fdk-aac/libFDK/src/mdct.cpp | 730 +++ fdk-aac/libFDK/src/mips/fft_rad2_mips.cpp | 165 + fdk-aac/libFDK/src/mips/mips_fft_twiddles.cpp | 931 +++ fdk-aac/libFDK/src/mips/scale_mips.cpp | 133 + fdk-aac/libFDK/src/nlc_dec.cpp | 1071 ++++ fdk-aac/libFDK/src/qmf.cpp | 1135 ++++ fdk-aac/libFDK/src/scale.cpp | 720 +++ 74 files changed, 35232 insertions(+) create mode 100644 fdk-aac/libFDK/include/FDK_archdef.h create mode 100644 fdk-aac/libFDK/include/FDK_bitbuffer.h create mode 100644 fdk-aac/libFDK/include/FDK_bitstream.h create mode 100644 fdk-aac/libFDK/include/FDK_core.h create mode 100644 fdk-aac/libFDK/include/FDK_crc.h create mode 100644 fdk-aac/libFDK/include/FDK_decorrelate.h create mode 100644 fdk-aac/libFDK/include/FDK_hybrid.h create mode 100644 fdk-aac/libFDK/include/FDK_lpc.h create mode 100644 fdk-aac/libFDK/include/FDK_matrixCalloc.h create mode 100644 fdk-aac/libFDK/include/FDK_qmf_domain.h create mode 100644 fdk-aac/libFDK/include/FDK_tools_rom.h create mode 100644 fdk-aac/libFDK/include/FDK_trigFcts.h create mode 100644 fdk-aac/libFDK/include/abs.h create mode 100644 fdk-aac/libFDK/include/arm/clz_arm.h create mode 100644 fdk-aac/libFDK/include/arm/cplx_mul_arm.h create mode 100644 fdk-aac/libFDK/include/arm/fixmadd_arm.h create mode 100644 fdk-aac/libFDK/include/arm/fixmul_arm.h create mode 100644 fdk-aac/libFDK/include/arm/scale_arm.h create mode 100644 fdk-aac/libFDK/include/arm/scramble_arm.h create mode 100644 fdk-aac/libFDK/include/autocorr2nd.h create mode 100644 fdk-aac/libFDK/include/clz.h create mode 100644 fdk-aac/libFDK/include/common_fix.h create mode 100644 fdk-aac/libFDK/include/cplx_mul.h create mode 100644 fdk-aac/libFDK/include/dct.h create mode 100644 fdk-aac/libFDK/include/fft.h create mode 100644 fdk-aac/libFDK/include/fft_rad2.h create mode 100644 fdk-aac/libFDK/include/fixmadd.h create mode 100644 fdk-aac/libFDK/include/fixminmax.h create mode 100644 fdk-aac/libFDK/include/fixmul.h create mode 100644 fdk-aac/libFDK/include/fixpoint_math.h create mode 100644 fdk-aac/libFDK/include/huff_nodes.h create mode 100644 fdk-aac/libFDK/include/mdct.h create mode 100644 fdk-aac/libFDK/include/mips/abs_mips.h create mode 100644 fdk-aac/libFDK/include/mips/clz_mips.h create mode 100644 fdk-aac/libFDK/include/mips/cplx_mul_mips.h create mode 100644 fdk-aac/libFDK/include/mips/fixmul_mips.h create mode 100644 fdk-aac/libFDK/include/mips/scale_mips.h create mode 100644 fdk-aac/libFDK/include/mips/scramble_mips.h create mode 100644 fdk-aac/libFDK/include/nlc_dec.h create mode 100644 fdk-aac/libFDK/include/ppc/clz_ppc.h create mode 100644 fdk-aac/libFDK/include/ppc/fixmul_ppc.h create mode 100644 fdk-aac/libFDK/include/qmf.h create mode 100644 fdk-aac/libFDK/include/qmf_pcm.h create mode 100644 fdk-aac/libFDK/include/scale.h create mode 100644 fdk-aac/libFDK/include/scramble.h create mode 100644 fdk-aac/libFDK/include/x86/abs_x86.h create mode 100644 fdk-aac/libFDK/include/x86/clz_x86.h create mode 100644 fdk-aac/libFDK/include/x86/fixmul_x86.h create mode 100644 fdk-aac/libFDK/include/x86/fixpoint_math_x86.h create mode 100644 fdk-aac/libFDK/src/FDK_bitbuffer.cpp create mode 100644 fdk-aac/libFDK/src/FDK_core.cpp create mode 100644 fdk-aac/libFDK/src/FDK_crc.cpp create mode 100644 fdk-aac/libFDK/src/FDK_decorrelate.cpp create mode 100644 fdk-aac/libFDK/src/FDK_hybrid.cpp create mode 100644 fdk-aac/libFDK/src/FDK_lpc.cpp create mode 100644 fdk-aac/libFDK/src/FDK_matrixCalloc.cpp create mode 100644 fdk-aac/libFDK/src/FDK_qmf_domain.cpp create mode 100644 fdk-aac/libFDK/src/FDK_tools_rom.cpp create mode 100644 fdk-aac/libFDK/src/FDK_trigFcts.cpp create mode 100644 fdk-aac/libFDK/src/arm/fft_rad2_arm.cpp create mode 100644 fdk-aac/libFDK/src/arm/scale_arm.cpp create mode 100644 fdk-aac/libFDK/src/autocorr2nd.cpp create mode 100644 fdk-aac/libFDK/src/dct.cpp create mode 100644 fdk-aac/libFDK/src/fft.cpp create mode 100644 fdk-aac/libFDK/src/fft_rad2.cpp create mode 100644 fdk-aac/libFDK/src/fixpoint_math.cpp create mode 100644 fdk-aac/libFDK/src/huff_nodes.cpp create mode 100644 fdk-aac/libFDK/src/mdct.cpp create mode 100644 fdk-aac/libFDK/src/mips/fft_rad2_mips.cpp create mode 100644 fdk-aac/libFDK/src/mips/mips_fft_twiddles.cpp create mode 100644 fdk-aac/libFDK/src/mips/scale_mips.cpp create mode 100644 fdk-aac/libFDK/src/nlc_dec.cpp create mode 100644 fdk-aac/libFDK/src/qmf.cpp create mode 100644 fdk-aac/libFDK/src/scale.cpp (limited to 'fdk-aac/libFDK') diff --git a/fdk-aac/libFDK/include/FDK_archdef.h b/fdk-aac/libFDK/include/FDK_archdef.h new file mode 100644 index 0000000..b4fef8a --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_archdef.h @@ -0,0 +1,270 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: + +*******************************************************************************/ + +#ifndef FDK_ARCHDEF_H +#define FDK_ARCHDEF_H + +/* Unify some few toolchain specific defines to avoid having large "or" macro + * contraptions all over the source code. */ + +/* 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(_MSC_VER) && defined(_M_X64)) || defined(__x86_64__) +#define __x86__ +#endif + +#if defined(_M_ARM) && !defined(__arm__) || defined(__aarch64__) || defined(_M_ARM64) +#define __arm__ +#endif + +#if defined(_ARCH_PPC) && !defined(__powerpc__) +#define __powerpc__ 1 +#endif + +#if (__TARGET_ARCH_ARM == 5) || defined(__TARGET_FEATURE_DSPMUL) || \ + (_M_ARM == 5) || defined(__ARM_ARCH_5TEJ__) || defined(__ARM_ARCH_7EM__) +/* Define __ARM_ARCH_5TE__ if armv5te features are supported */ +#define __ARM_ARCH_5TE__ +#endif + +#if (__TARGET_ARCH_ARM == 6) || defined(__ARM_ARCH_6J__) || \ + defined(__ARM_ARCH_6ZK__) +/* Define __ARM_ARCH_6__ if the armv6 intructions are being supported. */ +#define __ARM_ARCH_5TE__ +#define __ARM_ARCH_6__ +#endif + +#if defined(__TARGET_ARCH_7_R) || defined(__ARM_ARCH_7R__) +/* Define __ARM_ARCH_7_A__ if the armv7 intructions are being supported. */ +#define __ARM_ARCH_5TE__ +#define __ARM_ARCH_6__ +#define __ARM_ARCH_7_R__ +#endif + +#if defined(__TARGET_ARCH_7_A) || defined(__ARM_ARCH_7A__) || \ + ((__ARM_ARCH == 8) && (__ARM_32BIT_STATE == 1)) +/* Define __ARM_ARCH_7_A__ if the armv7 intructions are being supported. */ +#define __ARM_ARCH_5TE__ +#define __ARM_ARCH_6__ +#define __ARM_ARCH_7_A__ +#endif + +#if defined(__TARGET_ARCH_7_M) || defined(__ARM_ARCH_7_M__) +/* Define __ARM_ARCH_7M__ if the ARMv7-M instructions are being supported, e.g. + * Cortex-M3. */ +#define __ARM_ARCH_7M__ +#endif + +#if defined(__TARGET_ARCH_7E_M) || defined(__ARM_ARCH_7E_M__) +/* Define __ARM_ARCH_7EM__ if the ARMv7-ME instructions are being supported, + * e.g. Cortex-M4. */ +#define __ARM_ARCH_7EM__ +#endif + +#if defined(__aarch64__) || defined(_M_ARM64) +#define __ARM_ARCH_8__ +#endif + +#ifdef _M_ARM +#include "armintr.h" +#endif + +/* Define preferred Multiplication type */ + +#if defined(__mips__) +#define ARCH_PREFER_MULT_16x16 +#undef SINETABLE_16BIT +#undef POW2COEFF_16BIT +#undef LDCOEFF_16BIT +#undef WINDOWTABLE_16BIT + +#elif defined(__arm__) && defined(__ARM_ARCH_8__) +#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_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__) +#define ARCH_PREFER_MULT_32x16 +#define SINETABLE_16BIT +#define WINDOWTABLE_16BIT +#define POW2COEFF_16BIT +#define LDCOEFF_16BIT + +#elif defined(__powerpc__) +#define ARCH_PREFER_MULT_32x32 +#define ARCH_PREFER_MULT_32x16 +#define SINETABLE_16BIT +#define POW2COEFF_16BIT +#define LDCOEFF_16BIT +#define WINDOWTABLE_16BIT + +#else +#warning >>>> Please set architecture characterization defines for your platform (FDK_HIGH_PERFORMANCE)! <<<< + +#endif /* Architecture switches */ + +#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 FX_DBL2FX_WTB(x) FX_DBL2FX_SGL(x) +#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 FX_DBL2FX_WTB(x) (x) +#define FIXP_WTP FIXP_DPK +#define WTC(a) (FIXP_DBL)(a) +#endif /* SINETABLE_16BIT */ + +#define WTCP(a, b) \ + { \ + { WTC(a), WTC(b) } \ + } + +#endif /* FDK_ARCHDEF_H */ diff --git a/fdk-aac/libFDK/include/FDK_bitbuffer.h b/fdk-aac/libFDK/include/FDK_bitbuffer.h new file mode 100644 index 0000000..19a24b3 --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_bitbuffer.h @@ -0,0 +1,177 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Lohwasser + + Description: common bitbuffer read/write routines + +*******************************************************************************/ + +#ifndef FDK_BITBUFFER_H +#define FDK_BITBUFFER_H + +#include "FDK_archdef.h" +#include "machine_type.h" + +/* leave 3 bits headroom so MAX_BUFSIZE can be represented in bits as well. */ +#define MAX_BUFSIZE_BYTES (0x10000000) + +typedef struct { + UINT ValidBits; + UINT ReadOffset; + UINT WriteOffset; + 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 hBitBuf); + +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); + +UINT FDK_getValidBits(HANDLE_FDK_BITBUF hBitBuffer); + +INT FDK_getFreeBits(HANDLE_FDK_BITBUF hBitBuffer); + +void FDK_Feed(HANDLE_FDK_BITBUF hBitBuffer, const 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/fdk-aac/libFDK/include/FDK_bitstream.h b/fdk-aac/libFDK/include/FDK_bitstream.h new file mode 100644 index 0000000..f799026 --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_bitstream.h @@ -0,0 +1,642 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Lohwasser + + Description: bitstream interface to bitbuffer routines + +*******************************************************************************/ + +#ifndef FDK_BITSTREAM_H +#define FDK_BITSTREAM_H + +#include "FDK_bitbuffer.h" +#include "machine_type.h" + +#include "genericStds.h" + +#define CACHE_BITS 32 + +#define BUFSIZE_DUMMY_VALUE MAX_BUFSIZE_BYTES + +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 and <= + * MAX_BUFSIZE_BYTES) + * \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)); + if (hBitStream == NULL) return NULL; + 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 in bytes. (awaits size 2^n and <= + * MAX_BUFSIZE_BYTES) + * \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. ( (0),1 <= + * numberOfBits <= 32) + * \return the requested bits, right aligned + * \return + */ + +FDK_INLINE UINT FDKreadBits(HANDLE_FDK_BITSTREAM hBitStream, + const UINT numberOfBits) { + UINT bits = 0; + INT missingBits = (INT)numberOfBits - (INT)hBitStream->BitsInCache; + + FDK_ASSERT(numberOfBits <= 32); + if (missingBits > 0) { + if (missingBits != 32) bits = hBitStream->CacheWord << missingBits; + hBitStream->CacheWord = FDK_get32(&hBitStream->hBitBuf); + hBitStream->BitsInCache += CACHE_BITS; + } + + hBitStream->BitsInCache -= numberOfBits; + + return (bits | (hBitStream->CacheWord >> hBitStream->BitsInCache)) & + BitMask[numberOfBits]; +} + +FDK_INLINE UINT FDKreadBit(HANDLE_FDK_BITSTREAM hBitStream) { + if (!hBitStream->BitsInCache) { + hBitStream->CacheWord = FDK_get32(&hBitStream->hBitBuf); + hBitStream->BitsInCache = CACHE_BITS - 1; + return hBitStream->CacheWord >> 31; + } + hBitStream->BitsInCache--; + + return (hBitStream->CacheWord >> hBitStream->BitsInCache) & 1; +} + +/** + * \brief Read2Bits Function (forward). This function reads 2 sequential + * bits from the input bitstream. It is the optimized version + of FDKreadBits() for reading 2 bits. + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \return the requested bits, right aligned + * \return + */ +FDK_INLINE UINT FDKread2Bits(HANDLE_FDK_BITSTREAM hBitStream) { + /* + ** Version corresponds to optimized FDKreadBits implementation + ** calling FDK_get32, that keeps read pointer aligned. + */ + UINT bits = 0; + INT missingBits = 2 - (INT)hBitStream->BitsInCache; + if (missingBits > 0) { + bits = hBitStream->CacheWord << missingBits; + hBitStream->CacheWord = FDK_get32(&hBitStream->hBitBuf); + hBitStream->BitsInCache += CACHE_BITS; + } + + hBitStream->BitsInCache -= 2; + + return (bits | (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 read an integer value using a varying number of bits from the + * bitstream + * + * q.v. ISO/IEC FDIS 23003-3 Table 16 + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param nBits1 number of bits to read for a small integer value or escape + * value + * \param nBits2 number of bits to read for a medium sized integer value or + * escape value + * \param nBits3 number of bits to read for a large integer value + * \return integer value read from bitstream + */ +FDK_INLINE UINT escapedValue(HANDLE_FDK_BITSTREAM hBitStream, int nBits1, + int nBits2, int nBits3) { + UINT value = FDKreadBits(hBitStream, nBits1); + + if (value == (UINT)(1 << nBits1) - 1) { + UINT valueAdd = FDKreadBits(hBitStream, nBits2); + value += valueAdd; + if (valueAdd == (UINT)(1 << nBits2) - 1) { + value += FDKreadBits(hBitStream, nBits3); + } + } + + return value; +} + +/** + * \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 The 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 == NULL) { + return numberOfBits; + } + + if ((hBitStream->BitsInCache + numberOfBits) < CACHE_BITS) { + hBitStream->BitsInCache += numberOfBits; + hBitStream->CacheWord = + (hBitStream->CacheWord << numberOfBits) | (value & validMask); + } else { + /* Put always 32 bits into memory */ + /* - fill cache's LSBits with MSBits of value */ + /* - store 32 bits in memory using subroutine */ + /* - fill remaining bits into cache's LSBits */ + /* - upper bits in cache are don't care */ + + /* Compute number of bits to be filled into cache */ + int missing_bits = CACHE_BITS - hBitStream->BitsInCache; + int remaining_bits = numberOfBits - missing_bits; + value = value & validMask; + /* Avoid shift left by 32 positions */ + UINT CacheWord = + (missing_bits == 32) ? 0 : (hBitStream->CacheWord << missing_bits); + CacheWord |= (value >> (remaining_bits)); + FDK_put(&hBitStream->hBitBuf, CacheWord, 32); + + hBitStream->CacheWord = value; + hBitStream->BitsInCache = remaining_bits; + } + + 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 write an integer value using a varying number of bits from the + * bitstream + * + * q.v. ISO/IEC FDIS 23003-3 Table 16 + * + * \param hBitStream HANDLE_FDK_BITSTREAM handle + * \param value the data to be written + * \param nBits1 number of bits to write for a small integer value or escape + * value + * \param nBits2 number of bits to write for a medium sized integer value or + * escape value + * \param nBits3 number of bits to write for a large integer value + * \return number of bits written + */ +FDK_INLINE UCHAR FDKwriteEscapedValue(HANDLE_FDK_BITSTREAM hBitStream, + UINT value, UINT nBits1, UINT nBits2, + UINT nBits3) { + UCHAR nbits = 0; + UINT tmp = (1 << nBits1) - 1; + + if (value < tmp) { + nbits += FDKwriteBits(hBitStream, value, nBits1); + } else { + nbits += FDKwriteBits(hBitStream, tmp, nBits1); + value -= tmp; + tmp = (1 << nBits2) - 1; + + if (value < tmp) { + nbits += FDKwriteBits(hBitStream, value, nBits2); + } else { + nbits += FDKwriteBits(hBitStream, tmp, nBits2); + value -= tmp; + + nbits += FDKwriteBits(hBitStream, value, nBits3); + } + } + + return nbits; +} + +/** + * \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 if (hBitStream->BitsInCache) /* 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 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, + (UINT)((INT)8 - (((INT)alignmentAnchor - + (INT)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 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, 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/fdk-aac/libFDK/include/FDK_core.h b/fdk-aac/libFDK/include/FDK_core.h new file mode 100644 index 0000000..9543522 --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_core.h @@ -0,0 +1,122 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Manuel Jander + + Description: FDK tools versioning support + +*******************************************************************************/ + +#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/fdk-aac/libFDK/include/FDK_crc.h b/fdk-aac/libFDK/include/FDK_crc.h new file mode 100644 index 0000000..6c7040c --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_crc.h @@ -0,0 +1,225 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + 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; + INT bitBufCntBits; + INT 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/fdk-aac/libFDK/include/FDK_decorrelate.h b/fdk-aac/libFDK/include/FDK_decorrelate.h new file mode 100644 index 0000000..733aaae --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_decorrelate.h @@ -0,0 +1,314 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Markus Lohwasser + + Description: FDK Tools Decorrelator + +*******************************************************************************/ + +#ifndef FDK_DECORRELATE_H +#define FDK_DECORRELATE_H + +#include "common_fix.h" + +#define FIXP_MPS FIXP_DBL + +#ifndef ARCH_PREFER_MULT_32x32 +#define FIXP_DECORR FIXP_SGL +#define FX_DECORR2FX_DBL FX_SGL2FX_DBL +#define FX_DECORR2FX_SGL +#define FX_DBL2FX_DECORR FX_DBL2FX_SGL +#define FX_SGL2FX_DECORR +#define DECORR(a) (FX_DBL2FXCONST_SGL(a)) +#define FL2FXCONST_DECORR FL2FXCONST_SGL +#else +#define FIXP_DECORR FIXP_DBL +#define FX_DECORR2FX_DBL +#define FX_DECORR2FX_SGL FX_DBL2FX_SGL +#define FX_DBL2FX_DECORR +#define FX_SGL2FX_DECORR FX_SGL2FX_DBL +#define DECORR(a) FIXP_DBL(a) +#define FL2FXCONST_DECORR FL2FXCONST_DBL +#endif + +/*--------------- enums -------------------------------*/ + +/** + * Decorrelator types. + */ +typedef enum { + DECORR_MPS, /**< Decorrelator type used by MPS LP/HQ */ + DECORR_PS, /**< Decorrelator type used by HEAACv2 and MPS LP */ + DECORR_USAC, /**< Decorrelator type used by USAC */ + DECORR_LD /**< Decorrelator type used by MPS Low Delay */ +} FDK_DECORR_TYPE; + +/** + * Ducker types. + */ +typedef enum { + DUCKER_AUTOMATIC, /**< FDKdecorrelateInit() chooses correct ducker type + depending on provided parameters. */ + DUCKER_MPS, /**< Force ducker type to MPS. */ + DUCKER_PS /**< Force ducker type to PS. */ +} FDK_DUCKER_TYPE; + +/** + * Reverb band types. + */ +typedef enum { + NOT_EXIST, /**< Mark reverb band as non-existing (number of bands = 0). */ + DELAY, /**< Reverb bands just contains delay elements and no allpass filters. + */ + COMMON_REAL, /**< Real filter coeffs, common filter coeffs within one reverb + band */ + COMMON_CPLX, /**< Complex filter coeffs, common filter coeffs within one + reverb band */ + INDEP_CPLX, /**< Complex filter coeffs, independent filter coeffs for each + hybrid band */ + INDEP_CPLX_PS /**< PS optimized implementation of general INDEP_CPLX type */ +} REVBAND_FILT_TYPE; + +typedef struct DECORR_DEC *HANDLE_DECORR_DEC; + +typedef struct DUCKER_INSTANCE { + int hybridBands; + int parameterBands; + int partiallyComplex; + FDK_DUCKER_TYPE duckerType; + + const UCHAR *qs_next; + const UCHAR *mapProcBands2HybBands; + const UCHAR *mapHybBands2ProcBands; + /* interleaved SmoothDirectNrg[] and SmoothReverbNrg[], + non-interleaved SmoothDirectNrg[] in case of parametric stereo */ + FIXP_MPS SmoothDirRevNrg[2 * (28)]; + + /* + parametric stereo + */ + FIXP_MPS peakDecay[(28)]; + FIXP_MPS peakDiff[(28)]; + FIXP_DBL maxValDirectData; + FIXP_DBL maxValReverbData; + SCHAR scaleDirectNrg; + SCHAR scaleReverbNrg; + SCHAR scaleSmoothDirRevNrg; + SCHAR headroomSmoothDirRevNrg; + +} DUCKER_INSTANCE; + +typedef struct DECORR_FILTER_INSTANCE { + FIXP_MPS *stateCplx; + FIXP_DBL *DelayBufferCplx; + + const FIXP_DECORR *numeratorReal; + const FIXP_STP *coeffsPacked; + const FIXP_DECORR *denominatorReal; +} DECORR_FILTER_INSTANCE; + +typedef struct DECORR_DEC { + INT L_stateBufferCplx; + FIXP_DBL *stateBufferCplx; + INT L_delayBufferCplx; + FIXP_DBL *delayBufferCplx; + + const REVBAND_FILT_TYPE *REV_filtType; + const UCHAR *REV_bandOffset; + const UCHAR *REV_delay; + const SCHAR *REV_filterOrder; + INT reverbBandDelayBufferIndex[(4)]; + UCHAR stateBufferOffset[(3)]; + + DECORR_FILTER_INSTANCE Filter[(71)]; + DUCKER_INSTANCE ducker; + + int numbins; + int partiallyComplex; +} DECORR_DEC; + +/** + * \brief Create one instance of Decorrelator. + * + * \param hDecorrDec A pointer to a decorrelator instance which was + * allocated externally. + * \param bufferCplx Externally allocated buffer (allocate (2*( ( 825 ) + * + ( 373 ) )) FIXP_DBL values). + * \param bufLen Length of bufferCplx. Must be >= (2*( ( 825 ) + ( + * 373 ) )). + * + * \return 0 on success. + */ +INT FDKdecorrelateOpen(HANDLE_DECORR_DEC hDecorrDec, FIXP_DBL *bufferCplx, + const INT bufLen); + +/** + * \brief Initialize and configure Decorrelator instance. + * + * \param hDecorrDec A Decorrelator handle. + * \param nrHybBands Number of (hybrid) bands. + * \param decorrType Decorrelator type to use. + * \param duckerType Ducker type to use (in general use + * DUCKER_AUTOMATIC). + * \param decorrConfig Depending on decorrType values of 0,1,2 are + * allowed. + * \param seed Seed of decorrelator instance. Allowed maximum + * valued depends on decorrType. + * \param partiallyComplex Low power or high quality processing 0: HQ, 1: LQ + * (only allowed for DECORR_MPS | DECORR_PS). + * \param useFractDelay Indicate usage of fractional delay 0: off, 1: on + * (currently not supported). + * \param isLegacyPS Indicate if DECORR_PS is used for HEAACv2 (for all + * other cases: isLegacyPS = 0). The purpose of this parameter is to select the + * correct number of param bands for the ducker. + * \param initStatesFlag Indicates whether the states buffer has to be + * cleared. + * + * \return 0 on success. + */ +INT FDKdecorrelateInit(HANDLE_DECORR_DEC hDecorrDec, const INT nrHybBands, + const FDK_DECORR_TYPE decorrType, + const FDK_DUCKER_TYPE duckerType, const INT decorrConfig, + const INT seed, const INT partiallyComplex, + const INT useFractDelay, const INT isLegacyPS, + const INT initStatesFlag); + +/** + * \brief Apply Decorrelator on input data. + * + * Function applies decorrelator and ducker inplace on hybrid input data. + * Modified hybrid data will be returned inplace. + * + * \param hDecorrDec A decorrelator handle. + * \param dataRealIn In (hybrid) data. + * \param dataImagIn In (hybrid) data. + * \param dataRealOut Out (hybrid) data (can be same as dataRealIn for + * in-place calculation). + * \param dataImagOut Out (hybrid) data (can be same as dataImagIn for + * in-place calculation). + * \param startHybBand Hybrid band to start with decorrelation. + * + * \return 0 on success. + */ +INT FDKdecorrelateApply(HANDLE_DECORR_DEC hDecorrDec, FIXP_DBL *dataRealIn, + FIXP_DBL *dataImagIn, FIXP_DBL *dataRealOut, + FIXP_DBL *dataImagOut, const INT startHybBand); + +/** + * \brief Destroy a Decorrelator instance. + * + * Deallocate whole memory of decorraltor and inside ducker. + * + * \param hDecorrDec Pointer to a decoderrolator handle. Null initialized on + * return. + * + * \return 0 on success. + */ +INT FDKdecorrelateClose(HANDLE_DECORR_DEC hDecorrDec); + +/** + * \brief Get max value address of direct signal. + * + * Get max value address of direct signal needed for ducker energy calculation. + * + * \param hDecorrDec Pointer to a decoderrolator handle. + * + * \return address of max value + */ +FIXP_DBL *getAddrDirectSignalMaxVal(HANDLE_DECORR_DEC hDecorrDec); + +#endif /* FDK_DECORRELATE_H */ diff --git a/fdk-aac/libFDK/include/FDK_hybrid.h b/fdk-aac/libFDK/include/FDK_hybrid.h new file mode 100644 index 0000000..583f299 --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_hybrid.h @@ -0,0 +1,255 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Markus Lohwasser + + Description: FDK Tools Hybrid Filterbank + +*******************************************************************************/ + +#ifndef FDK_HYBRID_H +#define FDK_HYBRID_H + +#include "common_fix.h" + +/*--------------- enums -------------------------------*/ + +/** + * Hybrid Filterband modes. + */ +typedef enum { + THREE_TO_TEN, + THREE_TO_TWELVE, + THREE_TO_SIXTEEN + +} FDK_HYBRID_MODE; + +/*--------------- structure definitions ---------------*/ +typedef const struct FDK_HYBRID_SETUP *HANDLE_FDK_HYBRID_SETUP; + +typedef struct { + FIXP_DBL *bufferLFReal[3]; /*!< LF real filter states. */ + FIXP_DBL *bufferLFImag[3]; /*!< LF imag filter states. */ + FIXP_DBL *bufferHFReal[13]; /*!< HF real delay lines. */ + FIXP_DBL *bufferHFImag[13]; /*!< HF imag delay lines. */ + + INT bufferLFpos; /*!< Position to write incoming data into ringbuffer. */ + INT bufferHFpos; /*!< Delay line positioning. */ + INT nrBands; /*!< Number of QMF bands. */ + INT cplxBands; /*!< Number of complex QMF bands.*/ + UCHAR hfMode; /*!< Flag signalizes treatment of HF bands. */ + + FIXP_DBL *pLFmemory; /*!< Pointer to LF states buffer. */ + FIXP_DBL *pHFmemory; /*!< Pointer to HF states buffer. */ + + UINT LFmemorySize; /*!< Size of LF states buffer. */ + UINT HFmemorySize; /*!< Size of HF states buffer. */ + + HANDLE_FDK_HYBRID_SETUP pSetup; /*!< Pointer to filter setup. */ + +} FDK_ANA_HYB_FILTER; + +typedef struct { + INT nrBands; /*!< Number of QMF bands. */ + INT cplxBands; /*!< Number of complex QMF bands.*/ + + HANDLE_FDK_HYBRID_SETUP pSetup; /*!< Pointer to filter setup. */ + +} FDK_SYN_HYB_FILTER; + +typedef FDK_ANA_HYB_FILTER *HANDLE_FDK_ANA_HYB_FILTER; +typedef FDK_SYN_HYB_FILTER *HANDLE_FDK_SYN_HYB_FILTER; + +/** + * \brief Create one instance of Hybrid Analyis Filterbank. + * + * \param hAnalysisHybFilter Pointer to an outlying allocated Hybrid Analysis + * Filterbank structure. + * \param pLFmemory Pointer to outlying buffer used LF filtering. + * \param LFmemorySize Size of pLFmemory in bytes. + * \param pHFmemory Pointer to outlying buffer used HF delay line. + * \param HFmemorySize Size of pLFmemory in bytes. + * + * \return 0 on success. + */ +INT FDKhybridAnalysisOpen(HANDLE_FDK_ANA_HYB_FILTER hAnalysisHybFilter, + FIXP_DBL *const pLFmemory, const UINT LFmemorySize, + FIXP_DBL *const pHFmemory, const UINT HFmemorySize); + +/** + * \brief Initialize and configure Hybrid Analysis Filterbank instance. + * + * \param hAnalysisHybFilter A Hybrid Analysis Filterbank handle. + * \param mode Select hybrid filter configuration. + * \param qmfBands Number of qmf bands to be processed. + * \param cplxBands Number of complex qmf bands to be processed. + * \param initStatesFlag Indicates whether the states buffer has to be + * cleared. + * + * \return 0 on success. + */ +INT FDKhybridAnalysisInit(HANDLE_FDK_ANA_HYB_FILTER hAnalysisHybFilter, + const FDK_HYBRID_MODE mode, const INT qmfBands, + const INT cplxBands, const INT initStatesFlag); + +/** + * \brief Adjust Hybrid Analysis Filterbank states. + * + * \param hAnalysisHybFilter A Hybrid Analysis Filterbank handle. + * \param scalingValue Scaling value to be applied on filter states. + * + * \return 0 on success. + */ +INT FDKhybridAnalysisScaleStates(HANDLE_FDK_ANA_HYB_FILTER hAnalysisHybFilter, + const INT scalingValue); + +/** + * \brief Apply Hybrid Analysis Filterbank on Qmf input data. + * + * \param hAnalysisHybFilter A Hybrid Analysis Filterbank handle. + * \param pQmfReal Qmf input data. + * \param pQmfImag Qmf input data. + * \param pHybridReal Hybrid output data. + * \param pHybridImag Hybrid output data. + * + * \return 0 on success. + */ +INT FDKhybridAnalysisApply(HANDLE_FDK_ANA_HYB_FILTER hAnalysisHybFilter, + const FIXP_DBL *const pQmfReal, + const FIXP_DBL *const pQmfImag, + FIXP_DBL *const pHybridReal, + FIXP_DBL *const pHybridImag); + +/** + * \brief Close a Hybrid Analysis Filterbank instance. + * + * \param hAnalysisHybFilter Pointer to a Hybrid Analysis Filterbank instance. + * + * \return 0 on success. + */ +INT FDKhybridAnalysisClose(HANDLE_FDK_ANA_HYB_FILTER hAnalysisHybFilter); + +/** + * \brief Initialize and configure Hybrdid Synthesis Filterbank instance. + * + * \param hSynthesisHybFilter A Hybrid Synthesis Filterbank handle. + * \param mode Select hybrid filter configuration. + * \param qmfBands Number of qmf bands to be processed. + * \param cplxBands Number of complex qmf bands to be processed. + * + * \return 0 on success. + */ +INT FDKhybridSynthesisInit(HANDLE_FDK_SYN_HYB_FILTER hSynthesisHybFilter, + const FDK_HYBRID_MODE mode, const INT qmfBands, + const INT cplxBands); + +/** + * \brief Apply Hybrid Analysis Filterbank on Hybrid data. + * + * \param hSynthesisHybFilter A Hybrid Analysis Filterbandk handle. + * \param pHybridReal Hybrid input data. + * \param pHybridImag Hybrid input data. + * \param pQmfReal Qmf output data. + * \param pQmfImag Qmf output data. + * + */ +void FDKhybridSynthesisApply(HANDLE_FDK_SYN_HYB_FILTER hSynthesisHybFilter, + const FIXP_DBL *const pHybridReal, + const FIXP_DBL *const pHybridImag, + FIXP_DBL *const pQmfReal, + FIXP_DBL *const pQmfImag); + +#endif /* FDK_HYBRID_H */ diff --git a/fdk-aac/libFDK/include/FDK_lpc.h b/fdk-aac/libFDK/include/FDK_lpc.h new file mode 100644 index 0000000..851dd1f --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_lpc.h @@ -0,0 +1,218 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Manuel Jander + + Description: LPC related functions + +*******************************************************************************/ + +#ifndef FDK_LPC_H +#define FDK_LPC_H + +#include "common_fix.h" + +#define LPC_MAX_ORDER 24 + +/* + * Experimental solution for lattice filter substitution. + * LPC_SYNTHESIS_IIR macro must be activated in aacdec_tns.cpp. + * When LPC_SYNTHESIS_IIR enabled, there will be a substitution of the default + * lpc synthesis lattice filter by an IIR synthesis filter (with a conversionof + * the filter coefs). LPC_TNS related macros are intended to implement the data + * types used by the CLpc_Synthesis variant which is used for this solution. + * */ + +/* #define LPC_TNS_LOWER_PRECISION */ + +typedef FIXP_DBL FIXP_LPC_TNS; +#define FX_DBL2FX_LPC_TNS(x) (x) +#define FX_DBL2FXCONST_LPC_TNS(x) (x) +#define FX_LPC_TNS2FX_DBL(x) (x) +#define FL2FXCONST_LPC_TNS(val) FL2FXCONST_DBL(val) +#define MAXVAL_LPC_TNS MAXVAL_DBL + +typedef FIXP_SGL FIXP_LPC; +#define FX_DBL2FX_LPC(x) FX_DBL2FX_SGL((FIXP_DBL)(x)) +#define FX_DBL2FXCONST_LPC(x) FX_DBL2FXCONST_SGL(x) +#define FX_LPC2FX_DBL(x) FX_SGL2FX_DBL(x) +#define FL2FXCONST_LPC(val) FL2FXCONST_SGL(val) +#define MAXVAL_LPC MAXVAL_SGL + +/** + * \brief Obtain residual signal through LPC analysis. + * \param signal pointer to buffer holding signal to be analysed. Residual is + * returned there (in place) + * \param signal_size the size of the input data in pData + * \param lpcCoeff_m the LPC filter coefficient mantissas + * \param lpcCoeff_e the LPC filter coefficient exponent + * \param order the LPC filter order (size of coeff) + * \param filtState Pointer to state buffer of size order + * \param filtStateIndex pointer to state index storage + */ +void CLpc_Analysis(FIXP_DBL signal[], const int signal_size, + const FIXP_LPC lpcCoeff_m[], const int lpcCoeff_e, + const int order, FIXP_DBL *filtState, int *filtStateIndex); + +/** + * \brief Synthesize signal fom residual through LPC synthesis, using LP + * coefficients. + * \param signal pointer to buffer holding the residual signal. The synthesis is + * returned there (in place) + * \param signal_size the size of the input data in pData + * \param inc buffer traversal increment for signal + * \param coeff the LPC filter coefficients + * \param coeff_e exponent of coeff + * \param order the LPC filter order (size of coeff) + * \param state state buffer of size LPC_MAX_ORDER + * \param pStateIndex pointer to state index storage + */ +void CLpc_Synthesis(FIXP_DBL *signal, const int signal_size, const int signal_e, + const int inc, const FIXP_LPC_TNS *lpcCoeff_m, + const int lpcCoeff_e, const int order, FIXP_DBL *state, + int *pStateIndex); +void CLpc_Synthesis(FIXP_DBL *signal, const int signal_size, const int signal_e, + const int inc, const FIXP_LPC coeff[], const int coeff_e, + const int order, FIXP_DBL *filtState, int *pStateIndex); + +/** + * \brief Synthesize signal fom residual through LPC synthesis, using ParCor + * coefficients. The algorithm assumes a filter gain of max 1.0. If the filter + * gain is higher, this must be accounted into the values of signal_e + * and/or signal_e_out to avoid overflows. + * \param signal pointer to buffer holding the residual signal. The synthesis is + * returned there (in place) + * \param signal_size the size of the input data in pData + * \param inc buffer traversal increment for signal + * \param coeff the LPC filter coefficients + * \param coeff_e exponent of coeff + * \param order the LPC filter order (size of coeff) + * \param state state buffer of size LPC_MAX_ORDER + */ +void CLpc_SynthesisLattice(FIXP_DBL *signal, const int signal_size, + const int signal_e, const int signal_e_out, + const int inc, const FIXP_SGL *coeff, + const int order, FIXP_DBL *state); + +void CLpc_SynthesisLattice(FIXP_DBL *RESTRICT signal, const int signal_size, + const int signal_e, const int signal_e_out, + const int inc, const FIXP_DBL *RESTRICT coeff, + const int order, FIXP_DBL *RESTRICT state); + +/** + * \brief + */ +INT CLpc_ParcorToLpc(const FIXP_LPC_TNS reflCoeff[], FIXP_LPC_TNS LpcCoeff[], + INT numOfCoeff, FIXP_DBL workBuffer[]); +INT CLpc_ParcorToLpc(const FIXP_LPC reflCoeff[], FIXP_LPC LpcCoeff[], + const int numOfCoeff, FIXP_DBL workBuffer[]); + +/** + * \brief Calculate ParCor (Partial autoCorrelation, reflection) coefficients + * from autocorrelation coefficients using the Schur algorithm (instead of + * Levinson Durbin). + * \param acorr order+1 autocorrelation coefficients + * \param reflCoeff output reflection /ParCor coefficients. The first + * coefficient which is always 1.0 is ommitted. + * \param order number of acorr / reflCoeff coefficients. + * \param pPredictionGain_m prediction gain mantissa + * \param pPredictionGain_e prediction gain exponent + */ +void CLpc_AutoToParcor(FIXP_DBL acorr[], const int acorr_e, + FIXP_LPC reflCoeff[], const int order, + FIXP_DBL *pPredictionGain_m, INT *pPredictionGain_e); + +#endif /* FDK_LPC_H */ diff --git a/fdk-aac/libFDK/include/FDK_matrixCalloc.h b/fdk-aac/libFDK/include/FDK_matrixCalloc.h new file mode 100644 index 0000000..ffb54fe --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_matrixCalloc.h @@ -0,0 +1,230 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: matrix memory allocation + +*******************************************************************************/ + +#ifndef FDK_MATRIXCALLOC_H +#define FDK_MATRIXCALLOC_H + +#include "machine_type.h" +#include "genericStds.h" + +/* It is recommended to use FDK_ALLOCATE_MEMORY_1D instead of fdkCallocMatrix1D + */ +void* fdkCallocMatrix1D(UINT dim1, UINT size); +void* fdkCallocMatrix1D_aligned(UINT dim1, UINT size); +/* It is recommended to use FDK_ALLOCATE_MEMORY_1D_INT instead of + * fdkCallocMatrix1D_int */ +void* fdkCallocMatrix1D_int(UINT dim1, UINT size, MEMORY_SECTION s); +void* fdkCallocMatrix1D_int_aligned(UINT dim1, UINT size, MEMORY_SECTION s); +/* It is recommended to use FDK_FREE_MEMORY_1D instead of fdkFreeMatrix1D */ +void fdkFreeMatrix1D(void* p); +void fdkFreeMatrix1D_aligned(void* p); + +/* It is recommended to use FDK_ALLOCATE_MEMORY_2D instead of fdkCallocMatrix2D + */ +void** fdkCallocMatrix2D(UINT dim1, UINT dim2, UINT size); +void** fdkCallocMatrix2D_aligned(UINT dim1, UINT dim2, UINT size); +/* It is recommended to use FDK_ALLOCATE_MEMORY_2D_INT instead of + * fdkCallocMatrix2D_int */ +void** fdkCallocMatrix2D_int(UINT dim1, UINT dim2, UINT size, MEMORY_SECTION s); +/* It is recommended to use FDK_ALLOCATE_MEMORY_2D_INT_ALIGNED instead of + * fdkCallocMatrix2D_int_aligned */ +void** fdkCallocMatrix2D_int_aligned(UINT dim1, UINT dim2, UINT size, + MEMORY_SECTION s); +/* It is recommended to use FDK_FREE_MEMORY_2D instead of fdkFreeMatrix2D */ +void fdkFreeMatrix2D(void** p); +/* It is recommended to use FDK_FREE_MEMORY_2D_ALIGNED instead of + * fdkFreeMatrix2D_aligned */ +void fdkFreeMatrix2D_aligned(void** p); + +/* It is recommended to use FDK_ALLOCATE_MEMORY_3D instead of fdkCallocMatrix3D + */ +void*** fdkCallocMatrix3D(UINT dim1, UINT dim2, UINT dim3, UINT size); +/* It is recommended to use FDK_ALLOCATE_MEMORY_3D_INT instead of + * fdkCallocMatrix3D_int */ +void*** fdkCallocMatrix3D_int(UINT dim1, UINT dim2, UINT dim3, UINT size, + MEMORY_SECTION s); +/* It is recommended to use FDK_FREE_MEMORY_3D instead of fdkFreeMatrix3D */ +void fdkFreeMatrix3D(void*** p); + +#define FDK_ALLOCATE_MEMORY_1D(a, dim1, type) \ + if (((a) = (type*)fdkCallocMatrix1D((dim1), sizeof(type))) == NULL) { \ + goto bail; \ + } + +#define FDK_ALLOCATE_MEMORY_1D_ALIGNED(a, dim1, type) \ + if (((a) = (type*)fdkCallocMatrix1D_aligned((dim1), sizeof(type))) == \ + NULL) { \ + goto bail; \ + } + +#define FDK_ALLOCATE_MEMORY_1D_P(a, dim1, type, ptype) \ + if (((a) = (ptype)fdkCallocMatrix1D((dim1), sizeof(type))) == NULL) { \ + goto bail; \ + } + +#define FDK_ALLOCATE_MEMORY_1D_INT(a, dim1, type, s) \ + if (((a) = (type*)fdkCallocMatrix1D_int((dim1), sizeof(type), (s))) == \ + NULL) { \ + goto bail; \ + } + +#define FDK_FREE_MEMORY_1D(a) \ + do { \ + fdkFreeMatrix1D((void*)(a)); \ + (a) = NULL; \ + } while (0) + +#define FDK_FREE_MEMORY_1D_ALIGNED(a) \ + do { \ + fdkFreeMatrix1D_aligned((void*)(a)); \ + (a) = NULL; \ + } while (0) + +#define FDK_ALLOCATE_MEMORY_2D(a, dim1, dim2, type) \ + if (((a) = (type**)fdkCallocMatrix2D((dim1), (dim2), sizeof(type))) == \ + NULL) { \ + goto bail; \ + } + +#define FDK_ALLOCATE_MEMORY_2D_INT(a, dim1, dim2, type, s) \ + if (((a) = (type**)fdkCallocMatrix2D_int((dim1), (dim2), sizeof(type), \ + (s))) == NULL) { \ + goto bail; \ + } + +#define FDK_ALLOCATE_MEMORY_2D_INT_ALIGNED(a, dim1, dim2, type, s) \ + if (((a) = (type**)fdkCallocMatrix2D_int_aligned( \ + (dim1), (dim2), sizeof(type), (s))) == NULL) { \ + goto bail; \ + } + +#define FDK_FREE_MEMORY_2D(a) \ + do { \ + fdkFreeMatrix2D((void**)(a)); \ + (a) = NULL; \ + } while (0) + +#define FDK_FREE_MEMORY_2D_ALIGNED(a) \ + do { \ + fdkFreeMatrix2D_aligned((void**)(a)); \ + (a) = NULL; \ + } while (0) + +#define FDK_ALLOCATE_MEMORY_3D(a, dim1, dim2, dim3, type) \ + if (((a) = (type***)fdkCallocMatrix3D((dim1), (dim2), (dim3), \ + sizeof(type))) == NULL) { \ + goto bail; \ + } + +#define FDK_ALLOCATE_MEMORY_3D_INT(a, dim1, dim2, dim3, type, s) \ + if (((a) = (type***)fdkCallocMatrix3D_int((dim1), (dim2), (dim3), \ + sizeof(type), (s))) == NULL) { \ + goto bail; \ + } + +#define FDK_FREE_MEMORY_3D(a) \ + do { \ + fdkFreeMatrix3D((void***)(a)); \ + (a) = NULL; \ + } while (0) + +#endif /* FDK_MATRIXCALLOC_H */ diff --git a/fdk-aac/libFDK/include/FDK_qmf_domain.h b/fdk-aac/libFDK/include/FDK_qmf_domain.h new file mode 100644 index 0000000..5c12682 --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_qmf_domain.h @@ -0,0 +1,416 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Matthias Hildenbrand + + Description: Module to efficiently handle QMF data for multiple channels and + to share the data between e.g. SBR and MPS + +*******************************************************************************/ + +#ifndef FDK_QMF_DOMAIN_H +#define FDK_QMF_DOMAIN_H + +#include "qmf.h" + +typedef enum { + QMF_DOMAIN_OK = 0x0, /*!< No error occurred. */ + QMF_DOMAIN_OUT_OF_MEMORY = + 0x1, /*!< QMF-Configuration demands for more memory than allocated on + heap. */ + QMF_DOMAIN_INIT_ERROR = + 0x2, /*!< An error during filterbank-setup occurred. */ + QMF_DOMAIN_RESAMPLER_INIT_ERROR = + 0x3 /*!< An error during QMF-resampler-setup occurred. */ +} QMF_DOMAIN_ERROR; + +#define CMPLX_MOD (2) + +#define QMF_MAX_WB_SECTIONS (5) /* maximum number of workbuffer sections */ +#define QMF_WB_SECTION_SIZE (1024 * 2) + +H_ALLOC_MEM_OVERLAY(QmfWorkBufferCore1, FIXP_DBL) +H_ALLOC_MEM_OVERLAY(QmfWorkBufferCore2, FIXP_DBL) +H_ALLOC_MEM_OVERLAY(QmfWorkBufferCore3, FIXP_DBL) +H_ALLOC_MEM_OVERLAY(QmfWorkBufferCore4, FIXP_DBL) +H_ALLOC_MEM_OVERLAY(QmfWorkBufferCore5, FIXP_DBL) +H_ALLOC_MEM_OVERLAY(QmfWorkBufferCore6, FIXP_DBL) + +#define QMF_DOMAIN_MAX_ANALYSIS_QMF_BANDS (64) +#define QMF_DOMAIN_MAX_SYNTHESIS_QMF_BANDS (QMF_MAX_SYNTHESIS_BANDS) +#define QMF_DOMAIN_MAX_QMF_PROC_BANDS (64) +#define QMF_DOMAIN_MAX_TIMESLOTS (64) +#define QMF_DOMAIN_MAX_OV_TIMESLOTS (12) + +#define QMF_DOMAIN_ANALYSIS_QMF_BANDS_16 (16) +#define QMF_DOMAIN_ANALYSIS_QMF_BANDS_24 (24) +#define QMF_DOMAIN_ANALYSIS_QMF_BANDS_32 (32) + +#define QMF_DOMAIN_TIMESLOTS_16 (16) +#define QMF_DOMAIN_TIMESLOTS_32 (32) + +#define QMF_DOMAIN_OV_TIMESLOTS_16 (3) +#define QMF_DOMAIN_OV_TIMESLOTS_32 (6) + +H_ALLOC_MEM(AnaQmfStates, FIXP_QAS) +H_ALLOC_MEM(SynQmfStates, FIXP_QSS) +H_ALLOC_MEM(QmfSlotsReal, FIXP_DBL *) +H_ALLOC_MEM(QmfSlotsImag, FIXP_DBL *) +H_ALLOC_MEM(QmfOverlapBuffer, FIXP_DBL) + +H_ALLOC_MEM(AnaQmfStates16, FIXP_QAS) +H_ALLOC_MEM(AnaQmfStates24, FIXP_QAS) +H_ALLOC_MEM(AnaQmfStates32, FIXP_QAS) +H_ALLOC_MEM(QmfSlotsReal16, FIXP_DBL *) +H_ALLOC_MEM(QmfSlotsReal32, FIXP_DBL *) +H_ALLOC_MEM(QmfSlotsImag16, FIXP_DBL *) +H_ALLOC_MEM(QmfSlotsImag32, FIXP_DBL *) +H_ALLOC_MEM(QmfOverlapBuffer16, FIXP_DBL) +H_ALLOC_MEM(QmfOverlapBuffer32, FIXP_DBL) + +#define QDOM_PCM INT_PCM + +/** + * Structure to hold the configuration data which is global whithin a QMF domain + * instance. + */ +typedef struct { + UCHAR qmfDomainExplicitConfig; /*!< Flag to signal that QMF domain is set + explicitly instead of SBR and MPS init + routines. */ + UCHAR nInputChannels; /*!< Number of QMF input channels. */ + UCHAR nInputChannels_requested; /*!< Corresponding requested not yet active + configuration parameter. */ + UCHAR nOutputChannels; /*!< Number of QMF output channels. */ + UCHAR nOutputChannels_requested; /*!< Corresponding requested not yet active + configuration parameter. */ + UCHAR + parkChannel; /*!< signal to automatically allocate additional memory to + park a channel if only one processing channel is + available. */ + UCHAR parkChannel_requested; + QDOM_PCM + *TDinput; /*!< Pointer to time domain data used as input for the QMF + analysis. */ + FIXP_DBL * + pWorkBuffer[QMF_MAX_WB_SECTIONS]; /*!< Pointerarray to volatile memory. */ + UINT flags; /*!< Flags to be set on all QMF analysis/synthesis filter + instances. */ + UINT flags_requested; /*!< Corresponding requested not yet active + configuration parameter. */ + UCHAR nBandsAnalysis; /*!< Number of QMF analysis bands for all input + channels. */ + UCHAR nBandsAnalysis_requested; /*!< Corresponding requested not yet active + configuration parameter. */ + USHORT nBandsSynthesis; /*!< Number of QMF synthesis bands for all output + channels. */ + USHORT + nBandsSynthesis_requested; /*!< Corresponding requested not yet active + configuration parameter. */ + UCHAR nQmfTimeSlots; /*!< Number of QMF time slots (stored in work buffer + memory). */ + UCHAR nQmfTimeSlots_requested; /*!< Corresponding requested not yet active + configuration parameter. */ + UCHAR + nQmfOvTimeSlots; /*!< Number of QMF overlap/delay time slots (stored in + persistent memory). */ + UCHAR nQmfOvTimeSlots_requested; /*!< Corresponding requested not yet active + configuration parameter. */ + UCHAR nQmfProcBands; /*!< Number of QMF bands which are processed by the + decoder. Typically this is equal to nBandsSynthesis + but it may differ if the QMF based resampler is being + used. */ + UCHAR nQmfProcBands_requested; /*!< Corresponding requested not yet active + configuration parameter. */ + UCHAR + nQmfProcChannels; /*!< Number of complete QMF channels which need to + coexist in memory at the same time. For most cases + this is 1 which means the work buffer can be shared + between audio channels. */ + UCHAR + nQmfProcChannels_requested; /*!< Corresponding requested not yet active + configuration parameter. */ +} FDK_QMF_DOMAIN_GC; +typedef FDK_QMF_DOMAIN_GC *HANDLE_FDK_QMF_DOMAIN_GC; + +/** + * Structure representing one QMF input channel. This includes the QMF analysis + * and the QMF domain data representation needed by the codec. Work buffer data + * may be shared between channels if the codec processes all QMF channels in a + * consecutive order. + */ +typedef struct { + HANDLE_FDK_QMF_DOMAIN_GC + pGlobalConf; /*!< Pointer to global configuration structure. */ + QMF_FILTER_BANK fb; /*!< QMF (analysis) filter bank structure. */ + QMF_SCALE_FACTOR scaling; /*!< Structure with scaling information. */ + UCHAR workBuf_nTimeSlots; /*!< Work buffer dimension for this channel is + (workBuf_nTimeSlots * workBuf_nBands * + CMPLX_MOD). */ + UCHAR workBuf_nBands; /*!< Work buffer dimension for this channel is + (workBuf_nTimeSlots * workBuf_nBands * CMPLX_MOD). */ + USHORT workBufferOffset; /*!< Offset within work buffer. */ + USHORT workBufferSectSize; /*!< Size of work buffer section. */ + FIXP_QAS * + pAnaQmfStates; /*!< Pointer to QMF analysis states (persistent memory). */ + FIXP_DBL + *pOverlapBuffer; /*!< Pointer to QMF overlap/delay memory (persistent + memory). */ + FIXP_DBL **pWorkBuffer; /*!< Pointer array to available work buffers. */ + FIXP_DBL * + *hQmfSlotsReal; /*!< Handle for QMF real data time slot pointer array. */ + FIXP_DBL **hQmfSlotsImag; /*!< Handle for QMF imaginary data time slot pointer + array. */ +} FDK_QMF_DOMAIN_IN; +typedef FDK_QMF_DOMAIN_IN *HANDLE_FDK_QMF_DOMAIN_IN; + +/** + * Structure representing one QMF output channel. + */ +typedef struct { + QMF_FILTER_BANK fb; /*!< QMF (synthesis) filter bank structure. */ + FIXP_QSS *pSynQmfStates; /*!< Pointer to QMF synthesis states (persistent + memory). */ +} FDK_QMF_DOMAIN_OUT; +typedef FDK_QMF_DOMAIN_OUT *HANDLE_FDK_QMF_DOMAIN_OUT; + +/** + * Structure representing the QMF domain for multiple channels. + */ +typedef struct { + FDK_QMF_DOMAIN_GC globalConf; /*!< Global configuration structure. */ + FDK_QMF_DOMAIN_IN + QmfDomainIn[((8) + (1))]; /*!< Array of QMF domain input structures */ + FDK_QMF_DOMAIN_OUT + QmfDomainOut[((8) + (1))]; /*!< Array of QMF domain output structures */ +} FDK_QMF_DOMAIN; +typedef FDK_QMF_DOMAIN *HANDLE_FDK_QMF_DOMAIN; + +/** + * \brief Check whether analysis- and synthesis-filterbank-states have been + * initialized. + * + * \param qd Pointer to QMF domain structure. + * + * \return 1 if initialized, 0 else + */ +int FDK_QmfDomain_IsInitialized(const HANDLE_FDK_QMF_DOMAIN qd); + +/** + * \brief Initialize QMF analysis and synthesis filter banks and set up QMF data + * representation. + * + * \param qd Pointer to QMF domain structure. + * \param extra_flags Initialize filter banks with extra flags which were not + * set in the global config flags field. + * + * \return 0 on success. + */ +int FDK_QmfDomain_InitFilterBank(HANDLE_FDK_QMF_DOMAIN qd, UINT extra_flags); + +/** + * \brief When QMF processing of one channel is finished copy the overlap/delay + * part into the persistent memory to be used in the next frame. + * + * \param qd_ch Pointer to a QMF domain input channel. + * \param offset + * + * \return void + */ +void FDK_QmfDomain_SaveOverlap(HANDLE_FDK_QMF_DOMAIN_IN qd_ch, int offset); + +/** + * \brief Get one slot of QMF data and adapt the scaling. + * + * \param qd_ch Pointer to a QMF domain input channel. + * \param ts Time slot number to be obtained. + * \param start_band Start index of QMF bands to be obtained. + * \param stop_band Stop index of QMF band to be obtained. + * \param pQmfOutReal Output buffer (real QMF data). + * \param pQmfOutImag Output buffer (imag QMF data). + * \param exp_out Target exponent (scaling) of data. + * + * \return void + */ +void FDK_QmfDomain_GetSlot(const HANDLE_FDK_QMF_DOMAIN_IN qd_ch, const int ts, + const int start_band, const int stop_band, + FIXP_DBL *pQmfOutReal, FIXP_DBL *pQmfOutImag, + const int exp_out); + +/** + * \brief Direct access to the work buffer associated with a certain channel (no + * time slot pointer array is used). + * + * \param qd_ch Pointer to a QMF domain input channel. + * \param ts Time slot number to be obtained. + * \param ppQmfReal Returns the pointer to the requested part of the work buffer + * (real time slot). + * \param ppQmfImag Returns the pointer to the requested part of the work buffer + * (imag time slot). + * + * \return void + */ +void FDK_QmfDomain_GetWorkBuffer(const HANDLE_FDK_QMF_DOMAIN_IN qd_ch, + const int ts, FIXP_DBL **ppQmfReal, + FIXP_DBL **ppQmfImag); + +/** + * \brief For the case that the work buffer associated to this channel is not + * identical to the processing channel work buffer copy the data into the + * processing channel. + * + * \param qd_ch Pointer to a QMF domain input channel. + * \return void + */ +void FDK_QmfDomain_WorkBuffer2ProcChannel(const HANDLE_FDK_QMF_DOMAIN_IN qd_ch); + +/** + * \brief For the case of stereoCfgIndex3 with HBE the HBE buffer is copied into + * the processing channel work buffer and the processing channel work buffer is + * copied into the HBE buffer. + * + * \param qd_ch Pointer to a QMF domain input channel. + * \param ppQmfReal Pointer to a HBE QMF data buffer (real). + * \param ppQmfImag Pointer to a HBE QMF data buffer (imag). + * + * \return void + */ +void FDK_QmfDomain_QmfData2HBE(HANDLE_FDK_QMF_DOMAIN_IN qd_ch, + FIXP_DBL **ppQmfReal, FIXP_DBL **ppQmfImag); + +/** + * \brief Set all fields for requested parametervalues in global config struct + * FDK_QMF_DOMAIN_GC to 0. + * + * \param hgc Pointer to a QMF domain global config struct. + */ +void FDK_QmfDomain_ClearRequested(HANDLE_FDK_QMF_DOMAIN_GC hgc); + +/** + * \brief Check for parameter-change requests in global config and + * (re-)configure QMF domain accordingly. + * + * \param hqd Pointer to QMF domain + * + * \return errorcode + */ +QMF_DOMAIN_ERROR FDK_QmfDomain_Configure(HANDLE_FDK_QMF_DOMAIN hqd); + +/** + * \brief Free QMF workbuffer, QMF persistent memory and configuration + * variables. + * + * \param hqd Pointer to QMF domain + */ +void FDK_QmfDomain_FreeMem(HANDLE_FDK_QMF_DOMAIN hqd); + +/** + * \brief Clear QMF overlap buffers and QMF filter bank states. + * + * \param hqd Pointer to QMF domain + */ +QMF_DOMAIN_ERROR FDK_QmfDomain_ClearPersistentMemory(HANDLE_FDK_QMF_DOMAIN hqd); + +/** + * \brief Free QMF workbuffer and QMF persistent memory. + * + * \param hqd Pointer to QMF domain + * + * \param dmx_lp_mode downmix low power mode flag + */ +void FDK_QmfDomain_Close(HANDLE_FDK_QMF_DOMAIN hqd); + +#endif /* FDK_QMF_DOMAIN_H */ diff --git a/fdk-aac/libFDK/include/FDK_tools_rom.h b/fdk-aac/libFDK/include/FDK_tools_rom.h new file mode 100644 index 0000000..d1cb980 --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_tools_rom.h @@ -0,0 +1,398 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Oliver Moser + + Description: ROM tables used by FDK tools + +*******************************************************************************/ + +#ifndef FDK_TOOLS_ROM_H +#define FDK_TOOLS_ROM_H + +#include "common_fix.h" +#include "FDK_audio.h" + +/* sinetables */ + +/* None radix2 rotation vectors */ +extern RAM_ALIGN const FIXP_STB RotVectorReal60[60]; +extern RAM_ALIGN const FIXP_STB RotVectorImag60[60]; +extern RAM_ALIGN const FIXP_STB RotVectorReal192[192]; +extern RAM_ALIGN const FIXP_STB RotVectorImag192[192]; +extern RAM_ALIGN const FIXP_STB RotVectorReal240[210]; +extern RAM_ALIGN const FIXP_STB RotVectorImag240[210]; +extern RAM_ALIGN const FIXP_STB RotVectorReal480[480]; +extern RAM_ALIGN const FIXP_STB RotVectorImag480[480]; +extern RAM_ALIGN const FIXP_STB RotVectorReal6[6]; +extern RAM_ALIGN const FIXP_STB RotVectorImag6[6]; +extern RAM_ALIGN const FIXP_STB RotVectorReal12[12]; +extern RAM_ALIGN const FIXP_STB RotVectorImag12[12]; +extern RAM_ALIGN const FIXP_STB RotVectorReal24[24]; +extern RAM_ALIGN const FIXP_STB RotVectorImag24[24]; +extern RAM_ALIGN const FIXP_STB RotVectorReal48[48]; +extern RAM_ALIGN const FIXP_STB RotVectorImag48[48]; +extern RAM_ALIGN const FIXP_STB RotVectorReal80[80]; +extern RAM_ALIGN const FIXP_STB RotVectorImag80[80]; +extern RAM_ALIGN const FIXP_STB RotVectorReal96[96]; +extern RAM_ALIGN const FIXP_STB RotVectorImag96[96]; +extern RAM_ALIGN const FIXP_STB RotVectorReal384[384]; +extern RAM_ALIGN const FIXP_STB RotVectorImag384[384]; +extern RAM_ALIGN const FIXP_STB RotVectorReal20[20]; +extern RAM_ALIGN const FIXP_STB RotVectorImag20[20]; +extern RAM_ALIGN const FIXP_STB RotVectorReal120[120]; +extern RAM_ALIGN const FIXP_STB RotVectorImag120[120]; + +/* Regular sine tables */ +extern RAM_ALIGN const FIXP_STP SineTable1024[]; +extern RAM_ALIGN const FIXP_STP SineTable512[]; +extern RAM_ALIGN const FIXP_STP SineTable480[]; +extern RAM_ALIGN const FIXP_STP SineTable384[]; +extern RAM_ALIGN const FIXP_STP SineTable80[]; +#ifdef INCLUDE_SineTable10 +extern RAM_ALIGN const FIXP_STP SineTable10[]; +#endif + +/* AAC-LC windows */ +extern RAM_ALIGN const FIXP_WTP SineWindow1024[]; +extern RAM_ALIGN const FIXP_WTP KBDWindow1024[]; +extern RAM_ALIGN const FIXP_WTP SineWindow128[]; +extern RAM_ALIGN const FIXP_WTP KBDWindow128[]; + +extern RAM_ALIGN const FIXP_WTP SineWindow960[]; +extern RAM_ALIGN const FIXP_WTP KBDWindow960[]; +extern RAM_ALIGN const FIXP_WTP SineWindow120[]; +extern RAM_ALIGN const FIXP_WTP KBDWindow120[]; + +/* AAC-LD windows */ +extern RAM_ALIGN const FIXP_WTP SineWindow512[]; +#define LowOverlapWindow512 SineWindow128 +extern RAM_ALIGN const FIXP_WTP SineWindow480[]; +#define LowOverlapWindow480 SineWindow120 + +/* USAC TCX Window */ +extern RAM_ALIGN const FIXP_WTP SineWindow256[256]; +extern RAM_ALIGN const FIXP_WTP SineWindow192[]; + +/* USAC 8/3 windows */ +extern RAM_ALIGN const FIXP_WTP SineWindow768[]; +extern RAM_ALIGN const FIXP_WTP KBDWindow768[]; +extern RAM_ALIGN const FIXP_WTP SineWindow96[]; +extern RAM_ALIGN const FIXP_WTP KBDWindow96[]; + +/* DCT and others */ +extern RAM_ALIGN const FIXP_WTP SineWindow64[]; +extern RAM_ALIGN const FIXP_WTP SineWindow48[]; +extern RAM_ALIGN const FIXP_WTP SineWindow32[]; +extern RAM_ALIGN const FIXP_WTP SineWindow24[]; +extern RAM_ALIGN const FIXP_WTP SineWindow16[]; +extern RAM_ALIGN const FIXP_WTP SineWindow8[]; + +/** + * \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][4][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 +#define FX_DBL2FX_QTW(x) FX_DBL2FX_SGL(x) +#else +#define FIXP_PFT FIXP_DBL +#define FIXP_QTW FIXP_DBL + +#define FX_DBL2FX_QTW(x) (x) + +#endif + +#define QMF640_PFT_TABLE_SIZE (640 / 2 + QMF_NO_POLY) + +/* Resampling twiddles for QMF */ + +/* Not resampling twiddles */ +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_cos32[32]; +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_sin32[32]; +/* Adapted analysis post-twiddles for down-sampled HQ SBR */ +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_cos_downsamp32[32]; +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_sin_downsamp32[32]; +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_cos64[64]; +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_sin64[64]; +extern RAM_ALIGN const FIXP_PFT + qmf_pfilt640[QMF640_PFT_TABLE_SIZE + QMF_NO_POLY]; +extern RAM_ALIGN const FIXP_PFT qmf_pfilt640_vector[640]; + +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_cos40[40]; +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_sin40[40]; +extern RAM_ALIGN const FIXP_PFT qmf_pfilt400[]; +extern RAM_ALIGN const FIXP_PFT qmf_pfilt200[]; +extern RAM_ALIGN const FIXP_PFT qmf_pfilt120[]; + +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_cos24[24]; +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_sin24[24]; +extern RAM_ALIGN const FIXP_PFT qmf_pfilt240[]; + +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_cos16[16]; +extern RAM_ALIGN const FIXP_QTW qmf_phaseshift_sin16[16]; + +#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_ana[32]; +extern const FIXP_QTW qmf_phaseshift_cos32_cldfb_syn[32]; +extern const FIXP_QTW qmf_phaseshift_sin32_cldfb[32]; + +extern const FIXP_QTW qmf_phaseshift_cos16_cldfb_ana[16]; +extern const FIXP_QTW qmf_phaseshift_cos16_cldfb_syn[16]; +extern const FIXP_QTW qmf_phaseshift_sin16_cldfb[16]; + +extern const FIXP_QTW qmf_phaseshift_cos8_cldfb_ana[8]; +extern const FIXP_QTW qmf_phaseshift_cos8_cldfb_syn[8]; +extern const FIXP_QTW qmf_phaseshift_sin8_cldfb[8]; + +extern const FIXP_QTW qmf_phaseshift_cos64_cldfb[64]; +extern const FIXP_QTW qmf_phaseshift_sin64_cldfb[64]; + +extern RAM_ALIGN const FIXP_PFT qmf_cldfb_640[QMF640_CLDFB_PFT_TABLE_SIZE]; +extern RAM_ALIGN const FIXP_PFT qmf_cldfb_320[QMF320_CLDFB_PFT_TABLE_SIZE]; +#define QMF160_CLDFB_PFT_TABLE_SIZE (160) +extern RAM_ALIGN const FIXP_PFT qmf_cldfb_160[QMF160_CLDFB_PFT_TABLE_SIZE]; +#define QMF80_CLDFB_PFT_TABLE_SIZE (80) +extern RAM_ALIGN const FIXP_PFT qmf_cldfb_80[QMF80_CLDFB_PFT_TABLE_SIZE]; + +#define QMF320_MPSLDFB_PFT_TABLE_SIZE (320) +#define QMF640_MPSLDFB_PFT_TABLE_SIZE (640) +#define QMF_MPSLDFB_PFT_SCALE 1 + +extern const FIXP_PFT qmf_mpsldfb_320[QMF320_MPSLDFB_PFT_TABLE_SIZE]; +extern RAM_ALIGN const FIXP_PFT qmf_mpsldfb_640[QMF640_MPSLDFB_PFT_TABLE_SIZE]; + +/** + * Audio bitstream element specific syntax flags: + */ +#define AC_EL_GA_CCE 0x00000001 /*!< GA AAC coupling channel element (CCE) */ + +/* + * Raw Data Block list items. + */ +typedef enum { + element_instance_tag, + common_window, /* -> decision for link_sequence */ + 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, /* -> decision for link_sequence */ + 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, + + coupled_elements, /* only for CCE parsing */ + gain_element_lists, /* only for CCE parsing */ + + /* 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. + * \param elFlags element specific flags. + * \return element_list_t parser guidance structure. + */ +const element_list_t *getBitstreamElementList(AUDIO_OBJECT_TYPE aot, + SCHAR epConfig, UCHAR nChannels, + UCHAR layer, UINT elFlags); + +typedef enum { + /* n.a. */ + FDK_FORMAT_1_0 = 1, /* mono */ + FDK_FORMAT_2_0 = 2, /* stereo */ + FDK_FORMAT_3_0_FC = 3, /* 3/0.0 */ + FDK_FORMAT_3_1_0 = 4, /* 3/1.0 */ + FDK_FORMAT_5_0 = 5, /* 3/2.0 */ + FDK_FORMAT_5_1 = 6, /* 5.1 */ + FDK_FORMAT_7_1_ALT = 7, /* 5/2.1 ALT */ + /* 8 n.a.*/ + FDK_FORMAT_3_0_RC = 9, /* 2/1.0 */ + FDK_FORMAT_2_2_0 = 10, /* 2/2.0 */ + FDK_FORMAT_6_1 = 11, /* 3/3.1 */ + FDK_FORMAT_7_1 = 12, /* 3/4.1 */ + FDK_FORMAT_22_2 = 13, /* 22.2 */ + FDK_FORMAT_5_2_1 = 14, /* 5/2.1*/ + FDK_FORMAT_5_5_2 = 15, /* 5/5.2 */ + FDK_FORMAT_9_1 = 16, /* 5/4.1 */ + FDK_FORMAT_6_5_1 = 17, /* 6/5.1 */ + FDK_FORMAT_6_7_1 = 18, /* 6/7.1 */ + FDK_FORMAT_5_6_1 = 19, /* 5/6.1 */ + FDK_FORMAT_7_6_1 = 20, /* 7/6.1 */ + FDK_FORMAT_IN_LISTOFCHANNELS = 21, + FDK_FORMAT_OUT_LISTOFCHANNELS = 22, + /* 20 formats + In & Out list of channels */ + FDK_NFORMATS = 23, + FDK_FORMAT_FAIL = -1 +} FDK_converter_formatid_t; + +extern const INT format_nchan[FDK_NFORMATS + 9 - 2]; + +#endif diff --git a/fdk-aac/libFDK/include/FDK_trigFcts.h b/fdk-aac/libFDK/include/FDK_trigFcts.h new file mode 100644 index 0000000..153ca4c --- /dev/null +++ b/fdk-aac/libFDK/include/FDK_trigFcts.h @@ -0,0 +1,258 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Haricharan Lakshman, Manuel Jander + + Description: Trigonometric functions fixed point fractional implementation. + +*******************************************************************************/ + +#if !defined(FDK_TRIGFCTS_H) +#define FDK_TRIGFCTS_H + +#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 + +#include "FDK_tools_rom.h" + +#define SINETAB SineTable512 +#define LD 9 + +#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 + /* scale down by 1 for overflow prevention. This is undone at the calling + * function. */ + *sine = (FIXP_DBL)(sl * ssign) >> 1; + *cosine = (FIXP_DBL)(cl * csign) >> 1; +#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); + +#ifdef SINETABLE_16BIT + *out++ = cosine - (error0 << 1); + *out++ = sine + (error1 << 1); +#else + /* Undo downscaling by 1 which was done at fixp_sin_cos_residual_inline */ + *out++ = SATURATE_LEFT_SHIFT(cosine - (error0 << 1), 1, DFRACT_BITS); + *out++ = SATURATE_LEFT_SHIFT(sine + (error1 << 1), 1, DFRACT_BITS); +#endif + + residual = fixp_sin_cos_residual_inline(x2, scale, &sine, &cosine); + error0 = fMultDiv2(sine, residual); + error1 = fMultDiv2(cosine, residual); + +#ifdef SINETABLE_16BIT + *out++ = cosine - (error0 << 1); + *out++ = sine + (error1 << 1); +#else + *out++ = SATURATE_LEFT_SHIFT(cosine - (error0 << 1), 1, DFRACT_BITS); + *out++ = SATURATE_LEFT_SHIFT(sine + (error1 << 1), 1, DFRACT_BITS); +#endif +} +#endif + +#endif /* !defined(FDK_TRIGFCTS_H) */ diff --git a/fdk-aac/libFDK/include/abs.h b/fdk-aac/libFDK/include/abs.h new file mode 100644 index 0000000..0846c96 --- /dev/null +++ b/fdk-aac/libFDK/include/abs.h @@ -0,0 +1,136 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Lohwasser + + Description: fixed point abs definitions + +*******************************************************************************/ + +#if !defined(ABS_H) +#define ABS_H + +#if defined(__mips__) +#include "mips/abs_mips.h" + +#elif defined(__x86__) +#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/fdk-aac/libFDK/include/arm/clz_arm.h b/fdk-aac/libFDK/include/arm/clz_arm.h new file mode 100644 index 0000000..1c3e1fb --- /dev/null +++ b/fdk-aac/libFDK/include/arm/clz_arm.h @@ -0,0 +1,164 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: fixed point intrinsics + +*******************************************************************************/ + +#if !defined(CLZ_ARM_H) +#define CLZ_ARM_H + +#if defined(__arm__) + +#if defined(__GNUC__) +/* ARM gcc*/ + +#if defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_8__) +#define FUNCTION_fixnormz_D +#define FUNCTION_fixnorm_D +#define FUNCTION_fixnormz_S +#define FUNCTION_fixnorm_S + +#ifdef FUNCTION_fixnormz_D +inline INT fixnormz_D(LONG value) { + INT result; +#if defined(__ARM_ARCH_8__) + asm("clz %w0, %w1 " : "=r"(result) : "r"(value)); +#else + asm("clz %0, %1 " : "=r"(result) : "r"(value)); +#endif + return result; +} +#endif /* #ifdef FUNCTION_fixnormz_D */ + +#ifdef FUNCTION_fixnorm_D +inline INT fixnorm_D(LONG value) { + if (!value) return 0; + if (value < 0) value = ~value; + return fixnormz_D(value) - 1; +} +#endif /* #ifdef FUNCTION_fixnorm_D */ + +#ifdef FUNCTION_fixnormz_S +inline INT fixnormz_S(SHORT value) { + INT result; + result = (LONG)(value << 16); + if (result == 0) + result = 16; + else + result = fixnormz_D(result); + return result; +} +#endif /* #ifdef FUNCTION_fixnormz_S */ + +#ifdef FUNCTION_fixnorm_S +inline INT fixnorm_S(SHORT value) { + LONG lvalue = (LONG)(value << 16); + if (!lvalue) return 0; + if (lvalue < 0) lvalue = ~lvalue; + return fixnormz_D(lvalue) - 1; +} +#endif /* #ifdef FUNCTION_fixnorm_S */ + +#endif + +#endif /* arm toolchain */ + +#endif /* __arm__ */ + +#endif /* !defined(CLZ_ARM_H) */ diff --git a/fdk-aac/libFDK/include/arm/cplx_mul_arm.h b/fdk-aac/libFDK/include/arm/cplx_mul_arm.h new file mode 100644 index 0000000..a448e33 --- /dev/null +++ b/fdk-aac/libFDK/include/arm/cplx_mul_arm.h @@ -0,0 +1,201 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: fixed point intrinsics + +*******************************************************************************/ + +#if !defined(CPLX_MUL_ARM_H) +#define CPLX_MUL_ARM_H + +#if defined(__arm__) && defined(__GNUC__) + +#if defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_6__) || \ + defined(__ARM_ARCH_8__) +#define FUNCTION_cplxMultDiv2_32x16 +#define FUNCTION_cplxMultDiv2_32x16X2 +#endif + +#define FUNCTION_cplxMultDiv2_32x32X2 +#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_8__ + asm("smull %x0, %w2, %w4; \n" /* tmp1 = a_Re * b_Re */ + "smull %x1, %w2, %w5; \n" /* tmp2 = a_Re * b_Im */ + "smsubl %x0, %w3, %w5, %x0; \n" /* tmp1 -= a_Im * b_Im */ + "smaddl %x1, %w3, %w4, %x1; \n" /* tmp2 += a_Im * b_Re */ + "asr %x0, %x0, #32 \n" + "asr %x1, %x1, #32 \n" + : "=&r"(tmp1), "=&r"(tmp2) + : "r"(a_Re), "r"(a_Im), "r"(b_Re), "r"(b_Im)); +#elif defined(__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)); +#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 */ + +#if defined(FUNCTION_cplxMultDiv2_32x16) +inline void cplxMultDiv2(FIXP_DBL *c_Re, FIXP_DBL *c_Im, const FIXP_DBL a_Re, + const FIXP_DBL a_Im, FIXP_SPK wpk) { +#ifdef __ARM_ARCH_8__ + FIXP_DBL b_Im = FX_SGL2FX_DBL(wpk.v.im); + FIXP_DBL b_Re = FX_SGL2FX_DBL(wpk.v.re); + cplxMultDiv2(c_Re, c_Im, a_Re, a_Im, b_Re, b_Im); +#else + 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 +} +#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) { +#ifdef __ARM_ARCH_8__ + FIXP_DBL b_re = FX_SGL2FX_DBL(b_Re); + FIXP_DBL b_im = FX_SGL2FX_DBL(b_Im); + cplxMultDiv2(c_Re, c_Im, a_Re, a_Im, b_re, b_im); +#else + 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 +} +#endif /* FUNCTION_cplxMultDiv2_32x16X2 */ + +#endif + +#endif /* !defined(CPLX_MUL_ARM_H) */ diff --git a/fdk-aac/libFDK/include/arm/fixmadd_arm.h b/fdk-aac/libFDK/include/arm/fixmadd_arm.h new file mode 100644 index 0000000..1378660 --- /dev/null +++ b/fdk-aac/libFDK/include/arm/fixmadd_arm.h @@ -0,0 +1,220 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: fixed point intrinsics + +*******************************************************************************/ + +#if !defined(FIXMADD_ARM_H) +#define FIXMADD_ARM_H + +#if defined(__arm__) + +/* ############################################################################# + */ +#if defined(__GNUC__) && defined(__arm__) +/* ############################################################################# + */ +/* ARM GNU GCC */ + +#ifdef __ARM_ARCH_8__ +#define FUNCTION_fixmadddiv2_DD +#ifdef FUNCTION_fixmadddiv2_DD +inline FIXP_DBL fixmadddiv2_DD(FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) { + INT64 result; + asm("smull %x0, %w1, %w2; \n" + "asr %x0, %x0, #32; \n" + "add %w0, %w3, %w0; \n" + : "=&r"(result) + : "r"(a), "r"(b), "r"(x)); + return (INT)result; +} +#endif /* #ifdef FUNCTION_fixmadddiv2_DD */ + +#define FUNCTION_fixmsubdiv2_DD +#ifdef FUNCTION_fixmsubdiv2_DD +inline FIXP_DBL fixmsubdiv2_DD(FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) { + INT64 result; + asm("smull %x0, %w1, %w2; \n" + "asr %x0, %x0, #32; \n" + "sub %w0, %w3, %w0; \n" + : "=&r"(result) + : "r"(a), "r"(b), "r"(x)); + return (INT)result; +} +#endif /* #ifdef FUNCTION_fixmsubdiv2_DD */ + +#elif defined(__ARM_ARCH_6__) +#define FUNCTION_fixmadddiv2_DD +#ifdef FUNCTION_fixmadddiv2_DD +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; +} +#endif /* #ifdef FUNCTION_fixmadddiv2_DD */ + +#define FUNCTION_fixmsubdiv2_DD +#ifdef 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; +} +#endif /* #ifdef FUNCTION_fixmsubdiv2_DD */ + +#else +#define FUNCTION_fixmadddiv2_DD +#ifdef FUNCTION_fixmadddiv2_DD +inline FIXP_DBL fixmadddiv2_DD(FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) { + INT discard = 0; + INT result = x; + asm("smlal %0, %1, %2, %3;\n" : "+r"(discard), "+r"(result) : "r"(a), "r"(b)); + return result; +} +#endif /* #ifdef FUNCTION_fixmadddiv2_DD */ +#endif + +#if defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_6__) + +#define FUNCTION_fixmadddiv2_DS +#ifdef 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 /* #ifdef FUNCTION_fixmadddiv2_DS */ + +#endif /* defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_6__) */ + +#define FUNCTION_fixmadddiv2BitExact_DD +#ifdef FUNCTION_fixmadddiv2BitExact_DD +#define fixmadddiv2BitExact_DD(a, b, c) fixmadddiv2_DD(a, b, c) +#endif /* #ifdef FUNCTION_fixmadddiv2BitExact_DD */ + +#define FUNCTION_fixmsubdiv2BitExact_DD +#ifdef 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); +} +#endif /* #ifdef FUNCTION_fixmsubdiv2BitExact_DD */ + +#define FUNCTION_fixmadddiv2BitExact_DS +#ifdef FUNCTION_fixmadddiv2BitExact_DS +#define fixmadddiv2BitExact_DS(a, b, c) fixmadddiv2_DS(a, b, c) +#endif /* #ifdef FUNCTION_fixmadddiv2BitExact_DS */ + +#define FUNCTION_fixmsubdiv2BitExact_DS +#ifdef 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 /* #ifdef FUNCTION_fixmsubdiv2BitExact_DS */ + +/* ############################################################################# + */ +#endif /* toolchain */ + /* ############################################################################# + */ + +#endif /* __arm__ */ + +#endif /* !defined(FIXMADD_ARM_H) */ diff --git a/fdk-aac/libFDK/include/arm/fixmul_arm.h b/fdk-aac/libFDK/include/arm/fixmul_arm.h new file mode 100644 index 0000000..077e5c6 --- /dev/null +++ b/fdk-aac/libFDK/include/arm/fixmul_arm.h @@ -0,0 +1,198 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: fixed point intrinsics + +*******************************************************************************/ + +#if !defined(FIXMUL_ARM_H) +#define FIXMUL_ARM_H + +#if defined(__arm__) + +#if defined(__GNUC__) && defined(__arm__) +/* ARM with GNU compiler */ + +#define FUNCTION_fixmuldiv2_DD + +#define FUNCTION_fixmuldiv2BitExact_DD +#ifdef FUNCTION_fixmuldiv2BitExact_DD +#define fixmuldiv2BitExact_DD(a, b) fixmuldiv2_DD(a, b) +#endif /* #ifdef FUNCTION_fixmuldiv2BitExact_DD */ + +#define FUNCTION_fixmulBitExact_DD +#ifdef FUNCTION_fixmulBitExact_DD +#define fixmulBitExact_DD(a, b) (fixmuldiv2BitExact_DD(a, b) << 1) +#endif /* #ifdef FUNCTION_fixmulBitExact_DD */ + +#define FUNCTION_fixmuldiv2BitExact_DS +#ifdef FUNCTION_fixmuldiv2BitExact_DS +#define fixmuldiv2BitExact_DS(a, b) fixmuldiv2_DS(a, b) +#endif /* #ifdef FUNCTION_fixmuldiv2BitExact_DS */ + +#define FUNCTION_fixmulBitExact_DS +#ifdef FUNCTION_fixmulBitExact_DS +#define fixmulBitExact_DS(a, b) fixmul_DS(a, b) +#endif /* #ifdef FUNCTION_fixmulBitExact_DS */ + +#ifdef FUNCTION_fixmuldiv2_DD +inline INT fixmuldiv2_DD(const INT a, const INT b) { + INT result; +#if defined(__ARM_ARCH_8__) + INT64 result64; + __asm__( + "smull %x0, %w1, %w2;\n" + "asr %x0, %x0, #32; " + : "=r"(result64) + : "r"(a), "r"(b)); + result = (INT)result64; +#elif defined(__ARM_ARCH_6__) || defined(__TARGET_ARCH_7E_M) + __asm__("smmul %0, %1, %2" : "=r"(result) : "r"(a), "r"(b)); +#else + INT discard; + __asm__("smull %0, %1, %2, %3" + : "=&r"(discard), "=r"(result) + : "r"(a), "r"(b)); +#endif + return result; +} +#endif /* #ifdef FUNCTION_fixmuldiv2_DD */ + +#if defined(__ARM_ARCH_8__) +#define FUNCTION_fixmuldiv2_SD +#ifdef FUNCTION_fixmuldiv2_SD +inline INT fixmuldiv2_SD(const SHORT a, const INT b) { + return fixmuldiv2_DD((INT)(a << 16), b); +} +#endif /* #ifdef FUNCTION_fixmuldiv2_SD */ +#elif defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_6__) +#define FUNCTION_fixmuldiv2_SD +#ifdef 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 /* #ifdef FUNCTION_fixmuldiv2_SD */ +#endif + +#define FUNCTION_fixmul_DD +#ifdef FUNCTION_fixmul_DD +#if defined(__ARM_ARCH_8__) +inline INT fixmul_DD(const INT a, const INT b) { + INT64 result64; + + __asm__( + "smull %x0, %w1, %w2;\n" + "asr %x0, %x0, #31; " + : "=r"(result64) + : "r"(a), "r"(b)); + return (INT)result64; +} +#else +inline INT fixmul_DD(const INT a, const INT b) { + return (fixmuldiv2_DD(a, b) << 1); +} +#endif /* __ARM_ARCH_8__ */ +#endif /* #ifdef FUNCTION_fixmul_DD */ + +#endif /* defined(__GNUC__) && defined(__arm__) */ + +#endif /* __arm__ */ + +#endif /* !defined(FIXMUL_ARM_H) */ diff --git a/fdk-aac/libFDK/include/arm/scale_arm.h b/fdk-aac/libFDK/include/arm/scale_arm.h new file mode 100644 index 0000000..0bf4f66 --- /dev/null +++ b/fdk-aac/libFDK/include/arm/scale_arm.h @@ -0,0 +1,163 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: ARM scaling operations + +*******************************************************************************/ + +#if !defined(SCALE_ARM_H) +#define SCALE_ARM_H + +#if defined(__GNUC__) /* GCC Compiler */ + +#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 +#ifdef FUNCTION_scaleValueInPlace +inline void scaleValueInPlace(FIXP_DBL *value, /*!< Value */ + INT scalefactor /*!< Scalefactor */ +) { + INT newscale; + if ((newscale = scalefactor) >= 0) + *value <<= newscale; + else + *value >>= -newscale; +} +#endif /* #ifdef FUNCTION_scaleValueInPlace */ + +#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)) + +#endif /* !defined(SCALE_ARM_H) */ diff --git a/fdk-aac/libFDK/include/arm/scramble_arm.h b/fdk-aac/libFDK/include/arm/scramble_arm.h new file mode 100644 index 0000000..a7cfe65 --- /dev/null +++ b/fdk-aac/libFDK/include/arm/scramble_arm.h @@ -0,0 +1,174 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: bitreversal of input data + +*******************************************************************************/ + +#if !defined(SCRAMBLE_ARM_H) +#define SCRAMBLE_ARM_H + +#if defined(FUNCTION_scramble) +#if defined(__GNUC__) + +#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) */ +#endif /* !defined(SCRAMBLE_ARM_H) */ diff --git a/fdk-aac/libFDK/include/autocorr2nd.h b/fdk-aac/libFDK/include/autocorr2nd.h new file mode 100644 index 0000000..e01989b --- /dev/null +++ b/fdk-aac/libFDK/include/autocorr2nd.h @@ -0,0 +1,137 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Lohwasser + + Description: fixed point abs definitions + +*******************************************************************************/ + +#ifndef AUTOCORR2ND_H +#define AUTOCORR2ND_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 /* AUTOCORR2ND_H */ diff --git a/fdk-aac/libFDK/include/clz.h b/fdk-aac/libFDK/include/clz.h new file mode 100644 index 0000000..df75618 --- /dev/null +++ b/fdk-aac/libFDK/include/clz.h @@ -0,0 +1,205 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Marc Gayer + + Description: fixed point intrinsics + +*******************************************************************************/ + +#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__) +#include "mips/clz_mips.h" + +#elif defined(__x86__) +#include "x86/clz_x86.h" + +#elif defined(__powerpc__) +#include "ppc/clz_ppc.h" + +#endif /* all cores */ + +/************************************************************************* + ************************************************************************* + Software fallbacks for missing functions. +************************************************************************** +**************************************************************************/ + +#if !defined(FUNCTION_fixnormz_S) +#ifdef FUNCTION_fixnormz_D +inline INT fixnormz_S(SHORT a) { + if (a < 0) { + return 0; + } + return fixnormz_D((INT)(a)) - 16; +} +#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) { + if (val == (FIXP_SGL)0) { + return 0; + } + return fixnorm_D((INT)(val)) - 16; +} +#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/fdk-aac/libFDK/include/common_fix.h b/fdk-aac/libFDK/include/common_fix.h new file mode 100644 index 0000000..7c08225 --- /dev/null +++ b/fdk-aac/libFDK/include/common_fix.h @@ -0,0 +1,449 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Lohwasser, M. Gayer + + Description: Flexible fixpoint library configuration + +*******************************************************************************/ + +#ifndef COMMON_FIX_H +#define COMMON_FIX_H + +#include "FDK_archdef.h" +#include "machine_type.h" + +/* ***** Start of former fix.h ****** */ + +/* 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 MAXVAL_FIXP_PCM MAXVAL_DBL +#define MINVAL_FIXP_PCM MINVAL_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 MAXVAL_FIXP_PCM MAXVAL_SGL +#define MINVAL_FIXP_PCM MINVAL_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 + +#define MINVAL_DBL_CONST MINVAL_DBL +#define MINVAL_SGL_CONST MINVAL_SGL + +#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. */ + +/* #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 */ +#define FX_DBL2DOUBLE(val) (((double)(val) / (double)DFRACT_FIX_SCALE)) + +/* ############################################################# */ +#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 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); } + +#if !defined(__LP64__) +FDK_INLINE INT fAbs(INT x) { return fixabs_I(x); } +#endif + + /* ******************************************************************************** + */ + +#include "clz.h" + +FDK_INLINE INT fNormz(INT64 x) { + INT clz = fixnormz_D((INT)(x >> 32)); + if (clz == 32) clz += fixnormz_D((INT)x); + return clz; +} +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); } + +#if !defined(__LP64__) +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); } + +inline UCHAR fMax(UCHAR a, UCHAR b) { + return (UCHAR)fixmax_UI((UINT)a, (UINT)b); +} +inline UCHAR fMin(UCHAR a, UCHAR b) { + return (UCHAR)fixmin_UI((UINT)a, (UINT)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 "fixpoint_math.h" + +#endif diff --git a/fdk-aac/libFDK/include/cplx_mul.h b/fdk-aac/libFDK/include/cplx_mul.h new file mode 100644 index 0000000..eb1afce --- /dev/null +++ b/fdk-aac/libFDK/include/cplx_mul.h @@ -0,0 +1,266 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: fixed point intrinsics + +*******************************************************************************/ + +#if !defined(CPLX_MUL_H) +#define CPLX_MUL_H + +#include "common_fix.h" + +#if defined(__arm__) || defined(_M_ARM) +#include "arm/cplx_mul_arm.h" + +#elif defined(__GNUC__) && defined(__mips__) && __mips_isa_rev < 6 +#include "mips/cplx_mul_mips.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_16x16X2) +#define FUNCTION_cplxMultDiv2_16x16X2 + +inline void cplxMultDiv2(FIXP_DBL *c_Re, FIXP_DBL *c_Im, const FIXP_SGL a_Re, + const FIXP_SGL 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); +} + +inline void cplxMultDiv2(FIXP_SGL *c_Re, FIXP_SGL *c_Im, const FIXP_SGL a_Re, + const FIXP_SGL a_Im, const FIXP_SGL b_Re, + const FIXP_SGL b_Im) { + *c_Re = FX_DBL2FX_SGL(fMultDiv2(a_Re, b_Re) - fMultDiv2(a_Im, b_Im)); + *c_Im = FX_DBL2FX_SGL(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_cplxMultDiv2_16x16) +#define FUNCTION_cplxMultDiv2_16x16 + +inline void cplxMultDiv2(FIXP_DBL *c_Re, FIXP_DBL *c_Im, const FIXP_SGL a_Re, + const FIXP_SGL a_Im, const FIXP_SPK w) { + cplxMultDiv2(c_Re, c_Im, a_Re, a_Im, w.v.re, w.v.im); +} + +inline void cplxMultDiv2(FIXP_SGL *c_Re, FIXP_SGL *c_Im, const FIXP_SGL a_Re, + const FIXP_SGL 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_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); +} +inline void cplxMult(FIXP_SGL *c_Re, FIXP_SGL *c_Im, const FIXP_SGL a_Re, + const FIXP_SGL a_Im, const FIXP_SGL b_Re, + const FIXP_SGL b_Im) { + *c_Re = FX_DBL2FX_SGL(fMult(a_Re, b_Re) - fMult(a_Im, b_Im)); + *c_Im = FX_DBL2FX_SGL(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_MUL_H */ diff --git a/fdk-aac/libFDK/include/dct.h b/fdk-aac/libFDK/include/dct.h new file mode 100644 index 0000000..308afcb --- /dev/null +++ b/fdk-aac/libFDK/include/dct.h @@ -0,0 +1,171 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: Library functions to calculate standard DCTs. This will most + likely be replaced by hand-optimized functions for the specific + target processor. + +*******************************************************************************/ + +#ifndef DCT_H +#define DCT_H + +#include "common_fix.h" + +void dct_getTables(const FIXP_WTP **ptwiddle, const FIXP_STP **sin_twiddle, + int *sin_step, int length); + +/** + * \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 DST type III of given length. The DST III is + * calculated by a DCT III of mirrored input and sign-flipping of odd + * output coefficients. + * Note that the factor 0.5 for the sum term x[N-1] 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 dst_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/fdk-aac/libFDK/include/fft.h b/fdk-aac/libFDK/include/fft.h new file mode 100644 index 0000000..d394046 --- /dev/null +++ b/fdk-aac/libFDK/include/fft.h @@ -0,0 +1,263 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Josef Hoepfl, DSP Solutions + + Description: Fix point FFT + +*******************************************************************************/ + +#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. + */ + +#ifndef FUNCTION_fft_4 +/** + * \brief Perform an inplace complex valued FFT of length 4 + * + * \param pInput Input/Output data buffer. The input data must have at least 1 + * bit scale headroom. The values are interleaved, real/imag pairs. + */ +LNK_SECTION_CODE_L1 +static FDK_FORCEINLINE void 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 */ +} +#endif /* FUNCTION_fft_4 */ + +#ifndef FUNCTION_fft_8 +LNK_SECTION_CODE_L1 +static FDK_FORCEINLINE void fft_8(FIXP_DBL *x) { + FIXP_SPK w_PiFOURTH = {{FIXP_SGL(0x5A82), FIXP_SGL(0x5A82)}}; + + 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]; + + cplxMultDiv2(&vi, &vr, 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]; + + cplxMultDiv2(&vr, &vi, 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; +} +#endif /* FUNCTION_fft_8 */ + +#endif diff --git a/fdk-aac/libFDK/include/fft_rad2.h b/fdk-aac/libFDK/include/fft_rad2.h new file mode 100644 index 0000000..b820b7d --- /dev/null +++ b/fdk-aac/libFDK/include/fft_rad2.h @@ -0,0 +1,121 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Lohwasser, M. Gayer + + Description: + +*******************************************************************************/ + +#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); + +#endif /* FFT_RAD2_H */ diff --git a/fdk-aac/libFDK/include/fixmadd.h b/fdk-aac/libFDK/include/fixmadd.h new file mode 100644 index 0000000..1672456 --- /dev/null +++ b/fdk-aac/libFDK/include/fixmadd.h @@ -0,0 +1,333 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Lohwasser, M. Gayer + + Description: fixed point intrinsics + +*******************************************************************************/ + +#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" + +#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) +#ifdef FUNCTION_fixmadddiv2_DD +#define fixpadddiv2_D(x, a) fixmadddiv2_DD(x, a, a) +#else +inline INT fixpadddiv2_D(FIXP_DBL x, const FIXP_DBL a) { + return (x + fPow2Div2(a)); +} +#endif +#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) +#ifdef FUNCTION_fixmadddiv2_SS +#define fixpadddiv2_S(x, a) fixmadddiv2_SS(x, a, a) +#else +inline INT fixpadddiv2_S(FIXP_DBL x, const FIXP_SGL a) { + return (x + fPow2Div2(a)); +} +#endif +#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/fdk-aac/libFDK/include/fixminmax.h b/fdk-aac/libFDK/include/fixminmax.h new file mode 100644 index 0000000..69ef35d --- /dev/null +++ b/fdk-aac/libFDK/include/fixminmax.h @@ -0,0 +1,131 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Lohwasser, M. Gayer + + Description: min/max inline functions and defines + +*******************************************************************************/ + +#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 +inline T fixmin(T a, T b) { + return (a < b ? a : b); +} + +template +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/fdk-aac/libFDK/include/fixmul.h b/fdk-aac/libFDK/include/fixmul.h new file mode 100644 index 0000000..8eeb7ab --- /dev/null +++ b/fdk-aac/libFDK/include/fixmul.h @@ -0,0 +1,298 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Stefan Gewinner + + Description: fixed point multiplication + +*******************************************************************************/ + +#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__) +#include "mips/fixmul_mips.h" + +#elif defined(__x86__) +#include "x86/fixmul_x86.h" + +#elif defined(__powerpc__) +#include "ppc/fixmul_ppc.h" + +#endif /* all cores */ + +/************************************************************************* + ************************************************************************* + Software fallbacks for missing functions +************************************************************************** +**************************************************************************/ + +#if !defined(FUNCTION_fixmuldiv2_DD) +#define FUNCTION_fixmuldiv2_DD +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 +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 +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_DS(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) +#define FUNCTION_fixpow2div2_D +inline LONG fixpow2div2_D(const LONG a) { return fixmuldiv2_DD(a, a); } +#endif + +#if !defined(FUNCTION_fixpow2_D) +#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) { + LONG result = fixpow2div2_S(a) << 1; + return result ^ (result >> 31); +} +#endif + +#endif /* FIXMUL_H */ diff --git a/fdk-aac/libFDK/include/fixpoint_math.h b/fdk-aac/libFDK/include/fixpoint_math.h new file mode 100644 index 0000000..3805892 --- /dev/null +++ b/fdk-aac/libFDK/include/fixpoint_math.h @@ -0,0 +1,921 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Gayer + + Description: Fixed point specific mathematical functions + +*******************************************************************************/ + +#ifndef FIXPOINT_MATH_H +#define FIXPOINT_MATH_H + +#include "common_fix.h" +#include "scale.h" + +/* + * Data definitions + */ + +#define LD_DATA_SCALING (64.0f) +#define LD_DATA_SHIFT 6 /* pow(2, LD_DATA_SHIFT) = LD_DATA_SCALING */ + +#define MAX_LD_PRECISION 10 +#define LD_PRECISION 10 + +/* Taylor series coefficients for ln(1-x), centered at 0 (MacLaurin polynomial). + */ +#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 /* LDCOEFF_16BIT */ +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 /* LDCOEFF_16BIT */ + +/***************************************************************************** + + 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 + 2) +#define SQRT_BITS_MASK 0x7f +#define SQRT_FRACT_BITS_MASK 0x007FFFFF + +extern const FIXP_DBL invSqrtTab[SQRT_VALUES]; + +/* + * Hardware specific implementations + */ + +#if defined(__x86__) +#include "x86/fixpoint_math_x86.h" +#endif /* target architecture selector */ + +/* + * Fallback implementations + */ +#if !defined(FUNCTION_fIsLessThan) +/** + * \brief Compares two fixpoint values incl. scaling. + * \param a_m mantissa of the first input value. + * \param a_e exponent of the first input value. + * \param b_m mantissa of the second input value. + * \param b_e exponent of the second input value. + * \return non-zero if (a_m*2^a_e) < (b_m*2^b_e), 0 otherwise + */ +FDK_INLINE INT fIsLessThan(FIXP_DBL a_m, INT a_e, FIXP_DBL b_m, INT b_e) { + if (a_e > b_e) { + return ((b_m >> fMin(a_e - b_e, DFRACT_BITS - 1)) > a_m); + } else { + return ((a_m >> fMin(b_e - a_e, DFRACT_BITS - 1)) < b_m); + } +} + +FDK_INLINE INT fIsLessThan(FIXP_SGL a_m, INT a_e, FIXP_SGL b_m, INT b_e) { + if (a_e > b_e) { + return ((b_m >> fMin(a_e - b_e, FRACT_BITS - 1)) > a_m); + } else { + return ((a_m >> fMin(b_e - a_e, FRACT_BITS - 1)) < b_m); + } +} +#endif + +/** + * \brief deprecated. Use fLog2() instead. + */ +#define CalcLdData(op) fLog2(op, 0) + +void LdDataVector(FIXP_DBL *srcVector, FIXP_DBL *destVector, INT number); + +extern const UINT exp2_tab_long[32]; +extern const UINT exp2w_tab_long[32]; +extern const UINT exp2x_tab_long[32]; + +LNK_SECTION_CODE_L1 +FDK_INLINE FIXP_DBL CalcInvLdData(const FIXP_DBL x) { + int set_zero = (x < FL2FXCONST_DBL(-31.0 / 64.0)) ? 0 : 1; + int set_max = (x >= FL2FXCONST_DBL(31.0 / 64.0)) | (x == FL2FXCONST_DBL(0.0)); + + FIXP_SGL frac = (FIXP_SGL)((LONG)x & 0x3FF); + UINT index3 = (UINT)(LONG)(x >> 10) & 0x1F; + UINT index2 = (UINT)(LONG)(x >> 15) & 0x1F; + UINT index1 = (UINT)(LONG)(x >> 20) & 0x1F; + int exp = fMin(31, ((x > FL2FXCONST_DBL(0.0f)) ? (31 - (int)(x >> 25)) + : (int)(-(x >> 25)))); + + UINT lookup1 = exp2_tab_long[index1] * set_zero; + UINT lookup2 = exp2w_tab_long[index2]; + UINT lookup3 = exp2x_tab_long[index3]; + UINT lookup3f = + lookup3 + (UINT)(LONG)fMultDiv2((FIXP_DBL)(0x0016302F), (FIXP_SGL)frac); + + UINT lookup12 = (UINT)(LONG)fMult((FIXP_DBL)lookup1, (FIXP_DBL)lookup2); + UINT lookup = (UINT)(LONG)fMult((FIXP_DBL)lookup12, (FIXP_DBL)lookup3f); + + FIXP_DBL retVal = (lookup << 3) >> exp; + + if (set_max) { + retVal = (FIXP_DBL)MAXVAL_DBL; + } + + return retVal; +} + +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 = (UINT)nfrac * sqrt_tab[idx] + (UINT)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 = (UINT)nfrac * sqrt_tab[idx] + (UINT)frac * sqrt_tab[idx + 1]; + + /* Write back exponent */ + *x_e = e >> 1; + return (FIXP_DBL)(LONG)(t >> 1); +} + +void InitInvSqrtTab(); + +#ifndef FUNCTION_invSqrtNorm2 +/** + * \brief calculate 1.0/sqrt(op) + * \param op_m mantissa of input value. + * \param result_e pointer to return the exponent of the result + * \return mantissa of the result + */ +/***************************************************************************** + 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 +*****************************************************************************/ +static FDK_FORCEINLINE FIXP_DBL invSqrtNorm2(FIXP_DBL op, INT *shift) { + FIXP_DBL val = op; + FIXP_DBL reg1, reg2; + + if (val == FL2FXCONST_DBL(0.0)) { + *shift = 16; + return ((LONG)MAXVAL_DBL); /* maximum positive value */ + } + +#define INVSQRTNORM2_LINEAR_INTERPOLATE +#define INVSQRTNORM2_LINEAR_INTERPOLATE_HQ + + /* 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 */ + +#if defined(INVSQRTNORM2_LINEAR_INTERPOLATE) + INT index = + (INT)(val >> (DFRACT_BITS - 1 - (SQRT_BITS + 1))) & SQRT_BITS_MASK; + FIXP_DBL Fract = + (FIXP_DBL)(((INT)val & SQRT_FRACT_BITS_MASK) << (SQRT_BITS + 1)); + FIXP_DBL diff = invSqrtTab[index + 1] - invSqrtTab[index]; + reg1 = invSqrtTab[index] + (fMultDiv2(diff, Fract) << 1); +#if defined(INVSQRTNORM2_LINEAR_INTERPOLATE_HQ) + /* reg1 = t[i] + (t[i+1]-t[i])*fract ... already computed ... + + (1-fract)fract*(t[i+2]-t[i+1])/2 */ + if (Fract != (FIXP_DBL)0) { + /* fract = fract * (1 - fract) */ + Fract = fMultDiv2(Fract, (FIXP_DBL)((ULONG)0x80000000 - (ULONG)Fract)) << 1; + diff = diff - (invSqrtTab[index + 2] - invSqrtTab[index + 1]); + reg1 = fMultAddDiv2(reg1, Fract, diff); + } +#endif /* INVSQRTNORM2_LINEAR_INTERPOLATE_HQ */ +#else +#error \ + "Either define INVSQRTNORM2_NEWTON_ITERATE or INVSQRTNORM2_LINEAR_INTERPOLATE" +#endif + /* calculate the output exponent = input exp/2 */ + if (*shift & 0x00000001) { /* odd shift values ? */ + /* Note: Do not use rounded value 0x5A82799A to avoid overflow with + * shift-by-2 */ + reg2 = (FIXP_DBL)0x5A827999; + /* FL2FXCONST_DBL(0.707106781186547524400844362104849f);*/ /* 1/sqrt(2); + */ + reg1 = fMultDiv2(reg1, reg2) << 2; + } + + *shift = *shift >> 1; + + return (reg1); +} +#endif /* FUNCTION_invSqrtNorm2 */ + +#ifndef FUNCTION_sqrtFixp +static FDK_FORCEINLINE 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)); +} +#endif /* FUNCTION_sqrtFixp */ + +#ifndef FUNCTION_invFixp +/** + * \brief calculate 1.0/op + * \param op mantissa of the input value. + * \return mantissa of the result with implicit exponent of 31 + * \exceptions are provided for op=0,1 setting max. positive value + */ +static inline FIXP_DBL invFixp(FIXP_DBL op) { + if ((op == (FIXP_DBL)0x00000000) || (op == (FIXP_DBL)0x00000001)) { + return ((LONG)MAXVAL_DBL); + } + INT tmp_exp; + FIXP_DBL tmp_inv = invSqrtNorm2(op, &tmp_exp); + FDK_ASSERT((31 - (2 * tmp_exp + 1)) >= 0); + int shift = 31 - (2 * tmp_exp + 1); + tmp_inv = fPow2Div2(tmp_inv); + if (shift) { + tmp_inv = ((tmp_inv >> (shift - 1)) + (FIXP_DBL)1) >> 1; + } + return tmp_inv; +} + +/** + * \brief calculate 1.0/(op_m * 2^op_e) + * \param op_m mantissa of the input value. + * \param op_e pointer into were the exponent of the input value is stored, and + * the result will be stored into. + * \return mantissa of the result + */ +static inline FIXP_DBL invFixp(FIXP_DBL op_m, int *op_e) { + if ((op_m == (FIXP_DBL)0x00000000) || (op_m == (FIXP_DBL)0x00000001)) { + *op_e = 31 - *op_e; + return ((LONG)MAXVAL_DBL); + } + + INT tmp_exp; + FIXP_DBL tmp_inv = invSqrtNorm2(op_m, &tmp_exp); + + *op_e = (tmp_exp << 1) - *op_e + 1; + return fPow2Div2(tmp_inv); +} +#endif /* FUNCTION_invFixp */ + +#ifndef 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 /* FUNCTION_schur_div */ + +FIXP_DBL mul_dbl_sgl_rnd(const FIXP_DBL op1, const FIXP_SGL op2); + +#ifndef FUNCTION_fMultNorm +/** + * \brief multiply two values with normalization, thus max precision. + * Author: Robert Weidner + * + * \param f1 first factor + * \param f2 second 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 Multiply 2 values using maximum precision. The exponent of the result + * is 0. + * \param f1_m mantissa of factor 1 + * \param f2_m mantissa of factor 2 + * \return mantissa of the result with exponent equal to 0 + */ +inline FIXP_DBL fMultNorm(FIXP_DBL f1, FIXP_DBL f2) { + FIXP_DBL m; + INT e; + + m = fMultNorm(f1, f2, &e); + + m = scaleValueSaturate(m, e); + + return m; +} + +/** + * \brief Multiply 2 values with exponent and use given exponent for the + * mantissa of the result. + * \param f1_m mantissa of factor 1 + * \param f1_e exponent of factor 1 + * \param f2_m mantissa of factor 2 + * \param f2_e exponent of factor 2 + * \param result_e exponent for the returned mantissa of the result + * \return mantissa of the result with exponent equal to result_e + */ +inline FIXP_DBL fMultNorm(FIXP_DBL f1_m, INT f1_e, FIXP_DBL f2_m, INT f2_e, + INT result_e) { + FIXP_DBL m; + INT e; + + m = fMultNorm(f1_m, f2_m, &e); + + m = scaleValueSaturate(m, e + f1_e + f2_e - result_e); + + return m; +} +#endif /* FUNCTION_fMultNorm */ + +#ifndef FUNCTION_fMultI +/** + * \brief Multiplies a fractional value and a integer value and performs + * rounding to nearest + * \param a fractional value + * \param b integer value + * \return integer value + */ +inline INT fMultI(FIXP_DBL a, INT b) { + FIXP_DBL m, mi; + INT m_e; + + m = fMultNorm(a, (FIXP_DBL)b, &m_e); + + if (m_e < (INT)0) { + if (m_e > (INT)-DFRACT_BITS) { + m = m >> ((-m_e) - 1); + mi = (m + (FIXP_DBL)1) >> 1; + } else { + mi = (FIXP_DBL)0; + } + } else { + mi = scaleValueSaturate(m, m_e); + } + + return ((INT)mi); +} +#endif /* FUNCTION_fMultI */ + +#ifndef FUNCTION_fMultIfloor +/** + * \brief Multiplies a fractional value and a integer value and performs floor + * rounding + * \param a fractional value + * \param b integer value + * \return integer value + */ +inline INT fMultIfloor(FIXP_DBL a, INT b) { + FIXP_DBL m, mi; + INT m_e; + + m = fMultNorm(a, (FIXP_DBL)b, &m_e); + + if (m_e < (INT)0) { + if (m_e > (INT)-DFRACT_BITS) { + mi = m >> (-m_e); + } else { + mi = (FIXP_DBL)0; + if (m < (FIXP_DBL)0) { + mi = (FIXP_DBL)-1; + } + } + } else { + mi = scaleValueSaturate(m, m_e); + } + + return ((INT)mi); +} +#endif /* FUNCTION_fMultIfloor */ + +#ifndef FUNCTION_fMultIceil +/** + * \brief Multiplies a fractional value and a integer value and performs ceil + * rounding + * \param a fractional value + * \param b integer value + * \return integer value + */ +inline INT fMultIceil(FIXP_DBL a, INT b) { + FIXP_DBL m, mi; + INT m_e; + + m = fMultNorm(a, (FIXP_DBL)b, &m_e); + + if (m_e < (INT)0) { + if (m_e > (INT)-DFRACT_BITS) { + mi = (m >> (-m_e)); + if ((LONG)m & ((1 << (-m_e)) - 1)) { + mi = mi + (FIXP_DBL)1; + } + } else { + mi = (FIXP_DBL)1; + if (m < (FIXP_DBL)0) { + mi = (FIXP_DBL)0; + } + } + } else { + mi = scaleValueSaturate(m, m_e); + } + + return ((INT)mi); +} +#endif /* FUNCTION_fMultIceil */ + +#ifndef FUNCTION_fDivNorm +/** + * \brief Divide 2 FIXP_DBL values with normalization of input values. + * \param num numerator + * \param denum denominator + * \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, INT *result_e); + +/** + * \brief Divide 2 positive FIXP_DBL values with normalization of input values. + * \param num numerator + * \param denum denominator + * \return num/denum with exponent = 0 + */ +FIXP_DBL fDivNorm(FIXP_DBL num, FIXP_DBL denom); + +/** + * \brief Divide 2 signed FIXP_DBL values with normalization of input values. + * \param num numerator + * \param denum denominator + * \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 fDivNormSigned(FIXP_DBL L_num, FIXP_DBL L_denum, INT *result_e); + +/** + * \brief Divide 2 signed FIXP_DBL values with normalization of input values. + * \param num numerator + * \param denum denominator + * \return num/denum with exponent = 0 + */ +FIXP_DBL fDivNormSigned(FIXP_DBL num, FIXP_DBL denom); +#endif /* FUNCTION_fDivNorm */ + +/** + * \brief Adjust mantissa to exponent -1 + * \param a_m mantissa of value to be adjusted + * \param pA_e pointer to the exponen of a_m + * \return adjusted mantissa + */ +inline FIXP_DBL fAdjust(FIXP_DBL a_m, INT *pA_e) { + INT shift; + + shift = fNorm(a_m) - 1; + *pA_e -= shift; + + return scaleValue(a_m, shift); +} + +#ifndef FUNCTION_fAddNorm +/** + * \brief Add two values with normalization + * \param a_m mantissa of first summand + * \param a_e exponent of first summand + * \param a_m mantissa of second summand + * \param a_e exponent of second summand + * \param pResult_e pointer to where the exponent of the result will be stored + * to. + * \return mantissa of result + */ +inline FIXP_DBL fAddNorm(FIXP_DBL a_m, INT a_e, FIXP_DBL b_m, INT b_e, + INT *pResult_e) { + INT result_e; + FIXP_DBL result_m; + + /* If one of the summands is zero, return the other. + This is necessary for the summation of a very small number to zero */ + if (a_m == (FIXP_DBL)0) { + *pResult_e = b_e; + return b_m; + } + if (b_m == (FIXP_DBL)0) { + *pResult_e = a_e; + return a_m; + } + + a_m = fAdjust(a_m, &a_e); + b_m = fAdjust(b_m, &b_e); + + if (a_e > b_e) { + result_m = a_m + (b_m >> fMin(a_e - b_e, DFRACT_BITS - 1)); + result_e = a_e; + } else { + result_m = (a_m >> fMin(b_e - a_e, DFRACT_BITS - 1)) + b_m; + result_e = b_e; + } + + *pResult_e = result_e; + return result_m; +} + +inline FIXP_DBL fAddNorm(FIXP_DBL a_m, INT a_e, FIXP_DBL b_m, INT b_e, + INT result_e) { + FIXP_DBL result_m; + + a_m = scaleValue(a_m, a_e - result_e); + b_m = scaleValue(b_m, b_e - result_e); + + result_m = a_m + b_m; + + return result_m; +} +#endif /* FUNCTION_fAddNorm */ + +/** + * \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); + +#ifndef FUNCTION_fPow +/** + * \brief return 2 ^ (exp_m * 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_m * 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 baseLd_m mantissa of log2() of x. + * \param baseLd_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_m * 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 baseLd_m mantissa of log2() of x. + * \param baseLd_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_m * 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_m * 2^base_e) ^ N + * \param base_m mantissa of the base + * \param base_e exponent of the base + * \param N 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); +#endif /* #ifndef FUNCTION_fPow */ + +#ifndef FUNCTION_fLog2 +/** + * \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 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. + */ +FDK_INLINE 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 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 polynomial approximation of ln(1-x) */ + { + FIXP_DBL px2_m; + 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 polynomial 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 polynomial evaluation + * loop.*/ + *result_e = 1; + } + } + + return result_m; +} + +/** + * \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. + */ +FDK_INLINE 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; +} + +#endif /* FUNCTION_fLog2 */ + +#ifndef FUNCTION_fAddSaturate +/** + * \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); +} +#endif /* FUNCTION_fAddSaturate */ + +INT fixp_floorToInt(FIXP_DBL f_inp, INT sf); +FIXP_DBL fixp_floor(FIXP_DBL f_inp, INT sf); + +INT fixp_ceilToInt(FIXP_DBL f_inp, INT sf); +FIXP_DBL fixp_ceil(FIXP_DBL f_inp, INT sf); + +INT fixp_truncateToInt(FIXP_DBL f_inp, INT sf); +FIXP_DBL fixp_truncate(FIXP_DBL f_inp, INT sf); + +INT fixp_roundToInt(FIXP_DBL f_inp, INT sf); +FIXP_DBL fixp_round(FIXP_DBL f_inp, INT sf); + +/***************************************************************************** + + array for 1/n, n=1..80 + +****************************************************************************/ + +extern const FIXP_DBL invCount[80]; + +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 (80-1). + * \param intValue Integer input value. + * \param FIXP_DBL representation of 1/intValue + */ +inline FIXP_DBL GetInvInt(int intValue) { + return invCount[fMin(fMax(intValue, 0), 80 - 1)]; +} + +#endif /* FIXPOINT_MATH_H */ diff --git a/fdk-aac/libFDK/include/huff_nodes.h b/fdk-aac/libFDK/include/huff_nodes.h new file mode 100644 index 0000000..0dda5d3 --- /dev/null +++ b/fdk-aac/libFDK/include/huff_nodes.h @@ -0,0 +1,258 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Omer Osman + + Description: MPEG-D SAC/USAC/SAOC Huffman Part0 Tables + +*******************************************************************************/ + +#ifndef HUFF_NODES_H +#define HUFF_NODES_H + +#include "genericStds.h" + +typedef struct { + SHORT nodeTab[39][2]; + +} HUFF_RES_NODES; + +/* 1D Nodes */ +typedef struct { + SHORT nodeTab[30][2]; + +} HUFF_CLD_NOD_1D; + +typedef struct { + SHORT nodeTab[7][2]; + +} HUFF_ICC_NOD_1D; + +typedef struct { + SHORT nodeTab[50][2]; + +} HUFF_CPC_NOD_1D; + +typedef struct { + SHORT nodeTab[15][2]; + +} HUFF_OLD_NOD_1D; + +typedef struct { + SHORT nodeTab[63][2]; + +} HUFF_NRG_NOD_1D; + +/* 2D Nodes */ +typedef struct { + SHORT lav3[15][2]; + SHORT lav5[35][2]; + SHORT lav7[63][2]; + SHORT lav9[99][2]; + +} HUFF_CLD_NOD_2D; + +typedef struct { + SHORT lav1[3][2]; + SHORT lav3[15][2]; + SHORT lav5[35][2]; + SHORT lav7[63][2]; + +} HUFF_ICC_NOD_2D; + +typedef struct { + SHORT lav3[15][2]; + SHORT lav6[48][2]; + SHORT lav9[99][2]; + SHORT lav12[168][2]; + +} HUFF_OLD_NOD_2D; + +typedef struct { + SHORT lav3[15][2]; + SHORT lav5[35][2]; + SHORT lav7[63][2]; + SHORT lav9[99][2]; + +} HUFF_NRG_NOD_2D_df; + +typedef struct { + SHORT lav3[15][2]; + SHORT lav6[48][2]; + SHORT lav9[99][2]; + SHORT lav12[168][2]; + +} HUFF_NRG_NOD_2D_dt; + +typedef struct { + HUFF_NRG_NOD_2D_df df[2]; + HUFF_NRG_NOD_2D_dt dt[2]; + HUFF_NRG_NOD_2D_df dp[2]; + +} HUFF_NRG_NOD_2D; + +/* Complete bs Parameter Nodes */ +typedef struct { + const HUFF_CLD_NOD_1D *h1D[3]; + const HUFF_CLD_NOD_2D *h2D[3][2]; + +} HUFF_CLD_NODES; + +typedef struct { + const HUFF_ICC_NOD_1D *h1D[3]; + const HUFF_ICC_NOD_2D *h2D[3][2]; + +} HUFF_ICC_NODES; + +typedef struct { + const HUFF_OLD_NOD_1D *h1D[3]; + const HUFF_OLD_NOD_2D *h2D[3][2]; + +} HUFF_OLD_NODES; + +typedef struct { + const HUFF_NRG_NOD_1D *h1D[3]; + const HUFF_NRG_NOD_2D *h2D; + +} HUFF_NRG_NODES; + +/* parameter instance */ +typedef struct { + SHORT cld[30][2]; + SHORT icc[7][2]; + SHORT ipd[7][2]; + SHORT old[15][2]; + SHORT nrg[63][2]; +} HUFF_PT0_NODES; + +typedef struct { + SHORT nodeTab[3][2]; + +} HUFF_LAV_NODES; + +/* USAC specific */ +typedef struct { + SHORT nodeTab[7][2]; + +} HUFF_IPD_NOD_1D; + +typedef struct { + SHORT lav1[3][2]; + SHORT lav3[15][2]; + SHORT lav5[35][2]; + SHORT lav7[63][2]; + +} HUFF_IPD_NOD_2D; + +typedef struct { + HUFF_IPD_NOD_1D h1D[3]; + HUFF_IPD_NOD_2D h2D[3][2]; + +} HUFF_IPD_NODES; + +/* non-lossy coding decoder */ +extern const HUFF_PT0_NODES FDK_huffPart0Nodes; +extern const HUFF_LAV_NODES FDK_huffLavIdxNodes; + +extern const HUFF_ICC_NODES FDK_huffICCNodes; +extern const HUFF_CLD_NODES FDK_huffCLDNodes; +extern const HUFF_RES_NODES FDK_huffReshapeNodes; + +extern const HUFF_OLD_NODES huffOLDNodes; + +extern const HUFF_IPD_NODES FDK_huffIPDNodes; + +#endif /* HUFF_NODES_H */ diff --git a/fdk-aac/libFDK/include/mdct.h b/fdk-aac/libFDK/include/mdct.h new file mode 100644 index 0000000..1382374 --- /dev/null +++ b/fdk-aac/libFDK/include/mdct.h @@ -0,0 +1,253 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Manuel Jander, Josef Hoepfl, Youliy Ninov, Daniel Hagel + + Description: MDCT/MDST routines + +*******************************************************************************/ + +#ifndef MDCT_H +#define MDCT_H + +#include "common_fix.h" + +#define MDCT_OUT_HEADROOM 2 /* Output additional headroom */ +#define PCM_OUT_BITS SAMPLE_BITS +#define PCM_OUT_HEADROOM 8 /* Must have the same values as DMXH_HEADROOM */ + +#define MDCT_OUTPUT_SCALE (-MDCT_OUT_HEADROOM + (DFRACT_BITS - SAMPLE_BITS)) +/* Refer to "Output word length" in ISO/IEC 14496-3:2008(E) 23.2.3.6 */ +#define MDCT_OUTPUT_GAIN 16 + +#if (MDCT_OUTPUT_SCALE >= 0) +#define IMDCT_SCALE(x) SATURATE_RIGHT_SHIFT(x, MDCT_OUTPUT_SCALE, PCM_OUT_BITS) +#else +#define IMDCT_SCALE(x) SATURATE_LEFT_SHIFT(x, -MDCT_OUTPUT_SCALE, PCM_OUT_BITS) +#endif +#define IMDCT_SCALE_DBL(x) (FIXP_DBL)(x) +#define IMDCT_SCALE_DBL_LSH1(x) SATURATE_LEFT_SHIFT_ALT((x), 1, DFRACT_BITS) + +#define MLT_FLAG_CURR_ALIAS_SYMMETRY 1 + +typedef enum { + BLOCK_LONG = 0, /* normal long block */ + BLOCK_START, /* long start block */ + BLOCK_SHORT, /* 8 short blocks sequence */ + BLOCK_STOP /* long stop block*/ +} BLOCK_TYPE; + +typedef enum { SHAPE_SINE = 0, SHAPE_KBD, SHAPE_LOL } WINDOW_SHAPE; + +/** + * \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 transform 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 */ + + int prevAliasSymmetry; + int prevPrevAliasSymmetry; + + FIXP_DBL *pFacZir; + FIXP_DBL *pAsymOvlp; /**< pointer to asymmetric overlap (used for stereo LPD + transition) */ +} 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. + */ +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 pTimeData pointer to input time domain signal + * \param noInSamples number of input samples + * \param mdctData pointer to where the resulting MDCT spectrum will be stored + * into. + * \param nSpec number of spectra + * \param pMdctData_e pointer to the input data exponent. Updated accordingly on + * return for output data. + * \return number of input samples processed. + */ +INT mdct_block(H_MDCT hMdct, const INT_PCM *pTimeData, const INT noInSamples, + FIXP_DBL *RESTRICT mdctData, const INT nSpec, const INT tl, + const FIXP_WTP *pRightWindowPart, const INT fr, + SHORT *pMdctData_e); + +/** + * \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 MLT 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 spectrum pointer to the input MDCT spectra. + * \param scalefactors exponents 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). + * \param flags flags controlling the type of transform + * \return number of output samples returned. + */ +INT imlt_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, + int flags); + +#endif /* MDCT_H */ diff --git a/fdk-aac/libFDK/include/mips/abs_mips.h b/fdk-aac/libFDK/include/mips/abs_mips.h new file mode 100644 index 0000000..dbb2063 --- /dev/null +++ b/fdk-aac/libFDK/include/mips/abs_mips.h @@ -0,0 +1,125 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: fixed point intrinsics + +*******************************************************************************/ + +#if !defined(ABS_MIPS_H) +#define ABS_MIPS_H + +#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__ */ + +#endif /* !defined(ABS_MIPS_H) */ diff --git a/fdk-aac/libFDK/include/mips/clz_mips.h b/fdk-aac/libFDK/include/mips/clz_mips.h new file mode 100644 index 0000000..748f6c2 --- /dev/null +++ b/fdk-aac/libFDK/include/mips/clz_mips.h @@ -0,0 +1,134 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: fixed point intrinsics + +*******************************************************************************/ + +#if !defined(CLZ_MIPS_H) +#define CLZ_MIPS_H + +#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__ */ + +#endif /* !defined(CLZ_MIPS_H) */ diff --git a/fdk-aac/libFDK/include/mips/cplx_mul_mips.h b/fdk-aac/libFDK/include/mips/cplx_mul_mips.h new file mode 100644 index 0000000..4ade3e5 --- /dev/null +++ b/fdk-aac/libFDK/include/mips/cplx_mul_mips.h @@ -0,0 +1,133 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: fixed point intrinsics + +*******************************************************************************/ + +#if !defined(CPLX_MUL_MIPS_H) +#define CPLX_MUL_MIPS_H + +#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) { + *c_Re = (((long long)a_Re * (long long)b_Re) - ((long long)a_Im * (long long)b_Im))>>32; + *c_Im = (((long long)a_Re * (long long)b_Im) + ((long long)a_Im * (long long)b_Re))>>32; +} +#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) { + *c_Re = ((((long long)a_Re * (long long)b_Re) - ((long long)a_Im * (long long)b_Im))>>32)<<1; + *c_Im = ((((long long)a_Re * (long long)b_Im) + ((long long)a_Im * (long long)b_Re))>>32)<<1; +} +#endif + +#endif /* defined(__GNUC__) && defined(__mips__) */ + +#endif /* !defined(CPLX_MUL_MIPS_H) */ diff --git a/fdk-aac/libFDK/include/mips/fixmul_mips.h b/fdk-aac/libFDK/include/mips/fixmul_mips.h new file mode 100644 index 0000000..06cf530 --- /dev/null +++ b/fdk-aac/libFDK/include/mips/fixmul_mips.h @@ -0,0 +1,130 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: fixed point intrinsics + +*******************************************************************************/ + +#if !defined(FIXMUL_MIPS_H) +#define FIXMUL_MIPS_H + +#if defined(__mips__) + +#if (__GNUC__) && defined(__mips__) +/* 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; + + result = ((long long)a * b) >> 32; + + return result; +} + +#endif /* (__GNUC__) && defined(__mips__) */ + +#endif /* __mips__ */ + +#define FUNCTION_fixmulBitExact_DD +#define fixmulBitExact_DD fixmul_DD +#endif /* !defined(FIXMUL_MIPS_H) */ diff --git a/fdk-aac/libFDK/include/mips/scale_mips.h b/fdk-aac/libFDK/include/mips/scale_mips.h new file mode 100644 index 0000000..3c141fc --- /dev/null +++ b/fdk-aac/libFDK/include/mips/scale_mips.h @@ -0,0 +1,122 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: + +*******************************************************************************/ + +#ifndef SCALE_MIPS_H +#define SCALE_MIPS_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 /* SCALE_MIPS_H */ diff --git a/fdk-aac/libFDK/include/mips/scramble_mips.h b/fdk-aac/libFDK/include/mips/scramble_mips.h new file mode 100644 index 0000000..08c2e6d --- /dev/null +++ b/fdk-aac/libFDK/include/mips/scramble_mips.h @@ -0,0 +1,133 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: + +*******************************************************************************/ + +#ifndef SCRAMBLE_MIPS_H +#define SCRAMBLE_MIPS_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 /* SCRAMBLE_MIPS_H */ diff --git a/fdk-aac/libFDK/include/nlc_dec.h b/fdk-aac/libFDK/include/nlc_dec.h new file mode 100644 index 0000000..cca97f1 --- /dev/null +++ b/fdk-aac/libFDK/include/nlc_dec.h @@ -0,0 +1,187 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Omer Osman + + Description: SAC/SAOC Dec Noiseless Coding + +*******************************************************************************/ + +#ifndef NLC_DEC_H +#define NLC_DEC_H + +#include "FDK_bitstream.h" +#include "huff_nodes.h" +#include "common_fix.h" + +typedef enum { + + SAC_DECODER, + SAOC_DECODER, + USAC_DECODER + +} DECODER_TYPE; + +typedef enum { + t_CLD, + t_ICC, + t_IPD, + t_OLD, + t_IOC, + t_NRG, + t_DCLD, + t_DMG, + t_PDG + +} DATA_TYPE; + +typedef enum { + + BACKWARDS = 0x0, + FORWARDS = 0x1 + +} DIRECTION; + +typedef enum { + + DIFF_FREQ = 0x0, + DIFF_TIME = 0x1 + +} DIFF_TYPE; + +typedef enum { + + HUFF_1D = 0x0, + HUFF_2D = 0x1 + +} CODING_SCHEME; + +typedef enum { + + FREQ_PAIR = 0x0, + TIME_PAIR = 0x1 + +} PAIRING; + +#ifndef HUFFDEC_PARAMS +#define HUFFDEC_PARMS + +#define PAIR_SHIFT 4 +#define PAIR_MASK 0xf + +#define MAX_ENTRIES 168 +#define HANDLE_HUFF_NODE const SHORT(*)[MAX_ENTRIES][2] + +#endif /* HUFFDECPARAMS */ + +#define HUFFDEC_OK 0 +#define HUFFDEC_NOTOK (-1) + +typedef int ERROR_t; + +ERROR_t EcDataPairDec(DECODER_TYPE DECODER, HANDLE_FDK_BITSTREAM strm, + SCHAR *aaOutData1, SCHAR *aaOutData2, SCHAR *aHistory, + DATA_TYPE data_type, int startBand, int dataBands, + int pair_flag, int coarse_flag, + int allowDiffTimeBack_flag); + +/* needed for GES- & STP-tool */ +ERROR_t huff_dec_reshape(HANDLE_FDK_BITSTREAM strm, int *out_data, int num_val); + +extern ERROR_t sym_restoreIPD(HANDLE_FDK_BITSTREAM strm, int lav, + SCHAR data[2]); + +#endif diff --git a/fdk-aac/libFDK/include/ppc/clz_ppc.h b/fdk-aac/libFDK/include/ppc/clz_ppc.h new file mode 100644 index 0000000..bfd23c6 --- /dev/null +++ b/fdk-aac/libFDK/include/ppc/clz_ppc.h @@ -0,0 +1,102 @@ + +/* ----------------------------------------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. + All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements +the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio. +This FDK AAC Codec software is intended to be used on a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual +audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by +independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part +of the MPEG specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer) +may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners +individually for the purpose of encoding or decoding bit streams in products that are compliant with +the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license +these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec +software may already be covered under those patent licenses when it is used for those licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality, +are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional +applications information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, are permitted without +payment of copyright license fees provided that you satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of the FDK AAC Codec or +your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation and/or other materials +provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form. +You must make available free of charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived from this library without +prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec +software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software +and the date of any change. For modified versions of the FDK AAC Codec, the term +"Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term +"Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer, +ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with +respect to this software. + +You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized +by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors +"AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties +of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages, +including but not limited to procurement of substitute goods or services; loss of use, data, or profits, +or business interruption, however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of this software, even if +advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------------------------------------- */ + +/*************************** Fraunhofer IIS FDK Tools ********************** + + Author(s): + Description: fixed point intrinsics + +******************************************************************************/ + +#if defined(__powerpc__) && (defined(__GNUC__) || defined(__xlC__)) + +#define FUNCTION_fixnormz_D + +inline INT fixnormz_D(LONG value) +{ + INT result; + __asm__ ("cntlzw %0, %1" : "=r" (result) : "r" (value)); + return result; +} + +#endif /* __powerpc__ && (__GNUC__ || __xlC__) */ diff --git a/fdk-aac/libFDK/include/ppc/fixmul_ppc.h b/fdk-aac/libFDK/include/ppc/fixmul_ppc.h new file mode 100644 index 0000000..9e2745c --- /dev/null +++ b/fdk-aac/libFDK/include/ppc/fixmul_ppc.h @@ -0,0 +1,115 @@ + +/* ----------------------------------------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. + All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements +the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio. +This FDK AAC Codec software is intended to be used on a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual +audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by +independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part +of the MPEG specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer) +may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners +individually for the purpose of encoding or decoding bit streams in products that are compliant with +the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license +these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec +software may already be covered under those patent licenses when it is used for those licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality, +are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional +applications information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, are permitted without +payment of copyright license fees provided that you satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of the FDK AAC Codec or +your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation and/or other materials +provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form. +You must make available free of charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived from this library without +prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec +software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software +and the date of any change. For modified versions of the FDK AAC Codec, the term +"Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term +"Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer, +ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with +respect to this software. + +You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized +by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors +"AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties +of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages, +including but not limited to procurement of substitute goods or services; loss of use, data, or profits, +or business interruption, however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of this software, even if +advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------------------------------------- */ + +/*************************** Fraunhofer IIS FDK Tools ********************** + + Author(s): + Description: fixed point intrinsics + +******************************************************************************/ + +#if defined(__powerpc__) && (defined(__GNUC__) || defined(__xlC__)) + +#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 fixmuldiv2_DD (const INT a, const INT b) +{ + INT result; + __asm__ ("mulhw %0, %1, %2" : "=r" (result) : "r" (a), "r" (b)); + return result; +} + +#endif /* __powerpc__ && (__GNUC__ || __xlC__) */ diff --git a/fdk-aac/libFDK/include/qmf.h b/fdk-aac/libFDK/include/qmf.h new file mode 100644 index 0000000..609c6f1 --- /dev/null +++ b/fdk-aac/libFDK/include/qmf.h @@ -0,0 +1,301 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: + +*******************************************************************************/ + +/*! + \file qmf.h + \brief Complex qmf analysis/synthesis + \author Markus Werner + +*/ + +#ifndef QMF_H +#define QMF_H + +#include "common_fix.h" +#include "FDK_tools_rom.h" +#include "dct.h" + +#define FIXP_QAS FIXP_PCM +#define QAS_BITS SAMPLE_BITS + +#define FIXP_QSS FIXP_DBL +#define QSS_BITS DFRACT_BITS + +/* Flags for QMF intialization */ +/* Low Power mode flag */ +#define QMF_FLAG_LP 1 +/* Filter is not symmetric. This flag is set internally in the QMF + * initialization as required. */ +/* DO NOT PASS THIS FLAG TO qmfInitAnalysisFilterBank or + * qmfInitSynthesisFilterBank */ +#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 +/* Flag to indicate HE-AAC down-sampled SBR mode (decoder) -> adapt analysis + * post twiddling */ +#define QMF_FLAG_DOWNSAMPLED 64 + +#define QMF_MAX_SYNTHESIS_BANDS (64) + +/*! + * \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 omitted 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 omitted 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 + +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 synScalefactor; /*!< Scale factor of synthesis qmf (syn only) */ + int outScalefactor; /*!< Scale factor of output data (syn only) */ + FIXP_DBL outGain_m; /*!< Mantissa of gain output data (syn only) (init with + 0x80000000 to ignore) */ + int outGain_e; /*!< Exponent of gain output data (syn only) */ + + 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_DBL **qmfReal, /*!< Pointer to real subband slots */ + FIXP_DBL **qmfImag, /*!< Pointer to imag subband slots */ + QMF_SCALE_FACTOR *scaleFactor, /*!< Scale factors of QMF data */ + const LONG *timeIn, /*!< Time signal */ + const int timeIn_e, /*!< Exponent of audio data */ + const int stride, /*!< Stride factor of audio data */ + FIXP_DBL *pWorkBuffer /*!< pointer to temporary working buffer */ +); + +void qmfAnalysisFiltering( + HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Analysis Bank */ + FIXP_DBL **qmfReal, /*!< Pointer to real subband slots */ + FIXP_DBL **qmfImag, /*!< Pointer to imag subband slots */ + QMF_SCALE_FACTOR *scaleFactor, /*!< Scale factors of QMF data */ + const INT_PCM *timeIn, /*!< Time signal */ + const int timeIn_e, /*!< Exponent of audio data */ + const int stride, /*!< Stride factor of audio data */ + FIXP_DBL *pWorkBuffer /*!< pointer to temporal working buffer */ +); + +void qmfSynthesisFiltering( + HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_DBL **QmfBufferReal, /*!< Pointer to real subband slots */ + FIXP_DBL **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_DBL *pWorkBuffer /*!< pointer to temporary working buffer. It must be + aligned */ +); + +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_DBL *qmfReal, /*!< Low and High band, real */ + FIXP_DBL *qmfImag, /*!< Low and High band, imag */ + const LONG *timeIn, /*!< Pointer to input */ + const int stride, /*!< stride factor of input */ + FIXP_DBL *pWorkBuffer /*!< pointer to temporary working buffer */ +); + +void qmfAnalysisFilteringSlot( + HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_DBL *qmfReal, /*!< Low and High band, real */ + FIXP_DBL *qmfImag, /*!< Low and High band, imag */ + const INT_PCM *timeIn, /*!< Pointer to input */ + const int stride, /*!< stride factor of input */ + FIXP_DBL *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_DBL *realSlot, + const FIXP_DBL *imagSlot, + const int scaleFactorLowBand, + const int scaleFactorHighBand, INT_PCM *timeOut, + const int timeOut_e, FIXP_DBL *pWorkBuffer); + +void qmfChangeOutScalefactor( + HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + int outScalefactor /*!< New scaling factor for output data */ +); + +int qmfGetOutScalefactor( + HANDLE_QMF_FILTER_BANK synQmf /*!< Handle of Qmf Synthesis Bank */ +); + +void qmfChangeOutGain( + HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_DBL outputGain, /*!< New gain for output data (mantissa) */ + int outputGainScale /*!< New gain for output data (exponent) */ +); +void qmfSynPrototypeFirSlot( + HANDLE_QMF_FILTER_BANK qmf, + FIXP_DBL *RESTRICT realSlot, /*!< Input: Pointer to real Slot */ + FIXP_DBL *RESTRICT imagSlot, /*!< Input: Pointer to imag Slot */ + INT_PCM *RESTRICT timeOut, /*!< Time domain data */ + const int timeOut_e); + +#endif /*ifndef QMF_H */ diff --git a/fdk-aac/libFDK/include/qmf_pcm.h b/fdk-aac/libFDK/include/qmf_pcm.h new file mode 100644 index 0000000..f24e0cd --- /dev/null +++ b/fdk-aac/libFDK/include/qmf_pcm.h @@ -0,0 +1,405 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Markus Lohwasser, Josef Hoepfl, Manuel Jander + + Description: QMF filterbank + +*******************************************************************************/ + +#ifndef QMF_PCM_H +#define QMF_PCM_H + +/* + All Synthesis functions dependent on datatype INT_PCM_QMFOUT + Should only be included by qmf.cpp, but not compiled separately, please + exclude compilation from project, if done otherwise. Is optional included + twice to duplicate all functions with two different pre-definitions, as: + #define INT_PCM_QMFOUT LONG + and ... + #define INT_PCM_QMFOUT SHORT + needed to run QMF synthesis in both 16bit and 32bit sample output format. +*/ + +#define QSSCALE (0) +#define FX_DBL2FX_QSS(x) (x) +#define FX_QSS2FX_DBL(x) (x) + +/*! + \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_DBL *RESTRICT realSlot, /*!< Input: Pointer to real Slot */ + FIXP_DBL *RESTRICT imagSlot, /*!< Input: Pointer to imag Slot */ + INT_PCM_QMFOUT *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_QMFOUT) - 1 - qmf->outScalefactor - + qmf->outGain_e; + + p_flt = + p_Filter + p_stride * QMF_NO_POLY; /* 5th of 330 */ + p_fltm = p_Filter + (qmf->FilterSize / 2) - + p_stride * QMF_NO_POLY; /* 5 + (320 - 2*5) = 315th of 330 */ + + FIXP_SGL gain = FX_DBL2FX_SGL(qmf->outGain_m); + + FIXP_DBL rnd_val = 0; + + if (scale > 0) { + if (scale < (DFRACT_BITS - 1)) + rnd_val = FIXP_DBL(1 << (scale - 1)); + else + scale = (DFRACT_BITS - 1); + } else { + scale = fMax(scale, -(DFRACT_BITS - 1)); + } + + for (j = no_channels - 1; j >= 0; j--) { + FIXP_DBL imag = imagSlot[j]; /* no_channels-1 .. 0 */ + FIXP_DBL real = realSlot[j]; /* no_channels-1 .. 0 */ + { + INT_PCM_QMFOUT tmp; + FIXP_DBL Are = fMultAddDiv2(FX_QSS2FX_DBL(sta[0]), p_fltm[0], real); + + /* This PCM formatting performs: + - multiplication with 16-bit gain, if not -1.0f + - rounding, if shift right is applied + - apply shift left (or right) with saturation to 32 (or 16) bits + - store output with --stride in 32 (or 16) bit format + */ + if (gain != (FIXP_SGL)(-32768)) /* -1.0f */ + { + Are = fMult(Are, gain); + } + if (scale >= 0) { + FDK_ASSERT( + Are <= + (Are + rnd_val)); /* Round-addition must not overflow, might be + equal for rnd_val=0 */ + tmp = (INT_PCM_QMFOUT)( + SATURATE_RIGHT_SHIFT(Are + rnd_val, scale, SAMPLE_BITS_QMFOUT)); + } else { + tmp = (INT_PCM_QMFOUT)( + SATURATE_LEFT_SHIFT(Are, -scale, SAMPLE_BITS_QMFOUT)); + } + + { timeOut[(j)*stride] = tmp; } + } + + sta[0] = FX_DBL2FX_QSS(fMultAddDiv2(FX_QSS2FX_DBL(sta[1]), p_flt[4], imag)); + sta[1] = + FX_DBL2FX_QSS(fMultAddDiv2(FX_QSS2FX_DBL(sta[2]), p_fltm[1], real)); + sta[2] = FX_DBL2FX_QSS(fMultAddDiv2(FX_QSS2FX_DBL(sta[3]), p_flt[3], imag)); + sta[3] = + FX_DBL2FX_QSS(fMultAddDiv2(FX_QSS2FX_DBL(sta[4]), p_fltm[2], real)); + sta[4] = FX_DBL2FX_QSS(fMultAddDiv2(FX_QSS2FX_DBL(sta[5]), p_flt[2], imag)); + sta[5] = + FX_DBL2FX_QSS(fMultAddDiv2(FX_QSS2FX_DBL(sta[6]), p_fltm[3], real)); + sta[6] = FX_DBL2FX_QSS(fMultAddDiv2(FX_QSS2FX_DBL(sta[7]), p_flt[1], imag)); + sta[7] = + FX_DBL2FX_QSS(fMultAddDiv2(FX_QSS2FX_DBL(sta[8]), 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_DBL *RESTRICT realSlot, /*!< Input: Pointer to real Slot */ + FIXP_DBL *RESTRICT imagSlot, /*!< Input: Pointer to imag Slot */ + INT_PCM_QMFOUT *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_QMFOUT) - 1 - qmf->outScalefactor - + qmf->outGain_e; + + p_flt = p_Filter; /*!< Pointer to first half of filter coefficients */ + p_fltm = + &p_flt[qmf->FilterSize / 2]; /* at index 320, overall 640 coefficients */ + + FIXP_SGL gain = FX_DBL2FX_SGL(qmf->outGain_m); + + FIXP_DBL rnd_val = (FIXP_DBL)0; + + if (scale > 0) { + if (scale < (DFRACT_BITS - 1)) + rnd_val = FIXP_DBL(1 << (scale - 1)); + else + scale = (DFRACT_BITS - 1); + } else { + scale = fMax(scale, -(DFRACT_BITS - 1)); + } + + for (j = no_channels - 1; j >= 0; j--) { + FIXP_DBL imag = imagSlot[j]; /* no_channels-1 .. 0 */ + FIXP_DBL real = realSlot[j]; /* no_channels-1 .. 0 */ + { + INT_PCM_QMFOUT tmp; + FIXP_DBL Are = sta[0] + FX_DBL2FX_QSS(fMultDiv2(p_fltm[4], real)); + + /* This PCM formatting performs: + - multiplication with 16-bit gain, if not -1.0f + - rounding, if shift right is applied + - apply shift left (or right) with saturation to 32 (or 16) bits + - store output with --stride in 32 (or 16) bit format + */ + if (gain != (FIXP_SGL)(-32768)) /* -1.0f */ + { + Are = fMult(Are, gain); + } + if (scale > 0) { + FDK_ASSERT(Are < + (Are + rnd_val)); /* Round-addition must not overflow */ + tmp = (INT_PCM_QMFOUT)( + SATURATE_RIGHT_SHIFT(Are + rnd_val, scale, SAMPLE_BITS_QMFOUT)); + } else { + tmp = (INT_PCM_QMFOUT)( + SATURATE_LEFT_SHIFT(Are, -scale, SAMPLE_BITS_QMFOUT)); + } + 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 */ + +void qmfSynthesisFilteringSlot(HANDLE_QMF_FILTER_BANK synQmf, + const FIXP_DBL *realSlot, + const FIXP_DBL *imagSlot, + const int scaleFactorLowBand, + const int scaleFactorHighBand, + INT_PCM_QMFOUT *timeOut, const int stride, + FIXP_DBL *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 + * The workbuffer must be aligned + */ +void qmfSynthesisFiltering( + HANDLE_QMF_FILTER_BANK synQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_DBL **QmfBufferReal, /*!< Low and High band, real */ + FIXP_DBL **QmfBufferImag, /*!< Low and High band, imag */ + const QMF_SCALE_FACTOR *scaleFactor, + const INT ov_len, /*!< split Slot of overlap and actual slots */ + INT_PCM_QMFOUT *timeOut, /*!< Pointer to output */ + const INT stride, /*!< stride factor of output */ + FIXP_DBL *pWorkBuffer /*!< pointer to temporal working buffer */ +) { + int i; + int L = synQmf->no_channels; + int scaleFactorHighBand; + int scaleFactorLowBand_ov, scaleFactorLowBand_no_ov; + + FDK_ASSERT(synQmf->no_channels >= synQmf->lsb); + FDK_ASSERT(synQmf->no_channels >= synQmf->usb); + + /* adapt scaling */ + scaleFactorHighBand = -ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK - + scaleFactor->hb_scale - synQmf->filterScale; + scaleFactorLowBand_ov = -ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK - + scaleFactor->ov_lb_scale - synQmf->filterScale; + scaleFactorLowBand_no_ov = -ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK - + scaleFactor->lb_scale - synQmf->filterScale; + + for (i = 0; i < synQmf->no_col; i++) /* ----- no_col loop ----- */ + { + const FIXP_DBL *QmfBufferImagSlot = NULL; + + int 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 */ +} +#endif /* QMF_PCM_H */ diff --git a/fdk-aac/libFDK/include/scale.h b/fdk-aac/libFDK/include/scale.h new file mode 100644 index 0000000..30fa089 --- /dev/null +++ b/fdk-aac/libFDK/include/scale.h @@ -0,0 +1,298 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: Scaling operations + +*******************************************************************************/ + +#ifndef SCALE_H +#define SCALE_H + +#include "common_fix.h" +#include "genericStds.h" +#include "fixminmax.h" + +#define SCALE_INLINE + +#if defined(__arm__) +#include "arm/scale_arm.h" + +#elif defined(__mips__) +#include "mips/scale_mips.h" + +#endif + +void scaleValues(FIXP_SGL *vector, INT len, INT scalefactor); +void scaleValues(FIXP_DBL *vector, INT len, INT scalefactor); +void scaleValues(FIXP_DBL *dst, const FIXP_DBL *src, INT len, INT scalefactor); +#if (SAMPLE_BITS == 16) +void scaleValues(FIXP_PCM *dst, const FIXP_DBL *src, INT len, INT scalefactor); +#endif +void scaleValues(FIXP_PCM *dst, const FIXP_SGL *src, INT len, INT scalefactor); +void scaleCplxValues(FIXP_DBL *r_dst, FIXP_DBL *i_dst, const FIXP_DBL *r_src, + const FIXP_DBL *i_src, INT len, INT scalefactor); +void scaleValuesWithFactor(FIXP_DBL *vector, FIXP_DBL factor, INT len, + INT scalefactor); +void scaleValuesSaturate(FIXP_DBL *vector, INT len, INT scalefactor); +void scaleValuesSaturate(FIXP_DBL *dst, FIXP_DBL *src, INT len, + INT scalefactor); +void scaleValuesSaturate(FIXP_SGL *dst, FIXP_DBL *src, INT len, + INT scalefactor); +void scaleValuesSaturate(INT_PCM *dst, FIXP_DBL *src, INT len, INT scalefactor); +void scaleValuesSaturate(FIXP_SGL *vector, INT len, INT scalefactor); +void scaleValuesSaturate(FIXP_SGL *dst, FIXP_SGL *src, INT len, + INT scalefactor); +void scaleValuesSaturate(INT_PCM *dst, INT_PCM *src, INT len, INT scalefactor); +INT getScalefactorShort(const SHORT *vector, INT len); +INT getScalefactorPCM(const INT_PCM *vector, INT len, INT stride); +INT getScalefactor(const FIXP_DBL *vector, INT len); +INT getScalefactor(const FIXP_SGL *vector, INT len); + +#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)); +} +inline FIXP_SGL scaleValue(const FIXP_SGL 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 /* in range -31 ... +31 */ +) { + int headroom = fixnormz_D( + (INT)value ^ (INT)((value >> 31))); /* headroom in range 1...32 */ + if (scalefactor >= 0) { + /* shift left: saturate in case of headroom less/equal scalefactor */ + if (headroom <= scalefactor) { + if (value > (FIXP_DBL)0) + return (FIXP_DBL)MAXVAL_DBL; /* 0x7FFF.FFFF */ + else + return (FIXP_DBL)MINVAL_DBL + (FIXP_DBL)1; /* 0x8000.0001 */ + } else { + return fMax((value << scalefactor), (FIXP_DBL)MINVAL_DBL + (FIXP_DBL)1); + } + } else { + scalefactor = -scalefactor; + /* shift right: clear in case of 32-headroom greater/equal -scalefactor */ + if ((DFRACT_BITS - headroom) <= scalefactor) { + return (FIXP_DBL)0; + } else { + return fMax((value >> scalefactor), (FIXP_DBL)MINVAL_DBL + (FIXP_DBL)1); + } + } +} +#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)) - 1) >> (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/fdk-aac/libFDK/include/scramble.h b/fdk-aac/libFDK/include/scramble.h new file mode 100644 index 0000000..f07ebed --- /dev/null +++ b/fdk-aac/libFDK/include/scramble.h @@ -0,0 +1,153 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: + +*******************************************************************************/ + +#ifndef SCRAMBLE_H +#define SCRAMBLE_H + +#include "common_fix.h" + +#if defined(__arm__) +#include "arm/scramble_arm.h" + +#elif defined(__mips__) && defined(__mips_dsp) +#include "mips/scramble_mips.h" + +#endif + +/***************************************************************************** + + functionname: scramble + description: bitreversal of input data + returns: + input: + output: + +*****************************************************************************/ +#if !defined(FUNCTION_scramble) + +/* default scramble functionality */ +inline void scramble(FIXP_DBL *x, INT length) { + INT m, k, j; + FDK_ASSERT(!(((INT)(INT64)x) & (ALIGNMENT_DEFAULT - 1))); + C_ALLOC_ALIGNED_CHECK(x); + + for (m = 1, j = 0; m < length - 1; m++) { + { + for (k = length >> 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/fdk-aac/libFDK/include/x86/abs_x86.h b/fdk-aac/libFDK/include/x86/abs_x86.h new file mode 100644 index 0000000..efd6433 --- /dev/null +++ b/fdk-aac/libFDK/include/x86/abs_x86.h @@ -0,0 +1,123 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: fixed point intrinsics + +*******************************************************************************/ + +#if !defined(ABS_X86_H) +#define ABS_X86_H + +#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__ */ + +#endif /* !defined(ABS_X86_H) */ diff --git a/fdk-aac/libFDK/include/x86/clz_x86.h b/fdk-aac/libFDK/include/x86/clz_x86.h new file mode 100644 index 0000000..badca29 --- /dev/null +++ b/fdk-aac/libFDK/include/x86/clz_x86.h @@ -0,0 +1,165 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Manuel Jander + + Description: x86 version of count leading zero / bits + +*******************************************************************************/ + +#if !defined(CLZ_X86_H) +#define CLZ_X86_H + +#if defined(__GNUC__) && (defined(__x86__) || defined(__x86_64__)) + +#define FUNCTION_fixnormz_D +#define FUNCTION_fixnorm_D + +inline INT fixnormz_D(LONG value) { + INT result; + + if (value != 0) { + result = __builtin_clz(value); + } else { + result = 32; + } + return result; +} + +inline INT fixnorm_D(LONG value) { + INT result; + if (value == 0) { + return 0; + } + if (value < 0) { + value = ~value; + } + result = fixnormz_D(value); + return result - 1; +} + +#elif (_MSC_VER > 1200) && (defined(_M_IX86) || defined(_M_X64)) + +#include + +#define FUNCTION_fixnormz_D +#define FUNCTION_fixnorm_D + +inline INT fixnormz_D(LONG value) { + unsigned long result = 0; + unsigned char err; + err = _BitScanReverse(&result, value); + if (err) { + return 31 - result; + } else { + return 32; + } +} + +inline INT fixnorm_D(LONG value) { + INT result; + if (value == 0) { + return 0; + } + if (value < 0) { + value = ~value; + } + result = fixnormz_D(value); + return result - 1; +} + +#endif /* toolchain */ +#endif /* !defined(CLZ_X86_H) */ diff --git a/fdk-aac/libFDK/include/x86/fixmul_x86.h b/fdk-aac/libFDK/include/x86/fixmul_x86.h new file mode 100644 index 0000000..84e6316 --- /dev/null +++ b/fdk-aac/libFDK/include/x86/fixmul_x86.h @@ -0,0 +1,187 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: fixed point intrinsics + +*******************************************************************************/ + +#if !defined(FIXMUL_X86_H) +#define FIXMUL_X86_H + +#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__ */ + +#endif /* !defined(FIXMUL_X86_H) */ diff --git a/fdk-aac/libFDK/include/x86/fixpoint_math_x86.h b/fdk-aac/libFDK/include/x86/fixpoint_math_x86.h new file mode 100644 index 0000000..d81fb26 --- /dev/null +++ b/fdk-aac/libFDK/include/x86/fixpoint_math_x86.h @@ -0,0 +1,208 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Manuel Jander + + Description: Fixed point specific mathematical functions for x86 + +*******************************************************************************/ + +#if !defined(FIXPOINT_MATH_X86_H) +#define FIXPOINT_MATH_X86_H + +#define FUNCTION_sqrtFixp + +#include + +#ifdef FUNCTION_sqrtFixp +static inline FIXP_DBL sqrtFixp(const FIXP_DBL op) { + FIXP_DBL result; + /* result = + * (FIXP_DBL)(INT)(sqrt((double)(INT)op)*46340.950011841578559133736114903); + */ + result = (FIXP_DBL)(INT)(sqrt((float)(INT)op) * 46340.9492f); + FDK_ASSERT(result >= (FIXP_DBL)0); + return result; +} +#endif /* FUNCTION_sqrtFixp */ + +#include + +#define FUNCTION_invSqrtNorm2 +/** + * \brief calculate 1.0/sqrt(op) + * \param op_m mantissa of input value. + * \param result_e pointer to return the exponent of the result + * \return mantissa of the result + */ +#ifdef FUNCTION_invSqrtNorm2 +inline FIXP_DBL invSqrtNorm2(FIXP_DBL op_m, INT *result_e) { + float result; + if (op_m == (FIXP_DBL)0) { + *result_e = 16; + return ((LONG)0x7fffffff); + } + result = (float)(1.0 / sqrt(0.5f * (float)(INT)op_m)); + result = (float)ldexp(frexpf(result, result_e), DFRACT_BITS - 1); + *result_e += 15; + + FDK_ASSERT(result >= 0); + return (FIXP_DBL)(INT)result; +} +#endif /* FUNCTION_invSqrtNorm2 */ + +#define FUNCTION_invFixp +/** + * \brief calculate 1.0/op + * \param op mantissa of the input value. + * \return mantissa of the result with implizit exponent of 31 + */ +#ifdef FUNCTION_invFixp +inline FIXP_DBL invFixp(FIXP_DBL op) { + float result; + INT result_e; + if ((op == (FIXP_DBL)0) || (op == (FIXP_DBL)1)) { + return ((LONG)0x7fffffff); + } + result = (float)(1.0 / (float)(INT)op); + result = frexpf(result, &result_e); + result = ldexpf(result, 31 + result_e); + + return (FIXP_DBL)(INT)result; +} + +/** + * \brief calculate 1.0/(op_m * 2^op_e) + * \param op_m mantissa of the input value. + * \param op_e pointer into were the exponent of the input value is stored, and + * the result will be stored into. + * \return mantissa of the result + */ +inline FIXP_DBL invFixp(FIXP_DBL op_m, int *op_e) { + float result; + INT result_e; + if ((op_m == (FIXP_DBL)0x00000000) || (op_m == (FIXP_DBL)0x00000001)) { + *op_e = 31 - *op_e; + return ((LONG)0x7fffffff); + } + result = (float)(1.0 / (float)(INT)op_m); + result = ldexpf(frexpf(result, &result_e), DFRACT_BITS - 1); + *op_e = result_e - *op_e + 31; + return (FIXP_DBL)(INT)result; +} +#endif /* FUNCTION_invFixp */ + +#define 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 + */ +#ifdef FUNCTION_schur_div +inline FIXP_DBL schur_div(FIXP_DBL num, FIXP_DBL denum, INT count) { + (void)count; + /* same asserts than for fallback implementation */ + FDK_ASSERT(num >= (FIXP_DBL)0); + FDK_ASSERT(denum > (FIXP_DBL)0); + FDK_ASSERT(num <= denum); + + return (num == denum) ? (FIXP_DBL)MAXVAL_DBL + : (FIXP_DBL)(INT)(((INT64)(INT)num << 31) / (INT)denum); +} +#endif /* FUNCTION_schur_div */ +#endif /* !defined(FIXPOINT_MATH_X86_H) */ diff --git a/fdk-aac/libFDK/src/FDK_bitbuffer.cpp b/fdk-aac/libFDK/src/FDK_bitbuffer.cpp new file mode 100644 index 0000000..98905ea --- /dev/null +++ b/fdk-aac/libFDK/src/FDK_bitbuffer.cpp @@ -0,0 +1,489 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Lohwasser + + Description: common bitbuffer read/write routines + +*******************************************************************************/ + +#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}; + +void FDK_CreateBitBuffer(HANDLE_FDK_BITBUF *hBitBuf, UCHAR *pBuffer, + UINT bufSize) { + FDK_InitBitBuffer(*hBitBuf, pBuffer, bufSize, 0); + + FDKmemclear((*hBitBuf)->Buffer, bufSize * sizeof(UCHAR)); +} + +void FDK_DeleteBitBuffer(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->BitNdx = 0; + + hBitBuf->Buffer = pBuffer; + hBitBuf->bufSize = bufSize; + hBitBuf->bufBits = (bufSize << 3); + /*assure bufsize (2^n) */ + FDK_ASSERT(hBitBuf->ValidBits <= hBitBuf->bufBits); + FDK_ASSERT((bufSize > 0) && (bufSize <= MAX_BUFSIZE_BYTES)); + { + UINT x = 0, n = bufSize; + for (x = 0; n > 0; x++, n >>= 1) { + } + if (bufSize != ((UINT)1 << (x - 1))) { + FDK_ASSERT(0); + } + } +} + +void FDK_ResetBitBuffer(HANDLE_FDK_BITBUF hBitBuf) { + hBitBuf->ValidBits = 0; + hBitBuf->ReadOffset = 0; + hBitBuf->WriteOffset = 0; + hBitBuf->BitNdx = 0; +} + +#ifndef FUNCTION_FDK_get +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->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)); +} +#endif /* #ifndef FUNCTION_FDK_get */ + +#ifndef FUNCTION_FDK_get32 +INT FDK_get32(HANDLE_FDK_BITBUF hBitBuf) { + UINT BitNdx = hBitBuf->BitNdx + 32; + hBitBuf->BitNdx = BitNdx & (hBitBuf->bufBits - 1); + hBitBuf->ValidBits = (UINT)((INT)hBitBuf->ValidBits - (INT)32); + + UINT byteOffset = (BitNdx - 1) >> 3; + if (BitNdx <= hBitBuf->bufBits) { + 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 { + UINT byte_mask = hBitBuf->bufSize - 1; + UINT cache = (hBitBuf->Buffer[(byteOffset - 3) & byte_mask] << 24) | + (hBitBuf->Buffer[(byteOffset - 2) & byte_mask] << 16) | + (hBitBuf->Buffer[(byteOffset - 1) & byte_mask] << 8) | + hBitBuf->Buffer[(byteOffset - 0) & byte_mask]; + + if ((BitNdx = (BitNdx & 7)) != 0) { + cache = (cache >> (8 - BitNdx)) | + ((UINT)hBitBuf->Buffer[(byteOffset - 4) & byte_mask] + << (24 + BitNdx)); + } + return (cache); + } +} +#endif + +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->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) { + if (numberOfBits != 0) { + UINT byteOffset0 = hBitBuf->BitNdx >> 3; + UINT bitOffset = hBitBuf->BitNdx & 0x7; + + hBitBuf->BitNdx = (hBitBuf->BitNdx + numberOfBits) & (hBitBuf->bufBits - 1); + hBitBuf->ValidBits += numberOfBits; + + UINT byteMask = hBitBuf->bufSize - 1; + + UINT byteOffset1 = (byteOffset0 + 1) & byteMask; + UINT byteOffset2 = (byteOffset0 + 2) & byteMask; + UINT byteOffset3 = (byteOffset0 + 3) & byteMask; + + // Create tmp containing free bits at the left border followed by bits to + // write, LSB's are cleared, if available Create mask to apply upon all + // buffer bytes + UINT tmp = (value << (32 - numberOfBits)) >> bitOffset; + UINT mask = ~((BitMask[numberOfBits] << (32 - numberOfBits)) >> bitOffset); + + // read all 4 bytes from buffer and create a 32-bit cache + UINT cache = (((UINT)hBitBuf->Buffer[byteOffset0]) << 24) | + (((UINT)hBitBuf->Buffer[byteOffset1]) << 16) | + (((UINT)hBitBuf->Buffer[byteOffset2]) << 8) | + (((UINT)hBitBuf->Buffer[byteOffset3]) << 0); + + cache = (cache & mask) | tmp; + hBitBuf->Buffer[byteOffset0] = (UCHAR)(cache >> 24); + hBitBuf->Buffer[byteOffset1] = (UCHAR)(cache >> 16); + hBitBuf->Buffer[byteOffset2] = (UCHAR)(cache >> 8); + hBitBuf->Buffer[byteOffset3] = (UCHAR)(cache >> 0); + + if ((bitOffset + numberOfBits) > 32) { + UINT byteOffset4 = (byteOffset0 + 4) & byteMask; + // remaining bits: in range 1..7 + // replace MSBits of next byte in buffer by LSBits of "value" + int bits = (bitOffset + numberOfBits) & 7; + cache = + (UINT)hBitBuf->Buffer[byteOffset4] & (~(BitMask[bits] << (8 - bits))); + cache |= value << (8 - bits); + hBitBuf->Buffer[byteOffset4] = (UCHAR)cache; + } + } +} + +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->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))); + } +} + +#ifndef FUNCTION_FDK_pushBack +void FDK_pushBack(HANDLE_FDK_BITBUF hBitBuf, const UINT numberOfBits, + UCHAR config) { + hBitBuf->ValidBits = + (config == 0) ? (UINT)((INT)hBitBuf->ValidBits + (INT)numberOfBits) + : ((UINT)((INT)hBitBuf->ValidBits - (INT)numberOfBits)); + hBitBuf->BitNdx = ((UINT)((INT)hBitBuf->BitNdx - (INT)numberOfBits)) & + (hBitBuf->bufBits - 1); +} +#endif + +void FDK_pushForward(HANDLE_FDK_BITBUF hBitBuf, const UINT numberOfBits, + UCHAR config) { + hBitBuf->ValidBits = + (config == 0) ? ((UINT)((INT)hBitBuf->ValidBits - (INT)numberOfBits)) + : (UINT)((INT)hBitBuf->ValidBits + (INT)numberOfBits); + hBitBuf->BitNdx = + (UINT)((INT)hBitBuf->BitNdx + (INT)numberOfBits) & (hBitBuf->bufBits - 1); +} + +#ifndef FUNCTION_FDK_getValidBits +UINT FDK_getValidBits(HANDLE_FDK_BITBUF hBitBuf) { return hBitBuf->ValidBits; } +#endif /* #ifndef FUNCTION_FDK_getValidBits */ + +INT FDK_getFreeBits(HANDLE_FDK_BITBUF hBitBuf) { + return (hBitBuf->bufBits - hBitBuf->ValidBits); +} + +void FDK_Feed(HANDLE_FDK_BITBUF hBitBuf, const 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->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/fdk-aac/libFDK/src/FDK_core.cpp b/fdk-aac/libFDK/src/FDK_core.cpp new file mode 100644 index 0000000..75ea8a2 --- /dev/null +++ b/fdk-aac/libFDK/src/FDK_core.cpp @@ -0,0 +1,145 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Manuel Jander + + Description: FDK tools versioning support + +*******************************************************************************/ + +#include "FDK_core.h" + +/* FDK tools library info */ +#define FDK_TOOLS_LIB_VL0 3 +#define FDK_TOOLS_LIB_VL1 0 +#define FDK_TOOLS_LIB_VL2 0 +#define FDK_TOOLS_LIB_TITLE "FDK Tools" +#ifdef __ANDROID__ +#define FDK_TOOLS_LIB_BUILD_DATE "" +#define FDK_TOOLS_LIB_BUILD_TIME "" +#else +#define FDK_TOOLS_LIB_BUILD_DATE __DATE__ +#define FDK_TOOLS_LIB_BUILD_TIME __TIME__ +#endif + +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 = FDK_TOOLS_LIB_BUILD_DATE; + info->build_time = FDK_TOOLS_LIB_BUILD_TIME; + info->title = FDK_TOOLS_LIB_TITLE; + info->flags = 1; + + return 0; +} diff --git a/fdk-aac/libFDK/src/FDK_crc.cpp b/fdk-aac/libFDK/src/FDK_crc.cpp new file mode 100644 index 0000000..ecbddb1 --- /dev/null +++ b/fdk-aac/libFDK/src/FDK_crc.cpp @@ -0,0 +1,526 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + 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}; + +/** + * \brief This table defines precalculated lookup tables for crc polynom x^16 + x^14 + x^13 + x^12 + x^11 + x^5 + x^3 + x^2 + x^0. + */ +static const USHORT crcLookup_16_14_13_12_11_5_3_2_0[256] = +{ + 0x0000, 0x782f, 0xf05e, 0x8871, 0x9893, 0xe0bc, 0x68cd, 0x10e2, + 0x4909, 0x3126, 0xb957, 0xc178, 0xd19a, 0xa9b5, 0x21c4, 0x59eb, + 0x9212, 0xea3d, 0x624c, 0x1a63, 0x0a81, 0x72ae, 0xfadf, 0x82f0, + 0xdb1b, 0xa334, 0x2b45, 0x536a, 0x4388, 0x3ba7, 0xb3d6, 0xcbf9, + 0x5c0b, 0x2424, 0xac55, 0xd47a, 0xc498, 0xbcb7, 0x34c6, 0x4ce9, + 0x1502, 0x6d2d, 0xe55c, 0x9d73, 0x8d91, 0xf5be, 0x7dcf, 0x05e0, + 0xce19, 0xb636, 0x3e47, 0x4668, 0x568a, 0x2ea5, 0xa6d4, 0xdefb, + 0x8710, 0xff3f, 0x774e, 0x0f61, 0x1f83, 0x67ac, 0xefdd, 0x97f2, + 0xb816, 0xc039, 0x4848, 0x3067, 0x2085, 0x58aa, 0xd0db, 0xa8f4, + 0xf11f, 0x8930, 0x0141, 0x796e, 0x698c, 0x11a3, 0x99d2, 0xe1fd, + 0x2a04, 0x522b, 0xda5a, 0xa275, 0xb297, 0xcab8, 0x42c9, 0x3ae6, + 0x630d, 0x1b22, 0x9353, 0xeb7c, 0xfb9e, 0x83b1, 0x0bc0, 0x73ef, + 0xe41d, 0x9c32, 0x1443, 0x6c6c, 0x7c8e, 0x04a1, 0x8cd0, 0xf4ff, + 0xad14, 0xd53b, 0x5d4a, 0x2565, 0x3587, 0x4da8, 0xc5d9, 0xbdf6, + 0x760f, 0x0e20, 0x8651, 0xfe7e, 0xee9c, 0x96b3, 0x1ec2, 0x66ed, + 0x3f06, 0x4729, 0xcf58, 0xb777, 0xa795, 0xdfba, 0x57cb, 0x2fe4, + 0x0803, 0x702c, 0xf85d, 0x8072, 0x9090, 0xe8bf, 0x60ce, 0x18e1, + 0x410a, 0x3925, 0xb154, 0xc97b, 0xd999, 0xa1b6, 0x29c7, 0x51e8, + 0x9a11, 0xe23e, 0x6a4f, 0x1260, 0x0282, 0x7aad, 0xf2dc, 0x8af3, + 0xd318, 0xab37, 0x2346, 0x5b69, 0x4b8b, 0x33a4, 0xbbd5, 0xc3fa, + 0x5408, 0x2c27, 0xa456, 0xdc79, 0xcc9b, 0xb4b4, 0x3cc5, 0x44ea, + 0x1d01, 0x652e, 0xed5f, 0x9570, 0x8592, 0xfdbd, 0x75cc, 0x0de3, + 0xc61a, 0xbe35, 0x3644, 0x4e6b, 0x5e89, 0x26a6, 0xaed7, 0xd6f8, + 0x8f13, 0xf73c, 0x7f4d, 0x0762, 0x1780, 0x6faf, 0xe7de, 0x9ff1, + 0xb015, 0xc83a, 0x404b, 0x3864, 0x2886, 0x50a9, 0xd8d8, 0xa0f7, + 0xf91c, 0x8133, 0x0942, 0x716d, 0x618f, 0x19a0, 0x91d1, 0xe9fe, + 0x2207, 0x5a28, 0xd259, 0xaa76, 0xba94, 0xc2bb, 0x4aca, 0x32e5, + 0x6b0e, 0x1321, 0x9b50, 0xe37f, 0xf39d, 0x8bb2, 0x03c3, 0x7bec, + 0xec1e, 0x9431, 0x1c40, 0x646f, 0x748d, 0x0ca2, 0x84d3, 0xfcfc, + 0xa517, 0xdd38, 0x5549, 0x2d66, 0x3d84, 0x45ab, 0xcdda, 0xb5f5, + 0x7e0c, 0x0623, 0x8e52, 0xf67d, 0xe69f, 0x9eb0, 0x16c1, 0x6eee, + 0x3705, 0x4f2a, 0xc75b, 0xbf74, 0xaf96, 0xd7b9, 0x5fc8, 0x27e7, +}; + +/** + * \brief This table defines precalculated lookup tables for crc polynom x^16 + * + x^15 + x^5 + x^0. + */ +static const USHORT crcLookup_16_15_5_0[256] = { + 0x0000, 0x8021, 0x8063, 0x0042, 0x80e7, 0x00c6, 0x0084, 0x80a5, 0x81ef, + 0x01ce, 0x018c, 0x81ad, 0x0108, 0x8129, 0x816b, 0x014a, 0x83ff, 0x03de, + 0x039c, 0x83bd, 0x0318, 0x8339, 0x837b, 0x035a, 0x0210, 0x8231, 0x8273, + 0x0252, 0x82f7, 0x02d6, 0x0294, 0x82b5, 0x87df, 0x07fe, 0x07bc, 0x879d, + 0x0738, 0x8719, 0x875b, 0x077a, 0x0630, 0x8611, 0x8653, 0x0672, 0x86d7, + 0x06f6, 0x06b4, 0x8695, 0x0420, 0x8401, 0x8443, 0x0462, 0x84c7, 0x04e6, + 0x04a4, 0x8485, 0x85cf, 0x05ee, 0x05ac, 0x858d, 0x0528, 0x8509, 0x854b, + 0x056a, 0x8f9f, 0x0fbe, 0x0ffc, 0x8fdd, 0x0f78, 0x8f59, 0x8f1b, 0x0f3a, + 0x0e70, 0x8e51, 0x8e13, 0x0e32, 0x8e97, 0x0eb6, 0x0ef4, 0x8ed5, 0x0c60, + 0x8c41, 0x8c03, 0x0c22, 0x8c87, 0x0ca6, 0x0ce4, 0x8cc5, 0x8d8f, 0x0dae, + 0x0dec, 0x8dcd, 0x0d68, 0x8d49, 0x8d0b, 0x0d2a, 0x0840, 0x8861, 0x8823, + 0x0802, 0x88a7, 0x0886, 0x08c4, 0x88e5, 0x89af, 0x098e, 0x09cc, 0x89ed, + 0x0948, 0x8969, 0x892b, 0x090a, 0x8bbf, 0x0b9e, 0x0bdc, 0x8bfd, 0x0b58, + 0x8b79, 0x8b3b, 0x0b1a, 0x0a50, 0x8a71, 0x8a33, 0x0a12, 0x8ab7, 0x0a96, + 0x0ad4, 0x8af5, 0x9f1f, 0x1f3e, 0x1f7c, 0x9f5d, 0x1ff8, 0x9fd9, 0x9f9b, + 0x1fba, 0x1ef0, 0x9ed1, 0x9e93, 0x1eb2, 0x9e17, 0x1e36, 0x1e74, 0x9e55, + 0x1ce0, 0x9cc1, 0x9c83, 0x1ca2, 0x9c07, 0x1c26, 0x1c64, 0x9c45, 0x9d0f, + 0x1d2e, 0x1d6c, 0x9d4d, 0x1de8, 0x9dc9, 0x9d8b, 0x1daa, 0x18c0, 0x98e1, + 0x98a3, 0x1882, 0x9827, 0x1806, 0x1844, 0x9865, 0x992f, 0x190e, 0x194c, + 0x996d, 0x19c8, 0x99e9, 0x99ab, 0x198a, 0x9b3f, 0x1b1e, 0x1b5c, 0x9b7d, + 0x1bd8, 0x9bf9, 0x9bbb, 0x1b9a, 0x1ad0, 0x9af1, 0x9ab3, 0x1a92, 0x9a37, + 0x1a16, 0x1a54, 0x9a75, 0x1080, 0x90a1, 0x90e3, 0x10c2, 0x9067, 0x1046, + 0x1004, 0x9025, 0x916f, 0x114e, 0x110c, 0x912d, 0x1188, 0x91a9, 0x91eb, + 0x11ca, 0x937f, 0x135e, 0x131c, 0x933d, 0x1398, 0x93b9, 0x93fb, 0x13da, + 0x1290, 0x92b1, 0x92f3, 0x12d2, 0x9277, 0x1256, 0x1214, 0x9235, 0x975f, + 0x177e, 0x173c, 0x971d, 0x17b8, 0x9799, 0x97db, 0x17fa, 0x16b0, 0x9691, + 0x96d3, 0x16f2, 0x9657, 0x1676, 0x1634, 0x9615, 0x14a0, 0x9481, 0x94c3, + 0x14e2, 0x9447, 0x1466, 0x1424, 0x9405, 0x954f, 0x156e, 0x152c, 0x950d, + 0x15a8, 0x9589, 0x95cb, 0x15ea, +}; + +/*--------------- 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: + DAB+ FireCode: + x^16 + x^14 + x^13 + x^12 + x^11 + x^5 + x^3 + x^2 + x^0 + (1) 0111 1000 0010 1101 -> 0x782d + + x^16 + x^15 + x^5 + x^0 (1) 1000 0000 0010 0001 -> 0x8021 + 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; /* Preset 0 for "crcLen" != 16 or unknown 16-bit polynoms "crcPoly" */ + + if (hCrcInfo->crcLen == 16) { + switch (crcPoly) { + case 0x8021: + hCrcInfo->pCrcLookup = crcLookup_16_15_5_0; + break; + case 0x8005: + hCrcInfo->pCrcLookup = crcLookup_16_15_2_0; + break; + case 0x1021: + hCrcInfo->pCrcLookup = crcLookup_16_12_5_0; + break; + case 0x782d: + hCrcInfo->pCrcLookup = crcLookup_16_14_13_12_11_5_3_2_0; + break; + case 0x001d: + default: + /* no lookup table */ + break; + } + } +} + +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 = (INT)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 = + (INT)FDKgetValidBits(hBs) - hCrcInfo->crcRegData[reg].validBits; + } else { + hCrcInfo->crcRegData[reg].bitBufCntBits = + hCrcInfo->crcRegData[reg].validBits - (INT)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 = FDKreadBit(hBs); // process single bit + tmp ^= ((crc & crcMask) ? 1 : 0); + if (tmp != 0) tmp = crcPoly; + crc <<= 1; + crc ^= tmp; + } + } else { + for (i = 0; (i < nBits); i++) { + USHORT tmp = (crc & crcMask) ? crcPoly : 0; // process single bit + 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) { + ULONG data; + INT bits; + for (i = 0; i < (nBytes >> 2); i++) { + data = (ULONG)FDKreadBits(hBs, 32); + crc = + (crc << 8) ^ pCrcLookup[((crc >> 8) ^ ((USHORT)(data >> 24))) & 0xFF]; + crc = + (crc << 8) ^ pCrcLookup[((crc >> 8) ^ ((USHORT)(data >> 16))) & 0xFF]; + crc = + (crc << 8) ^ pCrcLookup[((crc >> 8) ^ ((USHORT)(data >> 8))) & 0xFF]; + crc = + (crc << 8) ^ pCrcLookup[((crc >> 8) ^ ((USHORT)(data >> 0))) & 0xFF]; + } + bits = (nBytes & 3) << 3; + if (bits > 0) { + data = (ULONG)FDKreadBits(hBs, bits); + for (bits -= 8; bits >= 0; bits -= 8) + crc = (crc << 8) ^ + pCrcLookup[((crc >> 8) ^ (USHORT)(data >> bits)) & 0xFF]; + } + } else { + for (i = 0; i < nBytes; i++) { + crc = (crc << 8) ^ pCrcLookup[(crc >> 8) & 0xFF]; + } + } + + *pCrc = crc; /* update crc value */ + //fprintf(stderr, "\n\n crc[%d]=%04x\n", i, crc); + + return (nBytes); +} + +/** + * \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, + -(rD->validBits - (INT)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) && ((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) { + calcCrc_Bits(&crc, hCrcInfo->crcMask, hCrcInfo->crcPoly, NULL, rBits); + } + } + + //fprintf(stderr, "\n\n crc=%04x\n", crc); + hCrcInfo->crcValue = crc; +} diff --git a/fdk-aac/libFDK/src/FDK_decorrelate.cpp b/fdk-aac/libFDK/src/FDK_decorrelate.cpp new file mode 100644 index 0000000..c5de79a --- /dev/null +++ b/fdk-aac/libFDK/src/FDK_decorrelate.cpp @@ -0,0 +1,1746 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Markus Lohwasser + + Description: FDK Tools Decorrelator + +*******************************************************************************/ + +#include "FDK_decorrelate.h" + +#define PC_NUM_BANDS (8) +#define PC_NUM_HYB_BANDS (PC_NUM_BANDS - 3 + 10) + +#define DUCK_ALPHA (0.8f) +#define DUCK_GAMMA (1.5f) +#define ABS_THR (1e-9f * 32768 * 32768) +#define ABS_THR_FDK ((FIXP_DBL)1) + +#define DECORR_ZERO_PADDING 0 + +#define DECORR_FILTER_ORDER_BAND_0_MPS (20) +#define DECORR_FILTER_ORDER_BAND_1_MPS (15) +#define DECORR_FILTER_ORDER_BAND_2_MPS (6) +#define DECORR_FILTER_ORDER_BAND_3_MPS (3) + +#define DECORR_FILTER_ORDER_BAND_0_USAC (10) +#define DECORR_FILTER_ORDER_BAND_1_USAC (8) +#define DECORR_FILTER_ORDER_BAND_2_USAC (3) +#define DECORR_FILTER_ORDER_BAND_3_USAC (2) + +#define DECORR_FILTER_ORDER_BAND_0_LD (0) +#define DECORR_FILTER_ORDER_BAND_1_LD (DECORR_FILTER_ORDER_BAND_1_MPS) +#define DECORR_FILTER_ORDER_BAND_2_LD (DECORR_FILTER_ORDER_BAND_2_MPS) +#define DECORR_FILTER_ORDER_BAND_3_LD (DECORR_FILTER_ORDER_BAND_3_MPS) + +#define MAX_DECORR_SEED_MPS \ + (5) /* 4 is worst case for 7272 mode for low power */ + /* 5 is worst case for 7271 and 7272 mode for high quality */ +#define MAX_DECORR_SEED_USAC (1) +#define MAX_DECORR_SEED_LD (4) + +#define DECORR_FILTER_ORDER_PS (12) +#define NUM_DECORR_CONFIGS \ + (3) /* different configs defined by bsDecorrConfig bitstream field */ + +/* REV_bandOffset_... tables map (hybrid) bands to the corresponding reverb + bands. Within each reverb band the same processing is applied. Instead of QMF + split frequencies the corresponding hybrid band offsets are stored directly + */ +static const UCHAR REV_bandOffset_MPS_HQ[NUM_DECORR_CONFIGS][(4)] = { + {8, 21, 30, 71}, {8, 56, 71, 71}, {0, 21, 71, 71}}; +/* REV_bandOffset_USAC[] are equivalent to REV_bandOffset_MPS_HQ */ +static const UCHAR REV_bandOffset_PS_HQ[(4)] = {30, 42, 71, 71}; +static const UCHAR REV_bandOffset_PS_LP[(4)] = {14, 42, 71, 71}; +static const UCHAR REV_bandOffset_LD[NUM_DECORR_CONFIGS][(4)] = { + {0, 14, 23, 64}, {0, 49, 64, 64}, {0, 14, 64, 64}}; + +/* REV_delay_... tables define the number of delay elements within each reverb + * band */ +/* REV_filterOrder_... tables define the filter order within each reverb band */ +static const UCHAR REV_delay_MPS[(4)] = {8, 7, 2, 1}; +static const SCHAR REV_filterOrder_MPS[(4)] = { + DECORR_FILTER_ORDER_BAND_0_MPS, DECORR_FILTER_ORDER_BAND_1_MPS, + DECORR_FILTER_ORDER_BAND_2_MPS, DECORR_FILTER_ORDER_BAND_3_MPS}; +static const UCHAR REV_delay_PS_HQ[(4)] = {2, 14, 1, 0}; +static const UCHAR REV_delay_PS_LP[(4)] = {8, 14, 1, 0}; +static const SCHAR REV_filterOrder_PS[(4)] = {DECORR_FILTER_ORDER_PS, -1, -1, + -1}; +static const UCHAR REV_delay_USAC[(4)] = {11, 10, 5, 2}; +static const SCHAR REV_filterOrder_USAC[(4)] = { + DECORR_FILTER_ORDER_BAND_0_USAC, DECORR_FILTER_ORDER_BAND_1_USAC, + DECORR_FILTER_ORDER_BAND_2_USAC, DECORR_FILTER_ORDER_BAND_3_USAC}; + +/* REV_filtType_... tables define the type of processing (filtering with + different properties or pure delay) done in each reverb band. This is mapped + to specialized routines. */ +static const REVBAND_FILT_TYPE REV_filtType_MPS[(4)] = { + COMMON_REAL, COMMON_REAL, COMMON_REAL, COMMON_REAL}; + +static const REVBAND_FILT_TYPE REV_filtType_PS[(4)] = {INDEP_CPLX_PS, DELAY, + DELAY, NOT_EXIST}; + +/* initialization values of ring buffer offsets for the 3 concatenated allpass + * filters (PS type decorrelator). */ +static const UCHAR stateBufferOffsetInit[(3)] = {0, 6, 14}; + +static const REVBAND_FILT_TYPE REV_filtType_LD[(4)] = { + NOT_EXIST, COMMON_REAL, COMMON_REAL, COMMON_REAL}; + +/*** mapping of hybrid bands to processing (/parameter?) bands ***/ +/* table for PS decorr running in legacy PS decoder. */ +static const UCHAR kernels_20_to_71_PS[(71) + 1] = { + 0, 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, + 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19}; + +/*** mapping of processing (/parameter?) bands to hybrid bands ***/ +/* table for PS decorr running in legacy PS decoder. */ +static const UCHAR kernels_20_to_71_offset_PS[(20) + 1] = { + 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 21, 25, 30, 42, 71}; + +static const UCHAR kernels_28_to_71[(71) + 1] = { + 0, 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, + 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, + 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27}; + +static const UCHAR kernels_28_to_71_offset[(28) + 1] = { + 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 21, 23, 25, 27, 30, 33, 37, 42, 48, 55, 71}; + +/* LD-MPS defined in SAOC standart (mapping qmf -> param bands)*/ +static const UCHAR kernels_23_to_64[(64) + 1] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 13, 13, 14, + 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, + 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, +}; + +static const UCHAR kernels_23_to_64_offset[(23) + 1] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 14, 16, 18, 20, 23, 26, 30, 35, 41, 48, 64}; + +static inline int SpatialDecGetProcessingBand(int hybridBand, + const UCHAR *tab) { + return tab[hybridBand]; +} + +/* helper inline function */ +static inline int SpatialDecGetQmfBand(int paramBand, const UCHAR *tab) { + return (int)tab[paramBand]; +} + +#define DUCKER_MAX_NRG_SCALE (24) +#define DUCKER_HEADROOM_BITS (3) + +#define FILTER_SF (2) + +#ifdef ARCH_PREFER_MULT_32x32 +#define FIXP_DUCK_GAIN FIXP_DBL +#define FX_DBL2FX_DUCK_GAIN +#define FL2FXCONST_DUCK FL2FXCONST_DBL +#else +#define FIXP_DUCK_GAIN FIXP_SGL +#define FX_DBL2FX_DUCK_GAIN FX_DBL2FX_SGL +#define FL2FXCONST_DUCK FL2FXCONST_SGL +#endif +#define PS_DUCK_PEAK_DECAY_FACTOR (0.765928338364649f) +#define PS_DUCK_FILTER_COEFF (0.25f) +#define DUCK_ALPHA_FDK FL2FXCONST_DUCK(DUCK_ALPHA) +#define DUCK_ONE_MINUS_ALPHA_X4_FDK FL2FXCONST_DUCK(4.0f * (1.0f - DUCK_ALPHA)) +#define DUCK_GAMMA_FDK FL2FXCONST_DUCK(DUCK_GAMMA / 2) +#define PS_DUCK_PEAK_DECAY_FACTOR_FDK FL2FXCONST_DUCK(PS_DUCK_PEAK_DECAY_FACTOR) +#define PS_DUCK_FILTER_COEFF_FDK FL2FXCONST_DUCK(PS_DUCK_FILTER_COEFF) +RAM_ALIGN +const FIXP_STP DecorrPsCoeffsCplx[][4] = { + {STCP(0x5d6940eb, 0x5783153e), STCP(0xadcd41a8, 0x0e0373ed), + STCP(0xbad41f3e, 0x14fba045), STCP(0xc1eb6694, 0x0883227d)}, + {STCP(0x5d6940eb, 0xa87ceac2), STCP(0xadcd41a8, 0xf1fc8c13), + STCP(0xbad41f3e, 0xeb045fbb), STCP(0xc1eb6694, 0xf77cdd83)}, + {STCP(0xaec24162, 0x62e9d75b), STCP(0xb7169316, 0x28751048), + STCP(0xd224c0cc, 0x37e05050), STCP(0xc680864f, 0x18e88cba)}, + {STCP(0xaec24162, 0x9d1628a5), STCP(0xb7169316, 0xd78aefb8), + STCP(0xd224c0cc, 0xc81fafb0), STCP(0xc680864f, 0xe7177346)}, + {STCP(0x98012341, 0x4aa00ed1), STCP(0xc89ca1b2, 0xc1ab6bff), + STCP(0xf8ea394e, 0xb8106bf4), STCP(0xcf542d73, 0xd888b99b)}, + {STCP(0x43b137b3, 0x6ca2ca40), STCP(0xe0649cc4, 0xb2d69cca), + STCP(0x22130c21, 0xc0405382), STCP(0xdbbf8fba, 0xcce3c7cc)}, + {STCP(0x28fc4d71, 0x86bd3b87), STCP(0x09ccfeb9, 0xad319baf), + STCP(0x46e51f02, 0xf1e5ea55), STCP(0xf30d5e34, 0xc2b0e335)}, + {STCP(0xc798f756, 0x72e73c7d), STCP(0x3b6c3c1e, 0xc580dc72), + STCP(0x2828a6ba, 0x3c1a14fb), STCP(0x14b733bb, 0xc4dcaae1)}, + {STCP(0x46dcadd3, 0x956795c7), STCP(0x52f32fae, 0xf78048cd), + STCP(0xd7d75946, 0x3c1a14fb), STCP(0x306017cb, 0xd82c0a75)}, + {STCP(0xabe197de, 0x607a675e), STCP(0x460cef6e, 0x2d3b264e), + STCP(0xb91ae0fe, 0xf1e5ea55), STCP(0x3e03e5e0, 0xf706590e)}, + {STCP(0xb1b4f509, 0x9abcaf5f), STCP(0xfeb0b4be, 0x535fb8ba), + STCP(0x1ba96f8e, 0xbd37e6d8), STCP(0x30f6dbbb, 0x271a0743)}, + {STCP(0xce75b52a, 0x89f9be61), STCP(0xb26e4dda, 0x101054c5), + STCP(0x1a475d2e, 0x3f714b19), STCP(0xf491f154, 0x3a6baf46)}, + {STCP(0xee8fdfcb, 0x813181fa), STCP(0xe11e1a00, 0xbb9a6039), + STCP(0xc3e582f5, 0xe71ab533), STCP(0xc9eb35e2, 0x0ffd212a)}, + {STCP(0x0fd7d92f, 0x80fbf975), STCP(0x38adccbc, 0xd571bbf4), + STCP(0x38c3aefc, 0xe87cc794), STCP(0xdafe8c3d, 0xd9b16100)}, + {STCP(0x300d9e10, 0x895cc359), STCP(0x32b9843e, 0x2b52adcc), + STCP(0xe9ded9f4, 0x356ce0ed), STCP(0x0fdd5ca3, 0xd072932e)}, + {STCP(0x4d03b4f8, 0x99c2dec3), STCP(0xe2bc8d94, 0x3744e195), + STCP(0xeb40ec55, 0xcde9ed22), STCP(0x2e67e231, 0xf893470b)}, + {STCP(0x64c4deb3, 0xb112790f), STCP(0xc7b32682, 0xf099172d), + STCP(0x2ebf44cf, 0x135d014a), STCP(0x1a2bacd5, 0x23334254)}, + {STCP(0x75b5f9aa, 0xcdb81e14), STCP(0x028d9bb1, 0xc9dc45b9), + STCP(0xd497893f, 0x11faeee9), STCP(0xee40ff71, 0x24a91b85)}, + {STCP(0x7eb1cd81, 0xedc3feec), STCP(0x31491897, 0xf765f6d8), + STCP(0x1098dc89, 0xd7ee574e), STCP(0xda6b816d, 0x011f35cf)}, + {STCP(0x7f1cde01, 0x0f0b7727), STCP(0x118ce49d, 0x2a5ecda4), + STCP(0x0f36ca28, 0x24badaa3), STCP(0xef2908a4, 0xe1ee3743)}, + {STCP(0x76efee25, 0x2f4e8c3a), STCP(0xdde3be2a, 0x17f92215), + STCP(0xde9bf36c, 0xf22b4839), STCP(0x1128fc0c, 0xe5c95f5a)}, + {STCP(0x66b87d65, 0x4c5ede42), STCP(0xe43f351a, 0xe6bf22dc), + STCP(0x1e0d3e85, 0xf38d5a9a), STCP(0x1c0f44a3, 0x02c92fe3)}, + {STCP(0x4f8f36b7, 0x6445680f), STCP(0x10867ea2, 0xe3072740), + STCP(0xf4ef6cfa, 0x1ab67076), STCP(0x09562a8a, 0x1742bb8b)}, + {STCP(0x3304f6ec, 0x7564812a), STCP(0x1be4f1a8, 0x0894d75a), + STCP(0xf6517f5b, 0xe8a05d98), STCP(0xf1bb0053, 0x10a78853)}, + {STCP(0x1307b2c5, 0x7e93d532), STCP(0xfe098e27, 0x18f02a58), + STCP(0x1408d459, 0x084c6e44), STCP(0xedafe5bd, 0xfbc15b2e)}, + {STCP(0xf1c111cd, 0x7f346c97), STCP(0xeb5ca6a0, 0x02efee93), + STCP(0xef4df9b6, 0x06ea5be4), STCP(0xfc149289, 0xf0d53ce4)}, + {STCP(0xd1710001, 0x773b6beb), STCP(0xfa1aeb8c, 0xf06655ff), + STCP(0x05884983, 0xf2a4c7c5), STCP(0x094f13df, 0xf79c01bf)}, + {STCP(0xb446be0b, 0x6732cfca), STCP(0x0a743752, 0xf9220dfa), + STCP(0x04263722, 0x0a046a2c), STCP(0x08ced80b, 0x0347e9c2)}, + {STCP(0x9c3b1202, 0x503018a5), STCP(0x05fcf01a, 0x05cd8529), + STCP(0xf95263e2, 0xfd3bdb3f), STCP(0x00c68cf9, 0x0637cb7f)}, + {STCP(0x8aee2710, 0x33c187ec), STCP(0xfdd253f8, 0x038e09b9), + STCP(0x0356ce0f, 0xfe9ded9f), STCP(0xfd6c3054, 0x01c8060a)}}; + +const FIXP_DECORR DecorrNumeratorReal0_USAC + [MAX_DECORR_SEED_USAC][DECORR_FILTER_ORDER_BAND_0_USAC + 1] = { + {DECORR(0x05bf4880), DECORR(0x08321c00), DECORR(0xe9315ee0), + DECORR(0x07d9dd20), DECORR(0x02224994), DECORR(0x0009d200), + DECORR(0xf8a29358), DECORR(0xf4e310d0), DECORR(0xef901fc0), + DECORR(0xebda0460), DECORR(0x40000000)}}; + +const FIXP_DECORR DecorrNumeratorReal1_USAC + [MAX_DECORR_SEED_USAC][DECORR_FILTER_ORDER_BAND_1_USAC + 1] = { + {DECORR(0xf82f8378), DECORR(0xfef588c2), DECORR(0x02eddbd8), + DECORR(0x041c2450), DECORR(0xf7edcd60), DECORR(0x07e29310), + DECORR(0xfa4ece48), DECORR(0xed9f8a20), DECORR(0x40000000)}}; + +/* identical to MPS coeffs for reverb band 3: DecorrNumeratorReal3[0] */ +const FIXP_DECORR + DecorrNumeratorReal2_USAC[MAX_DECORR_SEED_USAC] + [DECORR_FILTER_ORDER_BAND_2_USAC + 1] = { + {DECORR(0x0248e8a8), DECORR(0xfde95838), + DECORR(0x084823c0), DECORR(0x40000000)}}; + +const FIXP_DECORR + DecorrNumeratorReal3_USAC[MAX_DECORR_SEED_USAC] + [DECORR_FILTER_ORDER_BAND_3_USAC + 1] = { + {DECORR(0xff2b020c), DECORR(0x02393830), + DECORR(0x40000000)}}; + +/* const FIXP_DECORR DecorrNumeratorReal0_LD[MAX_DECORR_SEED_LD][] does not + * exist */ + +RAM_ALIGN +const FIXP_DECORR DecorrNumeratorReal1_LD[MAX_DECORR_SEED_LD] + [DECORR_FILTER_ORDER_BAND_1_LD + 1] = { + { + DECORR(0xf310cb29), + DECORR(0x1932d745), + DECORR(0x0cc2d917), + DECORR(0xddde064e), + DECORR(0xf234a626), + DECORR(0x198551a6), + DECORR(0x17141b6a), + DECORR(0xf298803d), + DECORR(0xef98be92), + DECORR(0x09ea1706), + DECORR(0x28fbdff4), + DECORR(0x1a869eb9), + DECORR(0xdeefe147), + DECORR(0xcde2adda), + DECORR(0x13ddc619), + DECORR(0x40000000), + }, + { + DECORR(0x041d7dbf), + DECORR(0x01b7309c), + DECORR(0xfb599834), + DECORR(0x092fc5ed), + DECORR(0xf2fd7c25), + DECORR(0xdd51e2eb), + DECORR(0xf62fe72b), + DECORR(0x0b15d588), + DECORR(0xf1f091a7), + DECORR(0xed1bbbfe), + DECORR(0x03526899), + DECORR(0x180cb256), + DECORR(0xecf1433d), + DECORR(0xf626ab95), + DECORR(0x197dd27e), + DECORR(0x40000000), + }, + { + DECORR(0x157a786c), + DECORR(0x0028c98c), + DECORR(0xf5eff57b), + DECORR(0x11f7d04f), + DECORR(0xf390d28d), + DECORR(0x18947081), + DECORR(0xe5dc2319), + DECORR(0xf4cc0235), + DECORR(0x2394d47f), + DECORR(0xe069230e), + DECORR(0x03a1a773), + DECORR(0xfbc9b092), + DECORR(0x15a0173b), + DECORR(0x0e9ecdf0), + DECORR(0xd309b2c7), + DECORR(0x40000000), + }, + { + DECORR(0xe0ce703b), + DECORR(0xe508b672), + DECORR(0xef362398), + DECORR(0xffe788ef), + DECORR(0x2fda3749), + DECORR(0x4671c0c6), + DECORR(0x3c003494), + DECORR(0x2387707c), + DECORR(0xd2107d2e), + DECORR(0xb3e47e08), + DECORR(0xacd0abca), + DECORR(0xc70791df), + DECORR(0x0b586e85), + DECORR(0x2f11cda7), + DECORR(0x3a4a210b), + DECORR(0x40000000), + }, +}; + +RAM_ALIGN +const FIXP_DECORR DecorrNumeratorReal2_LD[MAX_DECORR_SEED_LD] + [DECORR_FILTER_ORDER_BAND_2_LD + 1 + + DECORR_ZERO_PADDING] = { + { + DECORR(0xffb4a234), + DECORR(0x01ac71a2), + DECORR(0xf2bca010), + DECORR(0xfe3d7593), + DECORR(0x093e9976), + DECORR(0xf2c5f3f5), + DECORR(0x40000000), + }, + { + DECORR(0xe303afb8), + DECORR(0xcd70c2bb), + DECORR(0xf1e2ad7e), + DECORR(0x0c8ffbe2), + DECORR(0x21f80abf), + DECORR(0x3d08410c), + DECORR(0x40000000), + }, + { + DECORR(0xe26809d5), + DECORR(0x0efbcfa4), + DECORR(0x210c1a97), + DECORR(0xfe60af4e), + DECORR(0xeda01a51), + DECORR(0x00faf468), + DECORR(0x40000000), + }, + { + DECORR(0x1edc5d64), + DECORR(0xe5b2e35c), + DECORR(0xe94b1c45), + DECORR(0x30a6f1e1), + DECORR(0xf04e52de), + DECORR(0xe30de45a), + DECORR(0x40000000), + }, +}; + +RAM_ALIGN +const FIXP_DECORR DecorrNumeratorReal3_LD[MAX_DECORR_SEED_LD] + [DECORR_FILTER_ORDER_BAND_3_LD + 1] = { + { + DECORR(0x0248e8a7), + DECORR(0xfde9583b), + DECORR(0x084823bb), + DECORR(0x40000000), + }, + { + DECORR(0x1db22d0e), + DECORR(0xfc773992), + DECORR(0x0e819a74), + DECORR(0x40000000), + }, + { + DECORR(0x0fcb923a), + DECORR(0x0154b7ff), + DECORR(0xe70cb647), + DECORR(0x40000000), + }, + { + DECORR(0xe39f559b), + DECORR(0xe06dd6ca), + DECORR(0x19f71f71), + DECORR(0x40000000), + }, +}; + +FIXP_DBL *getAddrDirectSignalMaxVal(HANDLE_DECORR_DEC self) { + return &(self->ducker.maxValDirectData); +} + +static INT DecorrFilterInit(DECORR_FILTER_INSTANCE *const self, + FIXP_MPS *pStateBufferCplx, + FIXP_DBL *pDelayBufferCplx, INT *offsetStateBuffer, + INT *offsetDelayBuffer, INT const decorr_seed, + INT const reverb_band, INT const useFractDelay, + INT const noSampleDelay, INT const filterOrder, + FDK_DECORR_TYPE const decorrType) { + INT errorCode = 0; + switch (decorrType) { + case DECORR_USAC: + if (useFractDelay) { + return 1; + } else { + FDK_ASSERT(decorr_seed == 0); + + switch (reverb_band) { + case 0: + self->numeratorReal = DecorrNumeratorReal0_USAC[decorr_seed]; + break; + case 1: + self->numeratorReal = DecorrNumeratorReal1_USAC[decorr_seed]; + break; + case 2: + self->numeratorReal = DecorrNumeratorReal2_USAC[decorr_seed]; + break; + case 3: + self->numeratorReal = DecorrNumeratorReal3_USAC[decorr_seed]; + break; + } + } + break; + case DECORR_LD: + FDK_ASSERT(decorr_seed < MAX_DECORR_SEED_LD); + switch (reverb_band) { + case 0: + self->numeratorReal = NULL; + break; + case 1: + self->numeratorReal = DecorrNumeratorReal1_LD[decorr_seed]; + break; + case 2: + self->numeratorReal = DecorrNumeratorReal2_LD[decorr_seed]; + break; + case 3: + self->numeratorReal = DecorrNumeratorReal3_LD[decorr_seed]; + break; + } + break; + default: + return 1; + } + + self->stateCplx = pStateBufferCplx + (*offsetStateBuffer); + *offsetStateBuffer += 2 * filterOrder; + self->DelayBufferCplx = pDelayBufferCplx + (*offsetDelayBuffer); + *offsetDelayBuffer += 2 * noSampleDelay; + + return errorCode; +} + +/******************************************************************************* +*******************************************************************************/ +static INT DecorrFilterInitPS(DECORR_FILTER_INSTANCE *const self, + FIXP_MPS *pStateBufferCplx, + FIXP_DBL *pDelayBufferCplx, + INT *offsetStateBuffer, INT *offsetDelayBuffer, + INT const hybridBand, INT const reverbBand, + INT const noSampleDelay) { + INT errorCode = 0; + + if (reverbBand == 0) { + self->coeffsPacked = DecorrPsCoeffsCplx[hybridBand]; + + self->stateCplx = pStateBufferCplx + (*offsetStateBuffer); + *offsetStateBuffer += 2 * DECORR_FILTER_ORDER_PS; + } + + self->DelayBufferCplx = pDelayBufferCplx + (*offsetDelayBuffer); + *offsetDelayBuffer += 2 * noSampleDelay; + + return errorCode; +} + +LNK_SECTION_CODE_L1 +static INT DecorrFilterApplyPASS(DECORR_FILTER_INSTANCE const filter[], + FIXP_DBL *dataRealIn, FIXP_DBL *dataImagIn, + FIXP_DBL *dataRealOut, FIXP_DBL *dataImagOut, + INT start, INT stop, + INT reverbBandNoSampleDelay, + INT reverbBandDelayBufferIndex) { + INT i; + INT offset = 2 * reverbBandNoSampleDelay; + FIXP_MPS *pDelayBuffer = + &filter[start].DelayBufferCplx[reverbBandDelayBufferIndex]; + + /* Memory for the delayline has been allocated in a consecutive order, so we + can address from filter to filter with a constant length. + Be aware that real and imaginary part of the delayline are stored in + interleaved order. + */ + if (dataImagIn == NULL) { + for (i = start; i < stop; i++) { + FIXP_DBL tmp; + + tmp = *pDelayBuffer; + *pDelayBuffer = dataRealIn[i]; + dataRealOut[i] = tmp; + pDelayBuffer += offset; + } + } else { + if ((i = stop - start) != 0) { + dataRealIn += start; + dataImagIn += start; + dataRealOut += start; + dataImagOut += start; +#ifdef FUNCTION_DecorrFilterApplyPASS_func1 + DecorrFilterApplyPASS_func1(i, dataRealIn, dataImagIn, dataRealOut, + dataImagOut, pDelayBuffer, offset); +#else + do { + FIXP_DBL delay_re, delay_im, real, imag; + + real = *dataRealIn++; + imag = *dataImagIn++; + delay_re = pDelayBuffer[0]; + delay_im = pDelayBuffer[1]; + pDelayBuffer[0] = real; + pDelayBuffer[1] = imag; + *dataRealOut++ = delay_re; + *dataImagOut++ = delay_im; + pDelayBuffer += offset; + } while (--i != 0); +#endif + } + } + + return (INT)0; +} + +#ifndef FUNCTION_DecorrFilterApplyREAL +LNK_SECTION_CODE_L1 +static INT DecorrFilterApplyREAL(DECORR_FILTER_INSTANCE const filter[], + FIXP_DBL *dataRealIn, FIXP_DBL *dataImagIn, + FIXP_DBL *dataRealOut, FIXP_DBL *dataImagOut, + INT start, INT stop, INT reverbFilterOrder, + INT reverbBandNoSampleDelay, + INT reverbBandDelayBufferIndex) { + INT i, j; + FIXP_DBL xReal, xImag, yReal, yImag; + + const FIXP_DECORR *pFilter = filter[start].numeratorReal; + + INT offsetDelayBuffer = (2 * reverbBandNoSampleDelay) - 1; + FIXP_MPS *pDelayBuffer = + &filter[start].DelayBufferCplx[reverbBandDelayBufferIndex]; + + INT offsetStates = 2 * reverbFilterOrder; + FIXP_DBL *pStates = filter[start].stateCplx; + + /* Memory for the delayline has been allocated in a consecutive order, so we + can address from filter to filter with a constant length. The same is valid + for the states. + Be aware that real and imaginary part of the delayline and the states are + stored in interleaved order. + All filter in a reverb band have the same filter coefficients. + Exploit symmetry: numeratorReal[i] = + denominatorReal[reverbFilterLength-1-i] Do not accumulate the highest + states which are always zero. + */ + if (reverbFilterOrder == 2) { + FIXP_DECORR nFilt0L, nFilt0H; + + nFilt0L = pFilter[0]; + nFilt0H = pFilter[1]; + + for (i = start; i < stop; i++) { + xReal = *pDelayBuffer; + *pDelayBuffer = dataRealIn[i]; + pDelayBuffer++; + + xImag = *pDelayBuffer; + *pDelayBuffer = dataImagIn[i]; + pDelayBuffer += offsetDelayBuffer; + + yReal = (pStates[0] + fMultDiv2(xReal, nFilt0L)) << FILTER_SF; + yImag = (pStates[1] + fMultDiv2(xImag, nFilt0L)) << FILTER_SF; + + dataRealOut[i] = yReal; + dataImagOut[i] = yImag; + + pStates[0] = + pStates[2] + fMultDiv2(xReal, nFilt0H) - fMultDiv2(yReal, nFilt0H); + pStates[1] = + pStates[3] + fMultDiv2(xImag, nFilt0H) - fMultDiv2(yImag, nFilt0H); + pStates[2] = (xReal >> FILTER_SF) - fMultDiv2(yReal, nFilt0L); + pStates[3] = (xImag >> FILTER_SF) - fMultDiv2(yImag, nFilt0L); + pStates += offsetStates; + } + } else if (reverbFilterOrder == 3) { + FIXP_DECORR nFilt0L, nFilt0H, nFilt1L; + + nFilt0L = pFilter[0]; + nFilt0H = pFilter[1]; + nFilt1L = pFilter[2]; + + for (i = start; i < stop; i++) { + xReal = *pDelayBuffer; + *pDelayBuffer = dataRealIn[i]; + pDelayBuffer++; + + xImag = *pDelayBuffer; + *pDelayBuffer = dataImagIn[i]; + pDelayBuffer += offsetDelayBuffer; + + yReal = (pStates[0] + fMultDiv2(xReal, nFilt0L)) << FILTER_SF; + yImag = (pStates[1] + fMultDiv2(xImag, nFilt0L)) << FILTER_SF; + + dataRealOut[i] = yReal; + dataImagOut[i] = yImag; + + pStates[0] = + pStates[2] + fMultDiv2(xReal, nFilt0H) - fMultDiv2(yReal, nFilt1L); + pStates[1] = + pStates[3] + fMultDiv2(xImag, nFilt0H) - fMultDiv2(yImag, nFilt1L); + pStates[2] = + pStates[4] + fMultDiv2(xReal, nFilt1L) - fMultDiv2(yReal, nFilt0H); + pStates[3] = + pStates[5] + fMultDiv2(xImag, nFilt1L) - fMultDiv2(yImag, nFilt0H); + pStates[4] = (xReal >> FILTER_SF) - fMultDiv2(yReal, nFilt0L); + pStates[5] = (xImag >> FILTER_SF) - fMultDiv2(yImag, nFilt0L); + pStates += offsetStates; + } + } else if (reverbFilterOrder == 6) { + FIXP_DECORR nFilt0L, nFilt0H, nFilt1L, nFilt1H, nFilt2L, nFilt2H; + + nFilt0L = pFilter[0]; + nFilt0H = pFilter[1]; + nFilt1L = pFilter[2]; + nFilt1H = pFilter[3]; + nFilt2L = pFilter[4]; + nFilt2H = pFilter[5]; + + for (i = start; i < stop; i++) { + xReal = *pDelayBuffer; + *pDelayBuffer = dataRealIn[i]; + pDelayBuffer++; + + xImag = *pDelayBuffer; + *pDelayBuffer = dataImagIn[i]; + pDelayBuffer += offsetDelayBuffer; + + yReal = (pStates[0] + fMultDiv2(xReal, nFilt0L)) << FILTER_SF; + yImag = (pStates[1] + fMultDiv2(xImag, nFilt0L)) << FILTER_SF; + dataRealOut[i] = yReal; + dataImagOut[i] = yImag; + + pStates[0] = + pStates[2] + fMultDiv2(xReal, nFilt0H) - fMultDiv2(yReal, nFilt2H); + pStates[1] = + pStates[3] + fMultDiv2(xImag, nFilt0H) - fMultDiv2(yImag, nFilt2H); + pStates[2] = + pStates[4] + fMultDiv2(xReal, nFilt1L) - fMultDiv2(yReal, nFilt2L); + pStates[3] = + pStates[5] + fMultDiv2(xImag, nFilt1L) - fMultDiv2(yImag, nFilt2L); + pStates[4] = + pStates[6] + fMultDiv2(xReal, nFilt1H) - fMultDiv2(yReal, nFilt1H); + pStates[5] = + pStates[7] + fMultDiv2(xImag, nFilt1H) - fMultDiv2(yImag, nFilt1H); + pStates[6] = + pStates[8] + fMultDiv2(xReal, nFilt2L) - fMultDiv2(yReal, nFilt1L); + pStates[7] = + pStates[9] + fMultDiv2(xImag, nFilt2L) - fMultDiv2(yImag, nFilt1L); + pStates[8] = + pStates[10] + fMultDiv2(xReal, nFilt2H) - fMultDiv2(yReal, nFilt0H); + pStates[9] = + pStates[11] + fMultDiv2(xImag, nFilt2H) - fMultDiv2(yImag, nFilt0H); + pStates[10] = (xReal >> FILTER_SF) - fMultDiv2(yReal, nFilt0L); + pStates[11] = (xImag >> FILTER_SF) - fMultDiv2(yImag, nFilt0L); + pStates += offsetStates; + } + } else { + FIXP_DECORR nFilt0L, nFilt0H; + for (i = start; i < stop; i++) { + xReal = *pDelayBuffer; + *pDelayBuffer = dataRealIn[i]; + pDelayBuffer++; + + xImag = *pDelayBuffer; + *pDelayBuffer = dataImagIn[i]; + pDelayBuffer += offsetDelayBuffer; + + nFilt0L = pFilter[0]; + yReal = (pStates[0] + fMultDiv2(xReal, nFilt0L)) << 2; + yImag = (pStates[1] + fMultDiv2(xImag, nFilt0L)) << 2; + dataRealOut[i] = yReal; + dataImagOut[i] = yImag; + + for (j = 1; j < reverbFilterOrder; j++) { + nFilt0L = pFilter[j]; + nFilt0H = pFilter[reverbFilterOrder - j]; + pStates[2 * j - 2] = pStates[2 * j] + fMultDiv2(xReal, nFilt0L) - + fMultDiv2(yReal, nFilt0H); + pStates[2 * j - 1] = pStates[2 * j + 1] + fMultDiv2(xImag, nFilt0L) - + fMultDiv2(yImag, nFilt0H); + } + nFilt0L = pFilter[j]; + nFilt0H = pFilter[reverbFilterOrder - j]; + pStates[2 * j - 2] = + fMultDiv2(xReal, nFilt0L) - fMultDiv2(yReal, nFilt0H); + pStates[2 * j - 1] = + fMultDiv2(xImag, nFilt0L) - fMultDiv2(yImag, nFilt0H); + + pStates += offsetStates; + } + } + + return (INT)0; +} +#endif /* #ifndef FUNCTION_DecorrFilterApplyREAL */ + +#ifndef FUNCTION_DecorrFilterApplyCPLX_PS +LNK_SECTION_CODE_L1 +static INT DecorrFilterApplyCPLX_PS( + DECORR_FILTER_INSTANCE const filter[], FIXP_DBL *dataRealIn, + FIXP_DBL *dataImagIn, FIXP_DBL *dataRealOut, FIXP_DBL *dataImagOut, + INT start, INT stop, INT reverbFilterOrder, INT reverbBandNoSampleDelay, + INT reverbBandDelayBufferIndex, UCHAR *stateBufferOffset) { + /* r = real, j = imaginary */ + FIXP_DBL r_data_a, j_data_a, r_data_b, j_data_b, r_stage_mult, j_stage_mult; + FIXP_STP rj_coeff; + + /* get pointer to current position in input delay buffer of filter with + * starting-index */ + FIXP_DBL *pDelayBuffer = + &filter[start].DelayBufferCplx[reverbBandDelayBufferIndex]; /* increases + by 2 every + other call + of this + function */ + /* determine the increment for this pointer to get to the correct position in + * the delay buffer of the next filter */ + INT offsetDelayBuffer = (2 * reverbBandNoSampleDelay) - 1; + + /* pointer to current position in state buffer */ + FIXP_DBL *pStates = filter[start].stateCplx; + INT pStatesIncrement = 2 * reverbFilterOrder; + + /* stateBufferOffset-pointers */ + FIXP_DBL *pStateBufferOffset0 = pStates + stateBufferOffset[0]; + FIXP_DBL *pStateBufferOffset1 = pStates + stateBufferOffset[1]; + FIXP_DBL *pStateBufferOffset2 = pStates + stateBufferOffset[2]; + + /* traverse all hybrid-bands inbetween start- and stop-index */ + for (int i = start; i < stop; i++) { + /* 1. input delay (real/imaginary values interleaved) */ + + /* load delayed real input value */ + r_data_a = *pDelayBuffer; + /* store incoming real data value to delay buffer and increment pointer */ + *pDelayBuffer++ = dataRealIn[i]; + + /* load delayed imaginary input value */ + j_data_a = *pDelayBuffer; + /* store incoming imaginary data value to delay buffer */ + *pDelayBuffer = dataImagIn[i]; + /* increase delay buffer by offset */ + pDelayBuffer += offsetDelayBuffer; + + /* 2. Phi(k)-stage */ + + /* create pointer to coefficient table (real and imaginary coefficients + * interleaved) */ + const FIXP_STP *pCoeffs = filter[i].coeffsPacked; + + /* the first two entries of the coefficient table are the + * Phi(k)-multiplicants */ + rj_coeff = *pCoeffs++; + /* multiply value from input delay buffer by looked-up values */ + cplxMultDiv2(&r_data_b, &j_data_b, r_data_a, j_data_a, rj_coeff); + + /* 3. process all three filter stages */ + + /* stage 0 */ + + /* get coefficients from lookup table */ + rj_coeff = *pCoeffs++; + + /* multiply output of last stage by coefficient */ + cplxMultDiv2(&r_stage_mult, &j_stage_mult, r_data_b, j_data_b, rj_coeff); + r_stage_mult <<= 1; + j_stage_mult <<= 1; + + /* read and add value from state buffer (this is the input for the next + * stage) */ + r_data_a = r_stage_mult + pStateBufferOffset0[0]; + j_data_a = j_stage_mult + pStateBufferOffset0[1]; + + /* negate r_data_a to perform multiplication with complex conjugate of + * rj_coeff */ + cplxMultDiv2(&r_stage_mult, &j_stage_mult, -r_data_a, j_data_a, rj_coeff); + + /* add stage input to shifted result */ + r_stage_mult = r_data_b + (r_stage_mult << 1); + j_stage_mult = j_data_b - (j_stage_mult << 1); + + /* store result to state buffer */ + pStateBufferOffset0[0] = r_stage_mult; + pStateBufferOffset0[1] = j_stage_mult; + pStateBufferOffset0 += pStatesIncrement; + + /* stage 1 */ + + /* get coefficients from lookup table */ + rj_coeff = *pCoeffs++; + + /* multiply output of last stage by coefficient */ + cplxMultDiv2(&r_stage_mult, &j_stage_mult, r_data_a, j_data_a, rj_coeff); + r_stage_mult <<= 1; + j_stage_mult <<= 1; + + /* read and add value from state buffer (this is the input for the next + * stage) */ + r_data_b = r_stage_mult + pStateBufferOffset1[0]; + j_data_b = j_stage_mult + pStateBufferOffset1[1]; + + /* negate r_data_b to perform multiplication with complex conjugate of + * rj_coeff */ + cplxMultDiv2(&r_stage_mult, &j_stage_mult, -r_data_b, j_data_b, rj_coeff); + + /* add stage input to shifted result */ + r_stage_mult = r_data_a + (r_stage_mult << 1); + j_stage_mult = j_data_a - (j_stage_mult << 1); + + /* store result to state buffer */ + pStateBufferOffset1[0] = r_stage_mult; + pStateBufferOffset1[1] = j_stage_mult; + pStateBufferOffset1 += pStatesIncrement; + + /* stage 2 */ + + /* get coefficients from lookup table */ + rj_coeff = *pCoeffs++; + + /* multiply output of last stage by coefficient */ + cplxMultDiv2(&r_stage_mult, &j_stage_mult, r_data_b, j_data_b, rj_coeff); + r_stage_mult <<= 1; + j_stage_mult <<= 1; + + /* read and add value from state buffer (this is the input for the next + * stage) */ + r_data_a = r_stage_mult + pStateBufferOffset2[0]; + j_data_a = j_stage_mult + pStateBufferOffset2[1]; + + /* negate r_data_a to perform multiplication with complex conjugate of + * rj_coeff */ + cplxMultDiv2(&r_stage_mult, &j_stage_mult, -r_data_a, j_data_a, rj_coeff); + + /* add stage input to shifted result */ + r_stage_mult = r_data_b + (r_stage_mult << 1); + j_stage_mult = j_data_b - (j_stage_mult << 1); + + /* store result to state buffer */ + pStateBufferOffset2[0] = r_stage_mult; + pStateBufferOffset2[1] = j_stage_mult; + pStateBufferOffset2 += pStatesIncrement; + + /* write filter output */ + dataRealOut[i] = r_data_a << 1; + dataImagOut[i] = j_data_a << 1; + + } /* end of band/filter loop (outer loop) */ + + /* update stateBufferOffset with respect to ring buffer boundaries */ + if (stateBufferOffset[0] == 4) + stateBufferOffset[0] = 0; + else + stateBufferOffset[0] += 2; + + if (stateBufferOffset[1] == 12) + stateBufferOffset[1] = 6; + else + stateBufferOffset[1] += 2; + + if (stateBufferOffset[2] == 22) + stateBufferOffset[2] = 14; + else + stateBufferOffset[2] += 2; + + return (INT)0; +} + +#endif /* FUNCTION_DecorrFilterApplyCPLX_PS */ + +/******************************************************************************* +*******************************************************************************/ +static INT DuckerInit(DUCKER_INSTANCE *const self, int const hybridBands, + int partiallyComplex, const FDK_DUCKER_TYPE duckerType, + const int nParamBands, int initStatesFlag) { + INT errorCode = 0; + + if (self) { + switch (nParamBands) { + case (20): + FDK_ASSERT(hybridBands == 71); + self->mapHybBands2ProcBands = kernels_20_to_71_PS; + self->mapProcBands2HybBands = kernels_20_to_71_offset_PS; + self->parameterBands = (20); + break; + case (28): + + self->mapHybBands2ProcBands = kernels_28_to_71; + self->mapProcBands2HybBands = kernels_28_to_71_offset; + self->parameterBands = (28); + break; + case (23): + FDK_ASSERT(hybridBands == 64 || hybridBands == 32); + self->mapHybBands2ProcBands = kernels_23_to_64; + self->mapProcBands2HybBands = kernels_23_to_64_offset; + self->parameterBands = (23); + break; + default: + return 1; + } + self->qs_next = &self->mapProcBands2HybBands[1]; + + self->maxValDirectData = FL2FXCONST_DBL(-1.0f); + self->maxValReverbData = FL2FXCONST_DBL(-1.0f); + self->scaleDirectNrg = 2 * DUCKER_MAX_NRG_SCALE; + self->scaleReverbNrg = 2 * DUCKER_MAX_NRG_SCALE; + self->scaleSmoothDirRevNrg = 2 * DUCKER_MAX_NRG_SCALE; + self->headroomSmoothDirRevNrg = 2 * DUCKER_MAX_NRG_SCALE; + self->hybridBands = hybridBands; + self->partiallyComplex = partiallyComplex; + + if (initStatesFlag && (duckerType == DUCKER_PS)) { + int pb; + for (pb = 0; pb < self->parameterBands; pb++) { + self->SmoothDirRevNrg[pb] = (FIXP_MPS)0; + } + } + } else + errorCode = 1; + + return errorCode; +} + + /******************************************************************************* + *******************************************************************************/ + +#ifndef FUNCTION_DuckerCalcEnergy +static INT DuckerCalcEnergy(DUCKER_INSTANCE *const self, + FIXP_DBL const inputReal[(71)], + FIXP_DBL const inputImag[(71)], + FIXP_DBL energy[(28)], FIXP_DBL inputMaxVal, + SCHAR *nrgScale, int mode, /* 1:(ps) 0:(else) */ + int startHybBand) { + INT err = 0; + int qs, maxHybBand; + int maxHybridBand = self->hybridBands - 1; + + maxHybBand = maxHybridBand; + + FDKmemclear(energy, (28) * sizeof(FIXP_DBL)); + + if (mode == 1) { + int pb; + int clz; + FIXP_DBL maxVal = FL2FXCONST_DBL(-1.0f); + + if (maxVal == FL2FXCONST_DBL(-1.0f)) { +#ifdef FUNCTION_DuckerCalcEnergy_func2 + maxVal = DuckerCalcEnergy_func2(inputReal, inputImag, startHybBand, + maxHybBand, maxHybridBand); +#else + FIXP_DBL localMaxVal = FL2FXCONST_DBL(0.0f); + for (qs = startHybBand; qs <= maxHybBand; qs++) { + localMaxVal |= fAbs(inputReal[qs]); + localMaxVal |= fAbs(inputImag[qs]); + } + for (; qs <= maxHybridBand; qs++) { + localMaxVal |= fAbs(inputReal[qs]); + } + maxVal = localMaxVal; +#endif + } + + clz = fixMax(0, CntLeadingZeros(maxVal) - DUCKER_HEADROOM_BITS); + clz = fixMin(clz, DUCKER_MAX_NRG_SCALE); + *nrgScale = (SCHAR)clz << 1; + + /* Initialize pb since it would stay uninitialized for the case startHybBand + * > maxHybBand. */ + pb = SpatialDecGetProcessingBand(maxHybBand, self->mapHybBands2ProcBands); + for (qs = startHybBand; qs <= maxHybBand; qs++) { + pb = SpatialDecGetProcessingBand(qs, self->mapHybBands2ProcBands); + energy[pb] = + fAddSaturate(energy[pb], fPow2Div2(inputReal[qs] << clz) + + fPow2Div2(inputImag[qs] << clz)); + } + pb++; + + for (; pb <= SpatialDecGetProcessingBand(maxHybridBand, + self->mapHybBands2ProcBands); + pb++) { + FDK_ASSERT(pb != SpatialDecGetProcessingBand( + qs - 1, self->mapHybBands2ProcBands)); + int qs_next; + FIXP_DBL nrg = 0; + qs_next = (int)self->qs_next[pb]; + for (; qs < qs_next; qs++) { + nrg = fAddSaturate(nrg, fPow2Div2(inputReal[qs] << clz)); + } + energy[pb] = nrg; + } + } else { + int clz; + FIXP_DBL maxVal = FL2FXCONST_DBL(-1.0f); + + maxVal = inputMaxVal; + + if (maxVal == FL2FXCONST_DBL(-1.0f)) { +#ifdef FUNCTION_DuckerCalcEnergy_func2 + maxVal = DuckerCalcEnergy_func2(inputReal, inputImag, startHybBand, + maxHybBand, maxHybridBand); +#else + FIXP_DBL localMaxVal = FL2FXCONST_DBL(0.0f); + for (qs = startHybBand; qs <= maxHybBand; qs++) { + localMaxVal |= fAbs(inputReal[qs]); + localMaxVal |= fAbs(inputImag[qs]); + } + for (; qs <= maxHybridBand; qs++) { + localMaxVal |= fAbs(inputReal[qs]); + } + maxVal = localMaxVal; +#endif + } + + clz = fixMax(0, CntLeadingZeros(maxVal) - DUCKER_HEADROOM_BITS); + clz = fixMin(clz, DUCKER_MAX_NRG_SCALE); + *nrgScale = (SCHAR)clz << 1; + +#ifdef FUNCTION_DuckerCalcEnergy_func4 + DuckerCalcEnergy_func4(inputReal, inputImag, energy, + self->mapHybBands2ProcBands, clz, startHybBand, + maxHybBand, maxHybridBand); +#else + for (qs = startHybBand; qs <= maxHybBand; qs++) { + int pb = SpatialDecGetProcessingBand(qs, self->mapHybBands2ProcBands); + energy[pb] = + fAddSaturate(energy[pb], fPow2Div2(inputReal[qs] << clz) + + fPow2Div2(inputImag[qs] << clz)); + } + + for (; qs <= maxHybridBand; qs++) { + int pb = SpatialDecGetProcessingBand(qs, self->mapHybBands2ProcBands); + energy[pb] = fAddSaturate(energy[pb], fPow2Div2(inputReal[qs] << clz)); + } +#endif /* FUNCTION_DuckerCalcEnergy_func4 */ + } + + { + /* Catch overflows which have been observed in erred bitstreams to avoid + * assertion failures later. */ + int pb; + for (pb = 0; pb < (28); pb++) { + energy[pb] = (FIXP_DBL)((LONG)energy[pb] & (LONG)MAXVAL_DBL); + } + } + return err; +} +#endif /* #ifndef FUNCTION_DuckerCalcEnergy */ + +LNK_SECTION_CODE_L1 +static INT DuckerApply(DUCKER_INSTANCE *const self, + FIXP_DBL const directNrg[(28)], + FIXP_DBL outputReal[(71)], FIXP_DBL outputImag[(71)], + int startHybBand) { + INT err = 0; + int qs = startHybBand; + int qs_next = 0; + int pb = 0; + int startParamBand = 0; + int hybBands; + int hybridBands = self->hybridBands; + + C_ALLOC_SCRATCH_START(reverbNrg, FIXP_DBL, (28)); + + FIXP_DBL *smoothDirRevNrg = &self->SmoothDirRevNrg[0]; + FIXP_DUCK_GAIN duckGain = 0; + + int doScaleNrg = 0; + int scaleDirectNrg = 0; + int scaleReverbNrg = 0; + int scaleSmoothDirRevNrg = 0; + FIXP_DBL maxDirRevNrg = FL2FXCONST_DBL(0.0); + + hybBands = hybridBands; + + startParamBand = + SpatialDecGetProcessingBand(startHybBand, self->mapHybBands2ProcBands); + + DuckerCalcEnergy(self, outputReal, outputImag, reverbNrg, + self->maxValReverbData, &(self->scaleReverbNrg), 0, + startHybBand); + + if ((self->scaleDirectNrg != self->scaleReverbNrg) || + (self->scaleDirectNrg != self->scaleSmoothDirRevNrg) || + (self->headroomSmoothDirRevNrg == 0)) { + int scale; + + scale = fixMin(self->scaleDirectNrg, self->scaleSmoothDirRevNrg + + self->headroomSmoothDirRevNrg - 1); + scale = fixMin(scale, self->scaleReverbNrg); + + scaleDirectNrg = fMax(fMin(self->scaleDirectNrg - scale, (DFRACT_BITS - 1)), + -(DFRACT_BITS - 1)); + scaleReverbNrg = fMax(fMin(self->scaleReverbNrg - scale, (DFRACT_BITS - 1)), + -(DFRACT_BITS - 1)); + scaleSmoothDirRevNrg = + fMax(fMin(self->scaleSmoothDirRevNrg - scale, (DFRACT_BITS - 1)), + -(DFRACT_BITS - 1)); + + self->scaleSmoothDirRevNrg = (SCHAR)scale; + + doScaleNrg = 1; + } + for (pb = startParamBand; pb < self->parameterBands; pb++) { + FIXP_DBL tmp1; + FIXP_DBL tmp2; + INT s; + + /* smoothDirRevNrg[2*pb ] = fMult(smoothDirRevNrg[2*pb ],DUCK_ALPHA_FDK) + + fMultDiv2(directNrg[pb],DUCK_ONE_MINUS_ALPHA_X4_FDK); + smoothDirRevNrg[2*pb+1] = fMult(smoothDirRevNrg[2*pb+1],DUCK_ALPHA_FDK) + + fMultDiv2(reverbNrg[pb],DUCK_ONE_MINUS_ALPHA_X4_FDK); tmp1 = + fMult(smoothDirRevNrg[2*pb],DUCK_GAMMA_FDK); tmp2 = + smoothDirRevNrg[2*pb+1] >> 1; + */ + tmp1 = smoothDirRevNrg[2 * pb + 0]; + tmp2 = smoothDirRevNrg[2 * pb + 1]; + tmp1 = fMult(tmp1, DUCK_ALPHA_FDK); + tmp2 = fMult(tmp2, DUCK_ALPHA_FDK); + + if (doScaleNrg) { + int scaleSmoothDirRevNrg_asExponent = -scaleSmoothDirRevNrg; + + tmp1 = scaleValue(tmp1, scaleSmoothDirRevNrg_asExponent); + tmp2 = scaleValue(tmp2, scaleSmoothDirRevNrg_asExponent); + tmp1 = fMultAddDiv2(tmp1, scaleValue(directNrg[pb], -scaleDirectNrg), + DUCK_ONE_MINUS_ALPHA_X4_FDK); + tmp2 = fMultAddDiv2(tmp2, scaleValue(reverbNrg[pb], -scaleReverbNrg), + DUCK_ONE_MINUS_ALPHA_X4_FDK); + } else { + tmp1 = fMultAddDiv2(tmp1, directNrg[pb], DUCK_ONE_MINUS_ALPHA_X4_FDK); + tmp2 = fMultAddDiv2(tmp2, reverbNrg[pb], DUCK_ONE_MINUS_ALPHA_X4_FDK); + } + + smoothDirRevNrg[2 * pb] = tmp1; + smoothDirRevNrg[2 * pb + 1] = tmp2; + + maxDirRevNrg |= fAbs(tmp1); + maxDirRevNrg |= fAbs(tmp2); + + tmp1 = fMult(tmp1, DUCK_GAMMA_FDK); + tmp2 = tmp2 >> 1; + + qs_next = fMin((int)self->qs_next[pb], self->hybridBands); + + if (tmp2 > tmp1) { /* true for about 20% */ + /* gain smaller than 1.0 */ + tmp1 = sqrtFixp(tmp1); + tmp2 = invSqrtNorm2(tmp2, &s); + duckGain = FX_DBL2FX_DUCK_GAIN(fMultDiv2(tmp1, tmp2) << s); + } else { /* true for about 80 % */ + tmp2 = smoothDirRevNrg[2 * pb] >> 1; + tmp1 = fMult(smoothDirRevNrg[2 * pb + 1], DUCK_GAMMA_FDK); + if (tmp2 > tmp1) { /* true for about 20% */ + if (tmp1 <= (tmp2 >> 2)) { + /* limit gain to 2.0 */ + if (qs < hybBands) { + for (; qs < qs_next; qs++) { + outputReal[qs] = outputReal[qs] << 1; + outputImag[qs] = outputImag[qs] << 1; + } + } else { + for (; qs < qs_next; qs++) { + outputReal[qs] = outputReal[qs] << 1; + } + } + /* skip general gain*output section */ + continue; + } else { + /* gain from 1.0 to 2.0 */ + tmp2 = sqrtFixp(tmp2 >> 2); + tmp1 = invSqrtNorm2(tmp1, &s); + duckGain = FX_DBL2FX_DUCK_GAIN(fMult(tmp1, tmp2) << s); + } + } else { /* true for about 60% */ + /* gain = 1.0; output does not change; update qs index */ + qs = qs_next; + continue; + } + } + +#ifdef FUNCTION_DuckerApply_func1 + qs = DuckerApply_func1(qs, hybBands, qs_next, outputReal, outputImag, + duckGain); +#else + /* general gain*output section */ + if (qs < hybBands) { /* true for about 39% */ + for (; qs < qs_next; qs++) { /* runs about 2 times */ + outputReal[qs] = fMultDiv2(outputReal[qs], duckGain) << 2; + outputImag[qs] = fMultDiv2(outputImag[qs], duckGain) << 2; + } + } else { + for (; qs < qs_next; qs++) { + outputReal[qs] = fMultDiv2(outputReal[qs], duckGain) << 2; + } + } +#endif + } /* pb */ + + self->headroomSmoothDirRevNrg = + (SCHAR)fixMax(0, CntLeadingZeros(maxDirRevNrg) - 1); + + C_ALLOC_SCRATCH_END(reverbNrg, FIXP_DBL, (28)); + + return err; +} + +LNK_SECTION_CODE_L1 +static INT DuckerApplyPS(DUCKER_INSTANCE *const self, + FIXP_DBL const directNrg[(28)], + FIXP_DBL outputReal[(71)], FIXP_DBL outputImag[(71)], + int startHybBand) { + int qs = startHybBand; + int pb = 0; + int startParamBand = + SpatialDecGetProcessingBand(startHybBand, self->mapHybBands2ProcBands); + int hybBands; + + int doScaleNrg = 0; + int scaleDirectNrg = 0; + int scaleSmoothDirRevNrg = 0; + FIXP_DBL maxDirRevNrg = FL2FXCONST_DBL(0.0); + + if ((self->scaleDirectNrg != self->scaleSmoothDirRevNrg) || + (self->headroomSmoothDirRevNrg == 0)) { + int scale; + + scale = fixMin(self->scaleDirectNrg, self->scaleSmoothDirRevNrg + + self->headroomSmoothDirRevNrg - 2); + + scaleDirectNrg = fMax(fMin(self->scaleDirectNrg - scale, (DFRACT_BITS - 1)), + -(DFRACT_BITS - 1)); + scaleSmoothDirRevNrg = + fMax(fMin(self->scaleSmoothDirRevNrg - scale, (DFRACT_BITS - 1)), + -(DFRACT_BITS - 1)); + + self->scaleSmoothDirRevNrg = (SCHAR)scale; + + doScaleNrg = 1; + } + + hybBands = self->hybridBands; + + FDK_ASSERT((self->parameterBands == (28)) || (self->parameterBands == (20))); + for (pb = startParamBand; pb < self->parameterBands; pb++) { + FIXP_DBL directNrg2 = directNrg[pb]; + + if (doScaleNrg) { + directNrg2 = scaleValue(directNrg2, -scaleDirectNrg); + self->peakDiff[pb] = + scaleValue(self->peakDiff[pb], -scaleSmoothDirRevNrg); + self->peakDecay[pb] = + scaleValue(self->peakDecay[pb], -scaleSmoothDirRevNrg); + self->SmoothDirRevNrg[pb] = + scaleValue(self->SmoothDirRevNrg[pb], -scaleSmoothDirRevNrg); + } + self->peakDecay[pb] = fixMax( + directNrg2, fMult(self->peakDecay[pb], PS_DUCK_PEAK_DECAY_FACTOR_FDK)); + self->peakDiff[pb] = + self->peakDiff[pb] + + fMult(PS_DUCK_FILTER_COEFF_FDK, + (self->peakDecay[pb] - directNrg2 - self->peakDiff[pb])); + self->SmoothDirRevNrg[pb] = + fixMax(self->SmoothDirRevNrg[pb] + + fMult(PS_DUCK_FILTER_COEFF_FDK, + (directNrg2 - self->SmoothDirRevNrg[pb])), + FL2FXCONST_DBL(0)); + + maxDirRevNrg |= fAbs(self->peakDiff[pb]); + maxDirRevNrg |= fAbs(self->SmoothDirRevNrg[pb]); + + if ((self->peakDiff[pb] == FL2FXCONST_DBL(0)) && + (self->SmoothDirRevNrg[pb] == FL2FXCONST_DBL(0))) { + int qs_next; + + qs = fMax(qs, SpatialDecGetQmfBand(pb, self->mapProcBands2HybBands)); + qs_next = fMin((int)self->qs_next[pb], self->hybridBands); + + FIXP_DBL *pOutputReal = &outputReal[qs]; + FIXP_DBL *pOutputImag = &outputImag[qs]; + + if (qs < hybBands) { + for (; qs < qs_next; qs++) { + *pOutputReal++ = FL2FXCONST_DBL(0); + *pOutputImag++ = FL2FXCONST_DBL(0); + } + } else { + for (; qs < qs_next; qs++) { + *pOutputReal++ = FL2FXCONST_DBL(0); + } + } + } else if (self->peakDiff[pb] != FL2FXCONST_DBL(0)) { + FIXP_DBL multiplication = + fMult(FL2FXCONST_DUCK(0.75f), self->peakDiff[pb]); + if (multiplication > (self->SmoothDirRevNrg[pb] >> 1)) { + FIXP_DBL num, denom, duckGain; + int scale, qs_next; + + /* implement x/y as (sqrt(x)*invSqrt(y))^2 */ + num = sqrtFixp(self->SmoothDirRevNrg[pb] >> 1); + denom = self->peakDiff[pb] + + FL2FXCONST_DBL(ABS_THR / (32768.0f * 32768.0f * 128.0f * 1.5f)); + denom = invSqrtNorm2(denom, &scale); + + /* duck output whether duckGain != 1.f */ + qs = fMax(qs, SpatialDecGetQmfBand(pb, self->mapProcBands2HybBands)); + qs_next = fMin((int)self->qs_next[pb], self->hybridBands); + + duckGain = fMult(num, denom); + duckGain = fPow2Div2(duckGain << scale); + duckGain = fMultDiv2(FL2FXCONST_DUCK(2.f / 3.f), duckGain) << 3; + + FIXP_DBL *pOutputReal = &outputReal[qs]; + FIXP_DBL *pOutputImag = &outputImag[qs]; + + if (qs < hybBands) { + for (; qs < qs_next; qs++) { + *pOutputReal = fMult(*pOutputReal, duckGain); + pOutputReal++; /* don't move in front of "=" above, because then the + fract class treats it differently and provides + wrong argument to fMult() (seen on win32/msvc8) */ + *pOutputImag = fMult(*pOutputImag, duckGain); + pOutputImag++; + } + } else { + for (; qs < qs_next; qs++) { + *pOutputReal = fMult(*pOutputReal, duckGain); + pOutputReal++; + } + } + } + } + } /* pb */ + + self->headroomSmoothDirRevNrg = + (SCHAR)fixMax(0, CntLeadingZeros(maxDirRevNrg) - 1); + + return 0; +} + +INT FDKdecorrelateOpen(HANDLE_DECORR_DEC hDecorrDec, FIXP_DBL *bufferCplx, + const INT bufLen) { + HANDLE_DECORR_DEC self = hDecorrDec; + + if (bufLen < (2 * ((825) + (373)))) return 1; + + /* assign all memory to stateBufferCplx. It is reassigned during + * FDKdecorrelateInit() */ + self->stateBufferCplx = bufferCplx; + self->L_stateBufferCplx = 0; + + self->delayBufferCplx = NULL; + self->L_delayBufferCplx = 0; + + return 0; +} + +static int distributeBuffer(HANDLE_DECORR_DEC self, const int L_stateBuf, + const int L_delayBuf) { + /* factor 2 because of complex values */ + if ((2 * ((825) + (373))) < 2 * (L_stateBuf + L_delayBuf)) { + return 1; + } + + self->L_stateBufferCplx = 2 * L_stateBuf; + self->delayBufferCplx = self->stateBufferCplx + 2 * L_stateBuf; + self->L_delayBufferCplx = 2 * L_delayBuf; + + return 0; +} +INT FDKdecorrelateInit(HANDLE_DECORR_DEC hDecorrDec, const INT nrHybBands, + const FDK_DECORR_TYPE decorrType, + const FDK_DUCKER_TYPE duckerType, const INT decorrConfig, + const INT seed, const INT partiallyComplex, + const INT useFractDelay, const INT isLegacyPS, + const INT initStatesFlag) { + INT errorCode = 0; + int i, rb, i_start; + int nParamBands = 28; + + INT offsetStateBuffer = 0; + INT offsetDelayBuffer = 0; + + const UCHAR *REV_bandOffset; + + const SCHAR *REV_filterOrder; + + hDecorrDec->partiallyComplex = partiallyComplex; + hDecorrDec->numbins = nrHybBands; + + switch (decorrType) { + case DECORR_PS: + /* ignore decorrConfig, seed */ + if (partiallyComplex) { + hDecorrDec->REV_bandOffset = REV_bandOffset_PS_LP; + hDecorrDec->REV_delay = REV_delay_PS_LP; + errorCode = distributeBuffer(hDecorrDec, (168), (533)); + } else { + hDecorrDec->REV_bandOffset = REV_bandOffset_PS_HQ; + hDecorrDec->REV_delay = REV_delay_PS_HQ; + errorCode = distributeBuffer(hDecorrDec, (360), (257)); + } + hDecorrDec->REV_filterOrder = REV_filterOrder_PS; + hDecorrDec->REV_filtType = REV_filtType_PS; + + /* Initialize ring buffer offsets for PS specific filter implementation. + */ + for (i = 0; i < (3); i++) + hDecorrDec->stateBufferOffset[i] = stateBufferOffsetInit[i]; + + break; + case DECORR_USAC: + if (partiallyComplex) return 1; + if (seed != 0) return 1; + hDecorrDec->REV_bandOffset = + REV_bandOffset_MPS_HQ[decorrConfig]; /* reverb band layout is + inherited from MPS standard */ + hDecorrDec->REV_filterOrder = REV_filterOrder_USAC; + hDecorrDec->REV_delay = REV_delay_USAC; + if (useFractDelay) { + return 1; /* not yet supported */ + } else { + hDecorrDec->REV_filtType = REV_filtType_MPS; /* the filter types are + inherited from MPS + standard */ + } + /* bsDecorrConfig == 1 is worst case */ + errorCode = distributeBuffer(hDecorrDec, (509), (643)); + break; + case DECORR_LD: + if (partiallyComplex) return 1; + if (useFractDelay) return 1; + if (decorrConfig > 2) return 1; + if (seed > (MAX_DECORR_SEED_LD - 1)) return 1; + if (!(nrHybBands == 64 || nrHybBands == 32)) + return 1; /* actually just qmf bands and no hybrid bands */ + hDecorrDec->REV_bandOffset = REV_bandOffset_LD[decorrConfig]; + hDecorrDec->REV_filterOrder = REV_filterOrder_MPS; /* the filter orders + are inherited from + MPS standard */ + hDecorrDec->REV_delay = + REV_delay_MPS; /* the delays in each reverb band are inherited from + MPS standard */ + hDecorrDec->REV_filtType = REV_filtType_LD; + errorCode = distributeBuffer(hDecorrDec, (825), (373)); + break; + default: + return 1; + } + + if (errorCode) { + return errorCode; + } + + if (initStatesFlag) { + FDKmemclear( + hDecorrDec->stateBufferCplx, + hDecorrDec->L_stateBufferCplx * sizeof(*hDecorrDec->stateBufferCplx)); + FDKmemclear( + hDecorrDec->delayBufferCplx, + hDecorrDec->L_delayBufferCplx * sizeof(*hDecorrDec->delayBufferCplx)); + FDKmemclear(hDecorrDec->reverbBandDelayBufferIndex, + sizeof(hDecorrDec->reverbBandDelayBufferIndex)); + } + + REV_bandOffset = hDecorrDec->REV_bandOffset; + + REV_filterOrder = hDecorrDec->REV_filterOrder; + + i_start = 0; + for (rb = 0; rb < (4); rb++) { + int i_stop; + + i_stop = REV_bandOffset[rb]; + + if (i_stop <= i_start) { + continue; + } + + for (i = i_start; i < i_stop; i++) { + switch (decorrType) { + case DECORR_PS: + errorCode = DecorrFilterInitPS( + &hDecorrDec->Filter[i], hDecorrDec->stateBufferCplx, + hDecorrDec->delayBufferCplx, &offsetStateBuffer, + &offsetDelayBuffer, i, rb, hDecorrDec->REV_delay[rb]); + break; + default: + errorCode = DecorrFilterInit( + &hDecorrDec->Filter[i], hDecorrDec->stateBufferCplx, + hDecorrDec->delayBufferCplx, &offsetStateBuffer, + &offsetDelayBuffer, seed, rb, useFractDelay, + hDecorrDec->REV_delay[rb], REV_filterOrder[rb], decorrType); + break; + } + } + + i_start = i_stop; + } /* loop over reverbBands */ + + if (!(offsetStateBuffer <= hDecorrDec->L_stateBufferCplx) || + !(offsetDelayBuffer <= hDecorrDec->L_delayBufferCplx)) { + return errorCode = 1; + } + + if (duckerType == DUCKER_AUTOMATIC) { + /* Choose correct ducker type according to standards: */ + switch (decorrType) { + case DECORR_PS: + hDecorrDec->ducker.duckerType = DUCKER_PS; + if (isLegacyPS) { + nParamBands = (20); + } else { + nParamBands = (28); + } + break; + case DECORR_USAC: + hDecorrDec->ducker.duckerType = DUCKER_MPS; + nParamBands = (28); + break; + case DECORR_LD: + hDecorrDec->ducker.duckerType = DUCKER_MPS; + nParamBands = (23); + break; + default: + return 1; + } + } + + errorCode = DuckerInit( + &hDecorrDec->ducker, hDecorrDec->numbins, hDecorrDec->partiallyComplex, + hDecorrDec->ducker.duckerType, nParamBands, initStatesFlag); + + return errorCode; +} + +INT FDKdecorrelateClose(HANDLE_DECORR_DEC hDecorrDec) { + INT err = 0; + + if (hDecorrDec == NULL) { + return 1; + } + + hDecorrDec->stateBufferCplx = NULL; + hDecorrDec->L_stateBufferCplx = 0; + hDecorrDec->delayBufferCplx = NULL; + hDecorrDec->L_delayBufferCplx = 0; + + return err; +} + +LNK_SECTION_CODE_L1 +INT FDKdecorrelateApply(HANDLE_DECORR_DEC hDecorrDec, FIXP_DBL *dataRealIn, + FIXP_DBL *dataImagIn, FIXP_DBL *dataRealOut, + FIXP_DBL *dataImagOut, const INT startHybBand) { + HANDLE_DECORR_DEC self = hDecorrDec; + INT err = 0; + INT rb, stop, start; + + if (self != NULL) { + int nHybBands = 0; + /* copy new samples */ + nHybBands = self->numbins; + + FIXP_DBL directNrg[(28)]; + + DuckerCalcEnergy( + &self->ducker, dataRealIn, dataImagIn, directNrg, + self->ducker.maxValDirectData, &(self->ducker.scaleDirectNrg), + (self->ducker.duckerType == DUCKER_PS) ? 1 : 0, startHybBand); + + /* complex-valued hybrid bands */ + for (stop = 0, rb = 0; rb < (4); rb++) { + start = fMax(stop, startHybBand); + stop = fMin(self->REV_bandOffset[rb], (UCHAR)nHybBands); + + if (start < stop) { + switch (hDecorrDec->REV_filtType[rb]) { + case DELAY: + err = DecorrFilterApplyPASS(&self->Filter[0], dataRealIn, + dataImagIn, dataRealOut, dataImagOut, + start, stop, self->REV_delay[rb], + self->reverbBandDelayBufferIndex[rb]); + break; + case INDEP_CPLX_PS: + err = DecorrFilterApplyCPLX_PS( + &self->Filter[0], dataRealIn, dataImagIn, dataRealOut, + dataImagOut, start, stop, self->REV_filterOrder[rb], + self->REV_delay[rb], self->reverbBandDelayBufferIndex[rb], + self->stateBufferOffset); + break; + case COMMON_REAL: + err = DecorrFilterApplyREAL( + &self->Filter[0], dataRealIn, dataImagIn, dataRealOut, + dataImagOut, start, stop, self->REV_filterOrder[rb], + self->REV_delay[rb], self->reverbBandDelayBufferIndex[rb]); + break; + default: + err = 1; + break; + } + if (err != 0) { + goto bail; + } + } /* if start < stop */ + } /* loop over reverb bands */ + + for (rb = 0; rb < (4); rb++) { + self->reverbBandDelayBufferIndex[rb] += 2; + if (self->reverbBandDelayBufferIndex[rb] >= 2 * self->REV_delay[rb]) + self->reverbBandDelayBufferIndex[rb] = 0; + } + + switch (self->ducker.duckerType) { + case DUCKER_PS: + err = DuckerApplyPS(&self->ducker, directNrg, dataRealOut, dataImagOut, + startHybBand); + if (err != 0) goto bail; + break; + default: + err = DuckerApply(&self->ducker, directNrg, dataRealOut, dataImagOut, + startHybBand); + if (err != 0) goto bail; + break; + } + } + +bail: + return err; +} diff --git a/fdk-aac/libFDK/src/FDK_hybrid.cpp b/fdk-aac/libFDK/src/FDK_hybrid.cpp new file mode 100644 index 0000000..b661f82 --- /dev/null +++ b/fdk-aac/libFDK/src/FDK_hybrid.cpp @@ -0,0 +1,813 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Markus Lohwasser + + Description: FDK Tools Hybrid Filterbank + +*******************************************************************************/ + +#include "FDK_hybrid.h" + +#include "fft.h" + +/*--------------- defines -----------------------------*/ +#define FFT_IDX_R(a) (2 * a) +#define FFT_IDX_I(a) (2 * a + 1) + +#define HYB_COEF8_0 (0.00746082949812f) +#define HYB_COEF8_1 (0.02270420949825f) +#define HYB_COEF8_2 (0.04546865930473f) +#define HYB_COEF8_3 (0.07266113929591f) +#define HYB_COEF8_4 (0.09885108575264f) +#define HYB_COEF8_5 (0.11793710567217f) +#define HYB_COEF8_6 (0.12500000000000f) +#define HYB_COEF8_7 (HYB_COEF8_5) +#define HYB_COEF8_8 (HYB_COEF8_4) +#define HYB_COEF8_9 (HYB_COEF8_3) +#define HYB_COEF8_10 (HYB_COEF8_2) +#define HYB_COEF8_11 (HYB_COEF8_1) +#define HYB_COEF8_12 (HYB_COEF8_0) + +/*--------------- structure definitions ---------------*/ + +#if defined(ARCH_PREFER_MULT_32x16) +#define FIXP_HTB FIXP_SGL /* SGL data type. */ +#define FIXP_HTP FIXP_SPK /* Packed SGL data type. */ +#define HTC(a) (FX_DBL2FXCONST_SGL(a)) /* Cast to SGL */ +#define FL2FXCONST_HTB FL2FXCONST_SGL +#else +#define FIXP_HTB FIXP_DBL /* SGL data type. */ +#define FIXP_HTP FIXP_DPK /* Packed DBL data type. */ +#define HTC(a) ((FIXP_DBL)(LONG)(a)) /* Cast to DBL */ +#define FL2FXCONST_HTB FL2FXCONST_DBL +#endif + +#define HTCP(real, imag) \ + { \ + { HTC(real), HTC(imag) } \ + } /* How to arrange the packed values. */ + +struct FDK_HYBRID_SETUP { + UCHAR nrQmfBands; /*!< Number of QMF bands to be converted to hybrid. */ + UCHAR nHybBands[3]; /*!< Number of Hybrid bands generated by nrQmfBands. */ + SCHAR kHybrid[3]; /*!< Filter configuration of each QMF band. */ + UCHAR protoLen; /*!< Prototype filter length. */ + UCHAR filterDelay; /*!< Delay caused by hybrid filter. */ + const INT + *pReadIdxTable; /*!< Helper table to access input data ringbuffer. */ +}; + +/*--------------- constants ---------------------------*/ +static const INT ringbuffIdxTab[2 * 13] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 0, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12}; + +static const FDK_HYBRID_SETUP setup_3_16 = {3, {8, 4, 4}, {8, 4, 4}, + 13, (13 - 1) / 2, ringbuffIdxTab}; +static const FDK_HYBRID_SETUP setup_3_12 = {3, {8, 2, 2}, {8, 2, 2}, + 13, (13 - 1) / 2, ringbuffIdxTab}; +static const FDK_HYBRID_SETUP setup_3_10 = {3, {6, 2, 2}, {-8, -2, 2}, + 13, (13 - 1) / 2, ringbuffIdxTab}; + +static const FIXP_HTP HybFilterCoef8[] = { + HTCP(0x10000000, 0x00000000), HTCP(0x0df26407, 0xfa391882), + HTCP(0xff532109, 0x00acdef7), HTCP(0x08f26d36, 0xf70d92ca), + HTCP(0xfee34b5f, 0x02af570f), HTCP(0x038f276e, 0xf7684793), + HTCP(0x00000000, 0x05d1eac2), HTCP(0x00000000, 0x05d1eac2), + HTCP(0x038f276e, 0x0897b86d), HTCP(0xfee34b5f, 0xfd50a8f1), + HTCP(0x08f26d36, 0x08f26d36), HTCP(0xff532109, 0xff532109), + HTCP(0x0df26407, 0x05c6e77e)}; + +static const FIXP_HTB HybFilterCoef2[3] = {FL2FXCONST_HTB(0.01899487526049f), + FL2FXCONST_HTB(-0.07293139167538f), + FL2FXCONST_HTB(0.30596630545168f)}; + +static const FIXP_HTB HybFilterCoef4[13] = {FL2FXCONST_HTB(-0.00305151927305f), + FL2FXCONST_HTB(-0.00794862316203f), + FL2FXCONST_HTB(0.0f), + FL2FXCONST_HTB(0.04318924038756f), + FL2FXCONST_HTB(0.12542448210445f), + FL2FXCONST_HTB(0.21227807049160f), + FL2FXCONST_HTB(0.25f), + FL2FXCONST_HTB(0.21227807049160f), + FL2FXCONST_HTB(0.12542448210445f), + FL2FXCONST_HTB(0.04318924038756f), + FL2FXCONST_HTB(0.0f), + FL2FXCONST_HTB(-0.00794862316203f), + FL2FXCONST_HTB(-0.00305151927305f)}; + +/*--------------- function declarations ---------------*/ +static INT kChannelFiltering(const FIXP_DBL *const pQmfReal, + const FIXP_DBL *const pQmfImag, + const INT *const pReadIdx, + FIXP_DBL *const mHybridReal, + FIXP_DBL *const mHybridImag, + const SCHAR hybridConfig); + +/*--------------- function definitions ----------------*/ + +INT FDKhybridAnalysisOpen(HANDLE_FDK_ANA_HYB_FILTER hAnalysisHybFilter, + FIXP_DBL *const pLFmemory, const UINT LFmemorySize, + FIXP_DBL *const pHFmemory, const UINT HFmemorySize) { + INT err = 0; + + /* Save pointer to extern memory. */ + hAnalysisHybFilter->pLFmemory = pLFmemory; + hAnalysisHybFilter->LFmemorySize = LFmemorySize; + + hAnalysisHybFilter->pHFmemory = pHFmemory; + hAnalysisHybFilter->HFmemorySize = HFmemorySize; + + return err; +} + +INT FDKhybridAnalysisInit(HANDLE_FDK_ANA_HYB_FILTER hAnalysisHybFilter, + const FDK_HYBRID_MODE mode, const INT qmfBands, + const INT cplxBands, const INT initStatesFlag) { + int k; + INT err = 0; + FIXP_DBL *pMem = NULL; + HANDLE_FDK_HYBRID_SETUP setup = NULL; + + switch (mode) { + case THREE_TO_TEN: + setup = &setup_3_10; + break; + case THREE_TO_TWELVE: + setup = &setup_3_12; + break; + case THREE_TO_SIXTEEN: + setup = &setup_3_16; + break; + default: + err = -1; + goto bail; + } + + /* Initialize handle. */ + hAnalysisHybFilter->pSetup = setup; + if (initStatesFlag) { + hAnalysisHybFilter->bufferLFpos = setup->protoLen - 1; + hAnalysisHybFilter->bufferHFpos = 0; + } + hAnalysisHybFilter->nrBands = qmfBands; + hAnalysisHybFilter->cplxBands = cplxBands; + hAnalysisHybFilter->hfMode = 0; + + /* Check available memory. */ + if (((2 * setup->nrQmfBands * setup->protoLen * sizeof(FIXP_DBL)) > + hAnalysisHybFilter->LFmemorySize)) { + err = -2; + goto bail; + } + if (hAnalysisHybFilter->HFmemorySize != 0) { + if (((setup->filterDelay * + ((qmfBands - setup->nrQmfBands) + (cplxBands - setup->nrQmfBands)) * + sizeof(FIXP_DBL)) > hAnalysisHybFilter->HFmemorySize)) { + err = -3; + goto bail; + } + } + + /* Distribute LF memory. */ + pMem = hAnalysisHybFilter->pLFmemory; + for (k = 0; k < setup->nrQmfBands; k++) { + hAnalysisHybFilter->bufferLFReal[k] = pMem; + pMem += setup->protoLen; + hAnalysisHybFilter->bufferLFImag[k] = pMem; + pMem += setup->protoLen; + } + + /* Distribute HF memory. */ + if (hAnalysisHybFilter->HFmemorySize != 0) { + pMem = hAnalysisHybFilter->pHFmemory; + for (k = 0; k < setup->filterDelay; k++) { + hAnalysisHybFilter->bufferHFReal[k] = pMem; + pMem += (qmfBands - setup->nrQmfBands); + hAnalysisHybFilter->bufferHFImag[k] = pMem; + pMem += (cplxBands - setup->nrQmfBands); + } + } + + if (initStatesFlag) { + /* Clear LF buffer */ + for (k = 0; k < setup->nrQmfBands; k++) { + FDKmemclear(hAnalysisHybFilter->bufferLFReal[k], + setup->protoLen * sizeof(FIXP_DBL)); + FDKmemclear(hAnalysisHybFilter->bufferLFImag[k], + setup->protoLen * sizeof(FIXP_DBL)); + } + + if (hAnalysisHybFilter->HFmemorySize != 0) { + if (qmfBands > setup->nrQmfBands) { + /* Clear HF buffer */ + for (k = 0; k < setup->filterDelay; k++) { + FDKmemclear(hAnalysisHybFilter->bufferHFReal[k], + (qmfBands - setup->nrQmfBands) * sizeof(FIXP_DBL)); + FDKmemclear(hAnalysisHybFilter->bufferHFImag[k], + (cplxBands - setup->nrQmfBands) * sizeof(FIXP_DBL)); + } + } + } + } + +bail: + return err; +} + +INT FDKhybridAnalysisScaleStates(HANDLE_FDK_ANA_HYB_FILTER hAnalysisHybFilter, + const INT scalingValue) { + INT err = 0; + + if (hAnalysisHybFilter == NULL) { + err = 1; /* invalid handle */ + } else { + int k; + HANDLE_FDK_HYBRID_SETUP setup = hAnalysisHybFilter->pSetup; + + /* Scale LF buffer */ + for (k = 0; k < setup->nrQmfBands; k++) { + scaleValues(hAnalysisHybFilter->bufferLFReal[k], setup->protoLen, + scalingValue); + scaleValues(hAnalysisHybFilter->bufferLFImag[k], setup->protoLen, + scalingValue); + } + if (hAnalysisHybFilter->nrBands > setup->nrQmfBands) { + /* Scale HF buffer */ + for (k = 0; k < setup->filterDelay; k++) { + scaleValues(hAnalysisHybFilter->bufferHFReal[k], + (hAnalysisHybFilter->nrBands - setup->nrQmfBands), + scalingValue); + scaleValues(hAnalysisHybFilter->bufferHFImag[k], + (hAnalysisHybFilter->cplxBands - setup->nrQmfBands), + scalingValue); + } + } + } + return err; +} + +INT FDKhybridAnalysisApply(HANDLE_FDK_ANA_HYB_FILTER hAnalysisHybFilter, + const FIXP_DBL *const pQmfReal, + const FIXP_DBL *const pQmfImag, + FIXP_DBL *const pHybridReal, + FIXP_DBL *const pHybridImag) { + int k, hybOffset = 0; + INT err = 0; + const int nrQmfBandsLF = + hAnalysisHybFilter->pSetup + ->nrQmfBands; /* number of QMF bands to be converted to hybrid */ + + const int writIndex = hAnalysisHybFilter->bufferLFpos; + int readIndex = hAnalysisHybFilter->bufferLFpos; + + if (++readIndex >= hAnalysisHybFilter->pSetup->protoLen) readIndex = 0; + const INT *pBufferLFreadIdx = + &hAnalysisHybFilter->pSetup->pReadIdxTable[readIndex]; + + /* + * LF buffer. + */ + for (k = 0; k < nrQmfBandsLF; k++) { + /* New input sample. */ + hAnalysisHybFilter->bufferLFReal[k][writIndex] = pQmfReal[k]; + hAnalysisHybFilter->bufferLFImag[k][writIndex] = pQmfImag[k]; + + /* Perform hybrid filtering. */ + err |= + kChannelFiltering(hAnalysisHybFilter->bufferLFReal[k], + hAnalysisHybFilter->bufferLFImag[k], pBufferLFreadIdx, + pHybridReal + hybOffset, pHybridImag + hybOffset, + hAnalysisHybFilter->pSetup->kHybrid[k]); + + hybOffset += hAnalysisHybFilter->pSetup->nHybBands[k]; + } + + hAnalysisHybFilter->bufferLFpos = + readIndex; /* Index where to write next input sample. */ + + if (hAnalysisHybFilter->nrBands > nrQmfBandsLF) { + /* + * HF buffer. + */ + if (hAnalysisHybFilter->hfMode != 0) { + /* HF delay compensation was applied outside. */ + FDKmemcpy( + pHybridReal + hybOffset, &pQmfReal[nrQmfBandsLF], + (hAnalysisHybFilter->nrBands - nrQmfBandsLF) * sizeof(FIXP_DBL)); + FDKmemcpy( + pHybridImag + hybOffset, &pQmfImag[nrQmfBandsLF], + (hAnalysisHybFilter->cplxBands - nrQmfBandsLF) * sizeof(FIXP_DBL)); + } else { + FDK_ASSERT(hAnalysisHybFilter->HFmemorySize != 0); + /* HF delay compensation, filterlength/2. */ + FDKmemcpy( + pHybridReal + hybOffset, + hAnalysisHybFilter->bufferHFReal[hAnalysisHybFilter->bufferHFpos], + (hAnalysisHybFilter->nrBands - nrQmfBandsLF) * sizeof(FIXP_DBL)); + FDKmemcpy( + pHybridImag + hybOffset, + hAnalysisHybFilter->bufferHFImag[hAnalysisHybFilter->bufferHFpos], + (hAnalysisHybFilter->cplxBands - nrQmfBandsLF) * sizeof(FIXP_DBL)); + + FDKmemcpy( + hAnalysisHybFilter->bufferHFReal[hAnalysisHybFilter->bufferHFpos], + &pQmfReal[nrQmfBandsLF], + (hAnalysisHybFilter->nrBands - nrQmfBandsLF) * sizeof(FIXP_DBL)); + FDKmemcpy( + hAnalysisHybFilter->bufferHFImag[hAnalysisHybFilter->bufferHFpos], + &pQmfImag[nrQmfBandsLF], + (hAnalysisHybFilter->cplxBands - nrQmfBandsLF) * sizeof(FIXP_DBL)); + + if (++hAnalysisHybFilter->bufferHFpos >= + hAnalysisHybFilter->pSetup->filterDelay) + hAnalysisHybFilter->bufferHFpos = 0; + } + } /* process HF part*/ + + return err; +} + +INT FDKhybridAnalysisClose(HANDLE_FDK_ANA_HYB_FILTER hAnalysisHybFilter) { + INT err = 0; + + if (hAnalysisHybFilter != NULL) { + hAnalysisHybFilter->pLFmemory = NULL; + hAnalysisHybFilter->pHFmemory = NULL; + hAnalysisHybFilter->LFmemorySize = 0; + hAnalysisHybFilter->HFmemorySize = 0; + } + + return err; +} + +INT FDKhybridSynthesisInit(HANDLE_FDK_SYN_HYB_FILTER hSynthesisHybFilter, + const FDK_HYBRID_MODE mode, const INT qmfBands, + const INT cplxBands) { + INT err = 0; + HANDLE_FDK_HYBRID_SETUP setup = NULL; + + switch (mode) { + case THREE_TO_TEN: + setup = &setup_3_10; + break; + case THREE_TO_TWELVE: + setup = &setup_3_12; + break; + case THREE_TO_SIXTEEN: + setup = &setup_3_16; + break; + default: + err = -1; + goto bail; + } + + hSynthesisHybFilter->pSetup = setup; + hSynthesisHybFilter->nrBands = qmfBands; + hSynthesisHybFilter->cplxBands = cplxBands; + +bail: + return err; +} + +void FDKhybridSynthesisApply(HANDLE_FDK_SYN_HYB_FILTER hSynthesisHybFilter, + const FIXP_DBL *const pHybridReal, + const FIXP_DBL *const pHybridImag, + FIXP_DBL *const pQmfReal, + FIXP_DBL *const pQmfImag) { + int k, n, hybOffset = 0; + const INT nrQmfBandsLF = hSynthesisHybFilter->pSetup->nrQmfBands; + + /* + * LF buffer. + */ + for (k = 0; k < nrQmfBandsLF; k++) { + const int nHybBands = hSynthesisHybFilter->pSetup->nHybBands[k]; + + FIXP_DBL accu1 = FL2FXCONST_DBL(0.f); + FIXP_DBL accu2 = FL2FXCONST_DBL(0.f); + + /* Perform hybrid filtering. */ + for (n = 0; n < nHybBands; n++) { + accu1 += pHybridReal[hybOffset + n]; + accu2 += pHybridImag[hybOffset + n]; + } + pQmfReal[k] = accu1; + pQmfImag[k] = accu2; + + hybOffset += nHybBands; + } + + if (hSynthesisHybFilter->nrBands > nrQmfBandsLF) { + /* + * HF buffer. + */ + FDKmemcpy(&pQmfReal[nrQmfBandsLF], &pHybridReal[hybOffset], + (hSynthesisHybFilter->nrBands - nrQmfBandsLF) * sizeof(FIXP_DBL)); + FDKmemcpy( + &pQmfImag[nrQmfBandsLF], &pHybridImag[hybOffset], + (hSynthesisHybFilter->cplxBands - nrQmfBandsLF) * sizeof(FIXP_DBL)); + } + + return; +} + +static void dualChannelFiltering(const FIXP_DBL *const pQmfReal, + const FIXP_DBL *const pQmfImag, + const INT *const pReadIdx, + FIXP_DBL *const mHybridReal, + FIXP_DBL *const mHybridImag, + const INT invert) { + FIXP_DBL r1, r6; + FIXP_DBL i1, i6; + + const FIXP_HTB f0 = HybFilterCoef2[0]; /* corresponds to p1 and p11 */ + const FIXP_HTB f1 = HybFilterCoef2[1]; /* corresponds to p3 and p9 */ + const FIXP_HTB f2 = HybFilterCoef2[2]; /* corresponds to p5 and p7 */ + + /* symmetric filter coefficients */ + r1 = fMultDiv2(f0, pQmfReal[pReadIdx[1]]) + + fMultDiv2(f0, pQmfReal[pReadIdx[11]]); + i1 = fMultDiv2(f0, pQmfImag[pReadIdx[1]]) + + fMultDiv2(f0, pQmfImag[pReadIdx[11]]); + r1 += fMultDiv2(f1, pQmfReal[pReadIdx[3]]) + + fMultDiv2(f1, pQmfReal[pReadIdx[9]]); + i1 += fMultDiv2(f1, pQmfImag[pReadIdx[3]]) + + fMultDiv2(f1, pQmfImag[pReadIdx[9]]); + r1 += fMultDiv2(f2, pQmfReal[pReadIdx[5]]) + + fMultDiv2(f2, pQmfReal[pReadIdx[7]]); + i1 += fMultDiv2(f2, pQmfImag[pReadIdx[5]]) + + fMultDiv2(f2, pQmfImag[pReadIdx[7]]); + + r6 = pQmfReal[pReadIdx[6]] >> 2; + i6 = pQmfImag[pReadIdx[6]] >> 2; + + FDK_ASSERT((invert == 0) || (invert == 1)); + mHybridReal[0 + invert] = (r6 + r1) << 1; + mHybridImag[0 + invert] = (i6 + i1) << 1; + + mHybridReal[1 - invert] = (r6 - r1) << 1; + mHybridImag[1 - invert] = (i6 - i1) << 1; +} + +static void fourChannelFiltering(const FIXP_DBL *const pQmfReal, + const FIXP_DBL *const pQmfImag, + const INT *const pReadIdx, + FIXP_DBL *const mHybridReal, + FIXP_DBL *const mHybridImag, + const INT invert) { + const FIXP_HTB *p = HybFilterCoef4; + + FIXP_DBL fft[8]; + + static const FIXP_DBL cr[13] = { + FL2FXCONST_DBL(0.f), FL2FXCONST_DBL(-0.70710678118655f), + FL2FXCONST_DBL(-1.f), FL2FXCONST_DBL(-0.70710678118655f), + FL2FXCONST_DBL(0.f), FL2FXCONST_DBL(0.70710678118655f), + FL2FXCONST_DBL(1.f), FL2FXCONST_DBL(0.70710678118655f), + FL2FXCONST_DBL(0.f), FL2FXCONST_DBL(-0.70710678118655f), + FL2FXCONST_DBL(-1.f), FL2FXCONST_DBL(-0.70710678118655f), + FL2FXCONST_DBL(0.f)}; + static const FIXP_DBL ci[13] = { + FL2FXCONST_DBL(-1.f), FL2FXCONST_DBL(-0.70710678118655f), + FL2FXCONST_DBL(0.f), FL2FXCONST_DBL(0.70710678118655f), + FL2FXCONST_DBL(1.f), FL2FXCONST_DBL(0.70710678118655f), + FL2FXCONST_DBL(0.f), FL2FXCONST_DBL(-0.70710678118655f), + FL2FXCONST_DBL(-1.f), FL2FXCONST_DBL(-0.70710678118655f), + FL2FXCONST_DBL(0.f), FL2FXCONST_DBL(0.70710678118655f), + FL2FXCONST_DBL(1.f)}; + + /* FIR filter. */ + /* pre twiddeling with pre-twiddling coefficients c[n] */ + /* multiplication with filter coefficients p[n] */ + /* hint: (a + ib)*(c + id) = (a*c - b*d) + i(a*d + b*c) */ + /* write to fft coefficient n' */ + fft[FFT_IDX_R(0)] = + (fMult(p[10], (fMultSub(fMultDiv2(cr[2], pQmfReal[pReadIdx[2]]), ci[2], + pQmfImag[pReadIdx[2]]))) + + fMult(p[6], (fMultSub(fMultDiv2(cr[6], pQmfReal[pReadIdx[6]]), ci[6], + pQmfImag[pReadIdx[6]]))) + + fMult(p[2], (fMultSub(fMultDiv2(cr[10], pQmfReal[pReadIdx[10]]), ci[10], + pQmfImag[pReadIdx[10]])))); + fft[FFT_IDX_I(0)] = + (fMult(p[10], (fMultAdd(fMultDiv2(ci[2], pQmfReal[pReadIdx[2]]), cr[2], + pQmfImag[pReadIdx[2]]))) + + fMult(p[6], (fMultAdd(fMultDiv2(ci[6], pQmfReal[pReadIdx[6]]), cr[6], + pQmfImag[pReadIdx[6]]))) + + fMult(p[2], (fMultAdd(fMultDiv2(ci[10], pQmfReal[pReadIdx[10]]), cr[10], + pQmfImag[pReadIdx[10]])))); + + /* twiddle dee dum */ + fft[FFT_IDX_R(1)] = + (fMult(p[9], (fMultSub(fMultDiv2(cr[3], pQmfReal[pReadIdx[3]]), ci[3], + pQmfImag[pReadIdx[3]]))) + + fMult(p[5], (fMultSub(fMultDiv2(cr[7], pQmfReal[pReadIdx[7]]), ci[7], + pQmfImag[pReadIdx[7]]))) + + fMult(p[1], (fMultSub(fMultDiv2(cr[11], pQmfReal[pReadIdx[11]]), ci[11], + pQmfImag[pReadIdx[11]])))); + fft[FFT_IDX_I(1)] = + (fMult(p[9], (fMultAdd(fMultDiv2(ci[3], pQmfReal[pReadIdx[3]]), cr[3], + pQmfImag[pReadIdx[3]]))) + + fMult(p[5], (fMultAdd(fMultDiv2(ci[7], pQmfReal[pReadIdx[7]]), cr[7], + pQmfImag[pReadIdx[7]]))) + + fMult(p[1], (fMultAdd(fMultDiv2(ci[11], pQmfReal[pReadIdx[11]]), cr[11], + pQmfImag[pReadIdx[11]])))); + + /* twiddle dee dee */ + fft[FFT_IDX_R(2)] = + (fMult(p[12], (fMultSub(fMultDiv2(cr[0], pQmfReal[pReadIdx[0]]), ci[0], + pQmfImag[pReadIdx[0]]))) + + fMult(p[8], (fMultSub(fMultDiv2(cr[4], pQmfReal[pReadIdx[4]]), ci[4], + pQmfImag[pReadIdx[4]]))) + + fMult(p[4], (fMultSub(fMultDiv2(cr[8], pQmfReal[pReadIdx[8]]), ci[8], + pQmfImag[pReadIdx[8]]))) + + fMult(p[0], (fMultSub(fMultDiv2(cr[12], pQmfReal[pReadIdx[12]]), ci[12], + pQmfImag[pReadIdx[12]])))); + fft[FFT_IDX_I(2)] = + (fMult(p[12], (fMultAdd(fMultDiv2(ci[0], pQmfReal[pReadIdx[0]]), cr[0], + pQmfImag[pReadIdx[0]]))) + + fMult(p[8], (fMultAdd(fMultDiv2(ci[4], pQmfReal[pReadIdx[4]]), cr[4], + pQmfImag[pReadIdx[4]]))) + + fMult(p[4], (fMultAdd(fMultDiv2(ci[8], pQmfReal[pReadIdx[8]]), cr[8], + pQmfImag[pReadIdx[8]]))) + + fMult(p[0], (fMultAdd(fMultDiv2(ci[12], pQmfReal[pReadIdx[12]]), cr[12], + pQmfImag[pReadIdx[12]])))); + + fft[FFT_IDX_R(3)] = + (fMult(p[11], (fMultSub(fMultDiv2(cr[1], pQmfReal[pReadIdx[1]]), ci[1], + pQmfImag[pReadIdx[1]]))) + + fMult(p[7], (fMultSub(fMultDiv2(cr[5], pQmfReal[pReadIdx[5]]), ci[5], + pQmfImag[pReadIdx[5]]))) + + fMult(p[3], (fMultSub(fMultDiv2(cr[9], pQmfReal[pReadIdx[9]]), ci[9], + pQmfImag[pReadIdx[9]])))); + fft[FFT_IDX_I(3)] = + (fMult(p[11], (fMultAdd(fMultDiv2(ci[1], pQmfReal[pReadIdx[1]]), cr[1], + pQmfImag[pReadIdx[1]]))) + + fMult(p[7], (fMultAdd(fMultDiv2(ci[5], pQmfReal[pReadIdx[5]]), cr[5], + pQmfImag[pReadIdx[5]]))) + + fMult(p[3], (fMultAdd(fMultDiv2(ci[9], pQmfReal[pReadIdx[9]]), cr[9], + pQmfImag[pReadIdx[9]])))); + + /* fft modulation */ + /* here: fast manual fft modulation for a fft of length M=4 */ + /* fft_4{x[n]} = x[0]*exp(-i*2*pi/4*m*0) + x[1]*exp(-i*2*pi/4*m*1) + + x[2]*exp(-i*2*pi/4*m*2) + x[3]*exp(-i*2*pi/4*m*3) */ + + /* + fft bin m=0: + X[0, n] = x[0] + x[1] + x[2] + x[3] + */ + mHybridReal[0] = fft[FFT_IDX_R(0)] + fft[FFT_IDX_R(1)] + fft[FFT_IDX_R(2)] + + fft[FFT_IDX_R(3)]; + mHybridImag[0] = fft[FFT_IDX_I(0)] + fft[FFT_IDX_I(1)] + fft[FFT_IDX_I(2)] + + fft[FFT_IDX_I(3)]; + + /* + fft bin m=1: + X[1, n] = x[0] - i*x[1] - x[2] + i*x[3] + */ + mHybridReal[1] = fft[FFT_IDX_R(0)] + fft[FFT_IDX_I(1)] - fft[FFT_IDX_R(2)] - + fft[FFT_IDX_I(3)]; + mHybridImag[1] = fft[FFT_IDX_I(0)] - fft[FFT_IDX_R(1)] - fft[FFT_IDX_I(2)] + + fft[FFT_IDX_R(3)]; + + /* + fft bin m=2: + X[2, n] = x[0] - x[1] + x[2] - x[3] + */ + mHybridReal[2] = fft[FFT_IDX_R(0)] - fft[FFT_IDX_R(1)] + fft[FFT_IDX_R(2)] - + fft[FFT_IDX_R(3)]; + mHybridImag[2] = fft[FFT_IDX_I(0)] - fft[FFT_IDX_I(1)] + fft[FFT_IDX_I(2)] - + fft[FFT_IDX_I(3)]; + + /* + fft bin m=3: + X[3, n] = x[0] + j*x[1] - x[2] - j*x[3] + */ + mHybridReal[3] = fft[FFT_IDX_R(0)] - fft[FFT_IDX_I(1)] - fft[FFT_IDX_R(2)] + + fft[FFT_IDX_I(3)]; + mHybridImag[3] = fft[FFT_IDX_I(0)] + fft[FFT_IDX_R(1)] - fft[FFT_IDX_I(2)] - + fft[FFT_IDX_R(3)]; +} + +static void eightChannelFiltering(const FIXP_DBL *const pQmfReal, + const FIXP_DBL *const pQmfImag, + const INT *const pReadIdx, + FIXP_DBL *const mHybridReal, + FIXP_DBL *const mHybridImag, + const INT invert) { + const FIXP_HTP *p = HybFilterCoef8; + INT k, sc; + + FIXP_DBL mfft[16 + ALIGNMENT_DEFAULT]; + FIXP_DBL *pfft = (FIXP_DBL *)ALIGN_PTR(mfft); + + FIXP_DBL accu1, accu2, accu3, accu4; + + /* pre twiddeling */ + pfft[FFT_IDX_R(0)] = + pQmfReal[pReadIdx[6]] >> + (3 + 1); /* fMultDiv2(p[0].v.re, pQmfReal[pReadIdx[6]]); */ + pfft[FFT_IDX_I(0)] = + pQmfImag[pReadIdx[6]] >> + (3 + 1); /* fMultDiv2(p[0].v.re, pQmfImag[pReadIdx[6]]); */ + + cplxMultDiv2(&accu1, &accu2, pQmfReal[pReadIdx[7]], pQmfImag[pReadIdx[7]], + p[1]); + pfft[FFT_IDX_R(1)] = accu1; + pfft[FFT_IDX_I(1)] = accu2; + + cplxMultDiv2(&accu1, &accu2, pQmfReal[pReadIdx[0]], pQmfImag[pReadIdx[0]], + p[2]); + cplxMultDiv2(&accu3, &accu4, pQmfReal[pReadIdx[8]], pQmfImag[pReadIdx[8]], + p[3]); + pfft[FFT_IDX_R(2)] = accu1 + accu3; + pfft[FFT_IDX_I(2)] = accu2 + accu4; + + cplxMultDiv2(&accu1, &accu2, pQmfReal[pReadIdx[1]], pQmfImag[pReadIdx[1]], + p[4]); + cplxMultDiv2(&accu3, &accu4, pQmfReal[pReadIdx[9]], pQmfImag[pReadIdx[9]], + p[5]); + pfft[FFT_IDX_R(3)] = accu1 + accu3; + pfft[FFT_IDX_I(3)] = accu2 + accu4; + + pfft[FFT_IDX_R(4)] = fMultDiv2(pQmfImag[pReadIdx[10]], p[7].v.im) - + fMultDiv2(pQmfImag[pReadIdx[2]], p[6].v.im); + pfft[FFT_IDX_I(4)] = fMultDiv2(pQmfReal[pReadIdx[2]], p[6].v.im) - + fMultDiv2(pQmfReal[pReadIdx[10]], p[7].v.im); + + cplxMultDiv2(&accu1, &accu2, pQmfReal[pReadIdx[3]], pQmfImag[pReadIdx[3]], + p[8]); + cplxMultDiv2(&accu3, &accu4, pQmfReal[pReadIdx[11]], pQmfImag[pReadIdx[11]], + p[9]); + pfft[FFT_IDX_R(5)] = accu1 + accu3; + pfft[FFT_IDX_I(5)] = accu2 + accu4; + + cplxMultDiv2(&accu1, &accu2, pQmfReal[pReadIdx[4]], pQmfImag[pReadIdx[4]], + p[10]); + cplxMultDiv2(&accu3, &accu4, pQmfReal[pReadIdx[12]], pQmfImag[pReadIdx[12]], + p[11]); + pfft[FFT_IDX_R(6)] = accu1 + accu3; + pfft[FFT_IDX_I(6)] = accu2 + accu4; + + cplxMultDiv2(&accu1, &accu2, pQmfReal[pReadIdx[5]], pQmfImag[pReadIdx[5]], + p[12]); + pfft[FFT_IDX_R(7)] = accu1; + pfft[FFT_IDX_I(7)] = accu2; + + /* fft modulation */ + fft_8(pfft); + sc = 1 + 2; + + if (invert) { + mHybridReal[0] = pfft[FFT_IDX_R(7)] << sc; + mHybridImag[0] = pfft[FFT_IDX_I(7)] << sc; + mHybridReal[1] = pfft[FFT_IDX_R(0)] << sc; + mHybridImag[1] = pfft[FFT_IDX_I(0)] << sc; + + mHybridReal[2] = pfft[FFT_IDX_R(6)] << sc; + mHybridImag[2] = pfft[FFT_IDX_I(6)] << sc; + mHybridReal[3] = pfft[FFT_IDX_R(1)] << sc; + mHybridImag[3] = pfft[FFT_IDX_I(1)] << sc; + + mHybridReal[4] = pfft[FFT_IDX_R(2)] << sc; + mHybridReal[4] += pfft[FFT_IDX_R(5)] << sc; + mHybridImag[4] = pfft[FFT_IDX_I(2)] << sc; + mHybridImag[4] += pfft[FFT_IDX_I(5)] << sc; + + mHybridReal[5] = pfft[FFT_IDX_R(3)] << sc; + mHybridReal[5] += pfft[FFT_IDX_R(4)] << sc; + mHybridImag[5] = pfft[FFT_IDX_I(3)] << sc; + mHybridImag[5] += pfft[FFT_IDX_I(4)] << sc; + } else { + for (k = 0; k < 8; k++) { + mHybridReal[k] = pfft[FFT_IDX_R(k)] << sc; + mHybridImag[k] = pfft[FFT_IDX_I(k)] << sc; + } + } +} + +static INT kChannelFiltering(const FIXP_DBL *const pQmfReal, + const FIXP_DBL *const pQmfImag, + const INT *const pReadIdx, + FIXP_DBL *const mHybridReal, + FIXP_DBL *const mHybridImag, + const SCHAR hybridConfig) { + INT err = 0; + + switch (hybridConfig) { + case 2: + case -2: + dualChannelFiltering(pQmfReal, pQmfImag, pReadIdx, mHybridReal, + mHybridImag, (hybridConfig < 0) ? 1 : 0); + break; + case 4: + case -4: + fourChannelFiltering(pQmfReal, pQmfImag, pReadIdx, mHybridReal, + mHybridImag, (hybridConfig < 0) ? 1 : 0); + break; + case 8: + case -8: + eightChannelFiltering(pQmfReal, pQmfImag, pReadIdx, mHybridReal, + mHybridImag, (hybridConfig < 0) ? 1 : 0); + break; + default: + err = -1; + } + + return err; +} diff --git a/fdk-aac/libFDK/src/FDK_lpc.cpp b/fdk-aac/libFDK/src/FDK_lpc.cpp new file mode 100644 index 0000000..7d7e691 --- /dev/null +++ b/fdk-aac/libFDK/src/FDK_lpc.cpp @@ -0,0 +1,487 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Manuel Jander + + Description: LPC related functions + +*******************************************************************************/ + +#include "FDK_lpc.h" + +/* Internal scaling of LPC synthesis to avoid overflow of filte states. + This depends on the LPC order, because the LPC order defines the amount + of MAC operations. */ +static SCHAR order_ld[LPC_MAX_ORDER] = { + /* Assume that Synthesis filter output does not clip and filter + accu does change no more than 1.0 for each iteration. + ceil(0.5*log((1:24))/log(2)) */ + 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3}; + +/* IIRLattice */ +#ifndef FUNCTION_CLpc_SynthesisLattice_SGL +void CLpc_SynthesisLattice(FIXP_DBL *signal, const int signal_size, + const int signal_e, const int signal_e_out, + const int inc, const FIXP_SGL *coeff, + const int order, FIXP_DBL *state) { + int i, j; + FIXP_DBL *pSignal; + int shift; + + FDK_ASSERT(order <= LPC_MAX_ORDER); + FDK_ASSERT(order > 0); + + if (inc == -1) + pSignal = &signal[signal_size - 1]; + else + pSignal = &signal[0]; + + /* + tmp = x(k) - K(M)*g(M); + for m=M-1:-1:1 + tmp = tmp - K(m) * g(m); + g(m+1) = g(m) + K(m) * tmp; + endfor + g(1) = tmp; + + y(k) = tmp; + */ + + shift = -order_ld[order - 1]; + + for (i = signal_size; i != 0; i--) { + FIXP_DBL *pState = state + order - 1; + const FIXP_SGL *pCoeff = coeff + order - 1; + FIXP_DBL tmp; + + tmp = scaleValue(*pSignal, shift + signal_e) - + fMultDiv2(*pCoeff--, *pState--); + for (j = order - 1; j != 0; j--) { + tmp = fMultSubDiv2(tmp, pCoeff[0], pState[0]); + pState[1] = pState[0] + (fMultDiv2(*pCoeff--, tmp) << 2); + pState--; + } + + *pSignal = scaleValueSaturate(tmp, -shift - signal_e_out); + + /* exponent of state[] is -1 */ + pState[1] = tmp << 1; + pSignal += inc; + } +} +#endif + +#ifndef FUNCTION_CLpc_SynthesisLattice_DBL +void CLpc_SynthesisLattice(FIXP_DBL *signal, const int signal_size, + const int signal_e, const int signal_e_out, + const int inc, const FIXP_DBL *coeff, + const int order, FIXP_DBL *state) { + int i, j; + FIXP_DBL *pSignal; + + FDK_ASSERT(order <= LPC_MAX_ORDER); + FDK_ASSERT(order > 0); + + if (inc == -1) + pSignal = &signal[signal_size - 1]; + else + pSignal = &signal[0]; + + FDK_ASSERT(signal_size > 0); + for (i = signal_size; i != 0; i--) { + FIXP_DBL *pState = state + order - 1; + const FIXP_DBL *pCoeff = coeff + order - 1; + FIXP_DBL tmp, accu; + + accu = + fMultSubDiv2(scaleValue(*pSignal, signal_e - 1), *pCoeff--, *pState--); + tmp = SATURATE_LEFT_SHIFT_ALT(accu, 1, DFRACT_BITS); + + for (j = order - 1; j != 0; j--) { + accu = fMultSubDiv2(tmp >> 1, pCoeff[0], pState[0]); + tmp = SATURATE_LEFT_SHIFT_ALT(accu, 1, DFRACT_BITS); + + accu = fMultAddDiv2(pState[0] >> 1, *pCoeff--, tmp); + pState[1] = SATURATE_LEFT_SHIFT_ALT(accu, 1, DFRACT_BITS); + + pState--; + } + + *pSignal = scaleValue(tmp, -signal_e_out); + + /* exponent of state[] is 0 */ + pState[1] = tmp; + pSignal += inc; + } +} + +#endif + +/* LPC_SYNTHESIS_IIR version */ +void CLpc_Synthesis(FIXP_DBL *signal, const int signal_size, const int signal_e, + const int inc, const FIXP_LPC_TNS *lpcCoeff_m, + const int lpcCoeff_e, const int order, FIXP_DBL *state, + int *pStateIndex) { + int i, j; + FIXP_DBL *pSignal; + int stateIndex = *pStateIndex; + + FIXP_LPC_TNS coeff[2 * LPC_MAX_ORDER]; + FDKmemcpy(&coeff[0], lpcCoeff_m, order * sizeof(FIXP_LPC_TNS)); + FDKmemcpy(&coeff[order], lpcCoeff_m, order * sizeof(FIXP_LPC_TNS)); + + FDK_ASSERT(order <= LPC_MAX_ORDER); + FDK_ASSERT(stateIndex < order); + + if (inc == -1) + pSignal = &signal[signal_size - 1]; + else + pSignal = &signal[0]; + + /* y(n) = x(n) - lpc[1]*y(n-1) - ... - lpc[order]*y(n-order) */ + + for (i = 0; i < signal_size; i++) { + FIXP_DBL x; + const FIXP_LPC_TNS *pCoeff = coeff + order - stateIndex; + + x = scaleValue(*pSignal, -(lpcCoeff_e + 1)); + for (j = 0; j < order; j++) { + x -= fMultDiv2(state[j], pCoeff[j]); + } + x = SATURATE_SHIFT(x, -lpcCoeff_e - 1, DFRACT_BITS); + + /* Update states */ + stateIndex = ((stateIndex - 1) < 0) ? (order - 1) : (stateIndex - 1); + state[stateIndex] = x; + + *pSignal = scaleValue(x, signal_e); + pSignal += inc; + } + + *pStateIndex = stateIndex; +} +/* default version */ +void CLpc_Synthesis(FIXP_DBL *signal, const int signal_size, const int signal_e, + const int inc, const FIXP_LPC *lpcCoeff_m, + const int lpcCoeff_e, const int order, FIXP_DBL *state, + int *pStateIndex) { + int i, j; + FIXP_DBL *pSignal; + int stateIndex = *pStateIndex; + + FIXP_LPC coeff[2 * LPC_MAX_ORDER]; + FDKmemcpy(&coeff[0], lpcCoeff_m, order * sizeof(FIXP_LPC)); + FDKmemcpy(&coeff[order], lpcCoeff_m, order * sizeof(FIXP_LPC)); + + FDK_ASSERT(order <= LPC_MAX_ORDER); + FDK_ASSERT(stateIndex < order); + + if (inc == -1) + pSignal = &signal[signal_size - 1]; + else + pSignal = &signal[0]; + + /* y(n) = x(n) - lpc[1]*y(n-1) - ... - lpc[order]*y(n-order) */ + + for (i = 0; i < signal_size; i++) { + FIXP_DBL x; + const FIXP_LPC *pCoeff = coeff + order - stateIndex; + + x = scaleValue(*pSignal, -(lpcCoeff_e + 1)); + for (j = 0; j < order; j++) { + x -= fMultDiv2(state[j], pCoeff[j]); + } + x = SATURATE_SHIFT(x, -lpcCoeff_e - 1, DFRACT_BITS); + + /* Update states */ + stateIndex = ((stateIndex - 1) < 0) ? (order - 1) : (stateIndex - 1); + state[stateIndex] = x; + + *pSignal = scaleValue(x, signal_e); + pSignal += inc; + } + + *pStateIndex = stateIndex; +} + +/* FIR */ +void CLpc_Analysis(FIXP_DBL *RESTRICT signal, const int signal_size, + const FIXP_LPC lpcCoeff_m[], const int lpcCoeff_e, + const int order, FIXP_DBL *RESTRICT filtState, + int *filtStateIndex) { + int stateIndex; + INT i, j, shift = lpcCoeff_e + 1; /* +1, because fMultDiv2 */ + FIXP_DBL tmp; + + if (order <= 0) { + return; + } + if (filtStateIndex != NULL) { + stateIndex = *filtStateIndex; + } else { + stateIndex = 0; + } + + /* keep filter coefficients twice and save memory copy operation in + modulo state buffer */ + FIXP_LPC coeff[2 * LPC_MAX_ORDER]; + FIXP_LPC *pCoeff; + FDKmemcpy(&coeff[0], lpcCoeff_m, order * sizeof(FIXP_LPC)); + FDKmemcpy(&coeff[order], lpcCoeff_m, order * sizeof(FIXP_LPC)); + + /* + # Analysis filter, obtain residual. + for k = 0:BL-1 + err(i-BL+k) = a * inputSignal(i-BL+k:-1:i-BL-M+k); + endfor + */ + + FDK_ASSERT(shift >= 0); + + for (j = 0; j < signal_size; j++) { + pCoeff = &coeff[(order - stateIndex)]; + + tmp = signal[j] >> shift; + for (i = 0; i < order; i++) { + tmp = fMultAddDiv2(tmp, pCoeff[i], filtState[i]); + } + + stateIndex = + ((stateIndex - 1) < 0) ? (stateIndex - 1 + order) : (stateIndex - 1); + filtState[stateIndex] = signal[j]; + + signal[j] = tmp << shift; + } + + if (filtStateIndex != NULL) { + *filtStateIndex = stateIndex; + } +} + +/* For the LPC_SYNTHESIS_IIR version */ +INT CLpc_ParcorToLpc(const FIXP_LPC_TNS reflCoeff[], FIXP_LPC_TNS LpcCoeff[], + INT numOfCoeff, FIXP_DBL workBuffer[]) { + INT i, j; + INT shiftval, + par2LpcShiftVal = 6; /* 6 should be enough, bec. max(numOfCoeff) = 20 */ + FIXP_DBL maxVal = (FIXP_DBL)0; + + workBuffer[0] = FX_LPC_TNS2FX_DBL(reflCoeff[0]) >> par2LpcShiftVal; + for (i = 1; i < numOfCoeff; i++) { + for (j = 0; j < i / 2; j++) { + FIXP_DBL tmp1, tmp2; + + tmp1 = workBuffer[j]; + tmp2 = workBuffer[i - 1 - j]; + workBuffer[j] += fMult(reflCoeff[i], tmp2); + workBuffer[i - 1 - j] += fMult(reflCoeff[i], tmp1); + } + if (i & 1) { + workBuffer[j] += fMult(reflCoeff[i], workBuffer[j]); + } + + workBuffer[i] = FX_LPC_TNS2FX_DBL(reflCoeff[i]) >> par2LpcShiftVal; + } + + /* calculate exponent */ + for (i = 0; i < numOfCoeff; i++) { + maxVal = fMax(maxVal, fAbs(workBuffer[i])); + } + + shiftval = fMin(fNorm(maxVal), par2LpcShiftVal); + + for (i = 0; i < numOfCoeff; i++) { + LpcCoeff[i] = FX_DBL2FX_LPC_TNS(workBuffer[i] << shiftval); + } + + return (par2LpcShiftVal - shiftval); +} +/* Default version */ +INT CLpc_ParcorToLpc(const FIXP_LPC reflCoeff[], FIXP_LPC LpcCoeff[], + INT numOfCoeff, FIXP_DBL workBuffer[]) { + INT i, j; + INT shiftval, + par2LpcShiftVal = 6; /* 6 should be enough, bec. max(numOfCoeff) = 20 */ + FIXP_DBL maxVal = (FIXP_DBL)0; + + workBuffer[0] = FX_LPC2FX_DBL(reflCoeff[0]) >> par2LpcShiftVal; + for (i = 1; i < numOfCoeff; i++) { + for (j = 0; j < i / 2; j++) { + FIXP_DBL tmp1, tmp2; + + tmp1 = workBuffer[j]; + tmp2 = workBuffer[i - 1 - j]; + workBuffer[j] += fMult(reflCoeff[i], tmp2); + workBuffer[i - 1 - j] += fMult(reflCoeff[i], tmp1); + } + if (i & 1) { + workBuffer[j] += fMult(reflCoeff[i], workBuffer[j]); + } + + workBuffer[i] = FX_LPC2FX_DBL(reflCoeff[i]) >> par2LpcShiftVal; + } + + /* calculate exponent */ + for (i = 0; i < numOfCoeff; i++) { + maxVal = fMax(maxVal, fAbs(workBuffer[i])); + } + + shiftval = fMin(fNorm(maxVal), par2LpcShiftVal); + + for (i = 0; i < numOfCoeff; i++) { + LpcCoeff[i] = FX_DBL2FX_LPC(workBuffer[i] << shiftval); + } + + return (par2LpcShiftVal - shiftval); +} + +void CLpc_AutoToParcor(FIXP_DBL acorr[], const int acorr_e, + FIXP_LPC reflCoeff[], const int numOfCoeff, + FIXP_DBL *pPredictionGain_m, INT *pPredictionGain_e) { + INT i, j, scale = 0; + FIXP_DBL parcorWorkBuffer[LPC_MAX_ORDER]; + + FIXP_DBL *workBuffer = parcorWorkBuffer; + FIXP_DBL autoCorr_0 = acorr[0]; + + FDKmemclear(reflCoeff, numOfCoeff * sizeof(FIXP_LPC)); + + if (autoCorr_0 == FL2FXCONST_DBL(0.0)) { + if (pPredictionGain_m != NULL) { + *pPredictionGain_m = FL2FXCONST_DBL(0.5f); + *pPredictionGain_e = 1; + } + return; + } + + FDKmemcpy(workBuffer, acorr + 1, numOfCoeff * sizeof(FIXP_DBL)); + for (i = 0; i < numOfCoeff; i++) { + LONG sign = ((LONG)workBuffer[0] >> (DFRACT_BITS - 1)); + FIXP_DBL tmp = (FIXP_DBL)((LONG)workBuffer[0] ^ sign); + + /* Check preconditions for division function: num<=denum */ + /* For 1st iteration acorr[0] cannot be 0, it is checked before loop */ + /* Due to exor operation with "sign", num(=tmp) is greater/equal 0 */ + if (acorr[0] < tmp) break; + + /* tmp = div(num, denum, 16) */ + tmp = (FIXP_DBL)((LONG)schur_div(tmp, acorr[0], FRACT_BITS) ^ (~sign)); + + reflCoeff[i] = FX_DBL2FX_LPC(tmp); + + for (j = numOfCoeff - i - 1; j >= 0; j--) { + FIXP_DBL accu1 = fMult(tmp, acorr[j]); + FIXP_DBL accu2 = fMult(tmp, workBuffer[j]); + workBuffer[j] += accu1; + acorr[j] += accu2; + } + /* Check preconditions for division function: denum (=acorr[0]) > 0 */ + if (acorr[0] == (FIXP_DBL)0) break; + + workBuffer++; + } + + if (pPredictionGain_m != NULL) { + if (acorr[0] > (FIXP_DBL)0) { + /* prediction gain = signal power / error (residual) power */ + *pPredictionGain_m = fDivNormSigned(autoCorr_0, acorr[0], &scale); + *pPredictionGain_e = scale; + } else { + *pPredictionGain_m = (FIXP_DBL)0; + *pPredictionGain_e = 0; + } + } +} diff --git a/fdk-aac/libFDK/src/FDK_matrixCalloc.cpp b/fdk-aac/libFDK/src/FDK_matrixCalloc.cpp new file mode 100644 index 0000000..5d5c521 --- /dev/null +++ b/fdk-aac/libFDK/src/FDK_matrixCalloc.cpp @@ -0,0 +1,315 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: matrix memory allocation + +*******************************************************************************/ + +#include "FDK_matrixCalloc.h" + +#include "genericStds.h" + +void *fdkCallocMatrix1D_aligned(UINT dim1, UINT size) { + return FDKaalloc(dim1 * size, ALIGNMENT_DEFAULT); +} + +void *fdkCallocMatrix1D_int(UINT dim, UINT size, MEMORY_SECTION s) { + return FDKcalloc_L(dim, size, s); +} + +void *fdkCallocMatrix1D_int_aligned(UINT dim, UINT size, MEMORY_SECTION s) { + return FDKaalloc_L(dim * size, ALIGNMENT_DEFAULT, s); +} + +void fdkFreeMatrix1D(void *p) { + if (p != NULL) { + FDKfree_L(p); + } +} + +void fdkFreeMatrix1D_aligned(void *p) { + if (p != NULL) { + FDKafree_L(p); + } +} + +void *fdkCallocMatrix1D(UINT dim1, UINT size) { return FDKcalloc(dim1, size); } + +/* 2D */ +void **fdkCallocMatrix2D(UINT dim1, UINT dim2, UINT size) { + void **p1; + UINT i; + char *p2; + if (!dim1 || !dim2) return NULL; + if ((p1 = (void **)fdkCallocMatrix1D(dim1, sizeof(void *))) == NULL) { + goto bail; + } + if ((p2 = (char *)fdkCallocMatrix1D(dim1 * dim2, size)) == NULL) { + fdkFreeMatrix1D(p1); + p1 = NULL; + goto bail; + } + for (i = 0; i < dim1; i++) { + p1[i] = p2; + p2 += dim2 * size; + } +bail: + return p1; +} + +void **fdkCallocMatrix2D_aligned(UINT dim1, UINT dim2, UINT size) { + void **p1; + UINT i; + char *p2; + if (!dim1 || !dim2) return NULL; + if ((p1 = (void **)fdkCallocMatrix1D(dim1, sizeof(void *))) == NULL) { + goto bail; + } + if ((p2 = (char *)fdkCallocMatrix1D_aligned(dim1 * dim2, size)) == NULL) { + fdkFreeMatrix1D(p1); + p1 = NULL; + goto bail; + } + for (i = 0; i < dim1; i++) { + p1[i] = p2; + p2 += dim2 * size; + } +bail: + return p1; +} + +void fdkFreeMatrix2D(void **p) { + if (!p) return; + fdkFreeMatrix1D(p[0]); + fdkFreeMatrix1D(p); +} + +void fdkFreeMatrix2D_aligned(void **p) { + if (!p) return; + fdkFreeMatrix1D_aligned(p[0]); + fdkFreeMatrix1D(p); +} + +void **fdkCallocMatrix2D_int(UINT dim1, UINT dim2, UINT size, + MEMORY_SECTION s) { + void **p1; + UINT i; + char *p2; + + if (!dim1 || !dim2) return NULL; + if ((p1 = (void **)fdkCallocMatrix1D_int(dim1, sizeof(void *), s)) == NULL) { + goto bail; + } + if ((p2 = (char *)fdkCallocMatrix1D_int(dim1 * dim2, size, s)) == NULL) { + fdkFreeMatrix1D(p1); + p1 = NULL; + goto bail; + } + for (i = 0; i < dim1; i++) { + p1[i] = p2; + p2 += dim2 * size; + } +bail: + return p1; +} + +void **fdkCallocMatrix2D_int_aligned(UINT dim1, UINT dim2, UINT size, + MEMORY_SECTION s) { + void **p1; + UINT i; + char *p2; + + if (!dim1 || !dim2) return NULL; + if ((p1 = (void **)fdkCallocMatrix1D_int(dim1, sizeof(void *), s)) == NULL) { + goto bail; + } + if ((p2 = (char *)fdkCallocMatrix1D_int_aligned(dim1 * dim2, size, s)) == + NULL) { + fdkFreeMatrix1D(p1); + p1 = NULL; + goto bail; + } + for (i = 0; i < dim1; i++) { + p1[i] = p2; + p2 += dim2 * size; + } +bail: + return p1; +} + +/* 3D */ +void ***fdkCallocMatrix3D(UINT dim1, UINT dim2, UINT dim3, UINT size) { + void ***p1; + UINT i, j; + void **p2; + char *p3; + + if (!dim1 || !dim2 || !dim3) return NULL; + if ((p1 = (void ***)fdkCallocMatrix1D(dim1, sizeof(void **))) == NULL) { + goto bail; + } + if ((p2 = (void **)fdkCallocMatrix1D(dim1 * dim2, sizeof(void *))) == NULL) { + fdkFreeMatrix1D(p1); + p1 = NULL; + goto bail; + } + p1[0] = p2; + if ((p3 = (char *)fdkCallocMatrix1D(dim1 * dim2 * dim3, size)) == NULL) { + fdkFreeMatrix1D(p1); + fdkFreeMatrix1D(p2); + p1 = NULL; + p2 = NULL; + goto bail; + } + for (i = 0; i < dim1; i++) { + p1[i] = p2; + for (j = 0; j < dim2; j++) { + p2[j] = p3; + p3 += dim3 * size; + } + p2 += dim2; + } +bail: + return p1; +} + +void fdkFreeMatrix3D(void ***p) { + if (!p) return; + if (p[0] != NULL) fdkFreeMatrix1D(p[0][0]); + fdkFreeMatrix1D(p[0]); + fdkFreeMatrix1D(p); +} + +void ***fdkCallocMatrix3D_int(UINT dim1, UINT dim2, UINT dim3, UINT size, + MEMORY_SECTION s) { + void ***p1; + UINT i, j; + void **p2; + char *p3; + + if (!dim1 || !dim2 || !dim3) return NULL; + if ((p1 = (void ***)fdkCallocMatrix1D_int(dim1, sizeof(void **), s)) == + NULL) { + goto bail; + } + if ((p2 = (void **)fdkCallocMatrix1D_int(dim1 * dim2, sizeof(void *), s)) == + NULL) { + fdkFreeMatrix1D(p1); + p1 = NULL; + goto bail; + } + p1[0] = p2; + if ((p3 = (char *)fdkCallocMatrix1D_int(dim1 * dim2 * dim3, size, s)) == + NULL) { + fdkFreeMatrix1D(p1); + fdkFreeMatrix1D(p2); + p1 = NULL; + p2 = NULL; + goto bail; + } + for (i = 0; i < dim1; i++) { + p1[i] = p2; + for (j = 0; j < dim2; j++) { + p2[j] = p3; + p3 += dim3 * size; + } + p2 += dim2; + } +bail: + return p1; +} diff --git a/fdk-aac/libFDK/src/FDK_qmf_domain.cpp b/fdk-aac/libFDK/src/FDK_qmf_domain.cpp new file mode 100644 index 0000000..3245deb --- /dev/null +++ b/fdk-aac/libFDK/src/FDK_qmf_domain.cpp @@ -0,0 +1,1018 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Matthias Hildenbrand + + Description: Module to efficiently handle QMF data for multiple channels and + to share the data between e.g. SBR and MPS + +*******************************************************************************/ + +#include "FDK_qmf_domain.h" + +#include "common_fix.h" + +#define WORKBUFFER1_TAG 0 +#define WORKBUFFER2_TAG 1 + +#define WORKBUFFER3_TAG 4 +#define WORKBUFFER4_TAG 5 +#define WORKBUFFER5_TAG 6 +#define WORKBUFFER6_TAG 7 + +C_ALLOC_MEM_OVERLAY(QmfWorkBufferCore1, FIXP_DBL, QMF_WB_SECTION_SIZE, + SECT_DATA_L1, WORKBUFFER1_TAG) +C_ALLOC_MEM_OVERLAY(QmfWorkBufferCore2, FIXP_DBL, QMF_WB_SECTION_SIZE, + SECT_DATA_L2, WORKBUFFER2_TAG) +C_ALLOC_MEM_OVERLAY(QmfWorkBufferCore3, FIXP_DBL, QMF_WB_SECTION_SIZE, + SECT_DATA_L2, WORKBUFFER3_TAG) +C_ALLOC_MEM_OVERLAY(QmfWorkBufferCore4, FIXP_DBL, QMF_WB_SECTION_SIZE, + SECT_DATA_L2, WORKBUFFER4_TAG) +C_ALLOC_MEM_OVERLAY(QmfWorkBufferCore5, FIXP_DBL, QMF_WB_SECTION_SIZE, + SECT_DATA_L2, WORKBUFFER5_TAG) +C_ALLOC_MEM_OVERLAY(QmfWorkBufferCore6, FIXP_DBL, QMF_WB_SECTION_SIZE, + SECT_DATA_L2, WORKBUFFER6_TAG) + +/*! Analysis states buffer.
+ Dimension: #((8) + (1)) */ +C_ALLOC_MEM2(AnaQmfStates, FIXP_QAS, 10 * QMF_DOMAIN_MAX_ANALYSIS_QMF_BANDS, + ((8) + (1))) + +/*! Synthesis states buffer.
+ Dimension: #((8) + (1)) */ +C_ALLOC_MEM2(SynQmfStates, FIXP_QSS, 9 * QMF_DOMAIN_MAX_SYNTHESIS_QMF_BANDS, + ((8) + (1))) + +/*! Pointer to real qmf data for each time slot.
+ Dimension: #((8) + (1)) */ +C_ALLOC_MEM2(QmfSlotsReal, FIXP_DBL *, + QMF_DOMAIN_MAX_TIMESLOTS + QMF_DOMAIN_MAX_OV_TIMESLOTS, + ((8) + (1))) + +/*! Pointer to imaginary qmf data for each time slot.
+ Dimension: #((8) + (1)) */ +C_ALLOC_MEM2(QmfSlotsImag, FIXP_DBL *, + QMF_DOMAIN_MAX_TIMESLOTS + QMF_DOMAIN_MAX_OV_TIMESLOTS, + ((8) + (1))) + +/*! QMF overlap buffer.
+ Dimension: #((8) + (1)) */ +C_AALLOC_MEM2(QmfOverlapBuffer, FIXP_DBL, + 2 * QMF_DOMAIN_MAX_OV_TIMESLOTS * QMF_DOMAIN_MAX_QMF_PROC_BANDS, + ((8) + (1))) + +/*! Analysis states buffer.
+ Dimension: #((8) + (1)) */ +C_ALLOC_MEM2(AnaQmfStates16, FIXP_QAS, 10 * QMF_DOMAIN_ANALYSIS_QMF_BANDS_16, + ((8) + (1))) + +/*! Analysis states buffer.
+ Dimension: #((8) + (1)) */ +C_ALLOC_MEM2(AnaQmfStates24, FIXP_QAS, 10 * QMF_DOMAIN_ANALYSIS_QMF_BANDS_24, + ((8) + (1))) + +/*! Analysis states buffer.
+ Dimension: #((8) + (1)) */ +C_ALLOC_MEM2(AnaQmfStates32, FIXP_QAS, 10 * QMF_DOMAIN_ANALYSIS_QMF_BANDS_32, + ((8) + (1))) + +/*! Pointer to real qmf data for each time slot.
+ Dimension: #((8) + (1)) */ +C_ALLOC_MEM2(QmfSlotsReal16, FIXP_DBL *, + QMF_DOMAIN_TIMESLOTS_16 + QMF_DOMAIN_OV_TIMESLOTS_16, ((8) + (1))) + +/*! Pointer to real qmf data for each time slot.
+ Dimension: #((8) + (1)) */ +C_ALLOC_MEM2(QmfSlotsReal32, FIXP_DBL *, + QMF_DOMAIN_TIMESLOTS_32 + QMF_DOMAIN_OV_TIMESLOTS_32, ((8) + (1))) + +/*! Pointer to imaginary qmf data for each time slot.
+ Dimension: #((8) + (1)) */ +C_ALLOC_MEM2(QmfSlotsImag16, FIXP_DBL *, + QMF_DOMAIN_TIMESLOTS_16 + QMF_DOMAIN_OV_TIMESLOTS_16, ((8) + (1))) + +/*! Pointer to imaginary qmf data for each time slot.
+ Dimension: #((8) + (1)) */ +C_ALLOC_MEM2(QmfSlotsImag32, FIXP_DBL *, + QMF_DOMAIN_TIMESLOTS_32 + QMF_DOMAIN_OV_TIMESLOTS_32, ((8) + (1))) + +/*! QMF overlap buffer.
+ Dimension: #((8) + (1)) */ +C_AALLOC_MEM2(QmfOverlapBuffer16, FIXP_DBL, + 2 * QMF_DOMAIN_OV_TIMESLOTS_16 * QMF_DOMAIN_MAX_QMF_PROC_BANDS, + ((8) + (1))) + +/*! QMF overlap buffer.
+ Dimension: #((8) + (1)) */ +C_AALLOC_MEM2(QmfOverlapBuffer32, FIXP_DBL, + 2 * QMF_DOMAIN_OV_TIMESLOTS_32 * QMF_DOMAIN_MAX_QMF_PROC_BANDS, + ((8) + (1))) + +static int FDK_QmfDomain_FreePersistentMemory(HANDLE_FDK_QMF_DOMAIN qd) { + int err = 0; + int ch; + + for (ch = 0; ch < ((8) + (1)); ch++) { + if (qd->QmfDomainIn[ch].pAnaQmfStates) { + if (qd->globalConf.nBandsAnalysis == QMF_DOMAIN_ANALYSIS_QMF_BANDS_16) { + FreeAnaQmfStates16(&qd->QmfDomainIn[ch].pAnaQmfStates); + } else if (qd->globalConf.nBandsAnalysis == + QMF_DOMAIN_ANALYSIS_QMF_BANDS_24) { + FreeAnaQmfStates24(&qd->QmfDomainIn[ch].pAnaQmfStates); + } else if (qd->globalConf.nBandsAnalysis == + QMF_DOMAIN_ANALYSIS_QMF_BANDS_32) { + FreeAnaQmfStates32(&qd->QmfDomainIn[ch].pAnaQmfStates); + } else { + FreeAnaQmfStates(&qd->QmfDomainIn[ch].pAnaQmfStates); + } + } + + if (qd->QmfDomainIn[ch].pOverlapBuffer) { + if (qd->globalConf.nQmfOvTimeSlots == QMF_DOMAIN_OV_TIMESLOTS_16) { + FreeQmfOverlapBuffer16(&qd->QmfDomainIn[ch].pOverlapBuffer); + } else if (qd->globalConf.nQmfOvTimeSlots == QMF_DOMAIN_OV_TIMESLOTS_32) { + FreeQmfOverlapBuffer32(&qd->QmfDomainIn[ch].pOverlapBuffer); + } else { + FreeQmfOverlapBuffer(&qd->QmfDomainIn[ch].pOverlapBuffer); + } + } + + if (qd->QmfDomainIn[ch].hQmfSlotsReal) { + if (qd->globalConf.nQmfTimeSlots == QMF_DOMAIN_TIMESLOTS_16) { + FreeQmfSlotsReal16(&qd->QmfDomainIn[ch].hQmfSlotsReal); + } else if (qd->globalConf.nQmfTimeSlots == QMF_DOMAIN_TIMESLOTS_32) { + FreeQmfSlotsReal32(&qd->QmfDomainIn[ch].hQmfSlotsReal); + } else { + FreeQmfSlotsReal(&qd->QmfDomainIn[ch].hQmfSlotsReal); + } + } + + if (qd->QmfDomainIn[ch].hQmfSlotsImag) { + if (qd->globalConf.nQmfTimeSlots == QMF_DOMAIN_TIMESLOTS_16) { + FreeQmfSlotsImag16(&qd->QmfDomainIn[ch].hQmfSlotsImag); + } + if (qd->globalConf.nQmfTimeSlots == QMF_DOMAIN_TIMESLOTS_32) { + FreeQmfSlotsImag32(&qd->QmfDomainIn[ch].hQmfSlotsImag); + } else { + FreeQmfSlotsImag(&qd->QmfDomainIn[ch].hQmfSlotsImag); + } + } + } + + for (ch = 0; ch < ((8) + (1)); ch++) { + if (qd->QmfDomainOut[ch].pSynQmfStates) { + FreeSynQmfStates(&qd->QmfDomainOut[ch].pSynQmfStates); + } + } + + return err; +} + +static int FDK_QmfDomain_AllocatePersistentMemory(HANDLE_FDK_QMF_DOMAIN qd) { + int err = 0; + int ch; + HANDLE_FDK_QMF_DOMAIN_GC gc = &qd->globalConf; + + if ((gc->nInputChannels > ((8) + (1))) || (gc->nOutputChannels > ((8) + (1)))) + return err = 1; + for (ch = 0; ch < gc->nInputChannels; ch++) { + int size; + + size = gc->nBandsAnalysis * 10; + if (size > 0) { + if (gc->nBandsAnalysis == QMF_DOMAIN_ANALYSIS_QMF_BANDS_16) { + if (qd->QmfDomainIn[ch].pAnaQmfStates == NULL) { + if (NULL == + (qd->QmfDomainIn[ch].pAnaQmfStates = GetAnaQmfStates16(ch))) + goto bail; + } + } else if (gc->nBandsAnalysis == QMF_DOMAIN_ANALYSIS_QMF_BANDS_24) { + if (qd->QmfDomainIn[ch].pAnaQmfStates == NULL) { + if (NULL == + (qd->QmfDomainIn[ch].pAnaQmfStates = GetAnaQmfStates24(ch))) + goto bail; + } + } else if (gc->nBandsAnalysis == QMF_DOMAIN_ANALYSIS_QMF_BANDS_32) { + if (qd->QmfDomainIn[ch].pAnaQmfStates == NULL) { + if (NULL == + (qd->QmfDomainIn[ch].pAnaQmfStates = GetAnaQmfStates32(ch))) + goto bail; + } + } else { + if (qd->QmfDomainIn[ch].pAnaQmfStates == NULL) { + if (NULL == (qd->QmfDomainIn[ch].pAnaQmfStates = GetAnaQmfStates(ch))) + goto bail; + } + } + } else { + qd->QmfDomainIn[ch].pAnaQmfStates = NULL; + } + + size = gc->nQmfOvTimeSlots + gc->nQmfTimeSlots; + if (size > 0) { + if (gc->nQmfTimeSlots == QMF_DOMAIN_TIMESLOTS_16) { + if (qd->QmfDomainIn[ch].hQmfSlotsReal == NULL) { + if (NULL == + (qd->QmfDomainIn[ch].hQmfSlotsReal = GetQmfSlotsReal16(ch))) + goto bail; + } + if (qd->QmfDomainIn[ch].hQmfSlotsImag == NULL) { + if (NULL == + (qd->QmfDomainIn[ch].hQmfSlotsImag = GetQmfSlotsImag16(ch))) + goto bail; + } + } else if (gc->nQmfTimeSlots == QMF_DOMAIN_TIMESLOTS_32) { + if (qd->QmfDomainIn[ch].hQmfSlotsReal == NULL) { + if (NULL == + (qd->QmfDomainIn[ch].hQmfSlotsReal = GetQmfSlotsReal32(ch))) + goto bail; + } + if (qd->QmfDomainIn[ch].hQmfSlotsImag == NULL) { + if (NULL == + (qd->QmfDomainIn[ch].hQmfSlotsImag = GetQmfSlotsImag32(ch))) + goto bail; + } + } else { + if (qd->QmfDomainIn[ch].hQmfSlotsReal == NULL) { + if (NULL == (qd->QmfDomainIn[ch].hQmfSlotsReal = GetQmfSlotsReal(ch))) + goto bail; + } + if (qd->QmfDomainIn[ch].hQmfSlotsImag == NULL) { + if (NULL == (qd->QmfDomainIn[ch].hQmfSlotsImag = GetQmfSlotsImag(ch))) + goto bail; + } + } + } else { + qd->QmfDomainIn[ch].hQmfSlotsReal = NULL; + qd->QmfDomainIn[ch].hQmfSlotsImag = NULL; + } + + size = gc->nQmfOvTimeSlots * gc->nQmfProcBands * CMPLX_MOD; + if (size > 0) { + if (gc->nQmfOvTimeSlots == QMF_DOMAIN_OV_TIMESLOTS_16) { + if (qd->QmfDomainIn[ch].pOverlapBuffer == NULL) { + if (NULL == + (qd->QmfDomainIn[ch].pOverlapBuffer = GetQmfOverlapBuffer16(ch))) + goto bail; + } + } else if (gc->nQmfOvTimeSlots == QMF_DOMAIN_OV_TIMESLOTS_32) { + if (qd->QmfDomainIn[ch].pOverlapBuffer == NULL) { + if (NULL == + (qd->QmfDomainIn[ch].pOverlapBuffer = GetQmfOverlapBuffer32(ch))) + goto bail; + } + } else { + if (qd->QmfDomainIn[ch].pOverlapBuffer == NULL) { + if (NULL == + (qd->QmfDomainIn[ch].pOverlapBuffer = GetQmfOverlapBuffer(ch))) + goto bail; + } + } + } else { + qd->QmfDomainIn[ch].pOverlapBuffer = NULL; + } + } + + for (ch = 0; ch < gc->nOutputChannels; ch++) { + int size = gc->nBandsSynthesis * 9; + if (size > 0) { + if (qd->QmfDomainOut[ch].pSynQmfStates == NULL) { + if (NULL == (qd->QmfDomainOut[ch].pSynQmfStates = GetSynQmfStates(ch))) + goto bail; + } + } else { + qd->QmfDomainOut[ch].pSynQmfStates = NULL; + } + } + + return err; + +bail: + FDK_QmfDomain_FreePersistentMemory(qd); + return -1; +} + +QMF_DOMAIN_ERROR FDK_QmfDomain_ClearPersistentMemory( + HANDLE_FDK_QMF_DOMAIN hqd) { + QMF_DOMAIN_ERROR err = QMF_DOMAIN_OK; + int ch, size; + if (hqd) { + HANDLE_FDK_QMF_DOMAIN_GC gc = &hqd->globalConf; + + size = gc->nQmfOvTimeSlots * gc->nQmfProcBands * CMPLX_MOD; + for (ch = 0; ch < gc->nInputChannels; ch++) { + if (hqd->QmfDomainIn[ch].pOverlapBuffer) { + FDKmemclear(hqd->QmfDomainIn[ch].pOverlapBuffer, + size * sizeof(FIXP_DBL)); + } + } + if (FDK_QmfDomain_InitFilterBank(hqd, 0)) { + err = QMF_DOMAIN_INIT_ERROR; + } + } else { + err = QMF_DOMAIN_INIT_ERROR; + } + return err; +} + +/* + FDK_getWorkBuffer + + Parameters: + + pWorkBuffer i: array of pointers which point to different workbuffer + sections workBufferOffset i: offset in the workbuffer to the requested + memory memSize i: size of requested memory + + Function: + + The functions returns the address to the requested memory in the workbuffer. + + The overall workbuffer is divided into several sections. There are + QMF_MAX_WB_SECTIONS sections of size QMF_WB_SECTION_SIZE. The function + selects the workbuffer section with the help of the workBufferOffset and than + it verifies whether the requested amount of memory fits into the selected + workbuffer section. + + Returns: + + address to workbuffer +*/ +static FIXP_DBL *FDK_getWorkBuffer(FIXP_DBL **pWorkBuffer, + USHORT workBufferOffset, + USHORT workBufferSectSize, USHORT memSize) { + int idx1; + int idx2; + FIXP_DBL *pwb; + + /* a section must be a multiple of the number of processing bands (currently + * always 64) */ + FDK_ASSERT((workBufferSectSize % 64) == 0); + + /* calculate offset within the section */ + idx2 = workBufferOffset % workBufferSectSize; + /* calculate section number */ + idx1 = (workBufferOffset - idx2) / workBufferSectSize; + /* maximum sectionnumber is QMF_MAX_WB_SECTIONS */ + FDK_ASSERT(idx1 < QMF_MAX_WB_SECTIONS); + + /* check, whether workbuffer is available */ + FDK_ASSERT(pWorkBuffer[idx1] != NULL); + + /* check, whether buffer fits into selected section */ + FDK_ASSERT((idx2 + memSize) <= workBufferSectSize); + + /* get requested address to workbuffer */ + pwb = &pWorkBuffer[idx1][idx2]; + + return pwb; +} + +static int FDK_QmfDomain_FeedWorkBuffer(HANDLE_FDK_QMF_DOMAIN qd, int ch, + FIXP_DBL **pWorkBuffer, + USHORT workBufferOffset, + USHORT workBufferSectSize, int size) { + int err = 0; + int mem_needed; + + mem_needed = qd->QmfDomainIn[ch].workBuf_nBands * + qd->QmfDomainIn[ch].workBuf_nTimeSlots * CMPLX_MOD; + if (mem_needed > size) { + return (err = 1); + } + qd->QmfDomainIn[ch].pWorkBuffer = pWorkBuffer; + qd->QmfDomainIn[ch].workBufferOffset = workBufferOffset; + qd->QmfDomainIn[ch].workBufferSectSize = workBufferSectSize; + + return err; +} + +int FDK_QmfDomain_IsInitialized(const HANDLE_FDK_QMF_DOMAIN qd) { + FDK_ASSERT(qd != NULL); + return ((qd->QmfDomainIn[0].pAnaQmfStates == NULL) && + (qd->QmfDomainOut[0].pSynQmfStates == NULL)) + ? 0 + : 1; +} + +int FDK_QmfDomain_InitFilterBank(HANDLE_FDK_QMF_DOMAIN qd, UINT extra_flags) { + FDK_ASSERT(qd != NULL); + int err = 0; + int ch, ts; + HANDLE_FDK_QMF_DOMAIN_GC gc = &qd->globalConf; + int noCols = gc->nQmfTimeSlots; + int lsb = gc->nBandsAnalysis; + int usb = fMin((INT)gc->nBandsSynthesis, 64); + int nProcBands = gc->nQmfProcBands; + FDK_ASSERT(nProcBands % ALIGNMENT_DEFAULT == 0); + + if (extra_flags & QMF_FLAG_MPSLDFB) { + gc->flags &= ~QMF_FLAG_CLDFB; + gc->flags |= QMF_FLAG_MPSLDFB; + } + for (ch = 0; ch < gc->nInputChannels; ch++) { + /* distribute memory to slots array */ + FIXP_DBL *ptrOv = + qd->QmfDomainIn[ch].pOverlapBuffer; /* persistent memory for overlap */ + if ((ptrOv == NULL) && (gc->nQmfOvTimeSlots != 0)) { + err = 1; + return err; + } + /* This assumes the workbuffer defined for ch0 is the big one being used to + * hold one full frame of QMF data. */ + FIXP_DBL **ptr = + qd->QmfDomainIn[fMin(ch, fMax((INT)gc->nQmfProcChannels - 1, 0))] + .pWorkBuffer; /* non-persistent workbuffer */ + USHORT workBufferOffset = + qd->QmfDomainIn[fMin(ch, fMax((INT)gc->nQmfProcChannels - 1, 0))] + .workBufferOffset; + USHORT workBufferSectSize = + qd->QmfDomainIn[fMin(ch, fMax((INT)gc->nQmfProcChannels - 1, 0))] + .workBufferSectSize; + + if ((ptr == NULL) && (gc->nQmfTimeSlots != 0)) { + err = 1; + return err; + } + + qd->QmfDomainIn[ch].pGlobalConf = gc; + for (ts = 0; ts < gc->nQmfOvTimeSlots; ts++) { + qd->QmfDomainIn[ch].hQmfSlotsReal[ts] = ptrOv; + ptrOv += nProcBands; + qd->QmfDomainIn[ch].hQmfSlotsImag[ts] = ptrOv; + ptrOv += nProcBands; + } + for (; ts < (gc->nQmfOvTimeSlots + gc->nQmfTimeSlots); ts++) { + qd->QmfDomainIn[ch].hQmfSlotsReal[ts] = FDK_getWorkBuffer( + ptr, workBufferOffset, workBufferSectSize, nProcBands); + workBufferOffset += nProcBands; + qd->QmfDomainIn[ch].hQmfSlotsImag[ts] = FDK_getWorkBuffer( + ptr, workBufferOffset, workBufferSectSize, nProcBands); + workBufferOffset += nProcBands; + } + err |= qmfInitAnalysisFilterBank( + &qd->QmfDomainIn[ch].fb, qd->QmfDomainIn[ch].pAnaQmfStates, noCols, + (qd->QmfDomainIn[ch].fb.lsb == 0) ? lsb : qd->QmfDomainIn[ch].fb.lsb, + (qd->QmfDomainIn[ch].fb.usb == 0) ? usb : qd->QmfDomainIn[ch].fb.usb, + gc->nBandsAnalysis, gc->flags | extra_flags); + } + + for (ch = 0; ch < gc->nOutputChannels; ch++) { + FIXP_DBL outGain_m = qd->QmfDomainOut[ch].fb.outGain_m; + int outGain_e = qd->QmfDomainOut[ch].fb.outGain_e; + int outScale = qmfGetOutScalefactor(&qd->QmfDomainOut[ch].fb); + err |= qmfInitSynthesisFilterBank( + &qd->QmfDomainOut[ch].fb, qd->QmfDomainOut[ch].pSynQmfStates, noCols, + (qd->QmfDomainOut[ch].fb.lsb == 0) ? lsb : qd->QmfDomainOut[ch].fb.lsb, + (qd->QmfDomainOut[ch].fb.usb == 0) ? usb : qd->QmfDomainOut[ch].fb.usb, + gc->nBandsSynthesis, gc->flags | extra_flags); + if (outGain_m != (FIXP_DBL)0) { + qmfChangeOutGain(&qd->QmfDomainOut[ch].fb, outGain_m, outGain_e); + } + if (outScale) { + qmfChangeOutScalefactor(&qd->QmfDomainOut[ch].fb, outScale); + } + } + + return err; +} + +void FDK_QmfDomain_SaveOverlap(HANDLE_FDK_QMF_DOMAIN_IN qd_ch, int offset) { + FDK_ASSERT(qd_ch != NULL); + int ts; + HANDLE_FDK_QMF_DOMAIN_GC gc = qd_ch->pGlobalConf; + int ovSlots = gc->nQmfOvTimeSlots; + int nCols = gc->nQmfTimeSlots; + int nProcBands = gc->nQmfProcBands; + FIXP_DBL **qmfReal = qd_ch->hQmfSlotsReal; + FIXP_DBL **qmfImag = qd_ch->hQmfSlotsImag; + QMF_SCALE_FACTOR *pScaling = &qd_ch->scaling; + + /* for high part it would be enough to save only used part of overlap area */ + if (qmfImag != NULL) { + for (ts = offset; ts < ovSlots; ts++) { + FDKmemcpy(qmfReal[ts], qmfReal[nCols + ts], + sizeof(FIXP_DBL) * nProcBands); + FDKmemcpy(qmfImag[ts], qmfImag[nCols + ts], + sizeof(FIXP_DBL) * nProcBands); + } + } else { + for (ts = 0; ts < ovSlots; ts++) { + FDKmemcpy(qmfReal[ts], qmfReal[nCols + ts], + sizeof(FIXP_DBL) * nProcBands); + } + } + pScaling->ov_lb_scale = pScaling->lb_scale; +} + + /* Convert headroom bits to exponent */ +#define SCALE2EXP(s) (15 - (s)) +#define EXP2SCALE(e) (15 - (e)) + +void FDK_QmfDomain_GetSlot(const HANDLE_FDK_QMF_DOMAIN_IN qd_ch, const int ts, + const int start_band, const int stop_band, + FIXP_DBL *pQmfOutReal, FIXP_DBL *pQmfOutImag, + const int exp_out) { + FDK_ASSERT(qd_ch != NULL); + FDK_ASSERT(pQmfOutReal != NULL); + HANDLE_FDK_QMF_DOMAIN_GC gc = qd_ch->pGlobalConf; + const FIXP_DBL *real = qd_ch->hQmfSlotsReal[ts]; + const FIXP_DBL *imag = qd_ch->hQmfSlotsImag[ts]; + const int ovSlots = gc->nQmfOvTimeSlots; + const int exp_lb = SCALE2EXP((ts < ovSlots) ? qd_ch->scaling.ov_lb_scale + : qd_ch->scaling.lb_scale); + const int exp_hb = SCALE2EXP(qd_ch->scaling.hb_scale); + const int lsb = qd_ch->fb.lsb; + const int usb = qd_ch->fb.usb; + int b = start_band; + int lb_sf, hb_sf; + + int target_exp = + ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK + qd_ch->fb.filterScale; + + FDK_ASSERT(ts < (gc->nQmfTimeSlots + gc->nQmfOvTimeSlots)); + FDK_ASSERT(start_band >= 0); + FDK_ASSERT(stop_band <= gc->nQmfProcBands); + + if (qd_ch->fb.no_channels == 24) { + target_exp -= 1; + } + + /* Limit scaling factors to maximum negative value to avoid faulty behaviour + due to right-shifts. Corresponding asserts were observed during robustness + testing. + */ + lb_sf = fMax(exp_lb - target_exp - exp_out, -31); + FDK_ASSERT(lb_sf < 32); + hb_sf = fMax(exp_hb - target_exp - exp_out, -31); + FDK_ASSERT(hb_sf < 32); + + if (pQmfOutImag == NULL) { + for (; b < fMin(lsb, stop_band); b++) { + pQmfOutReal[b] = scaleValue(real[b], lb_sf); + } + for (; b < fMin(usb, stop_band); b++) { + pQmfOutReal[b] = scaleValue(real[b], hb_sf); + } + for (; b < stop_band; b++) { + pQmfOutReal[b] = (FIXP_DBL)0; + } + } else { + FDK_ASSERT(imag != NULL); + for (; b < fMin(lsb, stop_band); b++) { + pQmfOutReal[b] = scaleValue(real[b], lb_sf); + pQmfOutImag[b] = scaleValue(imag[b], lb_sf); + } + for (; b < fMin(usb, stop_band); b++) { + pQmfOutReal[b] = scaleValue(real[b], hb_sf); + pQmfOutImag[b] = scaleValue(imag[b], hb_sf); + } + for (; b < stop_band; b++) { + pQmfOutReal[b] = (FIXP_DBL)0; + pQmfOutImag[b] = (FIXP_DBL)0; + } + } +} + +void FDK_QmfDomain_GetWorkBuffer(const HANDLE_FDK_QMF_DOMAIN_IN qd_ch, + const int ts, FIXP_DBL **ppQmfReal, + FIXP_DBL **ppQmfImag) { + FDK_ASSERT(qd_ch != NULL); + FDK_ASSERT(ppQmfReal != NULL); + FDK_ASSERT(ppQmfImag != NULL); + const int bands = qd_ch->workBuf_nBands; + FIXP_DBL **pWorkBuf = qd_ch->pWorkBuffer; + USHORT workBufferOffset = qd_ch->workBufferOffset; + USHORT workBufferSectSize = qd_ch->workBufferSectSize; + + FDK_ASSERT(bands > 0); + FDK_ASSERT(ts < qd_ch->workBuf_nTimeSlots); + + *ppQmfReal = FDK_getWorkBuffer( + pWorkBuf, workBufferOffset + (ts * CMPLX_MOD + 0) * bands, + workBufferSectSize, bands); + *ppQmfImag = FDK_getWorkBuffer( + pWorkBuf, workBufferOffset + (ts * CMPLX_MOD + 1) * bands, + workBufferSectSize, bands); +} + +void FDK_QmfDomain_WorkBuffer2ProcChannel( + const HANDLE_FDK_QMF_DOMAIN_IN qd_ch) { + FDK_ASSERT(qd_ch != NULL); + HANDLE_FDK_QMF_DOMAIN_GC gc = qd_ch->pGlobalConf; + FIXP_DBL **pWorkBuf = qd_ch->pWorkBuffer; + USHORT workBufferOffset = qd_ch->workBufferOffset; + USHORT workBufferSectSize = qd_ch->workBufferSectSize; + + if (FDK_getWorkBuffer(pWorkBuf, workBufferOffset, workBufferSectSize, + qd_ch->workBuf_nBands) == + qd_ch->hQmfSlotsReal[gc->nQmfOvTimeSlots]) { + /* work buffer is part of processing channel => nothing to do */ + return; + } else { + /* copy parked new QMF data to processing channel */ + const int bands = qd_ch->workBuf_nBands; + const int slots = qd_ch->workBuf_nTimeSlots; + int ts; + for (ts = 0; ts < slots; ts++) { + FDKmemcpy(qd_ch->hQmfSlotsReal[gc->nQmfOvTimeSlots + ts], + FDK_getWorkBuffer(pWorkBuf, workBufferOffset, + workBufferSectSize, bands), + sizeof(FIXP_DBL) * bands); // parkBuf_to_anaMatrix + workBufferOffset += bands; + FDKmemcpy(qd_ch->hQmfSlotsImag[gc->nQmfOvTimeSlots + ts], + FDK_getWorkBuffer(pWorkBuf, workBufferOffset, + workBufferSectSize, bands), + sizeof(FIXP_DBL) * bands); + workBufferOffset += bands; + } + } +} + +void FDK_QmfDomain_QmfData2HBE(HANDLE_FDK_QMF_DOMAIN_IN qd_ch, + FIXP_DBL **ppQmfReal, FIXP_DBL **ppQmfImag) { + FDK_ASSERT(qd_ch != NULL); + FDK_ASSERT(ppQmfReal != NULL); + FDK_ASSERT(ppQmfImag != NULL); + HANDLE_FDK_QMF_DOMAIN_GC gc = qd_ch->pGlobalConf; + FIXP_DBL **pWorkBuf = qd_ch->pWorkBuffer; + USHORT workBufferOffset = qd_ch->workBufferOffset; + USHORT workBufferSectSize = qd_ch->workBufferSectSize; + + if (FDK_getWorkBuffer(pWorkBuf, workBufferOffset, workBufferSectSize, + qd_ch->workBuf_nBands) == + qd_ch->hQmfSlotsReal[gc->nQmfOvTimeSlots]) { // left channel (anaMatrix) + int ts; + const int bands = gc->nBandsAnalysis; + const int slots = qd_ch->workBuf_nTimeSlots; + FDK_ASSERT(bands <= 64); + for (ts = 0; ts < slots; ts++) { + /* copy current data of processing channel */ + FIXP_DBL tmp[64]; // one slot + /* real */ + FDKmemcpy(tmp, qd_ch->hQmfSlotsReal[gc->nQmfOvTimeSlots + ts], + sizeof(FIXP_DBL) * bands); // anaMatrix_to_tmp + FDKmemcpy(qd_ch->hQmfSlotsReal[gc->nQmfOvTimeSlots + ts], ppQmfReal[ts], + sizeof(FIXP_DBL) * bands); // HBE_to_anaMatrix + FDKmemcpy(ppQmfReal[ts], tmp, sizeof(FIXP_DBL) * bands); // tmp_to_HBE + /* imag */ + FDKmemcpy(tmp, qd_ch->hQmfSlotsImag[gc->nQmfOvTimeSlots + ts], + sizeof(FIXP_DBL) * bands); + FDKmemcpy(qd_ch->hQmfSlotsImag[gc->nQmfOvTimeSlots + ts], ppQmfImag[ts], + sizeof(FIXP_DBL) * bands); + FDKmemcpy(ppQmfImag[ts], tmp, sizeof(FIXP_DBL) * bands); + } + } else { // right channel (parkBuf) + const int bands = qd_ch->workBuf_nBands; + const int slots = qd_ch->workBuf_nTimeSlots; + int ts; + FDK_ASSERT(qd_ch->workBuf_nBands == gc->nBandsAnalysis); + for (ts = 0; ts < slots; ts++) { + /* copy HBE QMF data buffer to processing channel */ + FDKmemcpy(qd_ch->hQmfSlotsReal[gc->nQmfOvTimeSlots + ts], ppQmfReal[ts], + sizeof(FIXP_DBL) * bands); // HBE_to_anaMatrix + FDKmemcpy(qd_ch->hQmfSlotsImag[gc->nQmfOvTimeSlots + ts], ppQmfImag[ts], + sizeof(FIXP_DBL) * bands); + /* copy parked new QMF data to HBE QMF data buffer */ + FDKmemcpy(ppQmfReal[ts], + FDK_getWorkBuffer(pWorkBuf, workBufferOffset, + workBufferSectSize, bands), + sizeof(FIXP_DBL) * bands); // parkBuf_to_HBE + workBufferOffset += bands; + FDKmemcpy(ppQmfImag[ts], + FDK_getWorkBuffer(pWorkBuf, workBufferOffset, + workBufferSectSize, bands), + sizeof(FIXP_DBL) * bands); + workBufferOffset += bands; + } + } +} + +void FDK_QmfDomain_ClearRequested(HANDLE_FDK_QMF_DOMAIN_GC hgc) { + hgc->qmfDomainExplicitConfig = 0; + hgc->flags_requested = 0; + hgc->nInputChannels_requested = 0; + hgc->nOutputChannels_requested = 0; + hgc->parkChannel_requested = 0; + hgc->nBandsAnalysis_requested = 0; + hgc->nBandsSynthesis_requested = 0; + hgc->nQmfTimeSlots_requested = 0; + hgc->nQmfOvTimeSlots_requested = 0; + hgc->nQmfProcBands_requested = 0; + hgc->nQmfProcChannels_requested = 0; +} + +static void FDK_QmfDomain_ClearConfigured(HANDLE_FDK_QMF_DOMAIN_GC hgc) { + hgc->flags = 0; + hgc->nInputChannels = 0; + hgc->nOutputChannels = 0; + hgc->parkChannel = 0; + hgc->nBandsAnalysis = 0; + hgc->nBandsSynthesis = 0; + hgc->nQmfTimeSlots = 0; + hgc->nQmfOvTimeSlots = 0; + hgc->nQmfProcBands = 0; + hgc->nQmfProcChannels = 0; +} + +static void FDK_QmfDomain_ClearFilterBank(HANDLE_FDK_QMF_DOMAIN hqd) { + int ch; + + for (ch = 0; ch < ((8) + (1)); ch++) { + FDKmemclear(&hqd->QmfDomainIn[ch].fb, sizeof(hqd->QmfDomainIn[ch].fb)); + } + + for (ch = 0; ch < ((8) + (1)); ch++) { + FDKmemclear(&hqd->QmfDomainOut[ch].fb, sizeof(hqd->QmfDomainIn[ch].fb)); + } +} + +QMF_DOMAIN_ERROR FDK_QmfDomain_Configure(HANDLE_FDK_QMF_DOMAIN hqd) { + FDK_ASSERT(hqd != NULL); + QMF_DOMAIN_ERROR err = QMF_DOMAIN_OK; + int i, size_main, size, size_temp = 0; + + HANDLE_FDK_QMF_DOMAIN_GC hgc = &hqd->globalConf; + FIXP_DBL **pWorkBuffer = hgc->pWorkBuffer; + + int hasChanged = 0; + + if ((hgc->nQmfProcChannels_requested > 0) && + (hgc->nQmfProcBands_requested != 64)) { + return QMF_DOMAIN_INIT_ERROR; + } + if (hgc->nBandsAnalysis_requested > hgc->nQmfProcBands_requested) { + /* In general the output of the qmf analysis is written to QMF memory slots + which size is defined by nQmfProcBands. nBandsSynthesis may be larger + than nQmfProcBands. This is e.g. the case if the QMF based resampler is + used. + */ + return QMF_DOMAIN_INIT_ERROR; + } + + /* 1. adjust change of processing channels by comparison of current and + * requested parameters */ + if ((hgc->nQmfProcChannels != hgc->nQmfProcChannels_requested) || + (hgc->nQmfProcBands != hgc->nQmfProcBands_requested) || + (hgc->nQmfTimeSlots != hgc->nQmfTimeSlots_requested)) { + for (i = 0; i < hgc->nQmfProcChannels_requested; i++) { + hqd->QmfDomainIn[i].workBuf_nBands = hgc->nQmfProcBands_requested; + hgc->nQmfProcBands = hgc->nQmfProcBands_requested; + + hqd->QmfDomainIn[i].workBuf_nTimeSlots = hgc->nQmfTimeSlots_requested; + } + + hgc->nQmfProcChannels = + hgc->nQmfProcChannels_requested; /* keep highest value encountered so + far as allocated */ + + hasChanged = 1; + } + + /* 2. reallocate persistent memory if necessary (analysis state-buffers, + * timeslot-pointer-array, overlap-buffers, synthesis state-buffers) */ + if ((hgc->nInputChannels != hgc->nInputChannels_requested) || + (hgc->nBandsAnalysis != hgc->nBandsAnalysis_requested) || + (hgc->nQmfTimeSlots != hgc->nQmfTimeSlots_requested) || + (hgc->nQmfOvTimeSlots != hgc->nQmfOvTimeSlots_requested) || + (hgc->nOutputChannels != hgc->nOutputChannels_requested) || + (hgc->nBandsSynthesis != hgc->nBandsSynthesis_requested) || + (hgc->parkChannel != hgc->parkChannel_requested)) { + hgc->nInputChannels = hgc->nInputChannels_requested; + hgc->nBandsAnalysis = hgc->nBandsAnalysis_requested; + hgc->nQmfTimeSlots = hgc->nQmfTimeSlots_requested; + hgc->nQmfOvTimeSlots = hgc->nQmfOvTimeSlots_requested; + hgc->nOutputChannels = hgc->nOutputChannels_requested; + hgc->nBandsSynthesis = hgc->nBandsSynthesis_requested; + hgc->parkChannel = hgc->parkChannel_requested; + + if (FDK_QmfDomain_AllocatePersistentMemory(hqd)) { + err = QMF_DOMAIN_OUT_OF_MEMORY; + goto bail; + } + + /* 3. set request-flag for downsampled SBR */ + if ((hgc->nBandsAnalysis == 32) && (hgc->nBandsSynthesis == 32) && + !(hgc->flags & (QMF_FLAG_CLDFB | QMF_FLAG_MPSLDFB))) { + hgc->flags_requested |= QMF_FLAG_DOWNSAMPLED; + } + + hasChanged = 1; + } + + /* 4. initialize tables and buffer for QMF-resampler */ + + /* 5. set requested flags */ + if (hgc->flags != hgc->flags_requested) { + if ((hgc->flags_requested & QMF_FLAG_MPSLDFB) && + (hgc->flags_requested & QMF_FLAG_CLDFB)) { + hgc->flags_requested &= ~QMF_FLAG_CLDFB; + } + hgc->flags = hgc->flags_requested; + hasChanged = 1; + } + + if (hasChanged) { + /* 6. recalculate and check size of required workbuffer-space */ + + if (hgc->parkChannel && (hqd->globalConf.nQmfProcChannels == 1)) { + /* configure temp QMF buffer for parking right channel MPS212 output, + * (USAC stereoConfigIndex 3 only) */ + hqd->QmfDomainIn[1].workBuf_nBands = hqd->globalConf.nBandsAnalysis; + hqd->QmfDomainIn[1].workBuf_nTimeSlots = hqd->globalConf.nQmfTimeSlots; + size_temp = hqd->QmfDomainIn[1].workBuf_nBands * + hqd->QmfDomainIn[1].workBuf_nTimeSlots * CMPLX_MOD; + } + + size_main = hqd->QmfDomainIn[0].workBuf_nBands * + hqd->QmfDomainIn[0].workBuf_nTimeSlots * CMPLX_MOD; + + size = size_main * hgc->nQmfProcChannels + size_temp; + + if (size > (QMF_MAX_WB_SECTIONS * QMF_WB_SECTION_SIZE)) { + err = QMF_DOMAIN_OUT_OF_MEMORY; + goto bail; + } + + /* 7. allocate additional workbuffer if necessary */ + if ((size > 0 /* *QMF_WB_SECTION_SIZE */) && (pWorkBuffer[0] == NULL)) { + /* get work buffer of size QMF_WB_SECTION_SIZE */ + pWorkBuffer[0] = GetQmfWorkBufferCore6(); + } + + if ((size > 1 * QMF_WB_SECTION_SIZE) && (pWorkBuffer[1] == NULL)) { + /* get work buffer of size QMF_WB_SECTION_SIZE */ + pWorkBuffer[1] = GetQmfWorkBufferCore1(); + } + + if ((size > 2 * QMF_WB_SECTION_SIZE) && (pWorkBuffer[2] == NULL)) { + /* get work buffer of size QMF_WB_SECTION_SIZE */ + pWorkBuffer[2] = GetQmfWorkBufferCore3(); + } + + if ((size > 3 * QMF_WB_SECTION_SIZE) && (pWorkBuffer[3] == NULL)) { + /* get work buffer of size QMF_WB_SECTION_SIZE */ + pWorkBuffer[3] = GetQmfWorkBufferCore4(); + } + + if ((size > 4 * QMF_WB_SECTION_SIZE) && (pWorkBuffer[4] == NULL)) { + /* get work buffer of size QMF_WB_SECTION_SIZE */ + pWorkBuffer[4] = GetQmfWorkBufferCore5(); + } + + /* 8. distribute workbuffer over processing channels */ + for (i = 0; i < hgc->nQmfProcChannels; i++) { + FDK_QmfDomain_FeedWorkBuffer(hqd, i, pWorkBuffer, size_main * i, + QMF_WB_SECTION_SIZE, size_main); + } + if (hgc->parkChannel) { + for (; i < hgc->nInputChannels; i++) { + FDK_QmfDomain_FeedWorkBuffer(hqd, 1, pWorkBuffer, + size_main * hgc->nQmfProcChannels, + QMF_WB_SECTION_SIZE, size_temp); + } + } + + /* 9. (re-)init filterbank */ + for (i = 0; i < hgc->nOutputChannels; i++) { + if ((hqd->QmfDomainOut[i].fb.lsb == 0) && + (hqd->QmfDomainOut[i].fb.usb == 0)) { + /* Although lsb and usb are set in the SBR module, they are initialized + * at this point due to the case of using MPS without SBR. */ + hqd->QmfDomainOut[i].fb.lsb = hgc->nBandsAnalysis_requested; + hqd->QmfDomainOut[i].fb.usb = + fMin((INT)hgc->nBandsSynthesis_requested, 64); + } + } + if (FDK_QmfDomain_InitFilterBank(hqd, 0)) { + err = QMF_DOMAIN_INIT_ERROR; + } + } + +bail: + if (err) { + FDK_QmfDomain_FreeMem(hqd); + } + return err; +} + +static void FDK_QmfDomain_FreeWorkBuffer(HANDLE_FDK_QMF_DOMAIN hqd) { + FIXP_DBL **pWorkBuffer = hqd->globalConf.pWorkBuffer; + + if (pWorkBuffer[0]) FreeQmfWorkBufferCore6(&pWorkBuffer[0]); + if (pWorkBuffer[1]) FreeQmfWorkBufferCore1(&pWorkBuffer[1]); + if (pWorkBuffer[2]) FreeQmfWorkBufferCore3(&pWorkBuffer[2]); + if (pWorkBuffer[3]) FreeQmfWorkBufferCore4(&pWorkBuffer[3]); + if (pWorkBuffer[4]) FreeQmfWorkBufferCore5(&pWorkBuffer[4]); +} + +void FDK_QmfDomain_FreeMem(HANDLE_FDK_QMF_DOMAIN hqd) { + FDK_QmfDomain_FreeWorkBuffer(hqd); + + FDK_QmfDomain_FreePersistentMemory(hqd); + + FDK_QmfDomain_ClearFilterBank(hqd); + + FDK_QmfDomain_ClearConfigured(&hqd->globalConf); + + FDK_QmfDomain_ClearRequested(&hqd->globalConf); +} + +void FDK_QmfDomain_Close(HANDLE_FDK_QMF_DOMAIN hqd) { + FDK_QmfDomain_FreeWorkBuffer(hqd); + + FDK_QmfDomain_FreePersistentMemory(hqd); +} diff --git a/fdk-aac/libFDK/src/FDK_tools_rom.cpp b/fdk-aac/libFDK/src/FDK_tools_rom.cpp new file mode 100644 index 0000000..e9e1206 --- /dev/null +++ b/fdk-aac/libFDK/src/FDK_tools_rom.cpp @@ -0,0 +1,7274 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Oliver Moser + + Description: ROM tables used by FDK tools + +*******************************************************************************/ + +#include "FDK_tools_rom.h" + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STP SineTable80[] = { + STCP(0x7fffffff, 0x00000000), STCP(0x7ff9af04, 0x02835b5a), + STCP(0x7fe6bcb0, 0x05067734), STCP(0x7fc72ae2, 0x07891418), + STCP(0x7f9afcb9, 0x0a0af299), STCP(0x7f62368f, 0x0c8bd35e), + STCP(0x7f1cde01, 0x0f0b7727), STCP(0x7ecaf9e5, 0x11899ed3), + STCP(0x7e6c9251, 0x14060b68), STCP(0x7e01b096, 0x16807e15), + STCP(0x7d8a5f40, 0x18f8b83c), STCP(0x7d06aa16, 0x1b6e7b7a), + STCP(0x7c769e18, 0x1de189a6), STCP(0x7bda497d, 0x2051a4dd), + STCP(0x7b31bbb2, 0x22be8f87), STCP(0x7a7d055b, 0x25280c5e), + STCP(0x79bc384d, 0x278dde6e), STCP(0x78ef678f, 0x29efc925), + STCP(0x7816a759, 0x2c4d9050), STCP(0x77320d0d, 0x2ea6f827), + STCP(0x7641af3d, 0x30fbc54d), STCP(0x7545a5a0, 0x334bbcde), + STCP(0x743e0918, 0x3596a46c), STCP(0x732af3a7, 0x37dc420c), + STCP(0x720c8075, 0x3a1c5c57), STCP(0x70e2cbc6, 0x3c56ba70), + STCP(0x6fadf2fc, 0x3e8b240e), STCP(0x6e6e1492, 0x40b9617d), + STCP(0x6d23501b, 0x42e13ba4), STCP(0x6bcdc639, 0x45027c0c), + STCP(0x6a6d98a4, 0x471cece7), STCP(0x6902ea1d, 0x4930590f), + STCP(0x678dde6e, 0x4b3c8c12), STCP(0x660e9a6a, 0x4d415234), + STCP(0x648543e4, 0x4f3e7875), STCP(0x62f201ac, 0x5133cc94), + STCP(0x6154fb91, 0x53211d18), STCP(0x5fae5a55, 0x55063951), + STCP(0x5dfe47ad, 0x56e2f15d), STCP(0x5c44ee40, 0x58b71632), + STCP(0x5a82799a, 0x5a82799a), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STP SineTable384[] = { + STCP(0x7fffffff, 0x00000000), STCP(0x7fffb9d1, 0x00860a79), + STCP(0x7ffee744, 0x010c1460), STCP(0x7ffd885a, 0x01921d20), + STCP(0x7ffb9d15, 0x02182427), STCP(0x7ff92577, 0x029e28e2), + STCP(0x7ff62182, 0x03242abf), STCP(0x7ff2913a, 0x03aa292a), + STCP(0x7fee74a2, 0x0430238f), STCP(0x7fe9cbc0, 0x04b6195d), + STCP(0x7fe49698, 0x053c0a01), STCP(0x7fded530, 0x05c1f4e7), + STCP(0x7fd8878e, 0x0647d97c), STCP(0x7fd1adb9, 0x06cdb72f), + STCP(0x7fca47b9, 0x07538d6b), STCP(0x7fc25596, 0x07d95b9e), + STCP(0x7fb9d759, 0x085f2137), STCP(0x7fb0cd0a, 0x08e4dda0), + STCP(0x7fa736b4, 0x096a9049), STCP(0x7f9d1461, 0x09f0389f), + STCP(0x7f92661d, 0x0a75d60e), STCP(0x7f872bf3, 0x0afb6805), + STCP(0x7f7b65ef, 0x0b80edf1), STCP(0x7f6f141f, 0x0c066740), + STCP(0x7f62368f, 0x0c8bd35e), STCP(0x7f54cd4f, 0x0d1131ba), + STCP(0x7f46d86c, 0x0d9681c2), STCP(0x7f3857f6, 0x0e1bc2e4), + STCP(0x7f294bfd, 0x0ea0f48c), STCP(0x7f19b491, 0x0f26162a), + STCP(0x7f0991c4, 0x0fab272b), STCP(0x7ef8e3a6, 0x103026fe), + STCP(0x7ee7aa4c, 0x10b5150f), STCP(0x7ed5e5c6, 0x1139f0cf), + STCP(0x7ec3962a, 0x11beb9aa), STCP(0x7eb0bb8a, 0x12436f10), + STCP(0x7e9d55fc, 0x12c8106f), STCP(0x7e896595, 0x134c9d34), + STCP(0x7e74ea6a, 0x13d114d0), STCP(0x7e5fe493, 0x145576b1), + STCP(0x7e4a5426, 0x14d9c245), STCP(0x7e34393b, 0x155df6fc), + STCP(0x7e1d93ea, 0x15e21445), STCP(0x7e06644c, 0x1666198d), + STCP(0x7deeaa7a, 0x16ea0646), STCP(0x7dd6668f, 0x176dd9de), + STCP(0x7dbd98a4, 0x17f193c5), STCP(0x7da440d6, 0x1875336a), + STCP(0x7d8a5f40, 0x18f8b83c), STCP(0x7d6ff3fe, 0x197c21ad), + STCP(0x7d54ff2e, 0x19ff6f2a), STCP(0x7d3980ec, 0x1a82a026), + STCP(0x7d1d7958, 0x1b05b40f), STCP(0x7d00e88f, 0x1b88aa55), + STCP(0x7ce3ceb2, 0x1c0b826a), STCP(0x7cc62bdf, 0x1c8e3bbe), + STCP(0x7ca80038, 0x1d10d5c2), STCP(0x7c894bde, 0x1d934fe5), + STCP(0x7c6a0ef2, 0x1e15a99a), STCP(0x7c4a4996, 0x1e97e251), + STCP(0x7c29fbee, 0x1f19f97b), STCP(0x7c09261d, 0x1f9bee8a), + STCP(0x7be7c847, 0x201dc0ef), STCP(0x7bc5e290, 0x209f701c), + STCP(0x7ba3751d, 0x2120fb83), STCP(0x7b808015, 0x21a26295), + STCP(0x7b5d039e, 0x2223a4c5), STCP(0x7b38ffde, 0x22a4c185), + STCP(0x7b1474fd, 0x2325b847), STCP(0x7aef6323, 0x23a6887f), + STCP(0x7ac9ca7a, 0x2427319d), STCP(0x7aa3ab29, 0x24a7b317), + STCP(0x7a7d055b, 0x25280c5e), STCP(0x7a55d93a, 0x25a83ce6), + STCP(0x7a2e26f2, 0x26284422), STCP(0x7a05eead, 0x26a82186), + STCP(0x79dd3098, 0x2727d486), STCP(0x79b3ece0, 0x27a75c95), + STCP(0x798a23b1, 0x2826b928), STCP(0x795fd53a, 0x28a5e9b4), + STCP(0x793501a9, 0x2924edac), STCP(0x7909a92d, 0x29a3c485), + STCP(0x78ddcbf5, 0x2a226db5), STCP(0x78b16a32, 0x2aa0e8b0), + STCP(0x78848414, 0x2b1f34eb), STCP(0x785719cc, 0x2b9d51dd), + STCP(0x78292b8d, 0x2c1b3efb), STCP(0x77fab989, 0x2c98fbba), + STCP(0x77cbc3f2, 0x2d168792), STCP(0x779c4afc, 0x2d93e1f8), + STCP(0x776c4edb, 0x2e110a62), STCP(0x773bcfc4, 0x2e8e0048), + STCP(0x770acdec, 0x2f0ac320), STCP(0x76d94989, 0x2f875262), + STCP(0x76a742d1, 0x3003ad85), STCP(0x7674b9fa, 0x307fd401), + STCP(0x7641af3d, 0x30fbc54d), STCP(0x760e22d1, 0x317780e2), + STCP(0x75da14ef, 0x31f30638), STCP(0x75a585cf, 0x326e54c7), + STCP(0x757075ac, 0x32e96c09), STCP(0x753ae4c0, 0x33644b76), + STCP(0x7504d345, 0x33def287), STCP(0x74ce4177, 0x345960b7), + STCP(0x74972f92, 0x34d3957e), STCP(0x745f9dd1, 0x354d9057), + STCP(0x74278c72, 0x35c750bc), STCP(0x73eefbb3, 0x3640d627), + STCP(0x73b5ebd1, 0x36ba2014), STCP(0x737c5d0b, 0x37332dfd), + STCP(0x73424fa0, 0x37abff5d), STCP(0x7307c3d0, 0x382493b0), + STCP(0x72ccb9db, 0x389cea72), STCP(0x72913201, 0x3915031f), + STCP(0x72552c85, 0x398cdd32), STCP(0x7218a9a7, 0x3a04782a), + STCP(0x71dba9ab, 0x3a7bd382), STCP(0x719e2cd2, 0x3af2eeb7), + STCP(0x71603361, 0x3b69c947), STCP(0x7121bd9c, 0x3be062b0), + STCP(0x70e2cbc6, 0x3c56ba70), STCP(0x70a35e25, 0x3cccd004), + STCP(0x706374ff, 0x3d42a2ec), STCP(0x7023109a, 0x3db832a6), + STCP(0x6fe2313c, 0x3e2d7eb1), STCP(0x6fa0d72c, 0x3ea2868c), + STCP(0x6f5f02b2, 0x3f1749b8), STCP(0x6f1cb416, 0x3f8bc7b4), + STCP(0x6ed9eba1, 0x40000000), STCP(0x6e96a99d, 0x4073f21d), + STCP(0x6e52ee52, 0x40e79d8c), STCP(0x6e0eba0c, 0x415b01ce), + STCP(0x6dca0d14, 0x41ce1e65), STCP(0x6d84e7b7, 0x4240f2d1), + STCP(0x6d3f4a40, 0x42b37e96), STCP(0x6cf934fc, 0x4325c135), + STCP(0x6cb2a837, 0x4397ba32), STCP(0x6c6ba43e, 0x44096910), + STCP(0x6c242960, 0x447acd50), STCP(0x6bdc37eb, 0x44ebe679), + STCP(0x6b93d02e, 0x455cb40c), STCP(0x6b4af279, 0x45cd358f), + STCP(0x6b019f1a, 0x463d6a87), STCP(0x6ab7d663, 0x46ad5278), + STCP(0x6a6d98a4, 0x471cece7), STCP(0x6a22e630, 0x478c395a), + STCP(0x69d7bf57, 0x47fb3757), STCP(0x698c246c, 0x4869e665), + STCP(0x694015c3, 0x48d84609), STCP(0x68f393ae, 0x494655cc), + STCP(0x68a69e81, 0x49b41533), STCP(0x68593691, 0x4a2183c8), + STCP(0x680b5c33, 0x4a8ea111), STCP(0x67bd0fbd, 0x4afb6c98), + STCP(0x676e5183, 0x4b67e5e4), STCP(0x671f21dc, 0x4bd40c80), + STCP(0x66cf8120, 0x4c3fdff4), STCP(0x667f6fa5, 0x4cab5fc9), + STCP(0x662eedc3, 0x4d168b8b), STCP(0x65ddfbd3, 0x4d8162c4), + STCP(0x658c9a2d, 0x4debe4fe), STCP(0x653ac92b, 0x4e5611c5), + STCP(0x64e88926, 0x4ebfe8a5), STCP(0x6495da79, 0x4f296928), + STCP(0x6442bd7e, 0x4f9292dc), STCP(0x63ef3290, 0x4ffb654d), + STCP(0x639b3a0b, 0x5063e008), STCP(0x6346d44b, 0x50cc029c), + STCP(0x62f201ac, 0x5133cc94), STCP(0x629cc28c, 0x519b3d80), + STCP(0x62471749, 0x520254ef), STCP(0x61f1003f, 0x5269126e), + STCP(0x619a7dce, 0x52cf758f), STCP(0x61439053, 0x53357ddf), + STCP(0x60ec3830, 0x539b2af0), STCP(0x609475c3, 0x54007c51), + STCP(0x603c496c, 0x54657194), STCP(0x5fe3b38d, 0x54ca0a4b), + STCP(0x5f8ab487, 0x552e4605), STCP(0x5f314cba, 0x55922457), + STCP(0x5ed77c8a, 0x55f5a4d2), STCP(0x5e7d4458, 0x5658c709), + STCP(0x5e22a487, 0x56bb8a90), STCP(0x5dc79d7c, 0x571deefa), + STCP(0x5d6c2f99, 0x577ff3da), STCP(0x5d105b44, 0x57e198c7), + STCP(0x5cb420e0, 0x5842dd54), STCP(0x5c5780d3, 0x58a3c118), + STCP(0x5bfa7b82, 0x590443a7), STCP(0x5b9d1154, 0x59646498), + STCP(0x5b3f42ae, 0x59c42381), STCP(0x5ae10ff9, 0x5a237ffa), + STCP(0x5a82799a, 0x5a82799a), +}; + +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 +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), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STP SineTable1024[] = { + STCP(0x7fffffff, 0x00000000), STCP(0x7ffff621, 0x003243f5), + STCP(0x7fffd886, 0x006487e3), STCP(0x7fffa72c, 0x0096cbc1), + STCP(0x7fff6216, 0x00c90f88), STCP(0x7fff0943, 0x00fb5330), + STCP(0x7ffe9cb2, 0x012d96b1), STCP(0x7ffe1c65, 0x015fda03), + STCP(0x7ffd885a, 0x01921d20), STCP(0x7ffce093, 0x01c45ffe), + STCP(0x7ffc250f, 0x01f6a297), STCP(0x7ffb55ce, 0x0228e4e2), + STCP(0x7ffa72d1, 0x025b26d7), STCP(0x7ff97c18, 0x028d6870), + STCP(0x7ff871a2, 0x02bfa9a4), STCP(0x7ff75370, 0x02f1ea6c), + STCP(0x7ff62182, 0x03242abf), STCP(0x7ff4dbd9, 0x03566a96), + STCP(0x7ff38274, 0x0388a9ea), STCP(0x7ff21553, 0x03bae8b2), + STCP(0x7ff09478, 0x03ed26e6), STCP(0x7feeffe1, 0x041f6480), + STCP(0x7fed5791, 0x0451a177), STCP(0x7feb9b85, 0x0483ddc3), + STCP(0x7fe9cbc0, 0x04b6195d), STCP(0x7fe7e841, 0x04e8543e), + STCP(0x7fe5f108, 0x051a8e5c), STCP(0x7fe3e616, 0x054cc7b1), + STCP(0x7fe1c76b, 0x057f0035), STCP(0x7fdf9508, 0x05b137df), + STCP(0x7fdd4eec, 0x05e36ea9), STCP(0x7fdaf519, 0x0615a48b), + STCP(0x7fd8878e, 0x0647d97c), STCP(0x7fd6064c, 0x067a0d76), + STCP(0x7fd37153, 0x06ac406f), STCP(0x7fd0c8a3, 0x06de7262), + STCP(0x7fce0c3e, 0x0710a345), STCP(0x7fcb3c23, 0x0742d311), + STCP(0x7fc85854, 0x077501be), STCP(0x7fc560cf, 0x07a72f45), + STCP(0x7fc25596, 0x07d95b9e), STCP(0x7fbf36aa, 0x080b86c2), + STCP(0x7fbc040a, 0x083db0a7), STCP(0x7fb8bdb8, 0x086fd947), + STCP(0x7fb563b3, 0x08a2009a), STCP(0x7fb1f5fc, 0x08d42699), + STCP(0x7fae7495, 0x09064b3a), STCP(0x7faadf7c, 0x09386e78), + STCP(0x7fa736b4, 0x096a9049), STCP(0x7fa37a3c, 0x099cb0a7), + STCP(0x7f9faa15, 0x09cecf89), STCP(0x7f9bc640, 0x0a00ece8), + STCP(0x7f97cebd, 0x0a3308bd), STCP(0x7f93c38c, 0x0a6522fe), + STCP(0x7f8fa4b0, 0x0a973ba5), STCP(0x7f8b7227, 0x0ac952aa), + STCP(0x7f872bf3, 0x0afb6805), STCP(0x7f82d214, 0x0b2d7baf), + STCP(0x7f7e648c, 0x0b5f8d9f), STCP(0x7f79e35a, 0x0b919dcf), + STCP(0x7f754e80, 0x0bc3ac35), STCP(0x7f70a5fe, 0x0bf5b8cb), + STCP(0x7f6be9d4, 0x0c27c389), STCP(0x7f671a05, 0x0c59cc68), + STCP(0x7f62368f, 0x0c8bd35e), STCP(0x7f5d3f75, 0x0cbdd865), + STCP(0x7f5834b7, 0x0cefdb76), STCP(0x7f531655, 0x0d21dc87), + STCP(0x7f4de451, 0x0d53db92), STCP(0x7f489eaa, 0x0d85d88f), + STCP(0x7f434563, 0x0db7d376), STCP(0x7f3dd87c, 0x0de9cc40), + STCP(0x7f3857f6, 0x0e1bc2e4), STCP(0x7f32c3d1, 0x0e4db75b), + STCP(0x7f2d1c0e, 0x0e7fa99e), STCP(0x7f2760af, 0x0eb199a4), + STCP(0x7f2191b4, 0x0ee38766), STCP(0x7f1baf1e, 0x0f1572dc), + STCP(0x7f15b8ee, 0x0f475bff), STCP(0x7f0faf25, 0x0f7942c7), + STCP(0x7f0991c4, 0x0fab272b), STCP(0x7f0360cb, 0x0fdd0926), + STCP(0x7efd1c3c, 0x100ee8ad), STCP(0x7ef6c418, 0x1040c5bb), + STCP(0x7ef05860, 0x1072a048), STCP(0x7ee9d914, 0x10a4784b), + STCP(0x7ee34636, 0x10d64dbd), STCP(0x7edc9fc6, 0x11082096), + STCP(0x7ed5e5c6, 0x1139f0cf), STCP(0x7ecf1837, 0x116bbe60), + STCP(0x7ec8371a, 0x119d8941), STCP(0x7ec14270, 0x11cf516a), + STCP(0x7eba3a39, 0x120116d5), STCP(0x7eb31e78, 0x1232d979), + STCP(0x7eabef2c, 0x1264994e), STCP(0x7ea4ac58, 0x1296564d), + STCP(0x7e9d55fc, 0x12c8106f), STCP(0x7e95ec1a, 0x12f9c7aa), + STCP(0x7e8e6eb2, 0x132b7bf9), STCP(0x7e86ddc6, 0x135d2d53), + STCP(0x7e7f3957, 0x138edbb1), STCP(0x7e778166, 0x13c0870a), + STCP(0x7e6fb5f4, 0x13f22f58), STCP(0x7e67d703, 0x1423d492), + STCP(0x7e5fe493, 0x145576b1), STCP(0x7e57dea7, 0x148715ae), + STCP(0x7e4fc53e, 0x14b8b17f), STCP(0x7e47985b, 0x14ea4a1f), + STCP(0x7e3f57ff, 0x151bdf86), STCP(0x7e37042a, 0x154d71aa), + STCP(0x7e2e9cdf, 0x157f0086), STCP(0x7e26221f, 0x15b08c12), + STCP(0x7e1d93ea, 0x15e21445), STCP(0x7e14f242, 0x16139918), + STCP(0x7e0c3d29, 0x16451a83), STCP(0x7e0374a0, 0x1676987f), + STCP(0x7dfa98a8, 0x16a81305), STCP(0x7df1a942, 0x16d98a0c), + STCP(0x7de8a670, 0x170afd8d), STCP(0x7ddf9034, 0x173c6d80), + STCP(0x7dd6668f, 0x176dd9de), STCP(0x7dcd2981, 0x179f429f), + STCP(0x7dc3d90d, 0x17d0a7bc), STCP(0x7dba7534, 0x1802092c), + STCP(0x7db0fdf8, 0x183366e9), STCP(0x7da77359, 0x1864c0ea), + STCP(0x7d9dd55a, 0x18961728), STCP(0x7d9423fc, 0x18c7699b), + STCP(0x7d8a5f40, 0x18f8b83c), STCP(0x7d808728, 0x192a0304), + STCP(0x7d769bb5, 0x195b49ea), STCP(0x7d6c9ce9, 0x198c8ce7), + STCP(0x7d628ac6, 0x19bdcbf3), STCP(0x7d58654d, 0x19ef0707), + STCP(0x7d4e2c7f, 0x1a203e1b), STCP(0x7d43e05e, 0x1a517128), + STCP(0x7d3980ec, 0x1a82a026), STCP(0x7d2f0e2b, 0x1ab3cb0d), + STCP(0x7d24881b, 0x1ae4f1d6), STCP(0x7d19eebf, 0x1b161479), + STCP(0x7d0f4218, 0x1b4732ef), STCP(0x7d048228, 0x1b784d30), + STCP(0x7cf9aef0, 0x1ba96335), STCP(0x7ceec873, 0x1bda74f6), + STCP(0x7ce3ceb2, 0x1c0b826a), STCP(0x7cd8c1ae, 0x1c3c8b8c), + STCP(0x7ccda169, 0x1c6d9053), STCP(0x7cc26de5, 0x1c9e90b8), + STCP(0x7cb72724, 0x1ccf8cb3), STCP(0x7cabcd28, 0x1d00843d), + STCP(0x7ca05ff1, 0x1d31774d), STCP(0x7c94df83, 0x1d6265dd), + STCP(0x7c894bde, 0x1d934fe5), STCP(0x7c7da505, 0x1dc4355e), + STCP(0x7c71eaf9, 0x1df5163f), STCP(0x7c661dbc, 0x1e25f282), + STCP(0x7c5a3d50, 0x1e56ca1e), STCP(0x7c4e49b7, 0x1e879d0d), + STCP(0x7c4242f2, 0x1eb86b46), STCP(0x7c362904, 0x1ee934c3), + STCP(0x7c29fbee, 0x1f19f97b), STCP(0x7c1dbbb3, 0x1f4ab968), + STCP(0x7c116853, 0x1f7b7481), STCP(0x7c0501d2, 0x1fac2abf), + STCP(0x7bf88830, 0x1fdcdc1b), STCP(0x7bebfb70, 0x200d888d), + STCP(0x7bdf5b94, 0x203e300d), STCP(0x7bd2a89e, 0x206ed295), + STCP(0x7bc5e290, 0x209f701c), STCP(0x7bb9096b, 0x20d0089c), + STCP(0x7bac1d31, 0x21009c0c), STCP(0x7b9f1de6, 0x21312a65), + STCP(0x7b920b89, 0x2161b3a0), STCP(0x7b84e61f, 0x219237b5), + STCP(0x7b77ada8, 0x21c2b69c), STCP(0x7b6a6227, 0x21f3304f), + STCP(0x7b5d039e, 0x2223a4c5), STCP(0x7b4f920e, 0x225413f8), + STCP(0x7b420d7a, 0x22847de0), STCP(0x7b3475e5, 0x22b4e274), + STCP(0x7b26cb4f, 0x22e541af), STCP(0x7b190dbc, 0x23159b88), + STCP(0x7b0b3d2c, 0x2345eff8), STCP(0x7afd59a4, 0x23763ef7), + STCP(0x7aef6323, 0x23a6887f), STCP(0x7ae159ae, 0x23d6cc87), + STCP(0x7ad33d45, 0x24070b08), STCP(0x7ac50dec, 0x243743fa), + STCP(0x7ab6cba4, 0x24677758), STCP(0x7aa8766f, 0x2497a517), + STCP(0x7a9a0e50, 0x24c7cd33), STCP(0x7a8b9348, 0x24f7efa2), + STCP(0x7a7d055b, 0x25280c5e), STCP(0x7a6e648a, 0x2558235f), + STCP(0x7a5fb0d8, 0x2588349d), STCP(0x7a50ea47, 0x25b84012), + STCP(0x7a4210d8, 0x25e845b6), STCP(0x7a332490, 0x26184581), + STCP(0x7a24256f, 0x26483f6c), STCP(0x7a151378, 0x26783370), + STCP(0x7a05eead, 0x26a82186), STCP(0x79f6b711, 0x26d809a5), + STCP(0x79e76ca7, 0x2707ebc7), STCP(0x79d80f6f, 0x2737c7e3), + STCP(0x79c89f6e, 0x27679df4), STCP(0x79b91ca4, 0x27976df1), + STCP(0x79a98715, 0x27c737d3), STCP(0x7999dec4, 0x27f6fb92), + STCP(0x798a23b1, 0x2826b928), STCP(0x797a55e0, 0x2856708d), + STCP(0x796a7554, 0x288621b9), STCP(0x795a820e, 0x28b5cca5), + STCP(0x794a7c12, 0x28e5714b), STCP(0x793a6361, 0x29150fa1), + STCP(0x792a37fe, 0x2944a7a2), STCP(0x7919f9ec, 0x29743946), + STCP(0x7909a92d, 0x29a3c485), STCP(0x78f945c3, 0x29d34958), + STCP(0x78e8cfb2, 0x2a02c7b8), STCP(0x78d846fb, 0x2a323f9e), + STCP(0x78c7aba2, 0x2a61b101), STCP(0x78b6fda8, 0x2a911bdc), + STCP(0x78a63d11, 0x2ac08026), STCP(0x789569df, 0x2aefddd8), + STCP(0x78848414, 0x2b1f34eb), STCP(0x78738bb3, 0x2b4e8558), + STCP(0x786280bf, 0x2b7dcf17), STCP(0x7851633b, 0x2bad1221), + STCP(0x78403329, 0x2bdc4e6f), STCP(0x782ef08b, 0x2c0b83fa), + STCP(0x781d9b65, 0x2c3ab2b9), STCP(0x780c33b8, 0x2c69daa6), + STCP(0x77fab989, 0x2c98fbba), STCP(0x77e92cd9, 0x2cc815ee), + STCP(0x77d78daa, 0x2cf72939), STCP(0x77c5dc01, 0x2d263596), + STCP(0x77b417df, 0x2d553afc), STCP(0x77a24148, 0x2d843964), + STCP(0x7790583e, 0x2db330c7), STCP(0x777e5cc3, 0x2de2211e), + STCP(0x776c4edb, 0x2e110a62), STCP(0x775a2e89, 0x2e3fec8b), + STCP(0x7747fbce, 0x2e6ec792), STCP(0x7735b6af, 0x2e9d9b70), + STCP(0x77235f2d, 0x2ecc681e), STCP(0x7710f54c, 0x2efb2d95), + STCP(0x76fe790e, 0x2f29ebcc), STCP(0x76ebea77, 0x2f58a2be), + STCP(0x76d94989, 0x2f875262), STCP(0x76c69647, 0x2fb5fab2), + STCP(0x76b3d0b4, 0x2fe49ba7), STCP(0x76a0f8d2, 0x30133539), + STCP(0x768e0ea6, 0x3041c761), STCP(0x767b1231, 0x30705217), + STCP(0x76680376, 0x309ed556), STCP(0x7654e279, 0x30cd5115), + STCP(0x7641af3d, 0x30fbc54d), STCP(0x762e69c4, 0x312a31f8), + STCP(0x761b1211, 0x3158970e), STCP(0x7607a828, 0x3186f487), + STCP(0x75f42c0b, 0x31b54a5e), STCP(0x75e09dbd, 0x31e39889), + STCP(0x75ccfd42, 0x3211df04), STCP(0x75b94a9c, 0x32401dc6), + STCP(0x75a585cf, 0x326e54c7), STCP(0x7591aedd, 0x329c8402), + STCP(0x757dc5ca, 0x32caab6f), STCP(0x7569ca99, 0x32f8cb07), + STCP(0x7555bd4c, 0x3326e2c3), STCP(0x75419de7, 0x3354f29b), + STCP(0x752d6c6c, 0x3382fa88), STCP(0x751928e0, 0x33b0fa84), + STCP(0x7504d345, 0x33def287), STCP(0x74f06b9e, 0x340ce28b), + STCP(0x74dbf1ef, 0x343aca87), STCP(0x74c7663a, 0x3468aa76), + STCP(0x74b2c884, 0x34968250), STCP(0x749e18cd, 0x34c4520d), + STCP(0x7489571c, 0x34f219a8), STCP(0x74748371, 0x351fd918), + STCP(0x745f9dd1, 0x354d9057), STCP(0x744aa63f, 0x357b3f5d), + STCP(0x74359cbd, 0x35a8e625), STCP(0x74208150, 0x35d684a6), + STCP(0x740b53fb, 0x36041ad9), STCP(0x73f614c0, 0x3631a8b8), + STCP(0x73e0c3a3, 0x365f2e3b), STCP(0x73cb60a8, 0x368cab5c), + STCP(0x73b5ebd1, 0x36ba2014), STCP(0x73a06522, 0x36e78c5b), + STCP(0x738acc9e, 0x3714f02a), STCP(0x73752249, 0x37424b7b), + STCP(0x735f6626, 0x376f9e46), STCP(0x73499838, 0x379ce885), + STCP(0x7333b883, 0x37ca2a30), STCP(0x731dc70a, 0x37f76341), + STCP(0x7307c3d0, 0x382493b0), STCP(0x72f1aed9, 0x3851bb77), + STCP(0x72db8828, 0x387eda8e), STCP(0x72c54fc1, 0x38abf0ef), + STCP(0x72af05a7, 0x38d8fe93), STCP(0x7298a9dd, 0x39060373), + STCP(0x72823c67, 0x3932ff87), STCP(0x726bbd48, 0x395ff2c9), + STCP(0x72552c85, 0x398cdd32), STCP(0x723e8a20, 0x39b9bebc), + STCP(0x7227d61c, 0x39e6975e), STCP(0x7211107e, 0x3a136712), + STCP(0x71fa3949, 0x3a402dd2), STCP(0x71e35080, 0x3a6ceb96), + STCP(0x71cc5626, 0x3a99a057), STCP(0x71b54a41, 0x3ac64c0f), + STCP(0x719e2cd2, 0x3af2eeb7), STCP(0x7186fdde, 0x3b1f8848), + STCP(0x716fbd68, 0x3b4c18ba), STCP(0x71586b74, 0x3b78a007), + STCP(0x71410805, 0x3ba51e29), STCP(0x7129931f, 0x3bd19318), + STCP(0x71120cc5, 0x3bfdfecd), STCP(0x70fa74fc, 0x3c2a6142), + STCP(0x70e2cbc6, 0x3c56ba70), STCP(0x70cb1128, 0x3c830a50), + STCP(0x70b34525, 0x3caf50da), STCP(0x709b67c0, 0x3cdb8e09), + STCP(0x708378ff, 0x3d07c1d6), STCP(0x706b78e3, 0x3d33ec39), + STCP(0x70536771, 0x3d600d2c), STCP(0x703b44ad, 0x3d8c24a8), + STCP(0x7023109a, 0x3db832a6), STCP(0x700acb3c, 0x3de4371f), + STCP(0x6ff27497, 0x3e10320d), STCP(0x6fda0cae, 0x3e3c2369), + STCP(0x6fc19385, 0x3e680b2c), STCP(0x6fa90921, 0x3e93e950), + STCP(0x6f906d84, 0x3ebfbdcd), STCP(0x6f77c0b3, 0x3eeb889c), + STCP(0x6f5f02b2, 0x3f1749b8), STCP(0x6f463383, 0x3f430119), + STCP(0x6f2d532c, 0x3f6eaeb8), STCP(0x6f1461b0, 0x3f9a5290), + STCP(0x6efb5f12, 0x3fc5ec98), STCP(0x6ee24b57, 0x3ff17cca), + STCP(0x6ec92683, 0x401d0321), STCP(0x6eaff099, 0x40487f94), + STCP(0x6e96a99d, 0x4073f21d), STCP(0x6e7d5193, 0x409f5ab6), + STCP(0x6e63e87f, 0x40cab958), STCP(0x6e4a6e66, 0x40f60dfb), + STCP(0x6e30e34a, 0x4121589b), STCP(0x6e174730, 0x414c992f), + STCP(0x6dfd9a1c, 0x4177cfb1), STCP(0x6de3dc11, 0x41a2fc1a), + STCP(0x6dca0d14, 0x41ce1e65), STCP(0x6db02d29, 0x41f93689), + STCP(0x6d963c54, 0x42244481), STCP(0x6d7c3a98, 0x424f4845), + STCP(0x6d6227fa, 0x427a41d0), STCP(0x6d48047e, 0x42a5311b), + STCP(0x6d2dd027, 0x42d0161e), STCP(0x6d138afb, 0x42faf0d4), + STCP(0x6cf934fc, 0x4325c135), STCP(0x6cdece2f, 0x4350873c), + STCP(0x6cc45698, 0x437b42e1), STCP(0x6ca9ce3b, 0x43a5f41e), + STCP(0x6c8f351c, 0x43d09aed), STCP(0x6c748b3f, 0x43fb3746), + STCP(0x6c59d0a9, 0x4425c923), STCP(0x6c3f055d, 0x4450507e), + STCP(0x6c242960, 0x447acd50), STCP(0x6c093cb6, 0x44a53f93), + STCP(0x6bee3f62, 0x44cfa740), STCP(0x6bd3316a, 0x44fa0450), + STCP(0x6bb812d1, 0x452456bd), STCP(0x6b9ce39b, 0x454e9e80), + STCP(0x6b81a3cd, 0x4578db93), STCP(0x6b66536b, 0x45a30df0), + STCP(0x6b4af279, 0x45cd358f), STCP(0x6b2f80fb, 0x45f7526b), + STCP(0x6b13fef5, 0x4621647d), STCP(0x6af86c6c, 0x464b6bbe), + STCP(0x6adcc964, 0x46756828), STCP(0x6ac115e2, 0x469f59b4), + STCP(0x6aa551e9, 0x46c9405c), STCP(0x6a897d7d, 0x46f31c1a), + STCP(0x6a6d98a4, 0x471cece7), STCP(0x6a51a361, 0x4746b2bc), + STCP(0x6a359db9, 0x47706d93), STCP(0x6a1987b0, 0x479a1d67), + STCP(0x69fd614a, 0x47c3c22f), STCP(0x69e12a8c, 0x47ed5be6), + STCP(0x69c4e37a, 0x4816ea86), STCP(0x69a88c19, 0x48406e08), + STCP(0x698c246c, 0x4869e665), STCP(0x696fac78, 0x48935397), + STCP(0x69532442, 0x48bcb599), STCP(0x69368bce, 0x48e60c62), + STCP(0x6919e320, 0x490f57ee), STCP(0x68fd2a3d, 0x49389836), + STCP(0x68e06129, 0x4961cd33), STCP(0x68c387e9, 0x498af6df), + STCP(0x68a69e81, 0x49b41533), STCP(0x6889a4f6, 0x49dd282a), + STCP(0x686c9b4b, 0x4a062fbd), STCP(0x684f8186, 0x4a2f2be6), + STCP(0x683257ab, 0x4a581c9e), STCP(0x68151dbe, 0x4a8101de), + STCP(0x67f7d3c5, 0x4aa9dba2), STCP(0x67da79c3, 0x4ad2a9e2), + STCP(0x67bd0fbd, 0x4afb6c98), STCP(0x679f95b7, 0x4b2423be), + STCP(0x67820bb7, 0x4b4ccf4d), STCP(0x676471c0, 0x4b756f40), + STCP(0x6746c7d8, 0x4b9e0390), STCP(0x67290e02, 0x4bc68c36), + STCP(0x670b4444, 0x4bef092d), STCP(0x66ed6aa1, 0x4c177a6e), + STCP(0x66cf8120, 0x4c3fdff4), STCP(0x66b187c3, 0x4c6839b7), + STCP(0x66937e91, 0x4c9087b1), STCP(0x6675658c, 0x4cb8c9dd), + STCP(0x66573cbb, 0x4ce10034), STCP(0x66390422, 0x4d092ab0), + STCP(0x661abbc5, 0x4d31494b), STCP(0x65fc63a9, 0x4d595bfe), + STCP(0x65ddfbd3, 0x4d8162c4), STCP(0x65bf8447, 0x4da95d96), + STCP(0x65a0fd0b, 0x4dd14c6e), STCP(0x65826622, 0x4df92f46), + STCP(0x6563bf92, 0x4e210617), STCP(0x6545095f, 0x4e48d0dd), + STCP(0x6526438f, 0x4e708f8f), STCP(0x65076e25, 0x4e984229), + STCP(0x64e88926, 0x4ebfe8a5), STCP(0x64c99498, 0x4ee782fb), + STCP(0x64aa907f, 0x4f0f1126), STCP(0x648b7ce0, 0x4f369320), + STCP(0x646c59bf, 0x4f5e08e3), STCP(0x644d2722, 0x4f857269), + STCP(0x642de50d, 0x4faccfab), STCP(0x640e9386, 0x4fd420a4), + STCP(0x63ef3290, 0x4ffb654d), STCP(0x63cfc231, 0x50229da1), + STCP(0x63b0426d, 0x5049c999), STCP(0x6390b34a, 0x5070e92f), + STCP(0x637114cc, 0x5097fc5e), STCP(0x635166f9, 0x50bf031f), + STCP(0x6331a9d4, 0x50e5fd6d), STCP(0x6311dd64, 0x510ceb40), + STCP(0x62f201ac, 0x5133cc94), STCP(0x62d216b3, 0x515aa162), + STCP(0x62b21c7b, 0x518169a5), STCP(0x6292130c, 0x51a82555), + STCP(0x6271fa69, 0x51ced46e), STCP(0x6251d298, 0x51f576ea), + STCP(0x62319b9d, 0x521c0cc2), STCP(0x6211557e, 0x524295f0), + STCP(0x61f1003f, 0x5269126e), STCP(0x61d09be5, 0x528f8238), + STCP(0x61b02876, 0x52b5e546), STCP(0x618fa5f7, 0x52dc3b92), + STCP(0x616f146c, 0x53028518), STCP(0x614e73da, 0x5328c1d0), + STCP(0x612dc447, 0x534ef1b5), STCP(0x610d05b7, 0x537514c2), + STCP(0x60ec3830, 0x539b2af0), STCP(0x60cb5bb7, 0x53c13439), + STCP(0x60aa7050, 0x53e73097), STCP(0x60897601, 0x540d2005), + STCP(0x60686ccf, 0x5433027d), STCP(0x604754bf, 0x5458d7f9), + STCP(0x60262dd6, 0x547ea073), STCP(0x6004f819, 0x54a45be6), + STCP(0x5fe3b38d, 0x54ca0a4b), STCP(0x5fc26038, 0x54efab9c), + STCP(0x5fa0fe1f, 0x55153fd4), STCP(0x5f7f8d46, 0x553ac6ee), + STCP(0x5f5e0db3, 0x556040e2), STCP(0x5f3c7f6b, 0x5585adad), + STCP(0x5f1ae274, 0x55ab0d46), STCP(0x5ef936d1, 0x55d05faa), + STCP(0x5ed77c8a, 0x55f5a4d2), STCP(0x5eb5b3a2, 0x561adcb9), + STCP(0x5e93dc1f, 0x56400758), STCP(0x5e71f606, 0x566524aa), + STCP(0x5e50015d, 0x568a34a9), STCP(0x5e2dfe29, 0x56af3750), + STCP(0x5e0bec6e, 0x56d42c99), STCP(0x5de9cc33, 0x56f9147e), + STCP(0x5dc79d7c, 0x571deefa), STCP(0x5da5604f, 0x5742bc06), + STCP(0x5d8314b1, 0x57677b9d), STCP(0x5d60baa7, 0x578c2dba), + STCP(0x5d3e5237, 0x57b0d256), STCP(0x5d1bdb65, 0x57d5696d), + STCP(0x5cf95638, 0x57f9f2f8), STCP(0x5cd6c2b5, 0x581e6ef1), + STCP(0x5cb420e0, 0x5842dd54), STCP(0x5c9170bf, 0x58673e1b), + STCP(0x5c6eb258, 0x588b9140), STCP(0x5c4be5b0, 0x58afd6bd), + STCP(0x5c290acc, 0x58d40e8c), STCP(0x5c0621b2, 0x58f838a9), + STCP(0x5be32a67, 0x591c550e), STCP(0x5bc024f0, 0x594063b5), + STCP(0x5b9d1154, 0x59646498), STCP(0x5b79ef96, 0x598857b2), + STCP(0x5b56bfbd, 0x59ac3cfd), STCP(0x5b3381ce, 0x59d01475), + STCP(0x5b1035cf, 0x59f3de12), STCP(0x5aecdbc5, 0x5a1799d1), + STCP(0x5ac973b5, 0x5a3b47ab), STCP(0x5aa5fda5, 0x5a5ee79a), + STCP(0x5a82799a, 0x5a82799a), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal6[] = { + STC(0x40000000), + STC(0xc0000000), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag6[] = { + STC(0x6ed9eba1), + STC(0x6ed9eba1), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal12[] = { + STC(0x6ed9eba1), + STC(0x40000000), + STC(0x40000000), + STC(0xc0000000), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag12[] = { + STC(0x40000000), + STC(0x6ed9eba1), + STC(0x6ed9eba1), + STC(0x6ed9eba1), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal24[] = { + STC(0x7ba3751d), STC(0x6ed9eba1), STC(0x5a82799a), STC(0x40000000), + STC(0x2120fb83), STC(0x00000000), STC(0xdedf047d), STC(0xc0000000), + STC(0xa57d8666), STC(0x9126145f), STC(0x845c8ae3), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag24[] = { + STC(0x2120fb83), STC(0x40000000), STC(0x5a82799a), STC(0x6ed9eba1), + STC(0x7ba3751d), STC(0x7fffffff), STC(0x7ba3751d), STC(0x6ed9eba1), + STC(0x5a82799a), STC(0x40000000), STC(0x2120fb83), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal48[] = { + STC(0x7ee7aa4c), STC(0x7ba3751d), STC(0x7641af3d), STC(0x7ba3751d), + STC(0x6ed9eba1), STC(0x5a82799a), STC(0x7641af3d), STC(0x5a82799a), + STC(0x30fbc54d), STC(0x6ed9eba1), STC(0x40000000), STC(0x00000000), + STC(0x658c9a2d), STC(0x2120fb83), STC(0xcf043ab3), STC(0x5a82799a), + STC(0x00000000), STC(0xa57d8666), STC(0x4debe4fe), STC(0xdedf047d), + STC(0x89be50c3), STC(0x40000000), STC(0xc0000000), STC(0x80000000), + STC(0x30fbc54d), STC(0xa57d8666), STC(0x89be50c3), STC(0x2120fb83), + STC(0x9126145f), STC(0xa57d8666), STC(0x10b5150f), STC(0x845c8ae3), + STC(0xcf043ab3), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag48[] = { + STC(0x10b5150f), STC(0x2120fb83), STC(0x30fbc54d), STC(0x2120fb83), + STC(0x40000000), STC(0x5a82799a), STC(0x30fbc54d), STC(0x5a82799a), + STC(0x7641af3d), STC(0x40000000), STC(0x6ed9eba1), STC(0x7fffffff), + STC(0x4debe4fe), STC(0x7ba3751d), STC(0x7641af3d), STC(0x5a82799a), + STC(0x7fffffff), STC(0x5a82799a), STC(0x658c9a2d), STC(0x7ba3751d), + STC(0x30fbc54d), STC(0x6ed9eba1), STC(0x6ed9eba1), STC(0x00000000), + STC(0x7641af3d), STC(0x5a82799a), STC(0xcf043ab3), STC(0x7ba3751d), + STC(0x40000000), STC(0xa57d8666), STC(0x7ee7aa4c), STC(0x2120fb83), + STC(0x89be50c3), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal80[] = { + STC(0x7f9afcb9), STC(0x7e6c9251), STC(0x7c769e18), STC(0x79bc384d), + STC(0x7e6c9251), STC(0x79bc384d), STC(0x720c8075), STC(0x678dde6e), + STC(0x7c769e18), STC(0x720c8075), STC(0x6154fb91), STC(0x4b3c8c12), + STC(0x79bc384d), STC(0x678dde6e), STC(0x4b3c8c12), STC(0x278dde6e), + STC(0x7641af3d), STC(0x5a82799a), STC(0x30fbc54d), STC(0x00000000), + STC(0x720c8075), STC(0x4b3c8c12), STC(0x14060b68), STC(0xd8722192), + STC(0x6d23501b), STC(0x3a1c5c57), STC(0xf5f50d67), STC(0xb4c373ee), + STC(0x678dde6e), STC(0x278dde6e), STC(0xd8722192), STC(0x98722192), + STC(0x6154fb91), STC(0x14060b68), STC(0xbd1ec45c), STC(0x8643c7b3), + STC(0x5a82799a), STC(0x00000000), STC(0xa57d8666), STC(0x80000000), + STC(0x53211d18), STC(0xebf9f498), STC(0x92dcafe5), STC(0x8643c7b3), + STC(0x4b3c8c12), STC(0xd8722192), STC(0x8643c7b3), STC(0x98722192), + STC(0x42e13ba4), STC(0xc5e3a3a9), STC(0x80650347), STC(0xb4c373ee), + STC(0x3a1c5c57), STC(0xb4c373ee), STC(0x81936daf), STC(0xd8722192), + STC(0x30fbc54d), STC(0xa57d8666), STC(0x89be50c3), STC(0x00000000), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag80[] = { + STC(0x0a0af299), STC(0x14060b68), STC(0x1de189a6), STC(0x278dde6e), + STC(0x14060b68), STC(0x278dde6e), STC(0x3a1c5c57), STC(0x4b3c8c12), + STC(0x1de189a6), STC(0x3a1c5c57), STC(0x53211d18), STC(0x678dde6e), + STC(0x278dde6e), STC(0x4b3c8c12), STC(0x678dde6e), STC(0x79bc384d), + STC(0x30fbc54d), STC(0x5a82799a), STC(0x7641af3d), STC(0x7fffffff), + STC(0x3a1c5c57), STC(0x678dde6e), STC(0x7e6c9251), STC(0x79bc384d), + STC(0x42e13ba4), STC(0x720c8075), STC(0x7f9afcb9), STC(0x678dde6e), + STC(0x4b3c8c12), STC(0x79bc384d), STC(0x79bc384d), STC(0x4b3c8c12), + STC(0x53211d18), STC(0x7e6c9251), STC(0x6d23501b), STC(0x278dde6e), + STC(0x5a82799a), STC(0x7fffffff), STC(0x5a82799a), STC(0x00000000), + STC(0x6154fb91), STC(0x7e6c9251), STC(0x42e13ba4), STC(0xd8722192), + STC(0x678dde6e), STC(0x79bc384d), STC(0x278dde6e), STC(0xb4c373ee), + STC(0x6d23501b), STC(0x720c8075), STC(0x0a0af299), STC(0x98722192), + STC(0x720c8075), STC(0x678dde6e), STC(0xebf9f498), STC(0x8643c7b3), + STC(0x7641af3d), STC(0x5a82799a), STC(0xcf043ab3), STC(0x80000000), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal96[] = { + STC(0x7fb9d759), STC(0x7ee7aa4c), STC(0x7ee7aa4c), STC(0x7ba3751d), + STC(0x7d8a5f40), STC(0x7641af3d), STC(0x7ba3751d), STC(0x6ed9eba1), + STC(0x793501a9), STC(0x658c9a2d), STC(0x7641af3d), STC(0x5a82799a), + STC(0x72ccb9db), STC(0x4debe4fe), STC(0x6ed9eba1), STC(0x40000000), + STC(0x6a6d98a4), STC(0x30fbc54d), STC(0x658c9a2d), STC(0x2120fb83), + STC(0x603c496c), STC(0x10b5150f), STC(0x5a82799a), STC(0x00000000), + STC(0x54657194), STC(0xef4aeaf1), STC(0x4debe4fe), STC(0xdedf047d), + STC(0x471cece7), STC(0xcf043ab3), STC(0x40000000), STC(0xc0000000), + STC(0x389cea72), STC(0xb2141b02), STC(0x30fbc54d), STC(0xa57d8666), + STC(0x2924edac), STC(0x9a7365d3), STC(0x2120fb83), STC(0x9126145f), + STC(0x18f8b83c), STC(0x89be50c3), STC(0x10b5150f), STC(0x845c8ae3), + STC(0x085f2137), STC(0x811855b4), STC(0x00000000), STC(0x80000000), + STC(0xf7a0dec9), STC(0x811855b4), STC(0xef4aeaf1), STC(0x845c8ae3), + STC(0xe70747c4), STC(0x89be50c3), STC(0xdedf047d), STC(0x9126145f), + STC(0xd6db1254), STC(0x9a7365d3), STC(0xcf043ab3), STC(0xa57d8666), + STC(0xc763158e), STC(0xb2141b02), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag96[] = { + STC(0x085f2137), STC(0x10b5150f), STC(0x10b5150f), STC(0x2120fb83), + STC(0x18f8b83c), STC(0x30fbc54d), STC(0x2120fb83), STC(0x40000000), + STC(0x2924edac), STC(0x4debe4fe), STC(0x30fbc54d), STC(0x5a82799a), + STC(0x389cea72), STC(0x658c9a2d), STC(0x40000000), STC(0x6ed9eba1), + STC(0x471cece7), STC(0x7641af3d), STC(0x4debe4fe), STC(0x7ba3751d), + STC(0x54657194), STC(0x7ee7aa4c), STC(0x5a82799a), STC(0x7fffffff), + STC(0x603c496c), STC(0x7ee7aa4c), STC(0x658c9a2d), STC(0x7ba3751d), + STC(0x6a6d98a4), STC(0x7641af3d), STC(0x6ed9eba1), STC(0x6ed9eba1), + STC(0x72ccb9db), STC(0x658c9a2d), STC(0x7641af3d), STC(0x5a82799a), + STC(0x793501a9), STC(0x4debe4fe), STC(0x7ba3751d), STC(0x40000000), + STC(0x7d8a5f40), STC(0x30fbc54d), STC(0x7ee7aa4c), STC(0x2120fb83), + STC(0x7fb9d759), STC(0x10b5150f), STC(0x7fffffff), STC(0x00000000), + STC(0x7fb9d759), STC(0xef4aeaf1), STC(0x7ee7aa4c), STC(0xdedf047d), + STC(0x7d8a5f40), STC(0xcf043ab3), STC(0x7ba3751d), STC(0xc0000000), + STC(0x793501a9), STC(0xb2141b02), STC(0x7641af3d), STC(0xa57d8666), + STC(0x72ccb9db), STC(0x9a7365d3), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal384[] = { + STC(0x7ffb9d15), STC(0x7fee74a2), STC(0x7fd8878e), STC(0x7fb9d759), + STC(0x7f92661d), STC(0x7f62368f), STC(0x7f294bfd), STC(0x7ee7aa4c), + STC(0x7e9d55fc), STC(0x7e4a5426), STC(0x7deeaa7a), STC(0x7fee74a2), + STC(0x7fb9d759), STC(0x7f62368f), STC(0x7ee7aa4c), STC(0x7e4a5426), + STC(0x7d8a5f40), STC(0x7ca80038), STC(0x7ba3751d), STC(0x7a7d055b), + STC(0x793501a9), STC(0x77cbc3f2), STC(0x7fd8878e), STC(0x7f62368f), + STC(0x7e9d55fc), STC(0x7d8a5f40), STC(0x7c29fbee), STC(0x7a7d055b), + STC(0x78848414), STC(0x7641af3d), STC(0x73b5ebd1), STC(0x70e2cbc6), + STC(0x6dca0d14), STC(0x7fb9d759), STC(0x7ee7aa4c), STC(0x7d8a5f40), + STC(0x7ba3751d), STC(0x793501a9), STC(0x7641af3d), STC(0x72ccb9db), + STC(0x6ed9eba1), STC(0x6a6d98a4), STC(0x658c9a2d), STC(0x603c496c), + STC(0x7f92661d), STC(0x7e4a5426), STC(0x7c29fbee), STC(0x793501a9), + STC(0x757075ac), STC(0x70e2cbc6), STC(0x6b93d02e), STC(0x658c9a2d), + STC(0x5ed77c8a), STC(0x577ff3da), STC(0x4f9292dc), STC(0x7f62368f), + STC(0x7d8a5f40), STC(0x7a7d055b), STC(0x7641af3d), STC(0x70e2cbc6), + STC(0x6a6d98a4), STC(0x62f201ac), STC(0x5a82799a), STC(0x5133cc94), + STC(0x471cece7), STC(0x3c56ba70), STC(0x7f294bfd), STC(0x7ca80038), + STC(0x78848414), STC(0x72ccb9db), STC(0x6b93d02e), STC(0x62f201ac), + STC(0x590443a7), STC(0x4debe4fe), STC(0x41ce1e65), STC(0x34d3957e), + STC(0x2727d486), STC(0x7ee7aa4c), STC(0x7ba3751d), STC(0x7641af3d), + STC(0x6ed9eba1), STC(0x658c9a2d), STC(0x5a82799a), STC(0x4debe4fe), + STC(0x40000000), STC(0x30fbc54d), STC(0x2120fb83), STC(0x10b5150f), + STC(0x7e9d55fc), STC(0x7a7d055b), STC(0x73b5ebd1), STC(0x6a6d98a4), + STC(0x5ed77c8a), STC(0x5133cc94), STC(0x41ce1e65), STC(0x30fbc54d), + STC(0x1f19f97b), STC(0x0c8bd35e), STC(0xf9b82684), STC(0x7e4a5426), + STC(0x793501a9), STC(0x70e2cbc6), STC(0x658c9a2d), STC(0x577ff3da), + STC(0x471cece7), STC(0x34d3957e), STC(0x2120fb83), STC(0x0c8bd35e), + STC(0xf7a0dec9), STC(0xe2ef2a3e), STC(0x7deeaa7a), STC(0x77cbc3f2), + STC(0x6dca0d14), STC(0x603c496c), STC(0x4f9292dc), STC(0x3c56ba70), + STC(0x2727d486), STC(0x10b5150f), STC(0xf9b82684), STC(0xe2ef2a3e), + STC(0xcd1693f7), STC(0x7d8a5f40), STC(0x7641af3d), STC(0x6a6d98a4), + STC(0x5a82799a), STC(0x471cece7), STC(0x30fbc54d), STC(0x18f8b83c), + STC(0x00000000), STC(0xe70747c4), STC(0xcf043ab3), STC(0xb8e31319), + STC(0x7d1d7958), STC(0x74972f92), STC(0x66cf8120), STC(0x54657194), + STC(0x3e2d7eb1), STC(0x25280c5e), STC(0x0a75d60e), STC(0xef4aeaf1), + STC(0xd4e0cb15), STC(0xbc6845ce), STC(0xa6fbbc59), STC(0x7ca80038), + STC(0x72ccb9db), STC(0x62f201ac), STC(0x4debe4fe), STC(0x34d3957e), + STC(0x18f8b83c), STC(0xfbcfdc71), STC(0xdedf047d), STC(0xc3a94590), + STC(0xab9a8e6c), STC(0x97f4a3cd), STC(0x7c29fbee), STC(0x70e2cbc6), + STC(0x5ed77c8a), STC(0x471cece7), STC(0x2b1f34eb), STC(0x0c8bd35e), + STC(0xed37ef91), STC(0xcf043ab3), STC(0xb3c0200c), STC(0x9d0dfe54), + STC(0x8c4a142f), STC(0x7ba3751d), STC(0x6ed9eba1), STC(0x5a82799a), + STC(0x40000000), STC(0x2120fb83), STC(0x00000000), STC(0xdedf047d), + STC(0xc0000000), STC(0xa57d8666), STC(0x9126145f), STC(0x845c8ae3), + STC(0x7b1474fd), STC(0x6cb2a837), STC(0x55f5a4d2), STC(0x389cea72), + STC(0x16ea0646), STC(0xf3742ca2), STC(0xd0f53ce0), STC(0xb2141b02), + STC(0x99307ee0), STC(0x88343c0e), STC(0x806d99e3), STC(0x7a7d055b), + STC(0x6a6d98a4), STC(0x5133cc94), STC(0x30fbc54d), STC(0x0c8bd35e), + STC(0xe70747c4), STC(0xc3a94590), STC(0xa57d8666), STC(0x8f1d343a), + STC(0x8275a0c0), STC(0x809dc971), STC(0x79dd3098), STC(0x680b5c33), + STC(0x4c3fdff4), STC(0x2924edac), STC(0x02182427), STC(0xdad7f3a2), + STC(0xb727b9f7), STC(0x9a7365d3), STC(0x877b7bec), STC(0x80118b5e), + STC(0x84eb8b03), STC(0x793501a9), STC(0x658c9a2d), STC(0x471cece7), + STC(0x2120fb83), STC(0xf7a0dec9), STC(0xcf043ab3), STC(0xab9a8e6c), + STC(0x9126145f), STC(0x8275a0c0), STC(0x811855b4), STC(0x8d334625), + STC(0x78848414), STC(0x62f201ac), STC(0x41ce1e65), STC(0x18f8b83c), + STC(0xed37ef91), STC(0xc3a94590), STC(0xa1288376), STC(0x89be50c3), + STC(0x80277872), STC(0x8582faa5), STC(0x99307ee0), STC(0x77cbc3f2), + STC(0x603c496c), STC(0x3c56ba70), STC(0x10b5150f), STC(0xe2ef2a3e), + STC(0xb8e31319), STC(0x97f4a3cd), STC(0x845c8ae3), STC(0x809dc971), + STC(0x8d334625), STC(0xa8800c26), STC(0x770acdec), STC(0x5d6c2f99), + STC(0x36ba2014), STC(0x085f2137), STC(0xd8d82b7a), STC(0xaecc336c), + STC(0x901dcec4), STC(0x811855b4), STC(0x83d60412), STC(0x97f4a3cd), + STC(0xbaa34bf4), STC(0x7641af3d), STC(0x5a82799a), STC(0x30fbc54d), + STC(0x00000000), STC(0xcf043ab3), STC(0xa57d8666), STC(0x89be50c3), + STC(0x80000000), STC(0x89be50c3), STC(0xa57d8666), STC(0xcf043ab3), + STC(0x757075ac), STC(0x577ff3da), STC(0x2b1f34eb), STC(0xf7a0dec9), + STC(0xc5842c7e), STC(0x9d0dfe54), STC(0x84eb8b03), STC(0x811855b4), + STC(0x9235f2ec), STC(0xb5715eef), STC(0xe4fa4bf1), STC(0x74972f92), + STC(0x54657194), STC(0x25280c5e), STC(0xef4aeaf1), STC(0xbc6845ce), + STC(0x9592675c), STC(0x81b5abda), STC(0x845c8ae3), STC(0x9d0dfe54), + STC(0xc763158e), STC(0xfbcfdc71), STC(0x73b5ebd1), STC(0x5133cc94), + STC(0x1f19f97b), STC(0xe70747c4), STC(0xb3c0200c), STC(0x8f1d343a), + STC(0x80277872), STC(0x89be50c3), STC(0xaa0a5b2e), STC(0xdad7f3a2), + STC(0x12c8106f), STC(0x72ccb9db), STC(0x4debe4fe), STC(0x18f8b83c), + STC(0xdedf047d), STC(0xab9a8e6c), STC(0x89be50c3), STC(0x804628a7), + STC(0x9126145f), STC(0xb8e31319), STC(0xef4aeaf1), STC(0x2924edac), + STC(0x71dba9ab), STC(0x4a8ea111), STC(0x12c8106f), STC(0xd6db1254), + STC(0xa405847e), STC(0x8582faa5), STC(0x82115586), STC(0x9a7365d3), + STC(0xc945dfec), STC(0x0430238f), STC(0x3e2d7eb1), STC(0x70e2cbc6), + STC(0x471cece7), STC(0x0c8bd35e), STC(0xcf043ab3), STC(0x9d0dfe54), + STC(0x8275a0c0), STC(0x8582faa5), STC(0xa57d8666), STC(0xdad7f3a2), + STC(0x18f8b83c), STC(0x5133cc94), STC(0x6fe2313c), STC(0x4397ba32), + STC(0x0647d97c), STC(0xc763158e), STC(0x96bfea3d), STC(0x809dc971), + STC(0x8a8f8a54), STC(0xb2141b02), STC(0xed37ef91), STC(0x2d168792), + STC(0x619a7dce), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag384[] = { + STC(0x02182427), STC(0x0430238f), STC(0x0647d97c), STC(0x085f2137), + STC(0x0a75d60e), STC(0x0c8bd35e), STC(0x0ea0f48c), STC(0x10b5150f), + STC(0x12c8106f), STC(0x14d9c245), STC(0x16ea0646), STC(0x0430238f), + STC(0x085f2137), STC(0x0c8bd35e), STC(0x10b5150f), STC(0x14d9c245), + STC(0x18f8b83c), STC(0x1d10d5c2), STC(0x2120fb83), STC(0x25280c5e), + STC(0x2924edac), STC(0x2d168792), STC(0x0647d97c), STC(0x0c8bd35e), + STC(0x12c8106f), STC(0x18f8b83c), STC(0x1f19f97b), STC(0x25280c5e), + STC(0x2b1f34eb), STC(0x30fbc54d), STC(0x36ba2014), STC(0x3c56ba70), + STC(0x41ce1e65), STC(0x085f2137), STC(0x10b5150f), STC(0x18f8b83c), + STC(0x2120fb83), STC(0x2924edac), STC(0x30fbc54d), STC(0x389cea72), + STC(0x40000000), STC(0x471cece7), STC(0x4debe4fe), STC(0x54657194), + STC(0x0a75d60e), STC(0x14d9c245), STC(0x1f19f97b), STC(0x2924edac), + STC(0x32e96c09), STC(0x3c56ba70), STC(0x455cb40c), STC(0x4debe4fe), + STC(0x55f5a4d2), STC(0x5d6c2f99), STC(0x6442bd7e), STC(0x0c8bd35e), + STC(0x18f8b83c), STC(0x25280c5e), STC(0x30fbc54d), STC(0x3c56ba70), + STC(0x471cece7), STC(0x5133cc94), STC(0x5a82799a), STC(0x62f201ac), + STC(0x6a6d98a4), STC(0x70e2cbc6), STC(0x0ea0f48c), STC(0x1d10d5c2), + STC(0x2b1f34eb), STC(0x389cea72), STC(0x455cb40c), STC(0x5133cc94), + STC(0x5bfa7b82), STC(0x658c9a2d), STC(0x6dca0d14), STC(0x74972f92), + STC(0x79dd3098), STC(0x10b5150f), STC(0x2120fb83), STC(0x30fbc54d), + STC(0x40000000), STC(0x4debe4fe), STC(0x5a82799a), STC(0x658c9a2d), + STC(0x6ed9eba1), STC(0x7641af3d), STC(0x7ba3751d), STC(0x7ee7aa4c), + STC(0x12c8106f), STC(0x25280c5e), STC(0x36ba2014), STC(0x471cece7), + STC(0x55f5a4d2), STC(0x62f201ac), STC(0x6dca0d14), STC(0x7641af3d), + STC(0x7c29fbee), STC(0x7f62368f), STC(0x7fd8878e), STC(0x14d9c245), + STC(0x2924edac), STC(0x3c56ba70), STC(0x4debe4fe), STC(0x5d6c2f99), + STC(0x6a6d98a4), STC(0x74972f92), STC(0x7ba3751d), STC(0x7f62368f), + STC(0x7fb9d759), STC(0x7ca80038), STC(0x16ea0646), STC(0x2d168792), + STC(0x41ce1e65), STC(0x54657194), STC(0x6442bd7e), STC(0x70e2cbc6), + STC(0x79dd3098), STC(0x7ee7aa4c), STC(0x7fd8878e), STC(0x7ca80038), + STC(0x757075ac), STC(0x18f8b83c), STC(0x30fbc54d), STC(0x471cece7), + STC(0x5a82799a), STC(0x6a6d98a4), STC(0x7641af3d), STC(0x7d8a5f40), + STC(0x7fffffff), STC(0x7d8a5f40), STC(0x7641af3d), STC(0x6a6d98a4), + STC(0x1b05b40f), STC(0x34d3957e), STC(0x4c3fdff4), STC(0x603c496c), + STC(0x6fe2313c), STC(0x7a7d055b), STC(0x7f92661d), STC(0x7ee7aa4c), + STC(0x78848414), STC(0x6cb2a837), STC(0x5bfa7b82), STC(0x1d10d5c2), + STC(0x389cea72), STC(0x5133cc94), STC(0x658c9a2d), STC(0x74972f92), + STC(0x7d8a5f40), STC(0x7fee74a2), STC(0x7ba3751d), STC(0x70e2cbc6), + STC(0x603c496c), STC(0x4a8ea111), STC(0x1f19f97b), STC(0x3c56ba70), + STC(0x55f5a4d2), STC(0x6a6d98a4), STC(0x78848414), STC(0x7f62368f), + STC(0x7e9d55fc), STC(0x7641af3d), STC(0x66cf8120), STC(0x5133cc94), + STC(0x36ba2014), STC(0x2120fb83), STC(0x40000000), STC(0x5a82799a), + STC(0x6ed9eba1), STC(0x7ba3751d), STC(0x7fffffff), STC(0x7ba3751d), + STC(0x6ed9eba1), STC(0x5a82799a), STC(0x40000000), STC(0x2120fb83), + STC(0x2325b847), STC(0x4397ba32), STC(0x5ed77c8a), STC(0x72ccb9db), + STC(0x7deeaa7a), STC(0x7f62368f), STC(0x770acdec), STC(0x658c9a2d), + STC(0x4c3fdff4), STC(0x2d168792), STC(0x0a75d60e), STC(0x25280c5e), + STC(0x471cece7), STC(0x62f201ac), STC(0x7641af3d), STC(0x7f62368f), + STC(0x7d8a5f40), STC(0x70e2cbc6), STC(0x5a82799a), STC(0x3c56ba70), + STC(0x18f8b83c), STC(0xf3742ca2), STC(0x2727d486), STC(0x4a8ea111), + STC(0x66cf8120), STC(0x793501a9), STC(0x7ffb9d15), STC(0x7a7d055b), + STC(0x694015c3), STC(0x4debe4fe), STC(0x2b1f34eb), STC(0x0430238f), + STC(0xdcda47b9), STC(0x2924edac), STC(0x4debe4fe), STC(0x6a6d98a4), + STC(0x7ba3751d), STC(0x7fb9d759), STC(0x7641af3d), STC(0x603c496c), + STC(0x40000000), STC(0x18f8b83c), STC(0xef4aeaf1), STC(0xc763158e), + STC(0x2b1f34eb), STC(0x5133cc94), STC(0x6dca0d14), STC(0x7d8a5f40), + STC(0x7e9d55fc), STC(0x70e2cbc6), STC(0x55f5a4d2), STC(0x30fbc54d), + STC(0x0647d97c), STC(0xdad7f3a2), STC(0xb3c0200c), STC(0x2d168792), + STC(0x54657194), STC(0x70e2cbc6), STC(0x7ee7aa4c), STC(0x7ca80038), + STC(0x6a6d98a4), STC(0x4a8ea111), STC(0x2120fb83), STC(0xf3742ca2), + STC(0xc763158e), STC(0xa293d067), STC(0x2f0ac320), STC(0x577ff3da), + STC(0x73b5ebd1), STC(0x7fb9d759), STC(0x79dd3098), STC(0x62f201ac), + STC(0x3e2d7eb1), STC(0x10b5150f), STC(0xe0e60685), STC(0xb5715eef), + STC(0x946c2fd2), STC(0x30fbc54d), STC(0x5a82799a), STC(0x7641af3d), + STC(0x7fffffff), STC(0x7641af3d), STC(0x5a82799a), STC(0x30fbc54d), + STC(0x00000000), STC(0xcf043ab3), STC(0xa57d8666), STC(0x89be50c3), + STC(0x32e96c09), STC(0x5d6c2f99), STC(0x78848414), STC(0x7fb9d759), + STC(0x71dba9ab), STC(0x5133cc94), STC(0x2325b847), STC(0xef4aeaf1), + STC(0xbe31e19b), STC(0x97f4a3cd), STC(0x82e286a8), STC(0x34d3957e), + STC(0x603c496c), STC(0x7a7d055b), STC(0x7ee7aa4c), STC(0x6cb2a837), + STC(0x471cece7), STC(0x14d9c245), STC(0xdedf047d), STC(0xaecc336c), + STC(0x8d334625), STC(0x80118b5e), STC(0x36ba2014), STC(0x62f201ac), + STC(0x7c29fbee), STC(0x7d8a5f40), STC(0x66cf8120), STC(0x3c56ba70), + STC(0x0647d97c), STC(0xcf043ab3), STC(0xa1288376), STC(0x8582faa5), + STC(0x8162aa04), STC(0x389cea72), STC(0x658c9a2d), STC(0x7d8a5f40), + STC(0x7ba3751d), STC(0x603c496c), STC(0x30fbc54d), STC(0xf7a0dec9), + STC(0xc0000000), STC(0x9592675c), STC(0x811855b4), STC(0x86cafe57), + STC(0x3a7bd382), STC(0x680b5c33), STC(0x7e9d55fc), STC(0x793501a9), + STC(0x590443a7), STC(0x25280c5e), STC(0xe915f9ba), STC(0xb2141b02), + STC(0x8c4a142f), STC(0x80118b5e), STC(0x901dcec4), STC(0x3c56ba70), + STC(0x6a6d98a4), STC(0x7f62368f), STC(0x7641af3d), STC(0x5133cc94), + STC(0x18f8b83c), STC(0xdad7f3a2), STC(0xa57d8666), STC(0x8582faa5), + STC(0x8275a0c0), STC(0x9d0dfe54), STC(0x3e2d7eb1), STC(0x6cb2a837), + STC(0x7fd8878e), STC(0x72ccb9db), STC(0x48d84609), STC(0x0c8bd35e), + STC(0xcd1693f7), STC(0x9a7365d3), STC(0x8162aa04), STC(0x88343c0e), + STC(0xad308a71), +}; + +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(0xd8722192), STC(0x5f1f5ea1), STC(0x0d61304e), + STC(0xb4c373ee), STC(0x55a6125c), STC(0xf29ecfb2), STC(0x98722192), + STC(0x4b3c8c12), STC(0xd8722192), STC(0x8643c7b3), STC(0x40000000), + STC(0xc0000000), STC(0x80000000), STC(0x340ff242), STC(0xaa59eda4), + STC(0x8643c7b3), STC(0x278dde6e), STC(0x98722192), STC(0x98722192), + STC(0x1a9cd9ac), STC(0x8b10f144), STC(0xb4c373ee), STC(0x0d61304e), + STC(0x82cc0f36), STC(0xd8722192), +}; + +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(0xd8722192), STC(0x79bc384d), STC(0x4b3c8c12), STC(0xb4c373ee), + STC(0x7d33f0ca), STC(0x340ff242), STC(0x98722192), STC(0x7f4c7e54), + STC(0x1a9cd9ac), STC(0x8643c7b3), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal120[] = { + STC(0x7fd317b4), STC(0x7f4c7e54), STC(0x7e6c9251), STC(0x7d33f0ca), + STC(0x7ba3751d), STC(0x79bc384d), STC(0x777f903c), STC(0x7f4c7e54), + STC(0x7d33f0ca), STC(0x79bc384d), STC(0x74ef0ebc), STC(0x6ed9eba1), + STC(0x678dde6e), STC(0x5f1f5ea1), STC(0x7e6c9251), STC(0x79bc384d), + STC(0x720c8075), STC(0x678dde6e), STC(0x5a82799a), STC(0x4b3c8c12), + STC(0x3a1c5c57), STC(0x7d33f0ca), STC(0x74ef0ebc), STC(0x678dde6e), + STC(0x55a6125c), STC(0x40000000), STC(0x278dde6e), STC(0x0d61304e), + STC(0x7ba3751d), STC(0x6ed9eba1), STC(0x5a82799a), STC(0x40000000), + STC(0x2120fb83), STC(0x00000000), STC(0xdedf047d), STC(0x79bc384d), + STC(0x678dde6e), STC(0x4b3c8c12), STC(0x278dde6e), STC(0x00000000), + STC(0xd8722192), STC(0xb4c373ee), STC(0x777f903c), STC(0x5f1f5ea1), + STC(0x3a1c5c57), STC(0x0d61304e), STC(0xdedf047d), STC(0xb4c373ee), + STC(0x94a6715d), STC(0x74ef0ebc), STC(0x55a6125c), STC(0x278dde6e), + STC(0xf29ecfb2), STC(0xc0000000), STC(0x98722192), STC(0x82cc0f36), + STC(0x720c8075), STC(0x4b3c8c12), STC(0x14060b68), STC(0xd8722192), + STC(0xa57d8666), STC(0x8643c7b3), STC(0x81936daf), STC(0x6ed9eba1), + STC(0x40000000), STC(0x00000000), STC(0xc0000000), STC(0x9126145f), + STC(0x80000000), STC(0x9126145f), STC(0x6b598ea3), STC(0x340ff242), + STC(0xebf9f498), STC(0xaa59eda4), STC(0x845c8ae3), STC(0x8643c7b3), + STC(0xaf726def), STC(0x678dde6e), STC(0x278dde6e), STC(0xd8722192), + STC(0x98722192), STC(0x80000000), STC(0x98722192), STC(0xd8722192), + STC(0x637984d4), STC(0x1a9cd9ac), STC(0xc5e3a3a9), STC(0x8b10f144), + STC(0x845c8ae3), STC(0xb4c373ee), STC(0x06b2f1d2), STC(0x5f1f5ea1), + STC(0x0d61304e), STC(0xb4c373ee), STC(0x82cc0f36), STC(0x9126145f), + STC(0xd8722192), STC(0x340ff242), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag120[] = { + STC(0x06b2f1d2), STC(0x0d61304e), STC(0x14060b68), STC(0x1a9cd9ac), + STC(0x2120fb83), STC(0x278dde6e), STC(0x2ddf0040), STC(0x0d61304e), + STC(0x1a9cd9ac), STC(0x278dde6e), STC(0x340ff242), STC(0x40000000), + STC(0x4b3c8c12), STC(0x55a6125c), STC(0x14060b68), STC(0x278dde6e), + STC(0x3a1c5c57), STC(0x4b3c8c12), STC(0x5a82799a), STC(0x678dde6e), + STC(0x720c8075), STC(0x1a9cd9ac), STC(0x340ff242), STC(0x4b3c8c12), + STC(0x5f1f5ea1), STC(0x6ed9eba1), STC(0x79bc384d), STC(0x7f4c7e54), + STC(0x2120fb83), STC(0x40000000), STC(0x5a82799a), STC(0x6ed9eba1), + STC(0x7ba3751d), STC(0x7fffffff), STC(0x7ba3751d), STC(0x278dde6e), + STC(0x4b3c8c12), STC(0x678dde6e), STC(0x79bc384d), STC(0x7fffffff), + STC(0x79bc384d), STC(0x678dde6e), STC(0x2ddf0040), STC(0x55a6125c), + STC(0x720c8075), STC(0x7f4c7e54), STC(0x7ba3751d), STC(0x678dde6e), + STC(0x45b6bb5e), STC(0x340ff242), STC(0x5f1f5ea1), STC(0x79bc384d), + STC(0x7f4c7e54), STC(0x6ed9eba1), STC(0x4b3c8c12), STC(0x1a9cd9ac), + STC(0x3a1c5c57), STC(0x678dde6e), STC(0x7e6c9251), STC(0x79bc384d), + STC(0x5a82799a), STC(0x278dde6e), STC(0xebf9f498), STC(0x40000000), + STC(0x6ed9eba1), STC(0x7fffffff), STC(0x6ed9eba1), STC(0x40000000), + STC(0x00000000), STC(0xc0000000), STC(0x45b6bb5e), STC(0x74ef0ebc), + STC(0x7e6c9251), STC(0x5f1f5ea1), STC(0x2120fb83), STC(0xd8722192), + STC(0x9c867b2c), STC(0x4b3c8c12), STC(0x79bc384d), STC(0x79bc384d), + STC(0x4b3c8c12), STC(0x00000000), STC(0xb4c373ee), STC(0x8643c7b3), + STC(0x508d9211), STC(0x7d33f0ca), STC(0x720c8075), STC(0x340ff242), + STC(0xdedf047d), STC(0x98722192), STC(0x802ce84c), STC(0x55a6125c), + STC(0x7f4c7e54), STC(0x678dde6e), STC(0x1a9cd9ac), STC(0xc0000000), + STC(0x8643c7b3), STC(0x8b10f144), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal192[] = { + STC(0x7fee74a2), STC(0x7fb9d759), STC(0x7f62368f), STC(0x7ee7aa4c), + STC(0x7e4a5426), STC(0x7d8a5f40), STC(0x7ca80038), STC(0x7ba3751d), + STC(0x7a7d055b), STC(0x793501a9), STC(0x77cbc3f2), STC(0x7641af3d), + STC(0x74972f92), STC(0x72ccb9db), STC(0x70e2cbc6), 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(0x7f62368f), STC(0x7d8a5f40), + STC(0x7a7d055b), STC(0x7641af3d), STC(0x70e2cbc6), STC(0x6a6d98a4), + STC(0x62f201ac), STC(0x5a82799a), STC(0x5133cc94), STC(0x471cece7), + STC(0x3c56ba70), STC(0x30fbc54d), STC(0x25280c5e), STC(0x18f8b83c), + STC(0x0c8bd35e), 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(0xef4aeaf1), STC(0xdedf047d), STC(0xcf043ab3), + STC(0x7e4a5426), STC(0x793501a9), STC(0x70e2cbc6), STC(0x658c9a2d), + STC(0x577ff3da), STC(0x471cece7), STC(0x34d3957e), STC(0x2120fb83), + STC(0x0c8bd35e), STC(0xf7a0dec9), STC(0xe2ef2a3e), STC(0xcf043ab3), + STC(0xbc6845ce), STC(0xab9a8e6c), STC(0x9d0dfe54), STC(0x7d8a5f40), + STC(0x7641af3d), STC(0x6a6d98a4), STC(0x5a82799a), STC(0x471cece7), + STC(0x30fbc54d), STC(0x18f8b83c), STC(0x00000000), STC(0xe70747c4), + STC(0xcf043ab3), STC(0xb8e31319), STC(0xa57d8666), STC(0x9592675c), + STC(0x89be50c3), STC(0x8275a0c0), STC(0x7ca80038), STC(0x72ccb9db), + STC(0x62f201ac), STC(0x4debe4fe), STC(0x34d3957e), STC(0x18f8b83c), + STC(0xfbcfdc71), STC(0xdedf047d), STC(0xc3a94590), STC(0xab9a8e6c), + STC(0x97f4a3cd), STC(0x89be50c3), STC(0x81b5abda), STC(0x804628a7), + STC(0x8582faa5), STC(0x7ba3751d), STC(0x6ed9eba1), STC(0x5a82799a), + STC(0x40000000), STC(0x2120fb83), STC(0x00000000), STC(0xdedf047d), + STC(0xc0000000), STC(0xa57d8666), STC(0x9126145f), STC(0x845c8ae3), + STC(0x80000000), STC(0x845c8ae3), STC(0x9126145f), STC(0xa57d8666), + STC(0x7a7d055b), STC(0x6a6d98a4), STC(0x5133cc94), STC(0x30fbc54d), + STC(0x0c8bd35e), STC(0xe70747c4), STC(0xc3a94590), STC(0xa57d8666), + STC(0x8f1d343a), STC(0x8275a0c0), STC(0x809dc971), STC(0x89be50c3), + STC(0x9d0dfe54), STC(0xb8e31319), STC(0xdad7f3a2), STC(0x793501a9), + STC(0x658c9a2d), STC(0x471cece7), STC(0x2120fb83), STC(0xf7a0dec9), + STC(0xcf043ab3), STC(0xab9a8e6c), STC(0x9126145f), STC(0x8275a0c0), + STC(0x811855b4), STC(0x8d334625), STC(0xa57d8666), STC(0xc763158e), + STC(0xef4aeaf1), STC(0x18f8b83c), STC(0x77cbc3f2), STC(0x603c496c), + STC(0x3c56ba70), STC(0x10b5150f), STC(0xe2ef2a3e), STC(0xb8e31319), + STC(0x97f4a3cd), STC(0x845c8ae3), STC(0x809dc971), STC(0x8d334625), + STC(0xa8800c26), STC(0xcf043ab3), STC(0xfbcfdc71), STC(0x2924edac), + STC(0x5133cc94), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag192[] = { + STC(0x0430238f), STC(0x085f2137), STC(0x0c8bd35e), STC(0x10b5150f), + STC(0x14d9c245), STC(0x18f8b83c), STC(0x1d10d5c2), STC(0x2120fb83), + STC(0x25280c5e), STC(0x2924edac), STC(0x2d168792), STC(0x30fbc54d), + STC(0x34d3957e), STC(0x389cea72), STC(0x3c56ba70), 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(0x0c8bd35e), STC(0x18f8b83c), + STC(0x25280c5e), STC(0x30fbc54d), STC(0x3c56ba70), STC(0x471cece7), + STC(0x5133cc94), STC(0x5a82799a), STC(0x62f201ac), STC(0x6a6d98a4), + STC(0x70e2cbc6), STC(0x7641af3d), STC(0x7a7d055b), STC(0x7d8a5f40), + STC(0x7f62368f), 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(0x14d9c245), STC(0x2924edac), STC(0x3c56ba70), STC(0x4debe4fe), + STC(0x5d6c2f99), STC(0x6a6d98a4), STC(0x74972f92), STC(0x7ba3751d), + STC(0x7f62368f), STC(0x7fb9d759), STC(0x7ca80038), STC(0x7641af3d), + STC(0x6cb2a837), STC(0x603c496c), STC(0x5133cc94), STC(0x18f8b83c), + STC(0x30fbc54d), STC(0x471cece7), STC(0x5a82799a), STC(0x6a6d98a4), + STC(0x7641af3d), STC(0x7d8a5f40), STC(0x7fffffff), STC(0x7d8a5f40), + STC(0x7641af3d), STC(0x6a6d98a4), STC(0x5a82799a), STC(0x471cece7), + STC(0x30fbc54d), STC(0x18f8b83c), STC(0x1d10d5c2), STC(0x389cea72), + STC(0x5133cc94), STC(0x658c9a2d), STC(0x74972f92), STC(0x7d8a5f40), + STC(0x7fee74a2), STC(0x7ba3751d), STC(0x70e2cbc6), STC(0x603c496c), + STC(0x4a8ea111), STC(0x30fbc54d), STC(0x14d9c245), STC(0xf7a0dec9), + STC(0xdad7f3a2), 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(0xdedf047d), STC(0xc0000000), STC(0xa57d8666), + STC(0x25280c5e), STC(0x471cece7), STC(0x62f201ac), STC(0x7641af3d), + STC(0x7f62368f), STC(0x7d8a5f40), STC(0x70e2cbc6), STC(0x5a82799a), + STC(0x3c56ba70), STC(0x18f8b83c), STC(0xf3742ca2), STC(0xcf043ab3), + STC(0xaecc336c), STC(0x9592675c), STC(0x8582faa5), STC(0x2924edac), + STC(0x4debe4fe), STC(0x6a6d98a4), STC(0x7ba3751d), STC(0x7fb9d759), + STC(0x7641af3d), STC(0x603c496c), STC(0x40000000), STC(0x18f8b83c), + STC(0xef4aeaf1), STC(0xc763158e), STC(0xa57d8666), STC(0x8d334625), + STC(0x811855b4), STC(0x8275a0c0), STC(0x2d168792), STC(0x54657194), + STC(0x70e2cbc6), STC(0x7ee7aa4c), STC(0x7ca80038), STC(0x6a6d98a4), + STC(0x4a8ea111), STC(0x2120fb83), STC(0xf3742ca2), STC(0xc763158e), + STC(0xa293d067), STC(0x89be50c3), STC(0x80118b5e), STC(0x86cafe57), + STC(0x9d0dfe54), +}; + +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(0xef4aeaf1), STC(0xdedf047d), STC(0xcf043ab3), STC(0x7e6c9251), + STC(0x79bc384d), STC(0x720c8075), STC(0x678dde6e), STC(0x5a82799a), + STC(0x4b3c8c12), STC(0x3a1c5c57), STC(0x278dde6e), STC(0x14060b68), + STC(0x00000000), STC(0xebf9f498), STC(0xd8722192), STC(0xc5e3a3a9), + STC(0xb4c373ee), STC(0xa57d8666), STC(0x7ddb4bfc), STC(0x777f903c), + STC(0x6d23501b), STC(0x5f1f5ea1), STC(0x4debe4fe), STC(0x3a1c5c57), + STC(0x245a9d65), STC(0x0d61304e), STC(0xf5f50d67), STC(0xdedf047d), + STC(0xc8e5032b), STC(0xb4c373ee), STC(0xa326eec0), STC(0x94a6715d), + STC(0x89be50c3), STC(0x7d33f0ca), STC(0x74ef0ebc), STC(0x678dde6e), + STC(0x55a6125c), STC(0x40000000), STC(0x278dde6e), STC(0x0d61304e), + STC(0xf29ecfb2), STC(0xd8722192), STC(0xc0000000), STC(0xaa59eda4), + STC(0x98722192), STC(0x8b10f144), STC(0x82cc0f36), STC(0x80000000), + STC(0x7c769e18), STC(0x720c8075), STC(0x6154fb91), STC(0x4b3c8c12), + STC(0x30fbc54d), STC(0x14060b68), STC(0xf5f50d67), STC(0xd8722192), + STC(0xbd1ec45c), STC(0xa57d8666), STC(0x92dcafe5), STC(0x8643c7b3), + STC(0x80650347), STC(0x81936daf), STC(0x89be50c3), STC(0x7ba3751d), + STC(0x6ed9eba1), STC(0x5a82799a), STC(0x40000000), STC(0x2120fb83), + STC(0x00000000), STC(0xdedf047d), STC(0xc0000000), STC(0xa57d8666), + STC(0x9126145f), STC(0x845c8ae3), STC(0x80000000), STC(0x845c8ae3), + STC(0x9126145f), STC(0xa57d8666), STC(0x7aba9ae6), STC(0x6b598ea3), + STC(0x53211d18), STC(0x340ff242), STC(0x10b5150f), STC(0xebf9f498), + STC(0xc8e5032b), STC(0xaa59eda4), STC(0x92dcafe5), STC(0x845c8ae3), + STC(0x800b3a91), STC(0x8643c7b3), STC(0x96830876), STC(0xaf726def), + STC(0xcf043ab3), STC(0x79bc384d), STC(0x678dde6e), STC(0x4b3c8c12), + STC(0x278dde6e), STC(0x00000000), STC(0xd8722192), STC(0xb4c373ee), + STC(0x98722192), STC(0x8643c7b3), STC(0x80000000), STC(0x8643c7b3), + STC(0x98722192), STC(0xb4c373ee), STC(0xd8722192), STC(0x00000000), + STC(0x78a879f4), STC(0x637984d4), STC(0x42e13ba4), STC(0x1a9cd9ac), + STC(0xef4aeaf1), STC(0xc5e3a3a9), STC(0xa326eec0), STC(0x8b10f144), + STC(0x80650347), STC(0x845c8ae3), STC(0x96830876), STC(0xb4c373ee), + STC(0xdba5629b), STC(0x06b2f1d2), STC(0x30fbc54d), STC(0x777f903c), + STC(0x5f1f5ea1), STC(0x3a1c5c57), STC(0x0d61304e), STC(0xdedf047d), + STC(0xb4c373ee), STC(0x94a6715d), STC(0x82cc0f36), STC(0x81936daf), + STC(0x9126145f), STC(0xaf726def), STC(0xd8722192), 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(0xebf9f498), STC(0xcf043ab3), 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(0xdedf047d), + STC(0xc0000000), STC(0xa57d8666), STC(0x245a9d65), STC(0x45b6bb5e), + STC(0x6154fb91), STC(0x74ef0ebc), STC(0x7ee7aa4c), STC(0x7e6c9251), + STC(0x7387ea23), STC(0x5f1f5ea1), STC(0x42e13ba4), STC(0x2120fb83), + STC(0xfca63bd8), STC(0xd8722192), STC(0xb780001c), STC(0x9c867b2c), + STC(0x89be50c3), STC(0x278dde6e), STC(0x4b3c8c12), STC(0x678dde6e), + STC(0x79bc384d), STC(0x7fffffff), STC(0x79bc384d), STC(0x678dde6e), + STC(0x4b3c8c12), STC(0x278dde6e), STC(0x00000000), STC(0xd8722192), + STC(0xb4c373ee), STC(0x98722192), STC(0x8643c7b3), STC(0x80000000), + STC(0x2aba2ee4), STC(0x508d9211), STC(0x6d23501b), STC(0x7d33f0ca), + STC(0x7ee7aa4c), STC(0x720c8075), STC(0x581c00b3), STC(0x340ff242), + STC(0x0a0af299), STC(0xdedf047d), STC(0xb780001c), STC(0x98722192), + STC(0x8545651a), STC(0x802ce84c), STC(0x89be50c3), STC(0x2ddf0040), + STC(0x55a6125c), STC(0x720c8075), STC(0x7f4c7e54), STC(0x7ba3751d), + STC(0x678dde6e), STC(0x45b6bb5e), STC(0x1a9cd9ac), STC(0xebf9f498), + STC(0xc0000000), STC(0x9c867b2c), STC(0x8643c7b3), STC(0x802ce84c), + STC(0x8b10f144), STC(0xa57d8666), +}; + +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(0xf94d0e2e), + 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(0xf7a0dec9), STC(0xef4aeaf1), STC(0xe70747c4), STC(0xdedf047d), + STC(0xd6db1254), STC(0xcf043ab3), STC(0xc763158e), 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(0xf5f50d67), + STC(0xebf9f498), STC(0xe21e765a), STC(0xd8722192), STC(0xcf043ab3), + STC(0xc5e3a3a9), STC(0xbd1ec45c), STC(0xb4c373ee), STC(0xacdee2e8), + STC(0xa57d8666), STC(0x9eab046f), 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(0xf5f50d67), + STC(0xea52c166), STC(0xdedf047d), STC(0xd3b26fb0), STC(0xc8e5032b), + STC(0xbe8df2ba), STC(0xb4c373ee), STC(0xab9a8e6c), STC(0xa326eec0), + STC(0x9b7abc1c), STC(0x94a6715d), STC(0x8eb8b9a0), STC(0x89be50c3), + STC(0x85c1e80e), 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(0xf29ecfb2), STC(0xe5632654), STC(0xd8722192), STC(0xcbf00dbe), + STC(0xc0000000), STC(0xb4c373ee), STC(0xaa59eda4), STC(0xa0e0a15f), + STC(0x98722192), STC(0x9126145f), STC(0x8b10f144), STC(0x8643c7b3), + STC(0x82cc0f36), STC(0x80b381ac), STC(0x80000000), STC(0x80b381ac), + 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(0xf5f50d67), STC(0xe70747c4), STC(0xd8722192), + STC(0xca695b94), STC(0xbd1ec45c), STC(0xb0c1878b), STC(0xa57d8666), + STC(0x9b7abc1c), STC(0x92dcafe5), STC(0x8bc1f6e8), STC(0x8643c7b3), + STC(0x8275a0c0), STC(0x80650347), STC(0x80194350), STC(0x81936daf), + STC(0x84ce444e), STC(0x89be50c3), STC(0x90520d04), 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(0xef4aeaf1), + STC(0xdedf047d), STC(0xcf043ab3), STC(0xc0000000), STC(0xb2141b02), + STC(0xa57d8666), STC(0x9a7365d3), STC(0x9126145f), STC(0x89be50c3), + STC(0x845c8ae3), STC(0x811855b4), STC(0x80000000), STC(0x811855b4), + STC(0x845c8ae3), STC(0x89be50c3), STC(0x9126145f), STC(0x9a7365d3), + STC(0xa57d8666), STC(0xb2141b02), STC(0x7eace58a), STC(0x7aba9ae6), + STC(0x743e0918), STC(0x6b598ea3), STC(0x603c496c), STC(0x53211d18), + STC(0x444d7aff), STC(0x340ff242), STC(0x22be8f87), STC(0x10b5150f), + STC(0xfe531484), STC(0xebf9f498), STC(0xda0aecf9), STC(0xc8e5032b), + STC(0xb8e31319), STC(0xaa59eda4), STC(0x9d969742), STC(0x92dcafe5), + STC(0x8a650cb4), STC(0x845c8ae3), STC(0x80e321ff), STC(0x800b3a91), + STC(0x81d94c8f), STC(0x8643c7b3), STC(0x8d334625), STC(0x96830876), + STC(0xa201b853), STC(0xaf726def), STC(0xbe8df2ba), STC(0xcf043ab3), + STC(0xe07e0c84), STC(0x7e6c9251), STC(0x79bc384d), STC(0x720c8075), + STC(0x678dde6e), STC(0x5a82799a), STC(0x4b3c8c12), STC(0x3a1c5c57), + STC(0x278dde6e), STC(0x14060b68), STC(0x00000000), STC(0xebf9f498), + STC(0xd8722192), STC(0xc5e3a3a9), STC(0xb4c373ee), STC(0xa57d8666), + STC(0x98722192), STC(0x8df37f8b), STC(0x8643c7b3), STC(0x81936daf), + STC(0x80000000), STC(0x81936daf), STC(0x8643c7b3), STC(0x8df37f8b), + STC(0x98722192), STC(0xa57d8666), STC(0xb4c373ee), STC(0xc5e3a3a9), + STC(0xd8722192), STC(0xebf9f498), STC(0x00000000), STC(0x14060b68), + STC(0x7e26b371), STC(0x78a879f4), STC(0x6fadf2fc), STC(0x637984d4), + STC(0x54657194), STC(0x42e13ba4), STC(0x2f6e6d16), STC(0x1a9cd9ac), + STC(0x05067734), STC(0xef4aeaf1), STC(0xda0aecf9), STC(0xc5e3a3a9), + STC(0xb36a1978), STC(0xa326eec0), STC(0x9592675c), STC(0x8b10f144), + STC(0x83f03dd6), STC(0x80650347), STC(0x808976d1), STC(0x845c8ae3), + STC(0x8bc1f6e8), STC(0x96830876), STC(0xa45037c9), STC(0xb4c373ee), + STC(0xc763158e), STC(0xdba5629b), STC(0xf0f488d9), 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(0xf5f50d67), + STC(0xdedf047d), STC(0xc8e5032b), STC(0xb4c373ee), STC(0xa326eec0), + STC(0x94a6715d), STC(0x89be50c3), STC(0x82cc0f36), STC(0x800b3a91), + STC(0x81936daf), STC(0x8757860c), STC(0x9126145f), STC(0x9eab046f), + STC(0xaf726def), STC(0xc2ec7635), STC(0xd8722192), STC(0xef4aeaf1), + 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(0xf29ecfb2), + 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(0xfaf988cc), STC(0xebf9f498), + STC(0xdd417079), STC(0xcf043ab3), STC(0xc174dbf2), 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(0xef4aeaf1), + STC(0xdedf047d), STC(0xcf043ab3), STC(0xc0000000), STC(0xb2141b02), + STC(0xa57d8666), STC(0x9a7365d3), 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(0xfca63bd8), + STC(0xea52c166), STC(0xd8722192), STC(0xc763158e), STC(0xb780001c), + STC(0xa91d0ea3), STC(0x9c867b2c), STC(0x91fef880), STC(0x89be50c3), + STC(0x83f03dd6), 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(0xebf9f498), STC(0xd8722192), STC(0xc5e3a3a9), + STC(0xb4c373ee), STC(0xa57d8666), STC(0x98722192), STC(0x8df37f8b), + STC(0x8643c7b3), STC(0x81936daf), STC(0x80000000), STC(0x81936daf), + 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(0xf449acca), STC(0xdedf047d), + STC(0xca695b94), STC(0xb780001c), STC(0xa6aecd5e), STC(0x98722192), + STC(0x8d334625), STC(0x8545651a), STC(0x80e321ff), STC(0x802ce84c), + STC(0x8327fb9c), STC(0x89be50c3), STC(0x93bf30d4), 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(0xebf9f498), STC(0xd545d11c), STC(0xc0000000), STC(0xacdee2e8), + STC(0x9c867b2c), STC(0x8f82ebbd), STC(0x8643c7b3), STC(0x811855b4), + STC(0x802ce84c), STC(0x838961e8), STC(0x8b10f144), STC(0x96830876), + STC(0xa57d8666), STC(0xb780001c), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorReal20[] = { + STC(0x79bc384d), STC(0x678dde6e), STC(0x4b3c8c12), STC(0x678dde6e), + STC(0x278dde6e), STC(0xd8722192), STC(0x4b3c8c12), STC(0xd8722192), + STC(0x8643c7b3), STC(0x278dde6e), STC(0x98722192), STC(0x98722192), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_STB RotVectorImag20[] = { + STC(0x278dde6e), STC(0x4b3c8c12), STC(0x678dde6e), STC(0x4b3c8c12), + STC(0x79bc384d), STC(0x79bc384d), STC(0x678dde6e), STC(0x79bc384d), + STC(0x278dde6e), STC(0x79bc384d), STC(0x4b3c8c12), STC(0xb4c373ee), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow8[] = { + WTCP(0x7f62368f, 0x0c8bd35e), + WTCP(0x7a7d055b, 0x25280c5e), + WTCP(0x70e2cbc6, 0x3c56ba70), + WTCP(0x62f201ac, 0x5133cc94), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow12[] = { + WTCP(0x7fb9d759, 0x085f2137), WTCP(0x7d8a5f40, 0x18f8b83c), + WTCP(0x793501a9, 0x2924edac), WTCP(0x72ccb9db, 0x389cea72), + WTCP(0x6a6d98a4, 0x471cece7), WTCP(0x603c496c, 0x54657194), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow16[] = { + WTCP(0x7fd8878e, 0x0647d97c), WTCP(0x7e9d55fc, 0x12c8106f), + WTCP(0x7c29fbee, 0x1f19f97b), WTCP(0x78848414, 0x2b1f34eb), + WTCP(0x73b5ebd1, 0x36ba2014), WTCP(0x6dca0d14, 0x41ce1e65), + WTCP(0x66cf8120, 0x4c3fdff4), WTCP(0x5ed77c8a, 0x55f5a4d2), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow20[] = { + WTCP(0x7fe6bcb0, 0x05067734), WTCP(0x7f1cde01, 0x0f0b7727), + WTCP(0x7d8a5f40, 0x18f8b83c), WTCP(0x7b31bbb2, 0x22be8f87), + WTCP(0x7816a759, 0x2c4d9050), WTCP(0x743e0918, 0x3596a46c), + WTCP(0x6fadf2fc, 0x3e8b240e), WTCP(0x6a6d98a4, 0x471cece7), + WTCP(0x648543e4, 0x4f3e7875), WTCP(0x5dfe47ad, 0x56e2f15d), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow24[] = { + WTCP(0x7fee74a2, 0x0430238f), WTCP(0x7f62368f, 0x0c8bd35e), + WTCP(0x7e4a5426, 0x14d9c245), WTCP(0x7ca80038, 0x1d10d5c2), + WTCP(0x7a7d055b, 0x25280c5e), WTCP(0x77cbc3f2, 0x2d168792), + WTCP(0x74972f92, 0x34d3957e), WTCP(0x70e2cbc6, 0x3c56ba70), + WTCP(0x6cb2a837, 0x4397ba32), WTCP(0x680b5c33, 0x4a8ea111), + WTCP(0x62f201ac, 0x5133cc94), WTCP(0x5d6c2f99, 0x577ff3da), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +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), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow40[] = { + WTCP(0x7ff9af04, 0x02835b5a), WTCP(0x7fc72ae2, 0x07891418), + WTCP(0x7f62368f, 0x0c8bd35e), WTCP(0x7ecaf9e5, 0x11899ed3), + WTCP(0x7e01b096, 0x16807e15), WTCP(0x7d06aa16, 0x1b6e7b7a), + WTCP(0x7bda497d, 0x2051a4dd), WTCP(0x7a7d055b, 0x25280c5e), + WTCP(0x78ef678f, 0x29efc925), WTCP(0x77320d0d, 0x2ea6f827), + WTCP(0x7545a5a0, 0x334bbcde), WTCP(0x732af3a7, 0x37dc420c), + WTCP(0x70e2cbc6, 0x3c56ba70), WTCP(0x6e6e1492, 0x40b9617d), + WTCP(0x6bcdc639, 0x45027c0c), WTCP(0x6902ea1d, 0x4930590f), + WTCP(0x660e9a6a, 0x4d415234), WTCP(0x62f201ac, 0x5133cc94), + WTCP(0x5fae5a55, 0x55063951), WTCP(0x5c44ee40, 0x58b71632), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow48[] = { + WTCP(0x7ffb9d15, 0x02182427), WTCP(0x7fd8878e, 0x0647d97c), + WTCP(0x7f92661d, 0x0a75d60e), WTCP(0x7f294bfd, 0x0ea0f48c), + WTCP(0x7e9d55fc, 0x12c8106f), WTCP(0x7deeaa7a, 0x16ea0646), + WTCP(0x7d1d7958, 0x1b05b40f), WTCP(0x7c29fbee, 0x1f19f97b), + WTCP(0x7b1474fd, 0x2325b847), WTCP(0x79dd3098, 0x2727d486), + WTCP(0x78848414, 0x2b1f34eb), WTCP(0x770acdec, 0x2f0ac320), + WTCP(0x757075ac, 0x32e96c09), WTCP(0x73b5ebd1, 0x36ba2014), + WTCP(0x71dba9ab, 0x3a7bd382), WTCP(0x6fe2313c, 0x3e2d7eb1), + WTCP(0x6dca0d14, 0x41ce1e65), WTCP(0x6b93d02e, 0x455cb40c), + WTCP(0x694015c3, 0x48d84609), WTCP(0x66cf8120, 0x4c3fdff4), + WTCP(0x6442bd7e, 0x4f9292dc), WTCP(0x619a7dce, 0x52cf758f), + WTCP(0x5ed77c8a, 0x55f5a4d2), WTCP(0x5bfa7b82, 0x590443a7), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +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), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow96[] = { + WTCP(0x7ffee744, 0x010c1460), WTCP(0x7ff62182, 0x03242abf), + WTCP(0x7fe49698, 0x053c0a01), WTCP(0x7fca47b9, 0x07538d6b), + WTCP(0x7fa736b4, 0x096a9049), WTCP(0x7f7b65ef, 0x0b80edf1), + WTCP(0x7f46d86c, 0x0d9681c2), WTCP(0x7f0991c4, 0x0fab272b), + WTCP(0x7ec3962a, 0x11beb9aa), WTCP(0x7e74ea6a, 0x13d114d0), + WTCP(0x7e1d93ea, 0x15e21445), WTCP(0x7dbd98a4, 0x17f193c5), + WTCP(0x7d54ff2e, 0x19ff6f2a), WTCP(0x7ce3ceb2, 0x1c0b826a), + WTCP(0x7c6a0ef2, 0x1e15a99a), WTCP(0x7be7c847, 0x201dc0ef), + WTCP(0x7b5d039e, 0x2223a4c5), WTCP(0x7ac9ca7a, 0x2427319d), + WTCP(0x7a2e26f2, 0x26284422), WTCP(0x798a23b1, 0x2826b928), + WTCP(0x78ddcbf5, 0x2a226db5), WTCP(0x78292b8d, 0x2c1b3efb), + WTCP(0x776c4edb, 0x2e110a62), WTCP(0x76a742d1, 0x3003ad85), + WTCP(0x75da14ef, 0x31f30638), WTCP(0x7504d345, 0x33def287), + WTCP(0x74278c72, 0x35c750bc), WTCP(0x73424fa0, 0x37abff5d), + WTCP(0x72552c85, 0x398cdd32), WTCP(0x71603361, 0x3b69c947), + WTCP(0x706374ff, 0x3d42a2ec), WTCP(0x6f5f02b2, 0x3f1749b8), + WTCP(0x6e52ee52, 0x40e79d8c), WTCP(0x6d3f4a40, 0x42b37e96), + WTCP(0x6c242960, 0x447acd50), WTCP(0x6b019f1a, 0x463d6a87), + WTCP(0x69d7bf57, 0x47fb3757), WTCP(0x68a69e81, 0x49b41533), + WTCP(0x676e5183, 0x4b67e5e4), WTCP(0x662eedc3, 0x4d168b8b), + WTCP(0x64e88926, 0x4ebfe8a5), WTCP(0x639b3a0b, 0x5063e008), + WTCP(0x62471749, 0x520254ef), WTCP(0x60ec3830, 0x539b2af0), + WTCP(0x5f8ab487, 0x552e4605), WTCP(0x5e22a487, 0x56bb8a90), + WTCP(0x5cb420e0, 0x5842dd54), WTCP(0x5b3f42ae, 0x59c42381), +}; + +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 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 SineWindow160[] = { + WTCP(0x7fff9aef, 0x00a0d951), WTCP(0x7ffc726f, 0x01e287fc), + WTCP(0x7ff62182, 0x03242abf), WTCP(0x7feca851, 0x0465b9aa), + WTCP(0x7fe00716, 0x05a72ccf), WTCP(0x7fd03e23, 0x06e87c3f), + WTCP(0x7fbd4dda, 0x0829a00c), WTCP(0x7fa736b4, 0x096a9049), + WTCP(0x7f8df93c, 0x0aab450d), WTCP(0x7f719611, 0x0bebb66c), + WTCP(0x7f520de6, 0x0d2bdc80), WTCP(0x7f2f6183, 0x0e6baf61), + WTCP(0x7f0991c4, 0x0fab272b), WTCP(0x7ee09f95, 0x10ea3bfd), + WTCP(0x7eb48bfb, 0x1228e5f8), WTCP(0x7e85580c, 0x13671d3d), + WTCP(0x7e5304f2, 0x14a4d9f4), WTCP(0x7e1d93ea, 0x15e21445), + WTCP(0x7de50646, 0x171ec45c), WTCP(0x7da95d6c, 0x185ae269), + WTCP(0x7d6a9ad5, 0x199666a0), WTCP(0x7d28c00c, 0x1ad14938), + WTCP(0x7ce3ceb2, 0x1c0b826a), WTCP(0x7c9bc87a, 0x1d450a78), + WTCP(0x7c50af2b, 0x1e7dd9a4), WTCP(0x7c02849f, 0x1fb5e836), + WTCP(0x7bb14ac5, 0x20ed2e7b), WTCP(0x7b5d039e, 0x2223a4c5), + WTCP(0x7b05b13d, 0x2359436c), WTCP(0x7aab55ca, 0x248e02cb), + WTCP(0x7a4df380, 0x25c1db44), WTCP(0x79ed8cad, 0x26f4c53e), + WTCP(0x798a23b1, 0x2826b928), WTCP(0x7923bb01, 0x2957af74), + WTCP(0x78ba5524, 0x2a87a09d), WTCP(0x784df4b3, 0x2bb68522), + WTCP(0x77de9c5b, 0x2ce45589), WTCP(0x776c4edb, 0x2e110a62), + WTCP(0x76f70f05, 0x2f3c9c40), WTCP(0x767edfbe, 0x306703bf), + WTCP(0x7603c3fd, 0x31903982), WTCP(0x7585becb, 0x32b83634), + WTCP(0x7504d345, 0x33def287), WTCP(0x74810499, 0x35046736), + WTCP(0x73fa5607, 0x36288d03), WTCP(0x7370cae2, 0x374b5cb9), + WTCP(0x72e4668f, 0x386ccf2a), WTCP(0x72552c85, 0x398cdd32), + WTCP(0x71c3204c, 0x3aab7fb7), WTCP(0x712e457f, 0x3bc8afa5), + WTCP(0x70969fca, 0x3ce465f3), WTCP(0x6ffc32eb, 0x3dfe9ba1), + WTCP(0x6f5f02b2, 0x3f1749b8), WTCP(0x6ebf12ff, 0x402e694c), + WTCP(0x6e1c67c4, 0x4143f379), WTCP(0x6d770506, 0x4257e166), + WTCP(0x6cceeed8, 0x436a2c45), WTCP(0x6c242960, 0x447acd50), + WTCP(0x6b76b8d6, 0x4589bdcf), WTCP(0x6ac6a180, 0x4696f710), + WTCP(0x6a13e7b8, 0x47a27271), WTCP(0x695e8fe5, 0x48ac2957), + WTCP(0x68a69e81, 0x49b41533), WTCP(0x67ec1817, 0x4aba2f84), + WTCP(0x672f013f, 0x4bbe71d1), WTCP(0x666f5ea6, 0x4cc0d5ae), + WTCP(0x65ad3505, 0x4dc154bb), WTCP(0x64e88926, 0x4ebfe8a5), + WTCP(0x64215fe5, 0x4fbc8b22), WTCP(0x6357be2a, 0x50b735f8), + WTCP(0x628ba8ef, 0x51afe2f6), WTCP(0x61bd253f, 0x52a68bfb), + WTCP(0x60ec3830, 0x539b2af0), WTCP(0x6018e6eb, 0x548db9cb), + WTCP(0x5f4336a7, 0x557e3292), WTCP(0x5e6b2ca8, 0x566c8f55), + WTCP(0x5d90ce45, 0x5758ca31), WTCP(0x5cb420e0, 0x5842dd54), + WTCP(0x5bd529eb, 0x592ac2f7), WTCP(0x5af3eee6, 0x5a107561), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow192[] = { + WTCP(0x7fffb9d1, 0x00860a79), WTCP(0x7ffd885a, 0x01921d20), + WTCP(0x7ff92577, 0x029e28e2), WTCP(0x7ff2913a, 0x03aa292a), + WTCP(0x7fe9cbc0, 0x04b6195d), WTCP(0x7fded530, 0x05c1f4e7), + WTCP(0x7fd1adb9, 0x06cdb72f), WTCP(0x7fc25596, 0x07d95b9e), + WTCP(0x7fb0cd0a, 0x08e4dda0), WTCP(0x7f9d1461, 0x09f0389f), + WTCP(0x7f872bf3, 0x0afb6805), WTCP(0x7f6f141f, 0x0c066740), + WTCP(0x7f54cd4f, 0x0d1131ba), WTCP(0x7f3857f6, 0x0e1bc2e4), + WTCP(0x7f19b491, 0x0f26162a), WTCP(0x7ef8e3a6, 0x103026fe), + WTCP(0x7ed5e5c6, 0x1139f0cf), WTCP(0x7eb0bb8a, 0x12436f10), + WTCP(0x7e896595, 0x134c9d34), WTCP(0x7e5fe493, 0x145576b1), + WTCP(0x7e34393b, 0x155df6fc), WTCP(0x7e06644c, 0x1666198d), + WTCP(0x7dd6668f, 0x176dd9de), WTCP(0x7da440d6, 0x1875336a), + WTCP(0x7d6ff3fe, 0x197c21ad), WTCP(0x7d3980ec, 0x1a82a026), + WTCP(0x7d00e88f, 0x1b88aa55), WTCP(0x7cc62bdf, 0x1c8e3bbe), + WTCP(0x7c894bde, 0x1d934fe5), WTCP(0x7c4a4996, 0x1e97e251), + WTCP(0x7c09261d, 0x1f9bee8a), WTCP(0x7bc5e290, 0x209f701c), + WTCP(0x7b808015, 0x21a26295), WTCP(0x7b38ffde, 0x22a4c185), + WTCP(0x7aef6323, 0x23a6887f), WTCP(0x7aa3ab29, 0x24a7b317), + WTCP(0x7a55d93a, 0x25a83ce6), WTCP(0x7a05eead, 0x26a82186), + WTCP(0x79b3ece0, 0x27a75c95), WTCP(0x795fd53a, 0x28a5e9b4), + WTCP(0x7909a92d, 0x29a3c485), WTCP(0x78b16a32, 0x2aa0e8b0), + WTCP(0x785719cc, 0x2b9d51dd), WTCP(0x77fab989, 0x2c98fbba), + WTCP(0x779c4afc, 0x2d93e1f8), WTCP(0x773bcfc4, 0x2e8e0048), + WTCP(0x76d94989, 0x2f875262), WTCP(0x7674b9fa, 0x307fd401), + WTCP(0x760e22d1, 0x317780e2), WTCP(0x75a585cf, 0x326e54c7), + WTCP(0x753ae4c0, 0x33644b76), WTCP(0x74ce4177, 0x345960b7), + WTCP(0x745f9dd1, 0x354d9057), WTCP(0x73eefbb3, 0x3640d627), + WTCP(0x737c5d0b, 0x37332dfd), WTCP(0x7307c3d0, 0x382493b0), + WTCP(0x72913201, 0x3915031f), WTCP(0x7218a9a7, 0x3a04782a), + WTCP(0x719e2cd2, 0x3af2eeb7), WTCP(0x7121bd9c, 0x3be062b0), + WTCP(0x70a35e25, 0x3cccd004), WTCP(0x7023109a, 0x3db832a6), + WTCP(0x6fa0d72c, 0x3ea2868c), WTCP(0x6f1cb416, 0x3f8bc7b4), + WTCP(0x6e96a99d, 0x4073f21d), WTCP(0x6e0eba0c, 0x415b01ce), + WTCP(0x6d84e7b7, 0x4240f2d1), WTCP(0x6cf934fc, 0x4325c135), + WTCP(0x6c6ba43e, 0x44096910), WTCP(0x6bdc37eb, 0x44ebe679), + WTCP(0x6b4af279, 0x45cd358f), WTCP(0x6ab7d663, 0x46ad5278), + WTCP(0x6a22e630, 0x478c395a), WTCP(0x698c246c, 0x4869e665), + WTCP(0x68f393ae, 0x494655cc), WTCP(0x68593691, 0x4a2183c8), + WTCP(0x67bd0fbd, 0x4afb6c98), WTCP(0x671f21dc, 0x4bd40c80), + WTCP(0x667f6fa5, 0x4cab5fc9), WTCP(0x65ddfbd3, 0x4d8162c4), + WTCP(0x653ac92b, 0x4e5611c5), WTCP(0x6495da79, 0x4f296928), + WTCP(0x63ef3290, 0x4ffb654d), WTCP(0x6346d44b, 0x50cc029c), + WTCP(0x629cc28c, 0x519b3d80), WTCP(0x61f1003f, 0x5269126e), + WTCP(0x61439053, 0x53357ddf), WTCP(0x609475c3, 0x54007c51), + WTCP(0x5fe3b38d, 0x54ca0a4b), WTCP(0x5f314cba, 0x55922457), + WTCP(0x5e7d4458, 0x5658c709), WTCP(0x5dc79d7c, 0x571deefa), + WTCP(0x5d105b44, 0x57e198c7), WTCP(0x5c5780d3, 0x58a3c118), + WTCP(0x5b9d1154, 0x59646498), WTCP(0x5ae10ff9, 0x5a237ffa), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow240[] = { + WTCP(0x7fffd315, 0x006b3b9b), WTCP(0x7ffe6bbf, 0x0141b1a5), + WTCP(0x7ffb9d15, 0x02182427), WTCP(0x7ff76721, 0x02ee90c8), + WTCP(0x7ff1c9ef, 0x03c4f52f), WTCP(0x7feac58d, 0x049b4f00), + WTCP(0x7fe25a0f, 0x05719be2), WTCP(0x7fd8878e, 0x0647d97c), + WTCP(0x7fcd4e24, 0x071e0575), WTCP(0x7fc0adf2, 0x07f41d72), + WTCP(0x7fb2a71b, 0x08ca1f1b), WTCP(0x7fa339c5, 0x09a00817), + WTCP(0x7f92661d, 0x0a75d60e), WTCP(0x7f802c52, 0x0b4b86a8), + WTCP(0x7f6c8c96, 0x0c21178c), WTCP(0x7f578721, 0x0cf68662), + WTCP(0x7f411c2f, 0x0dcbd0d5), WTCP(0x7f294bfd, 0x0ea0f48c), + WTCP(0x7f1016ce, 0x0f75ef33), WTCP(0x7ef57cea, 0x104abe71), + WTCP(0x7ed97e9c, 0x111f5ff4), WTCP(0x7ebc1c31, 0x11f3d164), + WTCP(0x7e9d55fc, 0x12c8106f), WTCP(0x7e7d2c54, 0x139c1abf), + WTCP(0x7e5b9f93, 0x146fee03), WTCP(0x7e38b017, 0x154387e6), + WTCP(0x7e145e42, 0x1616e618), WTCP(0x7deeaa7a, 0x16ea0646), + WTCP(0x7dc79529, 0x17bce621), WTCP(0x7d9f1ebd, 0x188f8357), + WTCP(0x7d7547a7, 0x1961db9b), WTCP(0x7d4a105d, 0x1a33ec9c), + WTCP(0x7d1d7958, 0x1b05b40f), WTCP(0x7cef8315, 0x1bd72fa4), + WTCP(0x7cc02e15, 0x1ca85d12), WTCP(0x7c8f7ade, 0x1d793a0b), + WTCP(0x7c5d69f7, 0x1e49c447), WTCP(0x7c29fbee, 0x1f19f97b), + WTCP(0x7bf53153, 0x1fe9d75f), WTCP(0x7bbf0aba, 0x20b95bac), + WTCP(0x7b8788ba, 0x2188841a), WTCP(0x7b4eabf1, 0x22574e65), + WTCP(0x7b1474fd, 0x2325b847), WTCP(0x7ad8e482, 0x23f3bf7e), + WTCP(0x7a9bfb27, 0x24c161c7), WTCP(0x7a5db997, 0x258e9ce0), + WTCP(0x7a1e2082, 0x265b6e8a), WTCP(0x79dd3098, 0x2727d486), + WTCP(0x799aea92, 0x27f3cc94), WTCP(0x79574f28, 0x28bf547b), + WTCP(0x79125f19, 0x298a69fc), WTCP(0x78cc1b26, 0x2a550adf), + WTCP(0x78848414, 0x2b1f34eb), WTCP(0x783b9aad, 0x2be8e5e8), + WTCP(0x77f15fbc, 0x2cb21ba0), WTCP(0x77a5d413, 0x2d7ad3de), + WTCP(0x7758f886, 0x2e430c6f), WTCP(0x770acdec, 0x2f0ac320), + WTCP(0x76bb5521, 0x2fd1f5c1), WTCP(0x766a8f04, 0x3098a223), + WTCP(0x76187c77, 0x315ec617), WTCP(0x75c51e61, 0x32245f72), + WTCP(0x757075ac, 0x32e96c09), WTCP(0x751a8346, 0x33ade9b3), + WTCP(0x74c34820, 0x3471d647), WTCP(0x746ac52f, 0x35352fa1), + WTCP(0x7410fb6b, 0x35f7f39c), WTCP(0x73b5ebd1, 0x36ba2014), + WTCP(0x73599760, 0x377bb2e9), WTCP(0x72fbff1b, 0x383ca9fb), + WTCP(0x729d2409, 0x38fd032d), WTCP(0x723d0734, 0x39bcbc63), + WTCP(0x71dba9ab, 0x3a7bd382), WTCP(0x71790c7e, 0x3b3a4672), + WTCP(0x711530c2, 0x3bf8131c), WTCP(0x70b01790, 0x3cb5376b), + WTCP(0x7049c203, 0x3d71b14d), WTCP(0x6fe2313c, 0x3e2d7eb1), + WTCP(0x6f79665b, 0x3ee89d86), WTCP(0x6f0f6289, 0x3fa30bc1), + WTCP(0x6ea426ed, 0x405cc754), WTCP(0x6e37b4b6, 0x4115ce38), + WTCP(0x6dca0d14, 0x41ce1e65), WTCP(0x6d5b313b, 0x4285b5d4), + WTCP(0x6ceb2261, 0x433c9283), WTCP(0x6c79e1c2, 0x43f2b271), + WTCP(0x6c07709b, 0x44a8139e), WTCP(0x6b93d02e, 0x455cb40c), + WTCP(0x6b1f01c0, 0x461091c2), WTCP(0x6aa90697, 0x46c3aac5), + WTCP(0x6a31e000, 0x4775fd1f), WTCP(0x69b98f48, 0x482786dc), + WTCP(0x694015c3, 0x48d84609), WTCP(0x68c574c4, 0x498838b6), + WTCP(0x6849ada3, 0x4a375cf5), WTCP(0x67ccc1be, 0x4ae5b0da), + WTCP(0x674eb271, 0x4b93327c), WTCP(0x66cf8120, 0x4c3fdff4), + WTCP(0x664f2f2e, 0x4cebb75c), WTCP(0x65cdbe05, 0x4d96b6d3), + WTCP(0x654b2f10, 0x4e40dc79), WTCP(0x64c783bd, 0x4eea2670), + WTCP(0x6442bd7e, 0x4f9292dc), WTCP(0x63bcddc7, 0x503a1fe5), + WTCP(0x6335e611, 0x50e0cbb4), WTCP(0x62add7d6, 0x51869476), + WTCP(0x6224b495, 0x522b7859), WTCP(0x619a7dce, 0x52cf758f), + WTCP(0x610f3505, 0x53728a4a), WTCP(0x6082dbc1, 0x5414b4c1), + WTCP(0x5ff5738d, 0x54b5f32c), WTCP(0x5f66fdf5, 0x555643c8), + WTCP(0x5ed77c8a, 0x55f5a4d2), WTCP(0x5e46f0dd, 0x5694148b), + WTCP(0x5db55c86, 0x57319135), WTCP(0x5d22c11c, 0x57ce1917), + WTCP(0x5c8f203b, 0x5869aa79), WTCP(0x5bfa7b82, 0x590443a7), + WTCP(0x5b64d492, 0x599de2ee), WTCP(0x5ace2d0f, 0x5a36869f), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow256[] = { + WTCP(0x7fffd886, 0x006487e3), WTCP(0x7ffe9cb2, 0x012d96b1), + WTCP(0x7ffc250f, 0x01f6a297), WTCP(0x7ff871a2, 0x02bfa9a4), + WTCP(0x7ff38274, 0x0388a9ea), WTCP(0x7fed5791, 0x0451a177), + WTCP(0x7fe5f108, 0x051a8e5c), WTCP(0x7fdd4eec, 0x05e36ea9), + WTCP(0x7fd37153, 0x06ac406f), WTCP(0x7fc85854, 0x077501be), + WTCP(0x7fbc040a, 0x083db0a7), WTCP(0x7fae7495, 0x09064b3a), + WTCP(0x7f9faa15, 0x09cecf89), WTCP(0x7f8fa4b0, 0x0a973ba5), + WTCP(0x7f7e648c, 0x0b5f8d9f), WTCP(0x7f6be9d4, 0x0c27c389), + WTCP(0x7f5834b7, 0x0cefdb76), WTCP(0x7f434563, 0x0db7d376), + WTCP(0x7f2d1c0e, 0x0e7fa99e), WTCP(0x7f15b8ee, 0x0f475bff), + WTCP(0x7efd1c3c, 0x100ee8ad), WTCP(0x7ee34636, 0x10d64dbd), + WTCP(0x7ec8371a, 0x119d8941), WTCP(0x7eabef2c, 0x1264994e), + WTCP(0x7e8e6eb2, 0x132b7bf9), WTCP(0x7e6fb5f4, 0x13f22f58), + WTCP(0x7e4fc53e, 0x14b8b17f), WTCP(0x7e2e9cdf, 0x157f0086), + WTCP(0x7e0c3d29, 0x16451a83), WTCP(0x7de8a670, 0x170afd8d), + WTCP(0x7dc3d90d, 0x17d0a7bc), WTCP(0x7d9dd55a, 0x18961728), + WTCP(0x7d769bb5, 0x195b49ea), WTCP(0x7d4e2c7f, 0x1a203e1b), + WTCP(0x7d24881b, 0x1ae4f1d6), WTCP(0x7cf9aef0, 0x1ba96335), + WTCP(0x7ccda169, 0x1c6d9053), WTCP(0x7ca05ff1, 0x1d31774d), + WTCP(0x7c71eaf9, 0x1df5163f), WTCP(0x7c4242f2, 0x1eb86b46), + WTCP(0x7c116853, 0x1f7b7481), WTCP(0x7bdf5b94, 0x203e300d), + WTCP(0x7bac1d31, 0x21009c0c), WTCP(0x7b77ada8, 0x21c2b69c), + WTCP(0x7b420d7a, 0x22847de0), WTCP(0x7b0b3d2c, 0x2345eff8), + WTCP(0x7ad33d45, 0x24070b08), WTCP(0x7a9a0e50, 0x24c7cd33), + WTCP(0x7a5fb0d8, 0x2588349d), WTCP(0x7a24256f, 0x26483f6c), + WTCP(0x79e76ca7, 0x2707ebc7), WTCP(0x79a98715, 0x27c737d3), + WTCP(0x796a7554, 0x288621b9), WTCP(0x792a37fe, 0x2944a7a2), + WTCP(0x78e8cfb2, 0x2a02c7b8), WTCP(0x78a63d11, 0x2ac08026), + WTCP(0x786280bf, 0x2b7dcf17), WTCP(0x781d9b65, 0x2c3ab2b9), + WTCP(0x77d78daa, 0x2cf72939), WTCP(0x7790583e, 0x2db330c7), + WTCP(0x7747fbce, 0x2e6ec792), WTCP(0x76fe790e, 0x2f29ebcc), + WTCP(0x76b3d0b4, 0x2fe49ba7), WTCP(0x76680376, 0x309ed556), + WTCP(0x761b1211, 0x3158970e), WTCP(0x75ccfd42, 0x3211df04), + WTCP(0x757dc5ca, 0x32caab6f), WTCP(0x752d6c6c, 0x3382fa88), + WTCP(0x74dbf1ef, 0x343aca87), WTCP(0x7489571c, 0x34f219a8), + WTCP(0x74359cbd, 0x35a8e625), WTCP(0x73e0c3a3, 0x365f2e3b), + WTCP(0x738acc9e, 0x3714f02a), WTCP(0x7333b883, 0x37ca2a30), + WTCP(0x72db8828, 0x387eda8e), WTCP(0x72823c67, 0x3932ff87), + WTCP(0x7227d61c, 0x39e6975e), WTCP(0x71cc5626, 0x3a99a057), + WTCP(0x716fbd68, 0x3b4c18ba), WTCP(0x71120cc5, 0x3bfdfecd), + WTCP(0x70b34525, 0x3caf50da), WTCP(0x70536771, 0x3d600d2c), + WTCP(0x6ff27497, 0x3e10320d), WTCP(0x6f906d84, 0x3ebfbdcd), + WTCP(0x6f2d532c, 0x3f6eaeb8), WTCP(0x6ec92683, 0x401d0321), + WTCP(0x6e63e87f, 0x40cab958), WTCP(0x6dfd9a1c, 0x4177cfb1), + WTCP(0x6d963c54, 0x42244481), WTCP(0x6d2dd027, 0x42d0161e), + WTCP(0x6cc45698, 0x437b42e1), WTCP(0x6c59d0a9, 0x4425c923), + WTCP(0x6bee3f62, 0x44cfa740), WTCP(0x6b81a3cd, 0x4578db93), + WTCP(0x6b13fef5, 0x4621647d), WTCP(0x6aa551e9, 0x46c9405c), + WTCP(0x6a359db9, 0x47706d93), WTCP(0x69c4e37a, 0x4816ea86), + WTCP(0x69532442, 0x48bcb599), WTCP(0x68e06129, 0x4961cd33), + WTCP(0x686c9b4b, 0x4a062fbd), WTCP(0x67f7d3c5, 0x4aa9dba2), + WTCP(0x67820bb7, 0x4b4ccf4d), WTCP(0x670b4444, 0x4bef092d), + WTCP(0x66937e91, 0x4c9087b1), WTCP(0x661abbc5, 0x4d31494b), + WTCP(0x65a0fd0b, 0x4dd14c6e), WTCP(0x6526438f, 0x4e708f8f), + WTCP(0x64aa907f, 0x4f0f1126), WTCP(0x642de50d, 0x4faccfab), + WTCP(0x63b0426d, 0x5049c999), WTCP(0x6331a9d4, 0x50e5fd6d), + WTCP(0x62b21c7b, 0x518169a5), WTCP(0x62319b9d, 0x521c0cc2), + WTCP(0x61b02876, 0x52b5e546), WTCP(0x612dc447, 0x534ef1b5), + WTCP(0x60aa7050, 0x53e73097), WTCP(0x60262dd6, 0x547ea073), + WTCP(0x5fa0fe1f, 0x55153fd4), WTCP(0x5f1ae274, 0x55ab0d46), + WTCP(0x5e93dc1f, 0x56400758), WTCP(0x5e0bec6e, 0x56d42c99), + WTCP(0x5d8314b1, 0x57677b9d), WTCP(0x5cf95638, 0x57f9f2f8), + WTCP(0x5c6eb258, 0x588b9140), WTCP(0x5be32a67, 0x591c550e), + WTCP(0x5b56bfbd, 0x59ac3cfd), WTCP(0x5ac973b5, 0x5a3b47ab), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow384[] = { + WTCP(0x7fffee74, 0x00430546), WTCP(0x7fff6216, 0x00c90f88), + WTCP(0x7ffe495b, 0x014f18ee), WTCP(0x7ffca443, 0x01d520e4), + WTCP(0x7ffa72d1, 0x025b26d7), WTCP(0x7ff7b507, 0x02e12a36), + WTCP(0x7ff46ae8, 0x03672a6c), WTCP(0x7ff09478, 0x03ed26e6), + WTCP(0x7fec31ba, 0x04731f13), WTCP(0x7fe742b4, 0x04f9125e), + WTCP(0x7fe1c76b, 0x057f0035), WTCP(0x7fdbbfe6, 0x0604e805), + WTCP(0x7fd52c29, 0x068ac93b), WTCP(0x7fce0c3e, 0x0710a345), + WTCP(0x7fc6602c, 0x0796758f), WTCP(0x7fbe27fa, 0x081c3f87), + WTCP(0x7fb563b3, 0x08a2009a), WTCP(0x7fac135f, 0x0927b836), + WTCP(0x7fa2370a, 0x09ad65c8), WTCP(0x7f97cebd, 0x0a3308bd), + WTCP(0x7f8cda84, 0x0ab8a082), WTCP(0x7f815a6b, 0x0b3e2c86), + WTCP(0x7f754e80, 0x0bc3ac35), WTCP(0x7f68b6ce, 0x0c491efe), + WTCP(0x7f5b9364, 0x0cce844e), WTCP(0x7f4de451, 0x0d53db92), + WTCP(0x7f3fa9a2, 0x0dd92439), WTCP(0x7f30e369, 0x0e5e5db0), + WTCP(0x7f2191b4, 0x0ee38766), WTCP(0x7f11b495, 0x0f68a0c8), + WTCP(0x7f014c1e, 0x0feda943), WTCP(0x7ef05860, 0x1072a048), + WTCP(0x7eded96d, 0x10f78543), WTCP(0x7ecccf5a, 0x117c57a2), + WTCP(0x7eba3a39, 0x120116d5), WTCP(0x7ea71a20, 0x1285c249), + WTCP(0x7e936f22, 0x130a596e), WTCP(0x7e7f3957, 0x138edbb1), + WTCP(0x7e6a78d3, 0x14134881), WTCP(0x7e552dae, 0x14979f4e), + WTCP(0x7e3f57ff, 0x151bdf86), WTCP(0x7e28f7de, 0x15a00897), + WTCP(0x7e120d63, 0x162419f2), WTCP(0x7dfa98a8, 0x16a81305), + WTCP(0x7de299c6, 0x172bf33f), WTCP(0x7dca10d8, 0x17afba11), + WTCP(0x7db0fdf8, 0x183366e9), WTCP(0x7d976142, 0x18b6f936), + WTCP(0x7d7d3ad3, 0x193a706a), WTCP(0x7d628ac6, 0x19bdcbf3), + WTCP(0x7d475139, 0x1a410b41), WTCP(0x7d2b8e4a, 0x1ac42dc5), + WTCP(0x7d0f4218, 0x1b4732ef), WTCP(0x7cf26cc1, 0x1bca1a2f), + WTCP(0x7cd50e65, 0x1c4ce2f6), WTCP(0x7cb72724, 0x1ccf8cb3), + WTCP(0x7c98b71f, 0x1d5216d8), WTCP(0x7c79be78, 0x1dd480d6), + WTCP(0x7c5a3d50, 0x1e56ca1e), WTCP(0x7c3a33ca, 0x1ed8f220), + WTCP(0x7c19a209, 0x1f5af84f), WTCP(0x7bf88830, 0x1fdcdc1b), + WTCP(0x7bd6e665, 0x205e9cf6), WTCP(0x7bb4bccb, 0x20e03a51), + WTCP(0x7b920b89, 0x2161b3a0), WTCP(0x7b6ed2c5, 0x21e30853), + WTCP(0x7b4b12a4, 0x226437dc), WTCP(0x7b26cb4f, 0x22e541af), + WTCP(0x7b01fced, 0x2366253d), WTCP(0x7adca7a6, 0x23e6e1fa), + WTCP(0x7ab6cba4, 0x24677758), WTCP(0x7a90690f, 0x24e7e4c9), + WTCP(0x7a698012, 0x256829c2), WTCP(0x7a4210d8, 0x25e845b6), + WTCP(0x7a1a1b8c, 0x26683818), WTCP(0x79f1a05a, 0x26e8005b), + WTCP(0x79c89f6e, 0x27679df4), WTCP(0x799f18f4, 0x27e71057), + WTCP(0x79750d1c, 0x286656f8), WTCP(0x794a7c12, 0x28e5714b), + WTCP(0x791f6605, 0x29645ec5), WTCP(0x78f3cb25, 0x29e31edb), + WTCP(0x78c7aba2, 0x2a61b101), WTCP(0x789b07ab, 0x2ae014ae), + WTCP(0x786ddf72, 0x2b5e4956), WTCP(0x78403329, 0x2bdc4e6f), + WTCP(0x78120300, 0x2c5a236f), WTCP(0x77e34f2c, 0x2cd7c7cc), + WTCP(0x77b417df, 0x2d553afc), WTCP(0x77845d4e, 0x2dd27c75), + WTCP(0x77541fab, 0x2e4f8bae), WTCP(0x77235f2d, 0x2ecc681e), + WTCP(0x76f21c09, 0x2f49113d), WTCP(0x76c05674, 0x2fc58680), + WTCP(0x768e0ea6, 0x3041c761), WTCP(0x765b44d5, 0x30bdd356), + WTCP(0x7627f939, 0x3139a9d7), WTCP(0x75f42c0b, 0x31b54a5e), + WTCP(0x75bfdd83, 0x3230b461), WTCP(0x758b0ddb, 0x32abe75a), + WTCP(0x7555bd4c, 0x3326e2c3), WTCP(0x751fec11, 0x33a1a612), + WTCP(0x74e99a65, 0x341c30c4), WTCP(0x74b2c884, 0x34968250), + WTCP(0x747b76a9, 0x35109a31), WTCP(0x7443a512, 0x358a77e0), + WTCP(0x740b53fb, 0x36041ad9), WTCP(0x73d283a2, 0x367d8296), + WTCP(0x73993447, 0x36f6ae91), WTCP(0x735f6626, 0x376f9e46), + WTCP(0x73251981, 0x37e85130), WTCP(0x72ea4e96, 0x3860c6cb), + WTCP(0x72af05a7, 0x38d8fe93), WTCP(0x72733ef3, 0x3950f804), + WTCP(0x7236fabe, 0x39c8b29a), WTCP(0x71fa3949, 0x3a402dd2), + WTCP(0x71bcfad6, 0x3ab76929), WTCP(0x717f3fa8, 0x3b2e641c), + WTCP(0x71410805, 0x3ba51e29), WTCP(0x7102542f, 0x3c1b96ce), + WTCP(0x70c3246b, 0x3c91cd88), WTCP(0x708378ff, 0x3d07c1d6), + WTCP(0x70435230, 0x3d7d7337), WTCP(0x7002b045, 0x3df2e129), + WTCP(0x6fc19385, 0x3e680b2c), WTCP(0x6f7ffc37, 0x3edcf0c0), + WTCP(0x6f3deaa4, 0x3f519164), WTCP(0x6efb5f12, 0x3fc5ec98), + WTCP(0x6eb859cc, 0x403a01dc), WTCP(0x6e74db1c, 0x40add0b2), + WTCP(0x6e30e34a, 0x4121589b), WTCP(0x6dec72a2, 0x41949917), + WTCP(0x6da7896e, 0x420791a8), WTCP(0x6d6227fa, 0x427a41d0), + WTCP(0x6d1c4e93, 0x42eca912), WTCP(0x6cd5fd85, 0x435ec6f0), + WTCP(0x6c8f351c, 0x43d09aed), WTCP(0x6c47f5a7, 0x4442248b), + WTCP(0x6c003f74, 0x44b3634f), WTCP(0x6bb812d1, 0x452456bd), + WTCP(0x6b6f700e, 0x4594fe58), WTCP(0x6b265779, 0x460559a4), + WTCP(0x6adcc964, 0x46756828), WTCP(0x6a92c61f, 0x46e52967), + WTCP(0x6a484dfc, 0x47549ce7), WTCP(0x69fd614a, 0x47c3c22f), + WTCP(0x69b2005e, 0x483298c4), WTCP(0x69662b8a, 0x48a1202c), + WTCP(0x6919e320, 0x490f57ee), WTCP(0x68cd2775, 0x497d3f93), + WTCP(0x687ff8dc, 0x49ead6a0), WTCP(0x683257ab, 0x4a581c9e), + WTCP(0x67e44436, 0x4ac51114), WTCP(0x6795bed3, 0x4b31b38d), + WTCP(0x6746c7d8, 0x4b9e0390), WTCP(0x66f75f9b, 0x4c0a00a6), + WTCP(0x66a78675, 0x4c75aa5a), WTCP(0x66573cbb, 0x4ce10034), + WTCP(0x660682c7, 0x4d4c01c0), WTCP(0x65b558f1, 0x4db6ae88), + WTCP(0x6563bf92, 0x4e210617), WTCP(0x6511b703, 0x4e8b07f9), + WTCP(0x64bf3f9f, 0x4ef4b3b9), WTCP(0x646c59bf, 0x4f5e08e3), + WTCP(0x641905bf, 0x4fc70704), WTCP(0x63c543fa, 0x502fada9), + WTCP(0x637114cc, 0x5097fc5e), WTCP(0x631c7892, 0x50fff2b2), + WTCP(0x62c76fa7, 0x51679033), WTCP(0x6271fa69, 0x51ced46e), + WTCP(0x621c1937, 0x5235bef4), WTCP(0x61c5cc6d, 0x529c4f51), + WTCP(0x616f146c, 0x53028518), WTCP(0x6117f191, 0x53685fd6), + WTCP(0x60c0643d, 0x53cddf1d), WTCP(0x60686ccf, 0x5433027d), + WTCP(0x60100ba8, 0x5497c988), WTCP(0x5fb74129, 0x54fc33ce), + WTCP(0x5f5e0db3, 0x556040e2), WTCP(0x5f0471a8, 0x55c3f056), + WTCP(0x5eaa6d6b, 0x562741bd), WTCP(0x5e50015d, 0x568a34a9), + WTCP(0x5df52de3, 0x56ecc8af), WTCP(0x5d99f35f, 0x574efd62), + WTCP(0x5d3e5237, 0x57b0d256), WTCP(0x5ce24acd, 0x58124720), + WTCP(0x5c85dd88, 0x58735b56), WTCP(0x5c290acc, 0x58d40e8c), + WTCP(0x5bcbd300, 0x5934605a), WTCP(0x5b6e3689, 0x59945054), + WTCP(0x5b1035cf, 0x59f3de12), WTCP(0x5ab1d138, 0x5a53092c), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow480[] = { + 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), +}; + +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), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP SineWindow768[] = { + WTCP(0x7ffffb9d, 0x002182a4), WTCP(0x7fffd886, 0x006487e3), + WTCP(0x7fff9257, 0x00a78d06), WTCP(0x7fff2910, 0x00ea91fc), + WTCP(0x7ffe9cb2, 0x012d96b1), WTCP(0x7ffded3d, 0x01709b13), + WTCP(0x7ffd1ab2, 0x01b39f11), WTCP(0x7ffc250f, 0x01f6a297), + WTCP(0x7ffb0c56, 0x0239a593), WTCP(0x7ff9d087, 0x027ca7f3), + WTCP(0x7ff871a2, 0x02bfa9a4), WTCP(0x7ff6efa7, 0x0302aa95), + WTCP(0x7ff54a98, 0x0345aab2), WTCP(0x7ff38274, 0x0388a9ea), + WTCP(0x7ff1973b, 0x03cba829), WTCP(0x7fef88ef, 0x040ea55e), + WTCP(0x7fed5791, 0x0451a177), WTCP(0x7feb031f, 0x04949c60), + WTCP(0x7fe88b9c, 0x04d79608), WTCP(0x7fe5f108, 0x051a8e5c), + WTCP(0x7fe33364, 0x055d854a), WTCP(0x7fe052af, 0x05a07abf), + WTCP(0x7fdd4eec, 0x05e36ea9), WTCP(0x7fda281b, 0x062660f6), + WTCP(0x7fd6de3d, 0x06695194), WTCP(0x7fd37153, 0x06ac406f), + WTCP(0x7fcfe15d, 0x06ef2d76), WTCP(0x7fcc2e5d, 0x07321897), + WTCP(0x7fc85854, 0x077501be), WTCP(0x7fc45f42, 0x07b7e8da), + WTCP(0x7fc04329, 0x07facdd9), WTCP(0x7fbc040a, 0x083db0a7), + WTCP(0x7fb7a1e6, 0x08809133), WTCP(0x7fb31cbf, 0x08c36f6a), + WTCP(0x7fae7495, 0x09064b3a), WTCP(0x7fa9a96a, 0x09492491), + WTCP(0x7fa4bb3f, 0x098bfb5c), WTCP(0x7f9faa15, 0x09cecf89), + WTCP(0x7f9a75ef, 0x0a11a106), WTCP(0x7f951ecc, 0x0a546fc0), + WTCP(0x7f8fa4b0, 0x0a973ba5), WTCP(0x7f8a079a, 0x0ada04a3), + WTCP(0x7f84478e, 0x0b1ccaa7), WTCP(0x7f7e648c, 0x0b5f8d9f), + WTCP(0x7f785e96, 0x0ba24d79), WTCP(0x7f7235ad, 0x0be50a23), + WTCP(0x7f6be9d4, 0x0c27c389), WTCP(0x7f657b0c, 0x0c6a799b), + WTCP(0x7f5ee957, 0x0cad2c45), WTCP(0x7f5834b7, 0x0cefdb76), + WTCP(0x7f515d2d, 0x0d32871a), WTCP(0x7f4a62bb, 0x0d752f20), + WTCP(0x7f434563, 0x0db7d376), WTCP(0x7f3c0528, 0x0dfa7409), + WTCP(0x7f34a20b, 0x0e3d10c7), WTCP(0x7f2d1c0e, 0x0e7fa99e), + WTCP(0x7f257334, 0x0ec23e7b), WTCP(0x7f1da77e, 0x0f04cf4c), + WTCP(0x7f15b8ee, 0x0f475bff), WTCP(0x7f0da787, 0x0f89e482), + WTCP(0x7f05734b, 0x0fcc68c2), WTCP(0x7efd1c3c, 0x100ee8ad), + WTCP(0x7ef4a25d, 0x10516432), WTCP(0x7eec05af, 0x1093db3d), + WTCP(0x7ee34636, 0x10d64dbd), WTCP(0x7eda63f3, 0x1118bb9f), + WTCP(0x7ed15ee9, 0x115b24d1), WTCP(0x7ec8371a, 0x119d8941), + WTCP(0x7ebeec89, 0x11dfe8dc), WTCP(0x7eb57f39, 0x12224392), + WTCP(0x7eabef2c, 0x1264994e), WTCP(0x7ea23c65, 0x12a6ea00), + WTCP(0x7e9866e6, 0x12e93594), WTCP(0x7e8e6eb2, 0x132b7bf9), + WTCP(0x7e8453cc, 0x136dbd1d), WTCP(0x7e7a1636, 0x13aff8ed), + WTCP(0x7e6fb5f4, 0x13f22f58), WTCP(0x7e653308, 0x1434604a), + WTCP(0x7e5a8d75, 0x14768bb3), WTCP(0x7e4fc53e, 0x14b8b17f), + WTCP(0x7e44da66, 0x14fad19e), WTCP(0x7e39ccf0, 0x153cebfb), + WTCP(0x7e2e9cdf, 0x157f0086), WTCP(0x7e234a36, 0x15c10f2d), + WTCP(0x7e17d4f8, 0x160317dc), WTCP(0x7e0c3d29, 0x16451a83), + WTCP(0x7e0082cb, 0x1687170f), WTCP(0x7df4a5e2, 0x16c90d6e), + WTCP(0x7de8a670, 0x170afd8d), WTCP(0x7ddc847a, 0x174ce75b), + WTCP(0x7dd04003, 0x178ecac6), WTCP(0x7dc3d90d, 0x17d0a7bc), + WTCP(0x7db74f9d, 0x18127e2a), WTCP(0x7daaa3b5, 0x18544dff), + WTCP(0x7d9dd55a, 0x18961728), WTCP(0x7d90e48f, 0x18d7d993), + WTCP(0x7d83d156, 0x1919952f), WTCP(0x7d769bb5, 0x195b49ea), + WTCP(0x7d6943ae, 0x199cf7b0), WTCP(0x7d5bc946, 0x19de9e72), + WTCP(0x7d4e2c7f, 0x1a203e1b), WTCP(0x7d406d5e, 0x1a61d69b), + WTCP(0x7d328be6, 0x1aa367df), WTCP(0x7d24881b, 0x1ae4f1d6), + WTCP(0x7d166201, 0x1b26746d), WTCP(0x7d08199c, 0x1b67ef93), + WTCP(0x7cf9aef0, 0x1ba96335), WTCP(0x7ceb2201, 0x1beacf42), + WTCP(0x7cdc72d3, 0x1c2c33a7), WTCP(0x7ccda169, 0x1c6d9053), + WTCP(0x7cbeadc8, 0x1caee534), WTCP(0x7caf97f4, 0x1cf03238), + WTCP(0x7ca05ff1, 0x1d31774d), WTCP(0x7c9105c3, 0x1d72b461), + WTCP(0x7c81896f, 0x1db3e962), WTCP(0x7c71eaf9, 0x1df5163f), + WTCP(0x7c622a64, 0x1e363ae5), WTCP(0x7c5247b6, 0x1e775743), + WTCP(0x7c4242f2, 0x1eb86b46), WTCP(0x7c321c1e, 0x1ef976de), + WTCP(0x7c21d33c, 0x1f3a79f7), WTCP(0x7c116853, 0x1f7b7481), + WTCP(0x7c00db66, 0x1fbc6669), WTCP(0x7bf02c7b, 0x1ffd4f9e), + WTCP(0x7bdf5b94, 0x203e300d), WTCP(0x7bce68b8, 0x207f07a6), + WTCP(0x7bbd53eb, 0x20bfd656), WTCP(0x7bac1d31, 0x21009c0c), + WTCP(0x7b9ac490, 0x214158b5), WTCP(0x7b894a0b, 0x21820c41), + WTCP(0x7b77ada8, 0x21c2b69c), WTCP(0x7b65ef6c, 0x220357b6), + WTCP(0x7b540f5b, 0x2243ef7d), WTCP(0x7b420d7a, 0x22847de0), + WTCP(0x7b2fe9cf, 0x22c502cb), WTCP(0x7b1da45e, 0x23057e2e), + WTCP(0x7b0b3d2c, 0x2345eff8), WTCP(0x7af8b43f, 0x23865816), + WTCP(0x7ae6099b, 0x23c6b676), WTCP(0x7ad33d45, 0x24070b08), + WTCP(0x7ac04f44, 0x244755b9), WTCP(0x7aad3f9b, 0x24879678), + WTCP(0x7a9a0e50, 0x24c7cd33), WTCP(0x7a86bb68, 0x2507f9d8), + WTCP(0x7a7346e9, 0x25481c57), WTCP(0x7a5fb0d8, 0x2588349d), + WTCP(0x7a4bf93a, 0x25c84299), WTCP(0x7a382015, 0x26084639), + WTCP(0x7a24256f, 0x26483f6c), WTCP(0x7a10094c, 0x26882e21), + WTCP(0x79fbcbb2, 0x26c81245), WTCP(0x79e76ca7, 0x2707ebc7), + WTCP(0x79d2ec30, 0x2747ba95), WTCP(0x79be4a53, 0x27877e9f), + WTCP(0x79a98715, 0x27c737d3), WTCP(0x7994a27d, 0x2806e61f), + WTCP(0x797f9c90, 0x28468971), WTCP(0x796a7554, 0x288621b9), + WTCP(0x79552cce, 0x28c5aee5), WTCP(0x793fc305, 0x290530e3), + WTCP(0x792a37fe, 0x2944a7a2), WTCP(0x79148bbf, 0x29841311), + WTCP(0x78febe4e, 0x29c3731e), WTCP(0x78e8cfb2, 0x2a02c7b8), + WTCP(0x78d2bfef, 0x2a4210ce), WTCP(0x78bc8f0d, 0x2a814e4d), + WTCP(0x78a63d11, 0x2ac08026), WTCP(0x788fca01, 0x2affa646), + WTCP(0x787935e4, 0x2b3ec09c), WTCP(0x786280bf, 0x2b7dcf17), + WTCP(0x784baa9a, 0x2bbcd1a6), WTCP(0x7834b37a, 0x2bfbc837), + WTCP(0x781d9b65, 0x2c3ab2b9), WTCP(0x78066262, 0x2c79911b), + WTCP(0x77ef0877, 0x2cb8634b), WTCP(0x77d78daa, 0x2cf72939), + WTCP(0x77bff203, 0x2d35e2d3), WTCP(0x77a83587, 0x2d749008), + WTCP(0x7790583e, 0x2db330c7), WTCP(0x77785a2d, 0x2df1c4fe), + WTCP(0x77603b5a, 0x2e304c9d), WTCP(0x7747fbce, 0x2e6ec792), + WTCP(0x772f9b8e, 0x2ead35cd), WTCP(0x77171aa1, 0x2eeb973b), + WTCP(0x76fe790e, 0x2f29ebcc), WTCP(0x76e5b6dc, 0x2f68336f), + WTCP(0x76ccd411, 0x2fa66e13), WTCP(0x76b3d0b4, 0x2fe49ba7), + WTCP(0x769aaccc, 0x3022bc19), WTCP(0x7681685f, 0x3060cf59), + WTCP(0x76680376, 0x309ed556), WTCP(0x764e7e17, 0x30dccdfe), + WTCP(0x7634d848, 0x311ab941), WTCP(0x761b1211, 0x3158970e), + WTCP(0x76012b79, 0x31966753), WTCP(0x75e72487, 0x31d42a00), + WTCP(0x75ccfd42, 0x3211df04), WTCP(0x75b2b5b2, 0x324f864e), + WTCP(0x75984ddc, 0x328d1fcc), WTCP(0x757dc5ca, 0x32caab6f), + WTCP(0x75631d82, 0x33082925), WTCP(0x7548550b, 0x334598de), + WTCP(0x752d6c6c, 0x3382fa88), WTCP(0x751263ae, 0x33c04e13), + WTCP(0x74f73ad7, 0x33fd936e), WTCP(0x74dbf1ef, 0x343aca87), + WTCP(0x74c088fe, 0x3477f350), WTCP(0x74a5000a, 0x34b50db5), + WTCP(0x7489571c, 0x34f219a8), WTCP(0x746d8e3a, 0x352f1716), + WTCP(0x7451a56e, 0x356c05f0), WTCP(0x74359cbd, 0x35a8e625), + WTCP(0x74197431, 0x35e5b7a3), WTCP(0x73fd2bd0, 0x36227a5b), + WTCP(0x73e0c3a3, 0x365f2e3b), WTCP(0x73c43bb1, 0x369bd334), + WTCP(0x73a79402, 0x36d86934), WTCP(0x738acc9e, 0x3714f02a), + WTCP(0x736de58d, 0x37516807), WTCP(0x7350ded7, 0x378dd0b9), + WTCP(0x7333b883, 0x37ca2a30), WTCP(0x7316729a, 0x3806745c), + WTCP(0x72f90d24, 0x3842af2b), WTCP(0x72db8828, 0x387eda8e), + WTCP(0x72bde3af, 0x38baf674), WTCP(0x72a01fc2, 0x38f702cd), + WTCP(0x72823c67, 0x3932ff87), WTCP(0x726439a8, 0x396eec93), + WTCP(0x7246178c, 0x39aac9e0), WTCP(0x7227d61c, 0x39e6975e), + WTCP(0x72097560, 0x3a2254fc), WTCP(0x71eaf561, 0x3a5e02aa), + WTCP(0x71cc5626, 0x3a99a057), WTCP(0x71ad97b9, 0x3ad52df4), + WTCP(0x718eba22, 0x3b10ab70), WTCP(0x716fbd68, 0x3b4c18ba), + WTCP(0x7150a195, 0x3b8775c2), WTCP(0x713166b1, 0x3bc2c279), + WTCP(0x71120cc5, 0x3bfdfecd), WTCP(0x70f293d9, 0x3c392aaf), + WTCP(0x70d2fbf6, 0x3c74460e), WTCP(0x70b34525, 0x3caf50da), + WTCP(0x70936f6e, 0x3cea4b04), WTCP(0x70737ad9, 0x3d253479), + WTCP(0x70536771, 0x3d600d2c), WTCP(0x7033353d, 0x3d9ad50b), + WTCP(0x7012e447, 0x3dd58c06), WTCP(0x6ff27497, 0x3e10320d), + WTCP(0x6fd1e635, 0x3e4ac711), WTCP(0x6fb1392c, 0x3e854b01), + WTCP(0x6f906d84, 0x3ebfbdcd), WTCP(0x6f6f8346, 0x3efa1f65), + WTCP(0x6f4e7a7b, 0x3f346fb8), WTCP(0x6f2d532c, 0x3f6eaeb8), + WTCP(0x6f0c0d62, 0x3fa8dc54), WTCP(0x6eeaa927, 0x3fe2f87c), + WTCP(0x6ec92683, 0x401d0321), WTCP(0x6ea7857f, 0x4056fc31), + WTCP(0x6e85c626, 0x4090e39e), WTCP(0x6e63e87f, 0x40cab958), + WTCP(0x6e41ec95, 0x41047d4e), WTCP(0x6e1fd271, 0x413e2f71), + WTCP(0x6dfd9a1c, 0x4177cfb1), WTCP(0x6ddb439f, 0x41b15dfe), + WTCP(0x6db8cf04, 0x41eada49), WTCP(0x6d963c54, 0x42244481), + WTCP(0x6d738b99, 0x425d9c97), WTCP(0x6d50bcdc, 0x4296e27b), + WTCP(0x6d2dd027, 0x42d0161e), WTCP(0x6d0ac584, 0x43093770), + WTCP(0x6ce79cfc, 0x43424661), WTCP(0x6cc45698, 0x437b42e1), + WTCP(0x6ca0f262, 0x43b42ce1), WTCP(0x6c7d7065, 0x43ed0452), + WTCP(0x6c59d0a9, 0x4425c923), WTCP(0x6c361339, 0x445e7b46), + WTCP(0x6c12381e, 0x44971aaa), WTCP(0x6bee3f62, 0x44cfa740), + WTCP(0x6bca2910, 0x450820f8), WTCP(0x6ba5f530, 0x454087c4), + WTCP(0x6b81a3cd, 0x4578db93), WTCP(0x6b5d34f1, 0x45b11c57), + WTCP(0x6b38a8a6, 0x45e949ff), WTCP(0x6b13fef5, 0x4621647d), + WTCP(0x6aef37e9, 0x46596bc1), WTCP(0x6aca538c, 0x46915fbb), + WTCP(0x6aa551e9, 0x46c9405c), WTCP(0x6a803308, 0x47010d96), + WTCP(0x6a5af6f5, 0x4738c758), WTCP(0x6a359db9, 0x47706d93), + WTCP(0x6a102760, 0x47a80039), WTCP(0x69ea93f2, 0x47df7f3a), + WTCP(0x69c4e37a, 0x4816ea86), WTCP(0x699f1604, 0x484e420f), + WTCP(0x69792b98, 0x488585c5), WTCP(0x69532442, 0x48bcb599), + WTCP(0x692d000c, 0x48f3d17c), WTCP(0x6906bf00, 0x492ad95f), + WTCP(0x68e06129, 0x4961cd33), WTCP(0x68b9e692, 0x4998ace9), + WTCP(0x68934f44, 0x49cf7871), WTCP(0x686c9b4b, 0x4a062fbd), + WTCP(0x6845cab1, 0x4a3cd2be), WTCP(0x681edd81, 0x4a736165), + WTCP(0x67f7d3c5, 0x4aa9dba2), WTCP(0x67d0ad88, 0x4ae04167), + WTCP(0x67a96ad5, 0x4b1692a5), WTCP(0x67820bb7, 0x4b4ccf4d), + WTCP(0x675a9038, 0x4b82f750), WTCP(0x6732f863, 0x4bb90aa0), + WTCP(0x670b4444, 0x4bef092d), WTCP(0x66e373e4, 0x4c24f2e9), + WTCP(0x66bb8750, 0x4c5ac7c4), WTCP(0x66937e91, 0x4c9087b1), + WTCP(0x666b59b3, 0x4cc632a0), WTCP(0x664318c0, 0x4cfbc883), + WTCP(0x661abbc5, 0x4d31494b), WTCP(0x65f242cc, 0x4d66b4e9), + WTCP(0x65c9addf, 0x4d9c0b4f), WTCP(0x65a0fd0b, 0x4dd14c6e), + WTCP(0x6578305a, 0x4e067837), WTCP(0x654f47d7, 0x4e3b8e9d), + WTCP(0x6526438f, 0x4e708f8f), WTCP(0x64fd238b, 0x4ea57b01), + WTCP(0x64d3e7d7, 0x4eda50e2), WTCP(0x64aa907f, 0x4f0f1126), + WTCP(0x64811d8e, 0x4f43bbbd), WTCP(0x64578f0f, 0x4f785099), + WTCP(0x642de50d, 0x4faccfab), WTCP(0x64041f95, 0x4fe138e5), + WTCP(0x63da3eb1, 0x50158c39), WTCP(0x63b0426d, 0x5049c999), + WTCP(0x63862ad5, 0x507df0f6), WTCP(0x635bf7f3, 0x50b20241), + WTCP(0x6331a9d4, 0x50e5fd6d), WTCP(0x63074084, 0x5119e26b), + WTCP(0x62dcbc0d, 0x514db12d), WTCP(0x62b21c7b, 0x518169a5), + WTCP(0x628761db, 0x51b50bc4), WTCP(0x625c8c38, 0x51e8977d), + WTCP(0x62319b9d, 0x521c0cc2), WTCP(0x62069017, 0x524f6b83), + WTCP(0x61db69b1, 0x5282b3b4), WTCP(0x61b02876, 0x52b5e546), + WTCP(0x6184cc74, 0x52e9002a), WTCP(0x615955b6, 0x531c0454), + WTCP(0x612dc447, 0x534ef1b5), WTCP(0x61021834, 0x5381c83f), + WTCP(0x60d65188, 0x53b487e5), WTCP(0x60aa7050, 0x53e73097), + WTCP(0x607e7497, 0x5419c249), WTCP(0x60525e6b, 0x544c3cec), + WTCP(0x60262dd6, 0x547ea073), WTCP(0x5ff9e2e5, 0x54b0ecd0), + WTCP(0x5fcd7da4, 0x54e321f5), WTCP(0x5fa0fe1f, 0x55153fd4), + WTCP(0x5f746462, 0x55474660), WTCP(0x5f47b07a, 0x5579358b), + WTCP(0x5f1ae274, 0x55ab0d46), WTCP(0x5eedfa5a, 0x55dccd86), + WTCP(0x5ec0f839, 0x560e763b), WTCP(0x5e93dc1f, 0x56400758), + WTCP(0x5e66a617, 0x567180d0), WTCP(0x5e39562d, 0x56a2e295), + WTCP(0x5e0bec6e, 0x56d42c99), WTCP(0x5dde68e7, 0x57055ed0), + WTCP(0x5db0cba4, 0x5736792b), WTCP(0x5d8314b1, 0x57677b9d), + WTCP(0x5d55441b, 0x57986619), WTCP(0x5d2759ee, 0x57c93891), + WTCP(0x5cf95638, 0x57f9f2f8), WTCP(0x5ccb3905, 0x582a9540), + WTCP(0x5c9d0260, 0x585b1f5c), WTCP(0x5c6eb258, 0x588b9140), + WTCP(0x5c4048f9, 0x58bbeadd), WTCP(0x5c11c64f, 0x58ec2c26), + WTCP(0x5be32a67, 0x591c550e), WTCP(0x5bb4754e, 0x594c6588), + WTCP(0x5b85a711, 0x597c5d87), WTCP(0x5b56bfbd, 0x59ac3cfd), + WTCP(0x5b27bf5e, 0x59dc03de), WTCP(0x5af8a602, 0x5a0bb21c), + WTCP(0x5ac973b5, 0x5a3b47ab), WTCP(0x5a9a2884, 0x5a6ac47c), +}; + +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 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 KBDWindow96[] = { + WTCP(0x7ffffffd, 0x0001a838), WTCP(0x7fffffe2, 0x00056e83), + WTCP(0x7fffff79, 0x000b9fda), WTCP(0x7ffffe45, 0x00150e8e), + WTCP(0x7ffffb4d, 0x0022aeeb), WTCP(0x7ffff4c6, 0x00359b36), + WTCP(0x7fffe792, 0x004f14ff), WTCP(0x7fffce8b, 0x0070858c), + WTCP(0x7fffa18f, 0x009b7d75), WTCP(0x7fff5439, 0x00d1b353), + WTCP(0x7ffed442, 0x0115018f), WTCP(0x7ffe0775, 0x01676335), + WTCP(0x7ffcc937, 0x01caefcb), WTCP(0x7ffae79f, 0x0241d62e), + WTCP(0x7ff82019, 0x02ce567f), WTCP(0x7ff41ba4, 0x0372bb25), + WTCP(0x7fee6ac3, 0x043150fc), WTCP(0x7fe68129, 0x050c5ec8), + WTCP(0x7fdbb164, 0x06061c0f), WTCP(0x7fcd2894, 0x0720a779), + WTCP(0x7fb9ea80, 0x085dfce2), WTCP(0x7fa0ce2e, 0x09bfeb4d), + WTCP(0x7f807b45, 0x0b480ae2), WTCP(0x7f576880, 0x0cf7b339), + WTCP(0x7f23db4e, 0x0ecff212), WTCP(0x7ee3e8ee, 0x10d182c0), + WTCP(0x7e95791f, 0x12fcc670), WTCP(0x7e364a74, 0x1551bd88), + WTCP(0x7dc3f864, 0x17d00238), WTCP(0x7d3c02fd, 0x1a76c47e), + WTCP(0x7c9bd82a, 0x1d44c7ad), WTCP(0x7be0de56, 0x203861a1), + WTCP(0x7b08803d, 0x234f7ba6), WTCP(0x7a103993, 0x26879530), + WTCP(0x78f5a442, 0x29ddc854), WTCP(0x77b685de, 0x2d4ed00f), + WTCP(0x7650dcf5, 0x30d7103d), WTCP(0x74c2ede4, 0x34729f2d), + WTCP(0x730b4edb, 0x381d50ad), WTCP(0x7128f2c1, 0x3bd2c273), + WTCP(0x6f1b32a9, 0x3f8e698f), WTCP(0x6ce1d5a0, 0x434ba0d6), + WTCP(0x6a7d16a3, 0x4705b7e5), WTCP(0x67eda890, 0x4ab80288), + WTCP(0x6534b7f8, 0x4e5de842), WTCP(0x6253eacd, 0x51f2f39a), + WTCP(0x5f4d5de1, 0x5572e0f7), WTCP(0x5c23a04a, 0x58d9acb9), +}; + +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 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 KBDWindow256[] = { + WTCP(0x7fffffff, 0x000103c8), WTCP(0x7ffffffc, 0x000203ad), + WTCP(0x7ffffff5, 0x0003410a), WTCP(0x7fffffe9, 0x0004c6ce), + WTCP(0x7fffffd4, 0x00069ee0), WTCP(0x7fffffb2, 0x0008d376), + WTCP(0x7fffff7d, 0x000b6f5a), WTCP(0x7fffff2e, 0x000e7dfd), + WTCP(0x7ffffeba, 0x00120b83), WTCP(0x7ffffe16, 0x001624cd), + WTCP(0x7ffffd30, 0x001ad778), WTCP(0x7ffffbf3, 0x002031e2), + WTCP(0x7ffffa48, 0x00264330), WTCP(0x7ffff80d, 0x002d1b4b), + WTCP(0x7ffff51d, 0x0034cae6), WTCP(0x7ffff147, 0x003d637c), + WTCP(0x7fffec54, 0x0046f751), WTCP(0x7fffe5fe, 0x00519974), + WTCP(0x7fffddf3, 0x005d5dba), WTCP(0x7fffd3d2, 0x006a58c1), + WTCP(0x7fffc72a, 0x00789feb), WTCP(0x7fffb772, 0x0088495d), + WTCP(0x7fffa40e, 0x00996bfb), WTCP(0x7fff8c46, 0x00ac1f63), + WTCP(0x7fff6f46, 0x00c07bec), WTCP(0x7fff4c19, 0x00d69a9b), + WTCP(0x7fff21a6, 0x00ee9523), WTCP(0x7ffeeeab, 0x010885d9), + WTCP(0x7ffeb1b8, 0x012487b1), WTCP(0x7ffe692f, 0x0142b631), + WTCP(0x7ffe1335, 0x01632d6f), WTCP(0x7ffdadb8, 0x01860a00), + WTCP(0x7ffd3661, 0x01ab68f3), WTCP(0x7ffcaa91, 0x01d367c5), + WTCP(0x7ffc075b, 0x01fe2453), WTCP(0x7ffb497e, 0x022bbcd0), + WTCP(0x7ffa6d59, 0x025c4fba), WTCP(0x7ff96eeb, 0x028ffbc7), + WTCP(0x7ff849c6, 0x02c6dfdb), WTCP(0x7ff6f90b, 0x03011afc), + WTCP(0x7ff57760, 0x033ecc3a), WTCP(0x7ff3bee7, 0x038012a8), + WTCP(0x7ff1c939, 0x03c50d47), WTCP(0x7fef8f5a, 0x040ddaf6), + WTCP(0x7fed09b4, 0x045a9a64), WTCP(0x7fea300e, 0x04ab69f9), + WTCP(0x7fe6f980, 0x050067c7), WTCP(0x7fe35c70, 0x0559b17b), + WTCP(0x7fdf4e88, 0x05b76443), WTCP(0x7fdac4ad, 0x06199cc4), + WTCP(0x7fd5b2f8, 0x068076fe), WTCP(0x7fd00caf, 0x06ec0e41), + WTCP(0x7fc9c441, 0x075c7d16), WTCP(0x7fc2cb3b, 0x07d1dd2c), + WTCP(0x7fbb1242, 0x084c4745), WTCP(0x7fb28915, 0x08cbd323), + WTCP(0x7fa91e7e, 0x09509778), WTCP(0x7f9ec059, 0x09daa9cc), + WTCP(0x7f935b87, 0x0a6a1e74), WTCP(0x7f86dbf2, 0x0aff0877), + WTCP(0x7f792c8a, 0x0b997983), WTCP(0x7f6a3746, 0x0c3981d6), + WTCP(0x7f59e520, 0x0cdf3030), WTCP(0x7f481e1c, 0x0d8a91c3), + WTCP(0x7f34c949, 0x0e3bb222), WTCP(0x7f1fccc3, 0x0ef29b30), + WTCP(0x7f090dbc, 0x0faf5513), WTCP(0x7ef0707d, 0x1071e629), + WTCP(0x7ed5d872, 0x113a52f4), WTCP(0x7eb92831, 0x12089e14), + WTCP(0x7e9a4183, 0x12dcc836), WTCP(0x7e790571, 0x13b6d010), + WTCP(0x7e55544e, 0x1496b24f), WTCP(0x7e2f0dc8, 0x157c6998), + WTCP(0x7e0610f1, 0x1667ee77), WTCP(0x7dda3c54, 0x17593760), + WTCP(0x7dab6e06, 0x185038a3), WTCP(0x7d7983b3, 0x194ce46e), + WTCP(0x7d445ab5, 0x1a4f2ac4), WTCP(0x7d0bd028, 0x1b56f981), + WTCP(0x7ccfc0fd, 0x1c643c54), WTCP(0x7c900a11, 0x1d76dcc2), + WTCP(0x7c4c8844, 0x1e8ec227), WTCP(0x7c05188d, 0x1fabd1bb), + WTCP(0x7bb99817, 0x20cdee92), WTCP(0x7b69e455, 0x21f4f9a6), + WTCP(0x7b15db1a, 0x2320d1dc), WTCP(0x7abd5ab8, 0x2451540c), + WTCP(0x7a604213, 0x25865b09), WTCP(0x79fe70bf, 0x26bfbfaf), + WTCP(0x7997c716, 0x27fd58ed), WTCP(0x792c2654, 0x293efbd0), + WTCP(0x78bb70b0, 0x2a847b97), WTCP(0x78458976, 0x2bcda9bb), + WTCP(0x77ca551d, 0x2d1a5608), WTCP(0x7749b965, 0x2e6a4ea6), + WTCP(0x76c39d68, 0x2fbd6036), WTCP(0x7637e9b8, 0x311355dc), + WTCP(0x75a68873, 0x326bf95a), WTCP(0x750f6559, 0x33c71326), + WTCP(0x74726de1, 0x35246a7e), WTCP(0x73cf914f, 0x3683c582), + WTCP(0x7326c0c8, 0x37e4e94b), WTCP(0x7277ef5f, 0x39479a08), + WTCP(0x71c3122f, 0x3aab9b14), WTCP(0x71082063, 0x3c10af11), + WTCP(0x7047134a, 0x3d769807), WTCP(0x6f7fe661, 0x3edd177c), + WTCP(0x6eb29763, 0x4043ee92), WTCP(0x6ddf2651, 0x41aade26), + WTCP(0x6d05957c, 0x4311a6e8), WTCP(0x6c25e98f, 0x4478097b), + WTCP(0x6b402991, 0x45ddc693), WTCP(0x6a545ef0, 0x47429f13), + WTCP(0x6962957f, 0x48a65427), WTCP(0x686adb7c, 0x4a08a764), + WTCP(0x676d418d, 0x4b695ae8), WTCP(0x6669dac2, 0x4cc83171), + WTCP(0x6560bc90, 0x4e24ee7d), WTCP(0x6451fecf, 0x4f7f5668), + WTCP(0x633dbbb1, 0x50d72e85), WTCP(0x62240fbd, 0x522c3d3b), + WTCP(0x610519c7, 0x537e4a1f), WTCP(0x5fe0fae3, 0x54cd1e10), + WTCP(0x5eb7d65c, 0x5618834c), WTCP(0x5d89d1a5, 0x57604590), + WTCP(0x5c57144b, 0x58a43227), WTCP(0x5b1fc7e6, 0x59e41808), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_WTP KBDWindow768[] = { + WTCP(0x7fffff85, 0x000b11d9), WTCP(0x7ffffef0, 0x00107aa9), + WTCP(0x7ffffe3e, 0x0015351c), WTCP(0x7ffffd6c, 0x0019b0a1), + WTCP(0x7ffffc77, 0x001e1656), WTCP(0x7ffffb5b, 0x00227a80), + WTCP(0x7ffffa16, 0x0026e8d3), WTCP(0x7ffff8a4, 0x002b68c9), + WTCP(0x7ffff700, 0x002fff8a), WTCP(0x7ffff528, 0x0034b0d9), + WTCP(0x7ffff316, 0x00397f9c), WTCP(0x7ffff0c6, 0x003e6e22), + WTCP(0x7fffee35, 0x00437e53), WTCP(0x7fffeb5b, 0x0048b1d0), + WTCP(0x7fffe836, 0x004e0a05), WTCP(0x7fffe4be, 0x00538837), + WTCP(0x7fffe0ef, 0x00592d8e), WTCP(0x7fffdcc3, 0x005efb1a), + WTCP(0x7fffd832, 0x0064f1da), WTCP(0x7fffd337, 0x006b12c1), + WTCP(0x7fffcdcb, 0x00715eb4), WTCP(0x7fffc7e7, 0x0077d692), + WTCP(0x7fffc182, 0x007e7b30), WTCP(0x7fffba96, 0x00854d61), + WTCP(0x7fffb31b, 0x008c4df0), WTCP(0x7fffab06, 0x00937da6), + WTCP(0x7fffa251, 0x009add48), WTCP(0x7fff98f1, 0x00a26d98), + WTCP(0x7fff8edd, 0x00aa2f57), WTCP(0x7fff840b, 0x00b22343), + WTCP(0x7fff7870, 0x00ba4a19), WTCP(0x7fff6c02, 0x00c2a495), + WTCP(0x7fff5eb5, 0x00cb3371), WTCP(0x7fff507e, 0x00d3f767), + WTCP(0x7fff4150, 0x00dcf130), WTCP(0x7fff311f, 0x00e62183), + WTCP(0x7fff1fde, 0x00ef8919), WTCP(0x7fff0d7f, 0x00f928a7), + WTCP(0x7ffef9f4, 0x010300e5), WTCP(0x7ffee52f, 0x010d1288), + WTCP(0x7ffecf20, 0x01175e47), WTCP(0x7ffeb7b8, 0x0121e4d6), + WTCP(0x7ffe9ee6, 0x012ca6eb), WTCP(0x7ffe849b, 0x0137a53b), + WTCP(0x7ffe68c4, 0x0142e07a), WTCP(0x7ffe4b50, 0x014e595c), + WTCP(0x7ffe2c2c, 0x015a1095), WTCP(0x7ffe0b45, 0x016606da), + WTCP(0x7ffde888, 0x01723cde), WTCP(0x7ffdc3df, 0x017eb353), + WTCP(0x7ffd9d37, 0x018b6aed), WTCP(0x7ffd7479, 0x0198645f), + WTCP(0x7ffd4990, 0x01a5a05b), WTCP(0x7ffd1c63, 0x01b31f92), + WTCP(0x7ffcecdc, 0x01c0e2b8), WTCP(0x7ffcbae2, 0x01ceea7d), + WTCP(0x7ffc865c, 0x01dd3793), WTCP(0x7ffc4f2f, 0x01ebcaaa), + WTCP(0x7ffc1542, 0x01faa472), WTCP(0x7ffbd879, 0x0209c59c), + WTCP(0x7ffb98b7, 0x02192ed7), WTCP(0x7ffb55e0, 0x0228e0d2), + WTCP(0x7ffb0fd6, 0x0238dc3c), WTCP(0x7ffac679, 0x024921c3), + WTCP(0x7ffa79ac, 0x0259b215), WTCP(0x7ffa294d, 0x026a8dde), + WTCP(0x7ff9d53b, 0x027bb5cc), WTCP(0x7ff97d54, 0x028d2a8a), + WTCP(0x7ff92175, 0x029eecc3), WTCP(0x7ff8c17a, 0x02b0fd23), + WTCP(0x7ff85d3f, 0x02c35c53), WTCP(0x7ff7f49d, 0x02d60afd), + WTCP(0x7ff7876e, 0x02e909ca), WTCP(0x7ff7158b, 0x02fc5960), + WTCP(0x7ff69eca, 0x030ffa69), WTCP(0x7ff62303, 0x0323ed89), + WTCP(0x7ff5a20a, 0x03383367), WTCP(0x7ff51bb3, 0x034ccca7), + WTCP(0x7ff48fd3, 0x0361b9ed), WTCP(0x7ff3fe3c, 0x0376fbdd), + WTCP(0x7ff366be, 0x038c9317), WTCP(0x7ff2c929, 0x03a2803e), + WTCP(0x7ff2254e, 0x03b8c3f2), WTCP(0x7ff17afa, 0x03cf5ed1), + WTCP(0x7ff0c9f9, 0x03e6517a), WTCP(0x7ff01218, 0x03fd9c8a), + WTCP(0x7fef5321, 0x0415409c), WTCP(0x7fee8cde, 0x042d3e4d), + WTCP(0x7fedbf17, 0x04459634), WTCP(0x7fece993, 0x045e48ec), + WTCP(0x7fec0c18, 0x0477570a), WTCP(0x7feb266a, 0x0490c127), + WTCP(0x7fea384e, 0x04aa87d5), WTCP(0x7fe94186, 0x04c4abaa), + WTCP(0x7fe841d3, 0x04df2d37), WTCP(0x7fe738f4, 0x04fa0d0d), + WTCP(0x7fe626a9, 0x05154bbc), WTCP(0x7fe50aaf, 0x0530e9d3), + WTCP(0x7fe3e4c1, 0x054ce7dd), WTCP(0x7fe2b49b, 0x05694667), + WTCP(0x7fe179f6, 0x058605fa), WTCP(0x7fe0348b, 0x05a3271e), + WTCP(0x7fdee410, 0x05c0aa5c), WTCP(0x7fdd883b, 0x05de9038), + WTCP(0x7fdc20c1, 0x05fcd935), WTCP(0x7fdaad53, 0x061b85d6), + WTCP(0x7fd92da5, 0x063a969c), WTCP(0x7fd7a166, 0x065a0c06), + WTCP(0x7fd60844, 0x0679e690), WTCP(0x7fd461ee, 0x069a26b6), + WTCP(0x7fd2ae10, 0x06baccf2), WTCP(0x7fd0ec55, 0x06dbd9bd), + WTCP(0x7fcf1c65, 0x06fd4d8c), WTCP(0x7fcd3de9, 0x071f28d3), + WTCP(0x7fcb5088, 0x07416c06), WTCP(0x7fc953e6, 0x07641794), + WTCP(0x7fc747a8, 0x07872bee), WTCP(0x7fc52b70, 0x07aaa97f), + WTCP(0x7fc2fedf, 0x07ce90b4), WTCP(0x7fc0c195, 0x07f2e1f4), + WTCP(0x7fbe732f, 0x08179da7), WTCP(0x7fbc134b, 0x083cc431), + WTCP(0x7fb9a183, 0x086255f7), WTCP(0x7fb71d72, 0x08885359), + WTCP(0x7fb486af, 0x08aebcb5), WTCP(0x7fb1dcd3, 0x08d59269), + WTCP(0x7faf1f72, 0x08fcd4cf), WTCP(0x7fac4e21, 0x09248440), + WTCP(0x7fa96873, 0x094ca111), WTCP(0x7fa66df8, 0x09752b98), + WTCP(0x7fa35e40, 0x099e2425), WTCP(0x7fa038db, 0x09c78b09), + WTCP(0x7f9cfd54, 0x09f16090), WTCP(0x7f99ab38, 0x0a1ba507), + WTCP(0x7f964210, 0x0a4658b6), WTCP(0x7f92c165, 0x0a717be2), + WTCP(0x7f8f28bf, 0x0a9d0ed1), WTCP(0x7f8b77a4, 0x0ac911c4), + WTCP(0x7f87ad97, 0x0af584fb), WTCP(0x7f83ca1d, 0x0b2268b2), + WTCP(0x7f7fccb5, 0x0b4fbd23), WTCP(0x7f7bb4e2, 0x0b7d8288), + WTCP(0x7f778221, 0x0babb915), WTCP(0x7f7333f1, 0x0bda60fd), + WTCP(0x7f6ec9cd, 0x0c097a72), WTCP(0x7f6a4330, 0x0c3905a1), + WTCP(0x7f659f94, 0x0c6902b6), WTCP(0x7f60de70, 0x0c9971d9), + WTCP(0x7f5bff3b, 0x0cca5331), WTCP(0x7f57016b, 0x0cfba6e3), + WTCP(0x7f51e474, 0x0d2d6d0e), WTCP(0x7f4ca7c8, 0x0d5fa5d2), + WTCP(0x7f474ad9, 0x0d92514a), WTCP(0x7f41cd17, 0x0dc56f90), + WTCP(0x7f3c2df1, 0x0df900bb), WTCP(0x7f366cd5, 0x0e2d04de), + WTCP(0x7f30892e, 0x0e617c0a), WTCP(0x7f2a8269, 0x0e96664e), + WTCP(0x7f2457ef, 0x0ecbc3b5), WTCP(0x7f1e0929, 0x0f019449), + WTCP(0x7f17957e, 0x0f37d80f), WTCP(0x7f10fc55, 0x0f6e8f0c), + WTCP(0x7f0a3d14, 0x0fa5b940), WTCP(0x7f03571d, 0x0fdd56a8), + WTCP(0x7efc49d4, 0x10156740), WTCP(0x7ef5149b, 0x104deb00), + WTCP(0x7eedb6d2, 0x1086e1dd), WTCP(0x7ee62fda, 0x10c04bca), + WTCP(0x7ede7f11, 0x10fa28b7), WTCP(0x7ed6a3d5, 0x11347890), + WTCP(0x7ece9d81, 0x116f3b3f), WTCP(0x7ec66b73, 0x11aa70ac), + WTCP(0x7ebe0d04, 0x11e618ba), WTCP(0x7eb5818d, 0x1222334c), + WTCP(0x7eacc869, 0x125ec03e), WTCP(0x7ea3e0ef, 0x129bbf6e), + WTCP(0x7e9aca75, 0x12d930b2), WTCP(0x7e918452, 0x131713e2), + WTCP(0x7e880ddb, 0x135568cf), WTCP(0x7e7e6665, 0x13942f49), + WTCP(0x7e748d43, 0x13d3671e), WTCP(0x7e6a81c8, 0x14131017), + WTCP(0x7e604347, 0x145329fa), WTCP(0x7e55d111, 0x1493b48c), + WTCP(0x7e4b2a76, 0x14d4af8e), WTCP(0x7e404ec8, 0x15161abe), + WTCP(0x7e353d55, 0x1557f5d7), WTCP(0x7e29f56c, 0x159a4090), + WTCP(0x7e1e765c, 0x15dcfaa0), WTCP(0x7e12bf72, 0x162023b7), + WTCP(0x7e06cffc, 0x1663bb86), WTCP(0x7dfaa746, 0x16a7c1b9), + WTCP(0x7dee449e, 0x16ec35f7), WTCP(0x7de1a74e, 0x173117e9), + WTCP(0x7dd4cea3, 0x17766731), WTCP(0x7dc7b9e7, 0x17bc236f), + WTCP(0x7dba6865, 0x18024c40), WTCP(0x7dacd968, 0x1848e13f), + WTCP(0x7d9f0c3a, 0x188fe204), WTCP(0x7d910025, 0x18d74e22), + WTCP(0x7d82b472, 0x191f252c), WTCP(0x7d74286c, 0x196766ae), + WTCP(0x7d655b5b, 0x19b01236), WTCP(0x7d564c8a, 0x19f9274b), + WTCP(0x7d46fb40, 0x1a42a574), WTCP(0x7d3766c8, 0x1a8c8c32), + WTCP(0x7d278e6a, 0x1ad6db06), WTCP(0x7d17716f, 0x1b21916c), + WTCP(0x7d070f22, 0x1b6caedf), WTCP(0x7cf666cb, 0x1bb832d5), + WTCP(0x7ce577b3, 0x1c041cc2), WTCP(0x7cd44124, 0x1c506c17), + WTCP(0x7cc2c269, 0x1c9d2044), WTCP(0x7cb0faca, 0x1cea38b2), + WTCP(0x7c9ee992, 0x1d37b4cc), WTCP(0x7c8c8e0c, 0x1d8593f5), + WTCP(0x7c79e782, 0x1dd3d592), WTCP(0x7c66f541, 0x1e227903), + WTCP(0x7c53b692, 0x1e717da3), WTCP(0x7c402ac3, 0x1ec0e2cf), + WTCP(0x7c2c5120, 0x1f10a7dc), WTCP(0x7c1828f6, 0x1f60cc21), + WTCP(0x7c03b193, 0x1fb14eef), WTCP(0x7beeea44, 0x20022f96), + WTCP(0x7bd9d259, 0x20536d61), WTCP(0x7bc46921, 0x20a5079a), + WTCP(0x7baeadec, 0x20f6fd8a), WTCP(0x7b98a00b, 0x21494e73), + WTCP(0x7b823ecf, 0x219bf998), WTCP(0x7b6b898b, 0x21eefe37), + WTCP(0x7b547f93, 0x22425b8d), WTCP(0x7b3d203a, 0x229610d4), + WTCP(0x7b256ad5, 0x22ea1d42), WTCP(0x7b0d5ebb, 0x233e800c), + WTCP(0x7af4fb42, 0x23933864), WTCP(0x7adc3fc2, 0x23e8457a), + WTCP(0x7ac32b95, 0x243da679), WTCP(0x7aa9be14, 0x24935a8d), + WTCP(0x7a8ff69a, 0x24e960dd), WTCP(0x7a75d485, 0x253fb88e), + WTCP(0x7a5b5731, 0x259660c3), WTCP(0x7a407dfe, 0x25ed589c), + WTCP(0x7a25484c, 0x26449f38), WTCP(0x7a09b57c, 0x269c33b1), + WTCP(0x79edc4f1, 0x26f41522), WTCP(0x79d1760e, 0x274c42a0), + WTCP(0x79b4c83b, 0x27a4bb40), WTCP(0x7997badd, 0x27fd7e15), + WTCP(0x797a4d5e, 0x28568a2f), WTCP(0x795c7f26, 0x28afde9a), + WTCP(0x793e4fa3, 0x29097a63), WTCP(0x791fbe40, 0x29635c92), + WTCP(0x7900ca6e, 0x29bd842e), WTCP(0x78e1739c, 0x2a17f03e), + WTCP(0x78c1b93d, 0x2a729fc2), WTCP(0x78a19ac4, 0x2acd91bc), + WTCP(0x788117a7, 0x2b28c52a), WTCP(0x78602f5e, 0x2b843909), + WTCP(0x783ee163, 0x2bdfec54), WTCP(0x781d2d2f, 0x2c3bde02), + WTCP(0x77fb1241, 0x2c980d0a), WTCP(0x77d89017, 0x2cf47862), + WTCP(0x77b5a632, 0x2d511efb), WTCP(0x77925416, 0x2dadffc6), + WTCP(0x776e9947, 0x2e0b19b3), WTCP(0x774a754d, 0x2e686bae), + WTCP(0x7725e7b0, 0x2ec5f4a4), WTCP(0x7700effd, 0x2f23b37d), + WTCP(0x76db8dbf, 0x2f81a721), WTCP(0x76b5c088, 0x2fdfce77), + WTCP(0x768f87e8, 0x303e2863), WTCP(0x7668e375, 0x309cb3c8), + WTCP(0x7641d2c4, 0x30fb6f88), WTCP(0x761a556e, 0x315a5a82), + WTCP(0x75f26b0e, 0x31b97394), WTCP(0x75ca1341, 0x3218b99c), + WTCP(0x75a14da8, 0x32782b74), WTCP(0x757819e4, 0x32d7c7f6), + WTCP(0x754e779a, 0x33378dfc), WTCP(0x75246671, 0x33977c5b), + WTCP(0x74f9e613, 0x33f791e9), WTCP(0x74cef62b, 0x3457cd7c), + WTCP(0x74a3966a, 0x34b82de6), WTCP(0x7477c67f, 0x3518b1f9), + WTCP(0x744b861e, 0x35795887), WTCP(0x741ed4ff, 0x35da205e), + WTCP(0x73f1b2da, 0x363b084e), WTCP(0x73c41f6b, 0x369c0f24), + WTCP(0x73961a71, 0x36fd33ac), WTCP(0x7367a3ac, 0x375e74b1), + WTCP(0x7338bae1, 0x37bfd0ff), WTCP(0x73095fd7, 0x3821475f), + WTCP(0x72d99257, 0x3882d699), WTCP(0x72a9522d, 0x38e47d75), + WTCP(0x72789f28, 0x39463aba), WTCP(0x7247791b, 0x39a80d2e), + WTCP(0x7215dfda, 0x3a09f397), WTCP(0x71e3d33d, 0x3a6becba), + WTCP(0x71b1531f, 0x3acdf75a), WTCP(0x717e5f5d, 0x3b30123b), + WTCP(0x714af7d7, 0x3b923c20), WTCP(0x71171c72, 0x3bf473cc), + WTCP(0x70e2cd14, 0x3c56b7ff), WTCP(0x70ae09a6, 0x3cb9077b), + WTCP(0x7078d215, 0x3d1b6101), WTCP(0x7043264f, 0x3d7dc353), + WTCP(0x700d0648, 0x3de02d2e), WTCP(0x6fd671f5, 0x3e429d55), + WTCP(0x6f9f694f, 0x3ea51285), WTCP(0x6f67ec52, 0x3f078b7f), + WTCP(0x6f2ffafb, 0x3f6a0701), WTCP(0x6ef7954e, 0x3fcc83ca), + WTCP(0x6ebebb4e, 0x402f009a), WTCP(0x6e856d05, 0x40917c2e), + WTCP(0x6e4baa7e, 0x40f3f546), WTCP(0x6e1173c6, 0x41566aa1), + WTCP(0x6dd6c8ef, 0x41b8dafc), WTCP(0x6d9baa0f, 0x421b4518), + WTCP(0x6d60173d, 0x427da7b1), WTCP(0x6d241094, 0x42e00189), + WTCP(0x6ce79632, 0x4342515e), WTCP(0x6caaa839, 0x43a495ef), + WTCP(0x6c6d46ce, 0x4406cdfd), WTCP(0x6c2f7218, 0x4468f848), + WTCP(0x6bf12a42, 0x44cb138f), WTCP(0x6bb26f7b, 0x452d1e94), + WTCP(0x6b7341f5, 0x458f1818), WTCP(0x6b33a1e3, 0x45f0fede), + WTCP(0x6af38f7e, 0x4652d1a6), WTCP(0x6ab30b01, 0x46b48f34), + WTCP(0x6a7214ab, 0x4716364c), WTCP(0x6a30acbd, 0x4777c5b2), + WTCP(0x69eed37c, 0x47d93c2a), WTCP(0x69ac8930, 0x483a987a), + WTCP(0x6969ce24, 0x489bd968), WTCP(0x6926a2a8, 0x48fcfdbb), + WTCP(0x68e3070c, 0x495e043b), WTCP(0x689efba7, 0x49beebb0), + WTCP(0x685a80cf, 0x4a1fb2e5), WTCP(0x681596e1, 0x4a8058a4), + WTCP(0x67d03e3b, 0x4ae0dbb8), WTCP(0x678a773f, 0x4b413aee), + WTCP(0x67444253, 0x4ba17514), WTCP(0x66fd9fde, 0x4c0188f8), + WTCP(0x66b6904c, 0x4c61756b), WTCP(0x666f140d, 0x4cc1393d), + WTCP(0x66272b91, 0x4d20d341), WTCP(0x65ded74d, 0x4d80424a), + WTCP(0x659617bb, 0x4ddf852d), WTCP(0x654ced55, 0x4e3e9ac1), + WTCP(0x6503589b, 0x4e9d81dc), WTCP(0x64b95a0d, 0x4efc3959), + WTCP(0x646ef230, 0x4f5ac010), WTCP(0x6424218d, 0x4fb914df), + WTCP(0x63d8e8ae, 0x501736a1), WTCP(0x638d4822, 0x50752438), + WTCP(0x6341407a, 0x50d2dc82), WTCP(0x62f4d24b, 0x51305e61), + WTCP(0x62a7fe2b, 0x518da8bb), WTCP(0x625ac4b5, 0x51eaba74), + WTCP(0x620d2686, 0x52479273), WTCP(0x61bf2440, 0x52a42fa2), + WTCP(0x6170be85, 0x530090ea), WTCP(0x6121f5fb, 0x535cb53a), + WTCP(0x60d2cb4e, 0x53b89b7e), WTCP(0x60833f28, 0x541442a8), + WTCP(0x60335239, 0x546fa9a9), WTCP(0x5fe30533, 0x54cacf77), + WTCP(0x5f9258cc, 0x5525b306), WTCP(0x5f414dbb, 0x55805350), + WTCP(0x5eefe4bc, 0x55daaf4e), WTCP(0x5e9e1e8c, 0x5634c5fe), + WTCP(0x5e4bfbec, 0x568e965c), WTCP(0x5df97d9e, 0x56e81f6c), + WTCP(0x5da6a46a, 0x5741602e), WTCP(0x5d537118, 0x579a57a8), + WTCP(0x5cffe474, 0x57f304e2), WTCP(0x5cabff4c, 0x584b66e4), + WTCP(0x5c57c271, 0x58a37cbb), WTCP(0x5c032eb7, 0x58fb4576), + WTCP(0x5bae44f4, 0x5952c024), WTCP(0x5b590602, 0x59a9ebd8), + WTCP(0x5b0372bb, 0x5a00c7a8), WTCP(0x5aad8bfe, 0x5a5752ac), +}; + +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 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), +}; + +/** + * \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][4][9] = { + { /* Sine */ + {/* Radix 2 */ + NULL, SineWindow8, SineWindow16, SineWindow32, SineWindow64, + SineWindow128, SineWindow256, SineWindow512, SineWindow1024}, + { /* 10ms raster */ + NULL, /* 3.25 */ + NULL, /* 7.5 */ + NULL, NULL, NULL, SineWindow120, SineWindow240, SineWindow480, + SineWindow960}, + { /* 3/4 radix2 raster */ + NULL, /* 3 */ + NULL, /* 6 */ + SineWindow12, SineWindow24, SineWindow48, SineWindow96, SineWindow192, + SineWindow384, SineWindow768}, + { + /* 3/4 radix2 raster */ + NULL, + NULL, /* 3 */ + NULL, /* 6 */ + SineWindow20, + SineWindow40, + NULL, + SineWindow160, + NULL, + NULL, + }}, + { /* KBD */ + {/* Radix 2 */ + NULL, KBDWindow128, KBDWindow256, SineWindow512, KBDWindow1024}, + {/* 10ms raster */ + NULL, KBDWindow120, NULL, SineWindow480, KBDWindow960}, + {/* 3/4 radix2 raster */ + NULL, KBDWindow96, + SineWindow192, /* This entry might be accessed for erred bit streams. */ + NULL, KBDWindow768}, + {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 4 entries longer. */ + if (shape == 1) { + ld2_length -= 4; + } + + /* 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) ((FIXP_DBL)(x)) +#define QTCFL(x) FL2FXCONST_DBL(x) +#define QTC(x) ((FIXP_DBL)(x)) +#endif /* ARCH_PREFER_MULT_32x16 */ + +/*! + \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 +*/ +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_PFT qmf_pfilt120[] = { + QFC(0x00000000), QFC(0x01b2e41d), QFC(0x2e3a7532), QFC(0xd1c58ace), + QFC(0xfe4d1be3), QFC(0xffefcdb5), QFC(0x02828e13), QFC(0x35eecfd1), + QFC(0xd94e53e3), QFC(0xfefdfe42), QFC(0xffec30b0), QFC(0x036b8e20), + QFC(0x3daa7c5c), QFC(0xe08b3fa6), QFC(0xff8f33fc), QFC(0xffe88ba8), + QFC(0x04694101), QFC(0x4547daeb), QFC(0xe75f8bb7), QFC(0x0000e790), + QFC(0xffe69150), QFC(0x057341bc), QFC(0x4c9ef50f), QFC(0xedb0fdbd), + QFC(0x00549c76), QFC(0xffe6db43), QFC(0x067ef951), QFC(0x5389d1bb), + QFC(0xf36dbfe6), QFC(0x008cbe92), QFC(0xffea353a), QFC(0x077fedb3), + QFC(0x59e2f69e), QFC(0xf887507c), QFC(0x00acbd2f), QFC(0xfff176e1), + QFC(0x086685a4), QFC(0x5f845914), QFC(0xfcf2b6c8), QFC(0x00b881db), + QFC(0xfffd1253), QFC(0x09233c49), QFC(0x64504658), QFC(0x00adb69e), + QFC(0x00b4790a), QFC(0x000d31b5), QFC(0x09a3e163), QFC(0x682b39a4), + QFC(0x03b8f8dc), QFC(0x00a520bb), QFC(0x0021e26b), QFC(0x09d536b4), + QFC(0x6afb0c80), QFC(0x06186566), QFC(0x008db1f0), QFC(0x003a81c0), + QFC(0x09a505f2), QFC(0x6cb28145), QFC(0x07d6e67c), QFC(0x00728512), + QFC(0x0055dba1), QFC(0x09015651), QFC(0x6d474e1d), QFC(0x09015651), + QFC(0x0055dba1), QFC(0xfe4d1be3), QFC(0xd1c58ace), QFC(0x2e3a7532), + QFC(0x01b2e41d), QFC(0x00000000), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_PFT qmf_pfilt200[] = { + QFC(0x00000000), QFC(0x01b2e41d), QFC(0x2e3a7532), QFC(0xd1c58ace), + QFC(0xfe4d1be3), QFC(0xffefd5d9), QFC(0x022c39a4), QFC(0x32d6e6f6), + QFC(0xd652421f), QFC(0xfebafd64), QFC(0xffef3d2e), QFC(0x02af2a39), + QFC(0x377b44a6), QFC(0xdac7ff47), QFC(0xff1d9e1f), QFC(0xffed03e9), + QFC(0x033b07ff), QFC(0x3c1fc4e4), QFC(0xdf2029d5), QFC(0xff74a37e), + QFC(0xffeab7cc), QFC(0x03cf3ade), QFC(0x40bc12f6), QFC(0xe3546cf8), + QFC(0xffc070af), QFC(0xffe88ba8), QFC(0x04694101), QFC(0x4547daeb), + QFC(0xe75f8bb7), QFC(0x0000e790), QFC(0xffe7546d), QFC(0x050826e6), + QFC(0x49ba0a48), QFC(0xeb3ac63a), QFC(0x0036aa5d), QFC(0xffe6665c), + QFC(0x05a92d73), QFC(0x4e0b0602), QFC(0xeee323fd), QFC(0x0061fdf9), + QFC(0xffe6858d), QFC(0x0649e26b), QFC(0x523225cf), QFC(0xf2549ca7), + QFC(0x00838276), QFC(0xffe7e0bd), QFC(0x06e7cba4), QFC(0x5627597c), + QFC(0xf58c23ae), QFC(0x009c49df), QFC(0xffea353a), QFC(0x077fedb3), + QFC(0x59e2f69e), QFC(0xf887507c), QFC(0x00acbd2f), QFC(0xffee0a64), + QFC(0x080e83ac), QFC(0x5d5bac5e), QFC(0xfb432a8a), QFC(0x00b5e294), + QFC(0xfff35c0f), QFC(0x08905893), QFC(0x608bf7c1), QFC(0xfdbfe2d8), + QFC(0x00b8dcd6), QFC(0xfffa67ed), QFC(0x0901a70f), QFC(0x636d2657), + QFC(0xfffccdc7), QFC(0x00b66387), QFC(0x0002f512), QFC(0x095eb98e), + QFC(0x65f9595d), QFC(0x01fa380f), QFC(0x00afb0f3), QFC(0x000d31b5), + QFC(0x09a3e163), QFC(0x682b39a4), QFC(0x03b8f8dc), QFC(0x00a520bb), + QFC(0x00193141), QFC(0x09cc1a7d), QFC(0x69fbfee3), QFC(0x05395430), + QFC(0x0097ce05), QFC(0x00269ad4), QFC(0x09d3fe14), QFC(0x6b69bfaf), + QFC(0x067e12f2), QFC(0x00889924), QFC(0x003567de), QFC(0x09b75cca), + QFC(0x6c716eb9), QFC(0x0789e850), QFC(0x00781556), QFC(0x0045436a), + QFC(0x097277a9), QFC(0x6d110fe4), QFC(0x085f29c6), QFC(0x00670cb6), + QFC(0x0055dba1), QFC(0x09015651), QFC(0x6d474e1d), QFC(0x09015651), + QFC(0x0055dba1), QFC(0xfe4d1be3), QFC(0xd1c58ace), QFC(0x2e3a7532), + QFC(0x01b2e41d), QFC(0x00000000), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_QTW qmf_phaseshift_cos40[] = { + QTC(0x7fef5260), QTC(0x7f69ff76), QTC(0x7e5fe493), QTC(0x7cd21707), + QTC(0x7ac23561), QTC(0x783265c0), QTC(0x75255392), QTC(0x719e2cd2), + QTC(0x6da09eb1), QTC(0x6930d1c4), QTC(0x645365b2), QTC(0x5f0d6c5b), + QTC(0x59646498), QTC(0x535e3479), QTC(0x4d012324), QTC(0x4653d24b), + QTC(0x3f5d373e), QTC(0x382493b0), QTC(0x30b16e23), QTC(0x290b8a12), + QTC(0x213adfda), QTC(0x1947946c), QTC(0x1139f0cf), QTC(0x091a597e), + QTC(0x00f145ab), QTC(0xf8c73668), QTC(0xf0a4adcf), QTC(0xe8922622), + QTC(0xe09808f5), QTC(0xd8bea66a), QTC(0xd10e2c89), QTC(0xc98e9eb5), + QTC(0xc247cd5a), QTC(0xbb414dc0), QTC(0xb4827228), QTC(0xae12422c), + QTC(0xa7f7736a), QTC(0xa2386284), QTC(0x9cdb0c83), QTC(0x97e50896), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_QTW qmf_phaseshift_sin40[] = { + QTC(0x0415583b), QTC(0x0c3bc74f), QTC(0x145576b1), QTC(0x1c59f557), + QTC(0x2440e84d), QTC(0x2c021369), QTC(0x339561e1), QTC(0x3af2eeb7), + QTC(0x42130cf0), QTC(0x48ee4f98), QTC(0x4f7d917c), QTC(0x55b9fc9e), + QTC(0x5b9d1154), QTC(0x6120ad0d), QTC(0x663f10b7), QTC(0x6af2e6bc), + QTC(0x6f374891), QTC(0x7307c3d0), QTC(0x76605edb), QTC(0x793d9d03), + QTC(0x7b9c8226), QTC(0x7d7a95cf), QTC(0x7ed5e5c6), QTC(0x7fad081b), + QTC(0x7fff1c9b), QTC(0x7fcbcdbc), QTC(0x7f1350f8), QTC(0x7dd6668f), + QTC(0x7c1658c5), QTC(0x79d4fa89), QTC(0x7714a58b), QTC(0x73d837ca), + QTC(0x7023109a), QTC(0x6bf90d1d), QTC(0x675e843e), QTC(0x6258422c), + QTC(0x5ceb8355), QTC(0x571deefa), QTC(0x50f59141), QTC(0x4a78d4f0), +}; + +/* This filter is scaled (0.8*pfilt) */ +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_PFT qmf_pfilt400[] = { + QFC(0x00000000), QFC(0x015be9b1), QFC(0x24fb90f5), QFC(0xdb046f0b), + QFC(0xfea4164f), QFC(0xfff15ed6), QFC(0x018b53a8), QFC(0x26d2bd4e), + QFC(0xdcd812f9), QFC(0xfed12595), QFC(0xfff3117b), QFC(0x01bcfae9), + QFC(0x28abebf8), QFC(0xdea834e5), QFC(0xfefbfdea), QFC(0xfff32e53), + QFC(0x01f075de), QFC(0x2a86e540), QFC(0xe07383c3), QFC(0xff24936e), + QFC(0xfff29758), QFC(0x0225bb61), QFC(0x2c629d51), QFC(0xe2399905), + QFC(0xff4ae4e6), QFC(0xfff1ab73), QFC(0x025cb6d7), QFC(0x2e3e69f9), + QFC(0xe3fa13fc), QFC(0xff6eefd4), QFC(0xfff0cfed), QFC(0x0295a000), + QFC(0x30196a50), QFC(0xe5b354ab), QFC(0xff9082cb), QFC(0xffefd442), + QFC(0x02d01d61), QFC(0x31f2b6ac), QFC(0xe765dadc), QFC(0xffb0037f), + QFC(0xffeef970), QFC(0x030c2f18), QFC(0x33c9a8c5), QFC(0xe910572d), + QFC(0xffcd26f2), QFC(0xffee0f91), QFC(0x03494088), QFC(0x359ce8be), + QFC(0xeab28265), QFC(0xffe8133f), QFC(0xffed3c86), QFC(0x03876734), + QFC(0x376caf22), QFC(0xec4c6fc6), QFC(0x0000b940), QFC(0xffecb05f), + QFC(0x03c6b32b), QFC(0x3936c186), QFC(0xeddbfa4a), QFC(0x00174372), + QFC(0xffec438a), QFC(0x04068585), QFC(0x3afb3b6d), QFC(0xef62382f), + QFC(0x002bbb7e), QFC(0xffebc5c7), QFC(0x0446af4f), QFC(0x3cb9159f), + QFC(0xf0de3518), QFC(0x003e0713), QFC(0xffeb8517), QFC(0x0487578f), + QFC(0x3e6f3802), QFC(0xf24f4ffd), QFC(0x004e64c7), QFC(0xffeb8b0d), + QFC(0x04c7cd0d), QFC(0x401d78d8), QFC(0xf3b6114c), QFC(0x005ccd60), + QFC(0xffeb9e0a), QFC(0x0507e855), QFC(0x41c1b7d9), QFC(0xf5107d52), + QFC(0x0069352b), QFC(0xffec0c97), QFC(0x054789e4), QFC(0x435c76d2), + QFC(0xf6600380), QFC(0x0073ff44), QFC(0xffecb3ca), QFC(0x05863c83), + QFC(0x44ec4796), QFC(0xf7a34fbf), QFC(0x007d07e5), QFC(0xffed65ae), + QFC(0x05c3bdde), QFC(0x46702a28), QFC(0xf8da6b28), QFC(0x008444ef), + QFC(0xffee90fb), QFC(0x05fff15c), QFC(0x47e8c54c), QFC(0xfa05d9fc), + QFC(0x008a30f2), QFC(0xffefff78), QFC(0x0639db53), QFC(0x4952ab1e), + QFC(0xfb23d977), QFC(0x008e9313), QFC(0xfff1a1ea), QFC(0x067202f0), + QFC(0x4aafbd18), QFC(0xfc35bba2), QFC(0x00918210), QFC(0xfff3a45f), + QFC(0x06a741b7), QFC(0x4bfdfb06), QFC(0xfd3aee85), QFC(0x009350b6), + QFC(0xfff5e33f), QFC(0x06d9e076), QFC(0x4d3cc634), QFC(0xfe331be0), + QFC(0x0093e3de), QFC(0xfff867de), QFC(0x07090b4f), QFC(0x4e6cc1b3), + QFC(0xff1f4fd2), QFC(0x00936109), QFC(0xfffb8658), QFC(0x073485a5), + QFC(0x4f8a8512), QFC(0xfffd716c), QFC(0x0091e939), QFC(0xfffec6af), + QFC(0x075c2159), QFC(0x50986228), QFC(0x00cfb536), QFC(0x008f7f85), + QFC(0x00025da8), QFC(0x077efad8), QFC(0x5194477e), QFC(0x0194f9a6), + QFC(0x008c8d8f), QFC(0x00064e63), QFC(0x079d423f), QFC(0x527db75e), + QFC(0x024d9e1c), QFC(0x00886b36), QFC(0x000a8e2a), QFC(0x07b64de9), + QFC(0x5355c7b6), QFC(0x02fa60b0), QFC(0x00841a2f), QFC(0x000f2b4f), + QFC(0x07c95704), QFC(0x5418bd4a), QFC(0x0399eb6f), QFC(0x007eea79), + QFC(0x00142767), QFC(0x07d67b97), QFC(0x54c998b6), QFC(0x042ddcf3), + QFC(0x0079719e), QFC(0x00193ee8), QFC(0x07dd27cf), QFC(0x55662c93), + QFC(0x04b5da5c), QFC(0x007369b7), QFC(0x001ee243), QFC(0x07dccb44), + QFC(0x55ee32f2), QFC(0x0531a8c2), QFC(0x006d4750), QFC(0x002471ce), + QFC(0x07d588d9), QFC(0x566317ad), QFC(0x05a2ff7a), QFC(0x0066c7aa), + QFC(0x002ab97f), QFC(0x07c5e3d5), QFC(0x56c12561), QFC(0x0607ed0d), + QFC(0x00601112), QFC(0x0030e1af), QFC(0x07ae9698), QFC(0x570be9e8), + QFC(0x0662a78a), QFC(0x005958bb), QFC(0x00376922), QFC(0x078ec621), + QFC(0x5740d984), QFC(0x06b287d1), QFC(0x00527092), QFC(0x003e065c), + QFC(0x0765b74d), QFC(0x57607ccb), QFC(0x06f819ec), QFC(0x004b9363), + QFC(0x0044afb4), QFC(0x0734450e), QFC(0x576c3e7e), QFC(0x0734450e), + QFC(0x0044afb4), QFC(0xfea4164f), QFC(0xdb046f0b), QFC(0x24fb90f5), + QFC(0x015be9b1), QFC(0x00000000), +}; + +const FIXP_QTW qmf_phaseshift_cos16[] = { + QTC(0x7fc25596), QTC(0x7dd6668f), QTC(0x7a05eead), QTC(0x745f9dd1), + QTC(0x6cf934fc), QTC(0x63ef3290), QTC(0x59646498), QTC(0x4d8162c4), + QTC(0x4073f21d), QTC(0x326e54c7), QTC(0x23a6887f), QTC(0x145576b1), + QTC(0x04b6195d), QTC(0xf50497fb), QTC(0xe57d5fda), QTC(0xd65c3b7b), +}; +const FIXP_QTW qmf_phaseshift_sin16[] = { + QTC(0x07d95b9e), QTC(0x176dd9de), QTC(0x26a82186), QTC(0x354d9057), + QTC(0x4325c135), QTC(0x4ffb654d), QTC(0x5b9d1154), QTC(0x65ddfbd3), + QTC(0x6e96a99d), QTC(0x75a585cf), QTC(0x7aef6323), QTC(0x7e5fe493), + QTC(0x7fe9cbc0), QTC(0x7f872bf3), QTC(0x7d3980ec), QTC(0x7909a92d), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_PFT qmf_pfilt240[] = { + /* FP filter implementation */ + QFC(0x00000000), QFC(0x0121ed68), QFC(0x1ed1a380), QFC(0xe12e5c80), + QFC(0xfede1298), QFC(0xfff4b438), QFC(0x0164d8de), QFC(0x21610064), + QFC(0xe3b64ef2), QFC(0xff1ba1be), QFC(0xfff533ce), QFC(0x01ac5eb8), + QFC(0x23f48a8e), QFC(0xe63437e4), QFC(0xff53fed7), QFC(0xfff40ee0), + QFC(0x01f7edb3), QFC(0x26895855), QFC(0xe8a5bb55), QFC(0xff871d30), + QFC(0xfff2cb20), QFC(0x0247b415), QFC(0x291c52e4), QFC(0xeb077fc7), + QFC(0xffb4cd53), QFC(0xfff18a22), QFC(0x029b070e), QFC(0x2baa29ab), + QFC(0xed57da15), QFC(0xffdd4df1), QFC(0xfff05d1b), QFC(0x02f0d600), + QFC(0x2e2fe755), QFC(0xef9507d5), QFC(0x00009a60), QFC(0xffefac36), + QFC(0x0348fcbc), QFC(0x30a98c1c), QFC(0xf1bba8f2), QFC(0x001eed4c), + QFC(0xffef0b8b), QFC(0x03a22bd2), QFC(0x3314a372), QFC(0xf3cb53d5), + QFC(0x0038684e), QFC(0xffeef3e0), QFC(0x03fbd58b), QFC(0x356de4ab), + QFC(0xf5c263c0), QFC(0x004d55d0), QFC(0xffef3cd8), QFC(0x0454a637), + QFC(0x37b13672), QFC(0xf79e7feb), QFC(0x005dd461), QFC(0xfff01619), + QFC(0x04abb9c0), QFC(0x39dc5c00), QFC(0xf95f9279), QFC(0x006a5b4d), + QFC(0xfff178d2), QFC(0x04fff3cb), QFC(0x3beca455), QFC(0xfb04e050), + QFC(0x007328ca), QFC(0xfff390f0), QFC(0x054fa1dc), QFC(0x3ddd668e), + QFC(0xfc8c7550), QFC(0x00788f16), QFC(0xfff64f40), QFC(0x0599ae6b), + QFC(0x3fad90c7), QFC(0xfdf72485), QFC(0x007b013c), QFC(0xfff9abe4), + QFC(0x05dcdec0), QFC(0x415aa155), QFC(0xff44c284), QFC(0x007ad0dd), + QFC(0xfffe0c37), QFC(0x06177d87), QFC(0x42e02f00), QFC(0x0073cf14), + QFC(0x007850b2), QFC(0x000314dd), QFC(0x0647fe8b), QFC(0x443e0472), + QFC(0x0185ddb7), QFC(0x00741328), QFC(0x0008cbce), QFC(0x066d40eb), + QFC(0x45722655), QFC(0x027b5093), QFC(0x006e15d2), QFC(0x000f67a8), + QFC(0x0684f772), QFC(0x46789539), QFC(0x03537bc9), QFC(0x0066c76d), + QFC(0x001696f2), QFC(0x068e247c), QFC(0x47520855), QFC(0x04104399), + QFC(0x005e76a0), QFC(0x001e5ed7), QFC(0x06874760), QFC(0x47fd3e55), + QFC(0x04b27f90), QFC(0x0055a663), QFC(0x0027012b), QFC(0x066e03f9), + QFC(0x487700c7), QFC(0x0539eefc), QFC(0x004c58b7), QFC(0x0030042f), + QFC(0x0641b0ab), QFC(0x48c0afc7), QFC(0x05a90172), QFC(0x0042c9e7), + QFC(0x00393d16), QFC(0x0600e435), QFC(0x48da3400), QFC(0x0600e435), + QFC(0x00393d16), QFC(0xfede1298), QFC(0xe12e5c80), QFC(0x1ed1a380), + QFC(0x0121ed68), QFC(0x00000000), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_QTW qmf_phaseshift_cos24[] = { + QTC(0x7fded530), QTC(0x7ed5e5c6), QTC(0x7cc62bdf), QTC(0x79b3ece0), + QTC(0x75a585cf), QTC(0x70a35e25), QTC(0x6ab7d663), QTC(0x63ef3290), + QTC(0x5c5780d3), QTC(0x54007c51), QTC(0x4afb6c98), QTC(0x415b01ce), + QTC(0x37332dfd), QTC(0x2c98fbba), QTC(0x21a26295), QTC(0x1666198d), + QTC(0x0afb6805), QTC(0xff79f587), QTC(0xf3f998c0), QTC(0xe8922622), + QTC(0xdd5b3e7b), QTC(0xd26c1e08), QTC(0xc7db6c50), QTC(0xbdbf0d2f), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_QTW qmf_phaseshift_sin24[] = { + QTC(0x05c1f4e7), QTC(0x1139f0cf), QTC(0x1c8e3bbe), QTC(0x27a75c95), + QTC(0x326e54c7), QTC(0x3cccd004), QTC(0x46ad5278), QTC(0x4ffb654d), + QTC(0x58a3c118), QTC(0x609475c3), QTC(0x67bd0fbd), QTC(0x6e0eba0c), + QTC(0x737c5d0b), QTC(0x77fab989), QTC(0x7b808015), QTC(0x7e06644c), + QTC(0x7f872bf3), QTC(0x7fffb9d1), QTC(0x7f6f141f), QTC(0x7dd6668f), + QTC(0x7b38ffde), QTC(0x779c4afc), QTC(0x7307c3d0), QTC(0x6d84e7b7), +}; + +/* qmf_pfilt640 is used with stride 2 instead of qmf_pfilt320[] */ + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_QTW qmf_phaseshift_cos32[] = { + QTC(0x7fe9cbc0), QTC(0x7f3857f6), QTC(0x7dd6668f), QTC(0x7bc5e290), + QTC(0x7909a92d), QTC(0x75a585cf), QTC(0x719e2cd2), QTC(0x6cf934fc), + QTC(0x67bd0fbd), QTC(0x61f1003f), QTC(0x5b9d1154), QTC(0x54ca0a4b), + QTC(0x4d8162c4), QTC(0x45cd358f), QTC(0x3db832a6), QTC(0x354d9057), + QTC(0x2c98fbba), QTC(0x23a6887f), QTC(0x1a82a026), QTC(0x1139f0cf), + QTC(0x07d95b9e), QTC(0xfe6de2e0), QTC(0xf50497fb), QTC(0xebaa894f), + QTC(0xe26cb01b), QTC(0xd957de7a), QTC(0xd078ad9e), QTC(0xc7db6c50), + QTC(0xbf8c0de3), QTC(0xb796199b), QTC(0xb0049ab3), QTC(0xa8e21106), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_QTW qmf_phaseshift_sin32[] = { + QTC(0x04b6195d), QTC(0x0e1bc2e4), QTC(0x176dd9de), QTC(0x209f701c), + QTC(0x29a3c485), QTC(0x326e54c7), QTC(0x3af2eeb7), QTC(0x4325c135), + QTC(0x4afb6c98), QTC(0x5269126e), QTC(0x59646498), QTC(0x5fe3b38d), + QTC(0x65ddfbd3), QTC(0x6b4af279), QTC(0x7023109a), QTC(0x745f9dd1), + QTC(0x77fab989), QTC(0x7aef6323), QTC(0x7d3980ec), QTC(0x7ed5e5c6), + QTC(0x7fc25596), QTC(0x7ffd885a), QTC(0x7f872bf3), QTC(0x7e5fe493), + QTC(0x7c894bde), QTC(0x7a05eead), QTC(0x76d94989), QTC(0x7307c3d0), + QTC(0x6e96a99d), QTC(0x698c246c), QTC(0x63ef3290), QTC(0x5dc79d7c), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_QTW qmf_phaseshift_cos_downsamp32[] = { + QTC(0x7fd8878e), QTC(0x7e9d55fc), QTC(0x7c29fbee), QTC(0x78848414), + QTC(0x73b5ebd1), QTC(0x6dca0d14), QTC(0x66cf8120), QTC(0x5ed77c8a), + QTC(0x55f5a4d2), QTC(0x4c3fdff4), QTC(0x41ce1e65), QTC(0x36ba2014), + QTC(0x2b1f34eb), QTC(0x1f19f97b), QTC(0x12c8106f), QTC(0x0647d97c), + QTC(0xf9b82684), QTC(0xed37ef91), QTC(0xe0e60685), QTC(0xd4e0cb15), + QTC(0xc945dfec), QTC(0xbe31e19b), QTC(0xb3c0200c), QTC(0xaa0a5b2e), + QTC(0xa1288376), QTC(0x99307ee0), QTC(0x9235f2ec), QTC(0x8c4a142f), + QTC(0x877b7bec), QTC(0x83d60412), QTC(0x8162aa04), QTC(0x80277872), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_QTW qmf_phaseshift_sin_downsamp32[] = { + QTC(0x0647d97c), QTC(0x12c8106f), QTC(0x1f19f97b), QTC(0x2b1f34eb), + QTC(0x36ba2014), QTC(0x41ce1e65), QTC(0x4c3fdff4), QTC(0x55f5a4d2), + QTC(0x5ed77c8a), QTC(0x66cf8120), QTC(0x6dca0d14), QTC(0x73b5ebd1), + QTC(0x78848414), QTC(0x7c29fbee), QTC(0x7e9d55fc), QTC(0x7fd8878e), + QTC(0x7fd8878e), QTC(0x7e9d55fc), QTC(0x7c29fbee), QTC(0x78848414), + QTC(0x73b5ebd1), QTC(0x6dca0d14), QTC(0x66cf8120), QTC(0x5ed77c8a), + QTC(0x55f5a4d2), QTC(0x4c3fdff4), QTC(0x41ce1e65), QTC(0x36ba2014), + QTC(0x2b1f34eb), QTC(0x1f19f97b), QTC(0x12c8106f), QTC(0x0647d97c), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_PFT qmf_pfilt640[] = { + QFC(0x00000000), QFC(0x01b2e41d), QFC(0x2e3a7532), QFC(0xd1c58ace), + QFC(0xfe4d1be3), QFC(0xffede50e), QFC(0x01d78bfc), QFC(0x2faa221c), + QFC(0xd3337b3d), QFC(0xfe70b8d1), QFC(0xffed978a), QFC(0x01fd3ba0), + QFC(0x311af3a4), QFC(0xd49fd55f), QFC(0xfe933dc0), QFC(0xffefc9b9), + QFC(0x02244a25), QFC(0x328cc6f0), QFC(0xd60a46e5), QFC(0xfeb48d0d), + QFC(0xfff0065d), QFC(0x024bf7a1), QFC(0x33ff670e), QFC(0xd7722f04), + QFC(0xfed4bec3), QFC(0xffeff6ca), QFC(0x0274ba43), QFC(0x3572ec70), + QFC(0xd8d7f21f), QFC(0xfef3f6ab), QFC(0xffef7b8b), QFC(0x029e35b4), + QFC(0x36e69691), QFC(0xda3b176a), QFC(0xff120d70), QFC(0xffeedfa4), + QFC(0x02c89901), QFC(0x385a49c4), QFC(0xdb9b5b12), QFC(0xff2ef725), + QFC(0xffee1650), QFC(0x02f3e48d), QFC(0x39ce0477), QFC(0xdcf898fb), + QFC(0xff4aabc8), QFC(0xffed651d), QFC(0x03201116), QFC(0x3b415115), + QFC(0xde529086), 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(0x03a966bc), QFC(0x3f962fb8), QFC(0xe24b8f66), + QFC(0xffaea5d6), QFC(0xffea9192), QFC(0x03d8afe6), QFC(0x41058bc6), + 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(0x4547daeb), QFC(0xe75f8bb7), + 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(0x4973fef2), QFC(0xeafee7f1), QFC(0x0033b927), + QFC(0xffe6d466), QFC(0x05303f88), QFC(0x4ad237a2), QFC(0xec2a3f5f), + QFC(0x00426f36), QFC(0xffe6afed), QFC(0x05626209), QFC(0x4c2ca3df), + QFC(0xed50a31d), QFC(0x00504f41), QFC(0xffe65416), QFC(0x05950122), + QFC(0x4d83976d), QFC(0xee71b2fe), QFC(0x005d36df), QFC(0xffe681c6), + QFC(0x05c76fed), QFC(0x4ed62be3), QFC(0xef8d4d7b), QFC(0x006928a0), + QFC(0xffe66dd0), QFC(0x05f9c051), QFC(0x5024d70e), QFC(0xf0a3959f), + QFC(0x007400b8), QFC(0xffe66fab), QFC(0x062bf5ec), QFC(0x516eefb9), + QFC(0xf1b461ab), QFC(0x007e0393), QFC(0xffe69423), QFC(0x065dd56a), + QFC(0x52b449de), QFC(0xf2bf6ea4), QFC(0x00872c63), QFC(0xffe6fed4), + QFC(0x068f8b44), QFC(0x53f495aa), QFC(0xf3c4e887), QFC(0x008f87aa), + QFC(0xffe75361), QFC(0x06c0f0c0), QFC(0x552f8ff7), QFC(0xf4c473c5), + QFC(0x0096dcc2), QFC(0xffe80414), QFC(0x06f1825d), QFC(0x56654bdd), + QFC(0xf5be0fa9), QFC(0x009da526), QFC(0xffe85b4a), QFC(0x0721bf22), + QFC(0x579505f5), QFC(0xf6b1f3c3), QFC(0x00a3508f), QFC(0xffe954d0), + QFC(0x075112a2), QFC(0x58befacd), QFC(0xf79fa13a), QFC(0x00a85e94), + QFC(0xffea353a), QFC(0x077fedb3), QFC(0x59e2f69e), QFC(0xf887507c), + QFC(0x00acbd2f), QFC(0xffeb3849), QFC(0x07ad8c26), QFC(0x5b001db8), + 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(0x5e2f6367), QFC(0xfbe8f5bd), + QFC(0x00b73ab0), QFC(0xfff0e7ef), QFC(0x08594888), QFC(0x5f30ff5f), + QFC(0xfcb1d740), QFC(0x00b85f70), QFC(0xfff294c3), QFC(0x0880ffdd), + QFC(0x602b0c7f), QFC(0xfd7475d8), QFC(0x00b8c6b0), QFC(0xfff48700), + QFC(0x08a75da4), QFC(0x611d58a3), QFC(0xfe310657), QFC(0x00b8fe0d), + QFC(0xfff681d6), QFC(0x08cb4e23), QFC(0x6207f220), QFC(0xfee723c6), + QFC(0x00b8394b), QFC(0xfff91fc9), QFC(0x08edfeaa), QFC(0x62ea6474), + QFC(0xff96db8f), QFC(0x00b74c37), QFC(0xfffb42b0), QFC(0x090ec1fd), + QFC(0x63c45243), QFC(0x0040c497), QFC(0x00b5c867), QFC(0xfffdfa24), + QFC(0x092d7970), QFC(0x64964063), QFC(0x00e42fa2), QFC(0x00b3d15c), + QFC(0x00007134), QFC(0x0949eaac), QFC(0x655f63f2), QFC(0x01816e06), + QFC(0x00b1978d), QFC(0x00039609), QFC(0x0963ed46), QFC(0x661fd6b8), + QFC(0x02186a92), QFC(0x00af374c), QFC(0x0006b1cf), QFC(0x097c1ee9), + QFC(0x66d76725), QFC(0x02a99097), QFC(0x00abe79e), QFC(0x0009aa3f), + QFC(0x099140a7), QFC(0x6785c24d), QFC(0x03343534), QFC(0x00a8739d), + QFC(0x000d31b5), QFC(0x09a3e163), QFC(0x682b39a4), QFC(0x03b8f8dc), + QFC(0x00a520bb), QFC(0x0010bc63), QFC(0x09b3d780), QFC(0x68c7269c), + QFC(0x0437fb0a), QFC(0x00a1039c), QFC(0x001471f8), QFC(0x09c0e59f), + QFC(0x6959709d), QFC(0x04b0adcb), QFC(0x009d10bf), QFC(0x0018703f), + QFC(0x09cab9f2), QFC(0x69e29784), QFC(0x05237f9d), QFC(0x0098b855), + QFC(0x001c3549), QFC(0x09d19ca9), QFC(0x6a619c5e), QFC(0x0590a67d), + QFC(0x009424c6), QFC(0x002064f8), QFC(0x09d52709), QFC(0x6ad73e8e), + QFC(0x05f7fb90), QFC(0x008f4bfd), QFC(0x0024dd50), QFC(0x09d5560b), + QFC(0x6b42a864), QFC(0x06593912), QFC(0x008a7dd7), QFC(0x00293718), + QFC(0x09d1fa23), QFC(0x6ba4629f), QFC(0x06b559c3), QFC(0x0085c217), + QFC(0x002d8e42), QFC(0x09caeb0f), QFC(0x6bfbdd98), QFC(0x070bbf58), + QFC(0x00807994), QFC(0x00329ab6), QFC(0x09c018cf), QFC(0x6c492217), + QFC(0x075ca90c), QFC(0x007b3875), QFC(0x003745f9), QFC(0x09b18a1d), + QFC(0x6c8c4c7a), QFC(0x07a8127d), QFC(0x0075fded), QFC(0x003c1fa4), + QFC(0x099ec3dc), QFC(0x6cc59bab), QFC(0x07ee507c), QFC(0x0070c8a5), + QFC(0x004103f5), QFC(0x09881dc5), QFC(0x6cf4073e), QFC(0x082f552e), + QFC(0x006b47fa), QFC(0x00465348), QFC(0x096d0e22), QFC(0x6d18520e), + QFC(0x086b1eec), QFC(0x0065fde5), QFC(0x004b6c46), QFC(0x094d7ec2), + QFC(0x6d32730f), QFC(0x08a24899), QFC(0x006090c4), QFC(0x0050b177), + QFC(0x09299ead), QFC(0x6d41d964), QFC(0x08d3e41b), QFC(0x005b5371), + QFC(0x0055dba1), QFC(0x09015651), QFC(0x6d474e1d), QFC(0x09015651), + QFC(0x0055dba1), QFC(0xfe4d1be3), QFC(0xd1c58ace), QFC(0x2e3a7532), + QFC(0x01b2e41d), QFC(0x00000000), +}; + +/* This variant of the table above is used on platforms, that have vectorized + access to the table reading 4 filter sets (each of 5 coefficients) in a + block. Format: 1st row flt[0] of 4 sets (e.g. set 0, 1, 2, 3) 2nd row + flt[1] of 4 sets (e.g. set 0, 1, 2, 3) 3rd row flt[2] of 4 sets (e.g. set + 0, 1, 2, 3) 4th row flt[3] of 4 sets (e.g. set 0, 1, 2, 3) 5th row + flt[4] of 4 sets (e.g. set 0, 1, 2, 3) There are 32 blocks of 20 + coefficients, in total 640. Each of the rows must be at least 64-bit aligned + (see: RAM_ALIGN). +*/ +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_PFT qmf_pfilt640_vector[] = { + /*------------- 1 .. 4 ---------------*/ + QFC(0xFFEDE50E), + QFC(0xFFED978A), + QFC(0xFFEFC9B9), + QFC(0xFFF0065D), + QFC(0x01D78BFC), + QFC(0x01FD3BA0), + QFC(0x02244A25), + QFC(0x024BF7A1), + QFC(0x2FAA221C), + QFC(0x311AF3A4), + QFC(0x328CC6F0), + QFC(0x33FF670E), + QFC(0xD3337B3D), + QFC(0xD49FD55F), + QFC(0xD60A46E5), + QFC(0xD7722F04), + QFC(0xFE70B8D1), + QFC(0xFE933DC0), + QFC(0xFEB48D0D), + QFC(0xFED4BEC3), + /*------------- 5 .. 8 ---------------*/ + QFC(0xFFEFF6CA), + QFC(0xFFEF7B8B), + QFC(0xFFEEDFA4), + QFC(0xFFEE1650), + QFC(0x0274BA43), + QFC(0x029E35B4), + QFC(0x02C89901), + QFC(0x02F3E48D), + QFC(0x3572EC70), + QFC(0x36E69691), + QFC(0x385A49C4), + QFC(0x39CE0477), + QFC(0xD8D7F21F), + QFC(0xDA3B176A), + QFC(0xDB9B5B12), + QFC(0xDCF898FB), + QFC(0xFEF3F6AB), + QFC(0xFF120D70), + QFC(0xFF2EF725), + QFC(0xFF4AABC8), + /*------------- 9 .. 12 ---------------*/ + QFC(0xFFED651D), + QFC(0xFFECC31B), + QFC(0xFFEBE77B), + QFC(0xFFEB50B2), + QFC(0x03201116), + QFC(0x034D01F1), + QFC(0x037AD438), + QFC(0x03A966BC), + QFC(0x3B415115), + QFC(0x3CB41219), + QFC(0x3E25B17E), + QFC(0x3F962FB8), + QFC(0xDE529086), + QFC(0xDFA93AB5), + QFC(0xE0FC421E), + QFC(0xE24B8F66), + QFC(0xFF6542D1), + QFC(0xFF7EE3F1), + QFC(0xFF975C01), + QFC(0xFFAEA5D6), + /*------------- 13 .. 16 ---------------*/ + QFC(0xFFEA9192), + QFC(0xFFE9CA76), + QFC(0xFFE940F4), + QFC(0xFFE88BA8), + QFC(0x03D8AFE6), + QFC(0x04083FEC), + QFC(0x043889C6), + QFC(0x04694101), + QFC(0x41058BC6), + QFC(0x4272A385), + QFC(0x43DE620A), + QFC(0x4547DAEB), + QFC(0xE396A45D), + QFC(0xE4DE0CB0), + QFC(0xE620C476), + QFC(0xE75F8BB7), + QFC(0xFFC4E365), + QFC(0xFFDA17F2), + QFC(0xFFEE183B), + QFC(0x0000E790), + /*------------- 17 .. 20 ---------------*/ + QFC(0xFFE83A07), + QFC(0xFFE79E16), + QFC(0xFFE7746E), + QFC(0xFFE6D466), + QFC(0x049AA82F), + QFC(0x04CC2FCF), + QFC(0x04FE20BE), + QFC(0x05303F88), + QFC(0x46AEA856), + QFC(0x4812F848), + QFC(0x4973FEF2), + QFC(0x4AD237A2), + QFC(0xE89971B7), + QFC(0xE9CEA84A), + QFC(0xEAFEE7F1), + QFC(0xEC2A3F5F), + QFC(0x00131C75), + QFC(0x0023B989), + QFC(0x0033B927), + QFC(0x00426F36), + /*------------- 21 .. 24 ---------------*/ + QFC(0xFFE6AFED), + QFC(0xFFE65416), + QFC(0xFFE681C6), + QFC(0xFFE66DD0), + QFC(0x05626209), + QFC(0x05950122), + QFC(0x05C76FED), + QFC(0x05F9C051), + QFC(0x4C2CA3DF), + QFC(0x4D83976D), + QFC(0x4ED62BE3), + QFC(0x5024D70E), + QFC(0xED50A31D), + QFC(0xEE71B2FE), + QFC(0xEF8D4D7B), + QFC(0xF0A3959F), + QFC(0x00504F41), + QFC(0x005D36DF), + QFC(0x006928A0), + QFC(0x007400B8), + /*------------- 25 .. 28 ---------------*/ + QFC(0xFFE66FAB), + QFC(0xFFE69423), + QFC(0xFFE6FED4), + QFC(0xFFE75361), + QFC(0x062BF5EC), + QFC(0x065DD56A), + QFC(0x068F8B44), + QFC(0x06C0F0C0), + QFC(0x516EEFB9), + QFC(0x52B449DE), + QFC(0x53F495AA), + QFC(0x552F8FF7), + QFC(0xF1B461AB), + QFC(0xF2BF6EA4), + QFC(0xF3C4E887), + QFC(0xF4C473C5), + QFC(0x007E0393), + QFC(0x00872C63), + QFC(0x008F87AA), + QFC(0x0096DCC2), + /*------------- 29 .. 32 ---------------*/ + QFC(0xFFE80414), + QFC(0xFFE85B4A), + QFC(0xFFE954D0), + QFC(0xFFEA353A), + QFC(0x06F1825D), + QFC(0x0721BF22), + QFC(0x075112A2), + QFC(0x077FEDB3), + QFC(0x56654BDD), + QFC(0x579505F5), + QFC(0x58BEFACD), + QFC(0x59E2F69E), + QFC(0xF5BE0FA9), + QFC(0xF6B1F3C3), + QFC(0xF79FA13A), + QFC(0xF887507C), + QFC(0x009DA526), + QFC(0x00A3508F), + QFC(0x00A85E94), + QFC(0x00ACBD2F), + /*------------- 33 .. 36 ---------------*/ + QFC(0xFFEB3849), + QFC(0xFFEC8409), + QFC(0xFFEDC418), + QFC(0xFFEF2395), + QFC(0x07AD8C26), + QFC(0x07DA2B7F), + QFC(0x08061671), + QFC(0x08303897), + QFC(0x5B001DB8), + QFC(0x5C16D0AE), + QFC(0x5D26BE9B), + QFC(0x5E2F6367), + QFC(0xF96916F5), + QFC(0xFA44A069), + QFC(0xFB19B7BD), + QFC(0xFBE8F5BD), + QFC(0x00B06B68), + QFC(0x00B36ACD), + QFC(0x00B58C8D), + QFC(0x00B73AB0), + /*------------- 37 .. 40 ---------------*/ + QFC(0xFFF0E7EF), + QFC(0xFFF294C3), + QFC(0xFFF48700), + QFC(0xFFF681D6), + QFC(0x08594888), + QFC(0x0880FFDD), + QFC(0x08A75DA4), + QFC(0x08CB4E23), + QFC(0x5F30FF5F), + QFC(0x602B0C7F), + QFC(0x611D58A3), + QFC(0x6207F220), + QFC(0xFCB1D740), + QFC(0xFD7475D8), + QFC(0xFE310657), + QFC(0xFEE723C6), + QFC(0x00B85F70), + QFC(0x00B8C6B0), + QFC(0x00B8FE0D), + QFC(0x00B8394B), + /*------------- 41 .. 44 ---------------*/ + QFC(0xFFF91FC9), + QFC(0xFFFB42B0), + QFC(0xFFFDFA24), + QFC(0x00007134), + QFC(0x08EDFEAA), + QFC(0x090EC1FD), + QFC(0x092D7970), + QFC(0x0949EAAC), + QFC(0x62EA6474), + QFC(0x63C45243), + QFC(0x64964063), + QFC(0x655F63F2), + QFC(0xFF96DB8F), + QFC(0x0040C497), + QFC(0x00E42FA2), + QFC(0x01816E06), + QFC(0x00B74C37), + QFC(0x00B5C867), + QFC(0x00B3D15C), + QFC(0x00B1978D), + /*------------- 45 .. 48 ---------------*/ + QFC(0x00039609), + QFC(0x0006B1CF), + QFC(0x0009AA3F), + QFC(0x000D31B5), + QFC(0x0963ED46), + QFC(0x097C1EE9), + QFC(0x099140A7), + QFC(0x09A3E163), + QFC(0x661FD6B8), + QFC(0x66D76725), + QFC(0x6785C24D), + QFC(0x682B39A4), + QFC(0x02186A92), + QFC(0x02A99097), + QFC(0x03343534), + QFC(0x03B8F8DC), + QFC(0x00AF374C), + QFC(0x00ABE79E), + QFC(0x00A8739D), + QFC(0x00A520BB), + /*------------- 49 .. 52 ---------------*/ + QFC(0x0010BC63), + QFC(0x001471F8), + QFC(0x0018703F), + QFC(0x001C3549), + QFC(0x09B3D780), + QFC(0x09C0E59F), + QFC(0x09CAB9F2), + QFC(0x09D19CA9), + QFC(0x68C7269C), + QFC(0x6959709D), + QFC(0x69E29784), + QFC(0x6A619C5E), + QFC(0x0437FB0A), + QFC(0x04B0ADCB), + QFC(0x05237F9D), + QFC(0x0590A67D), + QFC(0x00A1039C), + QFC(0x009D10BF), + QFC(0x0098B855), + QFC(0x009424C6), + /*------------- 53 .. 56 ---------------*/ + QFC(0x002064F8), + QFC(0x0024DD50), + QFC(0x00293718), + QFC(0x002D8E42), + QFC(0x09D52709), + QFC(0x09D5560B), + QFC(0x09D1FA23), + QFC(0x09CAEB0F), + QFC(0x6AD73E8E), + QFC(0x6B42A864), + QFC(0x6BA4629F), + QFC(0x6BFBDD98), + QFC(0x05F7FB90), + QFC(0x06593912), + QFC(0x06B559C3), + QFC(0x070BBF58), + QFC(0x008F4BFD), + QFC(0x008A7DD7), + QFC(0x0085C217), + QFC(0x00807994), + /*------------- 57 .. 60 ---------------*/ + QFC(0x00329AB6), + QFC(0x003745F9), + QFC(0x003C1FA4), + QFC(0x004103F5), + QFC(0x09C018CF), + QFC(0x09B18A1D), + QFC(0x099EC3DC), + QFC(0x09881DC5), + QFC(0x6C492217), + QFC(0x6C8C4C7A), + QFC(0x6CC59BAB), + QFC(0x6CF4073E), + QFC(0x075CA90C), + QFC(0x07A8127D), + QFC(0x07EE507C), + QFC(0x082F552E), + QFC(0x007B3875), + QFC(0x0075FDED), + QFC(0x0070C8A5), + QFC(0x006B47FA), + /*------------- 61 .. 64 ---------------*/ + QFC(0x00465348), + QFC(0x004B6C46), + QFC(0x0050B177), + QFC(0x0055DBA1), + QFC(0x096D0E22), + QFC(0x094D7EC2), + QFC(0x09299EAD), + QFC(0x09015651), + QFC(0x6D18520E), + QFC(0x6D32730F), + QFC(0x6D41D964), + QFC(0x6D474E1D), + QFC(0x086B1EEC), + QFC(0x08A24899), + QFC(0x08D3E41B), + QFC(0x09015651), + QFC(0x0065FDE5), + QFC(0x006090C4), + QFC(0x005B5371), + QFC(0x0055DBA1), + /*------------- 63 .. 60 ---------------*/ + QFC(0x005B5371), + QFC(0x006090C4), + QFC(0x0065FDE5), + QFC(0x006B47FA), + QFC(0x08D3E41B), + QFC(0x08A24899), + QFC(0x086B1EEC), + QFC(0x082F552E), + QFC(0x6D41D964), + QFC(0x6D32730F), + QFC(0x6D18520E), + QFC(0x6CF4073E), + QFC(0x09299EAD), + QFC(0x094D7EC2), + QFC(0x096D0E22), + QFC(0x09881DC5), + QFC(0x0050B177), + QFC(0x004B6C46), + QFC(0x00465348), + QFC(0x004103F5), + /*------------- 59 .. 56 ---------------*/ + QFC(0x0070C8A5), + QFC(0x0075FDED), + QFC(0x007B3875), + QFC(0x00807994), + QFC(0x07EE507C), + QFC(0x07A8127D), + QFC(0x075CA90C), + QFC(0x070BBF58), + QFC(0x6CC59BAB), + QFC(0x6C8C4C7A), + QFC(0x6C492217), + QFC(0x6BFBDD98), + QFC(0x099EC3DC), + QFC(0x09B18A1D), + QFC(0x09C018CF), + QFC(0x09CAEB0F), + QFC(0x003C1FA4), + QFC(0x003745F9), + QFC(0x00329AB6), + QFC(0x002D8E42), + /*------------- 55 .. 52 ---------------*/ + QFC(0x0085C217), + QFC(0x008A7DD7), + QFC(0x008F4BFD), + QFC(0x009424C6), + QFC(0x06B559C3), + QFC(0x06593912), + QFC(0x05F7FB90), + QFC(0x0590A67D), + QFC(0x6BA4629F), + QFC(0x6B42A864), + QFC(0x6AD73E8E), + QFC(0x6A619C5E), + QFC(0x09D1FA23), + QFC(0x09D5560B), + QFC(0x09D52709), + QFC(0x09D19CA9), + QFC(0x00293718), + QFC(0x0024DD50), + QFC(0x002064F8), + QFC(0x001C3549), + /*------------- 51 .. 48 ---------------*/ + QFC(0x0098B855), + QFC(0x009D10BF), + QFC(0x00A1039C), + QFC(0x00A520BB), + QFC(0x05237F9D), + QFC(0x04B0ADCB), + QFC(0x0437FB0A), + QFC(0x03B8F8DC), + QFC(0x69E29784), + QFC(0x6959709D), + QFC(0x68C7269C), + QFC(0x682B39A4), + QFC(0x09CAB9F2), + QFC(0x09C0E59F), + QFC(0x09B3D780), + QFC(0x09A3E163), + QFC(0x0018703F), + QFC(0x001471F8), + QFC(0x0010BC63), + QFC(0x000D31B5), + /*------------- 47 .. 44 ---------------*/ + QFC(0x00A8739D), + QFC(0x00ABE79E), + QFC(0x00AF374C), + QFC(0x00B1978D), + QFC(0x03343534), + QFC(0x02A99097), + QFC(0x02186A92), + QFC(0x01816E06), + QFC(0x6785C24D), + QFC(0x66D76725), + QFC(0x661FD6B8), + QFC(0x655F63F2), + QFC(0x099140A7), + QFC(0x097C1EE9), + QFC(0x0963ED46), + QFC(0x0949EAAC), + QFC(0x0009AA3F), + QFC(0x0006B1CF), + QFC(0x00039609), + QFC(0x00007134), + /*------------- 43 .. 40 ---------------*/ + QFC(0x00B3D15C), + QFC(0x00B5C867), + QFC(0x00B74C37), + QFC(0x00B8394B), + QFC(0x00E42FA2), + QFC(0x0040C497), + QFC(0xFF96DB8F), + QFC(0xFEE723C6), + QFC(0x64964063), + QFC(0x63C45243), + QFC(0x62EA6474), + QFC(0x6207F220), + QFC(0x092D7970), + QFC(0x090EC1FD), + QFC(0x08EDFEAA), + QFC(0x08CB4E23), + QFC(0xFFFDFA24), + QFC(0xFFFB42B0), + QFC(0xFFF91FC9), + QFC(0xFFF681D6), + /*------------- 39 .. 36 ---------------*/ + QFC(0x00B8FE0D), + QFC(0x00B8C6B0), + QFC(0x00B85F70), + QFC(0x00B73AB0), + QFC(0xFE310657), + QFC(0xFD7475D8), + QFC(0xFCB1D740), + QFC(0xFBE8F5BD), + QFC(0x611D58A3), + QFC(0x602B0C7F), + QFC(0x5F30FF5F), + QFC(0x5E2F6367), + QFC(0x08A75DA4), + QFC(0x0880FFDD), + QFC(0x08594888), + QFC(0x08303897), + QFC(0xFFF48700), + QFC(0xFFF294C3), + QFC(0xFFF0E7EF), + QFC(0xFFEF2395), + /*------------- 35 .. 32 ---------------*/ + QFC(0x00B58C8D), + QFC(0x00B36ACD), + QFC(0x00B06B68), + QFC(0x00ACBD2F), + QFC(0xFB19B7BD), + QFC(0xFA44A069), + QFC(0xF96916F5), + QFC(0xF887507C), + QFC(0x5D26BE9B), + QFC(0x5C16D0AE), + QFC(0x5B001DB8), + QFC(0x59E2F69E), + QFC(0x08061671), + QFC(0x07DA2B7F), + QFC(0x07AD8C26), + QFC(0x077FEDB3), + QFC(0xFFEDC418), + QFC(0xFFEC8409), + QFC(0xFFEB3849), + QFC(0xFFEA353A), + /*------------- 31 .. 28 ---------------*/ + QFC(0x00A85E94), + QFC(0x00A3508F), + QFC(0x009DA526), + QFC(0x0096DCC2), + QFC(0xF79FA13A), + QFC(0xF6B1F3C3), + QFC(0xF5BE0FA9), + QFC(0xF4C473C5), + QFC(0x58BEFACD), + QFC(0x579505F5), + QFC(0x56654BDD), + QFC(0x552F8FF7), + QFC(0x075112A2), + QFC(0x0721BF22), + QFC(0x06F1825D), + QFC(0x06C0F0C0), + QFC(0xFFE954D0), + QFC(0xFFE85B4A), + QFC(0xFFE80414), + QFC(0xFFE75361), + /*------------- 27 .. 24 ---------------*/ + QFC(0x008F87AA), + QFC(0x00872C63), + QFC(0x007E0393), + QFC(0x007400B8), + QFC(0xF3C4E887), + QFC(0xF2BF6EA4), + QFC(0xF1B461AB), + QFC(0xF0A3959F), + QFC(0x53F495AA), + QFC(0x52B449DE), + QFC(0x516EEFB9), + QFC(0x5024D70E), + QFC(0x068F8B44), + QFC(0x065DD56A), + QFC(0x062BF5EC), + QFC(0x05F9C051), + QFC(0xFFE6FED4), + QFC(0xFFE69423), + QFC(0xFFE66FAB), + QFC(0xFFE66DD0), + /*------------- 23 .. 20 ---------------*/ + QFC(0x006928A0), + QFC(0x005D36DF), + QFC(0x00504F41), + QFC(0x00426F36), + QFC(0xEF8D4D7B), + QFC(0xEE71B2FE), + QFC(0xED50A31D), + QFC(0xEC2A3F5F), + QFC(0x4ED62BE3), + QFC(0x4D83976D), + QFC(0x4C2CA3DF), + QFC(0x4AD237A2), + QFC(0x05C76FED), + QFC(0x05950122), + QFC(0x05626209), + QFC(0x05303F88), + QFC(0xFFE681C6), + QFC(0xFFE65416), + QFC(0xFFE6AFED), + QFC(0xFFE6D466), + /*------------- 19 .. 16 ---------------*/ + QFC(0x0033B927), + QFC(0x0023B989), + QFC(0x00131C75), + QFC(0x0000E790), + QFC(0xEAFEE7F1), + QFC(0xE9CEA84A), + QFC(0xE89971B7), + QFC(0xE75F8BB7), + QFC(0x4973FEF2), + QFC(0x4812F848), + QFC(0x46AEA856), + QFC(0x4547DAEB), + QFC(0x04FE20BE), + QFC(0x04CC2FCF), + QFC(0x049AA82F), + QFC(0x04694101), + QFC(0xFFE7746E), + QFC(0xFFE79E16), + QFC(0xFFE83A07), + QFC(0xFFE88BA8), + /*------------- 15 .. 12 ---------------*/ + QFC(0xFFEE183B), + QFC(0xFFDA17F2), + QFC(0xFFC4E365), + QFC(0xFFAEA5D6), + QFC(0xE620C476), + QFC(0xE4DE0CB0), + QFC(0xE396A45D), + QFC(0xE24B8F66), + QFC(0x43DE620A), + QFC(0x4272A385), + QFC(0x41058BC6), + QFC(0x3F962FB8), + QFC(0x043889C6), + QFC(0x04083FEC), + QFC(0x03D8AFE6), + QFC(0x03A966BC), + QFC(0xFFE940F4), + QFC(0xFFE9CA76), + QFC(0xFFEA9192), + QFC(0xFFEB50B2), + /*------------- 11 .. 8 ---------------*/ + QFC(0xFF975C01), + QFC(0xFF7EE3F1), + QFC(0xFF6542D1), + QFC(0xFF4AABC8), + QFC(0xE0FC421E), + QFC(0xDFA93AB5), + QFC(0xDE529086), + QFC(0xDCF898FB), + QFC(0x3E25B17E), + QFC(0x3CB41219), + QFC(0x3B415115), + QFC(0x39CE0477), + QFC(0x037AD438), + QFC(0x034D01F1), + QFC(0x03201116), + QFC(0x02F3E48D), + QFC(0xFFEBE77B), + QFC(0xFFECC31B), + QFC(0xFFED651D), + QFC(0xFFEE1650), + /*------------- 7 .. 4 ---------------*/ + QFC(0xFF2EF725), + QFC(0xFF120D70), + QFC(0xFEF3F6AB), + QFC(0xFED4BEC3), + QFC(0xDB9B5B12), + QFC(0xDA3B176A), + QFC(0xD8D7F21F), + QFC(0xD7722F04), + QFC(0x385A49C4), + QFC(0x36E69691), + QFC(0x3572EC70), + QFC(0x33FF670E), + QFC(0x02C89901), + QFC(0x029E35B4), + QFC(0x0274BA43), + QFC(0x024BF7A1), + QFC(0xFFEEDFA4), + QFC(0xFFEF7B8B), + QFC(0xFFEFF6CA), + QFC(0xFFF0065D), + /*------------- 3 .. 0 ---------------*/ + QFC(0xFEB48D0D), + QFC(0xFE933DC0), + QFC(0xFE70B8D1), + QFC(0xFE4D1BE3), + QFC(0xD60A46E5), + QFC(0xD49FD55F), + QFC(0xD3337B3D), + QFC(0xD1C58ACE), + QFC(0x328CC6F0), + QFC(0x311AF3A4), + QFC(0x2FAA221C), + QFC(0x2E3A7532), + QFC(0x02244A25), + QFC(0x01FD3BA0), + QFC(0x01D78BFC), + QFC(0x01B2E41D), + QFC(0xFFEFC9B9), + QFC(0xFFED978A), + QFC(0xFFEDE50E), + QFC(0x00000000), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_QTW qmf_phaseshift_cos64[] = { + QTC(0x7ff62182), QTC(0x7fa736b4), QTC(0x7f0991c4), QTC(0x7e1d93ea), + QTC(0x7ce3ceb2), QTC(0x7b5d039e), QTC(0x798a23b1), QTC(0x776c4edb), + QTC(0x7504d345), QTC(0x72552c85), QTC(0x6f5f02b2), QTC(0x6c242960), + QTC(0x68a69e81), QTC(0x64e88926), QTC(0x60ec3830), QTC(0x5cb420e0), + QTC(0x5842dd54), QTC(0x539b2af0), QTC(0x4ebfe8a5), QTC(0x49b41533), + QTC(0x447acd50), QTC(0x3f1749b8), QTC(0x398cdd32), QTC(0x33def287), + QTC(0x2e110a62), QTC(0x2826b928), QTC(0x2223a4c5), QTC(0x1c0b826a), + QTC(0x15e21445), QTC(0x0fab272b), QTC(0x096a9049), QTC(0x03242abf), + QTC(0xfcdbd541), QTC(0xf6956fb7), QTC(0xf054d8d5), QTC(0xea1debbb), + QTC(0xe3f47d96), QTC(0xdddc5b3b), QTC(0xd7d946d8), QTC(0xd1eef59e), + QTC(0xcc210d79), QTC(0xc67322ce), QTC(0xc0e8b648), QTC(0xbb8532b0), + QTC(0xb64beacd), QTC(0xb140175b), QTC(0xac64d510), QTC(0xa7bd22ac), + QTC(0xa34bdf20), QTC(0x9f13c7d0), QTC(0x9b1776da), QTC(0x9759617f), + QTC(0x93dbd6a0), QTC(0x90a0fd4e), QTC(0x8daad37b), QTC(0x8afb2cbb), + QTC(0x8893b125), QTC(0x8675dc4f), QTC(0x84a2fc62), QTC(0x831c314e), + QTC(0x81e26c16), QTC(0x80f66e3c), QTC(0x8058c94c), QTC(0x8009de7e), +}; + +RAM_ALIGN +LNK_SECTION_CONSTDATA +const FIXP_QTW qmf_phaseshift_sin64[] = { + QTC(0x03242abf), QTC(0x096a9049), QTC(0x0fab272b), QTC(0x15e21445), + QTC(0x1c0b826a), QTC(0x2223a4c5), QTC(0x2826b928), QTC(0x2e110a62), + QTC(0x33def287), QTC(0x398cdd32), QTC(0x3f1749b8), QTC(0x447acd50), + QTC(0x49b41533), QTC(0x4ebfe8a5), QTC(0x539b2af0), QTC(0x5842dd54), + QTC(0x5cb420e0), QTC(0x60ec3830), QTC(0x64e88926), QTC(0x68a69e81), + QTC(0x6c242960), QTC(0x6f5f02b2), QTC(0x72552c85), QTC(0x7504d345), + QTC(0x776c4edb), QTC(0x798a23b1), QTC(0x7b5d039e), QTC(0x7ce3ceb2), + QTC(0x7e1d93ea), QTC(0x7f0991c4), QTC(0x7fa736b4), QTC(0x7ff62182), + QTC(0x7ff62182), QTC(0x7fa736b4), QTC(0x7f0991c4), QTC(0x7e1d93ea), + QTC(0x7ce3ceb2), QTC(0x7b5d039e), QTC(0x798a23b1), QTC(0x776c4edb), + QTC(0x7504d345), QTC(0x72552c85), QTC(0x6f5f02b2), QTC(0x6c242960), + QTC(0x68a69e81), QTC(0x64e88926), QTC(0x60ec3830), QTC(0x5cb420e0), + QTC(0x5842dd54), QTC(0x539b2af0), QTC(0x4ebfe8a5), QTC(0x49b41533), + QTC(0x447acd50), QTC(0x3f1749b8), QTC(0x398cdd32), QTC(0x33def287), + QTC(0x2e110a62), QTC(0x2826b928), QTC(0x2223a4c5), QTC(0x1c0b826a), + QTC(0x15e21445), QTC(0x0fab272b), QTC(0x096a9049), QTC(0x03242abf), +}; + +/* + * 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_ana[32] = { + /* analysis twiddle table */ + 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_cos32_cldfb_syn[32] = { + /* synthesis twiddle table */ + 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), +}; + +/* twiddles for X=(8,16) band qmf are copied from float simpleplayer + * implementation: qmf_phaseshift_cosX_cldfb_ana = + * QMFlib_twiddle3RealX_SBRLD_A qmf_phaseshift_cosX_cldfb_syn = + * -(QMFlib_twiddle3RealX_SBRLD_A) qmf_phaseshift_sinX_cldfb = + * QMFlib_twiddle3ImagX_SBRLD_A + */ + +/* cos ((n + 0.5)*pi*angle/L) , order = 159, L=16 */ +const FIXP_QTW qmf_phaseshift_cos16_cldfb_ana[16] = { + QTCFLLDT(-0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), + QTCFLLDT(-0.7071067812), QTCFLLDT(-0.7071067812), QTCFLLDT(0.7071067812), + QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), QTCFLLDT(-0.7071067812), + QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), + QTCFLLDT(-0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), + QTCFLLDT(-0.7071067812), +}; + +/* cos ((n + 0.5)*pi*angle/L) , order = 159, L=16 */ +const FIXP_QTW qmf_phaseshift_cos16_cldfb_syn[16] = { + QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), QTCFLLDT(-0.7071067812), + QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), + QTCFLLDT(-0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), + QTCFLLDT(-0.7071067812), QTCFLLDT(-0.7071067812), QTCFLLDT(0.7071067812), + QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), QTCFLLDT(-0.7071067812), + QTCFLLDT(0.7071067812), +}; + +/* sin ((n + 0.5)*pi*angle/L) , order = 159, L=16 */ +const FIXP_QTW qmf_phaseshift_sin16_cldfb[16] = { + QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), + QTCFLLDT(-0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), + QTCFLLDT(-0.7071067812), QTCFLLDT(-0.7071067812), QTCFLLDT(0.7071067812), + QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), QTCFLLDT(-0.7071067812), + QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), + QTCFLLDT(-0.7071067812), +}; + +/* cos ((n + 0.5)*pi*angle/L) , order = 79, L=8 */ +const FIXP_QTW qmf_phaseshift_cos8_cldfb_ana[8] = { + QTCFLLDT(-0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), + QTCFLLDT(-0.7071067812), QTCFLLDT(-0.7071067812), QTCFLLDT(0.7071067812), + QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), +}; + +const FIXP_QTW qmf_phaseshift_cos8_cldfb_syn[8] = { + QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), QTCFLLDT(-0.7071067812), + QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), + QTCFLLDT(-0.7071067812), QTCFLLDT(0.7071067812), +}; + +/* sin ((n + 0.5)*pi*angle/L) , order = 79, L=8 */ +const FIXP_QTW qmf_phaseshift_sin8_cldfb[8] = { + QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(-0.7071067812), + QTCFLLDT(-0.7071067812), QTCFLLDT(0.7071067812), QTCFLLDT(0.7071067812), + QTCFLLDT(-0.7071067812), QTCFLLDT(-0.7071067812), +}; + +/* 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), +}; + +RAM_ALIGN +const FIXP_PFT qmf_cldfb_160[QMF160_CLDFB_PFT_TABLE_SIZE] = { + QTCFLLD(6.114156e-07), QTCFLLD(-4.929378e-06), QTCFLLD(-1.173270e-03), + QTCFLLD(9.985781e-03), QTCFLLD(5.385081e-01), QTCFLLD(2.119298e-07), + QTCFLLD(8.001152e-06), QTCFLLD(-9.578346e-04), QTCFLLD(1.315910e-02), + QTCFLLD(6.066454e-01), QTCFLLD(8.097845e-07), QTCFLLD(1.849027e-05), + QTCFLLD(-1.219567e-03), QTCFLLD(1.721718e-02), QTCFLLD(6.734486e-01), + QTCFLLD(-1.135478e-08), QTCFLLD(5.632976e-06), QTCFLLD(-7.392278e-04), + QTCFLLD(2.226388e-02), QTCFLLD(7.376929e-01), QTCFLLD(6.347751e-08), + QTCFLLD(1.454425e-05), QTCFLLD(-1.105239e-04), QTCFLLD(2.845808e-02), + QTCFLLD(7.981848e-01), QTCFLLD(-2.838328e-06), QTCFLLD(3.414749e-06), + QTCFLLD(1.272254e-03), QTCFLLD(3.594821e-02), QTCFLLD(8.539265e-01), + QTCFLLD(7.116049e-08), QTCFLLD(4.031125e-05), QTCFLLD(2.136304e-03), + QTCFLLD(4.477318e-02), QTCFLLD(9.038135e-01), QTCFLLD(4.098227e-07), + QTCFLLD(7.484240e-05), QTCFLLD(2.716078e-03), QTCFLLD(5.502766e-02), + QTCFLLD(9.466825e-01), QTCFLLD(4.934327e-07), QTCFLLD(7.557725e-05), + QTCFLLD(2.058748e-03), QTCFLLD(6.626062e-02), QTCFLLD(9.818396e-01), + QTCFLLD(-4.933896e-08), QTCFLLD(-3.907360e-05), QTCFLLD(3.753964e-04), + QTCFLLD(7.806610e-02), QTCFLLD(1.008988e+00), QTCFLLD(-7.856341e-06), + QTCFLLD(9.949480e-05), QTCFLLD(7.176331e-04), QTCFLLD(8.987702e-02), + QTCFLLD(1.027784e+00), QTCFLLD(4.822448e-07), QTCFLLD(-1.327914e-05), + QTCFLLD(6.855222e-04), QTCFLLD(1.011847e-01), QTCFLLD(1.038242e+00), + QTCFLLD(4.432684e-07), QTCFLLD(-5.662008e-05), QTCFLLD(5.360314e-04), + QTCFLLD(1.112756e-01), QTCFLLD(1.041439e+00), QTCFLLD(-1.894204e-06), + QTCFLLD(-1.603894e-04), QTCFLLD(-2.796433e-04), QTCFLLD(1.193894e-01), + QTCFLLD(1.038456e+00), QTCFLLD(2.350541e-06), QTCFLLD(-1.981793e-04), + QTCFLLD(-1.719967e-03), QTCFLLD(1.249437e-01), QTCFLLD(1.028407e+00), + QTCFLLD(4.833713e-06), QTCFLLD(-1.957799e-04), QTCFLLD(-3.159640e-03), + QTCFLLD(1.274605e-01), QTCFLLD(1.009701e+00), QTCFLLD(4.724263e-06), + QTCFLLD(-1.181518e-05), QTCFLLD(-4.243399e-03), QTCFLLD(1.270390e-01), + QTCFLLD(9.748854e-01), QTCFLLD(1.007724e-06), QTCFLLD(2.585741e-05), + QTCFLLD(-4.713445e-03), QTCFLLD(1.231120e-01), QTCFLLD(9.246770e-01), + QTCFLLD(2.908454e-06), QTCFLLD(3.137374e-05), QTCFLLD(-4.230293e-03), + QTCFLLD(1.144269e-01), QTCFLLD(8.681067e-01), QTCFLLD(-4.128877e-08), + QTCFLLD(1.870358e-05), QTCFLLD(-2.842924e-03), QTCFLLD(1.003715e-01), + QTCFLLD(8.080344e-01), QTCFLLD(1.806649e-07), QTCFLLD(3.557071e-05), + QTCFLLD(-8.392422e-04), QTCFLLD(8.065225e-02), QTCFLLD(7.464405e-01), + QTCFLLD(2.352609e-06), QTCFLLD(1.090077e-04), QTCFLLD(7.497848e-04), + QTCFLLD(5.529631e-02), QTCFLLD(6.831591e-01), QTCFLLD(1.159657e-07), + QTCFLLD(4.585990e-05), QTCFLLD(2.079346e-03), QTCFLLD(2.434883e-02), + QTCFLLD(6.179208e-01), QTCFLLD(8.859606e-07), QTCFLLD(1.403345e-04), + QTCFLLD(1.065580e-03), QTCFLLD(-1.220572e-02), QTCFLLD(5.514521e-01), + QTCFLLD(-1.038278e-06), QTCFLLD(-1.368162e-04), QTCFLLD(2.932339e-04), + QTCFLLD(-5.416374e-02), QTCFLLD(4.843109e-01), QTCFLLD(7.820030e-08), + QTCFLLD(3.934544e-05), QTCFLLD(-6.638491e-04), QTCFLLD(-1.012664e-01), + QTCFLLD(4.165150e-01), QTCFLLD(-8.393432e-06), QTCFLLD(-5.053646e-05), + QTCFLLD(-1.381912e-03), QTCFLLD(-1.532225e-01), QTCFLLD(3.487301e-01), + QTCFLLD(-1.455897e-06), QTCFLLD(4.880962e-05), QTCFLLD(-2.274392e-03), + QTCFLLD(-2.096737e-01), QTCFLLD(2.818234e-01), QTCFLLD(-1.434317e-06), + QTCFLLD(2.203687e-04), QTCFLLD(-3.357312e-03), QTCFLLD(-2.701693e-01), + QTCFLLD(2.147441e-01), QTCFLLD(7.092199e-06), QTCFLLD(4.681670e-04), + QTCFLLD(-4.601593e-03), QTCFLLD(-3.341968e-01), QTCFLLD(1.461805e-01), + QTCFLLD(-1.116123e-05), QTCFLLD(1.072196e-03), QTCFLLD(-5.925141e-03), + QTCFLLD(-4.010285e-01), QTCFLLD(8.077862e-02), QTCFLLD(-3.775385e-05), + QTCFLLD(1.244841e-03), QTCFLLD(-7.628469e-03), QTCFLLD(-4.696240e-01), + QTCFLLD(2.901889e-02), +}; + +RAM_ALIGN +const FIXP_PFT qmf_cldfb_80[QMF80_CLDFB_PFT_TABLE_SIZE] = { + QTCFLLD(6.966921e-07), QTCFLLD(9.025176e-06), QTCFLLD(-1.073328e-03), + QTCFLLD(1.146585e-02), QTCFLLD(5.726758e-01), QTCFLLD(-2.323046e-09), + QTCFLLD(1.012638e-05), QTCFLLD(-1.084654e-03), QTCFLLD(1.960515e-02), + QTCFLLD(7.059712e-01), QTCFLLD(1.230159e-07), QTCFLLD(4.639126e-05), + QTCFLLD(6.398911e-04), QTCFLLD(3.204506e-02), QTCFLLD(8.267125e-01), + QTCFLLD(2.865339e-07), QTCFLLD(6.273759e-05), QTCFLLD(2.550464e-03), + QTCFLLD(4.977453e-02), QTCFLLD(9.261818e-01), QTCFLLD(3.738257e-07), + QTCFLLD(-2.429021e-06), QTCFLLD(1.375921e-03), QTCFLLD(7.212754e-02), + QTCFLLD(9.964333e-01), QTCFLLD(1.077039e-08), QTCFLLD(-8.532976e-06), + QTCFLLD(7.147022e-04), QTCFLLD(9.563432e-02), QTCFLLD(1.034012e+00), + QTCFLLD(3.086046e-07), QTCFLLD(-7.986870e-05), QTCFLLD(2.203781e-04), + QTCFLLD(1.156221e-01), QTCFLLD(1.040718e+00), QTCFLLD(5.542804e-06), + QTCFLLD(-1.736757e-04), QTCFLLD(-2.475428e-03), QTCFLLD(1.266206e-01), + QTCFLLD(1.020100e+00), QTCFLLD(3.415168e-06), QTCFLLD(6.290201e-06), + QTCFLLD(-4.576709e-03), QTCFLLD(1.256370e-01), QTCFLLD(9.506344e-01), + QTCFLLD(-1.998632e-09), QTCFLLD(3.017514e-05), QTCFLLD(-3.627394e-03), + QTCFLLD(1.081003e-01), QTCFLLD(8.383245e-01), QTCFLLD(2.590900e-07), + QTCFLLD(9.614004e-05), QTCFLLD(2.183786e-06), QTCFLLD(6.867141e-02), + QTCFLLD(7.150523e-01), QTCFLLD(1.408172e-07), QTCFLLD(5.203217e-05), + QTCFLLD(1.584410e-03), QTCFLLD(6.753749e-03), QTCFLLD(5.847858e-01), + QTCFLLD(-9.234326e-07), QTCFLLD(6.477183e-06), QTCFLLD(-2.123969e-04), + QTCFLLD(-7.709230e-02), QTCFLLD(4.504798e-01), QTCFLLD(-2.464033e-08), + QTCFLLD(1.888626e-05), QTCFLLD(-1.812003e-03), QTCFLLD(-1.809127e-01), + QTCFLLD(3.151743e-01), QTCFLLD(-8.344882e-07), QTCFLLD(2.538528e-04), + QTCFLLD(-3.972626e-03), QTCFLLD(-3.017793e-01), QTCFLLD(1.805658e-01), + QTCFLLD(-2.720526e-05), QTCFLLD(1.150009e-03), QTCFLLD(-6.712822e-03), + QTCFLLD(-4.351740e-01), QTCFLLD(5.276687e-02), +}; + +#if defined(QMF_COEFF_16BIT) +#define QTMFLLD(x) FL2FXCONST_SGL(x / (float)(1 << QMF_MPSLDFB_PFT_SCALE)) +#define QTMFLLDT(x) FX_DBL2FXCONST_SGL(x) +#else +#define QTMFLLD(x) FL2FXCONST_DBL(x / (float)(1 << QMF_MPSLDFB_PFT_SCALE)) +#define QTMFLLDT(x) (FIXP_DBL)(x) +#endif + +/*! + \name QMF + \brief QMF-Table + 32 channels, N = 320, + + The coefficients are derived from the MPS Low Delay coefficient set + with 640 samples. The coefficients are interpolated and rearranged + in the following way compared to the reference: + + qmf_mpsldfb_320[0] = (qmf_64_reference[ 0] + qmf_64_reference[ 1])/2.0; + qmf_mpsldfb_320[1] = (qmf_64_reference[128] + qmf_64_reference[129])/2.0; + qmf_mpsldfb_320[2] = (qmf_64_reference[256] + qmf_64_reference[257])/2.0; + qmf_mpsldfb_320[3] = (qmf_64_reference[384] + qmf_64_reference[385])/2.0; + qmf_mpsldfb_320[4] = (qmf_64_reference[512] + qmf_64_reference[513])/2.0; + + qmf_mpsldfb_320[5] = (qmf_64_reference[ 2] + qmf_64_reference[ 3])/2.0; + qmf_mpsldfb_320[6] = (qmf_64_reference[130] + qmf_64_reference[131])/2.0; + qmf_mpsldfb_320[7] = (qmf_64_reference[258] + qmf_64_reference[259])/2.0; + qmf_mpsldfb_320[8] = (qmf_64_reference[386] + qmf_64_reference[387])/2.0; + qmf_mpsldfb_320[9] = (qmf_64_reference[514] + qmf_64_reference[515])/2.0; + . + . + . + qmf_mpsldfb_320[315] = (qmf_64_reference[126] + qmf_64_reference[127])/2.0; + qmf_mpsldfb_320[316] = (qmf_64_reference[254] + qmf_64_reference[255])/2.0; + qmf_mpsldfb_320[317] = (qmf_64_reference[382] + qmf_64_reference[383])/2.0; + qmf_mpsldfb_320[318] = (qmf_64_reference[510] + qmf_64_reference[511])/2.0; + qmf_mpsldfb_320[319] = (qmf_64_reference[638] + qmf_64_reference[639])/2.0; + + The filter output is required to be scaled by 1 bit. + + \showinitializer +*/ +//@{ +const FIXP_PFT qmf_mpsldfb_320[QMF320_MPSLDFB_PFT_TABLE_SIZE] = { + QTMFLLD(1.0777725402e-004), QTMFLLD(-9.4703806099e-004), + QTMFLLD(6.1286436394e-003), QTMFLLD(-9.0161964297e-002), + QTMFLLD(5.5554401875e-001), QTMFLLD(1.2731316383e-004), + QTMFLLD(-1.2311334722e-003), QTMFLLD(4.9468209036e-003), + QTMFLLD(-1.1305026710e-001), QTMFLLD(5.2990418673e-001), + QTMFLLD(1.1927412561e-004), QTMFLLD(-1.5128203668e-003), + QTMFLLD(3.5794533323e-003), QTMFLLD(-1.3681203127e-001), + QTMFLLD(5.0423312187e-001), QTMFLLD(1.0006380762e-004), + QTMFLLD(-1.7925058492e-003), QTMFLLD(2.0164034795e-003), + QTMFLLD(-1.6139641404e-001), QTMFLLD(4.7861024737e-001), + QTMFLLD(7.2826202086e-005), QTMFLLD(-2.0697340369e-003), + QTMFLLD(2.4838969694e-004), QTMFLLD(-1.8674756587e-001), + QTMFLLD(4.5311337709e-001), QTMFLLD(3.8808015233e-005), + QTMFLLD(-2.3429044522e-003), QTMFLLD(-1.7331546405e-003), + QTMFLLD(-2.1280488372e-001), QTMFLLD(4.2781800032e-001), + QTMFLLD(-5.4359588830e-007), QTMFLLD(-2.6112669148e-003), + QTMFLLD(-3.9357249625e-003), QTMFLLD(-2.3950359225e-001), + QTMFLLD(4.0279802680e-001), QTMFLLD(-4.3614549213e-005), + QTMFLLD(-2.8741455171e-003), QTMFLLD(-6.3655078411e-003), + QTMFLLD(-2.6677471399e-001), QTMFLLD(3.7812507153e-001), + QTMFLLD(-8.9040157036e-005), QTMFLLD(-3.1308881007e-003), + QTMFLLD(-9.0275555849e-003), QTMFLLD(-2.9454550147e-001), + QTMFLLD(3.5386830568e-001), QTMFLLD(-1.3519046479e-004), + QTMFLLD(-3.3808732405e-003), QTMFLLD(-1.1925406754e-002), + QTMFLLD(-3.2273942232e-001), QTMFLLD(3.3009397984e-001), + QTMFLLD(-1.8045579782e-004), QTMFLLD(-3.6236830056e-003), + QTMFLLD(-1.5061311424e-002), QTMFLLD(-3.5127705336e-001), + QTMFLLD(3.0686509609e-001), QTMFLLD(-2.2396800341e-004), + QTMFLLD(-3.8587960880e-003), QTMFLLD(-1.8435835838e-002), + QTMFLLD(-3.8007527590e-001), QTMFLLD(2.8424069285e-001), + QTMFLLD(-2.6416976471e-004), QTMFLLD(-4.0859002620e-003), + QTMFLLD(-2.2048022598e-002), QTMFLLD(-4.0904915333e-001), + QTMFLLD(2.6227575541e-001), QTMFLLD(-3.0001887353e-004), + QTMFLLD(-4.3045589700e-003), QTMFLLD(-2.5894984603e-002), + QTMFLLD(-4.3811064959e-001), QTMFLLD(2.4102044106e-001), + QTMFLLD(-3.3083156450e-004), QTMFLLD(-4.5145484619e-003), + QTMFLLD(-2.9972121119e-002), QTMFLLD(-4.6717000008e-001), + QTMFLLD(2.2052007914e-001), QTMFLLD(-3.5614447552e-004), + QTMFLLD(-4.7155953944e-003), QTMFLLD(-3.4272894263e-002), + QTMFLLD(-4.9613577127e-001), QTMFLLD(2.0081442595e-001), + QTMFLLD(-3.7579826312e-004), QTMFLLD(-4.9072988331e-003), + QTMFLLD(-3.8788780570e-002), QTMFLLD(-5.2491527796e-001), + QTMFLLD(1.8193808198e-001), QTMFLLD(-3.8993739872e-004), + QTMFLLD(-5.0893351436e-003), QTMFLLD(-4.3509010226e-002), + QTMFLLD(-5.5341482162e-001), QTMFLLD(1.6391974688e-001), + QTMFLLD(-3.9912899956e-004), QTMFLLD(-5.2615385503e-003), + QTMFLLD(-4.8421185464e-002), QTMFLLD(-5.8154034615e-001), + QTMFLLD(1.4678207040e-001), QTMFLLD(-4.0421969607e-004), + QTMFLLD(-5.4236799479e-003), QTMFLLD(-5.3510606289e-002), + QTMFLLD(-6.0919785500e-001), QTMFLLD(1.3054165244e-001), + QTMFLLD(-4.0645478293e-004), QTMFLLD(-5.5756671354e-003), + QTMFLLD(-5.8760054410e-002), QTMFLLD(-6.3629388809e-001), + QTMFLLD(1.1520925164e-001), QTMFLLD(-4.0720938705e-004), + QTMFLLD(-5.7173836976e-003), QTMFLLD(-6.4149998128e-002), + QTMFLLD(-6.6273581982e-001), QTMFLLD(1.0078965127e-001), + QTMFLLD(-4.0812738007e-004), QTMFLLD(-5.8488911018e-003), + QTMFLLD(-6.9658569992e-002), QTMFLLD(-6.8843221664e-001), + QTMFLLD(8.7281554937e-002), QTMFLLD(-4.1120912647e-004), + QTMFLLD(-5.9703430161e-003), QTMFLLD(-7.5261354446e-002), + QTMFLLD(-7.1329379082e-001), QTMFLLD(7.4678033590e-002), + QTMFLLD(-4.1838851757e-004), QTMFLLD(-6.0821287334e-003), + QTMFLLD(-8.0931767821e-002), QTMFLLD(-7.3723363876e-001), + QTMFLLD(6.2966249883e-002), QTMFLLD(-4.3148122495e-004), + QTMFLLD(-6.1847940087e-003), QTMFLLD(-8.6640790105e-002), + QTMFLLD(-7.6016783714e-001), QTMFLLD(5.2128262818e-002), + QTMFLLD(-4.5229538227e-004), QTMFLLD(-6.2791546807e-003), + QTMFLLD(-9.2357128859e-002), QTMFLLD(-7.8201586008e-001), + QTMFLLD(4.2139917612e-002), QTMFLLD(-4.8211280955e-004), + QTMFLLD(-6.3661932945e-003), QTMFLLD(-9.8047181964e-002), + QTMFLLD(-8.0270123482e-001), QTMFLLD(3.2972395420e-002), + QTMFLLD(-5.2196672186e-004), QTMFLLD(-6.4471233636e-003), + QTMFLLD(-1.0367526114e-001), QTMFLLD(-8.2215231657e-001), + QTMFLLD(2.4589803070e-002), QTMFLLD(-5.7247944642e-004), + QTMFLLD(-6.5232971683e-003), QTMFLLD(-1.0920339823e-001), + QTMFLLD(-8.4030228853e-001), QTMFLLD(1.6952158883e-002), + QTMFLLD(-6.3343788497e-004), QTMFLLD(-6.5963375382e-003), + QTMFLLD(-1.1459194124e-001), QTMFLLD(-8.5709118843e-001), + QTMFLLD(1.0006074794e-002), QTMFLLD(-7.0449430496e-004), + QTMFLLD(-6.6681848839e-003), QTMFLLD(-1.1979964375e-001), + QTMFLLD(-8.7246519327e-001), QTMFLLD(3.6968050990e-003), + QTMFLLD(-7.9609593377e-004), QTMFLLD(-6.7403013818e-003), + QTMFLLD(-1.2478165329e-001), QTMFLLD(-8.8632321358e-001), + QTMFLLD(-1.6344460892e-003), QTMFLLD(-9.0200459817e-004), + QTMFLLD(-6.8151149899e-003), QTMFLLD(-1.2949258089e-001), + QTMFLLD(-8.9860773087e-001), QTMFLLD(-5.9283543378e-003), + QTMFLLD(-1.0116943158e-003), QTMFLLD(-6.8955891766e-003), + QTMFLLD(-1.3388808072e-001), QTMFLLD(-9.0933418274e-001), + QTMFLLD(-9.6466485411e-003), QTMFLLD(-1.1244935449e-003), + QTMFLLD(-6.9835213944e-003), QTMFLLD(-1.3791990280e-001), + QTMFLLD(-9.1846722364e-001), QTMFLLD(-1.2838950381e-002), + QTMFLLD(-1.2393904617e-003), QTMFLLD(-7.0809246972e-003), + QTMFLLD(-1.4153905213e-001), QTMFLLD(-9.2597639561e-001), + QTMFLLD(-1.5539921820e-002), QTMFLLD(-1.3542033266e-003), + QTMFLLD(-7.1895248257e-003), QTMFLLD(-1.4469626546e-001), + QTMFLLD(-9.3183851242e-001), QTMFLLD(-1.7783239484e-002), + QTMFLLD(-1.4669501688e-003), QTMFLLD(-7.3110014200e-003), + QTMFLLD(-1.4734169841e-001), QTMFLLD(-9.3603670597e-001), + QTMFLLD(-1.9597738981e-002), QTMFLLD(-1.5753224725e-003), + QTMFLLD(-7.4466220103e-003), QTMFLLD(-1.4942565560e-001), + QTMFLLD(-9.3856132030e-001), QTMFLLD(-2.1011535078e-002), + QTMFLLD(-1.6771152150e-003), QTMFLLD(-7.5972955674e-003), + QTMFLLD(-1.5089863539e-001), QTMFLLD(-9.3940949440e-001), + QTMFLLD(-2.2049814463e-002), QTMFLLD(-1.7698677257e-003), + QTMFLLD(-7.7634919435e-003), QTMFLLD(-1.5171185136e-001), + QTMFLLD(-9.3858534098e-001), QTMFLLD(-2.2738276049e-002), + QTMFLLD(-1.8512960523e-003), QTMFLLD(-7.9450644553e-003), + QTMFLLD(-1.5181747079e-001), QTMFLLD(-9.3610012531e-001), + QTMFLLD(-2.3101080209e-002), QTMFLLD(-1.9192657201e-003), + QTMFLLD(-8.1413704902e-003), QTMFLLD(-1.5116891265e-001), + QTMFLLD(-9.3197190762e-001), QTMFLLD(-2.3163486272e-002), + QTMFLLD(-1.9716904499e-003), QTMFLLD(-8.3509404212e-003), + QTMFLLD(-1.4972095191e-001), QTMFLLD(-9.2622530460e-001), + QTMFLLD(-2.2950030863e-002), QTMFLLD(-2.0066620782e-003), + QTMFLLD(-8.5715763271e-003), QTMFLLD(-1.4743055403e-001), + QTMFLLD(-9.1889131069e-001), QTMFLLD(-2.2486699745e-002), + QTMFLLD(-2.0227057394e-003), QTMFLLD(-8.8005559519e-003), + QTMFLLD(-1.4425669611e-001), QTMFLLD(-9.1000711918e-001), + QTMFLLD(-2.1799135953e-002), QTMFLLD(-2.0185527392e-003), + QTMFLLD(-9.0341167524e-003), QTMFLLD(-1.4016106725e-001), + QTMFLLD(-8.9961612225e-001), QTMFLLD(-2.0914383233e-002), + QTMFLLD(-1.9932338037e-003), QTMFLLD(-9.2674419284e-003), + QTMFLLD(-1.3510815799e-001), QTMFLLD(-8.8776648045e-001), + QTMFLLD(-1.9859094173e-002), QTMFLLD(-1.9461065531e-003), + QTMFLLD(-9.4948727638e-003), QTMFLLD(-1.2906542420e-001), + QTMFLLD(-8.7451159954e-001), QTMFLLD(-1.8660902977e-002), + QTMFLLD(-1.8770052120e-003), QTMFLLD(-9.7100129351e-003), + QTMFLLD(-1.2200380862e-001), QTMFLLD(-8.5991013050e-001), + QTMFLLD(-1.7346922308e-002), QTMFLLD(-1.7859865911e-003), + QTMFLLD(-9.9056493491e-003), QTMFLLD(-1.1389782280e-001), + QTMFLLD(-8.4402561188e-001), QTMFLLD(-1.5944939107e-002), + QTMFLLD(-1.6734169330e-003), QTMFLLD(-1.0073989630e-002), + QTMFLLD(-1.0472598672e-001), QTMFLLD(-8.2692527771e-001), + QTMFLLD(-1.4481747523e-002), QTMFLLD(-1.5399802942e-003), + QTMFLLD(-1.0205906816e-002), QTMFLLD(-9.4470888376e-002), + QTMFLLD(-8.0868041515e-001), QTMFLLD(-1.2984249741e-002), + QTMFLLD(-1.3865872752e-003), QTMFLLD(-1.0291703977e-002), + QTMFLLD(-8.3119556308e-002), QTMFLLD(-7.8936588764e-001), + QTMFLLD(-1.1477986351e-002), QTMFLLD(-1.2144348584e-003), + QTMFLLD(-1.0320962407e-002), QTMFLLD(-7.0663399994e-002), + QTMFLLD(-7.6905936003e-001), QTMFLLD(-9.9884867668e-003), + QTMFLLD(-1.0248266626e-003), QTMFLLD(-1.0282764211e-002), + QTMFLLD(-5.7098604739e-002), QTMFLLD(-7.4784147739e-001), + QTMFLLD(-8.5393209010e-003), QTMFLLD(-8.1919803051e-004), + QTMFLLD(-1.0165717453e-002), QTMFLLD(-4.2426198721e-002), + QTMFLLD(-7.2579479218e-001), QTMFLLD(-7.1533406153e-003), + QTMFLLD(-5.9914286248e-004), QTMFLLD(-9.9579729140e-003), + QTMFLLD(-2.6652012020e-002), QTMFLLD(-7.0300412178e-001), + QTMFLLD(-5.8508114889e-003), QTMFLLD(-3.6626873771e-004), + QTMFLLD(-9.6475090832e-003), QTMFLLD(-9.7871217877e-003), + QTMFLLD(-6.7955517769e-001), QTMFLLD(-4.6512838453e-003), + QTMFLLD(-1.2227181287e-004), QTMFLLD(-9.2221321538e-003), + QTMFLLD(8.1523396075e-003), QTMFLLD(-6.5553492308e-001), + QTMFLLD(-3.5699680448e-003), QTMFLLD(1.3090072025e-004), + QTMFLLD(-8.6695179343e-003), QTMFLLD(2.7145106345e-002), + QTMFLLD(-6.3103044033e-001), QTMFLLD(-2.6181070134e-003), + QTMFLLD(3.9128778735e-004), QTMFLLD(-7.9773496836e-003), + QTMFLLD(4.7164849937e-002), QTMFLLD(-6.0613000393e-001), + QTMFLLD(-1.7908872105e-003), QTMFLLD(6.5761915175e-004), + QTMFLLD(-7.1337916888e-003), QTMFLLD(6.8181537092e-002), + QTMFLLD(-5.8092808723e-001), QTMFLLD(-1.0135001503e-003)}; + +/*! + \name QMF + \brief QMF-Table + 64 channels, N = 640, + + The coeffs are rearranged compared with the reference in the following + way: + + qmf_64[0] = qmf_64_reference[0]; + qmf_64[1] = qmf_64_reference[128]; + qmf_64[2] = qmf_64_reference[256]; + qmf_64[3] = qmf_64_reference[384]; + qmf_64[4] = qmf_64_reference[512]; + + qmf_64[5] = qmf_64_reference[1]; + qmf_64[6] = qmf_64_reference[129]; + qmf_64[7] = qmf_64_reference[257]; + qmf_64[8] = qmf_64_reference[385]; + qmf_64[9] = qmf_64_reference[513]; + . + . + . + qmf_64[635] = qmf_64_reference[127] + qmf_64[636] = qmf_64_reference[255]; + qmf_64[637] = qmf_64_reference[383]; + qmf_64[638] = qmf_64_reference[511]; + qmf_64[639] = qmf_64_reference[639]; + + The filter output is required to be scaled by 1 bit. + + \showinitializer +*/ +//@{ +LNK_SECTION_CONSTDATA_L1 +RAM_ALIGN +const FIXP_PFT qmf_mpsldfb_640[QMF640_MPSLDFB_PFT_TABLE_SIZE] = { + QTMFLLD(9.3863010989e-005), QTMFLLD(-8.7536586216e-004), + QTMFLLD(6.4016343094e-003), QTMFLLD(-8.4552817047e-002), + QTMFLLD(5.6194400787e-001), QTMFLLD(1.2169149704e-004), + QTMFLLD(-1.0187102016e-003), QTMFLLD(5.8556534350e-003), + QTMFLLD(-9.5771118999e-002), QTMFLLD(5.4914402962e-001), + QTMFLLD(1.2793767382e-004), QTMFLLD(-1.1605311884e-003), + QTMFLLD(5.2649765275e-003), QTMFLLD(-1.0721673071e-001), + QTMFLLD(5.3632181883e-001), QTMFLLD(1.2668863928e-004), + QTMFLLD(-1.3017356396e-003), QTMFLLD(4.6286652796e-003), + QTMFLLD(-1.1888379604e-001), QTMFLLD(5.2348655462e-001), + QTMFLLD(1.2296593923e-004), QTMFLLD(-1.4426353155e-003), + QTMFLLD(3.9453012869e-003), QTMFLLD(-1.3076621294e-001), + QTMFLLD(5.1064836979e-001), QTMFLLD(1.1558231199e-004), + QTMFLLD(-1.5830053017e-003), QTMFLLD(3.2136053778e-003), + QTMFLLD(-1.4285783470e-001), QTMFLLD(4.9781781435e-001), + QTMFLLD(1.0582985124e-004), QTMFLLD(-1.7228506040e-003), + QTMFLLD(2.4323666003e-003), QTMFLLD(-1.5515175462e-001), + QTMFLLD(4.8500382900e-001), QTMFLLD(9.4297764008e-005), + QTMFLLD(-1.8621610943e-003), QTMFLLD(1.6004402423e-003), + QTMFLLD(-1.6764105856e-001), QTMFLLD(4.7221666574e-001), + QTMFLLD(8.0514568253e-005), QTMFLLD(-2.0008818246e-003), + QTMFLLD(7.1672687773e-004), QTMFLLD(-1.8031860888e-001), + QTMFLLD(4.5946595073e-001), QTMFLLD(6.5137835918e-005), + QTMFLLD(-2.1385864820e-003), QTMFLLD(-2.1994746930e-004), + QTMFLLD(-1.9317652285e-001), QTMFLLD(4.4676083326e-001), + QTMFLLD(4.8101064749e-005), QTMFLLD(-2.2751907818e-003), + QTMFLLD(-1.2104592752e-003), QTMFLLD(-2.0620720088e-001), + QTMFLLD(4.3411090970e-001), QTMFLLD(2.9514967537e-005), + QTMFLLD(-2.4106178898e-003), QTMFLLD(-2.2558500059e-003), + QTMFLLD(-2.1940255165e-001), QTMFLLD(4.2152509093e-001), + QTMFLLD(9.8814107332e-006), QTMFLLD(-2.5448307861e-003), + QTMFLLD(-3.3569468651e-003), QTMFLLD(-2.3275400698e-001), + QTMFLLD(4.0901294351e-001), QTMFLLD(-1.0968602510e-005), + QTMFLLD(-2.6777030434e-003), QTMFLLD(-4.5145032927e-003), + QTMFLLD(-2.4625316262e-001), QTMFLLD(3.9658311009e-001), + QTMFLLD(-3.2559255487e-005), QTMFLLD(-2.8091520071e-003), + QTMFLLD(-5.7292259298e-003), QTMFLLD(-2.5989097357e-001), + QTMFLLD(3.8424444199e-001), QTMFLLD(-5.4669842939e-005), + QTMFLLD(-2.9391390271e-003), QTMFLLD(-7.0017897524e-003), + QTMFLLD(-2.7365845442e-001), QTMFLLD(3.7200567126e-001), + QTMFLLD(-7.7506563684e-005), QTMFLLD(-3.0675258022e-003), + QTMFLLD(-8.3327051252e-003), QTMFLLD(-2.8754624724e-001), + QTMFLLD(3.5987523198e-001), QTMFLLD(-1.0057374311e-004), + QTMFLLD(-3.1942503992e-003), QTMFLLD(-9.7224051133e-003), + QTMFLLD(-3.0154475570e-001), QTMFLLD(3.4786140919e-001), + QTMFLLD(-1.2368557509e-004), QTMFLLD(-3.3192564733e-003), + QTMFLLD(-1.1171258055e-002), QTMFLLD(-3.1564420462e-001), + QTMFLLD(3.3597227931e-001), QTMFLLD(-1.4669535449e-004), + QTMFLLD(-3.4424900077e-003), QTMFLLD(-1.2679555453e-002), + QTMFLLD(-3.2983466983e-001), QTMFLLD(3.2421571016e-001), + QTMFLLD(-1.6928518016e-004), QTMFLLD(-3.5639149137e-003), + QTMFLLD(-1.4247507788e-002), QTMFLLD(-3.4410607815e-001), + QTMFLLD(3.1259948015e-001), QTMFLLD(-1.9162640092e-004), + QTMFLLD(-3.6834510975e-003), QTMFLLD(-1.5875114128e-002), + QTMFLLD(-3.5844799876e-001), QTMFLLD(3.0113074183e-001), + QTMFLLD(-2.1345751884e-004), QTMFLLD(-3.8009947166e-003), + QTMFLLD(-1.7562393099e-002), QTMFLLD(-3.7284970284e-001), + QTMFLLD(2.8981682658e-001), QTMFLLD(-2.3447850253e-004), + QTMFLLD(-3.9165974595e-003), QTMFLLD(-1.9309276715e-002), + QTMFLLD(-3.8730087876e-001), QTMFLLD(2.7866455913e-001), + QTMFLLD(-2.5462667691e-004), QTMFLLD(-4.0301652625e-003), + QTMFLLD(-2.1115457639e-002), QTMFLLD(-4.0179058909e-001), + QTMFLLD(2.6768052578e-001), QTMFLLD(-2.7371285250e-004), + QTMFLLD(-4.1416347958e-003), QTMFLLD(-2.2980585694e-002), + QTMFLLD(-4.1630774736e-001), QTMFLLD(2.5687095523e-001), + QTMFLLD(-2.9165804153e-004), QTMFLLD(-4.2509674095e-003), + QTMFLLD(-2.4904217571e-002), QTMFLLD(-4.3084129691e-001), + QTMFLLD(2.4624188244e-001), QTMFLLD(-3.0837973463e-004), + QTMFLLD(-4.3581505306e-003), QTMFLLD(-2.6885753497e-002), + QTMFLLD(-4.4538003206e-001), QTMFLLD(2.3579898477e-001), + QTMFLLD(-3.2378203468e-004), QTMFLLD(-4.4631510973e-003), + QTMFLLD(-2.8924530372e-002), QTMFLLD(-4.5991250873e-001), + QTMFLLD(2.2554755211e-001), QTMFLLD(-3.3788106521e-004), + QTMFLLD(-4.5659458265e-003), QTMFLLD(-3.1019711867e-002), + QTMFLLD(-4.7442746162e-001), QTMFLLD(2.1549259126e-001), + QTMFLLD(-3.5053401371e-004), QTMFLLD(-4.6664695255e-003), + QTMFLLD(-3.3170353621e-002), QTMFLLD(-4.8891320825e-001), + QTMFLLD(2.0563863218e-001), QTMFLLD(-3.6175493733e-004), + QTMFLLD(-4.7647207975e-003), QTMFLLD(-3.5375438631e-002), + QTMFLLD(-5.0335830450e-001), QTMFLLD(1.9599021971e-001), + QTMFLLD(-3.7159718340e-004), QTMFLLD(-4.8605888151e-003), + QTMFLLD(-3.7633713335e-002), QTMFLLD(-5.1775097847e-001), + QTMFLLD(1.8655113876e-001), QTMFLLD(-3.7999937194e-004), + QTMFLLD(-4.9540083855e-003), QTMFLLD(-3.9943847805e-002), + QTMFLLD(-5.3207957745e-001), QTMFLLD(1.7732504010e-001), + QTMFLLD(-3.8705617771e-004), QTMFLLD(-5.0450465642e-003), + QTMFLLD(-4.2304381728e-002), QTMFLLD(-5.4633224010e-001), + QTMFLLD(1.6831515729e-001), QTMFLLD(-3.9281861973e-004), + QTMFLLD(-5.1336232573e-003), QTMFLLD(-4.4713638723e-002), + QTMFLLD(-5.6049734354e-001), QTMFLLD(1.5952435136e-001), + QTMFLLD(-3.9737694897e-004), QTMFLLD(-5.2197398618e-003), + QTMFLLD(-4.7170232981e-002), QTMFLLD(-5.7456302643e-001), + QTMFLLD(1.5095503628e-001), QTMFLLD(-4.0088107926e-004), + QTMFLLD(-5.3033372387e-003), QTMFLLD(-4.9672137946e-002), + QTMFLLD(-5.8851766586e-001), QTMFLLD(1.4260910451e-001), + QTMFLLD(-4.0338383405e-004), QTMFLLD(-5.3843962960e-003), + QTMFLLD(-5.2217379212e-002), QTMFLLD(-6.0234934092e-001), + QTMFLLD(1.3448855281e-001), QTMFLLD(-4.0505555808e-004), + QTMFLLD(-5.4629631341e-003), QTMFLLD(-5.4803829640e-002), + QTMFLLD(-6.1604642868e-001), QTMFLLD(1.2659475207e-001), + QTMFLLD(-4.0614881436e-004), QTMFLLD(-5.5389581248e-003), + QTMFLLD(-5.7429198176e-002), QTMFLLD(-6.2959736586e-001), + QTMFLLD(1.1892842501e-001), QTMFLLD(-4.0676075150e-004), + QTMFLLD(-5.6123761460e-003), QTMFLLD(-6.0090914369e-002), + QTMFLLD(-6.4299046993e-001), QTMFLLD(1.1149007827e-001), + QTMFLLD(-4.0709332097e-004), QTMFLLD(-5.6832311675e-003), + QTMFLLD(-6.2786586583e-002), QTMFLLD(-6.5621429682e-001), + QTMFLLD(1.0428040475e-001), QTMFLLD(-4.0732545312e-004), + QTMFLLD(-5.7515366934e-003), QTMFLLD(-6.5513409674e-002), + QTMFLLD(-6.6925734282e-001), QTMFLLD(9.7298897803e-002), + QTMFLLD(-4.0770808118e-004), QTMFLLD(-5.8172862045e-003), + QTMFLLD(-6.8268470466e-002), QTMFLLD(-6.8210834265e-001), + QTMFLLD(9.0545162559e-002), QTMFLLD(-4.0854664985e-004), + QTMFLLD(-5.8804959990e-003), QTMFLLD(-7.1048669517e-002), + QTMFLLD(-6.9475615025e-001), QTMFLLD(8.4017947316e-002), + QTMFLLD(-4.1002241778e-004), QTMFLLD(-5.9412117116e-003), + QTMFLLD(-7.3850922287e-002), QTMFLLD(-7.0718955994e-001), + QTMFLLD(7.7716566622e-002), QTMFLLD(-4.1239586426e-004), + QTMFLLD(-5.9994738549e-003), QTMFLLD(-7.6671779156e-002), + QTMFLLD(-7.1939796209e-001), QTMFLLD(7.1639508009e-002), + QTMFLLD(-4.1594370850e-004), QTMFLLD(-6.0553550720e-003), + QTMFLLD(-7.9507902265e-002), QTMFLLD(-7.3137050867e-001), + QTMFLLD(6.5784148872e-002), QTMFLLD(-4.2083335575e-004), + QTMFLLD(-6.1089023948e-003), QTMFLLD(-8.2355625927e-002), + QTMFLLD(-7.4309676886e-001), QTMFLLD(6.0148354620e-002), + QTMFLLD(-4.2732476140e-004), QTMFLLD(-6.1602159403e-003), + QTMFLLD(-8.5211075842e-002), QTMFLLD(-7.5456637144e-001), + QTMFLLD(5.4730266333e-002), QTMFLLD(-4.3563771760e-004), + QTMFLLD(-6.2093720771e-003), QTMFLLD(-8.8070511818e-002), + QTMFLLD(-7.6576924324e-001), QTMFLLD(4.9526259303e-002), + QTMFLLD(-4.4600359979e-004), QTMFLLD(-6.2565426342e-003), + QTMFLLD(-9.0929701924e-002), QTMFLLD(-7.7669566870e-001), + QTMFLLD(4.4533081353e-002), QTMFLLD(-4.5858716476e-004), + QTMFLLD(-6.3017667271e-003), QTMFLLD(-9.3784548342e-002), + QTMFLLD(-7.8733605146e-001), QTMFLLD(3.9746750146e-002), + QTMFLLD(-4.7345875646e-004), QTMFLLD(-6.3452622853e-003), + QTMFLLD(-9.6630692482e-002), QTMFLLD(-7.9768097401e-001), + QTMFLLD(3.5163912922e-002), QTMFLLD(-4.9076689174e-004), + QTMFLLD(-6.3871243037e-003), QTMFLLD(-9.9463671446e-002), + QTMFLLD(-8.0772149563e-001), QTMFLLD(3.0780877918e-002), + QTMFLLD(-5.1067111781e-004), QTMFLLD(-6.4275567420e-003), + QTMFLLD(-1.0227891803e-001), QTMFLLD(-8.1744915247e-001), + QTMFLLD(2.6590615511e-002), QTMFLLD(-5.3326232592e-004), + QTMFLLD(-6.4666904509e-003), QTMFLLD(-1.0507161170e-001), + QTMFLLD(-8.2685548067e-001), QTMFLLD(2.2588992491e-002), + QTMFLLD(-5.5855646497e-004), QTMFLLD(-6.5047293901e-003), + QTMFLLD(-1.0783691704e-001), QTMFLLD(-8.3593225479e-001), + QTMFLLD(1.8772648647e-002), QTMFLLD(-5.8640236966e-004), + QTMFLLD(-6.5418654121e-003), QTMFLLD(-1.1056987941e-001), + QTMFLLD(-8.4467232227e-001), QTMFLLD(1.5131668188e-002), + QTMFLLD(-6.1692652525e-004), QTMFLLD(-6.5783206373e-003), + QTMFLLD(-1.1326543987e-001), QTMFLLD(-8.5306841135e-001), + QTMFLLD(1.1661184952e-002), QTMFLLD(-6.4994930290e-004), + QTMFLLD(-6.6143544391e-003), QTMFLLD(-1.1591844261e-001), + QTMFLLD(-8.6111402512e-001), QTMFLLD(8.3509646356e-003), + QTMFLLD(-6.8494328298e-004), QTMFLLD(-6.6502285190e-003), + QTMFLLD(-1.1852371693e-001), QTMFLLD(-8.6880439520e-001), + QTMFLLD(5.1832948811e-003), QTMFLLD(-7.2404538514e-004), + QTMFLLD(-6.6861407831e-003), QTMFLLD(-1.2107557058e-001), + QTMFLLD(-8.7612599134e-001), QTMFLLD(2.2103153169e-003), + QTMFLLD(-7.7061145566e-004), QTMFLLD(-6.7221261561e-003), + QTMFLLD(-1.2356808037e-001), QTMFLLD(-8.8305824995e-001), + QTMFLLD(-4.6855807886e-004), QTMFLLD(-8.2158041187e-004), + QTMFLLD(-6.7584766075e-003), QTMFLLD(-1.2599521875e-001), + QTMFLLD(-8.8958823681e-001), QTMFLLD(-2.8003340121e-003), + QTMFLLD(-8.7498105131e-004), QTMFLLD(-6.7957863212e-003), + QTMFLLD(-1.2835204601e-001), QTMFLLD(-8.9572954178e-001), + QTMFLLD(-4.9293786287e-003), QTMFLLD(-9.2902814504e-004), + QTMFLLD(-6.8344431929e-003), QTMFLLD(-1.3063311577e-001), + QTMFLLD(-9.0148586035e-001), QTMFLLD(-6.9273295812e-003), + QTMFLLD(-9.8383461591e-004), QTMFLLD(-6.8746237084e-003), + QTMFLLD(-1.3283239305e-001), QTMFLLD(-9.0685033798e-001), + QTMFLLD(-8.7857460603e-003), QTMFLLD(-1.0395538993e-003), + QTMFLLD(-6.9165546447e-003), QTMFLLD(-1.3494376838e-001), + QTMFLLD(-9.1181802750e-001), QTMFLLD(-1.0507551953e-002), + QTMFLLD(-1.0959620122e-003), QTMFLLD(-6.9604511373e-003), + QTMFLLD(-1.3696120679e-001), QTMFLLD(-9.1638565063e-001), + QTMFLLD(-1.2103702873e-002), QTMFLLD(-1.1530250777e-003), + QTMFLLD(-7.0065916516e-003), QTMFLLD(-1.3887859881e-001), + QTMFLLD(-9.2054879665e-001), QTMFLLD(-1.3574197888e-002), + QTMFLLD(-1.2105966453e-003), QTMFLLD(-7.0552495308e-003), + QTMFLLD(-1.4068968594e-001), QTMFLLD(-9.2430406809e-001), + QTMFLLD(-1.4923358336e-002), QTMFLLD(-1.2681842782e-003), + QTMFLLD(-7.1066003293e-003), QTMFLLD(-1.4238841832e-001), + QTMFLLD(-9.2764878273e-001), QTMFLLD(-1.6156485304e-002), + QTMFLLD(-1.3256429229e-003), QTMFLLD(-7.1608433500e-003), + QTMFLLD(-1.4396859705e-001), QTMFLLD(-9.3058031797e-001), + QTMFLLD(-1.7277117819e-002), QTMFLLD(-1.3827638468e-003), + QTMFLLD(-7.2182063013e-003), QTMFLLD(-1.4542391896e-001), + QTMFLLD(-9.3309664726e-001), QTMFLLD(-1.8289361149e-002), + QTMFLLD(-1.4391905861e-003), QTMFLLD(-7.2789187543e-003), + QTMFLLD(-1.4674818516e-001), QTMFLLD(-9.3519610167e-001), + QTMFLLD(-1.9195662811e-002), QTMFLLD(-1.4947097516e-003), + QTMFLLD(-7.3430840857e-003), QTMFLLD(-1.4793521166e-001), + QTMFLLD(-9.3687731028e-001), QTMFLLD(-1.9999813288e-002), + QTMFLLD(-1.5489540529e-003), QTMFLLD(-7.4108825065e-003), + QTMFLLD(-1.4897871017e-001), QTMFLLD(-9.3813979626e-001), + QTMFLLD(-2.0706148818e-002), QTMFLLD(-1.6016908921e-003), + QTMFLLD(-7.4823615141e-003), QTMFLLD(-1.4987260103e-001), + QTMFLLD(-9.3898290396e-001), QTMFLLD(-2.1316919476e-002), + QTMFLLD(-1.6526894178e-003), QTMFLLD(-7.5576924719e-003), + QTMFLLD(-1.5061059594e-001), QTMFLLD(-9.3940681219e-001), + QTMFLLD(-2.1835187450e-002), QTMFLLD(-1.7015410122e-003), + QTMFLLD(-7.6368991286e-003), QTMFLLD(-1.5118667483e-001), + QTMFLLD(-9.3941211700e-001), QTMFLLD(-2.2264443338e-002), + QTMFLLD(-1.7479787348e-003), QTMFLLD(-7.7200052328e-003), + QTMFLLD(-1.5159477293e-001), QTMFLLD(-9.3899971247e-001), + QTMFLLD(-2.2607907653e-002), QTMFLLD(-1.7917567166e-003), + QTMFLLD(-7.8069791198e-003), QTMFLLD(-1.5182891488e-001), + QTMFLLD(-9.3817096949e-001), QTMFLLD(-2.2868644446e-002), + QTMFLLD(-1.8325200072e-003), QTMFLLD(-7.8977877274e-003), + QTMFLLD(-1.5188319981e-001), QTMFLLD(-9.3692785501e-001), + QTMFLLD(-2.3049183190e-002), QTMFLLD(-1.8700722139e-003), + QTMFLLD(-7.9923402518e-003), QTMFLLD(-1.5175175667e-001), + QTMFLLD(-9.3527245522e-001), QTMFLLD(-2.3152977228e-002), + QTMFLLD(-1.9041235792e-003), QTMFLLD(-8.0905584618e-003), + QTMFLLD(-1.5142890811e-001), QTMFLLD(-9.3320751190e-001), + QTMFLLD(-2.3183524609e-002), QTMFLLD(-1.9344078610e-003), + QTMFLLD(-8.1921815872e-003), QTMFLLD(-1.5090890229e-001), + QTMFLLD(-9.3073624372e-001), QTMFLLD(-2.3143447936e-002), + QTMFLLD(-1.9606938586e-003), QTMFLLD(-8.2970457152e-003), + QTMFLLD(-1.5018628538e-001), QTMFLLD(-9.2786192894e-001), + QTMFLLD(-2.3035895079e-002), QTMFLLD(-1.9826870412e-003), + QTMFLLD(-8.4048351273e-003), QTMFLLD(-1.4925561845e-001), + QTMFLLD(-9.2458862066e-001), QTMFLLD(-2.2864164785e-002), + QTMFLLD(-2.0002126694e-003), QTMFLLD(-8.5152359679e-003), + QTMFLLD(-1.4811170101e-001), QTMFLLD(-9.2092043161e-001), + QTMFLLD(-2.2631708533e-002), QTMFLLD(-2.0131117199e-003), + QTMFLLD(-8.6279176176e-003), QTMFLLD(-1.4674940705e-001), + QTMFLLD(-9.1686213017e-001), QTMFLLD(-2.2341690958e-002), + QTMFLLD(-2.0211567171e-003), QTMFLLD(-8.7425475940e-003), + QTMFLLD(-1.4516362548e-001), QTMFLLD(-9.1241872311e-001), + QTMFLLD(-2.1996961907e-002), QTMFLLD(-2.0242547616e-003), + QTMFLLD(-8.8585643098e-003), QTMFLLD(-1.4334976673e-001), + QTMFLLD(-9.0759557486e-001), QTMFLLD(-2.1601308137e-002), + QTMFLLD(-2.0221893210e-003), QTMFLLD(-8.9755039662e-003), + QTMFLLD(-1.4130303264e-001), QTMFLLD(-9.0239852667e-001), + QTMFLLD(-2.1158147603e-002), QTMFLLD(-2.0149163902e-003), + QTMFLLD(-9.0927295387e-003), QTMFLLD(-1.3901908696e-001), + QTMFLLD(-8.9683371782e-001), QTMFLLD(-2.0670616999e-002), + QTMFLLD(-2.0022888202e-003), QTMFLLD(-9.2095714062e-003), + QTMFLLD(-1.3649365306e-001), QTMFLLD(-8.9090716839e-001), + QTMFLLD(-2.0142132416e-002), QTMFLLD(-1.9841785543e-003), + QTMFLLD(-9.3253115192e-003), QTMFLLD(-1.3372266293e-001), + QTMFLLD(-8.8462579250e-001), QTMFLLD(-1.9576057792e-002), + QTMFLLD(-1.9606270362e-003), QTMFLLD(-9.4392402098e-003), + QTMFLLD(-1.3070219755e-001), QTMFLLD(-8.7799650431e-001), + QTMFLLD(-1.8976125866e-002), QTMFLLD(-1.9315859536e-003), + QTMFLLD(-9.5505062491e-003), QTMFLLD(-1.2742865086e-001), + QTMFLLD(-8.7102663517e-001), QTMFLLD(-1.8345680088e-002), + QTMFLLD(-1.8970289966e-003), QTMFLLD(-9.6583357081e-003), + QTMFLLD(-1.2389861047e-001), QTMFLLD(-8.6372399330e-001), + QTMFLLD(-1.7687706277e-002), QTMFLLD(-1.8569815438e-003), + QTMFLLD(-9.7616901621e-003), QTMFLLD(-1.2010899931e-001), + QTMFLLD(-8.5609632730e-001), QTMFLLD(-1.7006140202e-002), + QTMFLLD(-1.8114587292e-003), QTMFLLD(-9.8597351462e-003), + QTMFLLD(-1.1605655402e-001), QTMFLLD(-8.4815198183e-001), + QTMFLLD(-1.6304368153e-002), QTMFLLD(-1.7605143366e-003), + QTMFLLD(-9.9515644833e-003), QTMFLLD(-1.1173909158e-001), + QTMFLLD(-8.3989918232e-001), QTMFLLD(-1.5585509129e-002), + QTMFLLD(-1.7042002873e-003), QTMFLLD(-1.0036026128e-002), + QTMFLLD(-1.0715358704e-001), QTMFLLD(-8.3134686947e-001), + QTMFLLD(-1.4853162691e-002), QTMFLLD(-1.6426335787e-003), + QTMFLLD(-1.0111952201e-002), QTMFLLD(-1.0229838639e-001), + QTMFLLD(-8.2250368595e-001), QTMFLLD(-1.4110331424e-002), + QTMFLLD(-1.5758809168e-003), QTMFLLD(-1.0178210214e-002), + QTMFLLD(-9.7171187401e-002), QTMFLLD(-8.1337898970e-001), + QTMFLLD(-1.3360806741e-002), QTMFLLD(-1.5040797880e-003), + QTMFLLD(-1.0233603418e-002), QTMFLLD(-9.1770596802e-002), + QTMFLLD(-8.0398184061e-001), QTMFLLD(-1.2607692741e-002), + QTMFLLD(-1.4273397392e-003), QTMFLLD(-1.0276827961e-002), + QTMFLLD(-8.6095176637e-002), QTMFLLD(-7.9432225227e-001), + QTMFLLD(-1.1853585951e-002), QTMFLLD(-1.3458349276e-003), + QTMFLLD(-1.0306579992e-002), QTMFLLD(-8.0143928528e-002), + QTMFLLD(-7.8440952301e-001), QTMFLLD(-1.1102385819e-002), + QTMFLLD(-1.2597256573e-003), QTMFLLD(-1.0321546346e-002), + QTMFLLD(-7.3915921152e-002), QTMFLLD(-7.7425378561e-001), + QTMFLLD(-1.0356968269e-002), QTMFLLD(-1.1691439431e-003), + QTMFLLD(-1.0320378467e-002), QTMFLLD(-6.7410878837e-002), + QTMFLLD(-7.6386493444e-001), QTMFLLD(-9.6200043336e-003), + QTMFLLD(-1.0743001476e-003), QTMFLLD(-1.0301630013e-002), + QTMFLLD(-6.0628447682e-002), QTMFLLD(-7.5325345993e-001), + QTMFLLD(-8.8949296623e-003), QTMFLLD(-9.7535311943e-004), + QTMFLLD(-1.0263898410e-002), QTMFLLD(-5.3568758070e-002), + QTMFLLD(-7.4242949486e-001), QTMFLLD(-8.1837112084e-003), + QTMFLLD(-8.7248592172e-004), QTMFLLD(-1.0205759667e-002), + QTMFLLD(-4.6232450753e-002), QTMFLLD(-7.3140352964e-001), + QTMFLLD(-7.4901022017e-003), QTMFLLD(-7.6591013931e-004), + QTMFLLD(-1.0125675239e-002), QTMFLLD(-3.8619950414e-002), + QTMFLLD(-7.2018599510e-001), QTMFLLD(-6.8165790290e-003), + QTMFLLD(-6.5580842784e-004), QTMFLLD(-1.0022218339e-002), + QTMFLLD(-3.0732547864e-002), QTMFLLD(-7.0878815651e-001), + QTMFLLD(-6.1642420478e-003), QTMFLLD(-5.4247735534e-004), + QTMFLLD(-9.8937284201e-003), QTMFLLD(-2.2571478039e-002), + QTMFLLD(-6.9722014666e-001), QTMFLLD(-5.5373813957e-003), + QTMFLLD(-4.2596619460e-004), QTMFLLD(-9.7389295697e-003), + QTMFLLD(-1.4138570987e-002), QTMFLLD(-6.8549299240e-001), + QTMFLLD(-4.9372608773e-003), QTMFLLD(-3.0657128082e-004), + QTMFLLD(-9.5560895279e-003), QTMFLLD(-5.4356725886e-003), + QTMFLLD(-6.7361742258e-001), QTMFLLD(-4.3653072789e-003), + QTMFLLD(-1.8451632059e-004), QTMFLLD(-9.3438196927e-003), + QTMFLLD(3.5346730147e-003), QTMFLLD(-6.6160440445e-001), + QTMFLLD(-3.8251809310e-003), QTMFLLD(-6.0027297877e-005), + QTMFLLD(-9.1004446149e-003), QTMFLLD(1.2770005502e-002), + QTMFLLD(-6.4946544170e-001), QTMFLLD(-3.3147553913e-003), + QTMFLLD(6.6618180426e-005), QTMFLLD(-8.8245263323e-003), + QTMFLLD(2.2267201915e-002), QTMFLLD(-6.3721030951e-001), + QTMFLLD(-2.8387091588e-003), QTMFLLD(1.9518326735e-004), + QTMFLLD(-8.5145104676e-003), QTMFLLD(3.2023012638e-002), + QTMFLLD(-6.2485051155e-001), QTMFLLD(-2.3975048680e-003), + QTMFLLD(3.2545044087e-004), QTMFLLD(-8.1687811762e-003), + QTMFLLD(4.2033810169e-002), QTMFLLD(-6.1239802837e-001), + QTMFLLD(-1.9807203207e-003), QTMFLLD(4.5712510473e-004), + QTMFLLD(-7.7859172598e-003), QTMFLLD(5.2295893431e-002), + QTMFLLD(-5.9986191988e-001), QTMFLLD(-1.6010539839e-003), + QTMFLLD(5.9015140869e-004), QTMFLLD(-7.3645371012e-003), + QTMFLLD(6.2805138528e-002), QTMFLLD(-5.8725595474e-001), + QTMFLLD(-1.2320743408e-003), QTMFLLD(7.2508689482e-004), + QTMFLLD(-6.9030462764e-003), QTMFLLD(7.3557935655e-002), + QTMFLLD(-5.7460016012e-001), QTMFLLD(-7.9492607620e-004)}; + +//@{ +/*! + \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)}; + +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[80] = /* 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, 0x028f5c29, 0x02828283, 0x02762762, 0x026a439f, + 0x025ed098, 0x0253c825, 0x02492492, 0x023ee090, 0x0234f72c, 0x022b63cc, + 0x02222222, 0x02192e2a, 0x02108421, 0x02082082, 0x02000000, 0x01f81f82, + 0x01f07c1f, 0x01e9131b, 0x01e1e1e2, 0x01dae607, 0x01d41d42, 0x01cd8569, + 0x01c71c72, 0x01c0e070, 0x01bacf91, 0x01b4e81b, 0x01af286c, 0x01a98ef6, + 0x01a41a42, 0x019ec8e9}; + +/* + * 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}}; + +/* CCE */ +static const rbd_id_t el_aac_cce[] = { + adtscrc_start_reg1, element_instance_tag, + coupled_elements, /* CCE specific */ + global_gain, ics_info, section_data, scale_factor_data, pulse, + tns_data_present, tns_data, gain_control_data_present, + /* gain_control_data, */ + spectral_data, gain_element_lists, /* CCE specific */ + adtscrc_end_reg1, end_of_sequence}; + +static const struct element_list node_aac_cce = {el_aac_cce, {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}}; + +/* + * 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_cpe_epc0[] = {element_instance_tag, common_window, + link_sequence}; + +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_epc0, {&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 = 20 + * epConfig = 0 + */ +static const rbd_id_t el_scal_sce_epc0[] = {ics_info, /* ESC 1 */ + tns_data_present, ltp_data_present, + /* ltp_data, */ + global_gain, section_data, + scale_factor_data, esc1_hcr, + esc2_rvlc, /* ESC 2 */ + tns_data, /* ESC 3 */ + spectral_data, /* ESC 4 */ + end_of_sequence}; + +static const struct element_list node_scal_sce_epc0 = {el_scal_sce_epc0, + {NULL, NULL}}; + +static const rbd_id_t el_scal_cpe_epc0[] = { + ics_info, /* ESC 0 */ + ms, tns_data_present, /* ESC 1 (ch 0) */ + ltp_data_present, + /* ltp_data, */ + global_gain, section_data, scale_factor_data, esc1_hcr, + esc2_rvlc, /* ESC 2 (ch 0) */ + tns_data, /* ESC 3 (ch 0) */ + spectral_data, /* ESC 4 (ch 0) */ + next_channel, tns_data_present, /* ESC 1 (ch 1) */ + ltp_data_present, global_gain, section_data, scale_factor_data, esc1_hcr, + esc2_rvlc, /* ESC 2 (ch 1) */ + tns_data, /* ESC 3 (ch 1) */ + spectral_data, /* ESC 4 (ch 1) */ + end_of_sequence}; + +static const struct element_list node_scal_cpe_epc0 = {el_scal_cpe_epc0, + {NULL, NULL}}; + +/* + * AOT = 20 + * epConfig = 1 + */ +static const rbd_id_t el_scal_sce_epc1[] = { + ics_info, tns_data_present, ltp_data_present, + /* ltp_data, */ + global_gain, section_data, scale_factor_data, esc1_hcr, tns_data, + spectral_data, end_of_sequence}; + +static const struct element_list node_scal_sce_epc1 = {el_scal_sce_epc1, + {NULL, NULL}}; + +static const rbd_id_t el_scal_cpe_epc1[] = { + ics_info, ms, tns_data_present, ltp_data_present, + /* ltp_data, */ + global_gain, section_data, scale_factor_data, esc1_hcr, next_channel, + tns_data_present, ltp_data_present, + /* ltp_data, */ + global_gain, section_data, scale_factor_data, esc1_hcr, 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_scal_cpe_epc1 = {el_scal_cpe_epc1, + {NULL, NULL}}; + +/* + * Pseudo AOT for DRM/DRM+ (similar to AOT 20) + */ +static const rbd_id_t el_drm_sce[] = { + drmcrc_start_reg, ics_info, tns_data_present, ltp_data_present, + /* ltp_data, */ + global_gain, section_data, scale_factor_data, esc1_hcr, tns_data, + drmcrc_end_reg, spectral_data, end_of_sequence}; + +static const struct element_list node_drm_sce = {el_drm_sce, {NULL, NULL}}; + +static const rbd_id_t el_drm_cpe[] = { + drmcrc_start_reg, ics_info, ms, tns_data_present, ltp_data_present, + /* ltp_data, */ + global_gain, section_data, scale_factor_data, esc1_hcr, next_channel, + tns_data_present, ltp_data_present, + /* ltp_data, */ + global_gain, section_data, scale_factor_data, esc1_hcr, next_channel, + tns_data, next_channel, tns_data, drmcrc_end_reg, next_channel, + spectral_data, next_channel, spectral_data, end_of_sequence}; + +static const struct element_list node_drm_cpe = {el_drm_cpe, {NULL, NULL}}; + +/* + * 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}}; + +/* + * AOT = 42 + * epConfig = 0 + */ + +static const rbd_id_t el_usac_coremode[] = {core_mode, next_channel, + link_sequence}; + +static const rbd_id_t el_usac_sce0_epc0[] = { + tns_data_present, + /* fd_channel_stream */ + global_gain, noise, ics_info, tw_data, scale_factor_data_usac, tns_data, + ac_spectral_data, fac_data, end_of_sequence}; + +static const rbd_id_t el_usac_lfe_epc0[] = { + /* fd_channel_stream */ + global_gain, ics_info, scale_factor_data_usac, + ac_spectral_data, fac_data, end_of_sequence}; + +static const rbd_id_t el_usac_lpd_epc0[] = {lpd_channel_stream, + end_of_sequence}; + +static const struct element_list node_usac_sce0_epc0 = {el_usac_sce0_epc0, + {NULL, NULL}}; + +static const struct element_list node_usac_sce1_epc0 = {el_usac_lpd_epc0, + {NULL, NULL}}; + +static const struct element_list node_usac_sce_epc0 = { + el_usac_coremode, {&node_usac_sce0_epc0, &node_usac_sce1_epc0}}; + +static const rbd_id_t list_usac_cpe00_epc0[] = {tns_active, common_window, + link_sequence}; + +static const rbd_id_t el_usac_common_tw[] = {common_tw, link_sequence}; + +static const rbd_id_t list_usac_cpe0000_epc0[] = { + /* core_mode0 = 0 */ + /* core_mode1 = 0 */ + /* common_window = 0 */ + /* common_tw = 0 */ + tns_data_present_usac, + global_gain, + noise, + ics_info, + tw_data, + scale_factor_data_usac, + tns_data, + ac_spectral_data, + fac_data, + next_channel, + global_gain, + noise, + ics_info, + tw_data, + scale_factor_data_usac, + tns_data, + ac_spectral_data, + fac_data, + end_of_sequence}; + +static const rbd_id_t list_usac_cpe0001_epc0[] = { + /* + core_mode0 = 0 + core_mode1 = 0 + common_window = 0 + common_tw = 1 + */ + tw_data, tns_data_present_usac, global_gain, noise, + ics_info, scale_factor_data_usac, tns_data, ac_spectral_data, + fac_data, next_channel, global_gain, noise, + ics_info, scale_factor_data_usac, tns_data, ac_spectral_data, + fac_data, end_of_sequence}; + +static const rbd_id_t list_usac_cpe001_epc0[] = { + /* core_mode0 = 0 */ + /* core_mode1 = 0 */ + /* common_window = 1 */ + ics_info, common_max_sfb, ms, common_tw, link_sequence}; + +static const rbd_id_t list_usac_cpe0010_epc0[] = { + /* core_mode0 = 0 */ + /* core_mode1 = 0 */ + /* common_window = 1 */ + /* common_tw = 0 */ + tns_data_present_usac, + global_gain, + noise, + tw_data, + scale_factor_data_usac, + tns_data, + ac_spectral_data, + fac_data, + next_channel, + global_gain, + noise, + tw_data, + scale_factor_data_usac, + tns_data, + ac_spectral_data, + fac_data, + end_of_sequence}; + +static const rbd_id_t list_usac_cpe0011_epc0[] = { + /* core_mode0 = 0 */ + /* core_mode1 = 0 */ + /* common_window = 1 */ + /* common_tw = 1 */ + tw_data, + tns_data_present_usac, + global_gain, + noise, + scale_factor_data_usac, + tns_data, + ac_spectral_data, + fac_data, + next_channel, + global_gain, + noise, + scale_factor_data_usac, + tns_data, + ac_spectral_data, + fac_data, + end_of_sequence}; + +static const rbd_id_t list_usac_cpe10_epc0[] = { + /* core_mode0 = 1 */ + /* core_mode1 = 0 */ + lpd_channel_stream, + next_channel, + tns_data_present, + global_gain, + noise, + ics_info, + tw_data, + scale_factor_data_usac, + tns_data, + ac_spectral_data, + fac_data, + end_of_sequence}; + +static const rbd_id_t list_usac_cpe01_epc0[] = { + /* core_mode0 = 0 */ + /* core_mode1 = 1 */ + tns_data_present, + global_gain, + noise, + ics_info, + tw_data, + scale_factor_data_usac, + tns_data, + ac_spectral_data, + fac_data, + next_channel, + lpd_channel_stream, + end_of_sequence}; + +static const rbd_id_t list_usac_cpe11_epc0[] = { + /* core_mode0 = 1 */ + /* core_mode1 = 1 */ + lpd_channel_stream, next_channel, lpd_channel_stream, end_of_sequence}; + +static const struct element_list node_usac_cpe0000_epc0 = { + /* core_mode0 = 0 */ + /* core_mode1 = 0 */ + /* common_window = 0 */ + /* common_tw = 0 */ + list_usac_cpe0000_epc0, + {NULL, NULL}}; + +static const struct element_list node_usac_cpe0010_epc0 = { + /* core_mode0 = 0 */ + /* core_mode1 = 0 */ + /* common_window = 1 */ + /* common_tw = 0 */ + list_usac_cpe0010_epc0, + {NULL, NULL}}; + +static const struct element_list node_usac_cpe0001_epc0 = { + /* core_mode0 = 0 */ + /* core_mode1 = 0 */ + /* common_window = 0 */ + /* common_tw = 1 */ + list_usac_cpe0001_epc0, + {NULL, NULL}}; + +static const struct element_list node_usac_cpe0011_epc0 = { + /* core_mode0 = 0 */ + /* core_mode1 = 0 */ + /* common_window = 1 */ + /* common_tw = 1 */ + list_usac_cpe0011_epc0, + {NULL, NULL}}; + +static const struct element_list node_usac_cpe000_epc0 = { + /* core_mode0 = 0 */ + /* core_mode1 = 0 */ + /* common_window = 0 */ + el_usac_common_tw, + {&node_usac_cpe0000_epc0, &node_usac_cpe0001_epc0}}; + +static const struct element_list node_usac_cpe001_epc0 = { + list_usac_cpe001_epc0, {&node_usac_cpe0010_epc0, &node_usac_cpe0011_epc0}}; + +static const struct element_list node_usac_cpe00_epc0 = { + /* core_mode0 = 0 */ + /* core_mode1 = 0 */ + list_usac_cpe00_epc0, + {&node_usac_cpe000_epc0, &node_usac_cpe001_epc0}}; + +static const struct element_list node_usac_cpe10_epc0 = { + /* core_mode0 = 1 */ + /* core_mode1 = 0 */ + list_usac_cpe10_epc0, + {NULL, NULL}}; + +static const struct element_list node_usac_cpe01_epc0 = {list_usac_cpe01_epc0, + {NULL, NULL}}; + +static const struct element_list node_usac_cpe11_epc0 = {list_usac_cpe11_epc0, + {NULL, NULL}}; + +static const struct element_list node_usac_cpe0_epc0 = { + /* core_mode0 = 0 */ + el_usac_coremode, + {&node_usac_cpe00_epc0, &node_usac_cpe01_epc0}}; + +static const struct element_list node_usac_cpe1_epc0 = { + /* core_mode0 = 1 */ + el_usac_coremode, + {&node_usac_cpe10_epc0, &node_usac_cpe11_epc0}}; + +static const struct element_list node_usac_cpe_epc0 = { + el_usac_coremode, {&node_usac_cpe0_epc0, &node_usac_cpe1_epc0}}; + +static const struct element_list node_usac_lfe_epc0 = {el_usac_lfe_epc0, + {NULL, NULL}}; + +const element_list_t *getBitstreamElementList(AUDIO_OBJECT_TYPE aot, + SCHAR epConfig, UCHAR nChannels, + UCHAR layer, UINT elFlags) { + switch (aot) { + case AOT_AAC_LC: + case AOT_SBR: + case AOT_PS: + case AOT_DABPLUS_AAC_LC: + case AOT_DABPLUS_SBR: + case AOT_DABPLUS_PS: + FDK_ASSERT(epConfig == -1); + if (elFlags & AC_EL_GA_CCE) { + return &node_aac_cce; + } else { + if (nChannels == 1) { + return &node_aac_sce; + } else { + return &node_aac_cpe; + } + } + 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; + } + case AOT_USAC: + if (elFlags & AC_EL_USAC_LFE) { + FDK_ASSERT(nChannels == 1); + return &node_usac_lfe_epc0; + } + if (nChannels == 1) { + return &node_usac_sce_epc0; + } else { + return &node_usac_cpe_epc0; + } + case AOT_ER_AAC_SCAL: + if (nChannels == 1) { + if (epConfig <= 0) + return &node_scal_sce_epc0; + else + return &node_scal_sce_epc1; + } else { + if (epConfig <= 0) + return &node_scal_cpe_epc0; + else + return &node_scal_cpe_epc1; + } + 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_DRM_AAC: + case AOT_DRM_SBR: + case AOT_DRM_MPEG_PS: + case AOT_DRM_SURROUND: + FDK_ASSERT(epConfig == 1); + if (nChannels == 1) { + return &node_drm_sce; + } else { + return &node_drm_cpe; + } + default: + break; + } + return NULL; +} + +/* Inverse square root table for operands running from 0.5 to ~1.0 */ +/* (INT) (0.5 + 1.0/sqrt((op)/FDKpow(2.0,31))); */ +/* Note: First value is rnot rounded for accuracy reasons */ +/* Implicit exponent is 1. */ +/* Examples: 0x5A82799A = invSqrtNorm2 (0x4000.0000), exp=1 */ +/* 0x5A82799A = invSqrtNorm2 (0x4000.0000), exp=1 */ + +LNK_SECTION_CONSTDATA_L1 +const FIXP_DBL invSqrtTab[SQRT_VALUES] = { + 0x5A827999, 0x5A287E03, 0x59CF8CBC, 0x5977A0AC, 0x5920B4DF, 0x58CAC480, + 0x5875CADE, 0x5821C364, 0x57CEA99D, 0x577C7930, 0x572B2DE0, 0x56DAC38E, + 0x568B3632, 0x563C81E0, 0x55EEA2C4, 0x55A19522, 0x55555555, 0x5509DFD0, + 0x54BF311A, 0x547545D0, 0x542C1AA4, 0x53E3AC5B, 0x539BF7CD, 0x5354F9E7, + 0x530EAFA5, 0x52C91618, 0x52842A5F, 0x523FE9AC, 0x51FC5140, 0x51B95E6B, + 0x51770E8F, 0x51355F1A, 0x50F44D89, 0x50B3D768, 0x5073FA50, 0x5034B3E7, + 0x4FF601E0, 0x4FB7E1FA, 0x4F7A5202, 0x4F3D4FCF, 0x4F00D944, 0x4EC4EC4F, + 0x4E8986EA, 0x4E4EA718, 0x4E144AE9, 0x4DDA7073, 0x4DA115DA, 0x4D683948, + 0x4D2FD8F4, 0x4CF7F31B, 0x4CC08605, 0x4C899000, 0x4C530F65, 0x4C1D0294, + 0x4BE767F5, 0x4BB23DF9, 0x4B7D8317, 0x4B4935CF, 0x4B1554A6, 0x4AE1DE2A, + 0x4AAED0F0, 0x4A7C2B93, 0x4A49ECB3, 0x4A1812FA, 0x49E69D16, 0x49B589BB, + 0x4984D7A4, 0x49548592, 0x49249249, 0x48F4FC97, 0x48C5C34B, 0x4896E53D, + 0x48686148, 0x483A364D, 0x480C6332, 0x47DEE6E1, 0x47B1C049, 0x4784EE60, + 0x4758701C, 0x472C447C, 0x47006A81, 0x46D4E130, 0x46A9A794, 0x467EBCBA, + 0x46541FB4, 0x4629CF98, 0x45FFCB80, 0x45D6128A, 0x45ACA3D5, 0x45837E88, + 0x455AA1CB, 0x45320CC8, 0x4509BEB0, 0x44E1B6B4, 0x44B9F40B, 0x449275ED, + 0x446B3B96, 0x44444444, 0x441D8F3B, 0x43F71BBF, 0x43D0E917, 0x43AAF68F, + 0x43854374, 0x435FCF15, 0x433A98C6, 0x43159FDC, 0x42F0E3AE, 0x42CC6398, + 0x42A81EF6, 0x42841527, 0x4260458E, 0x423CAF8D, 0x4219528B, 0x41F62DF2, + 0x41D3412A, 0x41B08BA2, 0x418E0CC8, 0x416BC40D, 0x4149B0E5, 0x4127D2C3, + 0x41062920, 0x40E4B374, 0x40C3713B, 0x40A261EF, 0x40818512, 0x4060DA22, + 0x404060A1, 0x40201814, 0x40000000, 0x3FE017EC /* , 0x3FC05F61 */ +}; + +/* number of channels of the formats */ + +const INT format_nchan[FDK_NFORMATS + 9 - 2] = { + 0, /* any set-up, ChConfIdx = 0 */ + 1, /* mono ChConfIdx = 1 */ + 2, /* stereo ChConfIdx = 2 */ + 3, /* 3/0.0 ChConfIdx = 3 */ + 4, /* 3/1.0 ChConfIdx = 4 */ + 5, /* 3/2.0 ChConfIdx = 5 */ + 6, /* 5.1 ChConfIdx = 6 */ + 8, /* 5/2.1 ALT ChConfIdx = 7 */ + 0, /* Empty n.a. ChConfIdx = 8 */ + 3, /* 2/1.0 ChConfIdx = 9 */ + 4, /* 2/2.0 ChConfIdx = 10 */ + 7, /* 3/3.1 ChConfIdx = 11 */ + 8, /* 3/4.1 ChConfIdx = 12 */ + 24, /* 22.2 ChConfIdx = 13 */ + 8, /* 5/2.1 ChConfIdx = 14 */ + 12, /* 5/5.2 ChConfIdx = 15 */ + 10, /* 5/4.1 ChConfIdx = 16 */ + 12, /* 6/5.1 ChConfIdx = 17 */ + 14, /* 6/7.1 ChConfIdx = 18 */ + 12, /* 5/6.1 ChConfIdx = 19 */ + 14 /* 7/6.1 ChConfIdx = 20 */ +}; diff --git a/fdk-aac/libFDK/src/FDK_trigFcts.cpp b/fdk-aac/libFDK/src/FDK_trigFcts.cpp new file mode 100644 index 0000000..4bb6262 --- /dev/null +++ b/fdk-aac/libFDK/src/FDK_trigFcts.cpp @@ -0,0 +1,340 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Haricharan Lakshman, Manuel Jander + + Description: Trigonometric functions fixed point fractional implementation. + +*******************************************************************************/ + +#include "FDK_trigFcts.h" + +#include "fixpoint_math.h" + +#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() so there a wider input + * range can be covered, too. + * + *****************************************************************************/ + 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; + + /* --- 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); + at = fixp_atan(q); /* ATO_SF */ + } + + // --- 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); + } + } + return ret; +} + +FIXP_DBL fixp_atan(FIXP_DBL x) { + INT sign; + FIXP_DBL result, temp; + + /* SNR of fixp_atan() = 56 dB */ + 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; + } + FDK_ASSERT(FL2FXCONST_DBL(1.0 / 64.0) == Q(Q_ATANINP)); + /* calc of arctan */ + if (x < FL2FXCONST_DBL(1.0 / 64.0)) + /* + Chebyshev polynomial approximation of atan(x) + 5th-order approximation: atan(x) = a1*x + a2*x^3 + a3*x^5 = x(a1 + x^2*(a2 + + a3*x^2)); a1 = 0.9949493661166540f, a2 = 0.2870606355326520f, a3 = + 0.0780371764464410f; 7th-order approximation: atan(x) = a1*x + a2*x^3 + + a3*x^5 + a3*x^7 = x(a1 + x^2*(a2 + x^2*(a3 + a4*x^2))); a1 = + 0.9991334482227801, a2 = -0.3205332923816640, a3 = 0.1449824901444650, a4 = + -0.0382544649702990; 7th-order approximation in use (the most accurate + solution) + */ + { + x <<= ATI_SF; + FIXP_DBL x2 = fPow2(x); + temp = fMultAddDiv2((FL2FXCONST_DBL(0.1449824901444650f) >> 1), x2, + FL2FXCONST_DBL(-0.0382544649702990)); + temp = fMultAddDiv2((FL2FXCONST_DBL(-0.3205332923816640f) >> 2), x2, temp); + temp = fMultAddDiv2((FL2FXCONST_DBL(0.9991334482227801f) >> 3), x2, temp); + result = fMult(x, (temp << 2)); + } 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 { + /* Other approximation for |x| > 1.28 */ + 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); +} + +#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); + +#ifdef SINETABLE_16BIT + return cosine - error; +#else + /* Undo downscaling by 1 which was done at fixp_sin_cos_residual_inline */ + return SATURATE_LEFT_SHIFT(cosine - error, 1, DFRACT_BITS); +#endif +} + +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); + +#ifdef SINETABLE_16BIT + return sine + error; +#else + return SATURATE_LEFT_SHIFT(sine + error, 1, DFRACT_BITS); +#endif +} + +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); + +#ifdef SINETABLE_16BIT + *cos = cosine - error0; + *sin = sine + error1; +#else + *cos = SATURATE_LEFT_SHIFT(cosine - error0, 1, DFRACT_BITS); + *sin = SATURATE_LEFT_SHIFT(sine + error1, 1, DFRACT_BITS); +#endif +} diff --git a/fdk-aac/libFDK/src/arm/fft_rad2_arm.cpp b/fdk-aac/libFDK/src/arm/fft_rad2_arm.cpp new file mode 100644 index 0000000..2c03b11 --- /dev/null +++ b/fdk-aac/libFDK/src/arm/fft_rad2_arm.cpp @@ -0,0 +1,321 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: dit_fft ARM assembler replacements. + +*******************************************************************************/ + +#ifndef __FFT_RAD2_CPP__ +#error \ + "Do not compile this file separately. It is included on demand from fft_rad2.cpp" +#endif + +#ifndef FUNCTION_dit_fft +#if defined(SINETABLE_16BIT) + +#define FUNCTION_dit_fft +#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/fdk-aac/libFDK/src/arm/scale_arm.cpp b/fdk-aac/libFDK/src/arm/scale_arm.cpp new file mode 100644 index 0000000..92c9edc --- /dev/null +++ b/fdk-aac/libFDK/src/arm/scale_arm.cpp @@ -0,0 +1,174 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Arthur Tritthart + + Description: Scaling operations for ARM + +*******************************************************************************/ + +/* prevent multiple inclusion with re-definitions */ +#ifndef __INCLUDE_SCALE_ARM__ +#define __INCLUDE_SCALE_ARM__ + +#if !defined(FUNCTION_scaleValuesWithFactor_DBL) +#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 /* #if !defined(FUNCTION_scaleValuesWithFactor_DBL) */ + +#endif /* #ifndef __INCLUDE_SCALE_ARM__ */ diff --git a/fdk-aac/libFDK/src/autocorr2nd.cpp b/fdk-aac/libFDK/src/autocorr2nd.cpp new file mode 100644 index 0000000..718a555 --- /dev/null +++ b/fdk-aac/libFDK/src/autocorr2nd.cpp @@ -0,0 +1,293 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Lohwasser + + Description: auto-correlation functions + +*******************************************************************************/ + +#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) + +/*! + * + * \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 + +#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 (should be smaller than 128) */ +) { + 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 = CntLeadingZeros(fAbs(ac->det)) - 1; + + ac->det <<= mScale; + ac->det_scale = mScale - 2; + + return autoCorrScaling; +} + +#endif /* FUNCTION_autoCorr2nd_cplx */ diff --git a/fdk-aac/libFDK/src/dct.cpp b/fdk-aac/libFDK/src/dct.cpp new file mode 100644 index 0000000..776493e --- /dev/null +++ b/fdk-aac/libFDK/src/dct.cpp @@ -0,0 +1,568 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: + +*******************************************************************************/ + +/*! + \file dct.cpp + \brief DCT Implementations + 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" + +void dct_getTables(const FIXP_WTP **ptwiddle, const FIXP_STP **sin_twiddle, + int *sin_step, int length) { + const FIXP_WTP *twiddle; + 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 = SineTable1024; + *sin_step = 1 << (10 - 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; + case 0x6: /* 3/4 of radix 2 */ + *sin_twiddle = SineTable384; + *sin_step = 1 << (8 - ld2_length); + twiddle = windowSlopes[0][2][ld2_length]; + break; + case 0x5: /* 5/16 of radix 2*/ + *sin_twiddle = SineTable80; + *sin_step = 1 << (6 - ld2_length); + twiddle = windowSlopes[0][3][ld2_length]; + break; + default: + *sin_twiddle = NULL; + *sin_step = 0; + twiddle = NULL; + break; + } + + if (ptwiddle != NULL) { + FDK_ASSERT(twiddle != NULL); + *ptwiddle = twiddle; + } + + FDK_ASSERT(*sin_step > 0); +} + +#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) { + const FIXP_WTP *sin_twiddle; + int i; + FIXP_DBL xr, accu1, accu2; + int inc, index; + int M = L >> 1; + + FDK_ASSERT(L % 4 == 0); + dct_getTables(NULL, &sin_twiddle, &inc, L); + inc >>= 1; + + FIXP_DBL *pTmp_0 = &tmp[2]; + FIXP_DBL *pTmp_1 = &tmp[(M - 1) * 2]; + + index = 4 * inc; + + /* This loop performs multiplication for index i (i*inc) */ + for (i = 1; i> 1; i++, pTmp_0 += 2, pTmp_1 -= 2) { + FIXP_DBL accu3, accu4, accu5, accu6; + + cplxMultDiv2(&accu2, &accu1, pDat[L - i], pDat[i], sin_twiddle[i * inc]); + cplxMultDiv2(&accu4, &accu3, pDat[M + i], pDat[M - i], + sin_twiddle[(M - i) * inc]); + accu3 >>= 1; + accu4 >>= 1; + + /* This method is better for ARM926, that uses operand2 shifted right by 1 + * always */ + if (2 * i < (M / 2)) { + cplxMultDiv2(&accu6, &accu5, (accu3 - (accu1 >> 1)), + ((accu2 >> 1) + accu4), sin_twiddle[index]); + } else { + cplxMultDiv2(&accu6, &accu5, ((accu2 >> 1) + accu4), + (accu3 - (accu1 >> 1)), sin_twiddle[index]); + accu6 = -accu6; + } + 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); + + /* Create index helper variables for (4*i)*inc indexed equivalent values of + * short tables. */ + if (2 * i < ((M / 2) - 1)) { + index += 4 * inc; + } else if (2 * i >= ((M / 2))) { + index -= 4 * inc; + } + } + + xr = fMultDiv2(pDat[M], sin_twiddle[M * inc].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[M * inc / 2]); + 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; +} + +void dst_III(FIXP_DBL *pDat, /*!< pointer to input/output */ + FIXP_DBL *tmp, /*!< pointer to temporal working buffer */ + int L, /*!< lenght of transform */ + int *pDat_e) { + int L2 = L >> 1; + int i; + FIXP_DBL t; + + /* note: DCT III is reused here, direct DST III implementation might be more + * efficient */ + + /* mirror input */ + for (i = 0; i < L2; i++) { + t = pDat[i]; + pDat[i] = pDat[L - 1 - i]; + pDat[L - 1 - i] = t; + } + + /* DCT-III */ + dct_III(pDat, tmp, L, pDat_e); + + /* flip signs at odd indices */ + for (i = 1; i < L; i += 2) pDat[i] = -pDat[i]; +} + +#endif + +#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 (has to be a multiple of 8 (or 4 in case + DCT_II_L_MULTIPLE_OF_4_SUPPORT is defined) */ + int *pDat_e) { + const FIXP_WTP *sin_twiddle; + FIXP_DBL accu1, accu2; + FIXP_DBL *pTmp_0, *pTmp_1; + + int i; + int inc, index = 0; + int M = L >> 1; + + FDK_ASSERT(L % 4 == 0); + dct_getTables(NULL, &sin_twiddle, &inc, L); + inc >>= 1; + + { + for (i = 0; i < M; i++) { + tmp[i] = pDat[2 * i] >> 1; /* dit_fft expects 1 bit scaled input values */ + tmp[L - 1 - i] = + pDat[2 * i + 1] >> 1; /* dit_fft expects 1 bit scaled input values */ + } + } + + fft(M, tmp, pDat_e); + + pTmp_0 = &tmp[2]; + pTmp_1 = &tmp[(M - 1) * 2]; + + index = inc * 4; + + for (i = 1; i> 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)); + + if (2 * i < (M / 2)) { + cplxMultDiv2(&accu1, &accu2, a2, a1, sin_twiddle[index]); + } else { + cplxMultDiv2(&accu1, &accu2, a1, a2, sin_twiddle[index]); + accu1 = -accu1; + } + 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[i * inc]); + pDat[L - i] = accu4; + pDat[i] = accu3; + + cplxMultDiv2(&accu3, &accu4, (a1 - accu2), -(accu1 - a2), + sin_twiddle[(M - i) * inc]); + pDat[M + i] = accu4; + pDat[M - i] = accu3; + + /* Create index helper variables for (4*i)*inc indexed equivalent values of + * short tables. */ + if (2 * i < ((M / 2) - 1)) { + index += 4 * inc; + } else if (2 * i >= ((M / 2))) { + index -= 4 * inc; + } + } + + cplxMultDiv2(&accu1, &accu2, tmp[M], tmp[M + 1], sin_twiddle[(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[M * inc].v.re); /* cos((PI/(2*L))*M); */ + + *pDat_e += 2; +} +#endif + +#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); + + FDK_ASSERT(L >= 4); + + dct_getTables(&twiddle, &sin_twiddle, &sin_step, L); + + { + FIXP_DBL *RESTRICT pDat_0 = &pDat[0]; + FIXP_DBL *RESTRICT pDat_1 = &pDat[L - 2]; + int i; + + /* 29 cycles on ARM926 */ + for (i = 0; i < M - 1; i += 2, pDat_0 += 2, pDat_1 -= 2) { + 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 >> 1; + pDat_0[1] = accu1 >> 1; + pDat_1[0] = accu4 >> 1; + pDat_1[1] = -(accu3 >> 1); + } + if (M & 1) { + FIXP_DBL accu1, accu2; + + accu1 = pDat_1[1]; + accu2 = pDat_0[0]; + + cplxMultDiv2(&accu1, &accu2, accu1, accu2, twiddle[i]); + + pDat_0[0] = accu2 >> 1; + pDat_0[1] = accu1 >> 1; + } + } + + fft(M, pDat, pDat_e); + + { + FIXP_DBL *RESTRICT pDat_0 = &pDat[0]; + FIXP_DBL *RESTRICT pDat_1 = &pDat[L - 2]; + 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]; + + /* 28 cycles for ARM926 */ + for (idx = sin_step, i = 1; i<(M + 1)>> 1; i++, idx += sin_step) { + FIXP_STP twd = sin_twiddle[idx]; + cplxMult(&accu3, &accu4, accu1, accu2, twd); + pDat_0[1] = accu3; + pDat_1[0] = accu4; + + pDat_0 += 2; + pDat_1 -= 2; + + cplxMult(&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 = fMult(accu1, WTC(0x5a82799a)); + accu2 = fMult(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; + + FDK_ASSERT(L >= 4); + + FDK_ASSERT(L >= 4); + + dct_getTables(&twiddle, &sin_twiddle, &sin_step, L); + + { + FIXP_DBL *RESTRICT pDat_0 = &pDat[0]; + FIXP_DBL *RESTRICT pDat_1 = &pDat[L - 2]; + int i; + + /* 34 cycles on ARM926 */ + for (i = 0; i < M - 1; i += 2, pDat_0 += 2, pDat_1 -= 2) { + 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 >> 1; + pDat_0[1] = accu1 >> 1; + pDat_1[0] = accu4 >> 1; + pDat_1[1] = -(accu3 >> 1); + } + if (M & 1) { + FIXP_DBL accu1, accu2; + + accu1 = pDat_1[1]; + accu2 = -pDat_0[0]; + + cplxMultDiv2(&accu1, &accu2, accu1, accu2, twiddle[i]); + + pDat_0[0] = accu2 >> 1; + pDat_0[1] = accu1 >> 1; + } + } + + fft(M, pDat, pDat_e); + + { + FIXP_DBL *RESTRICT pDat_0; + FIXP_DBL *RESTRICT pDat_1; + 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]; + pDat_0[0] = pDat_0[1]; + + for (idx = sin_step, i = 1; i<(M + 1)>> 1; i++, idx += sin_step) { + FIXP_STP twd = sin_twiddle[idx]; + + cplxMult(&accu3, &accu4, accu1, accu2, twd); + pDat_1[0] = -accu3; + pDat_0[1] = -accu4; + + pDat_0 += 2; + pDat_1 -= 2; + + cplxMult(&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 = fMult(accu1, WTC(0x5a82799a)); + accu2 = fMult(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/fdk-aac/libFDK/src/fft.cpp b/fdk-aac/libFDK/src/fft.cpp new file mode 100644 index 0000000..4e6fdd2 --- /dev/null +++ b/fdk-aac/libFDK/src/fft.cpp @@ -0,0 +1,1922 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Josef Hoepfl, DSP Solutions + + Description: Fix point FFT + +*******************************************************************************/ + +#include "fft_rad2.h" +#include "FDK_tools_rom.h" + +#define W_PiFOURTH STC(0x5a82799a) +//#define W_PiFOURTH ((FIXP_DBL)(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; \ + } +#define SUMDIFF_PIFOURTH16(diff, sum, a, b) \ + { \ + FIXP_SGL wa, wb; \ + wa = FX_DBL2FX_SGL(fMultDiv2(a, W_PiFOURTH)); \ + wb = FX_DBL2FX_SGL(fMultDiv2(b, W_PiFOURTH)); \ + diff = wb - wa; \ + sum = wb + wa; \ + } +#endif + +#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 + +#define SCALEFACTOR3 1 +#define SCALEFACTOR5 1 +#define SCALEFACTOR6 (SCALEFACTOR2 + SCALEFACTOR3 + 2) +#define SCALEFACTOR7 2 +#define SCALEFACTOR9 2 +#define SCALEFACTOR10 5 +#define SCALEFACTOR12 3 +#define SCALEFACTOR15 3 +#define SCALEFACTOR18 (SCALEFACTOR2 + SCALEFACTOR9 + 2) +#define SCALEFACTOR20 (SCALEFACTOR4 + SCALEFACTOR5 + 2) +#define SCALEFACTOR21 (SCALEFACTOR3 + SCALEFACTOR7 + 2) +#define SCALEFACTOR24 (SCALEFACTOR2 + SCALEFACTOR12 + 2) +#define SCALEFACTOR30 (SCALEFACTOR2 + SCALEFACTOR15 + 2) +#define SCALEFACTOR40 (SCALEFACTOR5 + SCALEFACTOR8 + 2) +#define SCALEFACTOR48 (SCALEFACTOR4 + SCALEFACTOR12 + 2) +#define SCALEFACTOR60 (SCALEFACTOR4 + SCALEFACTOR15 + 2) +#define SCALEFACTOR80 (SCALEFACTOR5 + SCALEFACTOR16 + 2) +#define SCALEFACTOR96 (SCALEFACTOR3 + SCALEFACTOR32 + 2) +#define SCALEFACTOR120 (SCALEFACTOR8 + SCALEFACTOR15 + 2) +#define SCALEFACTOR160 (SCALEFACTOR10 + SCALEFACTOR16 + 2) +#define SCALEFACTOR168 (SCALEFACTOR21 + SCALEFACTOR8 + 2) +#define SCALEFACTOR192 (SCALEFACTOR12 + SCALEFACTOR16 + 2) +#define SCALEFACTOR240 (SCALEFACTOR16 + SCALEFACTOR15 + 2) +#define SCALEFACTOR320 (SCALEFACTOR10 + SCALEFACTOR32 + 2) +#define SCALEFACTOR336 (SCALEFACTOR21 + SCALEFACTOR16 + 2) +#define SCALEFACTOR384 (SCALEFACTOR12 + SCALEFACTOR32 + 2) +#define SCALEFACTOR480 (SCALEFACTOR32 + SCALEFACTOR15 + 2) + +#include "fft.h" + +#ifndef FUNCTION_fft2 + +/* Performs the FFT of length 2. Input vector unscaled, output vector scaled + * with factor 0.5 */ +static FDK_FORCEINLINE void fft2(FIXP_DBL *RESTRICT pDat) { + FIXP_DBL r1, i1; + FIXP_DBL r2, i2; + + /* real part */ + r1 = pDat[2]; + r2 = pDat[0]; + + /* imaginary part */ + i1 = pDat[3]; + i2 = pDat[1]; + + /* real part */ + pDat[0] = (r2 + r1) >> 1; + pDat[2] = (r2 - r1) >> 1; + + /* imaginary part */ + pDat[1] = (i2 + i1) >> 1; + pDat[3] = (i2 - i1) >> 1; +} +#endif /* FUNCTION_fft2 */ + +#define C31 (STC(0x91261468)) /* FL2FXCONST_DBL(-0.86602540) = -sqrt(3)/2 */ + +#ifndef FUNCTION_fft3 +/* Performs the FFT of length 3 according to the algorithm after winograd. */ +static FDK_FORCEINLINE void fft3(FIXP_DBL *RESTRICT pDat) { + FIXP_DBL r1, r2; + FIXP_DBL s1, s2; + FIXP_DBL pD; + + /* real part */ + r1 = pDat[2] + pDat[4]; + r2 = fMultDiv2((pDat[2] - pDat[4]), C31); + pD = pDat[0] >> 1; + pDat[0] = pD + (r1 >> 1); + r1 = pD - (r1 >> 2); + + /* imaginary part */ + s1 = pDat[3] + pDat[5]; + s2 = fMultDiv2((pDat[3] - pDat[5]), C31); + pD = pDat[1] >> 1; + pDat[1] = pD + (s1 >> 1); + s1 = pD - (s1 >> 2); + + /* combination */ + pDat[2] = r1 - s2; + pDat[4] = r1 + s2; + pDat[3] = s1 + r2; + pDat[5] = s1 - r2; +} +#endif /* #ifndef FUNCTION_fft3 */ + +#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 */ +/* This version works with a prescale of 2 instead of 3 */ +static FDK_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]) >> 1; + r4 = (pDat[2] - pDat[8]) >> 1; + r3 = (pDat[4] + pDat[6]) >> 1; + r2 = (pDat[4] - pDat[6]) >> 1; + t = fMult((r1 - r3), C54); + r1 = r1 + r3; + pDat[0] = (pDat[0] >> 1) + 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]) >> 1; + s4 = (pDat[3] - pDat[9]) >> 1; + s3 = (pDat[5] + pDat[7]) >> 1; + s2 = (pDat[5] - pDat[7]) >> 1; + t = fMult((s1 - s3), C54); + s1 = s1 + s3; + pDat[1] = (pDat[1] >> 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 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) */ +/** + * \brief Function performs a complex 10-point FFT + * The FFT is performed inplace. The result of the FFT + * is scaled by SCALEFACTOR10 bits. + * + * WOPS FLC version: 1093 cycles + * WOPS with 32x16 bit multiplications: 196 cycles + * + * \param [i/o] re real input / output + * \param [i/o] im imag input / output + * \param [i ] s stride real and imag input / output + * + * \return void + */ +static void fft10(FIXP_DBL *x) // FIXP_DBL *re, FIXP_DBL *im, FIXP_SGL s) +{ + FIXP_DBL t; + FIXP_DBL x0, x1, x2, x3, x4; + FIXP_DBL r1, r2, r3, r4; + FIXP_DBL s1, s2, s3, s4; + FIXP_DBL y00, y01, y02, y03, y04, y05, y06, y07, y08, y09; + FIXP_DBL y10, y11, y12, y13, y14, y15, y16, y17, y18, y19; + + const int s = 1; // stride factor + + /* 2 fft5 stages */ + + /* real part */ + x0 = (x[s * 0] >> SCALEFACTOR10); + x1 = (x[s * 4] >> SCALEFACTOR10); + x2 = (x[s * 8] >> SCALEFACTOR10); + x3 = (x[s * 12] >> SCALEFACTOR10); + x4 = (x[s * 16] >> SCALEFACTOR10); + + r1 = (x3 + x2); + r4 = (x3 - x2); + r3 = (x1 + x4); + r2 = (x1 - x4); + t = fMult((r1 - r3), C54); + r1 = (r1 + r3); + y00 = (x0 + r1); + r1 = (y00 + ((fMult(r1, C55) << 1))); + r3 = (r1 - t); + r1 = (r1 + t); + t = fMult((r4 + r2), C51); + r4 = (t + (fMult(r4, C52) << 1)); + r2 = (t + fMult(r2, C53)); + + /* imaginary part */ + x0 = (x[s * 0 + 1] >> SCALEFACTOR10); + x1 = (x[s * 4 + 1] >> SCALEFACTOR10); + x2 = (x[s * 8 + 1] >> SCALEFACTOR10); + x3 = (x[s * 12 + 1] >> SCALEFACTOR10); + x4 = (x[s * 16 + 1] >> SCALEFACTOR10); + + s1 = (x3 + x2); + s4 = (x3 - x2); + s3 = (x1 + x4); + s2 = (x1 - x4); + t = fMult((s1 - s3), C54); + s1 = (s1 + s3); + y01 = (x0 + s1); + s1 = (y01 + (fMult(s1, C55) << 1)); + s3 = (s1 - t); + s1 = (s1 + t); + t = fMult((s4 + s2), C51); + s4 = (t + (fMult(s4, C52) << 1)); + s2 = (t + fMult(s2, C53)); + + /* combination */ + y04 = (r1 + s2); + y16 = (r1 - s2); + y08 = (r3 - s4); + y12 = (r3 + s4); + + y05 = (s1 - r2); + y17 = (s1 + r2); + y09 = (s3 + r4); + y13 = (s3 - r4); + + /* real part */ + x0 = (x[s * 10] >> SCALEFACTOR10); + x1 = (x[s * 2] >> SCALEFACTOR10); + x2 = (x[s * 6] >> SCALEFACTOR10); + x3 = (x[s * 14] >> SCALEFACTOR10); + x4 = (x[s * 18] >> SCALEFACTOR10); + + r1 = (x1 + x4); + r4 = (x1 - x4); + r3 = (x3 + x2); + r2 = (x3 - x2); + t = fMult((r1 - r3), C54); + r1 = (r1 + r3); + y02 = (x0 + r1); + r1 = (y02 + ((fMult(r1, C55) << 1))); + r3 = (r1 - t); + r1 = (r1 + t); + t = fMult(((r4 + r2)), C51); + r4 = (t + (fMult(r4, C52) << 1)); + r2 = (t + fMult(r2, C53)); + + /* imaginary part */ + x0 = (x[s * 10 + 1] >> SCALEFACTOR10); + x1 = (x[s * 2 + 1] >> SCALEFACTOR10); + x2 = (x[s * 6 + 1] >> SCALEFACTOR10); + x3 = (x[s * 14 + 1] >> SCALEFACTOR10); + x4 = (x[s * 18 + 1] >> SCALEFACTOR10); + + s1 = (x1 + x4); + s4 = (x1 - x4); + s3 = (x3 + x2); + s2 = (x3 - x2); + t = fMult((s1 - s3), C54); + s1 = (s1 + s3); + y03 = (x0 + s1); + s1 = (y03 + (fMult(s1, C55) << 1)); + s3 = (s1 - t); + s1 = (s1 + t); + t = fMult((s4 + s2), C51); + s4 = (t + (fMult(s4, C52) << 1)); + s2 = (t + fMult(s2, C53)); + + /* combination */ + y06 = (r1 + s2); + y18 = (r1 - s2); + y10 = (r3 - s4); + y14 = (r3 + s4); + + y07 = (s1 - r2); + y19 = (s1 + r2); + y11 = (s3 + r4); + y15 = (s3 - r4); + + /* 5 fft2 stages */ + x[s * 0] = (y00 + y02); + x[s * 0 + 1] = (y01 + y03); + x[s * 10] = (y00 - y02); + x[s * 10 + 1] = (y01 - y03); + + x[s * 4] = (y04 + y06); + x[s * 4 + 1] = (y05 + y07); + x[s * 14] = (y04 - y06); + x[s * 14 + 1] = (y05 - y07); + + x[s * 8] = (y08 + y10); + x[s * 8 + 1] = (y09 + y11); + x[s * 18] = (y08 - y10); + x[s * 18 + 1] = (y09 - y11); + + x[s * 12] = (y12 + y14); + x[s * 12 + 1] = (y13 + y15); + x[s * 2] = (y12 - y14); + x[s * 2 + 1] = (y13 - y15); + + x[s * 16] = (y16 + y18); + x[s * 16 + 1] = (y17 + y19); + x[s * 6] = (y16 - y18); + x[s * 6 + 1] = (y17 - y19); +} + +#ifndef FUNCTION_fft12 +#define FUNCTION_fft12 + +#undef C31 +#define C31 (STC(0x91261468)) /* FL2FXCONST_DBL(-0.86602540) = -sqrt(3)/2 */ + +static inline void fft12(FIXP_DBL *pInput) { + FIXP_DBL aDst[24]; + FIXP_DBL *pSrc, *pDst; + int i; + + pSrc = pInput; + pDst = aDst; + FIXP_DBL r1, r2, s1, s2, pD; + + /* First 3*2 samples are shifted right by 2 before output */ + r1 = pSrc[8] + pSrc[16]; + r2 = fMultDiv2((pSrc[8] - pSrc[16]), C31); + pD = pSrc[0] >> 1; + pDst[0] = (pD + (r1 >> 1)) >> 1; + r1 = pD - (r1 >> 2); + + /* imaginary part */ + s1 = pSrc[9] + pSrc[17]; + s2 = fMultDiv2((pSrc[9] - pSrc[17]), C31); + pD = pSrc[1] >> 1; + pDst[1] = (pD + (s1 >> 1)) >> 1; + s1 = pD - (s1 >> 2); + + /* combination */ + pDst[2] = (r1 - s2) >> 1; + pDst[3] = (s1 + r2) >> 1; + pDst[4] = (r1 + s2) >> 1; + pDst[5] = (s1 - r2) >> 1; + pSrc += 2; + pDst += 6; + + const FIXP_STB *pVecRe = RotVectorReal12; + const FIXP_STB *pVecIm = RotVectorImag12; + FIXP_DBL re, im; + FIXP_STB vre, vim; + for (i = 0; i < 2; i++) { + /* sample 0,1 are shifted right by 2 before output */ + /* sample 2,3 4,5 are shifted right by 1 and complex multiplied before + * output */ + + r1 = pSrc[8] + pSrc[16]; + r2 = fMultDiv2((pSrc[8] - pSrc[16]), C31); + pD = pSrc[0] >> 1; + pDst[0] = (pD + (r1 >> 1)) >> 1; + r1 = pD - (r1 >> 2); + + /* imaginary part */ + s1 = pSrc[9] + pSrc[17]; + s2 = fMultDiv2((pSrc[9] - pSrc[17]), C31); + pD = pSrc[1] >> 1; + pDst[1] = (pD + (s1 >> 1)) >> 1; + s1 = pD - (s1 >> 2); + + /* combination */ + re = (r1 - s2) >> 0; + im = (s1 + r2) >> 0; + vre = *pVecRe++; + vim = *pVecIm++; + cplxMultDiv2(&pDst[3], &pDst[2], im, re, vre, vim); + + re = (r1 + s2) >> 0; + im = (s1 - r2) >> 0; + vre = *pVecRe++; + vim = *pVecIm++; + cplxMultDiv2(&pDst[5], &pDst[4], im, re, vre, vim); + + pDst += 6; + pSrc += 2; + } + /* sample 0,1 are shifted right by 2 before output */ + /* sample 2,3 is shifted right by 1 and complex multiplied with (0.0,+1.0) */ + /* sample 4,5 is shifted right by 1 and complex multiplied with (-1.0,0.0) */ + r1 = pSrc[8] + pSrc[16]; + r2 = fMultDiv2((pSrc[8] - pSrc[16]), C31); + pD = pSrc[0] >> 1; + pDst[0] = (pD + (r1 >> 1)) >> 1; + r1 = pD - (r1 >> 2); + + /* imaginary part */ + s1 = pSrc[9] + pSrc[17]; + s2 = fMultDiv2((pSrc[9] - pSrc[17]), C31); + pD = pSrc[1] >> 1; + pDst[1] = (pD + (s1 >> 1)) >> 1; + s1 = pD - (s1 >> 2); + + /* combination */ + pDst[2] = (s1 + r2) >> 1; + pDst[3] = (s2 - r1) >> 1; + pDst[4] = -((r1 + s2) >> 1); + pDst[5] = (r2 - s1) >> 1; + + /* Perform 3 times the fft of length 4. 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 4 is built of the interleaved samples in aDst, the + output samples are stored consecutively at the address of pInput. + */ + pSrc = aDst; + pDst = pInput; + for (i = 0; i < 3; i++) { + /* inline FFT4 merged with incoming resorting loop */ + FIXP_DBL a00, a10, a20, a30, tmp0, tmp1; + + a00 = (pSrc[0] + pSrc[12]) >> 1; /* Re A + Re B */ + a10 = (pSrc[6] + pSrc[18]) >> 1; /* Re C + Re D */ + a20 = (pSrc[1] + pSrc[13]) >> 1; /* Im A + Im B */ + a30 = (pSrc[7] + pSrc[19]) >> 1; /* Im C + Im D */ + + pDst[0] = a00 + a10; /* Re A' = Re A + Re B + Re C + Re D */ + pDst[1] = a20 + a30; /* Im A' = Im A + Im B + Im C + Im D */ + + tmp0 = a00 - pSrc[12]; /* Re A - Re B */ + tmp1 = a20 - pSrc[13]; /* Im A - Im B */ + + pDst[12] = a00 - a10; /* Re C' = Re A + Re B - Re C - Re D */ + pDst[13] = a20 - a30; /* Im C' = Im A + Im B - Im C - Im D */ + + a10 = a10 - pSrc[18]; /* Re C - Re D */ + a30 = a30 - pSrc[19]; /* Im C - Im D */ + + pDst[6] = tmp0 + a30; /* Re B' = Re A - Re B + Im C - Im D */ + pDst[18] = tmp0 - a30; /* Re D' = Re A - Re B - Im C + Im D */ + pDst[7] = tmp1 - a10; /* Im B' = Im A - Im B - Re C + Re D */ + pDst[19] = tmp1 + a10; /* Im D' = Im A - Im B + Re C - Re D */ + + pSrc += 2; + pDst += 2; + } +} +#endif /* FUNCTION_fft12 */ + +#ifndef FUNCTION_fft15 + +#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) { + 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)]; */ + { + 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; + } + } + /* 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 */ + } + } +} +#endif /* FUNCTION_fft15 */ + +/* + Select shift placement. + Some processors like ARM may shift "for free" in combination with an addition + or substraction, but others don't so either combining shift with +/- or reduce + the total amount or shift operations is optimal + */ +#if !defined(__arm__) +#define SHIFT_A >> 1 +#define SHIFT_B +#else +#define SHIFT_A +#define SHIFT_B >> 1 +#endif + +#ifndef FUNCTION_fft_16 /* we check, if fft_16 (FIXP_DBL *) is not yet defined \ + */ + +/* This defines prevents this array to be declared twice, if 16-bit fft is + * enabled too */ +#define FUNCTION_DATA_fft_16_w16 +static const FIXP_STP fft16_w16[2] = {STCP(0x7641af3d, 0x30fbc54d), + STCP(0x30fbc54d, 0x7641af3d)}; + +LNK_SECTION_CODE_L1 +inline void fft_16(FIXP_DBL *RESTRICT x) { + FIXP_DBL vr, ur; + FIXP_DBL vr2, ur2; + FIXP_DBL vr3, ur3; + FIXP_DBL vr4, ur4; + FIXP_DBL vi, ui; + FIXP_DBL vi2, ui2; + FIXP_DBL vi3, ui3; + + vr = (x[0] >> 1) + (x[16] >> 1); /* Re A + Re B */ + ur = (x[1] >> 1) + (x[17] >> 1); /* Im A + Im B */ + vi = (x[8] SHIFT_A) + (x[24] SHIFT_A); /* Re C + Re D */ + ui = (x[9] SHIFT_A) + (x[25] SHIFT_A); /* Im C + Im D */ + x[0] = vr + (vi SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[1] = ur + (ui SHIFT_B); /* Im A' = sum of imag values */ + + vr2 = (x[4] >> 1) + (x[20] >> 1); /* Re A + Re B */ + ur2 = (x[5] >> 1) + (x[21] >> 1); /* Im A + Im B */ + + x[4] = vr - (vi SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[5] = ur - (ui SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + vr -= x[16]; /* Re A - Re B */ + vi = (vi SHIFT_B)-x[24]; /* Re C - Re D */ + ur -= x[17]; /* Im A - Im B */ + ui = (ui SHIFT_B)-x[25]; /* Im C - Im D */ + + vr3 = (x[2] >> 1) + (x[18] >> 1); /* Re A + Re B */ + ur3 = (x[3] >> 1) + (x[19] >> 1); /* Im A + Im B */ + + x[2] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ + x[3] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + + vr4 = (x[6] >> 1) + (x[22] >> 1); /* Re A + Re B */ + ur4 = (x[7] >> 1) + (x[23] >> 1); /* Im A + Im B */ + + x[6] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + x[7] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + + vi2 = (x[12] SHIFT_A) + (x[28] SHIFT_A); /* Re C + Re D */ + ui2 = (x[13] SHIFT_A) + (x[29] SHIFT_A); /* Im C + Im D */ + x[8] = vr2 + (vi2 SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[9] = ur2 + (ui2 SHIFT_B); /* Im A' = sum of imag values */ + x[12] = vr2 - (vi2 SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[13] = ur2 - (ui2 SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + vr2 -= x[20]; /* Re A - Re B */ + ur2 -= x[21]; /* Im A - Im B */ + vi2 = (vi2 SHIFT_B)-x[28]; /* Re C - Re D */ + ui2 = (ui2 SHIFT_B)-x[29]; /* Im C - Im D */ + + vi = (x[10] SHIFT_A) + (x[26] SHIFT_A); /* Re C + Re D */ + ui = (x[11] SHIFT_A) + (x[27] SHIFT_A); /* Im C + Im D */ + + x[10] = ui2 + vr2; /* Re B' = Im C - Im D + Re A - Re B */ + x[11] = ur2 - vi2; /* Im B'= -Re C + Re D + Im A - Im B */ + + vi3 = (x[14] SHIFT_A) + (x[30] SHIFT_A); /* Re C + Re D */ + ui3 = (x[15] SHIFT_A) + (x[31] SHIFT_A); /* Im C + Im D */ + + x[14] = vr2 - ui2; /* Re D' = -Im C + Im D + Re A - Re B */ + x[15] = vi2 + ur2; /* Im D'= Re C - Re D + Im A - Im B */ + + x[16] = vr3 + (vi SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[17] = ur3 + (ui SHIFT_B); /* Im A' = sum of imag values */ + x[20] = vr3 - (vi SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[21] = ur3 - (ui SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + vr3 -= x[18]; /* Re A - Re B */ + ur3 -= x[19]; /* Im A - Im B */ + vi = (vi SHIFT_B)-x[26]; /* Re C - Re D */ + ui = (ui SHIFT_B)-x[27]; /* Im C - Im D */ + x[18] = ui + vr3; /* Re B' = Im C - Im D + Re A - Re B */ + x[19] = ur3 - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + + x[24] = vr4 + (vi3 SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[28] = vr4 - (vi3 SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[25] = ur4 + (ui3 SHIFT_B); /* Im A' = sum of imag values */ + x[29] = ur4 - (ui3 SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + vr4 -= x[22]; /* Re A - Re B */ + ur4 -= x[23]; /* Im A - Im B */ + + x[22] = vr3 - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + x[23] = vi + ur3; /* Im D'= Re C - Re D + Im A - Im B */ + + vi3 = (vi3 SHIFT_B)-x[30]; /* Re C - Re D */ + ui3 = (ui3 SHIFT_B)-x[31]; /* Im C - Im D */ + x[26] = ui3 + vr4; /* Re B' = Im C - Im D + Re A - Re B */ + x[30] = vr4 - ui3; /* Re D' = -Im C + Im D + Re A - Re B */ + x[27] = ur4 - vi3; /* Im B'= -Re C + Re D + Im A - Im B */ + x[31] = vi3 + ur4; /* Im D'= Re C - Re D + Im A - Im B */ + + // xt1 = 0 + // xt2 = 8 + vr = x[8]; + vi = x[9]; + ur = x[0] >> 1; + ui = x[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 = x[13]; + vi = x[12]; + ur = x[4] >> 1; + ui = x[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 = x[24]; + vi = x[25]; + ur = x[16] >> 1; + ui = x[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 = x[29]; + vi = x[28]; + ur = x[20] >> 1; + ui = x[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, x[10], x[11]) + // vr = fMultDiv2((x[11] + x[10]),W_PiFOURTH); + // vi = fMultDiv2((x[11] - x[10]),W_PiFOURTH); + ur = x[2]; + ui = x[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, x[14], x[15]) + ur = x[6]; + ui = x[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, x[26], x[27]) + ur = x[18]; + ui = x[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, x[30], x[31]) + ur = x[22]; + ui = x[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; +} +#endif /* FUNCTION_fft_16 */ + +#ifndef FUNCTION_fft_32 +static const FIXP_STP fft32_w32[6] = { + STCP(0x7641af3d, 0x30fbc54d), STCP(0x30fbc54d, 0x7641af3d), + STCP(0x7d8a5f40, 0x18f8b83c), STCP(0x6a6d98a4, 0x471cece7), + STCP(0x471cece7, 0x6a6d98a4), STCP(0x18f8b83c, 0x7d8a5f40)}; +#define W_PiFOURTH STC(0x5a82799a) + +LNK_SECTION_CODE_L1 +inline void fft_32(FIXP_DBL *const _x) { + /* + * 1+2 stage radix 4 + */ + + ///////////////////////////////////////////////////////////////////////////////////////// + { + FIXP_DBL *const x = _x; + FIXP_DBL vi, ui; + FIXP_DBL vi2, ui2; + FIXP_DBL vi3, ui3; + FIXP_DBL vr, ur; + FIXP_DBL vr2, ur2; + FIXP_DBL vr3, ur3; + FIXP_DBL vr4, ur4; + + // i = 0 + vr = (x[0] + x[32]) >> 1; /* Re A + Re B */ + ur = (x[1] + x[33]) >> 1; /* Im A + Im B */ + vi = (x[16] + x[48]) SHIFT_A; /* Re C + Re D */ + ui = (x[17] + x[49]) SHIFT_A; /* Im C + Im D */ + + x[0] = vr + (vi SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[1] = ur + (ui SHIFT_B); /* Im A' = sum of imag values */ + + vr2 = (x[4] + x[36]) >> 1; /* Re A + Re B */ + ur2 = (x[5] + x[37]) >> 1; /* Im A + Im B */ + + x[4] = vr - (vi SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[5] = ur - (ui SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr -= x[32]; /* Re A - Re B */ + ur -= x[33]; /* Im A - Im B */ + vi = (vi SHIFT_B)-x[48]; /* Re C - Re D */ + ui = (ui SHIFT_B)-x[49]; /* Im C - Im D */ + + vr3 = (x[2] + x[34]) >> 1; /* Re A + Re B */ + ur3 = (x[3] + x[35]) >> 1; /* Im A + Im B */ + + x[2] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ + x[3] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + + vr4 = (x[6] + x[38]) >> 1; /* Re A + Re B */ + ur4 = (x[7] + x[39]) >> 1; /* Im A + Im B */ + + x[6] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + x[7] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + + // i=16 + vi = (x[20] + x[52]) SHIFT_A; /* Re C + Re D */ + ui = (x[21] + x[53]) SHIFT_A; /* Im C + Im D */ + + x[16] = vr2 + (vi SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[17] = ur2 + (ui SHIFT_B); /* Im A' = sum of imag values */ + x[20] = vr2 - (vi SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[21] = ur2 - (ui SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr2 -= x[36]; /* Re A - Re B */ + ur2 -= x[37]; /* Im A - Im B */ + vi = (vi SHIFT_B)-x[52]; /* Re C - Re D */ + ui = (ui SHIFT_B)-x[53]; /* Im C - Im D */ + + vi2 = (x[18] + x[50]) SHIFT_A; /* Re C + Re D */ + ui2 = (x[19] + x[51]) SHIFT_A; /* Im C + Im D */ + + x[18] = ui + vr2; /* Re B' = Im C - Im D + Re A - Re B */ + x[19] = ur2 - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + + vi3 = (x[22] + x[54]) SHIFT_A; /* Re C + Re D */ + ui3 = (x[23] + x[55]) SHIFT_A; /* Im C + Im D */ + + x[22] = vr2 - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + x[23] = vi + ur2; /* Im D'= Re C - Re D + Im A - Im B */ + + // i = 32 + + x[32] = vr3 + (vi2 SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[33] = ur3 + (ui2 SHIFT_B); /* Im A' = sum of imag values */ + x[36] = vr3 - (vi2 SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[37] = ur3 - (ui2 SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr3 -= x[34]; /* Re A - Re B */ + ur3 -= x[35]; /* Im A - Im B */ + vi2 = (vi2 SHIFT_B)-x[50]; /* Re C - Re D */ + ui2 = (ui2 SHIFT_B)-x[51]; /* Im C - Im D */ + + x[34] = ui2 + vr3; /* Re B' = Im C - Im D + Re A - Re B */ + x[35] = ur3 - vi2; /* Im B'= -Re C + Re D + Im A - Im B */ + + // i=48 + + x[48] = vr4 + (vi3 SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[52] = vr4 - (vi3 SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[49] = ur4 + (ui3 SHIFT_B); /* Im A' = sum of imag values */ + x[53] = ur4 - (ui3 SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr4 -= x[38]; /* Re A - Re B */ + ur4 -= x[39]; /* Im A - Im B */ + + x[38] = vr3 - ui2; /* Re D' = -Im C + Im D + Re A - Re B */ + x[39] = vi2 + ur3; /* Im D'= Re C - Re D + Im A - Im B */ + + vi3 = (vi3 SHIFT_B)-x[54]; /* Re C - Re D */ + ui3 = (ui3 SHIFT_B)-x[55]; /* Im C - Im D */ + + x[50] = ui3 + vr4; /* Re B' = Im C - Im D + Re A - Re B */ + x[54] = vr4 - ui3; /* Re D' = -Im C + Im D + Re A - Re B */ + x[51] = ur4 - vi3; /* Im B'= -Re C + Re D + Im A - Im B */ + x[55] = vi3 + ur4; /* Im D'= Re C - Re D + Im A - Im B */ + + // i=8 + vr = (x[8] + x[40]) >> 1; /* Re A + Re B */ + ur = (x[9] + x[41]) >> 1; /* Im A + Im B */ + vi = (x[24] + x[56]) SHIFT_A; /* Re C + Re D */ + ui = (x[25] + x[57]) SHIFT_A; /* Im C + Im D */ + + x[8] = vr + (vi SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[9] = ur + (ui SHIFT_B); /* Im A' = sum of imag values */ + + vr2 = (x[12] + x[44]) >> 1; /* Re A + Re B */ + ur2 = (x[13] + x[45]) >> 1; /* Im A + Im B */ + + x[12] = vr - (vi SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[13] = ur - (ui SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr -= x[40]; /* Re A - Re B */ + ur -= x[41]; /* Im A - Im B */ + vi = (vi SHIFT_B)-x[56]; /* Re C - Re D */ + ui = (ui SHIFT_B)-x[57]; /* Im C - Im D */ + + vr3 = (x[10] + x[42]) >> 1; /* Re A + Re B */ + ur3 = (x[11] + x[43]) >> 1; /* Im A + Im B */ + + x[10] = ui + vr; /* Re B' = Im C - Im D + Re A - Re B */ + x[11] = ur - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + + vr4 = (x[14] + x[46]) >> 1; /* Re A + Re B */ + ur4 = (x[15] + x[47]) >> 1; /* Im A + Im B */ + + x[14] = vr - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + x[15] = vi + ur; /* Im D'= Re C - Re D + Im A - Im B */ + + // i=24 + vi = (x[28] + x[60]) SHIFT_A; /* Re C + Re D */ + ui = (x[29] + x[61]) SHIFT_A; /* Im C + Im D */ + + x[24] = vr2 + (vi SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[28] = vr2 - (vi SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[25] = ur2 + (ui SHIFT_B); /* Im A' = sum of imag values */ + x[29] = ur2 - (ui SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr2 -= x[44]; /* Re A - Re B */ + ur2 -= x[45]; /* Im A - Im B */ + vi = (vi SHIFT_B)-x[60]; /* Re C - Re D */ + ui = (ui SHIFT_B)-x[61]; /* Im C - Im D */ + + vi2 = (x[26] + x[58]) SHIFT_A; /* Re C + Re D */ + ui2 = (x[27] + x[59]) SHIFT_A; /* Im C + Im D */ + + x[26] = ui + vr2; /* Re B' = Im C - Im D + Re A - Re B */ + x[27] = ur2 - vi; /* Im B'= -Re C + Re D + Im A - Im B */ + + vi3 = (x[30] + x[62]) SHIFT_A; /* Re C + Re D */ + ui3 = (x[31] + x[63]) SHIFT_A; /* Im C + Im D */ + + x[30] = vr2 - ui; /* Re D' = -Im C + Im D + Re A - Re B */ + x[31] = vi + ur2; /* Im D'= Re C - Re D + Im A - Im B */ + + // i=40 + + x[40] = vr3 + (vi2 SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[44] = vr3 - (vi2 SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[41] = ur3 + (ui2 SHIFT_B); /* Im A' = sum of imag values */ + x[45] = ur3 - (ui2 SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr3 -= x[42]; /* Re A - Re B */ + ur3 -= x[43]; /* Im A - Im B */ + vi2 = (vi2 SHIFT_B)-x[58]; /* Re C - Re D */ + ui2 = (ui2 SHIFT_B)-x[59]; /* Im C - Im D */ + + x[42] = ui2 + vr3; /* Re B' = Im C - Im D + Re A - Re B */ + x[43] = ur3 - vi2; /* Im B'= -Re C + Re D + Im A - Im B */ + + // i=56 + + x[56] = vr4 + (vi3 SHIFT_B); /* Re A' = ReA + ReB +ReC + ReD */ + x[60] = vr4 - (vi3 SHIFT_B); /* Re C' = -(ReC+ReD) + (ReA+ReB) */ + x[57] = ur4 + (ui3 SHIFT_B); /* Im A' = sum of imag values */ + x[61] = ur4 - (ui3 SHIFT_B); /* Im C' = -Im C -Im D +Im A +Im B */ + + vr4 -= x[46]; /* Re A - Re B */ + ur4 -= x[47]; /* Im A - Im B */ + + x[46] = vr3 - ui2; /* Re D' = -Im C + Im D + Re A - Re B */ + x[47] = vi2 + ur3; /* Im D'= Re C - Re D + Im A - Im B */ + + vi3 = (vi3 SHIFT_B)-x[62]; /* Re C - Re D */ + ui3 = (ui3 SHIFT_B)-x[63]; /* Im C - Im D */ + + x[58] = ui3 + vr4; /* Re B' = Im C - Im D + Re A - Re B */ + x[62] = vr4 - ui3; /* Re D' = -Im C + Im D + Re A - Re B */ + x[59] = ur4 - vi3; /* Im B'= -Re C + Re D + Im A - Im B */ + x[63] = vi3 + ur4; /* Im D'= Re C - Re D + Im A - Im B */ + } + + { + FIXP_DBL *xt = _x; + + int j = 4; + do { + FIXP_DBL vi, ui, vr, ur; + + vr = xt[8]; + vi = xt[9]; + ur = xt[0] >> 1; + ui = xt[1] >> 1; + xt[0] = ur + (vr >> 1); + xt[1] = ui + (vi >> 1); + xt[8] = ur - (vr >> 1); + xt[9] = ui - (vi >> 1); + + vr = xt[13]; + vi = xt[12]; + ur = xt[4] >> 1; + ui = xt[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, xt[10], xt[11]) + ur = xt[2]; + ui = xt[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, xt[14], xt[15]) + ur = xt[6]; + ui = xt[7]; + + xt[6] = (ur >> 1) + vr; + xt[7] = (ui >> 1) - vi; + xt[14] = (ur >> 1) - vr; + xt[15] = (ui >> 1) + vi; + xt += 16; + } while (--j != 0); + } + + { + FIXP_DBL *const x = _x; + FIXP_DBL vi, ui, vr, ur; + + 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 coefficient vector. + * \param pVecIm imaginary part of rotation coefficient vector. + */ + +/* + This defines patches each inaccurate 0x7FFF i.e. 0.9999 and uses 0x8000 + (-1.0) instead. At the end, the sign of the result is inverted +*/ +#define noFFT_APPLY_ROT_VECTOR_HQ + +#ifndef FUNCTION_fft_apply_rot_vector__FIXP_DBL +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); + } + } +} +#endif /* FUNCTION_fft_apply_rot_vector__FIXP_DBL */ + +/* select either switch case of function pointer. */ +//#define FFT_TWO_STAGE_SWITCH_CASE +#ifndef FUNCTION_fftN2_func +static inline void fftN2_func(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, FIXP_DBL *aDst, + FIXP_DBL *aDst2) { + /* 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; + + 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 < dim2; i++) { + for (int j = 0; j < dim1; 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 2: + fft2(pDst); + break; + case 3: + fft3(pDst); + break; + case 4: + fft_4(pDst); + break; + /* case 5: fft5(pDst); break; */ + /* case 8: fft_8(pDst); break; */ + case 12: + fft12(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 * dim1; + } + + /* Perform the modulation of the output of the fft of length dim1 */ + pSrc = aDst; + fft_apply_rot_vector(pSrc, 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. + */ + pSrc = aDst; + pDst = aDst2; + pDstOut = pInput; + for (i = 0; i < dim1; i++) { + for (int j = 0; j < dim2; 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 4: + fft_4(pDst); + break; + case 9: + fft9(pDst); + break; + case 12: + fft12(pDst); + break; + case 15: + fft15(pDst); + break; + case 16: + fft_16(pDst); + break; + case 32: + fft_32(pDst); + break; + } +#endif + + for (int 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; + } +} +#endif /* FUNCTION_fftN2_function */ + +#define fftN2(DATA_TYPE, pInput, length, dim1, dim2, fft_func1, fft_func2, \ + RotVectorReal, RotVectorImag) \ + { \ + C_AALLOC_SCRATCH_START(aDst, DATA_TYPE, 2 * length) \ + C_AALLOC_SCRATCH_START(aDst2, DATA_TYPE, 2 * dim2) \ + fftN2_func(pInput, length, dim1, dim2, fft_func1, fft_func2, \ + RotVectorReal, RotVectorImag, aDst, aDst2); \ + C_AALLOC_SCRATCH_END(aDst2, DATA_TYPE, 2 * dim2) \ + C_AALLOC_SCRATCH_END(aDst, DATA_TYPE, 2 * length) \ + } + + /*! + * + * \brief complex FFT of length 12,18,24,30,48,60,96, 192, 240, 384, 480 + * \param pInput contains the input signal prescaled right by 2 + * pInput contains the output signal scaled by SCALEFACTOR<#length> + * The output signal does not have any fixed headroom + * \return void + * + */ + +#ifndef FUNCTION_fft6 +static inline void fft6(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 6, 2, 3, fft2, fft3, RotVectorReal6, RotVectorImag6); +} +#endif /* #ifndef FUNCTION_fft6 */ + +#ifndef FUNCTION_fft12 +static inline void fft12(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 12, 3, 4, fft3, fft_4, RotVectorReal12, + RotVectorImag12); /* 16,58 */ +} +#endif /* #ifndef FUNCTION_fft12 */ + +#ifndef FUNCTION_fft20 +static inline void fft20(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 20, 4, 5, fft_4, fft5, RotVectorReal20, + RotVectorImag20); +} +#endif /* FUNCTION_fft20 */ + +static inline void fft24(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 24, 2, 12, fft2, fft12, RotVectorReal24, + RotVectorImag24); /* 16,73 */ +} + +static inline void fft48(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 48, 4, 12, fft_4, fft12, RotVectorReal48, + RotVectorImag48); /* 16,32 */ +} + +#ifndef FUNCTION_fft60 +static inline void fft60(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 60, 4, 15, fft_4, fft15, RotVectorReal60, + RotVectorImag60); /* 15,51 */ +} +#endif /* FUNCTION_fft60 */ + +#ifndef FUNCTION_fft80 +static inline void fft80(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 80, 5, 16, fft5, fft_16, RotVectorReal80, + RotVectorImag80); /* */ +} +#endif + +#ifndef FUNCTION_fft96 +static inline void fft96(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 96, 3, 32, fft3, fft_32, RotVectorReal96, + RotVectorImag96); /* 15,47 */ +} +#endif /* FUNCTION_fft96*/ + +#ifndef FUNCTION_fft120 +static inline void fft120(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 120, 8, 15, fft_8, fft15, RotVectorReal120, + RotVectorImag120); +} +#endif /* FUNCTION_fft120 */ + +#ifndef FUNCTION_fft192 +static inline void fft192(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 192, 16, 12, fft_16, fft12, RotVectorReal192, + RotVectorImag192); /* 15,50 */ +} +#endif + +#ifndef FUNCTION_fft240 +static inline void fft240(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 240, 16, 15, fft_16, fft15, RotVectorReal240, + RotVectorImag240); /* 15.44 */ +} +#endif + +#ifndef FUNCTION_fft384 +static inline void fft384(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 384, 12, 32, fft12, fft_32, RotVectorReal384, + RotVectorImag384); /* 16.02 */ +} +#endif /* FUNCTION_fft384 */ + +#ifndef FUNCTION_fft480 +static inline void fft480(FIXP_DBL *pInput) { + fftN2(FIXP_DBL, pInput, 480, 32, 15, fft_32, fft15, RotVectorReal480, + RotVectorImag480); /* 15.84 */ +} +#endif /* FUNCTION_fft480 */ + +void fft(int length, FIXP_DBL *pInput, INT *pScalefactor) { + /* Ensure, that the io-ptr is always (at least 8-byte) aligned */ + C_ALLOC_ALIGNED_CHECK(pInput); + + 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 2: + fft2(pInput); + *pScalefactor += SCALEFACTOR2; + break; + case 3: + fft3(pInput); + *pScalefactor += SCALEFACTOR3; + break; + case 4: + fft_4(pInput); + *pScalefactor += SCALEFACTOR4; + break; + case 5: + fft5(pInput); + *pScalefactor += SCALEFACTOR5; + break; + case 6: + fft6(pInput); + *pScalefactor += SCALEFACTOR6; + break; + case 10: + fft10(pInput); + *pScalefactor += SCALEFACTOR10; + break; + case 12: + fft12(pInput); + *pScalefactor += SCALEFACTOR12; + break; + case 15: + fft15(pInput); + *pScalefactor += SCALEFACTOR15; + break; + case 20: + fft20(pInput); + *pScalefactor += SCALEFACTOR20; + break; + case 24: + fft24(pInput); + *pScalefactor += SCALEFACTOR24; + break; + case 48: + fft48(pInput); + *pScalefactor += SCALEFACTOR48; + break; + case 60: + fft60(pInput); + *pScalefactor += SCALEFACTOR60; + break; + case 64: + dit_fft(pInput, 6, SineTable512, 512); + *pScalefactor += SCALEFACTOR64; + break; + case 80: + fft80(pInput); + *pScalefactor += SCALEFACTOR80; + break; + case 96: + fft96(pInput); + *pScalefactor += SCALEFACTOR96; + break; + case 120: + fft120(pInput); + *pScalefactor += SCALEFACTOR120; + break; + case 128: + dit_fft(pInput, 7, SineTable512, 512); + *pScalefactor += SCALEFACTOR128; + break; + case 192: + fft192(pInput); + *pScalefactor += SCALEFACTOR192; + break; + case 240: + fft240(pInput); + *pScalefactor += SCALEFACTOR240; + break; + case 256: + dit_fft(pInput, 8, SineTable512, 512); + *pScalefactor += SCALEFACTOR256; + break; + case 384: + fft384(pInput); + *pScalefactor += SCALEFACTOR384; + break; + case 480: + fft480(pInput); + *pScalefactor += SCALEFACTOR480; + 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/fdk-aac/libFDK/src/fft_rad2.cpp b/fdk-aac/libFDK/src/fft_rad2.cpp new file mode 100644 index 0000000..27f3aa0 --- /dev/null +++ b/fdk-aac/libFDK/src/fft_rad2.cpp @@ -0,0 +1,324 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Lohwasser, M. Gayer + + Description: + +*******************************************************************************/ + +#include "fft_rad2.h" + +#include "scramble.h" + +#define __FFT_RAD2_CPP__ + +#if defined(__arm__) +#include "arm/fft_rad2_arm.cpp" + +#elif defined(__GNUC__) && defined(__mips__) && defined(__mips_dsp) +#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; + + C_ALLOC_ALIGNED_CHECK(x); + + 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. */ + { /* block 1 */ + + 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; + } + + } /* end of block 1 */ + + 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; + } + } + + { /* block 2 */ + 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; + } + } /* end of block 2 */ + } +} + +#endif diff --git a/fdk-aac/libFDK/src/fixpoint_math.cpp b/fdk-aac/libFDK/src/fixpoint_math.cpp new file mode 100644 index 0000000..6c656fa --- /dev/null +++ b/fdk-aac/libFDK/src/fixpoint_math.cpp @@ -0,0 +1,900 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): M. Gayer + + Description: Fixed point specific mathematical functions + +*******************************************************************************/ + +#include "fixpoint_math.h" + +/* + * Hardware specific implementations + */ + +/* + * Fallback implementations + */ + +/***************************************************************************** + 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] = fLog2(srcVector[i], 0); + } +} + +#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 +RAM_ALIGN +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 +RAM_ALIGN +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: 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. + +*****************************************************************************/ +/* Date: 06-JULY-2012 Arthur Tritthart, IIS Fraunhofer Erlangen */ +/* Version with 3 table lookup and 1 linear interpolations */ +/* Algorithm: compute power of 2, argument x is in Q7.25 format */ +/* result = 2^(x/64) */ +/* We split exponent (x/64) into 5 components: */ +/* integer part: represented by b31..b25 (exp) */ +/* fractional part 1: represented by b24..b20 (lookup1) */ +/* fractional part 2: represented by b19..b15 (lookup2) */ +/* fractional part 3: represented by b14..b10 (lookup3) */ +/* fractional part 4: represented by b09..b00 (frac) */ +/* => result = (lookup1*lookup2*(lookup3+C1*frac)<<3)>>exp */ +/* Due to the fact, that all lookup values contain a factor 0.5 */ +/* the result has to be shifted by 3 to the right also. */ +/* Table exp2_tab_long contains the log2 for 0 to 1.0 in steps */ +/* of 1/32, table exp2w_tab_long the log2 for 0 to 1/32 in steps*/ +/* of 1/1024, table exp2x_tab_long the log2 for 0 to 1/1024 in */ +/* steps of 1/32768. Since the 2-logarithm of very very small */ +/* negative value is rather linear, we can use interpolation. */ +/* Limitations: */ +/* For x <= 0, the result is fractional positive */ +/* For x > 0, the result is integer in range 1...7FFF.FFFF */ +/* For x < -31/64, we have to clear the result */ +/* For x = 0, the result is ~1.0 (0x7FFF.FFFF) */ +/* For x >= 31/64, the result is 0x7FFF.FFFF */ + +/* This table is used for lookup 2^x with */ +/* x in range [0...1.0[ in steps of 1/32 */ +LNK_SECTION_DATA_L1 +const UINT exp2_tab_long[32] = { + 0x40000000, 0x4166C34C, 0x42D561B4, 0x444C0740, 0x45CAE0F2, 0x47521CC6, + 0x48E1E9BA, 0x4A7A77D4, 0x4C1BF829, 0x4DC69CDD, 0x4F7A9930, 0x51382182, + 0x52FF6B55, 0x54D0AD5A, 0x56AC1F75, 0x5891FAC1, 0x5A82799A, 0x5C7DD7A4, + 0x5E8451D0, 0x60962665, 0x62B39509, 0x64DCDEC3, 0x6712460B, 0x69540EC9, + 0x6BA27E65, 0x6DFDDBCC, 0x70666F76, 0x72DC8374, 0x75606374, 0x77F25CCE, + 0x7A92BE8B, 0x7D41D96E + // 0x80000000 +}; + +/* This table is used for lookup 2^x with */ +/* x in range [0...1/32[ in steps of 1/1024 */ +LNK_SECTION_DATA_L1 +const UINT exp2w_tab_long[32] = { + 0x40000000, 0x400B1818, 0x4016321B, 0x40214E0C, 0x402C6BE9, 0x40378BB4, + 0x4042AD6D, 0x404DD113, 0x4058F6A8, 0x40641E2B, 0x406F479E, 0x407A7300, + 0x4085A051, 0x4090CF92, 0x409C00C4, 0x40A733E6, 0x40B268FA, 0x40BD9FFF, + 0x40C8D8F5, 0x40D413DD, 0x40DF50B8, 0x40EA8F86, 0x40F5D046, 0x410112FA, + 0x410C57A2, 0x41179E3D, 0x4122E6CD, 0x412E3152, 0x41397DCC, 0x4144CC3B, + 0x41501CA0, 0x415B6EFB, + // 0x4166C34C, +}; +/* This table is used for lookup 2^x with */ +/* x in range [0...1/1024[ in steps of 1/32768 */ +LNK_SECTION_DATA_L1 +const UINT exp2x_tab_long[32] = { + 0x40000000, 0x400058B9, 0x4000B173, 0x40010A2D, 0x400162E8, 0x4001BBA3, + 0x4002145F, 0x40026D1B, 0x4002C5D8, 0x40031E95, 0x40037752, 0x4003D011, + 0x400428CF, 0x4004818E, 0x4004DA4E, 0x4005330E, 0x40058BCE, 0x4005E48F, + 0x40063D51, 0x40069613, 0x4006EED5, 0x40074798, 0x4007A05B, 0x4007F91F, + 0x400851E4, 0x4008AAA8, 0x4009036E, 0x40095C33, 0x4009B4FA, 0x400A0DC0, + 0x400A6688, 0x400ABF4F, + // 0x400B1818 +}; + +/***************************************************************************** + functionname: InitLdInt and CalcLdInt + description: Create and access table with integer LdData (0 to +LD_INT_TAB_LEN) +*****************************************************************************/ +#ifndef LD_INT_TAB_LEN +#define LD_INT_TAB_LEN \ + 193 /* Default tab length. Lower value should be set in fix.h */ +#endif + +#if (LD_INT_TAB_LEN <= 120) +LNK_SECTION_CONSTDATA_L1 +static const FIXP_DBL ldIntCoeff[] = { + (FIXP_DBL)0x80000001, (FIXP_DBL)0x00000000, (FIXP_DBL)0x02000000, + (FIXP_DBL)0x032b8034, (FIXP_DBL)0x04000000, (FIXP_DBL)0x04a4d3c2, + (FIXP_DBL)0x052b8034, (FIXP_DBL)0x059d5da0, (FIXP_DBL)0x06000000, + (FIXP_DBL)0x06570069, (FIXP_DBL)0x06a4d3c2, (FIXP_DBL)0x06eb3a9f, + (FIXP_DBL)0x072b8034, (FIXP_DBL)0x0766a009, (FIXP_DBL)0x079d5da0, + (FIXP_DBL)0x07d053f7, (FIXP_DBL)0x08000000, (FIXP_DBL)0x082cc7ee, + (FIXP_DBL)0x08570069, (FIXP_DBL)0x087ef05b, (FIXP_DBL)0x08a4d3c2, + (FIXP_DBL)0x08c8ddd4, (FIXP_DBL)0x08eb3a9f, (FIXP_DBL)0x090c1050, + (FIXP_DBL)0x092b8034, (FIXP_DBL)0x0949a785, (FIXP_DBL)0x0966a009, + (FIXP_DBL)0x0982809d, (FIXP_DBL)0x099d5da0, (FIXP_DBL)0x09b74949, + (FIXP_DBL)0x09d053f7, (FIXP_DBL)0x09e88c6b, (FIXP_DBL)0x0a000000, + (FIXP_DBL)0x0a16bad3, (FIXP_DBL)0x0a2cc7ee, (FIXP_DBL)0x0a423162, + (FIXP_DBL)0x0a570069, (FIXP_DBL)0x0a6b3d79, (FIXP_DBL)0x0a7ef05b, + (FIXP_DBL)0x0a92203d, (FIXP_DBL)0x0aa4d3c2, (FIXP_DBL)0x0ab7110e, + (FIXP_DBL)0x0ac8ddd4, (FIXP_DBL)0x0ada3f60, (FIXP_DBL)0x0aeb3a9f, + (FIXP_DBL)0x0afbd42b, (FIXP_DBL)0x0b0c1050, (FIXP_DBL)0x0b1bf312, + (FIXP_DBL)0x0b2b8034, (FIXP_DBL)0x0b3abb40, (FIXP_DBL)0x0b49a785, + (FIXP_DBL)0x0b584822, (FIXP_DBL)0x0b66a009, (FIXP_DBL)0x0b74b1fd, + (FIXP_DBL)0x0b82809d, (FIXP_DBL)0x0b900e61, (FIXP_DBL)0x0b9d5da0, + (FIXP_DBL)0x0baa708f, (FIXP_DBL)0x0bb74949, (FIXP_DBL)0x0bc3e9ca, + (FIXP_DBL)0x0bd053f7, (FIXP_DBL)0x0bdc899b, (FIXP_DBL)0x0be88c6b, + (FIXP_DBL)0x0bf45e09, (FIXP_DBL)0x0c000000, (FIXP_DBL)0x0c0b73cb, + (FIXP_DBL)0x0c16bad3, (FIXP_DBL)0x0c21d671, (FIXP_DBL)0x0c2cc7ee, + (FIXP_DBL)0x0c379085, (FIXP_DBL)0x0c423162, (FIXP_DBL)0x0c4caba8, + (FIXP_DBL)0x0c570069, (FIXP_DBL)0x0c6130af, (FIXP_DBL)0x0c6b3d79, + (FIXP_DBL)0x0c7527b9, (FIXP_DBL)0x0c7ef05b, (FIXP_DBL)0x0c88983f, + (FIXP_DBL)0x0c92203d, (FIXP_DBL)0x0c9b8926, (FIXP_DBL)0x0ca4d3c2, + (FIXP_DBL)0x0cae00d2, (FIXP_DBL)0x0cb7110e, (FIXP_DBL)0x0cc0052b, + (FIXP_DBL)0x0cc8ddd4, (FIXP_DBL)0x0cd19bb0, (FIXP_DBL)0x0cda3f60, + (FIXP_DBL)0x0ce2c97d, (FIXP_DBL)0x0ceb3a9f, (FIXP_DBL)0x0cf39355, + (FIXP_DBL)0x0cfbd42b, (FIXP_DBL)0x0d03fda9, (FIXP_DBL)0x0d0c1050, + (FIXP_DBL)0x0d140ca0, (FIXP_DBL)0x0d1bf312, (FIXP_DBL)0x0d23c41d, + (FIXP_DBL)0x0d2b8034, (FIXP_DBL)0x0d3327c7, (FIXP_DBL)0x0d3abb40, + (FIXP_DBL)0x0d423b08, (FIXP_DBL)0x0d49a785, (FIXP_DBL)0x0d510118, + (FIXP_DBL)0x0d584822, (FIXP_DBL)0x0d5f7cff, (FIXP_DBL)0x0d66a009, + (FIXP_DBL)0x0d6db197, (FIXP_DBL)0x0d74b1fd, (FIXP_DBL)0x0d7ba190, + (FIXP_DBL)0x0d82809d, (FIXP_DBL)0x0d894f75, (FIXP_DBL)0x0d900e61, + (FIXP_DBL)0x0d96bdad, (FIXP_DBL)0x0d9d5da0, (FIXP_DBL)0x0da3ee7f, + (FIXP_DBL)0x0daa708f, (FIXP_DBL)0x0db0e412, (FIXP_DBL)0x0db74949, + (FIXP_DBL)0x0dbda072, (FIXP_DBL)0x0dc3e9ca, (FIXP_DBL)0x0dca258e}; + +#elif (LD_INT_TAB_LEN <= 193) +LNK_SECTION_CONSTDATA_L1 +static const FIXP_DBL ldIntCoeff[] = { + (FIXP_DBL)0x80000001, (FIXP_DBL)0x00000000, (FIXP_DBL)0x02000000, + (FIXP_DBL)0x032b8034, (FIXP_DBL)0x04000000, (FIXP_DBL)0x04a4d3c2, + (FIXP_DBL)0x052b8034, (FIXP_DBL)0x059d5da0, (FIXP_DBL)0x06000000, + (FIXP_DBL)0x06570069, (FIXP_DBL)0x06a4d3c2, (FIXP_DBL)0x06eb3a9f, + (FIXP_DBL)0x072b8034, (FIXP_DBL)0x0766a009, (FIXP_DBL)0x079d5da0, + (FIXP_DBL)0x07d053f7, (FIXP_DBL)0x08000000, (FIXP_DBL)0x082cc7ee, + (FIXP_DBL)0x08570069, (FIXP_DBL)0x087ef05b, (FIXP_DBL)0x08a4d3c2, + (FIXP_DBL)0x08c8ddd4, (FIXP_DBL)0x08eb3a9f, (FIXP_DBL)0x090c1050, + (FIXP_DBL)0x092b8034, (FIXP_DBL)0x0949a785, (FIXP_DBL)0x0966a009, + (FIXP_DBL)0x0982809d, (FIXP_DBL)0x099d5da0, (FIXP_DBL)0x09b74949, + (FIXP_DBL)0x09d053f7, (FIXP_DBL)0x09e88c6b, (FIXP_DBL)0x0a000000, + (FIXP_DBL)0x0a16bad3, (FIXP_DBL)0x0a2cc7ee, (FIXP_DBL)0x0a423162, + (FIXP_DBL)0x0a570069, (FIXP_DBL)0x0a6b3d79, (FIXP_DBL)0x0a7ef05b, + (FIXP_DBL)0x0a92203d, (FIXP_DBL)0x0aa4d3c2, (FIXP_DBL)0x0ab7110e, + (FIXP_DBL)0x0ac8ddd4, (FIXP_DBL)0x0ada3f60, (FIXP_DBL)0x0aeb3a9f, + (FIXP_DBL)0x0afbd42b, (FIXP_DBL)0x0b0c1050, (FIXP_DBL)0x0b1bf312, + (FIXP_DBL)0x0b2b8034, (FIXP_DBL)0x0b3abb40, (FIXP_DBL)0x0b49a785, + (FIXP_DBL)0x0b584822, (FIXP_DBL)0x0b66a009, (FIXP_DBL)0x0b74b1fd, + (FIXP_DBL)0x0b82809d, (FIXP_DBL)0x0b900e61, (FIXP_DBL)0x0b9d5da0, + (FIXP_DBL)0x0baa708f, (FIXP_DBL)0x0bb74949, (FIXP_DBL)0x0bc3e9ca, + (FIXP_DBL)0x0bd053f7, (FIXP_DBL)0x0bdc899b, (FIXP_DBL)0x0be88c6b, + (FIXP_DBL)0x0bf45e09, (FIXP_DBL)0x0c000000, (FIXP_DBL)0x0c0b73cb, + (FIXP_DBL)0x0c16bad3, (FIXP_DBL)0x0c21d671, (FIXP_DBL)0x0c2cc7ee, + (FIXP_DBL)0x0c379085, (FIXP_DBL)0x0c423162, (FIXP_DBL)0x0c4caba8, + (FIXP_DBL)0x0c570069, (FIXP_DBL)0x0c6130af, (FIXP_DBL)0x0c6b3d79, + (FIXP_DBL)0x0c7527b9, (FIXP_DBL)0x0c7ef05b, (FIXP_DBL)0x0c88983f, + (FIXP_DBL)0x0c92203d, (FIXP_DBL)0x0c9b8926, (FIXP_DBL)0x0ca4d3c2, + (FIXP_DBL)0x0cae00d2, (FIXP_DBL)0x0cb7110e, (FIXP_DBL)0x0cc0052b, + (FIXP_DBL)0x0cc8ddd4, (FIXP_DBL)0x0cd19bb0, (FIXP_DBL)0x0cda3f60, + (FIXP_DBL)0x0ce2c97d, (FIXP_DBL)0x0ceb3a9f, (FIXP_DBL)0x0cf39355, + (FIXP_DBL)0x0cfbd42b, (FIXP_DBL)0x0d03fda9, (FIXP_DBL)0x0d0c1050, + (FIXP_DBL)0x0d140ca0, (FIXP_DBL)0x0d1bf312, (FIXP_DBL)0x0d23c41d, + (FIXP_DBL)0x0d2b8034, (FIXP_DBL)0x0d3327c7, (FIXP_DBL)0x0d3abb40, + (FIXP_DBL)0x0d423b08, (FIXP_DBL)0x0d49a785, (FIXP_DBL)0x0d510118, + (FIXP_DBL)0x0d584822, (FIXP_DBL)0x0d5f7cff, (FIXP_DBL)0x0d66a009, + (FIXP_DBL)0x0d6db197, (FIXP_DBL)0x0d74b1fd, (FIXP_DBL)0x0d7ba190, + (FIXP_DBL)0x0d82809d, (FIXP_DBL)0x0d894f75, (FIXP_DBL)0x0d900e61, + (FIXP_DBL)0x0d96bdad, (FIXP_DBL)0x0d9d5da0, (FIXP_DBL)0x0da3ee7f, + (FIXP_DBL)0x0daa708f, (FIXP_DBL)0x0db0e412, (FIXP_DBL)0x0db74949, + (FIXP_DBL)0x0dbda072, (FIXP_DBL)0x0dc3e9ca, (FIXP_DBL)0x0dca258e, + (FIXP_DBL)0x0dd053f7, (FIXP_DBL)0x0dd6753e, (FIXP_DBL)0x0ddc899b, + (FIXP_DBL)0x0de29143, (FIXP_DBL)0x0de88c6b, (FIXP_DBL)0x0dee7b47, + (FIXP_DBL)0x0df45e09, (FIXP_DBL)0x0dfa34e1, (FIXP_DBL)0x0e000000, + (FIXP_DBL)0x0e05bf94, (FIXP_DBL)0x0e0b73cb, (FIXP_DBL)0x0e111cd2, + (FIXP_DBL)0x0e16bad3, (FIXP_DBL)0x0e1c4dfb, (FIXP_DBL)0x0e21d671, + (FIXP_DBL)0x0e275460, (FIXP_DBL)0x0e2cc7ee, (FIXP_DBL)0x0e323143, + (FIXP_DBL)0x0e379085, (FIXP_DBL)0x0e3ce5d8, (FIXP_DBL)0x0e423162, + (FIXP_DBL)0x0e477346, (FIXP_DBL)0x0e4caba8, (FIXP_DBL)0x0e51daa8, + (FIXP_DBL)0x0e570069, (FIXP_DBL)0x0e5c1d0b, (FIXP_DBL)0x0e6130af, + (FIXP_DBL)0x0e663b74, (FIXP_DBL)0x0e6b3d79, (FIXP_DBL)0x0e7036db, + (FIXP_DBL)0x0e7527b9, (FIXP_DBL)0x0e7a1030, (FIXP_DBL)0x0e7ef05b, + (FIXP_DBL)0x0e83c857, (FIXP_DBL)0x0e88983f, (FIXP_DBL)0x0e8d602e, + (FIXP_DBL)0x0e92203d, (FIXP_DBL)0x0e96d888, (FIXP_DBL)0x0e9b8926, + (FIXP_DBL)0x0ea03232, (FIXP_DBL)0x0ea4d3c2, (FIXP_DBL)0x0ea96df0, + (FIXP_DBL)0x0eae00d2, (FIXP_DBL)0x0eb28c7f, (FIXP_DBL)0x0eb7110e, + (FIXP_DBL)0x0ebb8e96, (FIXP_DBL)0x0ec0052b, (FIXP_DBL)0x0ec474e4, + (FIXP_DBL)0x0ec8ddd4, (FIXP_DBL)0x0ecd4012, (FIXP_DBL)0x0ed19bb0, + (FIXP_DBL)0x0ed5f0c4, (FIXP_DBL)0x0eda3f60, (FIXP_DBL)0x0ede8797, + (FIXP_DBL)0x0ee2c97d, (FIXP_DBL)0x0ee70525, (FIXP_DBL)0x0eeb3a9f, + (FIXP_DBL)0x0eef69ff, (FIXP_DBL)0x0ef39355, (FIXP_DBL)0x0ef7b6b4, + (FIXP_DBL)0x0efbd42b, (FIXP_DBL)0x0effebcd, (FIXP_DBL)0x0f03fda9, + (FIXP_DBL)0x0f0809cf, (FIXP_DBL)0x0f0c1050, (FIXP_DBL)0x0f10113b, + (FIXP_DBL)0x0f140ca0, (FIXP_DBL)0x0f18028d, (FIXP_DBL)0x0f1bf312, + (FIXP_DBL)0x0f1fde3d, (FIXP_DBL)0x0f23c41d, (FIXP_DBL)0x0f27a4c0, + (FIXP_DBL)0x0f2b8034}; + +#else +#error "ldInt table size too small" + +#endif + +LNK_SECTION_INITCODE +void InitLdInt() { /* nothing to do! Use preinitialized logarithm table */ +} + +#if (LD_INT_TAB_LEN != 0) + +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 LD_INT_TAB_LEN */ + + FDK_ASSERT((LD_INT_TAB_LEN > 0) && + ((FIXP_DBL)ldIntCoeff[0] == + (FIXP_DBL)0x80000001)); /* tab has to be initialized */ + + if ((i > 0) && (i < LD_INT_TAB_LEN)) + return ldIntCoeff[i]; + else { + return (0); + } +} +#endif /* (LD_INT_TAB_LEN!=0) */ + +#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; + + if ((f1 == (FIXP_DBL)MINVAL_DBL) && (f2 == (FIXP_DBL)MINVAL_DBL)) { + product = -((FIXP_DBL)MINVAL_DBL >> 1); + *result_e = -(norm_f1 + norm_f2 - 1); + } else { + 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_fDivNormSigned +FIXP_DBL fDivNormSigned(FIXP_DBL num, FIXP_DBL denom) { + INT e; + FIXP_DBL res; + int sign; + + if (denom == (FIXP_DBL)0) { + return (FIXP_DBL)MAXVAL_DBL; + } + + sign = ((num >= (FIXP_DBL)0) != (denom >= (FIXP_DBL)0)); + res = fDivNormSigned(num, denom, &e); + + /* Saturate since we must output a value with exponent 0 */ + if ((e > 0) && (fAbs(res) >= FL2FXCONST_DBL(0.5))) { + if (sign) { + res = (FIXP_DBL)MINVAL_DBL; + } else { + res = (FIXP_DBL)MAXVAL_DBL; + } + } else { + res = scaleValue(res, e); + } + + return res; +} +FIXP_DBL fDivNormSigned(FIXP_DBL L_num, FIXP_DBL L_denum, INT *result_e) { + FIXP_DBL div; + INT norm_num, norm_den; + int sign; + + sign = ((L_num >= (FIXP_DBL)0) != (L_denum >= (FIXP_DBL)0)); + + if (L_num == (FIXP_DBL)0) { + *result_e = 0; + return ((FIXP_DBL)0); + } + if (L_denum == (FIXP_DBL)0) { + *result_e = 14; + return ((FIXP_DBL)MAXVAL_DBL); + } + + norm_num = CountLeadingBits(L_num); + L_num = L_num << norm_num; + L_num = L_num >> 2; + L_num = fAbs(L_num); + *result_e = -norm_num + 1; + + norm_den = CountLeadingBits(L_denum); + L_denum = L_denum << norm_den; + L_denum = L_denum >> 1; + L_denum = fAbs(L_denum); + *result_e -= -norm_den; + + div = schur_div(L_num, L_denum, FRACT_BITS); + + if (sign) { + div = -div; + } + + return div; +} +#endif /* FUNCTION_fDivNormSigned */ + +#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 */ + +#ifndef FUNCTION_fPow +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); + } + + /* "+ 1" compensates fMultAddDiv2() of the polynomial evaluation below. */ + *result_e = int_part + 1; + + /* 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); + } + } + 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; +} +#endif /* FUNCTION_fPow */ + +#ifndef FUNCTION_fLog2 +FIXP_DBL CalcLog2(FIXP_DBL base_m, INT base_e, INT *result_e) { + return fLog2(base_m, base_e, result_e); +} +#endif /* FUNCTION_fLog2 */ + +INT fixp_floorToInt(FIXP_DBL f_inp, INT sf) { + FDK_ASSERT(sf >= 0); + INT floorInt = (INT)(f_inp >> ((DFRACT_BITS - 1) - sf)); + return floorInt; +} + +FIXP_DBL fixp_floor(FIXP_DBL f_inp, INT sf) { + FDK_ASSERT(sf >= 0); + INT floorInt = fixp_floorToInt(f_inp, sf); + FIXP_DBL f_floor = (FIXP_DBL)(floorInt << ((DFRACT_BITS - 1) - sf)); + return f_floor; +} + +INT fixp_ceilToInt(FIXP_DBL f_inp, INT sf) // sf mantissaBits left of dot +{ + FDK_ASSERT(sf >= 0); + INT sx = (DFRACT_BITS - 1) - sf; // sx mantissaBits right of dot + INT inpINT = (INT)f_inp; + + INT mask = (0x1 << sx) - 1; + INT ceilInt = (INT)(f_inp >> sx); + + if (inpINT & mask) { + ceilInt++; // increment only, if there is at least one set mantissaBit + // right of dot [in inpINT] + } + + return ceilInt; +} + +FIXP_DBL fixp_ceil(FIXP_DBL f_inp, INT sf) { + FDK_ASSERT(sf >= 0); + INT sx = (DFRACT_BITS - 1) - sf; + INT ceilInt = fixp_ceilToInt(f_inp, sf); + ULONG mask = (ULONG)0x1 << (DFRACT_BITS - 1); // 0x80000000 + ceilInt = ceilInt + << sx; // no fract warn bec. shift into saturation done on int side + + if ((f_inp > FL2FXCONST_DBL(0.0f)) && (ceilInt & mask)) { + --ceilInt; + } + FIXP_DBL f_ceil = (FIXP_DBL)ceilInt; + + return f_ceil; +} + +/***************************************************************************** + fixp_truncateToInt() + Just remove the fractional part which is located right of decimal point + Same as which is done when a float is casted to (INT) : + result_INTtype = (INT)b_floatTypeInput; + + returns INT +*****************************************************************************/ +INT fixp_truncateToInt(FIXP_DBL f_inp, INT sf) // sf mantissaBits left of dot + // (without sign) e.g. at width + // 32 this would be [sign]7. + // supposed sf equals 8. +{ + FDK_ASSERT(sf >= 0); + INT sx = (DFRACT_BITS - 1) - sf; // sx mantissaBits right of dot + // at width 32 this would be .24 + // supposed sf equals 8. + INT fbaccu = (INT)f_inp; + INT mask = (0x1 << sx); + + if ((fbaccu < 0) && (fbaccu & (mask - 1))) { + fbaccu = fbaccu + mask; + } + + fbaccu = fbaccu >> sx; + return fbaccu; +} + +/***************************************************************************** + fixp_truncate() + Just remove the fractional part which is located right of decimal point + + returns FIXP_DBL +*****************************************************************************/ +FIXP_DBL fixp_truncate(FIXP_DBL f_inp, INT sf) { + FDK_ASSERT(sf >= 0); + INT truncateInt = fixp_truncateToInt(f_inp, sf); + FIXP_DBL f_truncate = (FIXP_DBL)(truncateInt << ((DFRACT_BITS - 1) - sf)); + return f_truncate; +} + +/***************************************************************************** + fixp_roundToInt() + round [typical rounding] + + See fct roundRef() [which is the reference] + returns INT +*****************************************************************************/ +INT fixp_roundToInt(FIXP_DBL f_inp, INT sf) { + FDK_ASSERT(sf >= 0); + INT sx = DFRACT_BITS - 1 - sf; + INT inp = (INT)f_inp; + INT mask1 = (0x1 << (sx - 1)); + INT mask2 = (0x1 << (sx)) - 1; + INT mask3 = 0x7FFFFFFF; + INT iam = inp & mask2; + INT rnd; + + if ((inp < 0) && !(iam == mask1)) + rnd = inp + mask1; + else if ((inp > 0) && !(inp == mask3)) + rnd = inp + mask1; + else + rnd = inp; + + rnd = rnd >> sx; + + if (inp == mask3) rnd++; + + return rnd; +} + +/***************************************************************************** + fixp_round() + round [typical rounding] + + See fct roundRef() [which is the reference] + returns FIXP_DBL +*****************************************************************************/ +FIXP_DBL fixp_round(FIXP_DBL f_inp, INT sf) { + FDK_ASSERT(sf >= 0); + INT sx = DFRACT_BITS - 1 - sf; + INT r = fixp_roundToInt(f_inp, sf); + ULONG mask = (ULONG)0x1 << (DFRACT_BITS - 1); // 0x80000000 + r = r << sx; + + if ((f_inp > FL2FXCONST_DBL(0.0f)) && (r & mask)) { + --r; + } + + FIXP_DBL f_round = (FIXP_DBL)r; + return f_round; +} diff --git a/fdk-aac/libFDK/src/huff_nodes.cpp b/fdk-aac/libFDK/src/huff_nodes.cpp new file mode 100644 index 0000000..66dc908 --- /dev/null +++ b/fdk-aac/libFDK/src/huff_nodes.cpp @@ -0,0 +1,1084 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Omer Osman + + Description: MPEG-D SAC/USAC/SAOC Huffman Part0 Tables + +*******************************************************************************/ + +#include "huff_nodes.h" + +const HUFF_PT0_NODES FDK_huffPart0Nodes = { + {{2, 1}, {4, 3}, {6, 5}, {8, 7}, {10, 9}, {12, 11}, + {14, 13}, {-8, 15}, {-9, 16}, {-10, 17}, {-18, 18}, {-17, -19}, + {-16, 19}, {-11, -20}, {-15, -21}, {-7, 20}, {-22, 21}, {-12, -14}, + {-13, -23}, {23, 22}, {-24, -31}, {-6, 24}, {-25, -26}, {26, 25}, + {-5, -27}, {-28, 27}, {-4, 28}, {-29, 29}, {-1, -30}, {-2, -3}}, + {{2, 1}, {-5, 3}, {-4, -6}, {-3, 4}, {-2, 5}, {-1, 6}, {-7, -8}}, + {{-1, 1}, {-8, 2}, {-2, 3}, {5, 4}, {-7, 6}, {-3, -5}, {-4, -6}}, + {{-1, 1}, + {3, 2}, + {-8, 4}, + {6, 5}, + {-16, 7}, + {9, 8}, + {11, 10}, + {-2, -7}, + {-6, 12}, + {-4, -5}, + {-3, 13}, + {-10, 14}, + {-11, -12}, + {-14, -15}, + {-9, -13}}, + {{2, 1}, {4, 3}, {6, 5}, {8, 7}, {10, 9}, {12, 11}, + {14, 13}, {16, 15}, {18, 17}, {20, 19}, {22, 21}, {24, 23}, + {26, 25}, {28, 27}, {30, 29}, {32, 31}, {-47, 33}, {-54, 34}, + {-46, 35}, {-48, 36}, {-23, -27}, {-45, 37}, {-55, 38}, {-22, -49}, + {-24, -53}, {-44, 39}, {-57, 40}, {-28, 41}, {-52, -56}, {-43, 42}, + {-50, 43}, {-25, -26}, {-29, -64}, {-62, 44}, {-21, -51}, {-58, 45}, + {-32, 46}, {-31, -42}, {-60, 47}, {-30, 48}, {-20, -61}, {-41, -63}, + {-19, -59}, {-40, 49}, {-18, -38}, {-39, 50}, {-36, -37}, {-35, 51}, + {-17, 52}, {-16, -34}, {-33, 53}, {-15, 54}, {-14, 55}, {-13, 56}, + {-12, 57}, {-11, 58}, {-10, 59}, {-9, 60}, {-7, 61}, {-1, -4}, + {-6, 62}, {-5, -8}, {-2, -3}}}; + +const HUFF_LAV_NODES FDK_huffLavIdxNodes = {{{-1, 1}, {-2, 2}, {-3, -4}}}; + +static const HUFF_ICC_NOD_1D FDK_huffICCNodes_h1D_0 = { + {{-1, 1}, {-2, 2}, {-3, 3}, {-4, 4}, {-5, 5}, {-6, 6}, {-7, -8}}}; + +static const HUFF_ICC_NOD_2D FDK_huffICCNodes_h2D_0_0 = { + {{-1, 1}, {-18, 2}, {-2, -17}}, + {{2, 1}, + {-1, -52}, + {-2, 3}, + {5, 4}, + {-51, 6}, + {-18, 7}, + {-17, 8}, + {-3, 9}, + {-36, 10}, + {-19, -50}, + {-35, 11}, + {-4, 12}, + {-34, 13}, + {-33, 14}, + {-20, -49}}, + {{2, 1}, {-86, 3}, {-1, 4}, {6, 5}, {-2, 7}, {-85, 8}, + {-18, 9}, {11, 10}, {-17, 12}, {14, 13}, {-70, 15}, {-3, -19}, + {-69, 16}, {-84, 17}, {-68, 18}, {-20, -35}, {-34, -83}, {20, 19}, + {-4, 21}, {-33, 22}, {-5, 23}, {-53, 24}, {-36, -52}, {-67, 25}, + {-21, -82}, {-54, 26}, {-6, 27}, {-51, 28}, {-50, 29}, {-49, 30}, + {-37, 31}, {-38, 0}, {0, 0}, {0, 0}, {0, 0}}, + {{2, 1}, {4, 3}, {-1, -120}, {6, 5}, {8, 7}, {-18, 9}, + {-2, 10}, {12, 11}, {14, 13}, {-17, -119}, {16, 15}, {-103, 17}, + {-104, 18}, {-52, 19}, {21, 20}, {-69, 22}, {24, 23}, {-3, -35}, + {-19, 25}, {-34, -85}, {27, 26}, {-86, 28}, {-118, 29}, {-37, 30}, + {32, 31}, {-102, 33}, {-20, -22}, {-4, -117}, {-87, 34}, {-100, 35}, + {-33, -36}, {37, 36}, {-70, -88}, {-101, 38}, {-5, 39}, {-51, -53}, + {-50, 40}, {-115, 41}, {-21, 42}, {-116, 43}, {-38, 44}, {-23, -84}, + {-49, -99}, {46, 45}, {-6, -114}, {-7, -72}, {-71, 47}, {-8, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}}}; +static const HUFF_ICC_NOD_2D FDK_huffICCNodes_h2D_0_1 = { + {{-1, 1}, {-18, 2}, {-2, -17}}, + {{2, 1}, + {-1, -52}, + {-17, 3}, + {5, 4}, + {-36, 6}, + {-2, 7}, + {-18, -33}, + {9, 8}, + {-20, 10}, + {-34, -51}, + {-49, 11}, + {-35, 12}, + {-19, 13}, + {-3, 14}, + {-4, -50}}, + {{2, 1}, {-86, 3}, {-1, 4}, {-17, 5}, {7, 6}, {-70, 8}, + {-33, 9}, {-18, 10}, {-2, 11}, {-54, 12}, {-49, 13}, {-38, 14}, + {-34, -65}, {-85, 15}, {-50, 16}, {-69, 17}, {-22, 18}, {-53, 19}, + {21, 20}, {-19, -81}, {-66, 22}, {-3, -35}, {24, 23}, {-37, 25}, + {-68, -84}, {-51, 26}, {28, 27}, {-20, -52}, {30, 29}, {-4, -36}, + {-83, 31}, {-67, 32}, {-82, 33}, {-21, 34}, {-5, -6}}, + {{2, 1}, {-1, 3}, {-120, 4}, {-17, 5}, {7, 6}, {-104, 8}, + {-33, 9}, {11, 10}, {13, 12}, {-49, 14}, {-88, 15}, {-18, -97}, + {-65, 16}, {-40, 17}, {-2, -72}, {19, 18}, {-113, 20}, {-34, 21}, + {-56, -81}, {23, 22}, {-50, 24}, {-82, -119}, {-24, -103}, {26, 25}, + {28, 27}, {30, 29}, {-55, -87}, {-66, 31}, {33, 32}, {-98, 34}, + {-35, -67}, {-19, 35}, {-70, 36}, {-71, 37}, {-51, -52}, {-3, 38}, + {40, 39}, {-86, -118}, {42, 41}, {-39, -69}, {-54, -83}, {44, 43}, + {-102, 45}, {-101, 46}, {-68, -85}, {-36, -53}, {-5, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}}}; +static const HUFF_ICC_NOD_2D FDK_huffICCNodes_h2D_1_0 = { + {{-1, 1}, {-18, 2}, {-2, -17}}, + {{-52, 1}, + {-1, 2}, + {4, 3}, + {-2, -17}, + {-18, 5}, + {-36, 6}, + {-51, 7}, + {9, 8}, + {-33, 10}, + {-34, 11}, + {-35, 12}, + {-19, -20}, + {-3, 13}, + {-49, 14}, + {-4, -50}}, + {{-1, 1}, {-86, 2}, {4, 3}, {-17, 5}, {-2, 6}, {-18, 7}, + {-70, 8}, {-85, 9}, {11, 10}, {13, 12}, {-33, 14}, {16, 15}, + {-34, -54}, {-69, 17}, {-38, 18}, {-50, 19}, {-35, -53}, {-49, 20}, + {-19, 21}, {-3, 22}, {-65, 23}, {-68, 24}, {-22, 25}, {-81, -84}, + {-66, 26}, {-37, 27}, {-20, -51}, {29, 28}, {-52, 30}, {-4, -83}, + {-36, 31}, {-67, 32}, {-5, 33}, {-82, 34}, {-21, 0}}, + {{-1, 1}, {-120, 2}, {4, 3}, {-17, 5}, {-2, 6}, {8, 7}, + {-18, 9}, {-104, 10}, {12, 11}, {14, 13}, {16, 15}, {-119, 17}, + {-81, 18}, {20, 19}, {-33, 21}, {-88, 22}, {-103, 23}, {-34, 24}, + {-56, 25}, {-72, 26}, {-49, 27}, {-82, 28}, {-50, 29}, {-65, 30}, + {-55, -87}, {-19, 31}, {-67, 32}, {-35, -40}, {34, 33}, {-52, -71}, + {-66, 35}, {-70, 36}, {38, 37}, {-51, -97}, {-86, -102}, {-3, 39}, + {-118, 40}, {42, 41}, {-24, -85}, {-54, 43}, {-39, 44}, {-98, -113}, + {-36, -37}, {-20, -69}, {-4, 45}, {-5, 46}, {-21, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}}}; +static const HUFF_ICC_NOD_2D FDK_huffICCNodes_h2D_1_1 = { + {{-1, 1}, {-18, 2}, {-2, -17}}, + {{-52, 1}, + {-1, 2}, + {4, 3}, + {-2, 5}, + {-17, -18}, + {-51, 6}, + {-36, 7}, + {9, 8}, + {-35, 10}, + {-3, 11}, + {-19, -34}, + {-33, 12}, + {-50, 13}, + {-20, 14}, + {-4, -49}}, + {{2, 1}, {-86, 3}, {-1, 4}, {6, 5}, {-18, 7}, {-2, -17}, + {9, 8}, {-70, 10}, {-69, -85}, {-35, 11}, {13, 12}, {-34, 14}, + {-19, 15}, {-53, 16}, {-68, 17}, {-33, 18}, {-3, -52}, {20, 19}, + {-54, 21}, {-84, 22}, {-50, 23}, {-20, -51}, {-36, 24}, {26, 25}, + {-83, 27}, {-4, -38}, {-49, 28}, {-37, 29}, {-67, 30}, {-5, 31}, + {-21, 32}, {-65, -66}, {-82, 33}, {-22, 34}, {-6, -81}}, + {{2, 1}, {-1, -120}, {4, 3}, {6, 5}, {-18, 7}, {9, 8}, + {-17, 10}, {-2, 11}, {-103, 12}, {-52, 13}, {-35, -104}, {-119, 14}, + {16, 15}, {-69, -86}, {18, 17}, {-34, 19}, {-19, 20}, {22, 21}, + {-70, 23}, {-87, 24}, {-102, 25}, {-85, 26}, {-33, 27}, {-36, 28}, + {-3, 29}, {-88, 30}, {-51, 31}, {-118, 32}, {34, 33}, {-68, 35}, + {-53, 36}, {-67, 37}, {-20, 38}, {-101, 39}, {-50, 40}, {42, 41}, + {-37, 43}, {-116, 44}, {-117, 45}, {-49, 46}, {-21, -100}, {48, 47}, + {-55, -71}, {-4, 49}, {-22, -84}, {-115, 50}, {-66, -82}, {-72, 51}, + {-5, -6}, {-54, 52}, {-38, 53}, {-83, 54}, {-40, 55}, {-39, 56}, + {-99, 57}, {-23, -56}, {-7, 58}, {-65, -97}, {-8, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}}}; + +const HUFF_ICC_NODES FDK_huffICCNodes = { + {&FDK_huffICCNodes_h1D_0, &FDK_huffICCNodes_h1D_0, &FDK_huffICCNodes_h1D_0}, + {{&FDK_huffICCNodes_h2D_0_0, &FDK_huffICCNodes_h2D_0_1}, + {&FDK_huffICCNodes_h2D_1_0, &FDK_huffICCNodes_h2D_1_1}, + {&FDK_huffICCNodes_h2D_0_1, &FDK_huffICCNodes_h2D_0_1}}}; + +static const HUFF_CLD_NOD_1D FDK_huffCLDNodes_h1D_0 = { + {{-1, 1}, {-2, 2}, {-3, 3}, {-4, 4}, {-5, 5}, {-6, 6}, + {-7, 7}, {-8, 8}, {-9, 9}, {-10, 10}, {-11, 11}, {-12, 12}, + {-13, 13}, {15, 14}, {-14, 16}, {-15, 17}, {-16, 18}, {-17, 19}, + {-18, 20}, {-19, 21}, {-20, -21}, {-23, 22}, {-22, 23}, {-24, 24}, + {-25, 25}, {27, 26}, {29, 28}, {-30, -31}, {-28, -29}, {-26, -27}}}; +static const HUFF_CLD_NOD_1D FDK_huffCLDNodes_h1D_1 = { + {{-1, 1}, {-2, 2}, {-3, 3}, {-4, 4}, {-5, 5}, {-6, 6}, + {-7, 7}, {9, 8}, {-8, 10}, {-9, 11}, {-10, 12}, {-11, 13}, + {-12, 14}, {-13, 15}, {-14, 16}, {-15, 17}, {-16, 18}, {-17, 19}, + {-18, 20}, {-19, -20}, {-21, 21}, {-22, 22}, {-23, 23}, {25, 24}, + {-24, 26}, {-25, 27}, {29, 28}, {-26, -31}, {-29, -30}, {-27, -28}}}; + +static const HUFF_CLD_NOD_2D FDK_huffCLDNodes_h2_0_0 = { + {{2, 1}, + {-1, -52}, + {4, 3}, + {-2, 5}, + {-51, 6}, + {-17, -18}, + {8, 7}, + {10, 9}, + {-3, -36}, + {-19, 11}, + {-35, -50}, + {-34, 12}, + {-4, 13}, + {-33, 14}, + {-20, -49}}, + {{2, 1}, {4, 3}, {-86, 5}, {7, 6}, {9, 8}, {-1, -2}, + {-85, 10}, {-18, 11}, {-17, 12}, {14, 13}, {-70, 15}, {17, 16}, + {-19, -69}, {-84, 18}, {-3, 19}, {21, 20}, {-34, -68}, {-20, 22}, + {-35, 23}, {-83, 24}, {-33, 25}, {-4, 26}, {-53, 27}, {-54, -67}, + {-36, 28}, {-21, -52}, {-82, 29}, {-5, -50}, {-51, 30}, {-38, 31}, + {-37, -49}, {-6, 32}, {-66, 33}, {-65, 34}, {-22, -81}}, + {{2, 1}, {4, 3}, {-120, 5}, {7, 6}, {9, 8}, {11, 10}, + {-1, 12}, {-18, -119}, {-2, 13}, {15, 14}, {-17, 16}, {-104, 17}, + {19, 18}, {-19, 20}, {-103, 21}, {-118, 22}, {24, 23}, {-3, 25}, + {27, 26}, {-34, 28}, {-102, 29}, {-20, 30}, {-35, 31}, {33, 32}, + {-117, 34}, {-33, 35}, {-88, 36}, {-4, 37}, {-87, 38}, {40, 39}, + {-36, -101}, {-86, 41}, {-21, -37}, {-85, -100}, {-52, 42}, {-22, 43}, + {-116, 44}, {-50, 45}, {47, 46}, {-5, -51}, {-115, 48}, {-70, 49}, + {-84, 50}, {-38, -49}, {-72, -99}, {-53, 51}, {-69, -71}, {-23, 52}, + {-6, -67}, {-114, 53}, {-7, 54}, {-66, -68}, {-55, 55}, {57, 56}, + {-54, -65}, {-8, -56}, {-82, -83}, {59, 58}, {-39, -40}, {-81, 60}, + {-98, 61}, {-97, 62}, {-24, -113}}, + {{2, 1}, {4, 3}, {6, 5}, {-154, 7}, {9, 8}, + {11, 10}, {13, 12}, {15, 14}, {-18, 16}, {-153, 17}, + {-1, -2}, {19, 18}, {-138, 20}, {-17, 21}, {23, 22}, + {25, 24}, {-19, -137}, {27, 26}, {-152, 28}, {30, 29}, + {-3, -34}, {32, 31}, {34, 33}, {36, 35}, {-136, 37}, + {-35, 38}, {-20, 39}, {-122, 40}, {-151, 41}, {-33, 42}, + {-121, 43}, {45, 44}, {47, 46}, {-4, 48}, {-36, -120}, + {-135, 49}, {51, 50}, {-21, 52}, {54, 53}, {56, 55}, + {-50, -150}, {58, 57}, {-51, 59}, {61, 60}, {-119, 62}, + {-52, 63}, {-5, 64}, {-37, 65}, {-117, -134}, {-39, -54}, + {-22, 66}, {-106, 67}, {-69, -102}, {-132, 68}, {-105, 69}, + {-49, 70}, {-149, 71}, {-24, -104}, {73, 72}, {-53, 74}, + {-38, -118}, {-103, 75}, {-6, 76}, {-66, -87}, {-133, -147}, + {-23, 77}, {-67, 78}, {-68, -86}, {-70, -101}, {-40, -148}, + {-116, 79}, {-55, 80}, {-84, -131}, {82, 81}, {-89, -90}, + {-7, -25}, {-85, -88}, {-65, 83}, {-72, -146}, {85, 84}, + {-9, -71}, {-83, 86}, {-82, 87}, {-8, 88}, {-100, 89}, + {-74, -99}, {-73, 90}, {-10, -81}, {-56, 91}, {-57, -98}, + {93, 92}, {-58, -114}, {-97, -115}, {95, 94}, {-41, 96}, + {-42, 97}, {-26, -129}, {-113, 98}, {-130, -145}}}; +static const HUFF_CLD_NOD_2D FDK_huffCLDNodes_h2_0_1 = { + {{-1, 1}, + {-52, 2}, + {-17, 3}, + {5, 4}, + {-36, 6}, + {-33, 7}, + {-2, -18}, + {-20, 8}, + {10, 9}, + {-34, -49}, + {-51, 11}, + {-35, 12}, + {-19, 13}, + {-3, 14}, + {-4, -50}}, + {{2, 1}, {4, 3}, {-86, 5}, {-1, 6}, {-17, 7}, {-70, 8}, + {10, 9}, {-18, 11}, {-33, 12}, {-54, 13}, {-2, 14}, {-34, 15}, + {-38, 16}, {-49, 17}, {-85, 18}, {-50, 19}, {-69, 20}, {-53, -65}, + {-22, 21}, {-66, 22}, {-19, 23}, {-37, 24}, {-35, -81}, {-3, 25}, + {-51, 26}, {-68, -84}, {-52, 27}, {29, 28}, {-20, 30}, {-4, -36}, + {-83, 31}, {-67, 32}, {-21, 33}, {-5, 34}, {-6, -82}}, + {{2, 1}, {4, 3}, {6, 5}, {-120, 7}, {-17, 8}, {-1, -104}, + {10, 9}, {12, 11}, {-18, 13}, {-33, -88}, {15, 14}, {17, 16}, + {-2, 18}, {-34, 19}, {-72, 20}, {-49, 21}, {-119, 22}, {-50, 23}, + {-103, 24}, {-56, 25}, {-65, 26}, {28, 27}, {-40, -87}, {-66, 29}, + {-82, 30}, {32, 31}, {-19, -81}, {-71, 33}, {-97, 34}, {-35, -55}, + {-24, 35}, {37, 36}, {-3, -98}, {-51, 38}, {-67, 39}, {-39, -118}, + {-113, 40}, {-102, 41}, {-86, 42}, {-70, -83}, {44, 43}, {-20, -54}, + {-52, 45}, {-36, 46}, {-4, 47}, {-68, 48}, {-85, 49}, {-101, -117}, + {-69, 50}, {52, 51}, {-21, -37}, {-53, 53}, {55, 54}, {-5, -100}, + {-116, 56}, {-84, 57}, {-38, 58}, {-22, -99}, {-115, 59}, {-6, 60}, + {-23, 61}, {-7, 62}, {-114, 0}}, + {{2, 1}, {4, 3}, {6, 5}, {-154, 7}, {9, 8}, + {-17, 10}, {-138, 11}, {-1, 12}, {14, 13}, {16, 15}, + {-33, -122}, {-18, 17}, {19, 18}, {-34, 20}, {-2, 21}, + {-106, 22}, {-49, 23}, {25, 24}, {-50, 26}, {-153, 27}, + {-90, 28}, {-137, 29}, {-65, 30}, {32, 31}, {-66, 33}, + {-121, 34}, {-74, 35}, {-81, 36}, {38, 37}, {-42, 39}, + {-82, 40}, {-105, 41}, {-19, -114}, {-58, 42}, {-35, 43}, + {-97, 44}, {46, 45}, {-129, 47}, {-26, -89}, {-57, -98}, + {-51, 48}, {-3, 49}, {-113, 50}, {-130, 51}, {-152, 52}, + {-67, -73}, {-99, -136}, {-145, 53}, {-120, 54}, {-41, 55}, + {-83, 56}, {-72, 57}, {-104, 58}, {-115, 59}, {-20, 60}, + {62, 61}, {-36, -88}, {-84, 63}, {-52, -56}, {65, 64}, + {-4, -87}, {-68, 66}, {-151, 67}, {-100, -135}, {69, 68}, + {-69, -119}, {-103, 70}, {-71, 71}, {73, 72}, {-21, 74}, + {-85, 75}, {-37, -53}, {-86, 76}, {78, 77}, {-102, -150}, + {-5, 79}, {-134, 80}, {-118, 81}, {-54, -117}, {83, 82}, + {-38, -70}, {-22, 84}, {-6, 85}, {87, 86}, {-55, 88}, + {-101, 89}, {-133, -149}, {-24, -39}, {91, 90}, {-132, 92}, + {-23, 93}, {-7, 94}, {-147, -148}, {-116, -131}, {-25, 95}, + {-40, 0}, {0, 0}, {0, 0}, {0, 0}}}; +static const HUFF_CLD_NOD_2D FDK_huffCLDNodes_h2_1_0 = { + {{-1, 1}, + {-52, 2}, + {-17, 3}, + {5, 4}, + {-2, -36}, + {-18, 6}, + {8, 7}, + {-51, 9}, + {-33, 10}, + {-34, 11}, + {-20, -35}, + {-19, 12}, + {-3, 13}, + {-49, 14}, + {-4, -50}}, + {{2, 1}, {-86, 3}, {-1, 4}, {-17, 5}, {7, 6}, {-70, 8}, + {-2, -18}, {10, 9}, {12, 11}, {-85, 13}, {-33, 14}, {-34, -54}, + {16, 15}, {-69, 17}, {19, 18}, {-50, -53}, {-19, 20}, {-38, 21}, + {-35, -49}, {-3, 22}, {24, 23}, {-68, 25}, {-84, 26}, {-65, 27}, + {-51, -66}, {-22, -37}, {-52, 28}, {-20, 29}, {-36, 30}, {-81, 31}, + {-4, -83}, {-67, 32}, {-21, 33}, {-5, 34}, {-6, -82}}, + {{2, 1}, {-120, 3}, {-1, 4}, {6, 5}, {-17, 7}, {-104, 8}, + {-18, 9}, {-2, 10}, {12, 11}, {14, 13}, {-119, 15}, {-33, 16}, + {-34, -88}, {-103, 17}, {19, 18}, {21, 20}, {23, 22}, {25, 24}, + {-19, -72}, {-50, 26}, {-49, 27}, {-87, 28}, {30, 29}, {32, 31}, + {-3, -35}, {34, 33}, {-56, 35}, {-65, -66}, {-40, 36}, {-82, -118}, + {-71, 37}, {-55, 38}, {-67, -102}, {-51, 39}, {-70, 40}, {42, 41}, + {-81, 43}, {-86, 44}, {-52, -97}, {-98, 45}, {-24, -39}, {-20, 46}, + {-54, -83}, {-36, 47}, {-85, 48}, {-68, 49}, {-4, 50}, {-69, -113}, + {-117, 51}, {-37, -101}, {-53, 52}, {-21, 53}, {55, 54}, {-84, -100}, + {-5, 56}, {-116, 57}, {-22, 58}, {-38, -115}, {60, 59}, {-6, -99}, + {-23, 61}, {-114, 62}, {-7, -8}}, + {{2, 1}, {-154, 3}, {5, 4}, {-1, 6}, {8, 7}, + {-17, 9}, {-138, 10}, {-18, 11}, {-2, 12}, {14, 13}, + {16, 15}, {-153, 17}, {-34, 18}, {-33, -122}, {20, 19}, + {22, 21}, {-137, 23}, {25, 24}, {27, 26}, {-106, 28}, + {30, 29}, {-50, 31}, {-19, 32}, {-49, -121}, {34, 33}, + {36, 35}, {-35, 37}, {-90, 38}, {-66, 39}, {-3, 40}, + {42, 41}, {-65, 43}, {-105, 44}, {46, 45}, {-74, 47}, + {-51, 48}, {-82, -152}, {-136, 49}, {-81, 50}, {-42, -89}, + {-114, 51}, {53, 52}, {-57, -58}, {-120, 54}, {-98, 55}, + {-67, 56}, {-97, 57}, {59, 58}, {-99, 60}, {-73, -104}, + {-72, 61}, {-113, 62}, {-20, -83}, {-84, -130}, {-36, 63}, + {-26, 64}, {-41, 65}, {-52, -129}, {-87, -88}, {67, 66}, + {-115, 68}, {-68, 69}, {-56, -69}, {-4, -100}, {-151, 70}, + {-135, 71}, {-103, -119}, {73, 72}, {-71, -145}, {-102, 74}, + {76, 75}, {-53, -85}, {-37, 77}, {-21, -86}, {79, 78}, + {-5, 80}, {-54, -134}, {-150, 81}, {-118, 82}, {-70, 83}, + {-117, 84}, {-22, -38}, {-101, 85}, {-55, 86}, {-149, 87}, + {-39, 88}, {-133, 89}, {-6, 90}, {-116, 91}, {-24, 92}, + {-7, -132}, {-23, 93}, {-40, 94}, {-131, -148}, {-25, 95}, + {-147, 96}, {-146, 97}, {-8, 0}, {0, 0}}}; +static const HUFF_CLD_NOD_2D FDK_huffCLDNodes_h2_1_1 = { + {{-1, 1}, + {-52, 2}, + {4, 3}, + {-2, 5}, + {-17, 6}, + {-18, 7}, + {-36, -51}, + {9, 8}, + {-35, 10}, + {-34, 11}, + {-19, -33}, + {-3, 12}, + {-20, 13}, + {-50, 14}, + {-4, -49}}, + {{2, 1}, {-86, 3}, {5, 4}, {-1, 6}, {8, 7}, {-17, -18}, + {-2, 9}, {-70, 10}, {-85, 11}, {13, 12}, {-69, 14}, {-34, 15}, + {17, 16}, {-19, 18}, {-33, -35}, {-54, 19}, {-53, 20}, {-3, 21}, + {-68, 22}, {-84, 23}, {-50, 24}, {-52, 25}, {-51, 26}, {-20, -36}, + {-49, 27}, {-38, 28}, {-37, 29}, {-4, -83}, {-67, 30}, {-66, 31}, + {-21, 32}, {-22, -65}, {-5, 33}, {-82, 34}, {-6, -81}}, + {{2, 1}, {4, 3}, {-120, 5}, {7, 6}, {9, 8}, {-1, 10}, + {-18, 11}, {-17, 12}, {-2, -104}, {-119, 13}, {15, 14}, {-103, 16}, + {18, 17}, {-34, 19}, {-19, 20}, {22, 21}, {-35, 23}, {-33, 24}, + {-88, 25}, {-87, 26}, {28, 27}, {-3, -102}, {-86, 29}, {-52, -118}, + {31, 30}, {-50, 32}, {-51, 33}, {-70, 34}, {-36, 35}, {-85, 36}, + {-20, 37}, {39, 38}, {-69, -71}, {-72, 40}, {-49, -67}, {42, 41}, + {-68, 43}, {-4, -101}, {-53, -117}, {-37, 44}, {-66, 45}, {-55, 46}, + {48, 47}, {-54, 49}, {-21, 50}, {-84, -100}, {-56, -65}, {52, 51}, + {-82, -83}, {54, 53}, {-5, -116}, {-22, 55}, {-38, 56}, {-39, -40}, + {58, 57}, {-81, -115}, {-98, -99}, {-6, 59}, {-23, 60}, {-24, 61}, + {-7, -97}, {-114, 62}, {-8, -113}}, + {{2, 1}, {4, 3}, {-154, 5}, {7, 6}, {9, 8}, + {11, 10}, {-1, 12}, {-18, 13}, {-17, 14}, {-2, -138}, + {16, 15}, {-153, 17}, {-137, 18}, {20, 19}, {22, 21}, + {-34, 23}, {-19, 24}, {-35, 25}, {27, 26}, {29, 28}, + {-121, 30}, {-120, 31}, {-136, 32}, {-33, -122}, {34, 33}, + {-152, 35}, {-3, 36}, {-51, 37}, {-52, 38}, {-69, 39}, + {-36, 40}, {-50, 41}, {43, 42}, {-20, 44}, {-104, 45}, + {-103, 46}, {-87, 47}, {-119, 48}, {-105, 49}, {-86, 50}, + {-102, 51}, {-106, 52}, {-49, -135}, {-68, 53}, {55, 54}, + {-53, 56}, {-67, -151}, {-4, 57}, {-84, 58}, {-85, 59}, + {-66, 60}, {-37, 61}, {-70, 62}, {-54, -88}, {-21, 63}, + {65, 64}, {-89, 66}, {-118, 67}, {-72, 68}, {-90, 69}, + {-71, 70}, {-65, -134}, {-150, 71}, {-83, 72}, {-5, 73}, + {-101, -117}, {-82, 74}, {76, 75}, {-99, 77}, {-38, 78}, + {-100, 79}, {-22, 80}, {-73, 81}, {-39, -74}, {83, 82}, + {-55, -81}, {-57, 84}, {-133, -149}, {-56, 85}, {-6, 86}, + {-98, 87}, {-132, 88}, {-23, 89}, {-114, 90}, {-116, 91}, + {-58, -115}, {-24, 92}, {-97, -148}, {-40, -41}, {-7, -42}, + {-147, 93}, {95, 94}, {-131, 96}, {-8, -130}, {-25, -113}, + {-9, 97}, {-26, -129}, {-146, 98}, {-10, -145}}}; + +const HUFF_CLD_NODES FDK_huffCLDNodes = { + {&FDK_huffCLDNodes_h1D_0, &FDK_huffCLDNodes_h1D_1, &FDK_huffCLDNodes_h1D_1}, + {{&FDK_huffCLDNodes_h2_0_0, &FDK_huffCLDNodes_h2_0_1}, + {&FDK_huffCLDNodes_h2_1_0, &FDK_huffCLDNodes_h2_1_1}, + {&FDK_huffCLDNodes_h2_0_1, &FDK_huffCLDNodes_h2_0_1}}}; + +const HUFF_RES_NODES FDK_huffReshapeNodes = { + {{2, 1}, {4, 3}, {6, 5}, {-33, 7}, {-17, 8}, {-49, 9}, + {-34, 10}, {12, 11}, {-18, -35}, {-50, 13}, {15, 14}, {-40, 16}, + {-36, 17}, {-19, 18}, {-1, -37}, {-51, 19}, {21, 20}, {-38, -65}, + {-2, -39}, {-20, 22}, {-52, 23}, {25, 24}, {-21, 26}, {-66, 27}, + {-53, 28}, {-3, 29}, {31, 30}, {-22, 32}, {-54, 33}, {-4, 34}, + {-56, 35}, {-24, -67}, {-23, -55}, {-8, -72}, {-5, 36}, {-68, 37}, + {-6, 38}, {-7, -69}, {-70, -71}}}; + +const HUFF_IPD_NODES FDK_huffIPDNodes = { + {{{{-1, 1}, {-8, 2}, {-2, 3}, {5, 4}, {-3, -7}, {-6, 6}, {-4, -5}}}, + {{{-1, 1}, {-2, 2}, {-8, 3}, {-3, 4}, {-7, 5}, {-4, 6}, {-5, -6}}}, + {{{-1, 1}, {-8, 2}, {-2, 3}, {5, 4}, {-3, -7}, {-6, 6}, {-4, -5}}}}, + {{{{{-1, 1}, {-18, 2}, {-17, 0}}, + {{-1, 1}, + {-36, 2}, + {-18, 3}, + {-35, 4}, + {-52, 5}, + {7, 6}, + {-34, 8}, + {-33, -49}, + {-20, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}}, + {{-1, 1}, {3, 2}, {5, 4}, {-86, 6}, {-66, 7}, {9, 8}, + {11, 10}, {-18, 12}, {-51, 13}, {-37, -52}, {-69, 14}, {-38, 15}, + {-53, 16}, {-35, 17}, {-50, -70}, {-22, -49}, {-33, 18}, {-17, 19}, + {-34, -65}, {-81, 20}, {-54, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + {{2, 1}, {4, 3}, {-1, 5}, {-69, 6}, {-120, 7}, {-68, 8}, + {10, 9}, {12, 11}, {14, 13}, {-52, -54}, {-18, 15}, {-70, 16}, + {-67, 17}, {19, 18}, {-17, 20}, {-113, 21}, {23, 22}, {-83, 24}, + {-24, 25}, {-103, -104}, {-51, -55}, {27, 26}, {-71, 28}, {-86, 29}, + {-35, 30}, {-66, 31}, {-39, -50}, {-82, -98}, {-72, 32}, {-56, -87}, + {-34, 33}, {-33, -88}, {-40, -97}, {-65, 34}, {-49, 35}, {-81, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}}}, + {{{-1, 1}, {-18, 2}, {-17, 0}}, + {{-1, 1}, + {-36, 2}, + {-18, 3}, + {-35, 4}, + {-52, 5}, + {7, 6}, + {-34, 8}, + {-33, -49}, + {-20, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}}, + {{-1, 1}, {3, 2}, {5, 4}, {-86, 6}, {-66, 7}, {9, 8}, + {11, 10}, {-18, 12}, {-51, 13}, {-37, -52}, {-69, 14}, {-38, 15}, + {-53, 16}, {-35, 17}, {-50, -70}, {-22, -49}, {-33, 18}, {-17, 19}, + {-34, -65}, {-81, 20}, {-54, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + {{2, 1}, {4, 3}, {-1, 5}, {-69, 6}, {-120, 7}, {-68, 8}, + {10, 9}, {12, 11}, {14, 13}, {-52, -54}, {-18, 15}, {-70, 16}, + {-67, 17}, {19, 18}, {-17, 20}, {-113, 21}, {23, 22}, {-83, 24}, + {-24, 25}, {-103, -104}, {-51, -55}, {27, 26}, {-71, 28}, {-86, 29}, + {-35, 30}, {-66, 31}, {-39, -50}, {-82, -98}, {-72, 32}, {-56, -87}, + {-34, 33}, {-33, -88}, {-40, -97}, {-65, 34}, {-49, 35}, {-81, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}}}}, + {{{{-1, 1}, {-18, 2}, {-17, 0}}, + {{-1, 1}, + {3, 2}, + {-18, 4}, + {-52, 5}, + {-34, -36}, + {-35, 6}, + {-17, 7}, + {-33, 8}, + {-20, 9}, + {-49, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}}, + {{-1, 1}, {3, 2}, {-52, 4}, {-86, 5}, {-35, 6}, {-53, 7}, + {-70, 8}, {-17, 9}, {-37, 10}, {12, 11}, {-38, -66}, {-18, 13}, + {-51, 14}, {16, 15}, {-34, -69}, {18, 17}, {-54, -65}, {-50, 19}, + {-33, -49}, {-22, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + {{-1, 1}, {-69, 2}, {4, 3}, {-120, 5}, {7, 6}, {-113, 8}, + {-68, 9}, {11, 10}, {-17, 12}, {-52, 13}, {-24, 14}, {-18, 15}, + {17, 16}, {-104, 18}, {20, 19}, {-54, -70}, {22, 21}, {24, 23}, + {-86, -97}, {-103, 25}, {-83, 26}, {-35, 27}, {-34, -98}, {-40, 28}, + {-39, -67}, {30, 29}, {-33, -51}, {-87, 31}, {-88, 32}, {-82, 33}, + {-55, -81}, {-56, -71}, {-72, 34}, {-50, -66}, {-65, 35}, {-49, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}}}, + {{{-1, 1}, {-18, 2}, {-17, 0}}, + {{-1, 1}, + {3, 2}, + {-18, 4}, + {-52, 5}, + {-34, -36}, + {-35, 6}, + {-17, 7}, + {-33, 8}, + {-20, 9}, + {-49, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}}, + {{-1, 1}, {3, 2}, {-52, 4}, {-86, 5}, {-35, 6}, {-53, 7}, + {-70, 8}, {-17, 9}, {-37, 10}, {12, 11}, {-38, -66}, {-18, 13}, + {-51, 14}, {16, 15}, {-34, -69}, {18, 17}, {-54, -65}, {-50, 19}, + {-33, -49}, {-22, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + {{-1, 1}, {-69, 2}, {4, 3}, {-120, 5}, {7, 6}, {-113, 8}, + {-68, 9}, {11, 10}, {-17, 12}, {-52, 13}, {-24, 14}, {-18, 15}, + {17, 16}, {-104, 18}, {20, 19}, {-54, -70}, {22, 21}, {24, 23}, + {-86, -97}, {-103, 25}, {-83, 26}, {-35, 27}, {-34, -98}, {-40, 28}, + {-39, -67}, {30, 29}, {-33, -51}, {-87, 31}, {-88, 32}, {-82, 33}, + {-55, -81}, {-56, -71}, {-72, 34}, {-50, -66}, {-65, 35}, {-49, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}}}}, + {{{{-1, 1}, {-18, 2}, {-17, 0}}, + {{-1, 1}, + {-36, 2}, + {-18, 3}, + {-35, 4}, + {-52, 5}, + {7, 6}, + {-34, 8}, + {-33, -49}, + {-20, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}}, + {{-1, 1}, {3, 2}, {5, 4}, {-86, 6}, {-66, 7}, {9, 8}, + {11, 10}, {-18, 12}, {-51, 13}, {-37, -52}, {-69, 14}, {-38, 15}, + {-53, 16}, {-35, 17}, {-50, -70}, {-22, -49}, {-33, 18}, {-17, 19}, + {-34, -65}, {-81, 20}, {-54, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + {{2, 1}, {4, 3}, {-1, 5}, {-69, 6}, {-120, 7}, {-68, 8}, + {10, 9}, {12, 11}, {14, 13}, {-52, -54}, {-18, 15}, {-70, 16}, + {-67, 17}, {19, 18}, {-17, 20}, {-113, 21}, {23, 22}, {-83, 24}, + {-24, 25}, {-103, -104}, {-51, -55}, {27, 26}, {-71, 28}, {-86, 29}, + {-35, 30}, {-66, 31}, {-39, -50}, {-82, -98}, {-72, 32}, {-56, -87}, + {-34, 33}, {-33, -88}, {-40, -97}, {-65, 34}, {-49, 35}, {-81, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}}}, + {{{-1, 1}, {-18, 2}, {-17, 0}}, + {{-1, 1}, + {-36, 2}, + {-18, 3}, + {-35, 4}, + {-52, 5}, + {7, 6}, + {-34, 8}, + {-33, -49}, + {-20, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}}, + {{-1, 1}, {3, 2}, {5, 4}, {-86, 6}, {-66, 7}, {9, 8}, + {11, 10}, {-18, 12}, {-51, 13}, {-37, -52}, {-69, 14}, {-38, 15}, + {-53, 16}, {-35, 17}, {-50, -70}, {-22, -49}, {-33, 18}, {-17, 19}, + {-34, -65}, {-81, 20}, {-54, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + {{2, 1}, {4, 3}, {-1, 5}, {-69, 6}, {-120, 7}, {-68, 8}, + {10, 9}, {12, 11}, {14, 13}, {-52, -54}, {-18, 15}, {-70, 16}, + {-67, 17}, {19, 18}, {-17, 20}, {-113, 21}, {23, 22}, {-83, 24}, + {-24, 25}, {-103, -104}, {-51, -55}, {27, 26}, {-71, 28}, {-86, 29}, + {-35, 30}, {-66, 31}, {-39, -50}, {-82, -98}, {-72, 32}, {-56, -87}, + {-34, 33}, {-33, -88}, {-40, -97}, {-65, 34}, {-49, 35}, {-81, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, + {0, 0}, {0, 0}, {0, 0}}}}}}; + +static const HUFF_OLD_NOD_1D huffOLDNodes_h1D_0 = {{{-1, 1}, + {3, 2}, + {-2, 4}, + {-3, 5}, + {-4, 6}, + {-5, 7}, + {-6, -8}, + {-7, 8}, + {10, 9}, + {12, 11}, + {-9, -11}, + {-10, 13}, + {-12, 14}, + {-13, -16}, + {-14, -15}}}; + +static const HUFF_OLD_NOD_1D huffOLDNodes_h1D_1 = {{{-1, 1}, + {-2, 2}, + {4, 3}, + {-3, 5}, + {-4, 6}, + {-5, 7}, + {-6, -8}, + {-7, 8}, + {10, 9}, + {12, 11}, + {-9, 13}, + {-16, 14}, + {-10, -15}, + {-11, -12}, + {-13, -14}}}; + +static const HUFF_OLD_NOD_2D huffOLDNodes_h2D_0_0 = { + {{2, 1}, + {-1, 3}, + {5, 4}, + {-2, 6}, + {-3, -4}, + {-17, 7}, + {-18, 8}, + {-19, 9}, + {-20, 10}, + {-52, 11}, + {-33, 12}, + {-34, -35}, + {-36, 13}, + {-51, 14}, + {-49, -50}}, + {{-1, 1}, {3, 2}, {5, 4}, {7, 6}, {-103, 8}, {10, 9}, + {12, 11}, {-18, 13}, {15, 14}, {-2, 16}, {-86, 17}, {-35, 18}, + {20, 19}, {-102, 21}, {23, 22}, {-69, 24}, {-87, 25}, {-3, 26}, + {-17, 27}, {-19, 28}, {-52, 29}, {-34, -101}, {31, 30}, {-85, 32}, + {34, 33}, {-20, -70}, {-4, 35}, {-71, -100}, {-5, -33}, {-50, 36}, + {-36, -55}, {-54, -84}, {38, 37}, {-51, -53}, {-21, 39}, {-6, -99}, + {-37, -68}, {-83, 40}, {-7, -49}, {-22, -98}, {42, 41}, {44, 43}, + {-66, 45}, {-67, 46}, {-38, -39}, {-65, -82}, {-23, 47}, {-81, -97}}, + {{-1, 1}, {3, 2}, {5, 4}, {7, 6}, {9, 8}, + {11, 10}, {13, 12}, {15, 14}, {-154, 16}, {-103, 17}, + {19, 18}, {21, 20}, {-18, 22}, {24, 23}, {26, 25}, + {28, 27}, {-137, 29}, {31, 30}, {-2, -51}, {33, 32}, + {-35, 34}, {-26, 35}, {37, 36}, {-8, 38}, {-70, -153}, + {40, 39}, {-120, 41}, {-52, 42}, {44, 43}, {-3, -138}, + {46, 45}, {48, 47}, {-34, 49}, {-7, 50}, {-19, 51}, + {-17, 52}, {-152, 53}, {-4, -151}, {-33, 54}, {-106, 55}, + {-53, -122}, {-105, -136}, {-121, 56}, {-104, 57}, {-50, -118}, + {-20, 58}, {-5, 59}, {-38, 60}, {-133, 61}, {-148, 62}, + {-23, -135}, {-36, 63}, {-6, 64}, {66, 65}, {-21, -150}, + {68, 67}, {-49, 69}, {-134, 70}, {-119, 71}, {-37, 72}, + {-149, 73}, {-9, 74}, {-69, 75}, {-86, 76}, {-22, 77}, + {-68, 78}, {80, 79}, {82, 81}, {84, 83}, {-88, 85}, + {-132, 86}, {-90, 87}, {-10, -117}, {-67, 88}, {-71, 89}, + {-87, 90}, {-54, -66}, {-25, 91}, {-89, 92}, {-72, 93}, + {-131, 94}, {-113, -115}, {-99, 95}, {-73, -116}, {-24, -85}, + {-84, -102}, {-39, 96}, {-55, -98}, {-81, -97}, {-82, -83}, + {-114, 97}, {-146, -147}, {-42, -101}, {-57, -100}, {-65, -130}, + {-74, 98}, {-56, -58}, {-40, -129}, {-41, -145}}, + {{2, 1}, {4, 3}, {6, 5}, {8, 7}, {10, 9}, + {12, 11}, {-4, 13}, {-11, -28}, {-21, 14}, {-1, 15}, + {17, 16}, {19, 18}, {-38, 20}, {22, 21}, {24, 23}, + {26, 25}, {28, 27}, {-54, 29}, {31, 30}, {-44, 32}, + {-45, 33}, {-37, 34}, {-5, 35}, {-27, 36}, {38, 37}, + {40, 39}, {-53, 41}, {-12, 42}, {-22, 43}, {-20, 44}, + {-36, 45}, {-43, 46}, {-6, 47}, {-205, 48}, {-51, -52}, + {-35, 49}, {-34, 50}, {-13, 51}, {-42, 52}, {-29, 53}, + {-18, -41}, {55, 54}, {-17, -26}, {-19, 56}, {-7, 57}, + {-23, -188}, {59, 58}, {-10, 60}, {62, 61}, {-39, 63}, + {-33, 64}, {-2, 65}, {-204, 66}, {68, 67}, {-189, 69}, + {-171, 70}, {72, 71}, {74, 73}, {-203, 75}, {-3, -25}, + {-24, 76}, {78, 77}, {80, 79}, {82, 81}, {-173, 83}, + {-172, -187}, {85, 84}, {-86, 86}, {-50, 87}, {-202, 88}, + {90, 89}, {-154, 91}, {93, 92}, {-120, 94}, {96, 95}, + {-186, 97}, {99, 98}, {-69, 100}, {-156, -157}, {102, 101}, + {104, 103}, {-170, -201}, {-103, 105}, {107, 106}, {-155, 108}, + {-137, 109}, {-185, 110}, {-49, 111}, {-8, 112}, {-66, 113}, + {-67, 114}, {116, 115}, {-169, 117}, {-141, 118}, {120, 119}, + {122, 121}, {-200, 123}, {-68, -121}, {125, 124}, {-136, 126}, + {-140, 127}, {-71, 128}, {-139, 129}, {-151, -184}, {-82, 130}, + {-56, -101}, {132, 131}, {-9, -153}, {-40, 133}, {-138, 134}, + {-83, -199}, {-84, 135}, {-90, -168}, {-65, -91}, {-102, 136}, + {-135, -166}, {-72, -183}, {-87, -150}, {-181, 137}, {-125, 138}, + {-55, -70}, {-85, -152}, {-106, -124}, {-89, -123}, {-198, 139}, + {-57, 140}, {-105, 141}, {-167, -196}, {-81, -122}, {-182, 142}, + {-99, -180}, {-100, -104}, {-116, -165}, {-98, 143}, {-117, -119}, + {-88, -134}, {-197, 144}, {-73, -195}, {-92, -149}, {-118, -164}, + {-58, -108}, {-107, -179}, {-109, 145}, {-93, -97}, {-115, -194}, + {-114, 146}, {-113, 147}, {149, 148}, {151, 150}, {153, 152}, + {155, 154}, {157, 156}, {159, 158}, {161, 160}, {163, 162}, + {165, 164}, {167, 166}, {-178, -193}, {-163, -177}, {-161, -162}, + {-147, -148}, {-145, -146}, {-132, -133}, {-130, -131}, {-77, -129}, + {-75, -76}, {-61, -74}, {-59, -60}}}; + +static const HUFF_OLD_NOD_2D huffOLDNodes_h2D_0_1 = { + {{-1, 1}, + {3, 2}, + {5, 4}, + {-52, 6}, + {-49, 7}, + {9, 8}, + {-17, 10}, + {-36, 11}, + {-18, 12}, + {-2, -3}, + {-35, 13}, + {-34, -50}, + {-4, -33}, + {-20, 14}, + {-19, -51}}, + {{-1, 1}, {3, 2}, {-103, 4}, {6, 5}, {8, 7}, {-18, 9}, + {11, 10}, {-87, 12}, {-17, 13}, {15, 14}, {-86, 16}, {18, 17}, + {-71, 19}, {21, 20}, {-33, -35}, {-34, 22}, {-55, 23}, {-2, 24}, + {-50, -102}, {26, 25}, {-49, 27}, {-69, -70}, {-39, 28}, {-65, 29}, + {-66, 30}, {-54, 31}, {-19, 32}, {-23, -52}, {-51, 33}, {-81, 34}, + {-82, 35}, {-3, -38}, {-85, -101}, {-67, -97}, {37, 36}, {-20, -53}, + {-36, 38}, {40, 39}, {-100, 41}, {-4, -84}, {-68, 42}, {-21, 43}, + {-37, 44}, {-99, 45}, {-5, -83}, {-22, 46}, {-98, 47}, {-6, -7}}, + {{-1, 1}, {3, 2}, {5, 4}, {7, 6}, {9, 8}, + {-154, 10}, {12, 11}, {14, 13}, {-18, 15}, {17, 16}, + {19, 18}, {21, 20}, {-17, 22}, {-137, 23}, {-35, 24}, + {-138, 25}, {27, 26}, {-113, 28}, {-34, 29}, {31, 30}, + {33, 32}, {-122, 34}, {-33, 35}, {-73, 36}, {38, 37}, + {40, 39}, {-106, 41}, {-52, 42}, {-58, -120}, {-50, 43}, + {45, 44}, {-49, 46}, {-10, -103}, {-36, 47}, {-54, -90}, + {-53, 48}, {-2, 49}, {-98, -153}, {-121, 50}, {-66, 51}, + {-65, -72}, {-51, 52}, {-74, 53}, {-9, 54}, {-105, 55}, + {-71, -82}, {-19, -55}, {-81, 56}, {58, 57}, {-83, 59}, + {-68, -88}, {-89, -97}, {-70, 60}, {-3, 61}, {-67, 62}, + {64, 63}, {-69, 65}, {-104, 66}, {-136, -152}, {68, 67}, + {-8, -26}, {-37, 69}, {-4, 70}, {72, 71}, {-22, 73}, + {-42, 74}, {-7, -20}, {76, 75}, {78, 77}, {-6, 79}, + {-114, 80}, {-25, -135}, {-119, -151}, {-24, 81}, {-57, 82}, + {-5, 83}, {-99, 84}, {-23, -130}, {-129, 85}, {-118, 86}, + {-21, -41}, {-86, 87}, {-115, -145}, {-84, 88}, {-87, -150}, + {-38, -56}, {-134, 89}, {-100, 90}, {-85, -133}, {-149, 91}, + {-102, 92}, {-117, -148}, {94, 93}, {-39, 95}, {-101, 96}, + {-116, 97}, {-131, -132}, {-40, 98}, {-146, -147}}, + {{2, 1}, {-1, 3}, {5, 4}, {7, 6}, {9, 8}, + {-205, 10}, {12, 11}, {14, 13}, {16, 15}, {-18, 17}, + {19, 18}, {21, 20}, {23, 22}, {-189, 24}, {-188, 25}, + {27, 26}, {-17, 28}, {-173, 29}, {31, 30}, {33, 32}, + {-34, -157}, {-35, 34}, {-33, 35}, {37, 36}, {39, 38}, + {41, 40}, {-50, 42}, {-49, 43}, {-141, 44}, {-204, 45}, + {-2, -171}, {-172, 46}, {-66, 47}, {49, 48}, {51, 50}, + {-65, 52}, {-125, 53}, {-156, 54}, {-82, 55}, {57, 56}, + {59, 58}, {-19, -52}, {61, 60}, {-81, 62}, {64, 63}, + {-109, -140}, {-51, 65}, {67, 66}, {-98, 68}, {70, 69}, + {72, 71}, {-67, -93}, {74, 73}, {-203, 75}, {-154, 76}, + {-124, 77}, {-97, -187}, {-114, 78}, {-61, 79}, {-155, 80}, + {82, 81}, {-113, 83}, {-3, -146}, {-83, 84}, {-108, 85}, + {-20, 86}, {-76, 87}, {-45, -77}, {-139, 88}, {90, 89}, + {-69, -130}, {-129, 91}, {-36, 92}, {-99, -161}, {94, 93}, + {-92, -162}, {-68, 95}, {-29, 96}, {-86, 97}, {-60, 98}, + {-123, -177}, {-145, 99}, {-91, -131}, {101, 100}, {-137, -178}, + {-115, 102}, {-84, -116}, {-147, 103}, {-4, 104}, {-106, -202}, + {106, 105}, {-132, -186}, {-107, 107}, {-193, 108}, {-100, -120}, + {-75, -170}, {-44, 109}, {-122, -163}, {-138, 110}, {-90, 111}, + {-37, 112}, {-101, 113}, {-121, 114}, {116, 115}, {-103, 117}, + {-74, -201}, {-21, -85}, {-53, -59}, {-117, 118}, {-148, 119}, + {-5, 120}, {-169, 121}, {-105, -185}, {123, 122}, {-102, -133}, + {-136, 124}, {-153, 125}, {127, 126}, {-54, 128}, {130, 129}, + {-22, -104}, {-38, 131}, {-89, -118}, {-184, 132}, {-71, 133}, + {-87, 134}, {-70, 135}, {-200, 136}, {-168, 137}, {-152, 138}, + {-6, -23}, {-39, 139}, {-119, -199}, {141, 140}, {-55, 142}, + {-7, -151}, {-183, 143}, {145, 144}, {-135, 146}, {-56, 147}, + {-150, 148}, {-40, 149}, {-72, -198}, {-88, 150}, {-57, -134}, + {-41, 151}, {-166, -167}, {-25, -165}, {-9, 152}, {-8, -24}, + {-73, -181}, {-182, 153}, {155, 154}, {-197, 156}, {-42, -180}, + {158, 157}, {-43, -149}, {-196, 159}, {-58, -164}, {-26, 160}, + {162, 161}, {164, 163}, {166, 165}, {-195, 167}, {-179, -194}, + {-27, -28}, {-12, -13}, {-10, -11}}}; + +static const HUFF_OLD_NOD_2D huffOLDNodes_h2D_1_0 = { + {{-1, 1}, + {-52, 2}, + {4, 3}, + {-18, 5}, + {7, 6}, + {-17, 8}, + {-36, 9}, + {-35, 10}, + {-2, 11}, + {-19, 12}, + {-33, -51}, + {-20, -34}, + {14, 13}, + {-3, -49}, + {-4, -50}}, + {{-1, 1}, {3, 2}, {5, 4}, {-103, 6}, {8, 7}, {-18, 9}, + {11, 10}, {13, 12}, {-86, 14}, {-87, 15}, {17, 16}, {-35, 18}, + {-17, 19}, {21, 20}, {-34, -71}, {23, 22}, {-50, -55}, {-33, 24}, + {-69, 25}, {-2, -70}, {27, 26}, {-102, 28}, {-49, 29}, {-66, 30}, + {-39, -54}, {-52, 31}, {-51, 32}, {-65, 33}, {-19, 34}, {-38, -82}, + {-23, -85}, {-67, 35}, {-81, 36}, {-3, 37}, {-53, -101}, {-20, -97}, + {39, 38}, {-36, 40}, {-84, 41}, {-100, 42}, {-4, -68}, {-21, 43}, + {-37, 44}, {-83, 45}, {-5, -99}, {-22, 46}, {-98, 47}, {-6, -7}}, + {{-1, 1}, {3, 2}, {5, 4}, {7, 6}, {9, 8}, + {-154, 10}, {12, 11}, {14, 13}, {-18, 15}, {17, 16}, + {-113, 18}, {20, 19}, {-137, 21}, {23, 22}, {25, 24}, + {27, 26}, {-35, 28}, {-138, 29}, {-58, 30}, {-103, 31}, + {-98, 32}, {34, 33}, {-122, 35}, {-120, 36}, {-17, -73}, + {-34, 37}, {-106, 38}, {-50, 39}, {-83, -90}, {-74, 40}, + {-52, 41}, {-66, -121}, {-33, -88}, {43, 42}, {-82, -105}, + {-49, 44}, {-68, -153}, {-2, -89}, {-51, -65}, {-67, 45}, + {-81, -97}, {47, 46}, {-104, 48}, {-19, 49}, {51, 50}, + {53, 52}, {55, 54}, {-136, 56}, {-152, 57}, {-3, 58}, + {60, 59}, {62, 61}, {64, 63}, {-36, 65}, {-20, 66}, + {-53, 67}, {-114, 68}, {-57, -99}, {-72, 69}, {-69, 70}, + {-42, 71}, {-151, 72}, {-119, 73}, {-84, -118}, {-135, 74}, + {-4, -130}, {-115, 75}, {-26, -41}, {-87, 76}, {-56, -86}, + {-100, 77}, {-37, -129}, {-21, 78}, {-38, 79}, {-71, -145}, + {-134, 80}, {-85, 81}, {-150, 82}, {-5, 83}, {-133, 84}, + {-102, 85}, {-22, 86}, {-23, 87}, {-54, 88}, {-149, 89}, + {-117, -148}, {-70, 90}, {-6, -101}, {92, 91}, {-8, -55}, + {-7, 93}, {-132, 94}, {-39, -116}, {-24, 95}, {-147, 96}, + {-40, 97}, {-10, -131}, {-146, 98}, {-9, -25}}, + {{2, 1}, {-1, 3}, {5, 4}, {7, 6}, {9, 8}, + {11, 10}, {13, 12}, {-205, 14}, {16, 15}, {18, 17}, + {20, 19}, {-18, 21}, {23, 22}, {25, 24}, {27, 26}, + {29, 28}, {-188, 30}, {32, 31}, {34, 33}, {36, 35}, + {-189, 37}, {39, 38}, {-35, 40}, {42, 41}, {44, 43}, + {46, 45}, {-173, 47}, {49, 48}, {-34, 50}, {-17, 51}, + {53, 52}, {-157, 54}, {56, 55}, {58, 57}, {-171, 59}, + {-50, 60}, {62, 61}, {-66, -141}, {-172, 63}, {-125, 64}, + {66, 65}, {-33, 67}, {-52, 68}, {-204, 69}, {-82, 70}, + {-156, 71}, {-2, 72}, {74, 73}, {-109, 75}, {-51, -98}, + {77, 76}, {-49, -140}, {79, 78}, {-146, 80}, {-124, 81}, + {-61, -93}, {-19, -76}, {-81, -154}, {-65, -114}, {83, 82}, + {-83, -108}, {-67, 84}, {-77, 85}, {-130, 86}, {-99, -155}, + {88, 87}, {-97, 89}, {-69, -91}, {-92, 90}, {-131, 91}, + {93, 92}, {-116, -187}, {-123, 94}, {-60, 95}, {-86, -139}, + {97, 96}, {-68, -162}, {99, 98}, {-45, -113}, {-147, -203}, + {-115, 100}, {-75, 101}, {-84, -106}, {-129, 102}, {-3, 103}, + {-137, 104}, {-132, 105}, {-44, -120}, {-107, 106}, {-20, -100}, + {-36, 107}, {-90, -163}, {-161, 108}, {-59, -145}, {-101, 109}, + {-29, -138}, {-121, 110}, {-177, -178}, {-186, 111}, {-122, -148}, + {-117, 112}, {-85, -170}, {-202, 113}, {-4, 114}, {-37, -105}, + {-74, 115}, {-133, 116}, {-102, 117}, {119, 118}, {-89, -193}, + {-103, 120}, {-21, -53}, {-153, 121}, {123, 122}, {125, 124}, + {-185, 126}, {-104, -169}, {-201, 127}, {-136, 128}, {-118, 129}, + {-87, 130}, {-5, 131}, {-38, 132}, {-54, 133}, {-70, -184}, + {-71, -168}, {-22, 134}, {136, 135}, {-151, -152}, {-55, 137}, + {-6, 138}, {-39, -72}, {-200, 139}, {-167, 140}, {142, 141}, + {-119, -166}, {-88, 143}, {-23, -135}, {-199, 144}, {-165, 145}, + {-56, -150}, {-57, -183}, {-7, 146}, {-41, 147}, {-181, 148}, + {-134, 149}, {-24, -25}, {-40, 150}, {-73, 151}, {-9, 152}, + {-43, 153}, {-182, -197}, {-8, -195}, {-198, 154}, {-149, 155}, + {157, 156}, {159, 158}, {161, 160}, {163, 162}, {165, 164}, + {167, 166}, {-194, -196}, {-179, -180}, {-58, -164}, {-28, -42}, + {-26, -27}, {-12, -13}, {-10, -11}}}; + +static const HUFF_OLD_NOD_2D huffOLDNodes_h2D_1_1 = { + {{-1, 1}, + {-52, 2}, + {4, 3}, + {6, 5}, + {-18, 7}, + {-2, 8}, + {-17, 9}, + {-35, 10}, + {-36, -51}, + {-34, 11}, + {-33, 12}, + {-19, 13}, + {-3, -20}, + {-50, 14}, + {-4, -49}}, + {{-1, 1}, {3, 2}, {5, 4}, {-103, 6}, {8, 7}, {-18, 9}, + {11, 10}, {13, 12}, {-86, 14}, {16, 15}, {-2, -35}, {-17, 17}, + {-87, 18}, {-102, 19}, {21, 20}, {-69, 22}, {-34, 23}, {-19, 24}, + {26, 25}, {-3, 27}, {-52, -70}, {-33, -71}, {-85, 28}, {-101, 29}, + {31, 30}, {-50, 32}, {-51, 33}, {-20, 34}, {-36, 35}, {-4, -55}, + {-54, 36}, {-49, -100}, {-53, 37}, {-84, 38}, {-68, 39}, {41, 40}, + {-5, 42}, {-21, 43}, {-65, -66}, {-67, 44}, {-37, -99}, {-39, 45}, + {-6, 46}, {-38, -83}, {-22, 47}, {-81, -82}, {-7, -98}, {-23, -97}}, + {{-1, 1}, {3, 2}, {5, 4}, {7, 6}, {9, 8}, + {-154, 10}, {-103, 11}, {13, 12}, {-18, 14}, {16, 15}, + {-137, 17}, {19, 18}, {-35, 20}, {22, 21}, {-120, 23}, + {25, 24}, {-52, 26}, {-2, 27}, {-138, 28}, {-153, 29}, + {-17, 30}, {32, 31}, {34, 33}, {-34, 35}, {-19, 36}, + {38, 37}, {40, 39}, {-3, 41}, {-121, 42}, {-122, 43}, + {-136, -152}, {-33, 44}, {-104, 45}, {-105, 46}, {-51, -106}, + {-50, 47}, {-36, 48}, {-20, 49}, {-53, -119}, {-4, 50}, + {-135, -151}, {-68, 51}, {53, 52}, {-49, 54}, {56, 55}, + {-118, 57}, {-88, 58}, {60, 59}, {-5, -8}, {-38, 61}, + {63, 62}, {-21, 64}, {-37, -83}, {-67, 65}, {-66, -133}, + {-6, 66}, {-150, 67}, {-134, 68}, {-23, -65}, {-73, -90}, + {-69, -89}, {-148, 69}, {-7, -22}, {-98, -113}, {71, 70}, + {-82, 72}, {-86, -149}, {-58, -81}, {-74, 73}, {75, 74}, + {77, 76}, {-87, -97}, {-102, 78}, {80, 79}, {-84, 81}, + {-85, 82}, {-54, 83}, {-70, 84}, {-72, 85}, {-117, 86}, + {-71, 87}, {-99, 88}, {-101, 89}, {-39, -100}, {-55, 90}, + {-57, 91}, {-132, 92}, {-56, 93}, {-24, -114}, {-115, 94}, + {-40, -116}, {-42, -147}, {-9, -41}, {-131, 95}, {97, 96}, + {-129, 98}, {-25, -130}, {-26, -146}, {-10, -145}}, + {{2, 1}, {-1, 3}, {5, 4}, {7, 6}, {9, 8}, + {11, 10}, {13, 12}, {-205, 14}, {16, 15}, {18, 17}, + {-18, 19}, {21, 20}, {23, 22}, {-188, 24}, {26, 25}, + {28, 27}, {30, 29}, {-35, 31}, {33, 32}, {35, 34}, + {-171, 36}, {-189, 37}, {-204, 38}, {40, 39}, {-2, 41}, + {43, 42}, {-17, 44}, {-52, 45}, {-34, 46}, {-19, 47}, + {49, 48}, {-154, 50}, {52, 51}, {54, 53}, {-172, 55}, + {-173, 56}, {-69, -187}, {-203, 57}, {59, 58}, {-86, 60}, + {-3, 61}, {63, 62}, {-33, -50}, {-51, 64}, {-36, 65}, + {-137, 66}, {-20, 67}, {69, 68}, {-120, 70}, {72, 71}, + {-156, -157}, {-155, 73}, {-170, 74}, {76, 75}, {-186, -202}, + {78, 77}, {80, 79}, {82, 81}, {-4, -67}, {-49, -103}, + {-66, 83}, {-68, 84}, {-53, 85}, {-21, 86}, {-37, 87}, + {89, 88}, {91, 90}, {93, 92}, {-138, 94}, {-140, 95}, + {-141, -153}, {-139, 96}, {-201, 97}, {-185, 98}, {-121, 99}, + {-169, 100}, {-5, 101}, {-136, 102}, {-65, -84}, {-83, -85}, + {-82, 103}, {-70, 104}, {-54, 105}, {-38, 106}, {108, 107}, + {-101, 109}, {-22, -102}, {-122, -123}, {111, 110}, {113, 112}, + {-125, 114}, {-87, -124}, {-71, 115}, {-168, 116}, {-6, -200}, + {-184, 117}, {-152, 118}, {-81, 119}, {121, 120}, {-105, 122}, + {-106, 123}, {-99, 124}, {-98, -100}, {-23, 125}, {-104, 126}, + {-39, 127}, {-135, 128}, {-55, -151}, {130, 129}, {-91, -119}, + {-7, -199}, {-183, 131}, {-107, -108}, {-116, 132}, {-109, -117}, + {-56, -167}, {-97, 133}, {-90, 134}, {-72, 135}, {-115, -118}, + {-92, 136}, {-93, -166}, {-24, -114}, {-89, 137}, {-88, -150}, + {139, 138}, {-8, 140}, {-40, 141}, {-198, 142}, {-134, 143}, + {-113, 144}, {-182, 145}, {147, 146}, {-41, 148}, {-57, -181}, + {-131, 149}, {151, 150}, {-25, 152}, {-132, 153}, {155, 154}, + {-9, -76}, {-42, -165}, {-73, -133}, {-77, 156}, {-130, 157}, + {-75, -149}, {-10, -146}, {-26, 158}, {-197, 159}, {-180, 160}, + {-147, -196}, {-58, -74}, {-27, 161}, {-129, -148}, {-11, -61}, + {-60, 162}, {-59, 163}, {-43, -145}, {-12, -164}, {-161, 164}, + {-163, 165}, {-162, -195}, {-179, 166}, {-177, 167}, {-28, -178}, + {-45, -194}, {-29, -44}, {-13, -193}}}; + +const HUFF_OLD_NODES huffOLDNodes = { + {&huffOLDNodes_h1D_0, &huffOLDNodes_h1D_1, &huffOLDNodes_h1D_1}, + {{&huffOLDNodes_h2D_0_0, &huffOLDNodes_h2D_0_1}, + {&huffOLDNodes_h2D_1_0, &huffOLDNodes_h2D_1_1}, + {&huffOLDNodes_h2D_0_1, &huffOLDNodes_h2D_0_1}}}; diff --git a/fdk-aac/libFDK/src/mdct.cpp b/fdk-aac/libFDK/src/mdct.cpp new file mode 100644 index 0000000..f5aa284 --- /dev/null +++ b/fdk-aac/libFDK/src/mdct.cpp @@ -0,0 +1,730 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Josef Hoepfl, Manuel Jander, Youliy Ninov, Daniel Hagel + + Description: MDCT/MDST routines + +*******************************************************************************/ + +#include "mdct.h" + +#include "FDK_tools_rom.h" +#include "dct.h" +#include "fixpoint_math.h" + +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; + hMdct->prevAliasSymmetry = 0; + hMdct->prevPrevAliasSymmetry = 0; + hMdct->pFacZir = NULL; + hMdct->pAsymOvlp = NULL; +} + +/* +This program implements the forward MDCT transform on an input block of data. +The input block is in a form (A,B,C,D) where A,B,C and D are the respective +1/4th segments of the block. The program takes the input block and folds it in +the form: +(-D-Cr,A-Br). This block is twice shorter and here the 'r' suffix denotes +flipping of the sequence (reversing the order of the samples). While folding the +input block in the above mentioned shorter block the program windows the data. +Because the two operations (windowing and folding) are not implemented +sequentially, but together the program's structure is not easy to understand. +Once the output (already windowed) block (-D-Cr,A-Br) is ready it is passed to +the DCT IV for processing. +*/ +INT mdct_block(H_MDCT hMdct, const INT_PCM *RESTRICT timeData, + const INT noInSamples, FIXP_DBL *RESTRICT mdctData, + const INT nSpec, const INT tl, const FIXP_WTP *pRightWindowPart, + const INT fr, SHORT *pMdctData_e) { + int i, n; + /* tl: transform length + fl: left window slope length + nl: left window slope offset + fr: right window slope length + nr: right window slope offset + See FDK_tools/doc/intern/mdct.tex for more detail. */ + int fl, nl, nr; + const FIXP_WTP *wls, *wrs; + + wrs = pRightWindowPart; + + /* Detect FRprevious / FL mismatches and override parameters accordingly */ + if (hMdct->prev_fr == + 0) { /* At start just initialize and pass parameters as they are */ + hMdct->prev_fr = fr; + hMdct->prev_wrs = wrs; + hMdct->prev_tl = tl; + } + + /* Derive NR */ + nr = (tl - fr) >> 1; + + /* Skip input samples if tl is smaller than block size */ + timeData += (noInSamples - tl) >> 1; + + /* windowing */ + for (n = 0; n < nSpec; n++) { + /* + * MDCT scale: + * + 1: fMultDiv2() in windowing. + * + 1: Because of factor 1/2 in Princen-Bradley compliant windowed TDAC. + */ + INT mdctData_e = 1 + 1; + + /* Derive left parameters */ + wls = hMdct->prev_wrs; + fl = hMdct->prev_fr; + nl = (tl - fl) >> 1; + + /* Here we implement a simplified version of what happens after the this + piece of code (see the comments below). We implement the folding of A and B + segments to (A-Br) but A is zero, because in this part of the MDCT sequence + the window coefficients with which A must be multiplied are zero. */ + for (i = 0; i < nl; i++) { +#if SAMPLE_BITS == DFRACT_BITS /* SPC_BITS and DFRACT_BITS should be equal. */ + mdctData[(tl / 2) + i] = -((FIXP_DBL)timeData[tl - i - 1] >> (1)); +#else + mdctData[(tl / 2) + i] = -(FIXP_DBL)timeData[tl - i - 1] + << (DFRACT_BITS - SAMPLE_BITS - 1); /* 0(A)-Br */ +#endif + } + + /* Implements the folding and windowing of the left part of the sequence, + that is segments A and B. The A segment is multiplied by the respective left + window coefficient and placed in a temporary variable. + + tmp0 = fMultDiv2((FIXP_PCM)timeData[i+nl], pLeftWindowPart[i].v.im); + + After this the B segment taken in reverse order is multiplied by the left + window and subtracted from the previously derived temporary variable, so + that finally we implement the A-Br operation. This output is written to the + right part of the MDCT output : (-D-Cr,A-Br). + + mdctData[(tl/2)+i+nl] = fMultSubDiv2(tmp0, (FIXP_PCM)timeData[tl-nl-i-1], + pLeftWindowPart[i].v.re);//A*window-Br*window + + The (A-Br) data is written to the output buffer (mdctData) without being + flipped. */ + for (i = 0; i < fl / 2; i++) { + FIXP_DBL tmp0; + tmp0 = fMultDiv2((FIXP_PCM)timeData[i + nl], wls[i].v.im); /* a*window */ + mdctData[(tl / 2) + i + nl] = + fMultSubDiv2(tmp0, (FIXP_PCM)timeData[tl - nl - i - 1], + wls[i].v.re); /* A*window-Br*window */ + } + + /* Right window slope offset */ + /* Here we implement a simplified version of what happens after the this + piece of code (see the comments below). We implement the folding of C and D + segments to (-D-Cr) but D is zero, because in this part of the MDCT sequence + the window coefficients with which D must be multiplied are zero. */ + for (i = 0; i < nr; i++) { +#if SAMPLE_BITS == \ + DFRACT_BITS /* This should be SPC_BITS instead of DFRACT_BITS. */ + mdctData[(tl / 2) - 1 - i] = -((FIXP_DBL)timeData[tl + i] >> (1)); +#else + mdctData[(tl / 2) - 1 - i] = + -(FIXP_DBL)timeData[tl + i] + << (DFRACT_BITS - SAMPLE_BITS - 1); /* -C flipped at placing */ +#endif + } + + /* Implements the folding and windowing of the right part of the sequence, + that is, segments C and D. The C segment is multiplied by the respective + right window coefficient and placed in a temporary variable. + + tmp1 = fMultDiv2((FIXP_PCM)timeData[tl+nr+i], pRightWindowPart[i].v.re); + + After this the D segment taken in reverse order is multiplied by the right + window and added from the previously derived temporary variable, so that we + get (C+Dr) operation. This output is negated to get (-C-Dr) and written to + the left part of the MDCT output while being reversed (flipped) at the same + time, so that from (-C-Dr) we get (-D-Cr)=> (-D-Cr,A-Br). + + mdctData[(tl/2)-nr-i-1] = -fMultAddDiv2(tmp1, + (FIXP_PCM)timeData[(tl*2)-nr-i-1], pRightWindowPart[i].v.im);*/ + for (i = 0; i < fr / 2; i++) { + FIXP_DBL tmp1; + tmp1 = fMultDiv2((FIXP_PCM)timeData[tl + nr + i], + wrs[i].v.re); /* C*window */ + mdctData[(tl / 2) - nr - i - 1] = + -fMultAddDiv2(tmp1, (FIXP_PCM)timeData[(tl * 2) - nr - i - 1], + wrs[i].v.im); /* -(C*window+Dr*window) and flip before + placing -> -Cr - D */ + } + + /* We pass the shortened folded data (-D-Cr,A-Br) to the MDCT function */ + dct_IV(mdctData, tl, &mdctData_e); + + pMdctData_e[n] = (SHORT)mdctData_e; + + timeData += tl; + mdctData += tl; + + hMdct->prev_wrs = wrs; + hMdct->prev_fr = fr; + hMdct->prev_tl = tl; + } + + return nSpec * 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; + + gain_e += -MDCT_OUTPUT_GAIN - MDCT_OUT_HEADROOM + 1; + if (tl == 0) { + /* Dont regard the 2/N factor from the IDCT. It is compensated for somewhere + * else. */ + *pGain_e = gain_e; + return; + } + + log2_tl = DFRACT_BITS - 1 - fNormz((FIXP_DBL)tl); + gain_e += -log2_tl; + + FDK_ASSERT(log2_tl - 2 >= 0); + FDK_ASSERT(log2_tl - 2 < 8*sizeof(int)); + + /* 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 0x5: /* 0.8 of radix 2 (e.g. tl 160), 1/tl = 1.0/(FDKpow(2.0, -log2_tl) + * 0.8/1.5) */ + if (gain_m == (FIXP_DBL)0) { + gain_m = FL2FXCONST_DBL(0.53333333333333333333f); + } else { + gain_m = fMult(gain_m, FL2FXCONST_DBL(0.53333333333333333333f)); + } + 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); + FDKmemcpy(pTimeData, hMdct->overlap.time, nt * sizeof(FIXP_DBL)); + pTimeData += nt; + + pOvl = hMdct->overlap.freq + hMdct->ov_size - 1; + if (hMdct->prevPrevAliasSymmetry == 0) { + for (i = 0; i < nf; i++) { + FIXP_DBL x = -(*pOvl--); + *pTimeData = IMDCT_SCALE_DBL(x); + pTimeData++; + } + } else { + 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; + } + } + /* + * 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; +} + +/* +This program implements the inverse modulated lapped transform, a generalized +version of the inverse MDCT transform. Setting none of the MLT_*_ALIAS_FLAG +flags computes the IMDCT, setting all of them computes the IMDST. Other +combinations of these flags compute type III transforms used by the RSVD60 +multichannel tool for transitions between MDCT/MDST. The following description +relates to the IMDCT only. + +If we pass the data block (A,B,C,D,E,F) to the FORWARD MDCT it will produce two +outputs. The first one will be over the (A,B,C,D) part =>(-D-Cr,A-Br) and the +second one will be over the (C,D,E,F) part => (-F-Er,C-Dr), since there is a +overlap between consequtive passes of the algorithm. This overlap is over the +(C,D) segments. The two outputs will be given sequentially to the DCT IV +algorithm. At the INVERSE MDCT side we get two consecutive outputs from the IDCT +IV algorithm, namely the same blocks: (-D-Cr,A-Br) and (-F-Er,C-Dr). The first +of them lands in the Overlap buffer and the second is in the working one, which, +one algorithm pass later will substitute the one residing in the overlap +register. The IMDCT algorithm has to produce the C and D segments from the two +buffers. In order to do this we take the left part of the overlap +buffer(-D-Cr,A-Br), namely (-D-Cr) and add it appropriately to the right part of +the working buffer (-F-Er,C-Dr), namely (C-Dr), so that we get first the C +segment and later the D segment. We do this in the following way: From the right +part of the working buffer(C-Dr) we subtract the flipped left part of the +overlap buffer(-D-Cr): + +Result = (C-Dr) - flipped(-D-Cr) = C -Dr + Dr + C = 2C +We divide by two and get the C segment. What we did is adding the right part of +the first frame to the left part of the second one. While applying these +operation we multiply the respective segments with the appropriate window +functions. + +In order to get the D segment we do the following: +From the negated second part of the working buffer(C-Dr) we subtract the flipped +first part of the overlap buffer (-D-Cr): + +Result= - (C -Dr) - flipped(-D-Cr)= -C +Dr +Dr +C = 2Dr. +After dividing by two and flipping we get the D segment.What we did is adding +the right part of the first frame to the left part of the second one. While +applying these operation we multiply the respective segments with the +appropriate window functions. + +Once we have obtained the C and D segments the overlap buffer is emptied and the +current buffer is sent in it, so that the E and F segments are available for +decoding in the next algorithm pass.*/ +INT imlt_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, + int flags) { + FIXP_DBL *pOvl; + FIXP_DBL *pOut0 = output, *pOut1; + INT nl, nr; + int w, i, nrSamples = 0, specShiftScale, transform_gain_e = 0; + int currAliasSymmetry = (flags & MLT_FLAG_CURR_ALIAS_SYMMETRY); + + /* 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; + + /* Detect FRprevious / FL mismatches and override parameters accordingly */ + if (hMdct->prev_fr != fl) { + imdct_adapt_parameters(hMdct, &fl, &nl, tl, wls, noOutSamples); + } + + specShiftScale = transform_gain_e; + + /* Setup window pointers */ + pWindow = hMdct->prev_wrs; + + /* Current spectrum */ + pSpec = spectrum + w * tl; + + /* DCT IV of current spectrum. */ + if (currAliasSymmetry == 0) { + if (hMdct->prevAliasSymmetry == 0) { + dct_IV(pSpec, tl, &specShiftScale); + } else { + FIXP_DBL _tmp[1024 + ALIGNMENT_DEFAULT / sizeof(FIXP_DBL)]; + FIXP_DBL *tmp = (FIXP_DBL *)ALIGN_PTR(_tmp); + C_ALLOC_ALIGNED_REGISTER(tmp, sizeof(_tmp)); + dct_III(pSpec, tmp, tl, &specShiftScale); + C_ALLOC_ALIGNED_UNREGISTER(tmp); + } + } else { + if (hMdct->prevAliasSymmetry == 0) { + FIXP_DBL _tmp[1024 + ALIGNMENT_DEFAULT / sizeof(FIXP_DBL)]; + FIXP_DBL *tmp = (FIXP_DBL *)ALIGN_PTR(_tmp); + C_ALLOC_ALIGNED_REGISTER(tmp, sizeof(_tmp)); + dst_III(pSpec, tmp, tl, &specShiftScale); + C_ALLOC_ALIGNED_UNREGISTER(tmp); + } else { + dst_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) { + for (i = 0; i < tl; i++) { + pSpec[i] = fMult(pSpec[i], gain); + } + } + + { + int loc_scale = + fixmin_I(scalefactor[w] + specShiftScale, (INT)DFRACT_BITS - 1); + DWORD_ALIGNED(pSpec); + scaleValuesSaturate(pSpec, tl, loc_scale); + } + + 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] */ + if ((hMdct->pFacZir != 0) && (hMdct->prev_nr == fl / 2)) { + /* In the case of ACELP -> TCX20 -> FD short add FAC ZIR on nr signal part + */ + for (i = 0; i < hMdct->prev_nr; i++) { + FIXP_DBL x = -(*pOvl--); + *pOut0 = IMDCT_SCALE_DBL(x + hMdct->pFacZir[i]); + pOut0++; + } + hMdct->pFacZir = NULL; + } else { + /* Here we implement a simplified version of what happens after the this + piece of code (see the comments below). We implement the folding of C and + D segments from (-D-Cr) but D is zero, because in this part of the MDCT + sequence the window coefficients with which D must be multiplied are zero. + "pOut0" writes sequentially the C block from left to right. */ + if (hMdct->prevPrevAliasSymmetry == 0) { + for (i = 0; i < hMdct->prev_nr; i++) { + FIXP_DBL x = -(*pOvl--); + *pOut0 = IMDCT_SCALE_DBL(x); + pOut0++; + } + } else { + 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; + DWORD_ALIGNED(pCurr); + C_ALLOC_ALIGNED_REGISTER(pWindow, fl); + DWORD_ALIGNED(pWindow); + C_ALLOC_ALIGNED_UNREGISTER(pWindow); + + if (hMdct->prevPrevAliasSymmetry == 0) { + if (hMdct->prevAliasSymmetry == 0) { + if (!hMdct->pAsymOvlp) { + for (i = 0; i < fl / 2; i++) { + FIXP_DBL x0, x1; + cplxMultDiv2(&x1, &x0, *pCurr++, -*pOvl--, pWindow[i]); + *pOut0 = IMDCT_SCALE_DBL_LSH1(x0); + *pOut1 = IMDCT_SCALE_DBL_LSH1(-x1); + pOut0++; + pOut1--; + } + } else { + FIXP_DBL *pAsymOvl = hMdct->pAsymOvlp + fl / 2 - 1; + for (i = 0; i < fl / 2; i++) { + FIXP_DBL x0, x1; + x1 = -fMultDiv2(*pCurr, pWindow[i].v.re) + + fMultDiv2(*pAsymOvl, pWindow[i].v.im); + x0 = fMultDiv2(*pCurr, pWindow[i].v.im) - + fMultDiv2(*pOvl, pWindow[i].v.re); + pCurr++; + pOvl--; + pAsymOvl--; + *pOut0++ = IMDCT_SCALE_DBL_LSH1(x0); + *pOut1-- = IMDCT_SCALE_DBL_LSH1(x1); + } + hMdct->pAsymOvlp = NULL; + } + } else { /* prevAliasingSymmetry == 1 */ + for (i = 0; i < fl / 2; i++) { + FIXP_DBL x0, x1; + cplxMultDiv2(&x1, &x0, *pCurr++, -*pOvl--, pWindow[i]); + *pOut0 = IMDCT_SCALE_DBL_LSH1(x0); + *pOut1 = IMDCT_SCALE_DBL_LSH1(x1); + pOut0++; + pOut1--; + } + } + } else { /* prevPrevAliasingSymmetry == 1 */ + if (hMdct->prevAliasSymmetry == 0) { + for (i = 0; i < fl / 2; i++) { + FIXP_DBL x0, x1; + cplxMultDiv2(&x1, &x0, *pCurr++, *pOvl--, pWindow[i]); + *pOut0 = IMDCT_SCALE_DBL_LSH1(x0); + *pOut1 = IMDCT_SCALE_DBL_LSH1(-x1); + pOut0++; + pOut1--; + } + } else { /* prevAliasingSymmetry == 1 */ + for (i = 0; i < fl / 2; i++) { + FIXP_DBL x0, x1; + cplxMultDiv2(&x1, &x0, *pCurr++, *pOvl--, pWindow[i]); + *pOut0 = IMDCT_SCALE_DBL_LSH1(x0); + *pOut1 = IMDCT_SCALE_DBL_LSH1(x1); + pOut0++; + pOut1--; + } + } + } + + if (hMdct->pFacZir != 0) { + /* add FAC ZIR of previous ACELP -> mdct transition */ + FIXP_DBL *pOut = pOut0 - fl / 2; + FDK_ASSERT(fl / 2 <= 128); + for (i = 0; i < fl / 2; i++) { + pOut[i] += IMDCT_SCALE_DBL(hMdct->pFacZir[i]); + } + hMdct->pFacZir = NULL; + } + pOut0 += (fl / 2) + nl; + + /* NL output samples TL/2+FL/2..TL. - current[FL/2..0] */ + pOut1 += (fl / 2) + 1; + pCurr = pSpec + tl - fl / 2 - 1; + /* Here we implement a simplified version of what happens above the this + piece of code (see the comments above). We implement the folding of C and D + segments from (C-Dr) but C is zero, because in this part of the MDCT + sequence the window coefficients with which C must be multiplied are zero. + "pOut1" writes sequentially the D block from left to right. */ + if (hMdct->prevAliasSymmetry == 0) { + for (i = 0; i < nl; i++) { + FIXP_DBL x = -(*pCurr--); + *pOut1++ = IMDCT_SCALE_DBL(x); + } + } else { + for (i = 0; i < nl; i++) { + FIXP_DBL x = *pCurr--; + *pOut1++ = IMDCT_SCALE_DBL(x); + } + } + + /* 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; + + /* Previous aliasing symmetry */ + hMdct->prevPrevAliasSymmetry = hMdct->prevAliasSymmetry; + hMdct->prevAliasSymmetry = currAliasSymmetry; + } + + /* Save overlap */ + + pOvl = hMdct->overlap.freq + hMdct->ov_size - tl / 2; + FDKmemcpy(pOvl, &spectrum[(nSpec - 1) * tl], (tl / 2) * sizeof(FIXP_DBL)); + + return nrSamples; +} diff --git a/fdk-aac/libFDK/src/mips/fft_rad2_mips.cpp b/fdk-aac/libFDK/src/mips/fft_rad2_mips.cpp new file mode 100644 index 0000000..7db8b4e --- /dev/null +++ b/fdk-aac/libFDK/src/mips/fft_rad2_mips.cpp @@ -0,0 +1,165 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: dit_fft MIPS assembler replacements. + +*******************************************************************************/ + +#ifndef __FFT_RAD2_CPP__ +#error \ + "Do not compile this file separately. It is included on demand from fft_rad2.cpp" +#endif + +#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; + 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/fdk-aac/libFDK/src/mips/mips_fft_twiddles.cpp b/fdk-aac/libFDK/src/mips/mips_fft_twiddles.cpp new file mode 100644 index 0000000..f905f86 --- /dev/null +++ b/fdk-aac/libFDK/src/mips/mips_fft_twiddles.cpp @@ -0,0 +1,931 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: + +*******************************************************************************/ + +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)}; diff --git a/fdk-aac/libFDK/src/mips/scale_mips.cpp b/fdk-aac/libFDK/src/mips/scale_mips.cpp new file mode 100644 index 0000000..1a3d33c --- /dev/null +++ b/fdk-aac/libFDK/src/mips/scale_mips.cpp @@ -0,0 +1,133 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: + +*******************************************************************************/ + +#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. + * + */ +SCALE_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/fdk-aac/libFDK/src/nlc_dec.cpp b/fdk-aac/libFDK/src/nlc_dec.cpp new file mode 100644 index 0000000..6e98ce0 --- /dev/null +++ b/fdk-aac/libFDK/src/nlc_dec.cpp @@ -0,0 +1,1071 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Omer Osman + + Description: SAC/SAOC Dec Noiseless Coding + +*******************************************************************************/ + +#include "nlc_dec.h" +#include "FDK_tools_rom.h" + +/* MAX_PARAMETER_BANDS defines array length in huffdec */ + +#ifndef min +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +ERROR_t sym_restoreIPD(HANDLE_FDK_BITSTREAM strm, int lav, SCHAR data[2]) { + int sum_val = data[0] + data[1]; + int diff_val = data[0] - data[1]; + + if (sum_val > lav) { + data[0] = -sum_val + (2 * lav + 1); + data[1] = -diff_val; + } else { + data[0] = sum_val; + data[1] = diff_val; + } + + if (data[0] - data[1] != 0) { + ULONG sym_bit; + sym_bit = FDKreadBits(strm, 1); + if (sym_bit) { + int tmp; + tmp = data[0]; + data[0] = data[1]; + data[1] = tmp; + } + } + + return HUFFDEC_OK; +} + +static int ilog2(unsigned int i) { + int l = 0; + + if (i) i--; + while (i > 0) { + i >>= 1; + l++; + } + + return l; +} + +static ERROR_t pcm_decode(HANDLE_FDK_BITSTREAM strm, SCHAR* out_data_1, + SCHAR* out_data_2, int offset, int num_val, + int num_levels) { + int i = 0, j = 0, idx = 0; + int max_grp_len = 0, next_val = 0; + ULONG tmp; + + int pcm_chunk_size[7] = {0}; + + switch (num_levels) { + case 3: + max_grp_len = 5; + break; + case 7: + max_grp_len = 6; + break; + case 11: + max_grp_len = 2; + break; + case 13: + max_grp_len = 4; + break; + case 19: + max_grp_len = 4; + break; + case 25: + max_grp_len = 3; + break; + case 51: + max_grp_len = 4; + break; + case 4: + case 8: + case 15: + case 16: + case 26: + case 31: + max_grp_len = 1; + break; + default: + return HUFFDEC_NOTOK; + } + + tmp = 1; + for (i = 1; i <= max_grp_len; i++) { + tmp *= num_levels; + pcm_chunk_size[i] = ilog2(tmp); + } + + for (i = 0; i < num_val; i += max_grp_len) { + int grp_len, grp_val, data; + grp_len = min(max_grp_len, num_val - i); + data = FDKreadBits(strm, pcm_chunk_size[grp_len]); + + grp_val = data; + + for (j = 0; j < grp_len; j++) { + idx = i + (grp_len - j - 1); + next_val = grp_val % num_levels; + + if (out_data_2 == NULL) { + out_data_1[idx] = next_val - offset; + } else if (out_data_1 == NULL) { + out_data_2[idx] = next_val - offset; + } else { + if (idx % 2) { + out_data_2[idx / 2] = next_val - offset; + } else { + out_data_1[idx / 2] = next_val - offset; + } + } + + grp_val = (grp_val - next_val) / num_levels; + } + } + + return HUFFDEC_OK; +} + +static ERROR_t huff_read(HANDLE_FDK_BITSTREAM strm, + const SHORT (*nodeTab)[MAX_ENTRIES][2], + int* out_data) { + int node = 0; + int len = 0; + + do { + ULONG next_bit; + next_bit = FDKreadBits(strm, 1); + len++; + node = (*nodeTab)[node][next_bit]; + } while (node > 0); + + *out_data = node; + + return HUFFDEC_OK; +} + +static ERROR_t huff_read_2D(HANDLE_FDK_BITSTREAM strm, + const SHORT (*nodeTab)[MAX_ENTRIES][2], + SCHAR out_data[2], int* escape) { + ERROR_t err = HUFFDEC_OK; + + int huff_2D_8bit = 0; + int node = 0; + + if ((err = huff_read(strm, nodeTab, &node)) != HUFFDEC_OK) { + goto bail; + } + *escape = (node == 0); + + if (*escape) { + out_data[0] = 0; + out_data[1] = 1; + } else { + huff_2D_8bit = -(node + 1); + out_data[0] = huff_2D_8bit >> 4; + out_data[1] = huff_2D_8bit & 0xf; + } + +bail: + return err; +} + +static ERROR_t sym_restore(HANDLE_FDK_BITSTREAM strm, int lav, SCHAR data[2]) { + ULONG sym_bit = 0; + + int sum_val = data[0] + data[1]; + int diff_val = data[0] - data[1]; + + if (sum_val > lav) { + data[0] = -sum_val + (2 * lav + 1); + data[1] = -diff_val; + } else { + data[0] = sum_val; + data[1] = diff_val; + } + + if (data[0] + data[1] != 0) { + sym_bit = FDKreadBits(strm, 1); + if (sym_bit) { + data[0] = -data[0]; + data[1] = -data[1]; + } + } + + if (data[0] - data[1] != 0) { + sym_bit = FDKreadBits(strm, 1); + if (sym_bit) { + int tmp; + tmp = data[0]; + data[0] = data[1]; + data[1] = tmp; + } + } + + return HUFFDEC_OK; +} + +static ERROR_t huff_dec_1D(HANDLE_FDK_BITSTREAM strm, const DATA_TYPE data_type, + const INT dim1, SCHAR* out_data, const INT num_val, + const INT p0_flag) + +{ + ERROR_t err = HUFFDEC_OK; + int i = 0, node = 0, offset = 0; + int od = 0, od_sign = 0; + ULONG data = 0; + int bitsAvail = 0; + + const SHORT(*partTab)[MAX_ENTRIES][2] = NULL; + const SHORT(*nodeTab)[MAX_ENTRIES][2] = NULL; + + switch (data_type) { + case t_CLD: + partTab = (HANDLE_HUFF_NODE)&FDK_huffPart0Nodes.cld[0][0]; + nodeTab = (HANDLE_HUFF_NODE)&FDK_huffCLDNodes.h1D[dim1]->nodeTab[0][0]; + break; + case t_ICC: + partTab = (HANDLE_HUFF_NODE)&FDK_huffPart0Nodes.icc[0][0]; + nodeTab = (HANDLE_HUFF_NODE)&FDK_huffICCNodes.h1D[dim1]->nodeTab[0][0]; + break; + case t_OLD: + partTab = (HANDLE_HUFF_NODE)&FDK_huffPart0Nodes.old[0][0]; + nodeTab = (HANDLE_HUFF_NODE)&huffOLDNodes.h1D[dim1]->nodeTab[0][0]; + break; + case t_IPD: + partTab = (HANDLE_HUFF_NODE)&FDK_huffPart0Nodes.ipd[0][0]; + nodeTab = (HANDLE_HUFF_NODE)&FDK_huffIPDNodes.h1D[dim1].nodeTab[0][0]; + break; + default: + FDK_ASSERT(0); + err = HUFFDEC_NOTOK; + goto bail; + } + + if (p0_flag) { + if ((err = huff_read(strm, partTab, &node)) != HUFFDEC_OK) { + goto bail; + } + + out_data[0] = -(node + 1); + offset = 1; + } + + for (i = offset; i < num_val; i++) { + bitsAvail = FDKgetValidBits(strm); + if (bitsAvail < 1) { + err = HUFFDEC_NOTOK; + goto bail; + } + + if ((err = huff_read(strm, nodeTab, &node)) != HUFFDEC_OK) { + goto bail; + } + od = -(node + 1); + + if (data_type != t_IPD) { + if (od != 0) { + bitsAvail = FDKgetValidBits(strm); + if (bitsAvail < 1) { + err = HUFFDEC_NOTOK; + goto bail; + } + + data = FDKreadBits(strm, 1); + od_sign = data; + + if (od_sign) od = -od; + } + } + + out_data[i] = od; + } + +bail: + return err; +} + +static ERROR_t huff_dec_2D(HANDLE_FDK_BITSTREAM strm, const DATA_TYPE data_type, + const INT dim1, const INT dim2, SCHAR out_data[][2], + const INT num_val, const INT stride, + SCHAR* p0_data[2]) { + ERROR_t err = HUFFDEC_OK; + int i = 0, lav = 0, escape = 0, escCntr = 0; + int node = 0; + unsigned long data = 0; + + SCHAR esc_data[2][28] = {{0}}; + int escIdx[28] = {0}; + const SHORT(*nodeTab)[MAX_ENTRIES][2] = NULL; + + /* LAV */ + if ((err = + huff_read(strm, (HANDLE_HUFF_NODE)&FDK_huffLavIdxNodes.nodeTab[0][0], + &node)) != HUFFDEC_OK) { + goto bail; + } + data = -(node + 1); + + switch (data_type) { + case t_CLD: + lav = 2 * data + 3; /* 3, 5, 7, 9 */ + nodeTab = (HANDLE_HUFF_NODE)&FDK_huffPart0Nodes.cld[0][0]; + break; + case t_ICC: + lav = 2 * data + 1; /* 1, 3, 5, 7 */ + nodeTab = (HANDLE_HUFF_NODE)&FDK_huffPart0Nodes.icc[0][0]; + break; + case t_OLD: + lav = 3 * data + 3; + nodeTab = (HANDLE_HUFF_NODE)&FDK_huffPart0Nodes.old[0][0]; + break; + case t_IPD: + if (data == 0) + data = 3; + else + data--; + lav = 2 * data + 1; /* 1, 3, 5, 7 */ + nodeTab = (HANDLE_HUFF_NODE)&FDK_huffPart0Nodes.ipd[0][0]; + break; + default: + FDK_ASSERT(0); + err = HUFFDEC_NOTOK; + goto bail; + } + + /* Partition 0 */ + if (p0_data[0] != NULL) { + if ((err = huff_read(strm, nodeTab, &node)) != HUFFDEC_OK) { + goto bail; + } + *p0_data[0] = -(node + 1); + } + if (p0_data[1] != NULL) { + if ((err = huff_read(strm, nodeTab, &node)) != HUFFDEC_OK) { + goto bail; + } + *p0_data[1] = -(node + 1); + } + + switch (data_type) { + case t_CLD: + switch (lav) { + case 3: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffCLDNodes.h2D[dim1][dim2]->lav3[0][0]; + break; + case 5: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffCLDNodes.h2D[dim1][dim2]->lav5[0][0]; + break; + case 7: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffCLDNodes.h2D[dim1][dim2]->lav7[0][0]; + break; + case 9: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffCLDNodes.h2D[dim1][dim2]->lav9[0][0]; + break; + } + break; + case t_ICC: + switch (lav) { + case 1: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffICCNodes.h2D[dim1][dim2]->lav1[0][0]; + break; + case 3: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffICCNodes.h2D[dim1][dim2]->lav3[0][0]; + break; + case 5: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffICCNodes.h2D[dim1][dim2]->lav5[0][0]; + break; + case 7: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffICCNodes.h2D[dim1][dim2]->lav7[0][0]; + break; + } + break; + case t_OLD: + switch (lav) { + case 3: + nodeTab = (HANDLE_HUFF_NODE)&huffOLDNodes.h2D[dim1][dim2]->lav3[0][0]; + break; + case 6: + nodeTab = (HANDLE_HUFF_NODE)&huffOLDNodes.h2D[dim1][dim2]->lav6[0][0]; + break; + case 9: + nodeTab = (HANDLE_HUFF_NODE)&huffOLDNodes.h2D[dim1][dim2]->lav9[0][0]; + break; + case 12: + nodeTab = + (HANDLE_HUFF_NODE)&huffOLDNodes.h2D[dim1][dim2]->lav12[0][0]; + break; + } + break; + case t_IPD: + switch (lav) { + case 1: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffIPDNodes.h2D[dim1][dim2].lav1[0][0]; + break; + case 3: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffIPDNodes.h2D[dim1][dim2].lav3[0][0]; + break; + case 5: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffIPDNodes.h2D[dim1][dim2].lav5[0][0]; + break; + case 7: + nodeTab = + (HANDLE_HUFF_NODE)&FDK_huffIPDNodes.h2D[dim1][dim2].lav7[0][0]; + break; + } + break; + default: + break; + } + + for (i = 0; i < num_val; i += stride) { + if ((err = huff_read_2D(strm, nodeTab, out_data[i], &escape)) != + HUFFDEC_OK) { + goto bail; + } + + if (escape) { + escIdx[escCntr++] = i; + } else { + if (data_type == t_IPD) { + if ((err = sym_restoreIPD(strm, lav, out_data[i])) != HUFFDEC_OK) { + goto bail; + } + } else { + if ((err = sym_restore(strm, lav, out_data[i])) != HUFFDEC_OK) { + goto bail; + } + } + } + } /* i */ + + if (escCntr > 0) { + if ((err = pcm_decode(strm, esc_data[0], esc_data[1], 0, 2 * escCntr, + (2 * lav + 1))) != HUFFDEC_OK) { + goto bail; + } + + for (i = 0; i < escCntr; i++) { + out_data[escIdx[i]][0] = esc_data[0][i] - lav; + out_data[escIdx[i]][1] = esc_data[1][i] - lav; + } + } +bail: + return err; +} + +static ERROR_t huff_decode(HANDLE_FDK_BITSTREAM strm, SCHAR* out_data_1, + SCHAR* out_data_2, DATA_TYPE data_type, + DIFF_TYPE diff_type_1, DIFF_TYPE diff_type_2, + int num_val, CODING_SCHEME* cdg_scheme, int ldMode) { + ERROR_t err = HUFFDEC_OK; + DIFF_TYPE diff_type; + + int i = 0; + ULONG data = 0; + + SCHAR pair_vec[28][2]; + + SCHAR* p0_data_1[2] = {NULL, NULL}; + SCHAR* p0_data_2[2] = {NULL, NULL}; + + int p0_flag[2]; + + int num_val_1_int = num_val; + int num_val_2_int = num_val; + + SCHAR* out_data_1_int = out_data_1; + SCHAR* out_data_2_int = out_data_2; + + int df_rest_flag_1 = 0; + int df_rest_flag_2 = 0; + + int hufYY1; + int hufYY2; + int hufYY; + + /* Coding scheme */ + data = FDKreadBits(strm, 1); + *cdg_scheme = (CODING_SCHEME)(data << PAIR_SHIFT); + + if (*cdg_scheme >> PAIR_SHIFT == HUFF_2D) { + if ((out_data_1 != NULL) && (out_data_2 != NULL) && (ldMode == 0)) { + data = FDKreadBits(strm, 1); + *cdg_scheme = (CODING_SCHEME)(*cdg_scheme | data); + } else { + *cdg_scheme = (CODING_SCHEME)(*cdg_scheme | FREQ_PAIR); + } + } + + { + hufYY1 = diff_type_1; + hufYY2 = diff_type_2; + } + + switch (*cdg_scheme >> PAIR_SHIFT) { + case HUFF_1D: + p0_flag[0] = (diff_type_1 == DIFF_FREQ); + p0_flag[1] = (diff_type_2 == DIFF_FREQ); + if (out_data_1 != NULL) { + if ((err = huff_dec_1D(strm, data_type, hufYY1, out_data_1, + num_val_1_int, p0_flag[0])) != HUFFDEC_OK) { + goto bail; + } + } + if (out_data_2 != NULL) { + if ((err = huff_dec_1D(strm, data_type, hufYY2, out_data_2, + num_val_2_int, p0_flag[1])) != HUFFDEC_OK) { + goto bail; + } + } + + break; /* HUFF_1D */ + + case HUFF_2D: + + switch (*cdg_scheme & PAIR_MASK) { + case FREQ_PAIR: + + if (out_data_1 != NULL) { + if (diff_type_1 == DIFF_FREQ) { + p0_data_1[0] = &out_data_1[0]; + p0_data_1[1] = NULL; + + num_val_1_int -= 1; + out_data_1_int += 1; + } + df_rest_flag_1 = num_val_1_int % 2; + if (df_rest_flag_1) num_val_1_int -= 1; + if (num_val_1_int < 0) { + err = HUFFDEC_NOTOK; + goto bail; + } + } + if (out_data_2 != NULL) { + if (diff_type_2 == DIFF_FREQ) { + p0_data_2[0] = NULL; + p0_data_2[1] = &out_data_2[0]; + + num_val_2_int -= 1; + out_data_2_int += 1; + } + df_rest_flag_2 = num_val_2_int % 2; + if (df_rest_flag_2) num_val_2_int -= 1; + if (num_val_2_int < 0) { + err = HUFFDEC_NOTOK; + goto bail; + } + } + + if (out_data_1 != NULL) { + if ((err = huff_dec_2D(strm, data_type, hufYY1, FREQ_PAIR, pair_vec, + num_val_1_int, 2, p0_data_1)) != + HUFFDEC_OK) { + goto bail; + } + if (df_rest_flag_1) { + if ((err = huff_dec_1D(strm, data_type, hufYY1, + out_data_1_int + num_val_1_int, 1, 0)) != + HUFFDEC_OK) { + goto bail; + } + } + } + if (out_data_2 != NULL) { + if ((err = huff_dec_2D(strm, data_type, hufYY2, FREQ_PAIR, + pair_vec + 1, num_val_2_int, 2, + p0_data_2)) != HUFFDEC_OK) { + goto bail; + } + if (df_rest_flag_2) { + if ((err = huff_dec_1D(strm, data_type, hufYY2, + out_data_2_int + num_val_2_int, 1, 0)) != + HUFFDEC_OK) { + goto bail; + } + } + } + + if (out_data_1 != NULL) { + for (i = 0; i < num_val_1_int - 1; i += 2) { + out_data_1_int[i] = pair_vec[i][0]; + out_data_1_int[i + 1] = pair_vec[i][1]; + } + } + if (out_data_2 != NULL) { + for (i = 0; i < num_val_2_int - 1; i += 2) { + out_data_2_int[i] = pair_vec[i + 1][0]; + out_data_2_int[i + 1] = pair_vec[i + 1][1]; + } + } + break; /* FREQ_PAIR */ + + case TIME_PAIR: + if (((diff_type_1 == DIFF_FREQ) || (diff_type_2 == DIFF_FREQ))) { + p0_data_1[0] = &out_data_1[0]; + p0_data_1[1] = &out_data_2[0]; + + out_data_1_int += 1; + out_data_2_int += 1; + + num_val_1_int -= 1; + } + + if ((diff_type_1 == DIFF_TIME) || (diff_type_2 == DIFF_TIME)) { + diff_type = DIFF_TIME; + } else { + diff_type = DIFF_FREQ; + } + { hufYY = diff_type; } + + if ((err = huff_dec_2D(strm, data_type, hufYY, TIME_PAIR, pair_vec, + num_val_1_int, 1, p0_data_1)) != HUFFDEC_OK) { + goto bail; + } + + for (i = 0; i < num_val_1_int; i++) { + out_data_1_int[i] = pair_vec[i][0]; + out_data_2_int[i] = pair_vec[i][1]; + } + + break; /* TIME_PAIR */ + + default: + break; + } + + break; /* HUFF_2D */ + + default: + break; + } +bail: + return err; +} + +static void diff_freq_decode(const SCHAR* const diff_data, + SCHAR* const out_data, const int num_val) { + int i = 0; + out_data[0] = diff_data[0]; + + for (i = 1; i < num_val; i++) { + out_data[i] = out_data[i - 1] + diff_data[i]; + } +} + +static void diff_time_decode_backwards(const SCHAR* const prev_data, + const SCHAR* const diff_data, + SCHAR* const out_data, + const int mixed_diff_type, + const int num_val) { + int i = 0; /* default start value*/ + + if (mixed_diff_type) { + out_data[0] = diff_data[0]; + i = 1; /* new start value */ + } + for (; i < num_val; i++) { + out_data[i] = prev_data[i] + diff_data[i]; + } +} + +static void diff_time_decode_forwards(const SCHAR* const prev_data, + const SCHAR* const diff_data, + SCHAR* const out_data, + const int mixed_diff_type, + const int num_val) { + int i = 0; /* default start value*/ + + if (mixed_diff_type) { + out_data[0] = diff_data[0]; + i = 1; /* new start value */ + } + for (; i < num_val; i++) { + out_data[i] = prev_data[i] - diff_data[i]; + } +} + +static ERROR_t attach_lsb(HANDLE_FDK_BITSTREAM strm, SCHAR* in_data_msb, + int offset, int num_lsb, int num_val, + SCHAR* out_data) { + int i = 0, lsb = 0; + ULONG data = 0; + + for (i = 0; i < num_val; i++) { + int msb; + msb = in_data_msb[i]; + + if (num_lsb > 0) { + data = FDKreadBits(strm, num_lsb); + lsb = data; + + out_data[i] = ((msb << num_lsb) | lsb) - offset; + } else + out_data[i] = msb - offset; + } + + return HUFFDEC_OK; /* dummy */ +} + +ERROR_t EcDataPairDec(DECODER_TYPE DECODER, HANDLE_FDK_BITSTREAM strm, + SCHAR* aaOutData1, SCHAR* aaOutData2, SCHAR* aHistory, + DATA_TYPE data_type, int startBand, int dataBands, + int pair_flag, int coarse_flag, + int allowDiffTimeBack_flag) + +{ + ERROR_t err = HUFFDEC_OK; + + // int allowDiffTimeBack_flag = !independency_flag || (setIdx > 0); + int attachLsb_flag = 0; + int pcmCoding_flag = 0; + + int mixed_time_pair = 0, numValPcm = 0; + int quant_levels = 0, quant_offset = 0; + ULONG data = 0; + + SCHAR aaDataPair[2][28] = {{0}}; + SCHAR aaDataDiff[2][28] = {{0}}; + + SCHAR aHistoryMsb[28] = {0}; + + SCHAR* pDataVec[2] = {NULL, NULL}; + + DIFF_TYPE diff_type[2] = {DIFF_FREQ, DIFF_FREQ}; + CODING_SCHEME cdg_scheme = HUFF_1D; + DIRECTION direction = BACKWARDS; + + switch (data_type) { + case t_CLD: + if (coarse_flag) { + attachLsb_flag = 0; + quant_levels = 15; + quant_offset = 7; + } else { + attachLsb_flag = 0; + quant_levels = 31; + quant_offset = 15; + } + + break; + + case t_ICC: + if (coarse_flag) { + attachLsb_flag = 0; + quant_levels = 4; + quant_offset = 0; + } else { + attachLsb_flag = 0; + quant_levels = 8; + quant_offset = 0; + } + + break; + + case t_OLD: + if (coarse_flag) { + attachLsb_flag = 0; + quant_levels = 8; + quant_offset = 0; + } else { + attachLsb_flag = 0; + quant_levels = 16; + quant_offset = 0; + } + break; + + case t_NRG: + if (coarse_flag) { + attachLsb_flag = 0; + quant_levels = 32; + quant_offset = 0; + } else { + attachLsb_flag = 0; + quant_levels = 64; + quant_offset = 0; + } + break; + + case t_IPD: + if (!coarse_flag) { + attachLsb_flag = 1; + quant_levels = 16; + quant_offset = 0; + } else { + attachLsb_flag = 0; + quant_levels = 8; + quant_offset = 0; + } + break; + + default: + return HUFFDEC_NOTOK; + } + + data = FDKreadBits(strm, 1); + pcmCoding_flag = data; + + if (pcmCoding_flag) { + if (pair_flag) { + pDataVec[0] = aaDataPair[0]; + pDataVec[1] = aaDataPair[1]; + numValPcm = 2 * dataBands; + } else { + pDataVec[0] = aaDataPair[0]; + pDataVec[1] = NULL; + numValPcm = dataBands; + } + + err = pcm_decode(strm, pDataVec[0], pDataVec[1], quant_offset, numValPcm, + quant_levels); + if (err != HUFFDEC_OK) return HUFFDEC_NOTOK; + + } else { /* Differential/Huffman/LSB Coding */ + + if (pair_flag) { + pDataVec[0] = aaDataDiff[0]; + pDataVec[1] = aaDataDiff[1]; + } else { + pDataVec[0] = aaDataDiff[0]; + pDataVec[1] = NULL; + } + + diff_type[0] = DIFF_FREQ; + diff_type[1] = DIFF_FREQ; + + direction = BACKWARDS; + { + if (pair_flag || allowDiffTimeBack_flag) { + data = FDKreadBits(strm, 1); + diff_type[0] = (DIFF_TYPE)data; + } + + if (pair_flag && + ((diff_type[0] == DIFF_FREQ) || allowDiffTimeBack_flag)) { + data = FDKreadBits(strm, 1); + diff_type[1] = (DIFF_TYPE)data; + } + } + /* Huffman decoding */ + err = huff_decode(strm, pDataVec[0], pDataVec[1], data_type, diff_type[0], + diff_type[1], dataBands, &cdg_scheme, + (DECODER == SAOC_DECODER)); + if (err != HUFFDEC_OK) { + return HUFFDEC_NOTOK; + } + + { + /* Differential decoding */ + if ((diff_type[0] == DIFF_TIME) || (diff_type[1] == DIFF_TIME)) { + if (DECODER == SAOC_DECODER) { + direction = BACKWARDS; + } else { + if (pair_flag) { + if ((diff_type[0] == DIFF_TIME) && !allowDiffTimeBack_flag) { + direction = FORWARDS; + } else if (diff_type[1] == DIFF_TIME) { + direction = BACKWARDS; + } else { + data = FDKreadBits(strm, 1); + direction = (DIRECTION)data; + } + } else { + direction = BACKWARDS; + } + } + } + + mixed_time_pair = (diff_type[0] != diff_type[1]) && + ((cdg_scheme & PAIR_MASK) == TIME_PAIR); + + if (direction == BACKWARDS) { + if (diff_type[0] == DIFF_FREQ) { + diff_freq_decode(aaDataDiff[0], aaDataPair[0], dataBands); + } else { + int i; + for (i = 0; i < dataBands; i++) { + aHistoryMsb[i] = aHistory[i + startBand] + quant_offset; + if (attachLsb_flag) { + aHistoryMsb[i] >>= 1; + } + } + diff_time_decode_backwards(aHistoryMsb, aaDataDiff[0], aaDataPair[0], + mixed_time_pair, dataBands); + } + if (diff_type[1] == DIFF_FREQ) { + diff_freq_decode(aaDataDiff[1], aaDataPair[1], dataBands); + } else { + diff_time_decode_backwards(aaDataPair[0], aaDataDiff[1], + aaDataPair[1], mixed_time_pair, dataBands); + } + } else { + /* diff_type[1] MUST BE DIFF_FREQ */ + diff_freq_decode(aaDataDiff[1], aaDataPair[1], dataBands); + + if (diff_type[0] == DIFF_FREQ) { + diff_freq_decode(aaDataDiff[0], aaDataPair[0], dataBands); + } else { + diff_time_decode_forwards(aaDataPair[1], aaDataDiff[0], aaDataPair[0], + mixed_time_pair, dataBands); + } + } + } + + /* LSB decoding */ + err = attach_lsb(strm, aaDataPair[0], quant_offset, attachLsb_flag ? 1 : 0, + dataBands, aaDataPair[0]); + if (err != HUFFDEC_OK) goto bail; + + if (pair_flag) { + err = attach_lsb(strm, aaDataPair[1], quant_offset, + attachLsb_flag ? 1 : 0, dataBands, aaDataPair[1]); + if (err != HUFFDEC_OK) goto bail; + } + } /* End: Differential/Huffman/LSB Coding */ + + /* Copy data to output arrays */ + FDKmemcpy(aaOutData1 + startBand, aaDataPair[0], sizeof(SCHAR) * dataBands); + if (pair_flag) { + FDKmemcpy(aaOutData2 + startBand, aaDataPair[1], sizeof(SCHAR) * dataBands); + } + +bail: + return err; +} + +ERROR_t huff_dec_reshape(HANDLE_FDK_BITSTREAM strm, int* out_data, + int num_val) { + ERROR_t err = HUFFDEC_OK; + int val_rcvd = 0, dummy = 0, i = 0, val = 0, len = 0; + SCHAR rl_data[2] = {0}; + + while (val_rcvd < num_val) { + err = huff_read_2D(strm, + (HANDLE_HUFF_NODE)&FDK_huffReshapeNodes.nodeTab[0][0], + rl_data, &dummy); + if (err != HUFFDEC_OK) goto bail; + val = rl_data[0]; + len = rl_data[1] + 1; + if (val_rcvd + len > num_val) { + err = HUFFDEC_NOTOK; + goto bail; + } + for (i = val_rcvd; i < val_rcvd + len; i++) { + out_data[i] = val; + } + val_rcvd += len; + } +bail: + return err; +} diff --git a/fdk-aac/libFDK/src/qmf.cpp b/fdk-aac/libFDK/src/qmf.cpp new file mode 100644 index 0000000..6fca043 --- /dev/null +++ b/fdk-aac/libFDK/src/qmf.cpp @@ -0,0 +1,1135 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): Markus Lohwasser, Josef Hoepfl, Manuel Jander + + Description: QMF filterbank + +*******************************************************************************/ + +/*! + \file + \brief Complex qmf analysis/synthesis + 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 #qmf_pfilt640 (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

About polyphase filtering

+ 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 "FDK_trigFcts.h" +#include "fixpoint_math.h" +#include "dct.h" + +#define QSSCALE (0) +#define FX_DBL2FX_QSS(x) (x) +#define FX_QSS2FX_DBL(x) (x) + +/* moved to qmf_pcm.h: -> qmfSynPrototypeFirSlot */ +/* moved to qmf_pcm.h: -> qmfSynPrototypeFirSlot_NonSymmetric */ +/* moved to qmf_pcm.h: -> qmfSynthesisFilteringSlot */ + +#ifndef FUNCTION_qmfAnaPrototypeFirSlot +/*! + \brief Perform Analysis Prototype Filtering on a single slot of input data. +*/ +static void qmfAnaPrototypeFirSlot( + FIXP_DBL *analysisBuffer, + INT no_channels, /*!< Number channels of analysis filter */ + const FIXP_PFT *p_filter, INT p_stride, /*!< Stride of analysis filter */ + FIXP_QAS *RESTRICT pFilterStates) { + INT k; + + FIXP_DBL accu; + const FIXP_PFT *RESTRICT p_flt = p_filter; + FIXP_DBL *RESTRICT pData_0 = analysisBuffer + 2 * no_channels - 1; + FIXP_DBL *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 filters 127..64 0..63 */ + for (k = 0; k < no_channels; k++) { + 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++ = (accu << 1); + sta_1 += staStep2; + + p_flt += pfltStep; + 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-- = (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_DBL *analysisBuffer, + int no_channels, /*!< Number channels of analysis filter */ + const FIXP_PFT *p_filter, int p_stride, /*!< Stride 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] = (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_DBL *timeIn, /*!< Time Signal */ + FIXP_DBL *rSubband) /*!< Real Output */ +{ + int i; + int L = anaQmf->no_channels; + int M = L >> 1; + int scale; + FIXP_DBL accu; + + const FIXP_DBL *timeInTmp1 = (FIXP_DBL *)&timeIn[3 * M]; + const FIXP_DBL *timeInTmp2 = timeInTmp1; + FIXP_DBL *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_DBL *timeIn, /*!< Time Signal */ + FIXP_DBL *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 + * + * + */ +#if !defined(FUNCTION_qmfForwardModulationHQ) +static void qmfForwardModulationHQ( + HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Analysis Bank */ + const FIXP_DBL *RESTRICT timeIn, /*!< Time Signal */ + FIXP_DBL *RESTRICT rSubband, /*!< Real Output */ + FIXP_DBL *RESTRICT iSubband /*!< Imaginary Output */ +) { + int i; + int L = anaQmf->no_channels; + int L2 = L << 1; + int shift = 0; + + /* Time advance by one sample, which is equivalent to the complex + rotation at the end of the analysis. Works only for STD mode. */ + if ((L == 64) && !(anaQmf->flags & (QMF_FLAG_CLDFB | QMF_FLAG_MPSLDFB))) { + FIXP_DBL x, y; + + /*rSubband[0] = u[1] + u[0]*/ + /*iSubband[0] = u[1] - u[0]*/ + x = timeIn[1] >> 1; + y = timeIn[0]; + rSubband[0] = x + (y >> 1); + iSubband[0] = x - (y >> 1); + + /*rSubband[n] = u[n+1] - u[2M-n], n=1,...,M-1*/ + /*iSubband[n] = u[n+1] + u[2M-n], n=1,...,M-1*/ + for (i = 1; i < L; i++) { + x = timeIn[i + 1] >> 1; /*u[n+1] */ + y = timeIn[L2 - i]; /*u[2M-n] */ + rSubband[i] = x - (y >> 1); + iSubband[i] = x + (y >> 1); + } + } else { + for (i = 0; i < L; i += 2) { + FIXP_DBL x0, x1, y0, y1; + + x0 = timeIn[i + 0] >> 1; + x1 = timeIn[i + 1] >> 1; + y0 = timeIn[L2 - 1 - i]; + y1 = timeIn[L2 - 2 - i]; + + rSubband[i + 0] = x0 - (y0 >> 1); + rSubband[i + 1] = x1 - (y1 >> 1); + iSubband[i + 0] = x0 + (y0 >> 1); + iSubband[i + 1] = x1 + (y1 >> 1); + } + } + + dct_IV(rSubband, L, &shift); + dst_IV(iSubband, L, &shift); + + /* Do the complex rotation except for the case of 64 bands (in STD mode). */ + if ((L != 64) || (anaQmf->flags & (QMF_FLAG_CLDFB | QMF_FLAG_MPSLDFB))) { + if (anaQmf->flags & QMF_FLAG_MPSLDFB_OPTIMIZE_MODULATION) { + FIXP_DBL iBand; + for (i = 0; i < fMin(anaQmf->lsb, L); i += 2) { + iBand = rSubband[i]; + rSubband[i] = -iSubband[i]; + iSubband[i] = iBand; + + iBand = -rSubband[i + 1]; + rSubband[i + 1] = iSubband[i + 1]; + iSubband[i + 1] = iBand; + } + } else { + const FIXP_QTW *sbr_t_cos; + const FIXP_QTW *sbr_t_sin; + const int len = L; /* was len = fMin(anaQmf->lsb, L) but in case of USAC + the signal above lsb is actually needed in some + cases (HBE?) */ + sbr_t_cos = anaQmf->t_cos; + sbr_t_sin = anaQmf->t_sin; + + for (i = 0; i < len; i++) { + cplxMult(&iSubband[i], &rSubband[i], iSubband[i], rSubband[i], + sbr_t_cos[i], sbr_t_sin[i]); + } + } + } +} +#endif /* FUNCTION_qmfForwardModulationHQ */ + +/* + * \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 + * + * Note: anaQmf->lsb can be greater than anaQmf->no_channels in case + * of implicit resampling (USAC with reduced 3/4 core frame length). + */ +#if (SAMPLE_BITS != DFRACT_BITS) && (QAS_BITS == DFRACT_BITS) +void qmfAnalysisFilteringSlot( + HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_DBL *qmfReal, /*!< Low and High band, real */ + FIXP_DBL *qmfImag, /*!< Low and High band, imag */ + const LONG *RESTRICT timeIn, /*!< Pointer to input */ + const int stride, /*!< stride factor of input */ + FIXP_DBL *pWorkBuffer /*!< pointer to temporal working buffer */ +) { + int offset = anaQmf->no_channels * (QMF_NO_POLY * 2 - 1); + /* + Feed time signal into oldest anaQmf->no_channels states + */ + { + FIXP_DBL *FilterStatesAnaTmp = ((FIXP_DBL *)anaQmf->FilterStates) + offset; + + /* Feed and scale actual time in slot */ + for (int i = anaQmf->no_channels >> 1; i != 0; i--) { + /* Place INT_PCM value left aligned in scaledTimeIn */ + + *FilterStatesAnaTmp++ = (FIXP_QAS)*timeIn; + timeIn += stride; + *FilterStatesAnaTmp++ = (FIXP_QAS)*timeIn; + timeIn += stride; + } + } + + 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(anaQmf->FilterStates, + (FIXP_QAS *)anaQmf->FilterStates + anaQmf->no_channels, + offset * sizeof(FIXP_QAS)); +} +#endif + +void qmfAnalysisFilteringSlot( + HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Synthesis Bank */ + FIXP_DBL *qmfReal, /*!< Low and High band, real */ + FIXP_DBL *qmfImag, /*!< Low and High band, imag */ + const INT_PCM *RESTRICT timeIn, /*!< Pointer to input */ + const int stride, /*!< stride factor of input */ + FIXP_DBL *pWorkBuffer /*!< pointer to temporal working buffer */ +) { + int offset = anaQmf->no_channels * (QMF_NO_POLY * 2 - 1); + /* + Feed time signal into oldest anaQmf->no_channels states + */ + { + FIXP_QAS *FilterStatesAnaTmp = ((FIXP_QAS *)anaQmf->FilterStates) + offset; + + /* Feed and scale actual time in slot */ + for (int 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(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. + * + * + * \sa PolyphaseFiltering + */ +#if (SAMPLE_BITS != DFRACT_BITS) && (QAS_BITS == DFRACT_BITS) +void qmfAnalysisFiltering( + HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Analysis Bank */ + FIXP_DBL **qmfReal, /*!< Pointer to real subband slots */ + FIXP_DBL **qmfImag, /*!< Pointer to imag subband slots */ + QMF_SCALE_FACTOR *scaleFactor, const LONG *timeIn, /*!< Time signal */ + const int timeIn_e, const int stride, + FIXP_DBL *pWorkBuffer /*!< pointer to temporal working buffer */ +) { + int i; + int no_channels = anaQmf->no_channels; + + scaleFactor->lb_scale = + -ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK - timeIn_e; + scaleFactor->lb_scale -= anaQmf->filterScale; + + for (i = 0; i < anaQmf->no_col; i++) { + FIXP_DBL *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 */ +} +#endif + +void qmfAnalysisFiltering( + HANDLE_QMF_FILTER_BANK anaQmf, /*!< Handle of Qmf Analysis Bank */ + FIXP_DBL **qmfReal, /*!< Pointer to real subband slots */ + FIXP_DBL **qmfImag, /*!< Pointer to imag subband slots */ + QMF_SCALE_FACTOR *scaleFactor, const INT_PCM *timeIn, /*!< Time signal */ + const int timeIn_e, const int stride, + FIXP_DBL *pWorkBuffer /*!< pointer to temporal working buffer */ +) { + int i; + int no_channels = anaQmf->no_channels; + + scaleFactor->lb_scale = + -ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK - timeIn_e; + scaleFactor->lb_scale -= anaQmf->filterScale; + + for (i = 0; i < anaQmf->no_col; i++) { + FIXP_DBL *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_DBL *qmfReal, /*!< Pointer to qmf real subband slot (input) */ + const int scaleFactorLowBand, /*!< Scalefactor for Low band */ + const int scaleFactorHighBand, /*!< Scalefactor for High band */ + FIXP_DBL *pTimeOut /*!< Pointer to qmf subband slot (output)*/ +) { + int i; + int L = synQmf->no_channels; + int M = L >> 1; + int scale; + FIXP_DBL tmp; + FIXP_DBL *RESTRICT tReal = pTimeOut; + FIXP_DBL *RESTRICT tImag = pTimeOut + L; + + /* Move input to output vector with offset */ + scaleValues(&tReal[0], &qmfReal[0], synQmf->lsb, (int)scaleFactorLowBand); + scaleValues(&tReal[0 + synQmf->lsb], &qmfReal[0 + synQmf->lsb], + synQmf->usb - synQmf->lsb, (int)scaleFactorHighBand); + FDKmemclear(&tReal[0 + synQmf->usb], (L - synQmf->usb) * sizeof(FIXP_DBL)); + + /* 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_DBL)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_DBL *qmfReal, /*!< Pointer to qmf real subband slot (input) */ + const int scaleFactorLowBand, /*!< Scalefactor for Low band */ + const int scaleFactorHighBand, /*!< Scalefactor for High band */ + FIXP_DBL *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_DBL)); + + 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]; + } +} + +#ifndef FUNCTION_qmfInverseModulationHQ +/*! + * + * \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_DBL *qmfReal, /*!< Pointer to qmf real subband slot */ + const FIXP_DBL *qmfImag, /*!< Pointer to qmf imag subband slot */ + const int scaleFactorLowBand, /*!< Scalefactor for Low band */ + const int scaleFactorHighBand, /*!< Scalefactor for High band */ + FIXP_DBL *pWorkBuffer /*!< WorkBuffer (output) */ +) { + int i; + int L = synQmf->no_channels; + int M = L >> 1; + int shift = 0; + FIXP_DBL *RESTRICT tReal = pWorkBuffer; + FIXP_DBL *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, (int)scaleFactorLowBand); + scaleValues(&tReal[0 + synQmf->lsb], &qmfReal[0 + synQmf->lsb], + synQmf->usb - synQmf->lsb, (int)scaleFactorHighBand); + scaleValues(&tImag[0], &qmfImag[0], synQmf->lsb, (int)scaleFactorLowBand); + scaleValues(&tImag[0 + synQmf->lsb], &qmfImag[0 + synQmf->lsb], + synQmf->usb - synQmf->lsb, (int)scaleFactorHighBand); + } + + FDKmemclear(&tReal[synQmf->usb], + (synQmf->no_channels - synQmf->usb) * sizeof(FIXP_DBL)); + FDKmemclear(&tImag[synQmf->usb], + (synQmf->no_channels - synQmf->usb) * sizeof(FIXP_DBL)); + + dct_IV(tReal, L, &shift); + dst_IV(tImag, L, &shift); + + if (synQmf->flags & QMF_FLAG_CLDFB) { + for (i = 0; i < M; i++) { + FIXP_DBL 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_DBL 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; + } + } +} +#endif /* #ifndef FUNCTION_qmfInverseModulationHQ */ + +/*! + * + * \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 */ + int synflag) /*!< 1: synthesis; 0: analysis */ +{ + FDKmemclear(h_Qmf, sizeof(QMF_FILTER_BANK)); + + if (flags & QMF_FLAG_MPSLDFB) { + flags |= QMF_FLAG_NONSYMMETRIC; + flags |= QMF_FLAG_MPSLDFB_OPTIMIZE_MODULATION; + + h_Qmf->t_cos = NULL; + h_Qmf->t_sin = NULL; + h_Qmf->filterScale = QMF_MPSLDFB_PFT_SCALE; + h_Qmf->p_stride = 1; + + switch (no_channels) { + case 64: + h_Qmf->p_filter = qmf_mpsldfb_640; + h_Qmf->FilterSize = 640; + break; + case 32: + h_Qmf->p_filter = qmf_mpsldfb_320; + h_Qmf->FilterSize = 320; + break; + default: + 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 = (synflag) ? qmf_phaseshift_cos32_cldfb_syn + : qmf_phaseshift_cos32_cldfb_ana; + h_Qmf->t_sin = qmf_phaseshift_sin32_cldfb; + h_Qmf->p_filter = qmf_cldfb_320; + h_Qmf->FilterSize = 320; + break; + case 16: + h_Qmf->t_cos = (synflag) ? qmf_phaseshift_cos16_cldfb_syn + : qmf_phaseshift_cos16_cldfb_ana; + h_Qmf->t_sin = qmf_phaseshift_sin16_cldfb; + h_Qmf->p_filter = qmf_cldfb_160; + h_Qmf->FilterSize = 160; + break; + case 8: + h_Qmf->t_cos = (synflag) ? qmf_phaseshift_cos8_cldfb_syn + : qmf_phaseshift_cos8_cldfb_ana; + h_Qmf->t_sin = qmf_phaseshift_sin8_cldfb; + h_Qmf->p_filter = qmf_cldfb_80; + h_Qmf->FilterSize = 80; + break; + default: + return -1; + } + } + + if (!(flags & QMF_FLAG_MPSLDFB) && ((flags & QMF_FLAG_CLDFB) == 0)) { + switch (no_channels) { + case 64: + h_Qmf->p_filter = qmf_pfilt640; + 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 40: + if (synflag) { + break; + } else { + h_Qmf->p_filter = qmf_pfilt400; /* Scaling factor 0.8 */ + h_Qmf->t_cos = qmf_phaseshift_cos40; + h_Qmf->t_sin = qmf_phaseshift_sin40; + h_Qmf->filterScale = 1; + h_Qmf->p_stride = 1; + h_Qmf->FilterSize = no_channels * 10; + } + break; + case 32: + h_Qmf->p_filter = qmf_pfilt640; + if (flags & QMF_FLAG_DOWNSAMPLED) { + h_Qmf->t_cos = qmf_phaseshift_cos_downsamp32; + h_Qmf->t_sin = qmf_phaseshift_sin_downsamp32; + } else { + 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; + case 20: + h_Qmf->p_filter = qmf_pfilt200; + h_Qmf->p_stride = 1; + h_Qmf->FilterSize = 200; + h_Qmf->filterScale = 0; + break; + case 12: + h_Qmf->p_filter = qmf_pfilt120; + h_Qmf->p_stride = 1; + h_Qmf->FilterSize = 120; + h_Qmf->filterScale = 0; + break; + case 8: + h_Qmf->p_filter = qmf_pfilt640; + h_Qmf->p_stride = 8; + h_Qmf->FilterSize = 640; + h_Qmf->filterScale = 0; + break; + case 16: + h_Qmf->p_filter = qmf_pfilt640; + h_Qmf->t_cos = qmf_phaseshift_cos16; + h_Qmf->t_sin = qmf_phaseshift_sin16; + h_Qmf->p_stride = 4; + h_Qmf->FilterSize = 640; + h_Qmf->filterScale = 0; + break; + case 24: + h_Qmf->p_filter = qmf_pfilt240; + h_Qmf->t_cos = qmf_phaseshift_cos24; + h_Qmf->t_sin = qmf_phaseshift_sin24; + h_Qmf->p_stride = 1; + h_Qmf->FilterSize = 240; + h_Qmf->filterScale = 1; + break; + default: + return -1; + } + } + + h_Qmf->synScalefactor = h_Qmf->filterScale; + // DCT|DST dependency + switch (no_channels) { + case 128: + h_Qmf->synScalefactor += ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK + 1; + break; + case 40: { + h_Qmf->synScalefactor += ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK - 1; + } break; + case 64: + h_Qmf->synScalefactor += ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK; + break; + case 8: + h_Qmf->synScalefactor += ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK - 3; + break; + case 12: + h_Qmf->synScalefactor += ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK; + break; + case 20: + h_Qmf->synScalefactor += ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK + 1; + break; + case 32: + h_Qmf->synScalefactor += ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK - 1; + break; + case 16: + h_Qmf->synScalefactor += ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK - 2; + break; + case 24: + h_Qmf->synScalefactor += ALGORITHMIC_SCALING_IN_SYNTHESIS_FILTERBANK - 1; + break; + default: + return -1; + } + + h_Qmf->flags = flags; + + h_Qmf->no_channels = no_channels; + h_Qmf->no_col = noCols; + + h_Qmf->lsb = fMin(lsb, h_Qmf->no_channels); + h_Qmf->usb = synflag + ? fMin(usb, h_Qmf->no_channels) + : usb; /* was: h_Qmf->usb = fMin(usb, h_Qmf->no_channels); */ + + h_Qmf->FilterStates = (void *)pFilterStates; + + h_Qmf->outScalefactor = + (ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK + h_Qmf->filterScale) + + h_Qmf->synScalefactor; + + h_Qmf->outGain_m = + (FIXP_DBL)0x80000000; /* default init value will be not applied */ + h_Qmf->outGain_e = 0; + + 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; + } + if (scaleFactorDiff > 0) { + scaleValuesSaturate((FIXP_QSS *)synQmf->FilterStates, + synQmf->no_channels * (QMF_NO_POLY * 2 - 1), + scaleFactorDiff); + } else { + scaleValues((FIXP_QSS *)synQmf->FilterStates, + synQmf->no_channels * (QMF_NO_POLY * 2 - 1), scaleFactorDiff); + } +} + +/*! + * + * \brief Create QMF filter bank instance + * + * + * \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, 0); + 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)); + } + + FDK_ASSERT(h_Qmf->no_channels >= h_Qmf->lsb); + + return err; +} + +/*! + * + * \brief Create QMF filter bank instance + * + * + * \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, 1); + 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); + } + } + + FDK_ASSERT(h_Qmf->no_channels >= h_Qmf->lsb); + FDK_ASSERT(h_Qmf->no_channels >= h_Qmf->usb); + + 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) { + return; + } + + /* Add internal filterbank scale */ + outScalefactor += + (ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK + synQmf->filterScale) + + synQmf->synScalefactor; + + /* adjust filter states when scale factor has been changed */ + if (synQmf->outScalefactor != outScalefactor) { + int diff; + + diff = synQmf->outScalefactor - outScalefactor; + + qmfAdaptFilterStates(synQmf, diff); + + /* save new scale factor */ + synQmf->outScalefactor = outScalefactor; + } +} + +/*! + * + * \brief Get scale factor change which was set by qmfChangeOutScalefactor() + * + * \return scaleFactor + * + */ +int qmfGetOutScalefactor( + HANDLE_QMF_FILTER_BANK synQmf) /*!< Handle of Qmf Synthesis Bank */ +{ + int scaleFactor = synQmf->outScalefactor + ? (synQmf->outScalefactor - + (ALGORITHMIC_SCALING_IN_ANALYSIS_FILTERBANK + + synQmf->filterScale + synQmf->synScalefactor)) + : 0; + return scaleFactor; +} + +/*! + * + * \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 (mantissa) */ + int outputGainScale /*!< New gain for output data (exponent) */ +) { + synQmf->outGain_m = outputGain; + synQmf->outGain_e = outputGainScale; +} + +/* When QMF_16IN_32OUT is set, synthesis functions for 16 and 32 bit parallel + * output is compiled */ +#define INT_PCM_QMFOUT INT_PCM +#define SAMPLE_BITS_QMFOUT SAMPLE_BITS +#include "qmf_pcm.h" diff --git a/fdk-aac/libFDK/src/scale.cpp b/fdk-aac/libFDK/src/scale.cpp new file mode 100644 index 0000000..24a8a5b --- /dev/null +++ b/fdk-aac/libFDK/src/scale.cpp @@ -0,0 +1,720 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/******************* Library for basic calculation routines ******************** + + Author(s): + + Description: Scaling operations + +*******************************************************************************/ + +#include "common_fix.h" + +#include "genericStds.h" + +/************************************************** + * Inline definitions + **************************************************/ + +#include "scale.h" + +#if defined(__mips__) +#include "mips/scale_mips.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 +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)(FRACT_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)FRACT_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_scaleValuesSaturate_DBL +/*! + * + * \brief Multiply input vector by \f$ 2^{scalefactor} \f$ + * \param vector source/destination buffer + * \param len length of vector + * \param scalefactor amount of shifts to be applied + * \return void + * + */ +#define FUNCTION_scaleValuesSaturate_DBL +SCALE_INLINE +void scaleValuesSaturate(FIXP_DBL *vector, /*!< Vector */ + INT len, /*!< Length */ + INT scalefactor /*!< Scalefactor */ +) { + INT i; + + /* Return if scalefactor is Zero */ + if (scalefactor == 0) return; + + scalefactor = fixmax_I(fixmin_I(scalefactor, (INT)DFRACT_BITS - 1), + (INT) - (DFRACT_BITS - 1)); + + for (i = 0; i < len; i++) { + vector[i] = scaleValueSaturate(vector[i], scalefactor); + } +} +#endif /* FUNCTION_scaleValuesSaturate_DBL */ + +#ifndef FUNCTION_scaleValuesSaturate_DBL_DBL +/*! + * + * \brief Multiply input vector by \f$ 2^{scalefactor} \f$ + * \param dst destination buffer + * \param src source buffer + * \param len length of vector + * \param scalefactor amount of shifts to be applied + * \return void + * + */ +#define FUNCTION_scaleValuesSaturate_DBL_DBL +SCALE_INLINE +void scaleValuesSaturate(FIXP_DBL *dst, /*!< Output */ + FIXP_DBL *src, /*!< Input */ + INT len, /*!< Length */ + INT scalefactor /*!< Scalefactor */ +) { + INT i; + + /* Return if scalefactor is Zero */ + if (scalefactor == 0) { + FDKmemmove(dst, src, len * sizeof(FIXP_DBL)); + return; + } + + scalefactor = fixmax_I(fixmin_I(scalefactor, (INT)DFRACT_BITS - 1), + (INT) - (DFRACT_BITS - 1)); + + for (i = 0; i < len; i++) { + dst[i] = scaleValueSaturate(src[i], scalefactor); + } +} +#endif /* FUNCTION_scaleValuesSaturate_DBL_DBL */ + +#ifndef FUNCTION_scaleValuesSaturate_SGL_DBL +/*! + * + * \brief Multiply input vector by \f$ 2^{scalefactor} \f$ + * \param dst destination buffer (FIXP_SGL) + * \param src source buffer (FIXP_DBL) + * \param len length of vector + * \param scalefactor amount of shifts to be applied + * \return void + * + */ +#define FUNCTION_scaleValuesSaturate_SGL_DBL +SCALE_INLINE +void scaleValuesSaturate(FIXP_SGL *dst, /*!< Output */ + FIXP_DBL *src, /*!< Input */ + INT len, /*!< Length */ + INT scalefactor) /*!< Scalefactor */ +{ + INT i; + scalefactor = fixmax_I(fixmin_I(scalefactor, (INT)DFRACT_BITS - 1), + (INT) - (DFRACT_BITS - 1)); + + for (i = 0; i < len; i++) { + dst[i] = FX_DBL2FX_SGL(fAddSaturate(scaleValueSaturate(src[i], scalefactor), + (FIXP_DBL)0x8000)); + } +} +#endif /* FUNCTION_scaleValuesSaturate_SGL_DBL */ + +#ifndef FUNCTION_scaleValuesSaturate_SGL +/*! + * + * \brief Multiply input vector by \f$ 2^{scalefactor} \f$ + * \param vector source/destination buffer + * \param len length of vector + * \param scalefactor amount of shifts to be applied + * \return void + * + */ +#define FUNCTION_scaleValuesSaturate_SGL +SCALE_INLINE +void scaleValuesSaturate(FIXP_SGL *vector, /*!< Vector */ + INT len, /*!< Length */ + INT scalefactor /*!< Scalefactor */ +) { + INT i; + + /* Return if scalefactor is Zero */ + if (scalefactor == 0) return; + + scalefactor = fixmax_I(fixmin_I(scalefactor, (INT)DFRACT_BITS - 1), + (INT) - (DFRACT_BITS - 1)); + + for (i = 0; i < len; i++) { + vector[i] = FX_DBL2FX_SGL( + scaleValueSaturate(FX_SGL2FX_DBL(vector[i]), scalefactor)); + } +} +#endif /* FUNCTION_scaleValuesSaturate_SGL */ + +#ifndef FUNCTION_scaleValuesSaturate_SGL_SGL +/*! + * + * \brief Multiply input vector by \f$ 2^{scalefactor} \f$ + * \param dst destination buffer + * \param src source buffer + * \param len length of vector + * \param scalefactor amount of shifts to be applied + * \return void + * + */ +#define FUNCTION_scaleValuesSaturate_SGL_SGL +SCALE_INLINE +void scaleValuesSaturate(FIXP_SGL *dst, /*!< Output */ + FIXP_SGL *src, /*!< Input */ + INT len, /*!< Length */ + INT scalefactor /*!< Scalefactor */ +) { + INT i; + + /* Return if scalefactor is Zero */ + if (scalefactor == 0) { + FDKmemmove(dst, src, len * sizeof(FIXP_SGL)); + return; + } + + scalefactor = fixmax_I(fixmin_I(scalefactor, (INT)DFRACT_BITS - 1), + (INT) - (DFRACT_BITS - 1)); + + for (i = 0; i < len; i++) { + dst[i] = + FX_DBL2FX_SGL(scaleValueSaturate(FX_SGL2FX_DBL(src[i]), scalefactor)); + } +} +#endif /* FUNCTION_scaleValuesSaturate_SGL_SGL */ + +#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 + +#if (SAMPLE_BITS == 16) +#ifndef FUNCTION_scaleValues_PCMDBL +/*! + * + * \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_PCMDBL +SCALE_INLINE +void scaleValues(FIXP_PCM *dst, /*!< dst Vector */ + const FIXP_DBL *src, /*!< src Vector */ + INT len, /*!< Length */ + INT scalefactor /*!< Scalefactor */ +) { + INT i; + + scalefactor -= DFRACT_BITS - SAMPLE_BITS; + + /* Return if scalefactor is Zero */ + { + if (scalefactor > 0) { + scalefactor = fixmin_I(scalefactor, (INT)DFRACT_BITS - 1); + for (i = len & 3; i--;) { + *(dst++) = (FIXP_PCM)(*(src++) << scalefactor); + } + for (i = len >> 2; i--;) { + *(dst++) = (FIXP_PCM)(*(src++) << scalefactor); + *(dst++) = (FIXP_PCM)(*(src++) << scalefactor); + *(dst++) = (FIXP_PCM)(*(src++) << scalefactor); + *(dst++) = (FIXP_PCM)(*(src++) << scalefactor); + } + } else { + INT negScalefactor = fixmin_I(-scalefactor, (INT)DFRACT_BITS - 1); + for (i = len & 3; i--;) { + *(dst++) = (FIXP_PCM)(*(src++) >> negScalefactor); + } + for (i = len >> 2; i--;) { + *(dst++) = (FIXP_PCM)(*(src++) >> negScalefactor); + *(dst++) = (FIXP_PCM)(*(src++) >> negScalefactor); + *(dst++) = (FIXP_PCM)(*(src++) >> negScalefactor); + *(dst++) = (FIXP_PCM)(*(src++) >> negScalefactor); + } + } + } +} +#endif +#endif /* (SAMPLE_BITS == 16) */ + +#ifndef FUNCTION_scaleValues_SGLSGL +/*! + * + * \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_SGLSGL +SCALE_INLINE +void scaleValues(FIXP_SGL *dst, /*!< dst Vector */ + const FIXP_SGL *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 vector 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. + * + * If all data is 0xFFFF.FFFF or 0x0000.0000 function returns 31 + * Note: You can skip data normalization only if return value is 0 + * + */ +#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_S((FIXP_SGL)maxVal)) - 1); +} +#endif -- cgit v1.2.3