Home | History | Annotate | Download | only in src
      1 
      2 /* -----------------------------------------------------------------------------------------------------------
      3 Software License for The Fraunhofer FDK AAC Codec Library for Android
      4 
      5  Copyright  1995 - 2012 Fraunhofer-Gesellschaft zur Frderung der angewandten Forschung e.V.
      6   All rights reserved.
      7 
      8  1.    INTRODUCTION
      9 The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements
     10 the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio.
     11 This FDK AAC Codec software is intended to be used on a wide variety of Android devices.
     12 
     13 AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual
     14 audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by
     15 independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part
     16 of the MPEG specifications.
     17 
     18 Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer)
     19 may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners
     20 individually for the purpose of encoding or decoding bit streams in products that are compliant with
     21 the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license
     22 these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec
     23 software may already be covered under those patent licenses when it is used for those licensed purposes only.
     24 
     25 Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality,
     26 are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional
     27 applications information and documentation.
     28 
     29 2.    COPYRIGHT LICENSE
     30 
     31 Redistribution and use in source and binary forms, with or without modification, are permitted without
     32 payment of copyright license fees provided that you satisfy the following conditions:
     33 
     34 You must retain the complete text of this software license in redistributions of the FDK AAC Codec or
     35 your modifications thereto in source code form.
     36 
     37 You must retain the complete text of this software license in the documentation and/or other materials
     38 provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form.
     39 You must make available free of charge copies of the complete source code of the FDK AAC Codec and your
     40 modifications thereto to recipients of copies in binary form.
     41 
     42 The name of Fraunhofer may not be used to endorse or promote products derived from this library without
     43 prior written permission.
     44 
     45 You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec
     46 software or your modifications thereto.
     47 
     48 Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software
     49 and the date of any change. For modified versions of the FDK AAC Codec, the term
     50 "Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term
     51 "Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android."
     52 
     53 3.    NO PATENT LICENSE
     54 
     55 NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer,
     56 ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with
     57 respect to this software.
     58 
     59 You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized
     60 by appropriate patent licenses.
     61 
     62 4.    DISCLAIMER
     63 
     64 This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors
     65 "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties
     66 of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
     67 CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages,
     68 including but not limited to procurement of substitute goods or services; loss of use, data, or profits,
     69 or business interruption, however caused and on any theory of liability, whether in contract, strict
     70 liability, or tort (including negligence), arising in any way out of the use of this software, even if
     71 advised of the possibility of such damage.
     72 
     73 5.    CONTACT INFORMATION
     74 
     75 Fraunhofer Institute for Integrated Circuits IIS
     76 Attention: Audio and Multimedia Departments - FDK AAC LL
     77 Am Wolfsmantel 33
     78 91058 Erlangen, Germany
     79 
     80 www.iis.fraunhofer.de/amm
     81 amm-info (at) iis.fraunhofer.de
     82 ----------------------------------------------------------------------------------------------------------- */
     83 
     84 /*!
     85   \file
     86   \brief  SBR main definitions
     87 */
     88 #ifndef __SBR_DEF_H
     89 #define __SBR_DEF_H
     90 
     91 #include "common_fix.h"
     92 
     93 #define noError 0
     94 #define HANDLE_ERROR_INFO INT
     95 #define ERROR(a,b) 1
     96 #define handBack
     97 
     98 /* #define SBR_ENV_STATISTICS_BITRATE */
     99 #undef SBR_ENV_STATISTICS_BITRATE
    100 
    101 /* #define SBR_ENV_STATISTICS */
    102 #undef SBR_ENV_STATISTICS
    103 
    104 /* #define SBR_PAYLOAD_MONITOR */
    105 #undef SBR_PAYLOAD_MONITOR
    106 
    107 #define SWAP(a,b)                               tempr=a, a=b, b=tempr
    108 #define TRUE  1
    109 #define FALSE 0
    110 
    111 
    112 /* Constants */
    113 #define EPS                                     1e-12
    114 #define LOG2                                    0.69314718056f  /* natural logarithm of 2 */
    115 #define ILOG2                                   1.442695041f    /* 1/LOG2 */
    116 #define RELAXATION_FLOAT                        (1e-6f)
    117 #define RELAXATION                              (FL2FXCONST_DBL(RELAXATION_FLOAT))
    118 #define RELAXATION_FRACT                        (FL2FXCONST_DBL(0.524288f))     /* 0.524288f is fractional part of RELAXATION */
    119 #define RELAXATION_SHIFT                        (19)
    120 #define RELAXATION_LD64                         (FL2FXCONST_DBL(0.31143075889f))/* (ld64(RELAXATION) */
    121 
    122 /************  Definitions ***************/
    123 #define SBR_COMP_MODE_DELTA                     0
    124 #define SBR_COMP_MODE_CTS                       1
    125 
    126 #define MAX_NUM_CHANNELS                        2
    127 
    128 #define MAX_NOISE_ENVELOPES                     2
    129 #define MAX_NUM_NOISE_COEFFS                    5
    130 #define MAX_NUM_NOISE_VALUES                    (MAX_NUM_NOISE_COEFFS*MAX_NOISE_ENVELOPES)
    131 
    132 #define MAX_NUM_ENVELOPE_VALUES                 (MAX_ENVELOPES * MAX_FREQ_COEFFS)
    133 #define MAX_ENVELOPES                           5
    134 #define MAX_FREQ_COEFFS                         48
    135 
    136 #define MAX_FREQ_COEFFS_FS44100                 35
    137 #define MAX_FREQ_COEFFS_FS48000                 32
    138 
    139 
    140 #define QMF_CHANNELS                            64
    141 #define QMF_FILTER_LENGTH                      640
    142 #define QMF_MAX_TIME_SLOTS                      32
    143 #define NO_OF_ESTIMATES_LC                      4
    144 #define NO_OF_ESTIMATES_LD                      3
    145 #define MAX_NO_OF_ESTIMATES                     4
    146 
    147 
    148 #define NOISE_FLOOR_OFFSET                      6
    149 #define NOISE_FLOOR_OFFSET_64                   (FL2FXCONST_DBL(0.09375f))
    150 
    151 #define LOW_RES                                 0
    152 #define HIGH_RES                                1
    153 
    154 #define LO                                      0
    155 #define HI                                      1
    156 
    157 #define LENGTH_SBR_FRAME_INFO                   35      /* 19 */
    158 
    159 #define SBR_NSFB_LOW_RES                        9       /*  8 */
    160 #define SBR_NSFB_HIGH_RES                       18      /* 16 */
    161 
    162 
    163 #define SBR_XPOS_CTRL_DEFAULT                   2
    164 
    165 #define SBR_FREQ_SCALE_DEFAULT                  2
    166 #define SBR_ALTER_SCALE_DEFAULT                 1
    167 #define SBR_NOISE_BANDS_DEFAULT                 2
    168 
    169 #define SBR_LIMITER_BANDS_DEFAULT               2
    170 #define SBR_LIMITER_GAINS_DEFAULT               2
    171 #define SBR_LIMITER_GAINS_INFINITE              3
    172 #define SBR_INTERPOL_FREQ_DEFAULT               1
    173 #define SBR_SMOOTHING_LENGTH_DEFAULT            0
    174 
    175 
    176 /* sbr_header */
    177 #define SI_SBR_AMP_RES_BITS                     1
    178 #define SI_SBR_COUPLING_BITS                    1
    179 #define SI_SBR_START_FREQ_BITS                  4
    180 #define SI_SBR_STOP_FREQ_BITS                   4
    181 #define SI_SBR_XOVER_BAND_BITS                  3
    182 #define SI_SBR_RESERVED_BITS                    2
    183 #define SI_SBR_DATA_EXTRA_BITS                  1
    184 #define SI_SBR_HEADER_EXTRA_1_BITS              1
    185 #define SI_SBR_HEADER_EXTRA_2_BITS              1
    186 
    187 /* sbr_header extra 1 */
    188 #define SI_SBR_FREQ_SCALE_BITS                  2
    189 #define SI_SBR_ALTER_SCALE_BITS                 1
    190 #define SI_SBR_NOISE_BANDS_BITS                 2
    191 
    192 /* sbr_header extra 2 */
    193 #define SI_SBR_LIMITER_BANDS_BITS               2
    194 #define SI_SBR_LIMITER_GAINS_BITS               2
    195 #define SI_SBR_INTERPOL_FREQ_BITS               1
    196 #define SI_SBR_SMOOTHING_LENGTH_BITS            1
    197 
    198 /* sbr_grid */
    199 #define SBR_CLA_BITS                            2   /*!< size of bs_frame_class */
    200 #define SBR_CLA_BITS_LD                         1   /*!< size of bs_frame_class */
    201 #define SBR_ENV_BITS                            2   /*!< size of bs_num_env_raw */
    202 #define SBR_ABS_BITS                            2   /*!< size of bs_abs_bord_raw for HE-AAC */
    203 #define SBR_NUM_BITS                            2   /*!< size of bs_num_rel */
    204 #define SBR_REL_BITS                            2   /*!< size of bs_rel_bord_raw */
    205 #define SBR_RES_BITS                            1   /*!< size of bs_freq_res_flag */
    206 #define SBR_DIR_BITS                            1   /*!< size of bs_df_flag */
    207 
    208 
    209 /* sbr_data */
    210 #define SI_SBR_INVF_MODE_BITS                   2
    211 
    212 
    213 #define SI_SBR_START_ENV_BITS_AMP_RES_3_0           6
    214 #define SI_SBR_START_ENV_BITS_BALANCE_AMP_RES_3_0   5
    215 #define SI_SBR_START_NOISE_BITS_AMP_RES_3_0         5
    216 #define SI_SBR_START_NOISE_BITS_BALANCE_AMP_RES_3_0 5
    217 
    218 #define SI_SBR_START_ENV_BITS_AMP_RES_1_5           7
    219 #define SI_SBR_START_ENV_BITS_BALANCE_AMP_RES_1_5   6
    220 
    221 
    222 #define SI_SBR_EXTENDED_DATA_BITS               1
    223 #define SI_SBR_EXTENSION_SIZE_BITS              4
    224 #define SI_SBR_EXTENSION_ESC_COUNT_BITS         8
    225 #define SI_SBR_EXTENSION_ID_BITS                2
    226 
    227 #define SBR_EXTENDED_DATA_MAX_CNT               (15+255)
    228 
    229 #define EXTENSION_ID_PS_CODING                  2
    230 
    231 /* Envelope coding constants */
    232 #define FREQ                      0
    233 #define TIME                      1
    234 
    235 
    236 /* huffman tables */
    237 #define CODE_BOOK_SCF_LAV00         60
    238 #define CODE_BOOK_SCF_LAV01         31
    239 #define CODE_BOOK_SCF_LAV10         60
    240 #define CODE_BOOK_SCF_LAV11         31
    241 #define CODE_BOOK_SCF_LAV_BALANCE11 12
    242 #define CODE_BOOK_SCF_LAV_BALANCE10 24
    243 
    244 typedef enum
    245 {
    246   SBR_AMP_RES_1_5=0,
    247   SBR_AMP_RES_3_0
    248 }
    249 AMP_RES;
    250 
    251 typedef enum
    252 {
    253   XPOS_MDCT,
    254   XPOS_MDCT_CROSS,
    255   XPOS_LC,
    256   XPOS_RESERVED,
    257   XPOS_SWITCHED /* not a real choice but used here to control behaviour */
    258 }
    259 XPOS_MODE;
    260 
    261 typedef enum
    262 {
    263   INVF_OFF = 0,
    264   INVF_LOW_LEVEL,
    265   INVF_MID_LEVEL,
    266   INVF_HIGH_LEVEL,
    267   INVF_SWITCHED /* not a real choice but used here to control behaviour */
    268 }
    269 INVF_MODE;
    270 
    271 typedef enum
    272 {
    273   SINGLE_RATE,
    274   DUAL_RATE
    275 }
    276 SR_MODE;
    277 
    278 typedef enum
    279 {
    280   FREQ_RES_LOW = 0,
    281   FREQ_RES_HIGH
    282 }
    283 FREQ_RES;
    284 
    285 
    286 #endif
    287