Initialize Tizen 2.3
[external/opencore-amr.git] / opencore / codecs_v2 / audio / gsm_amr / amr_nb / enc / src / gsmamr_enc.h
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.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)
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
33
34  Filename: gsmamr_enc.h
35
36 ------------------------------------------------------------------------------
37  INCLUDE DESCRIPTION
38
39  This header contains all the necessary information needed to use the
40  GSM AMR encoder library.
41
42 ------------------------------------------------------------------------------
43 */
44 #ifndef _GSMAMR_ENC_H_
45 #define _GSMAMR_ENC_H_
46
47 /*----------------------------------------------------------------------------
48 ; INCLUDES
49 ----------------------------------------------------------------------------*/
50
51 #include "gsm_amr_typedefs.h"
52
53 /*--------------------------------------------------------------------------*/
54 #ifdef __cplusplus
55 extern "C"
56 {
57 #endif
58
59     /*----------------------------------------------------------------------------
60     ; MACROS
61     ----------------------------------------------------------------------------*/
62
63
64     /*----------------------------------------------------------------------------
65     ; DEFINES
66     ----------------------------------------------------------------------------*/
67     /* Number of 13-bit linear PCM samples per 20 ms frame */
68     /* L_FRAME = (8 kHz) * (20 msec) = 160 samples         */
69 #define L_FRAME     160
70
71     /* Output format types */
72 #define AMR_TX_WMF  0
73 #define AMR_TX_IF2  1
74 #define AMR_TX_ETS  2
75 #define AMR_TX_IETF 3
76
77     /*----------------------------------------------------------------------------
78     ; EXTERNAL VARIABLES REFERENCES
79     ----------------------------------------------------------------------------*/
80
81
82     /*----------------------------------------------------------------------------
83     ; SIMPLE TYPEDEF'S
84     ----------------------------------------------------------------------------*/
85
86     /*----------------------------------------------------------------------------
87     ; ENUMERATED TYPEDEF'S
88     ----------------------------------------------------------------------------*/
89
90     enum Mode
91     {
92         MR475 = 0,/* 4.75 kbps */
93         MR515,    /* 5.15 kbps */
94         MR59,     /* 5.90 kbps */
95         MR67,     /* 6.70 kbps */
96         MR74,     /* 7.40 kbps */
97         MR795,    /* 7.95 kbps */
98         MR102,    /* 10.2 kbps */
99         MR122,    /* 12.2 kbps */
100         MRDTX,    /* DTX       */
101         N_MODES   /* Not Used  */
102     };
103
104     enum Frame_Type_3GPP
105     {
106         AMR_475 = 0,        /* 4.75 kbps    */
107         AMR_515,            /* 5.15 kbps    */
108         AMR_59,             /* 5.9 kbps     */
109         AMR_67,             /* 6.7 kbps     */
110         AMR_74,             /* 7.4 kbps     */
111         AMR_795,            /* 7.95 kbps    */
112         AMR_102,            /* 10.2 kbps    */
113         AMR_122,            /* 12.2 kbps    */
114         AMR_SID,            /* GSM AMR DTX  */
115         GSM_EFR_SID,        /* GSM EFR DTX  */
116         TDMA_EFR_SID,       /* TDMA EFR DTX */
117         PDC_EFR_SID,        /* PDC EFR DTX  */
118         FOR_FUTURE_USE1,    /* Unused 1     */
119         FOR_FUTURE_USE2,    /* Unused 2     */
120         FOR_FUTURE_USE3,    /* Unused 3     */
121         AMR_NO_DATA         /* No data      */
122     };
123
124     /*----------------------------------------------------------------------------
125     ; STRUCTURES TYPEDEF'S
126     ----------------------------------------------------------------------------*/
127     /*----------------------------------------------------------------------------
128     ; GLOBAL FUNCTION DEFINITIONS
129     ----------------------------------------------------------------------------*/
130     /* AMREncodeInit initializes the GSM AMR Encoder library by calling
131      * GSMInitEncode and sid_sync_init. If initialization was successful,
132      * init_status is set to zero, otherwise, it is set to -1.
133     */
134     int AMREncodeInit(
135         void **pEncStructure,
136         void **pSidSyncStructure,
137         Flag dtx_enable);
138
139     /* AMREncodeReset resets the state memory used by the Encoder and SID sync
140      * function. If reset was successful, reset_status is set to zero, otherwise,
141      * it is set to -1.
142     */
143     int AMREncodeReset(
144         void *pEncStructure,
145         void *pSidSyncStructure);
146
147     /* AMREncodeExit frees up the state memory used by the Encoder and SID
148      * synchronization function.
149     */
150     void AMREncodeExit(
151         void **pEncStructure,
152         void **pSidSyncStructure);
153
154     /*
155      * AMREncode is the entry point to the ETS Encoder library that encodes the raw
156      * data speech bits and converts the encoded bitstream into either an IF2-
157      * formatted bitstream, WMF-formatted bitstream, or ETS-formatted bitstream,
158      * depending on the the value of output_format. A zero is returned on success.
159      */
160     int AMREncode(
161         void *pEncState,
162         void *pSidSyncState,
163         enum Mode mode,
164         Word16 *pEncInput,
165         unsigned char *pEncOutput,
166         enum Frame_Type_3GPP *p3gpp_frame_type,
167         Word16 output_format
168     );
169
170 #ifdef __cplusplus
171 }
172 #endif
173
174
175 #endif  /* _GSMAMR_DEC_H_ */
176