diff options
Diffstat (limited to 'libFDK')
-rw-r--r-- | libFDK/include/FDK_archdef.h | 20 | ||||
-rw-r--r-- | libFDK/include/clz.h | 3 | ||||
-rw-r--r-- | libFDK/include/common_fix.h | 4 | ||||
-rw-r--r-- | libFDK/include/fft.h | 4 | ||||
-rw-r--r-- | libFDK/include/fixmul.h | 3 | ||||
-rw-r--r-- | libFDK/include/mips/abs_mips.h | 2 | ||||
-rw-r--r-- | libFDK/include/mips/cplx_mul_mips.h | 47 | ||||
-rw-r--r-- | libFDK/include/mips/scale_mips.h | 2 | ||||
-rw-r--r-- | libFDK/include/ppc/clz_ppc.h | 102 | ||||
-rw-r--r-- | libFDK/include/ppc/fixmul_ppc.h | 115 | ||||
-rw-r--r-- | libFDK/include/scramble.h | 2 | ||||
-rw-r--r-- | libFDK/src/fft.cpp | 6 | ||||
-rw-r--r-- | libFDK/src/fft_rad2.cpp | 2 | ||||
-rw-r--r-- | libFDK/src/mips/scale_mips.cpp | 2 |
14 files changed, 255 insertions, 59 deletions
diff --git a/libFDK/include/FDK_archdef.h b/libFDK/include/FDK_archdef.h index 3d0cddf..f3254f2 100644 --- a/libFDK/include/FDK_archdef.h +++ b/libFDK/include/FDK_archdef.h @@ -114,10 +114,14 @@ amm-info@iis.fraunhofer.de #define __x86__ #endif -#if defined(_M_ARM) && !defined(__arm__) || defined(__aarch64__) +#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 */ @@ -158,12 +162,11 @@ amm-info@iis.fraunhofer.de #define __ARM_ARCH_7EM__ #endif -#if defined(__aarch64__) +#if defined(__aarch64__) || defined(_M_ARM64) #define __ARM_ARCH_8__ #endif #ifdef _M_ARM -#include "cmnintrin.h" #include "armintr.h" #endif @@ -226,6 +229,17 @@ amm-info@iis.fraunhofer.de #define LDCOEFF_16BIT #define WINDOWTABLE_16BIT +#elif defined(__powerpc__) +#define ARCH_PREFER_MULT_32x32 + +#elif defined(__s390x__) +#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)! <<<< diff --git a/libFDK/include/clz.h b/libFDK/include/clz.h index 6acdee6..df75618 100644 --- a/libFDK/include/clz.h +++ b/libFDK/include/clz.h @@ -115,6 +115,9 @@ amm-info@iis.fraunhofer.de #elif defined(__x86__) #include "x86/clz_x86.h" +#elif defined(__powerpc__) +#include "ppc/clz_ppc.h" + #endif /* all cores */ /************************************************************************* diff --git a/libFDK/include/common_fix.h b/libFDK/include/common_fix.h index 8d0dfde..7c08225 100644 --- a/libFDK/include/common_fix.h +++ b/libFDK/include/common_fix.h @@ -406,10 +406,6 @@ 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); } -#if !defined(_MSC_VER) && defined(__x86_64__) -FDK_INLINE SHORT fMax(SHORT a, SHORT b) { return fixmax_S(a, b); } -FDK_INLINE SHORT fMin(SHORT a, SHORT b) { return fixmin_S(a, b); } -#endif #endif inline UINT fMax(UINT a, UINT b) { return fixmax_UI(a, b); } diff --git a/libFDK/include/fft.h b/libFDK/include/fft.h index 3576ed3..4ef62b4 100644 --- a/libFDK/include/fft.h +++ b/libFDK/include/fft.h @@ -139,7 +139,7 @@ void ifft(int length, FIXP_DBL *pInput, INT *scalefactor); * bit scale headroom. The values are interleaved, real/imag pairs. */ LNK_SECTION_CODE_L1 -static void FDK_FORCEINLINE fft_4(FIXP_DBL *x) { +static inline void fft_4(FIXP_DBL *x) { FIXP_DBL a00, a10, a20, a30, tmp0, tmp1; a00 = (x[0] + x[4]) >> 1; /* Re A + Re B */ @@ -168,7 +168,7 @@ static void FDK_FORCEINLINE fft_4(FIXP_DBL *x) { #ifndef FUNCTION_fft_8 LNK_SECTION_CODE_L1 -static void FDK_FORCEINLINE fft_8(FIXP_DBL *x) { +static inline void fft_8(FIXP_DBL *x) { FIXP_SPK w_PiFOURTH = {{FIXP_SGL(0x5A82), FIXP_SGL(0x5A82)}}; FIXP_DBL a00, a10, a20, a30; diff --git a/libFDK/include/fixmul.h b/libFDK/include/fixmul.h index a51ca0c..8eeb7ab 100644 --- a/libFDK/include/fixmul.h +++ b/libFDK/include/fixmul.h @@ -115,6 +115,9 @@ amm-info@iis.fraunhofer.de #elif defined(__x86__) #include "x86/fixmul_x86.h" +#elif defined(__powerpc__) +#include "ppc/fixmul_ppc.h" + #endif /* all cores */ /************************************************************************* diff --git a/libFDK/include/mips/abs_mips.h b/libFDK/include/mips/abs_mips.h index dbb2063..5644bc0 100644 --- a/libFDK/include/mips/abs_mips.h +++ b/libFDK/include/mips/abs_mips.h @@ -107,7 +107,7 @@ amm-info@iis.fraunhofer.de #if defined(__GNUC__) && defined(__mips__) -#if defined(__mips_dsp) +#if defined(__mips_dsp) && !defined(__mips16) #define FUNCTION_fixabs_D #define FUNCTION_fixabs_I #define FUNCTION_fixabs_S diff --git a/libFDK/include/mips/cplx_mul_mips.h b/libFDK/include/mips/cplx_mul_mips.h index acae118..4ade3e5 100644 --- a/libFDK/include/mips/cplx_mul_mips.h +++ b/libFDK/include/mips/cplx_mul_mips.h @@ -103,7 +103,7 @@ amm-info@iis.fraunhofer.de #if !defined(CPLX_MUL_MIPS_H) #define CPLX_MUL_MIPS_H -#if defined(__GNUC__) && defined(__mips__) && __mips_isa_rev < 6 +#if defined(__GNUC__) && defined(__mips__) //#define FUNCTION_cplxMultDiv2_32x16 //#define FUNCTION_cplxMultDiv2_32x16X2 @@ -115,53 +115,16 @@ amm-info@iis.fraunhofer.de #if defined(FUNCTION_cplxMultDiv2_32x32X2) inline void cplxMultDiv2(FIXP_DBL *c_Re, FIXP_DBL *c_Im, FIXP_DBL a_Re, FIXP_DBL a_Im, FIXP_DBL b_Re, FIXP_DBL b_Im) { - INT result; - - __asm__( - "mult %[a_Re], %[b_Re];\n" - "msub %[a_Im], %[b_Im];\n" - "mfhi %[result];\n" - : [result] "=r"(result) - : [a_Re] "d"(a_Re), [b_Re] "d"(b_Re), [a_Im] "d"(a_Im), [b_Im] "d"(b_Im) - : "lo"); - - *c_Re = result; - - __asm__( - "mult %[a_Re], %[b_Im];\n" - "madd %[a_Im], %[b_Re];\n" - "mfhi %[result];\n" - : [result] "=r"(result) - : [a_Re] "r"(a_Re), [b_Im] "r"(b_Im), [a_Im] "r"(a_Im), [b_Re] "r"(b_Re) - : "lo"); - *c_Im = result; + *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) { - INT result; - - __asm__( - "mult %[a_Re], %[b_Re];\n" - "msub %[a_Im], %[b_Im];\n" - "mfhi %[result];\n" - //"extr_w %[result], 31;\n" - : [result] "=r"(result) - : [a_Re] "r"(a_Re), [b_Re] "r"(b_Re), [a_Im] "r"(a_Im), [b_Im] "r"(b_Im) - : "lo"); - *c_Re = result << 1; - - __asm__( - "mult %[a_Re], %[b_Im];\n" - "madd %[a_Im], %[b_Re];\n" - "mfhi %[result];\n" - //"extr_w %[result], 31;\n" - : [result] "=r"(result) - : [a_Re] "r"(a_Re), [b_Im] "r"(b_Im), [a_Im] "r"(a_Im), [b_Re] "r"(b_Re) - : "lo"); - *c_Im = result << 1; + *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 diff --git a/libFDK/include/mips/scale_mips.h b/libFDK/include/mips/scale_mips.h index 3c141fc..882ef35 100644 --- a/libFDK/include/mips/scale_mips.h +++ b/libFDK/include/mips/scale_mips.h @@ -103,7 +103,7 @@ amm-info@iis.fraunhofer.de #ifndef SCALE_MIPS_H #define SCALE_MIPS_H -#if defined(__mips_dsp) +#if defined(__mips_dsp) && !defined(__mips16) /*! * diff --git a/libFDK/include/ppc/clz_ppc.h b/libFDK/include/ppc/clz_ppc.h new file mode 100644 index 0000000..bfd23c6 --- /dev/null +++ b/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/libFDK/include/ppc/fixmul_ppc.h b/libFDK/include/ppc/fixmul_ppc.h new file mode 100644 index 0000000..9e2745c --- /dev/null +++ b/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/libFDK/include/scramble.h b/libFDK/include/scramble.h index f07ebed..e7cead9 100644 --- a/libFDK/include/scramble.h +++ b/libFDK/include/scramble.h @@ -108,7 +108,7 @@ amm-info@iis.fraunhofer.de #if defined(__arm__) #include "arm/scramble_arm.h" -#elif defined(__mips__) && defined(__mips_dsp) +#elif defined(__mips__) && defined(__mips_dsp) && !defined(__mips16) #include "mips/scramble_mips.h" #endif diff --git a/libFDK/src/fft.cpp b/libFDK/src/fft.cpp index 4e6fdd2..c9ee784 100644 --- a/libFDK/src/fft.cpp +++ b/libFDK/src/fft.cpp @@ -170,7 +170,7 @@ amm-info@iis.fraunhofer.de /* Performs the FFT of length 2. Input vector unscaled, output vector scaled * with factor 0.5 */ -static FDK_FORCEINLINE void fft2(FIXP_DBL *RESTRICT pDat) { +static inline void fft2(FIXP_DBL *RESTRICT pDat) { FIXP_DBL r1, i1; FIXP_DBL r2, i2; @@ -196,7 +196,7 @@ static FDK_FORCEINLINE void fft2(FIXP_DBL *RESTRICT pDat) { #ifndef FUNCTION_fft3 /* Performs the FFT of length 3 according to the algorithm after winograd. */ -static FDK_FORCEINLINE void fft3(FIXP_DBL *RESTRICT pDat) { +static inline void fft3(FIXP_DBL *RESTRICT pDat) { FIXP_DBL r1, r2; FIXP_DBL s1, s2; FIXP_DBL pD; @@ -233,7 +233,7 @@ static FDK_FORCEINLINE void fft3(FIXP_DBL *RESTRICT pDat) { /* performs the FFT of length 5 according to the algorithm after winograd */ /* This version works with a prescale of 2 instead of 3 */ -static FDK_FORCEINLINE void fft5(FIXP_DBL *RESTRICT pDat) { +static inline void fft5(FIXP_DBL *RESTRICT pDat) { FIXP_DBL r1, r2, r3, r4; FIXP_DBL s1, s2, s3, s4; FIXP_DBL t; diff --git a/libFDK/src/fft_rad2.cpp b/libFDK/src/fft_rad2.cpp index 27f3aa0..f457f8b 100644 --- a/libFDK/src/fft_rad2.cpp +++ b/libFDK/src/fft_rad2.cpp @@ -109,7 +109,7 @@ amm-info@iis.fraunhofer.de #if defined(__arm__) #include "arm/fft_rad2_arm.cpp" -#elif defined(__GNUC__) && defined(__mips__) && defined(__mips_dsp) +#elif defined(__GNUC__) && defined(__mips__) && defined(__mips_dsp) && !defined(__mips16) #include "mips/fft_rad2_mips.cpp" #endif diff --git a/libFDK/src/mips/scale_mips.cpp b/libFDK/src/mips/scale_mips.cpp index 1a3d33c..ff295d9 100644 --- a/libFDK/src/mips/scale_mips.cpp +++ b/libFDK/src/mips/scale_mips.cpp @@ -100,7 +100,7 @@ amm-info@iis.fraunhofer.de *******************************************************************************/ -#if defined(__mips_dsp) +#if defined(__mips_dsp) && !defined(__mips16) #ifndef FUNCTION_getScalefactor_DBL #define FUNCTION_getScalefactor_DBL |