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 - 2015 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 #define SBR_MAX_ENERGY_VALUES                   5
    126 #define SBR_GLOBAL_TONALITY_VALUES              2
    127 
    128 #define MAX_NUM_CHANNELS                        2
    129 
    130 #define MAX_NOISE_ENVELOPES                     2
    131 #define MAX_NUM_NOISE_COEFFS                    5
    132 #define MAX_NUM_NOISE_VALUES                    (MAX_NUM_NOISE_COEFFS*MAX_NOISE_ENVELOPES)
    133 
    134 #define MAX_NUM_ENVELOPE_VALUES                 (MAX_ENVELOPES * MAX_FREQ_COEFFS)
    135 #define MAX_ENVELOPES                           5
    136 #define MAX_FREQ_COEFFS                         48
    137 
    138 #define MAX_FREQ_COEFFS_FS44100                 35
    139 #define MAX_FREQ_COEFFS_FS48000                 32
    140 
    141 
    142 #define QMF_CHANNELS                            64
    143 #define QMF_FILTER_LENGTH                      640
    144 #define QMF_MAX_TIME_SLOTS                      32
    145 #define NO_OF_ESTIMATES_LC                      4
    146 #define NO_OF_ESTIMATES_LD                      3
    147 #define MAX_NO_OF_ESTIMATES                     4
    148 
    149 
    150 #define NOISE_FLOOR_OFFSET                      6
    151 #define NOISE_FLOOR_OFFSET_64                   (FL2FXCONST_DBL(0.09375f))
    152 
    153 #define LOW_RES                                 0
    154 #define HIGH_RES                                1
    155 
    156 #define LO                                      0
    157 #define HI                                      1
    158 
    159 #define LENGTH_SBR_FRAME_INFO                   35      /* 19 */
    160 
    161 #define SBR_NSFB_LOW_RES                        9       /*  8 */
    162 #define SBR_NSFB_HIGH_RES                       18      /* 16 */
    163 
    164 
    165 #define SBR_XPOS_CTRL_DEFAULT                   2
    166 
    167 #define SBR_FREQ_SCALE_DEFAULT                  2
    168 #define SBR_ALTER_SCALE_DEFAULT                 1
    169 #define SBR_NOISE_BANDS_DEFAULT                 2
    170 
    171 #define SBR_LIMITER_BANDS_DEFAULT               2
    172 #define SBR_LIMITER_GAINS_DEFAULT               2
    173 #define SBR_LIMITER_GAINS_INFINITE              3
    174 #define SBR_INTERPOL_FREQ_DEFAULT               1
    175 #define SBR_SMOOTHING_LENGTH_DEFAULT            0
    176 
    177 
    178 /* sbr_header */
    179 #define SI_SBR_AMP_RES_BITS                     1
    180 #define SI_SBR_COUPLING_BITS                    1
    181 #define SI_SBR_START_FREQ_BITS                  4
    182 #define SI_SBR_STOP_FREQ_BITS                   4
    183 #define SI_SBR_XOVER_BAND_BITS                  3
    184 #define SI_SBR_RESERVED_BITS                    2
    185 #define SI_SBR_DATA_EXTRA_BITS                  1
    186 #define SI_SBR_HEADER_EXTRA_1_BITS              1
    187 #define SI_SBR_HEADER_EXTRA_2_BITS              1
    188 
    189 /* sbr_header extra 1 */
    190 #define SI_SBR_FREQ_SCALE_BITS                  2
    191 #define SI_SBR_ALTER_SCALE_BITS                 1
    192 #define SI_SBR_NOISE_BANDS_BITS                 2
    193 
    194 /* sbr_header extra 2 */
    195 #define SI_SBR_LIMITER_BANDS_BITS               2
    196 #define SI_SBR_LIMITER_GAINS_BITS               2
    197 #define SI_SBR_INTERPOL_FREQ_BITS               1
    198 #define SI_SBR_SMOOTHING_LENGTH_BITS            1
    199 
    200 /* sbr_grid */
    201 #define SBR_CLA_BITS                            2   /*!< size of bs_frame_class */
    202 #define SBR_CLA_BITS_LD                         1   /*!< size of bs_frame_class */
    203 #define SBR_ENV_BITS                            2   /*!< size of bs_num_env_raw */
    204 #define SBR_ABS_BITS                            2   /*!< size of bs_abs_bord_raw for HE-AAC */
    205 #define SBR_NUM_BITS                            2   /*!< size of bs_num_rel */
    206 #define SBR_REL_BITS                            2   /*!< size of bs_rel_bord_raw */
    207 #define SBR_RES_BITS                            1   /*!< size of bs_freq_res_flag */
    208 #define SBR_DIR_BITS                            1   /*!< size of bs_df_flag */
    209 
    210 
    211 /* sbr_data */
    212 #define SI_SBR_INVF_MODE_BITS                   2
    213 
    214 
    215 #define SI_SBR_START_ENV_BITS_AMP_RES_3_0           6
    216 #define SI_SBR_START_ENV_BITS_BALANCE_AMP_RES_3_0   5
    217 #define SI_SBR_START_NOISE_BITS_AMP_RES_3_0         5
    218 #define SI_SBR_START_NOISE_BITS_BALANCE_AMP_RES_3_0 5
    219 
    220 #define SI_SBR_START_ENV_BITS_AMP_RES_1_5           7
    221 #define SI_SBR_START_ENV_BITS_BALANCE_AMP_RES_1_5   6
    222 
    223 
    224 #define SI_SBR_EXTENDED_DATA_BITS               1
    225 #define SI_SBR_EXTENSION_SIZE_BITS              4
    226 #define SI_SBR_EXTENSION_ESC_COUNT_BITS         8
    227 #define SI_SBR_EXTENSION_ID_BITS                2
    228 
    229 #define SBR_EXTENDED_DATA_MAX_CNT               (15+255)
    230 
    231 #define EXTENSION_ID_PS_CODING                  2
    232 
    233 /* Envelope coding constants */
    234 #define FREQ                      0
    235 #define TIME                      1
    236 
    237 /* qmf data scaling */
    238 #define QMF_SCALE_OFFSET          7
    239 
    240 /* huffman tables */
    241 #define CODE_BOOK_SCF_LAV00         60
    242 #define CODE_BOOK_SCF_LAV01         31
    243 #define CODE_BOOK_SCF_LAV10         60
    244 #define CODE_BOOK_SCF_LAV11         31
    245 #define CODE_BOOK_SCF_LAV_BALANCE11 12
    246 #define CODE_BOOK_SCF_LAV_BALANCE10 24
    247 
    248 typedef enum
    249 {
    250   SBR_AMP_RES_1_5=0,
    251   SBR_AMP_RES_3_0
    252 }
    253 AMP_RES;
    254 
    255 typedef enum
    256 {
    257   XPOS_MDCT,
    258   XPOS_MDCT_CROSS,
    259   XPOS_LC,
    260   XPOS_RESERVED,
    261   XPOS_SWITCHED /* not a real choice but used here to control behaviour */
    262 }
    263 XPOS_MODE;
    264 
    265 typedef enum
    266 {
    267   INVF_OFF = 0,
    268   INVF_LOW_LEVEL,
    269   INVF_MID_LEVEL,
    270   INVF_HIGH_LEVEL,
    271   INVF_SWITCHED /* not a real choice but used here to control behaviour */
    272 }
    273 INVF_MODE;
    274 
    275 #endif
    276