Home | History | Annotate | Download | only in aacdec
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 /*
     19 
     20  Pathname: ./src/sfb.c
     21 
     22 
     23 ------------------------------------------------------------------------------
     24  REVISION HISTORY
     25 
     26  Description: created to define the scalefactor bands for all sampling rates
     27 
     28  Description: Change short to Int16
     29 
     30  Description: Modified structure to avoid assigning addresses to constant
     31               tables. This solve linking problem when using the
     32               /ropi option (Read-only position independent) for some
     33               compilers
     34               - Eliminated redundant vector sfb_96_128.
     35               - Eliminated references to contant vector addresses in
     36                 samp_rate_info
     37 
     38  Who:                              Date:
     39  Description:
     40 
     41 ------------------------------------------------------------------------------
     42  INPUT AND OUTPUT DEFINITIONS
     43 
     44  Inputs:
     45 
     46  Local Stores/Buffers/Pointers Needed:
     47 
     48  Global Stores/Buffers/Pointers Needed:
     49 
     50  Outputs:
     51 
     52  Pointers and Buffers Modified:
     53 
     54 
     55  Local Stores Modified:
     56 
     57  Global Stores Modified:
     58 
     59 ------------------------------------------------------------------------------
     60  FUNCTION DESCRIPTION
     61 
     62  This function defines the scalefactor bands for all sampling rates
     63 
     64 ------------------------------------------------------------------------------
     65  REQUIREMENTS
     66 
     67 
     68 ------------------------------------------------------------------------------
     69  REFERENCES
     70 
     71  (1) ISO/IEC 14496-3: 1999(E)
     72     Subpart 4       p66     (sfb tables)
     73                     p111    (4.6.10)
     74                     p200    (Annex 4.B.5)
     75 
     76 ------------------------------------------------------------------------------
     77  PSEUDO-CODE
     78 
     79 ------------------------------------------------------------------------------
     80  RESOURCES USED
     81    When the code is written for a specific target processor the
     82      the resources used should be documented below.
     83 
     84  STACK USAGE: [stack count for this module] + [variable to represent
     85           stack usage for each subroutine called]
     86 
     87      where: [stack usage variable] = stack usage for [subroutine
     88          name] (see [filename].ext)
     89 
     90  DATA MEMORY USED: x words
     91 
     92  PROGRAM MEMORY USED: x words
     93 
     94  CLOCK CYCLES: [cycle count equation for this module] + [variable
     95            used to represent cycle count for each subroutine
     96            called]
     97 
     98      where: [cycle count variable] = cycle count for [subroutine
     99         name] (see [filename].ext)
    100 
    101 ------------------------------------------------------------------------------
    102 */
    103 
    104 
    105 /*----------------------------------------------------------------------------
    106 ; INCLUDES
    107 ----------------------------------------------------------------------------*/
    108 #include    "pv_audio_type_defs.h"
    109 #include    "sfb.h"
    110 
    111 /*----------------------------------------------------------------------------
    112 ; MACROS
    113 ; Define module specific macros here
    114 ----------------------------------------------------------------------------*/
    115 
    116 /*----------------------------------------------------------------------------
    117 ; DEFINES
    118 ; Include all pre-processor statements here. Include conditional
    119 ; compile variables also.
    120 ----------------------------------------------------------------------------*/
    121 
    122 /*----------------------------------------------------------------------------
    123 ; LOCAL FUNCTION DEFINITIONS
    124 ; Function Prototype declaration
    125 ----------------------------------------------------------------------------*/
    126 
    127 /*----------------------------------------------------------------------------
    128 ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
    129 ; Variable declaration - defined here and used outside this module
    130 ----------------------------------------------------------------------------*/
    131 const Int16 sfb_96_1024[] =
    132 {
    133     4, 8, 12, 16, 20, 24, 28,
    134     32, 36, 40, 44, 48, 52, 56,
    135     64, 72, 80, 88, 96, 108, 120,
    136     132, 144, 156, 172, 188, 212, 240,
    137     276, 320, 384, 448, 512, 576, 640,
    138     704, 768, 832, 896, 960, 1024
    139 };         /* 41 scfbands */
    140 
    141 const Int16 sfb_64_1024[] =
    142 {
    143     4, 8, 12, 16, 20, 24, 28,
    144     32, 36, 40, 44, 48, 52, 56,
    145     64, 72, 80, 88, 100, 112, 124,
    146     140, 156, 172, 192, 216, 240, 268,
    147     304, 344, 384, 424, 464, 504, 544,
    148     584, 624, 664, 704, 744, 784, 824,
    149     864, 904, 944, 984, 1024
    150 };               /* 41 scfbands 47 */
    151 
    152 const Int16 sfb_64_128[] =
    153 {
    154     4, 8, 12, 16, 20, 24, 32,
    155     40, 48, 64, 92, 128
    156 };                   /* 12 scfbands */
    157 
    158 
    159 const Int16 sfb_48_1024[] =
    160 {
    161     4,  8,  12, 16, 20, 24, 28,
    162     32, 36, 40, 48, 56, 64, 72,
    163     80, 88, 96, 108,    120,    132,    144,
    164     160,    176,    196,    216,    240,    264,    292,
    165     320,    352,    384,    416,    448,    480,    512,
    166     544,    576,    608,    640,    672,    704,    736,
    167     768,    800,    832,    864,    896,    928,    1024
    168 };
    169 /* 49  scfbands*/
    170 
    171 const Int16 sfb_48_128[] =
    172 {
    173     4,  8,  12, 16, 20, 28, 36,
    174     44, 56, 68, 80, 96, 112, 128
    175 };         /* 14 scfbands */
    176 
    177 const Int16 sfb_32_1024[] =
    178 {
    179     4,  8,  12, 16, 20, 24, 28,
    180     32, 36, 40, 48, 56, 64, 72,
    181     80, 88, 96, 108,    120,    132,    144,
    182     160,    176,    196,    216,    240,    264,    292,
    183     320,    352,    384,    416,    448,    480,    512,
    184     544,    576,    608,    640,    672,    704,    736,
    185     768,    800,    832,    864,    896,    928,    960,
    186     992,    1024
    187 };                         /* 51 scfbands */
    188 
    189 const Int16 sfb_24_1024[] =
    190 {
    191     4, 8, 12, 16, 20, 24, 28,
    192     32, 36, 40, 44, 52, 60, 68,
    193     76, 84, 92, 100, 108, 116, 124,
    194     136, 148, 160, 172, 188, 204, 220,
    195     240, 260, 284, 308, 336, 364, 396,
    196     432, 468, 508, 552, 600, 652, 704,
    197     768, 832, 896, 960, 1024
    198 };              /* 47 scfbands */
    199 
    200 const Int16 sfb_24_128[] =
    201 {
    202     4, 8, 12, 16, 20, 24, 28,
    203     36, 44, 52, 64, 76, 92, 108,
    204     128
    205 };                                   /* 15 scfbands */
    206 
    207 const Int16 sfb_16_1024[] =
    208 {
    209     8, 16, 24, 32, 40, 48, 56,
    210     64, 72, 80, 88, 100, 112, 124,
    211     136, 148, 160, 172, 184, 196, 212,
    212     228, 244, 260, 280, 300, 320, 344,
    213     368, 396, 424, 456, 492, 532, 572,
    214     616, 664, 716, 772, 832, 896, 960,
    215     1024
    216 };                                  /* 43 scfbands */
    217 
    218 const Int16 sfb_16_128[] =
    219 {
    220     4, 8, 12, 16, 20, 24, 28,
    221     32, 40, 48, 60, 72, 88, 108,
    222     128
    223 };                                   /* 15 scfbands */
    224 
    225 const Int16 sfb_8_1024[] =
    226 {
    227     12, 24, 36, 48, 60, 72, 84,
    228     96, 108, 120, 132, 144, 156, 172,
    229     188, 204, 220, 236, 252, 268, 288,
    230     308, 328, 348, 372, 396, 420, 448,
    231     476, 508, 544, 580, 620, 664, 712,
    232     764, 820, 880, 944, 1024
    233 };               /* 40 scfbands */
    234 
    235 const Int16 sfb_8_128[] =
    236 {
    237     4, 8, 12, 16, 20, 24, 28,
    238     36, 44, 52, 60, 72, 88, 108,
    239     128
    240 };                                   /* 15 scfbands */
    241 
    242 const SR_Info samp_rate_info[12] =
    243 {
    244     /* sampling_frequency, #long sfb, #short sfb */
    245     /* samp_rate, nsfb1024, nsfb128 */
    246     {96000, 41, 12},       /* 96000 */
    247     {88200, 41, 12},       /* 88200 */
    248     {64000, 47, 12},       /* 64000 */
    249     {48000, 49, 14},       /* 48000 */
    250     {44100, 49, 14},       /* 44100 */
    251     {32000, 51, 14},       /* 32000 */
    252     {24000, 47, 15},       /* 24000 */
    253     {22050, 47, 15},       /* 22050 */
    254     {16000, 43, 15},       /* 16000 */
    255     {12000, 43, 15},       /* 12000 */
    256     {11025, 43, 15},       /* 11025 */
    257     { 8000, 40, 15},       /* 8000  */
    258 };
    259 
    260 
    261 /*----------------------------------------------------------------------------
    262 ; EXTERNAL FUNCTION REFERENCES
    263 ; Declare functions defined elsewhere and referenced in this module
    264 ----------------------------------------------------------------------------*/
    265 
    266 /*----------------------------------------------------------------------------
    267 ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
    268 ; Declare variables used in this module but defined elsewhere
    269 ----------------------------------------------------------------------------*/
    270 
    271 /*----------------------------------------------------------------------------
    272 ; FUNCTION CODE
    273 ----------------------------------------------------------------------------*/
    274 
    275 
    276