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: .huffman.h
     21 
     22 ------------------------------------------------------------------------------
     23  REVISION HISTORY
     24 
     25  Description: Put declaration of getfill in this file.
     26 
     27  Description: Remove prstflag from get_ics_info declaration.
     28 
     29  Description: Trivial change of the data type of one of the parameters to
     30               get_ics_info.
     31 
     32  Description: Change where get_ics_info is declared.
     33 
     34  Description: Clean up comments
     35 
     36  Description: (1) Add declaration of binary tree search function for Huffman
     37                   decoding
     38               (2) #if the traditional and optimized linear seach methods.
     39 
     40  Description: Modified per review comments
     41               (1) delete #if traditional and optimized linear seach methods
     42 
     43  Description: Merged Ken's change on getics: delete pFrameInfo from argument
     44               list
     45 
     46  Description: Added function definition for table specific huffman decoding
     47               functions.
     48 
     49  Who:                                         Date:
     50  Description:
     51 
     52 ------------------------------------------------------------------------------
     53  INCLUDE DESCRIPTION
     54 
     55  include function prototype definitions for Huffman decoding module
     56 
     57 ------------------------------------------------------------------------------
     58 */
     59 
     60 /*----------------------------------------------------------------------------
     61 ; CONTINUE ONLY IF NOT ALREADY DEFINED
     62 ----------------------------------------------------------------------------*/
     63 #ifndef HUFFMAN_H
     64 #define HUFFMAN_H
     65 
     66 #ifdef __cplusplus
     67 extern "C"
     68 {
     69 #endif
     70 
     71     /*----------------------------------------------------------------------------
     72     ; INCLUDES
     73     ----------------------------------------------------------------------------*/
     74 #include    "pv_audio_type_defs.h"
     75 #include    "s_frameinfo.h"
     76 #include    "s_sectinfo.h"
     77 #include    "s_pulseinfo.h"
     78 #include    "s_tdec_int_file.h"
     79 #include    "s_tdec_int_chan.h"
     80 #include    "ibstream.h"
     81 
     82 #include    "s_hcb.h"
     83 #include    "hcbtables.h"
     84 
     85 #include    "get_pulse_data.h"
     86 #include    "get_ics_info.h"
     87 
     88     /*----------------------------------------------------------------------------
     89     ; MACROS
     90     ; Define module specific macros here
     91     ----------------------------------------------------------------------------*/
     92 
     93     /*----------------------------------------------------------------------------
     94     ; DEFINES
     95     ; Include all pre-processor statements here.
     96     ----------------------------------------------------------------------------*/
     97 #define DIMENSION_4     4
     98 #define DIMENSION_2     2
     99 
    100     /*----------------------------------------------------------------------------
    101     ; EXTERNAL VARIABLES REFERENCES
    102     ; Declare variables used in this module but defined elsewhere
    103     ----------------------------------------------------------------------------*/
    104 
    105     /*----------------------------------------------------------------------------
    106     ; SIMPLE TYPEDEF'S
    107     ----------------------------------------------------------------------------*/
    108 
    109     /*----------------------------------------------------------------------------
    110     ; ENUMERATED TYPEDEF'S
    111     ----------------------------------------------------------------------------*/
    112 
    113     /*----------------------------------------------------------------------------
    114     ; STRUCTURES TYPEDEF'S
    115     ----------------------------------------------------------------------------*/
    116 
    117     /*----------------------------------------------------------------------------
    118     ; GLOBAL FUNCTION DEFINITIONS
    119     ; Function Prototype declaration
    120     ----------------------------------------------------------------------------*/
    121     Int decode_huff_cw_tab1(
    122         BITS *pInputStream);
    123 
    124     Int decode_huff_cw_tab2(
    125         BITS *pInputStream);
    126 
    127     Int decode_huff_cw_tab3(
    128         BITS *pInputStream);
    129 
    130     Int decode_huff_cw_tab4(
    131         BITS *pInputStream);
    132 
    133     Int decode_huff_cw_tab5(
    134         BITS *pInputStream);
    135 
    136     Int decode_huff_cw_tab6(
    137         BITS *pInputStream);
    138 
    139     Int decode_huff_cw_tab7(
    140         BITS *pInputStream);
    141 
    142     Int decode_huff_cw_tab8(
    143         BITS *pInputStream);
    144 
    145     Int decode_huff_cw_tab9(
    146         BITS *pInputStream);
    147 
    148     Int decode_huff_cw_tab10(
    149         BITS *pInputStream);
    150 
    151     Int decode_huff_cw_tab11(
    152         BITS *pInputStream);
    153 
    154     Int decode_huff_scl(
    155         BITS          *pInputStream);
    156 
    157     Int infoinit(
    158         const  Int sampling_rate_idx,
    159         FrameInfo   **ppWin_seq_info,
    160         Int    *pSfbwidth128);
    161 
    162     Int huffcb(
    163         SectInfo *pSect,
    164         BITS     *pInputStream,
    165         Int      *pSectbits,
    166         Int       tot_sfb,
    167         Int       sfb_per_sbk,
    168         Int       max_sfb);
    169 
    170     Int hufffac(
    171         FrameInfo   *pFrameInfo,
    172         BITS        *pInputStream,
    173         Int         *pGroup,
    174         Int          nsect,
    175         SectInfo    *pSect,
    176         Int          global_gain,
    177         Int         *pFactors,
    178         Int          huffBookUsed[]);
    179 
    180     Int huffspec_fxp(
    181         FrameInfo *pFrameInfo,
    182         BITS      *pInputStream,
    183         Int       nsect,
    184         SectInfo  *pSectInfo,
    185         Int       factors[],
    186         Int32     coef[],
    187         Int16     quantSpec[],
    188         Int16     tmp_spec[],
    189         const FrameInfo  *pLongFrameInfo,
    190         PulseInfo  *pPulseInfo,
    191         Int         qFormat[]);
    192 
    193     Int huffdecode(
    194         Int           id_syn_ele,
    195         BITS          *pInputStream,
    196         tDec_Int_File *pVars,
    197         tDec_Int_Chan *pChVars[]);
    198 
    199     void deinterleave(
    200         Int16          interleaved[],
    201         Int16        deinterleaved[],
    202         FrameInfo   *pFrameInfo);
    203 
    204     Int getics(
    205 
    206         BITS            *pInputStream,
    207         Int             common_window,
    208         tDec_Int_File   *pVars,
    209         tDec_Int_Chan   *pChVars,
    210         Int             group[],
    211         Int             *pMax_sfb,
    212         Int             *pCodebookMap,
    213         TNS_frame_info  *pTnsInfo,
    214         FrameInfo       **pWinMap,
    215         PulseInfo       *pPulseInfo,
    216         SectInfo        sect[]);
    217 
    218     void  calc_gsfb_table(
    219         FrameInfo   *pFrameInfo,
    220         Int         group[]);
    221 
    222     Int getmask(
    223         FrameInfo   *pFrameInfo,
    224         BITS        *pInputStream,
    225         Int         *pGroup,
    226         Int         max_sfb,
    227         Int         *pMask);
    228 
    229     void getgroup(
    230         Int         group[],
    231         BITS        *pInputStream);
    232 
    233 
    234     /*----------------------------------------------------------------------------
    235     ; END
    236     ----------------------------------------------------------------------------*/
    237 #ifdef __cplusplus
    238 }
    239 #endif
    240 
    241 #endif
    242