Home | History | Annotate | Download | only in include
      1 /* -----------------------------------------------------------------------------
      2 Software License for The Fraunhofer FDK AAC Codec Library for Android
      3 
      4  Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Frderung der angewandten
      5 Forschung e.V. All rights reserved.
      6 
      7  1.    INTRODUCTION
      8 The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
      9 that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
     10 scheme for digital audio. This FDK AAC Codec software is intended to be used on
     11 a wide variety of Android devices.
     12 
     13 AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
     14 general perceptual audio codecs. AAC-ELD is considered the best-performing
     15 full-bandwidth communications codec by independent studies and is widely
     16 deployed. AAC has been standardized by ISO and IEC as part of the MPEG
     17 specifications.
     18 
     19 Patent licenses for necessary patent claims for the FDK AAC Codec (including
     20 those of Fraunhofer) may be obtained through Via Licensing
     21 (www.vialicensing.com) or through the respective patent owners individually for
     22 the purpose of encoding or decoding bit streams in products that are compliant
     23 with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
     24 Android devices already license these patent claims through Via Licensing or
     25 directly from the patent owners, and therefore FDK AAC Codec software may
     26 already be covered under those patent licenses when it is used for those
     27 licensed purposes only.
     28 
     29 Commercially-licensed AAC software libraries, including floating-point versions
     30 with enhanced sound quality, are also available from Fraunhofer. Users are
     31 encouraged to check the Fraunhofer website for additional applications
     32 information and documentation.
     33 
     34 2.    COPYRIGHT LICENSE
     35 
     36 Redistribution and use in source and binary forms, with or without modification,
     37 are permitted without payment of copyright license fees provided that you
     38 satisfy the following conditions:
     39 
     40 You must retain the complete text of this software license in redistributions of
     41 the FDK AAC Codec or your modifications thereto in source code form.
     42 
     43 You must retain the complete text of this software license in the documentation
     44 and/or other materials provided with redistributions of the FDK AAC Codec or
     45 your modifications thereto in binary form. You must make available free of
     46 charge copies of the complete source code of the FDK AAC Codec and your
     47 modifications thereto to recipients of copies in binary form.
     48 
     49 The name of Fraunhofer may not be used to endorse or promote products derived
     50 from this library without prior written permission.
     51 
     52 You may not charge copyright license fees for anyone to use, copy or distribute
     53 the FDK AAC Codec software or your modifications thereto.
     54 
     55 Your modified versions of the FDK AAC Codec must carry prominent notices stating
     56 that you changed the software and the date of any change. For modified versions
     57 of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
     58 must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
     59 AAC Codec Library for Android."
     60 
     61 3.    NO PATENT LICENSE
     62 
     63 NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
     64 limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
     65 Fraunhofer provides no warranty of patent non-infringement with respect to this
     66 software.
     67 
     68 You may use this FDK AAC Codec software or modifications thereto only for
     69 purposes that are authorized by appropriate patent licenses.
     70 
     71 4.    DISCLAIMER
     72 
     73 This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
     74 holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
     75 including but not limited to the implied warranties of merchantability and
     76 fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
     77 CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
     78 or consequential damages, including but not limited to procurement of substitute
     79 goods or services; loss of use, data, or profits, or business interruption,
     80 however caused and on any theory of liability, whether in contract, strict
     81 liability, or tort (including negligence), arising in any way out of the use of
     82 this software, even if advised of the possibility of such damage.
     83 
     84 5.    CONTACT INFORMATION
     85 
     86 Fraunhofer Institute for Integrated Circuits IIS
     87 Attention: Audio and Multimedia Departments - FDK AAC LL
     88 Am Wolfsmantel 33
     89 91058 Erlangen, Germany
     90 
     91 www.iis.fraunhofer.de/amm
     92 amm-info (at) iis.fraunhofer.de
     93 ----------------------------------------------------------------------------- */
     94 
     95 /******************* Library for basic calculation routines ********************
     96 
     97    Author(s):
     98 
     99    Description:
    100 
    101 *******************************************************************************/
    102 
    103 #ifndef FDK_ARCHDEF_H
    104 #define FDK_ARCHDEF_H
    105 
    106 /* Unify some few toolchain specific defines to avoid having large "or" macro
    107  * contraptions all over the source code. */
    108 
    109 /* Use single macro (the GCC built in macro) for architecture identification
    110  * independent of the particular toolchain */
    111 #if defined(__i386__) || defined(__i486__) || defined(__i586__) ||  \
    112     defined(__i686__) || (defined(_MSC_VER) && defined(_M_IX86)) || \
    113     (defined(_MSC_VER) && defined(_M_X64)) || defined(__x86_64__)
    114 #define __x86__
    115 #endif
    116 
    117 #if defined(_M_ARM) && !defined(__arm__) || defined(__aarch64__)
    118 #define __arm__
    119 #endif
    120 
    121 #if (__TARGET_ARCH_ARM == 5) || defined(__TARGET_FEATURE_DSPMUL) || \
    122     (_M_ARM == 5) || defined(__ARM_ARCH_5TEJ__) || defined(__ARM_ARCH_7EM__)
    123 /* Define __ARM_ARCH_5TE__ if armv5te features are supported  */
    124 #define __ARM_ARCH_5TE__
    125 #endif
    126 
    127 #if (__TARGET_ARCH_ARM == 6) || defined(__ARM_ARCH_6J__) || \
    128     defined(__ARM_ARCH_6ZK__)
    129 /* Define __ARM_ARCH_6__ if the armv6 intructions are being supported. */
    130 #define __ARM_ARCH_5TE__
    131 #define __ARM_ARCH_6__
    132 #endif
    133 
    134 #if defined(__TARGET_ARCH_7_R) || defined(__ARM_ARCH_7R__)
    135 /* Define __ARM_ARCH_7_A__ if the armv7 intructions are being supported. */
    136 #define __ARM_ARCH_5TE__
    137 #define __ARM_ARCH_6__
    138 #define __ARM_ARCH_7_R__
    139 #endif
    140 
    141 #if defined(__TARGET_ARCH_7_A) || defined(__ARM_ARCH_7A__) || \
    142     ((__ARM_ARCH == 8) && (__ARM_32BIT_STATE == 1))
    143 /* Define __ARM_ARCH_7_A__ if the armv7 intructions are being supported. */
    144 #define __ARM_ARCH_5TE__
    145 #define __ARM_ARCH_6__
    146 #define __ARM_ARCH_7_A__
    147 #endif
    148 
    149 #if defined(__TARGET_ARCH_7_M) || defined(__ARM_ARCH_7_M__)
    150 /* Define __ARM_ARCH_7M__ if the ARMv7-M instructions are being supported, e.g.
    151  * Cortex-M3. */
    152 #define __ARM_ARCH_7M__
    153 #endif
    154 
    155 #if defined(__TARGET_ARCH_7E_M) || defined(__ARM_ARCH_7E_M__)
    156 /* Define __ARM_ARCH_7EM__ if the ARMv7-ME instructions are being supported,
    157  * e.g. Cortex-M4. */
    158 #define __ARM_ARCH_7EM__
    159 #endif
    160 
    161 #if defined(__aarch64__)
    162 #define __ARM_ARCH_8__
    163 #endif
    164 
    165 #ifdef _M_ARM
    166 #include "cmnintrin.h"
    167 #include "armintr.h"
    168 #endif
    169 
    170 /* Define preferred Multiplication type */
    171 
    172 #if defined(__mips__)
    173 #define ARCH_PREFER_MULT_16x16
    174 #undef SINETABLE_16BIT
    175 #undef POW2COEFF_16BIT
    176 #undef LDCOEFF_16BIT
    177 #undef WINDOWTABLE_16BIT
    178 
    179 #elif defined(__arm__) && defined(__ARM_ARCH_8__)
    180 #define ARCH_PREFER_MULT_32x16
    181 #define SINETABLE_16BIT
    182 #define POW2COEFF_16BIT
    183 #define LDCOEFF_16BIT
    184 #define WINDOWTABLE_16BIT
    185 
    186 #elif defined(__arm__) && defined(__ARM_ARCH_5TE__)
    187 #define ARCH_PREFER_MULT_32x16
    188 #define SINETABLE_16BIT
    189 #define POW2COEFF_16BIT
    190 #define LDCOEFF_16BIT
    191 #define WINDOWTABLE_16BIT
    192 
    193 #elif defined(__arm__) && defined(__ARM_ARCH_7M__)
    194 #define ARCH_PREFER_MULT_32x16
    195 #define SINETABLE_16BIT
    196 #define POW2COEFF_16BIT
    197 #define LDCOEFF_16BIT
    198 #define WINDOWTABLE_16BIT
    199 
    200 #elif defined(__arm__) && defined(__ARM_ARCH_7EM__)
    201 #define ARCH_PREFER_MULT_32x32
    202 #define ARCH_PREFER_MULT_32x16
    203 #define SINETABLE_16BIT
    204 #define POW2COEFF_16BIT
    205 #define LDCOEFF_16BIT
    206 #define WINDOWTABLE_16BIT
    207 
    208 #elif defined(__arm__) && !defined(__ARM_ARCH_5TE__)
    209 #define ARCH_PREFER_MULT_16x16
    210 #undef SINETABLE_16BIT
    211 #undef WINDOWTABLE_16BIT
    212 #undef POW2COEFF_16BIT
    213 #undef LDCOEFF_16BIT
    214 
    215 #elif defined(__x86__)
    216 #define ARCH_PREFER_MULT_32x16
    217 #define SINETABLE_16BIT
    218 #define WINDOWTABLE_16BIT
    219 #define POW2COEFF_16BIT
    220 #define LDCOEFF_16BIT
    221 
    222 #else
    223 #warning >>>> Please set architecture characterization defines for your platform (FDK_HIGH_PERFORMANCE)! <<<<
    224 
    225 #endif /* Architecture switches */
    226 
    227 #ifdef SINETABLE_16BIT
    228 #define FIXP_STB FIXP_SGL /* STB sinus Tab used in transformation */
    229 #define FIXP_STP FIXP_SPK
    230 #define STC(a) (FX_DBL2FXCONST_SGL(a))
    231 #else
    232 #define FIXP_STB FIXP_DBL
    233 #define FIXP_STP FIXP_DPK
    234 #define STC(a) ((FIXP_DBL)(LONG)(a))
    235 #endif /* defined(SINETABLE_16BIT) */
    236 
    237 #define STCP(cos, sin)     \
    238   {                        \
    239     { STC(cos), STC(sin) } \
    240   }
    241 
    242 #ifdef WINDOWTABLE_16BIT
    243 #define FIXP_WTB FIXP_SGL /* single FIXP_SGL values */
    244 #define FX_DBL2FX_WTB(x) FX_DBL2FX_SGL(x)
    245 #define FIXP_WTP FIXP_SPK /* packed FIXP_SGL values */
    246 #define WTC(a) FX_DBL2FXCONST_SGL(a)
    247 #else /* SINETABLE_16BIT */
    248 #define FIXP_WTB FIXP_DBL
    249 #define FX_DBL2FX_WTB(x) (x)
    250 #define FIXP_WTP FIXP_DPK
    251 #define WTC(a) (FIXP_DBL)(a)
    252 #endif /* SINETABLE_16BIT */
    253 
    254 #define WTCP(a, b)     \
    255   {                    \
    256     { WTC(a), WTC(b) } \
    257   }
    258 
    259 #endif /* FDK_ARCHDEF_H */
    260