Home | History | Annotate | Download | only in src
      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 Portions of this file are derived from the following 3GPP standard:
     20 
     21     3GPP TS 26.173
     22     ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
     23     Available from http://www.3gpp.org
     24 
     25 (C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
     26 Permission to distribute, modify and use this file under the standard license
     27 terms listed above has been obtained from the copyright holder.
     28 ****************************************************************************************/
     29 /*
     30 ------------------------------------------------------------------------------
     31 
     32  Name: pvamrwbdecoder_cnst.h
     33 
     34      Date: 05/02/2007
     35 
     36 ------------------------------------------------------------------------------
     37  REVISION HISTORY
     38 
     39 
     40  Description:
     41 
     42 ------------------------------------------------------------------------------
     43  INCLUDE DESCRIPTION
     44 
     45  Main header file for the Packet Video AMR Wide  Band  decoder library. The
     46  constants, structures, and functions defined within this file, along with
     47  a basic data types header file, is all that is needed to use and communicate
     48  with the library. The internal data structures within the library are
     49  purposely hidden.
     50 
     51 
     52 ------------------------------------------------------------------------------
     53  REFERENCES
     54 
     55   (Normally header files do not have a reference section)
     56 
     57 ------------------------------------------------------------------------------
     58 */
     59 
     60 /*----------------------------------------------------------------------------
     61 ; CONTINUE ONLY IF NOT ALREADY DEFINED
     62 ----------------------------------------------------------------------------*/
     63 
     64 #ifndef PVAMRWBDECODER_CNST_H
     65 #define PVAMRWBDECODER_CNST_H
     66 
     67 /*----------------------------------------------------------------------------
     68 ; INCLUDES
     69 ----------------------------------------------------------------------------*/
     70 
     71 /*----------------------------------------------------------------------------
     72 ; MACROS
     73 ; Define module specific macros here
     74 ----------------------------------------------------------------------------*/
     75 
     76 /*----------------------------------------------------------------------------
     77 ; DEFINES
     78 ; Include all pre-processor statements here.
     79 ----------------------------------------------------------------------------*/
     80 
     81 #define L_FRAME      256                   /* Frame size                                 */
     82 #define L_SUBFR16k   80                    /* Subframe size at 16kHz                     */
     83 
     84 #define L_SUBFR      64                    /* Subframe size                              */
     85 #define NB_SUBFR     4                     /* Number of subframe per frame               */
     86 
     87 #define L_NEXT       64                    /* Overhead in LP analysis                    */
     88 #define L_WINDOW     384                   /* window size in LP analysis                 */
     89 #define L_TOTAL      384                   /* Total size of speech buffer.               */
     90 #define M            16                    /* Order of LP filter                         */
     91 #define M16k             20
     92 
     93 #define L_FILT16k    15                    /* Delay of down-sampling filter              */
     94 #define L_FILT       12                    /* Delay of up-sampling filter                */
     95 
     96 #define GP_CLIP      15565                 /* Pitch gain clipping = 0.95 Q14             */
     97 #define PIT_SHARP    27853                 /* pitch sharpening factor = 0.85 Q15         */
     98 
     99 #define PIT_MIN      34                    /* Minimum pitch lag with resolution 1/4      */
    100 #define PIT_FR2      128                   /* Minimum pitch lag with resolution 1/2      */
    101 #define PIT_FR1_9b   160                   /* Minimum pitch lag with resolution 1        */
    102 #define PIT_FR1_8b   92                    /* Minimum pitch lag with resolution 1        */
    103 #define PIT_MAX      231                   /* Maximum pitch lag                          */
    104 #define L_INTERPOL   (16+1)                /* Length of filter for interpolation         */
    105 
    106 #define OPL_DECIM    2                     /* Decimation in open-loop pitch analysis     */
    107 
    108 #define PREEMPH_FAC  22282                 /* preemphasis factor (0.68 in Q15)           */
    109 #define GAMMA1       30147                 /* Weighting factor (numerator) (0.92 in Q15) */
    110 #define TILT_FAC     22282                 /* tilt factor (denominator) (0.68 in Q15)    */
    111 
    112 #define Q_MAX        8                     /* scaling max for signal (see syn_filt_32)   */
    113 
    114 #define RANDOM_INITSEED  21845             /* own random init value                      */
    115 
    116 #define L_MEANBUF        3
    117 #define ONE_PER_MEANBUF 10923
    118 
    119 #define MODE_7k       0
    120 #define MODE_9k       1
    121 #define MODE_12k      2
    122 #define MODE_14k      3
    123 #define MODE_16k      4
    124 #define MODE_18k      5
    125 #define MODE_20k      6
    126 #define MODE_23k      7
    127 #define MODE_24k      8
    128 #define MRDTX         9
    129 //#define NUM_OF_MODES  10                   /* see bits.h for bits definition             */
    130 
    131 #define EHF_MASK (int16)0x0008            /* homing frame pattern                       */
    132 
    133 #define BIT_0     (int16)-127
    134 #define BIT_1     (int16)127
    135 #define BIT_0_ITU (int16)0x007F
    136 #define BIT_1_ITU (int16)0x0081
    137 
    138 /*----------------------------------------------------------------------------
    139 ; END
    140 ----------------------------------------------------------------------------*/
    141 
    142 #endif
    143