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: window_block_fxp.h
     21 
     22 
     23 ------------------------------------------------------------------------------
     24  REVISION HISTORY
     25 
     26  Description:
     27     modified function definition: Time_data from Int to Int32
     28     change wnd_shape from structure to passing parameters
     29     delete definition of wnd_shape1, not needed.
     30 
     31  Description: Modified based on unit test comments
     32 
     33  Description: Change copyright, add () around constants.
     34 
     35  Description:
     36     changed Long_Window_fxp and Short _Window_fxp tables definition, from
     37     "const UInt16 *"  to "const UInt16 * const" to avoid global variable
     38     definition.
     39 
     40  Description: Updated function trans4m_freq_2_time_fxp definition
     41 
     42  Description:  Modified function interface to add output_buffer
     43 
     44 
     45  Description:
     46 
     47 ------------------------------------------------------------------------------
     48  INCLUDE DESCRIPTION
     49 
     50  Header file for window and block switch
     51 
     52 
     53 ------------------------------------------------------------------------------
     54  REFERENCES
     55 
     56  (1) ISO/IEC 13818-7 Part 7: Advanced Audo Coding (AAC)
     57 
     58 
     59  (2) MPEG-2 NBC Audio Decoder
     60    "This software module was originally developed by AT&T, Dolby
     61    Laboratories, Fraunhofer Gesellschaft IIS in the course of development
     62    of the MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and
     63    3. This software module is an implementation of a part of one or more
     64    MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4
     65    Audio standard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio
     66    standards free license to this software module or modifications thereof
     67    for use in hardware or software products claiming conformance to the
     68    MPEG-2 NBC/MPEG-4 Audio  standards. Those intending to use this software
     69    module in hardware or software products are advised that this use may
     70    infringe existing patents. The original developer of this software
     71    module and his/her company, the subsequent editors and their companies,
     72    and ISO/IEC have no liability for use of this software module or
     73    modifications thereof in an implementation. Copyright is not released
     74    for non MPEG-2 NBC/MPEG-4 Audio conforming products.The original
     75    developer retains full right to use the code for his/her own purpose,
     76    assign or donate the code to a third party and to inhibit third party
     77    from using the code for non MPEG-2 NBC/MPEG-4 Audio conforming products.
     78    This copyright notice must be included in all copies or derivative
     79    works."
     80    Copyright(c)1996.
     81 
     82 ------------------------------------------------------------------------------
     83 */
     84 
     85 /*----------------------------------------------------------------------------
     86 ; CONTINUE ONLY IF NOT ALREADY DEFINED
     87 ----------------------------------------------------------------------------*/
     88 #ifndef WINDOW_BLOCK_FXP_H
     89 #define WINDOW_BLOCK_FXP_H
     90 
     91 
     92 /*----------------------------------------------------------------------------
     93 ; INCLUDES
     94 ----------------------------------------------------------------------------*/
     95 #include "pv_audio_type_defs.h"
     96 #include "e_window_shape.h"
     97 #include "e_window_sequence.h"
     98 
     99 /*----------------------------------------------------------------------------
    100 ; MACROS
    101 ; Define module specific macros here
    102 ----------------------------------------------------------------------------*/
    103 #ifdef __cplusplus
    104 extern "C"
    105 {
    106 #endif
    107 
    108     /*----------------------------------------------------------------------------
    109     ; DEFINES
    110     ; Include all pre-processor statements here.
    111     ----------------------------------------------------------------------------*/
    112 #define LONG_WINDOW         (1024)
    113 #define SHORT_WINDOW        (128)
    114 
    115 #define HALF_LONG_WINDOW    (LONG_WINDOW>>1)
    116 #define HALF_SHORT_WINDOW   (SHORT_WINDOW>>1)
    117 
    118 #define NUM_SHORT_WINDOWS   (8)
    119 #define LONG_WINDOW_m_1     (LONG_WINDOW-1)
    120 #define SHORT_WINDOW_m_1    (SHORT_WINDOW-1)
    121 
    122     /*
    123      *  Limits for window sequences, they are used to build
    124      *  each long window, they are defined in the standards
    125      */
    126 #define W_L_START_1         ((3*LONG_WINDOW - SHORT_WINDOW)>>1)
    127 #define W_L_START_2         ((3*LONG_WINDOW + SHORT_WINDOW)>>1)
    128 #define W_L_STOP_1          ((LONG_WINDOW - SHORT_WINDOW)>>1)
    129 #define W_L_STOP_2          ((LONG_WINDOW + SHORT_WINDOW)>>1)
    130 
    131 
    132 #define LONG_BLOCK1          (2*LONG_WINDOW)
    133 #define SHORT_BLOCK1         (2*SHORT_WINDOW)
    134 
    135 
    136 #define  SCALING    10
    137 #define  ROUNDING     (1<<(SCALING-1))
    138 
    139 
    140     /*----------------------------------------------------------------------------
    141     ; EXTERNAL VARIABLES REFERENCES
    142     ; Declare variables used in this module but defined elsewhere
    143     ----------------------------------------------------------------------------*/
    144     extern const Int16 Short_Window_KBD_fxp[ SHORT_WINDOW];
    145     extern const Int16 Long_Window_KBD_fxp[ LONG_WINDOW];
    146     extern const Int16 Short_Window_sine_fxp[ SHORT_WINDOW];
    147     extern const Int16 Long_Window_sine_fxp[ LONG_WINDOW];
    148 
    149     extern const Int16 * const Long_Window_fxp[];
    150     extern const Int16 * const Short_Window_fxp[];
    151 
    152     /*----------------------------------------------------------------------------
    153     ; SIMPLE TYPEDEF'S
    154     ----------------------------------------------------------------------------*/
    155 
    156     /*----------------------------------------------------------------------------
    157     ; ENUMERATED TYPEDEF'S
    158     ----------------------------------------------------------------------------*/
    159 
    160 
    161 
    162     /*----------------------------------------------------------------------------
    163     ; STRUCTURES TYPEDEF'S
    164     ----------------------------------------------------------------------------*/
    165 
    166     /*----------------------------------------------------------------------------
    167     ; GLOBAL FUNCTION DEFINITIONS
    168     ; Function Prototype declaration
    169     ----------------------------------------------------------------------------*/
    170 
    171     void trans4m_freq_2_time_fxp(
    172         Int32   Frequency_data[],
    173         Int32   Time_data[],
    174 #ifdef AAC_PLUS
    175         Int32   Output_buffer[],
    176 #else
    177         Int16   Output_buffer[],
    178 #endif
    179         WINDOW_SEQUENCE wnd_seq,
    180         Int     wnd_shape_prev_bk,
    181         Int     wnd_shape_this_bk,
    182         Int     Q_format,
    183         Int32   abs_max_per_window[],
    184         Int32   freq_2_time_buffer[] ,
    185         Int16   *Interleave_output
    186     );
    187 
    188 
    189 
    190     void trans4m_freq_2_time_fxp_1(
    191         Int32   Frequency_data[],
    192         Int32   Time_data[],
    193         Int16   Output_buffer[],
    194         WINDOW_SEQUENCE wnd_seq,
    195         Int     wnd_shape_prev_bk,
    196         Int     wnd_shape_this_bk,
    197         Int     Q_format,
    198         Int32   abs_max_per_window[],
    199         Int32   freq_2_time_buffer[]
    200     );
    201 
    202 
    203     void trans4m_freq_2_time_fxp_2(
    204         Int32   Frequency_data[],
    205         Int32   Time_data[],
    206         WINDOW_SEQUENCE wnd_seq,
    207         Int     wnd_shape_prev_bk,
    208         Int     wnd_shape_this_bk,
    209         Int     Q_format,
    210         Int32   abs_max_per_window[],
    211         Int32   freq_2_time_buffer[] ,
    212         Int16   *Interleave_output
    213     );
    214 
    215     void trans4m_time_2_freq_fxp(
    216         Int32   Time2Freq_data[],
    217         WINDOW_SEQUENCE wnd_seq,
    218         Int     wnd_shape_prev_bk,
    219         Int     wnd_shape_this_bk,
    220         Int     *pQ_format,
    221         Int32   mem_4_in_place_FFT[]);
    222 
    223     /*----------------------------------------------------------------------------
    224     ; END
    225     ----------------------------------------------------------------------------*/
    226 #ifdef __cplusplus
    227 }
    228 #endif
    229 
    230 #endif  /*  WINDOW_BLOCK_FXP_H */
    231 
    232