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: s_tDec_Int_File.h
     21 
     22 ------------------------------------------------------------------------------
     23  REVISION HISTORY
     24 
     25  Description: Remove unneeded structure elements, clean up.
     26 
     27  Description: Remove block.h, not needed, chains in other not needed files.
     28 
     29  Description: Added declaration of scratch memory, scratchTnsDecCoefMem,
     30  which will be utilized by tns_decode_coef().
     31 
     32  Description:
     33  (1) Modified to include the lines...
     34 
     35     #ifdef __cplusplus
     36     extern "C" {
     37     #endif
     38 
     39     #ifdef __cplusplus
     40     }
     41     #endif
     42 
     43  (2) Updated the copyright header.
     44 
     45  Description: Per review comments...
     46  (1) Removed declaration of unused variable, savedMCInfo
     47  (2) Commented out ADTS related variables.
     48  (3) Slight re-wording of comment for clarity.
     49 
     50  Description:
     51  (1) Moved scratch_prog_config into the scratch union.
     52 
     53  Description:
     54  (1) Added ltp state variable.
     55 
     56  Description: Make tDec_Int_perChan an array of structures.
     57               In the user applications, the malloc command will allocate a
     58               continuous chunk of memory.
     59 
     60  Description:
     61            (1) Added the array data_stream_bytes[] to structure tDec_Int_File.
     62                This to support Data Streaming Elements (DSE).
     63            (2) Updated the copyright header.
     64 
     65 
     66  Who:                                       Date:
     67  Description:
     68 
     69 ------------------------------------------------------------------------------
     70  INCLUDE DESCRIPTION
     71 
     72  This include file defines the structure, tDec_Int_Chan
     73 
     74 ------------------------------------------------------------------------------
     75 */
     76 
     77 /*----------------------------------------------------------------------------
     78 ; CONTINUE ONLY IF NOT ALREADY DEFINED
     79 ----------------------------------------------------------------------------*/
     80 #ifndef S_TDEC_INT_FILE_H
     81 #define S_TDEC_INT_FILE_H
     82 
     83 #ifdef __cplusplus
     84 extern "C"
     85 {
     86 #endif
     87 
     88     /*----------------------------------------------------------------------------
     89     ; INCLUDES
     90     ----------------------------------------------------------------------------*/
     91 #include "pv_audio_type_defs.h"
     92 #include "s_progconfig.h"
     93 #include "s_frameinfo.h"
     94 #include "s_mc_info.h"
     95 #include "s_adif_header.h"
     96 #include "s_tdec_int_chan.h"
     97 #include "s_pulseinfo.h"
     98 #include "s_bits.h"
     99 #include "s_hcb.h"
    100 #include "e_infoinitconst.h"
    101 
    102 #include "s_sbr_channel.h"
    103 #include "s_sbr_dec.h"
    104 #include "s_sbrbitstream.h"
    105 
    106     /*----------------------------------------------------------------------------
    107     ; MACROS
    108     ; Define module specific macros here
    109     ----------------------------------------------------------------------------*/
    110 
    111     /*----------------------------------------------------------------------------
    112     ; DEFINES
    113     ; Include all pre-processor statements here.
    114     ----------------------------------------------------------------------------*/
    115 
    116     /*----------------------------------------------------------------------------
    117     ; EXTERNAL VARIABLES REFERENCES
    118     ; Declare variables used in this module but defined elsewhere
    119     ----------------------------------------------------------------------------*/
    120 
    121     /*----------------------------------------------------------------------------
    122     ; SIMPLE TYPEDEF'S
    123     ----------------------------------------------------------------------------*/
    124 
    125     /*----------------------------------------------------------------------------
    126     ; ENUMERATED TYPEDEF'S
    127     ----------------------------------------------------------------------------*/
    128 
    129     /*----------------------------------------------------------------------------
    130     ; STRUCTURES TYPEDEF'S
    131     ----------------------------------------------------------------------------*/
    132 
    133 
    134 
    135 
    136 
    137     /*
    138      * Note: most of the names of the variables put into this structure were kept
    139      * the same because the name is also used in called functions.
    140      *
    141      * bno - block number
    142      *
    143      */
    144     typedef struct
    145     {
    146         UInt32         bno;
    147         Int            status;  /* save the status */
    148 
    149         bool           aacPlusEnabled;
    150         bool           aacConfigUtilityEnabled;
    151 
    152         Int            current_program;
    153         Int            frameLength;
    154         Int            adif_test;
    155 
    156         BITS           inputStream;
    157 
    158         ProgConfig     prog_config;
    159 
    160         Int            SFBWidth128[(1<<LEN_MAX_SFBS)];
    161 
    162         /*
    163          * One of the two arrays should be deleted in the final version.
    164          */
    165         FrameInfo      longFrameInfo;
    166         FrameInfo      shortFrameInfo;
    167         FrameInfo     *winmap[NUM_WIN_SEQ];
    168 
    169         /*
    170          * Pns variables.
    171          */
    172         Int32          pns_cur_noise_state;
    173 
    174         /*
    175          *
    176          */
    177         MC_Info        mc_info;
    178 
    179         Int            ltp_buffer_state;
    180 
    181         /*
    182          *  For eaac+, a scratch matrix is created with the rigth element ( perChan[1] is not used)
    183          *  and the fxpCoef matrix. These  2 matrices are [2][38][64] == 4864 Int32
    184          *    2349 coming from the perChan[1] plus 4096 coming from fxpCoef
    185          */
    186         tDec_Int_Chan  perChan[Chans];
    187 
    188         Int32          fxpCoef[2][LN];         /* LN  = 2048     */
    189 
    190 
    191 
    192 #ifdef AAC_PLUS
    193 
    194         SBRDECODER_DATA sbrDecoderData;/* allocates 2 SBR_CHANNEL, each has a SBR_FRAME_DATA */
    195         SBR_DEC         sbrDec;
    196         SBRBITSTREAM    sbrBitStr;
    197 
    198 #endif
    199 
    200 
    201         /*
    202          * If ADTS support is needed, the following variables will
    203          * be required.
    204          */
    205         UInt32         syncword;
    206         Int            invoke;
    207 
    208         Int         mask[MAXBANDS];
    209         Int         hasmask;
    210 
    211 
    212         /*  SBR usage
    213          *  These two unions are used for the SBR tool and used
    214          *  as a single 2560 int32 continuous memory for circular
    215          *  buffering the synthesis QMF's bank history
    216          */
    217 
    218         /* This union specifies memory for arrays which are used
    219          * by only one function.  This is the simplest type of scratch
    220          * memory to implement, since there are no worries about
    221          * function interaction.
    222          */
    223         union scratch_memory
    224         {
    225             Int32  fft[LONG_WINDOW];    /* 1024, as needed by the FFT */
    226             Int32  tns_inv_filter[TNS_MAX_ORDER];
    227             Int32  tns_decode_coef[2*TNS_MAX_ORDER];
    228             Int    huffbook_used[248];
    229             Int16  tmp_spec[LN2];  /* Used in conjunction with quant_spec */
    230 
    231             ADIF_Header    adif_header;
    232 
    233             ProgConfig     scratch_prog_config;
    234 
    235 
    236             Int32  scratch_mem[16][64];
    237         } scratch;
    238 
    239         /* This union tries to take advantage of the fact that
    240          * some variables are only used before LTP, and
    241          * the long array, predictedSamples, is only used after LTP.
    242          */
    243 
    244         /*
    245          *  also used by the circular buffer scheme on aac+ (needs 4096 + 1152)
    246          *  from scratch_mem[2] + 5248  (uses most of shared_memory).
    247          *  For eaac+, shared memory is used by sbrQmfBufferReal which needs
    248          *  1824 bytes
    249          */
    250         union shared_memory
    251         {
    252             Int32       predictedSamples[LONG_BLOCK1];  /* 2048 Int32 */
    253 
    254             Char        data_stream_bytes[(1<<LEN_D_CNT)+1];
    255 
    256             struct
    257             {
    258                 Int16         quantSpec[LN2];
    259                 SectInfo    sect[MAXBANDS + 1];
    260                 PulseInfo   pulseInfo;
    261             } a;
    262 
    263         } share;
    264 
    265 
    266     } tDec_Int_File;
    267 
    268     /*----------------------------------------------------------------------------
    269     ; GLOBAL FUNCTION DEFINITIONS
    270     ; Function Prototype declaration
    271     ----------------------------------------------------------------------------*/
    272 
    273 #ifdef __cplusplus
    274 }
    275 #endif
    276 
    277 #endif /* S_TDEC_INT_FILE_H */
    278