cnst.h revision 4f1efc098cb5791c3e9f483f2af84aef70d2d0a0
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/****************************************************************************************
19Portions of this file are derived from the following 3GPP standard:
20
21    3GPP TS 26.073
22    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
23    Available from http://www.3gpp.org
24
25(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
26Permission to distribute, modify and use this file under the standard license
27terms listed above has been obtained from the copyright holder.
28****************************************************************************************/
29/*
30 INCLUDE DESCRIPTION
31
32 This file contains the Speech code (encoder, decoder, and postfilter)
33 constant parameters.
34
35 NOTE: This file must be synchronized with /gsm-amr/asm/include/cnst.inc file.
36
37------------------------------------------------------------------------------
38*/
39
40/*----------------------------------------------------------------------------
41; CONTINUE ONLY IF NOT ALREADY DEFINED
42----------------------------------------------------------------------------*/
43#ifndef _CNST_H_
44#define _CNST_H_
45
46/*----------------------------------------------------------------------------
47; INCLUDES
48----------------------------------------------------------------------------*/
49
50/*--------------------------------------------------------------------------*/
51#ifdef __cplusplus
52extern "C"
53{
54#endif
55
56    /*----------------------------------------------------------------------------
57    ; MACROS
58    ; Define module specific macros here
59    ----------------------------------------------------------------------------*/
60
61    /*----------------------------------------------------------------------------
62    ; DEFINES
63    ; Include all pre-processor statements here.
64    ----------------------------------------------------------------------------*/
65#define L_TOTAL      320       /* Total size of speech buffer.             */
66#define L_WINDOW     240       /* Window size in LP analysis               */
67#define L_FRAME      160       /* Frame size                               */
68#define L_FRAME_BY2  80        /* Frame size divided by 2                  */
69#define L_SUBFR      40        /* Subframe size                            */
70#define L_CODE       40        /* codevector length                        */
71#define NB_TRACK     5         /* number of tracks                         */
72#define STEP         5         /* codebook step size                       */
73#define NB_TRACK_MR102  4      /* number of tracks mode mr102              */
74#define STEP_MR102      4      /* codebook step size mode mr102            */
75#define M            10        /* Order of LP filter                       */
76#define MP1          (M+1)     /* Order of LP filter + 1                   */
77#define LSF_GAP      205       /* Minimum distance between LSF after quan- */
78    /* tization; 50 Hz = 205                    */
79#define LSP_PRED_FAC_MR122 21299 /* MR122 LSP prediction factor (0.65 Q15) */
80#define AZ_SIZE       (4*M+4)  /* Size of array of LP filters in 4 subfr.s */
81#define PIT_MIN_MR122 18       /* Minimum pitch lag (MR122 mode)           */
82#define PIT_MIN       20       /* Minimum pitch lag (all other modes)      */
83#define PIT_MAX       143      /* Maximum pitch lag                        */
84#define L_INTERPOL    (10+1)   /* Length of filter for interpolation       */
85#define L_INTER_SRCH  4        /* Length of filter for CL LTP search       */
86    /* interpolation                            */
87
88#define MU       26214         /* Factor for tilt compensation filter 0.8  */
89#define AGC_FAC  29491         /* Factor for automatic gain control 0.9    */
90
91#define L_NEXT       40        /* Overhead in LP analysis                  */
92#define SHARPMAX  13017        /* Maximum value of pitch sharpening        */
93#define SHARPMIN  0            /* Minimum value of pitch sharpening        */
94
95
96#define MAX_PRM_SIZE    57     /* max. num. of params                      */
97#define MAX_SERIAL_SIZE 244    /* max. num. of serial bits                 */
98
99#define GP_CLIP   15565        /* Pitch gain clipping = 0.95               */
100#define N_FRAME   7            /* old pitch gains in average calculation   */
101
102#define EHF_MASK 0x0008        /* encoder homing frame pattern             */
103
104    /*----------------------------------------------------------------------------
105    ; EXTERNAL VARIABLES REFERENCES
106    ; Declare variables used in this module but defined elsewhere
107    ----------------------------------------------------------------------------*/
108
109    /*----------------------------------------------------------------------------
110    ; SIMPLE TYPEDEF'S
111    ----------------------------------------------------------------------------*/
112
113    /*----------------------------------------------------------------------------
114    ; ENUMERATED TYPEDEF'S
115    ----------------------------------------------------------------------------*/
116
117    /*----------------------------------------------------------------------------
118    ; STRUCTURES TYPEDEF'S
119    ----------------------------------------------------------------------------*/
120
121    /*----------------------------------------------------------------------------
122    ; GLOBAL FUNCTION DEFINITIONS
123    ; Function Prototype declaration
124    ----------------------------------------------------------------------------*/
125#ifdef __cplusplus
126}
127#endif
128
129#endif  /* _CNST_H_ */
130