summaryrefslogtreecommitdiffstats
path: root/fdk-aac/libFDK/include
diff options
context:
space:
mode:
Diffstat (limited to 'fdk-aac/libFDK/include')
-rw-r--r--fdk-aac/libFDK/include/FDK_archdef.h270
-rw-r--r--fdk-aac/libFDK/include/FDK_bitbuffer.h177
-rw-r--r--fdk-aac/libFDK/include/FDK_bitstream.h642
-rw-r--r--fdk-aac/libFDK/include/FDK_core.h122
-rw-r--r--fdk-aac/libFDK/include/FDK_crc.h225
-rw-r--r--fdk-aac/libFDK/include/FDK_decorrelate.h314
-rw-r--r--fdk-aac/libFDK/include/FDK_hybrid.h255
-rw-r--r--fdk-aac/libFDK/include/FDK_lpc.h218
-rw-r--r--fdk-aac/libFDK/include/FDK_matrixCalloc.h230
-rw-r--r--fdk-aac/libFDK/include/FDK_qmf_domain.h416
-rw-r--r--fdk-aac/libFDK/include/FDK_tools_rom.h398
-rw-r--r--fdk-aac/libFDK/include/FDK_trigFcts.h258
-rw-r--r--fdk-aac/libFDK/include/abs.h136
-rw-r--r--fdk-aac/libFDK/include/arm/clz_arm.h164
-rw-r--r--fdk-aac/libFDK/include/arm/cplx_mul_arm.h201
-rw-r--r--fdk-aac/libFDK/include/arm/fixmadd_arm.h220
-rw-r--r--fdk-aac/libFDK/include/arm/fixmul_arm.h198
-rw-r--r--fdk-aac/libFDK/include/arm/scale_arm.h163
-rw-r--r--fdk-aac/libFDK/include/arm/scramble_arm.h174
-rw-r--r--fdk-aac/libFDK/include/autocorr2nd.h137
-rw-r--r--fdk-aac/libFDK/include/clz.h205
-rw-r--r--fdk-aac/libFDK/include/common_fix.h449
-rw-r--r--fdk-aac/libFDK/include/cplx_mul.h266
-rw-r--r--fdk-aac/libFDK/include/dct.h171
-rw-r--r--fdk-aac/libFDK/include/fft.h263
-rw-r--r--fdk-aac/libFDK/include/fft_rad2.h121
-rw-r--r--fdk-aac/libFDK/include/fixmadd.h333
-rw-r--r--fdk-aac/libFDK/include/fixminmax.h131
-rw-r--r--fdk-aac/libFDK/include/fixmul.h298
-rw-r--r--fdk-aac/libFDK/include/fixpoint_math.h921
-rw-r--r--fdk-aac/libFDK/include/huff_nodes.h258
-rw-r--r--fdk-aac/libFDK/include/mdct.h253
-rw-r--r--fdk-aac/libFDK/include/mips/abs_mips.h125
-rw-r--r--fdk-aac/libFDK/include/mips/clz_mips.h134
-rw-r--r--fdk-aac/libFDK/include/mips/cplx_mul_mips.h133
-rw-r--r--fdk-aac/libFDK/include/mips/fixmul_mips.h130
-rw-r--r--fdk-aac/libFDK/include/mips/scale_mips.h122
-rw-r--r--fdk-aac/libFDK/include/mips/scramble_mips.h133
-rw-r--r--fdk-aac/libFDK/include/nlc_dec.h187
-rw-r--r--fdk-aac/libFDK/include/ppc/clz_ppc.h102
-rw-r--r--fdk-aac/libFDK/include/ppc/fixmul_ppc.h115
-rw-r--r--fdk-aac/libFDK/include/qmf.h301
-rw-r--r--fdk-aac/libFDK/include/qmf_pcm.h405
-rw-r--r--fdk-aac/libFDK/include/scale.h298
-rw-r--r--fdk-aac/libFDK/include/scramble.h153
-rw-r--r--fdk-aac/libFDK/include/x86/abs_x86.h123
-rw-r--r--fdk-aac/libFDK/include/x86/clz_x86.h165
-rw-r--r--fdk-aac/libFDK/include/x86/fixmul_x86.h187
-rw-r--r--fdk-aac/libFDK/include/x86/fixpoint_math_x86.h208
49 files changed, 11608 insertions, 0 deletions
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 <class T>
+inline T fixmin(T a, T b) {
+ return (a < b ? a : b);
+}
+
+template <class T>
+inline T fixmax(T a, T b) {
+ return (a > b ? a : b);
+}
+
+#define fixmax_D(a, b) fixmax(a, b)
+#define fixmin_D(a, b) fixmin(a, b)
+#define fixmax_S(a, b) fixmax(a, b)
+#define fixmin_S(a, b) fixmin(a, b)
+#define fixmax_I(a, b) fixmax(a, b)
+#define fixmin_I(a, b) fixmin(a, b)
+#define fixmax_UI(a, b) fixmax(a, b)
+#define fixmin_UI(a, b) fixmin(a, b)
+
+#endif
diff --git a/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 <intrin.h>
+
+#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 <math.h>
+
+#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 <math.h>
+
+#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) */