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
31 Pathname: ./audio/gsm-amr/c/src/BytesUsed.c
32
33------------------------------------------------------------------------------
34 REVISION HISTORY
35
36 Description: Corrected entries for all SID frames and updated function
37              description. Updated copyright year.
38
39 Description: Added #ifdef __cplusplus and removed "extern" from table
40              definition. Removed corresponding header file from Include
41              section.
42
43 Description: Put "extern" back.
44
45 Who:                       Date:
46 Description:
47
48------------------------------------------------------------------------------
49 INPUT AND OUTPUT DEFINITIONS
50
51 Inputs:
52    None
53
54 Local Stores/Buffers/Pointers Needed:
55    None
56
57 Global Stores/Buffers/Pointers Needed:
58    None
59
60 Outputs:
61    None
62
63 Pointers and Buffers Modified:
64    None
65
66 Local Stores Modified:
67    None
68
69 Global Stores Modified:
70    None
71
72------------------------------------------------------------------------------
73 FUNCTION DESCRIPTION
74
75 This function creates a table called BytesUsed that holds the value that
76 describes the number of bytes required to hold one frame worth of data in
77 the WMF (non-IF2) frame format. Each table entry is the sum of the frame
78 type byte and the number of bytes used up by the core speech data for each
79 3GPP frame type.
80
81------------------------------------------------------------------------------
82 REQUIREMENTS
83
84 None
85
86------------------------------------------------------------------------------
87 REFERENCES
88
89 [1] "AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0
90     Release 4, June 2001, page 13.
91
92------------------------------------------------------------------------------
93 PSEUDO-CODE
94
95
96------------------------------------------------------------------------------
97 RESOURCES USED
98   When the code is written for a specific target processor the
99     the resources used should be documented below.
100
101 STACK USAGE: [stack count for this module] + [variable to represent
102          stack usage for each subroutine called]
103
104     where: [stack usage variable] = stack usage for [subroutine
105         name] (see [filename].ext)
106
107 DATA MEMORY USED: x words
108
109 PROGRAM MEMORY USED: x words
110
111 CLOCK CYCLES: [cycle count equation for this module] + [variable
112           used to represent cycle count for each subroutine
113           called]
114
115     where: [cycle count variable] = cycle count for [subroutine
116        name] (see [filename].ext)
117
118------------------------------------------------------------------------------
119*/
120
121
122/*----------------------------------------------------------------------------
123; INCLUDES
124----------------------------------------------------------------------------*/
125#include "typedef.h"
126
127/*--------------------------------------------------------------------------*/
128#ifdef __cplusplus
129extern "C"
130{
131#endif
132
133    /*----------------------------------------------------------------------------
134    ; MACROS
135    ; Define module specific macros here
136    ----------------------------------------------------------------------------*/
137
138
139    /*----------------------------------------------------------------------------
140    ; DEFINES
141    ; Include all pre-processor statements here. Include conditional
142    ; compile variables also.
143    ----------------------------------------------------------------------------*/
144
145    /*----------------------------------------------------------------------------
146    ; LOCAL FUNCTION DEFINITIONS
147    ; Function Prototype declaration
148    ----------------------------------------------------------------------------*/
149
150
151    /*----------------------------------------------------------------------------
152    ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
153    ; Variable declaration - defined here and used outside this module
154    ----------------------------------------------------------------------------*/
155    const short BytesUsed[16] =
156    {
157        13, /* 4.75 */
158        14, /* 5.15 */
159        16, /* 5.90 */
160        18, /* 6.70 */
161        20, /* 7.40 */
162        21, /* 7.95 */
163        27, /* 10.2 */
164        32, /* 12.2 */
165        6, /* GsmAmr comfort noise */
166        7, /* Gsm-Efr comfort noise */
167        6, /* IS-641 comfort noise */
168        6, /* Pdc-Efr comfort noise */
169        0, /* future use */
170        0, /* future use */
171        0, /* future use */
172        1 /* No transmission */
173    };
174    /*----------------------------------------------------------------------------
175    ; EXTERNAL FUNCTION REFERENCES
176    ; Declare functions defined elsewhere and referenced in this module
177    ----------------------------------------------------------------------------*/
178
179
180    /*----------------------------------------------------------------------------
181    ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
182    ; Declare variables used in this module but defined elsewhere
183    ----------------------------------------------------------------------------*/
184
185
186    /*--------------------------------------------------------------------------*/
187#ifdef __cplusplus
188}
189#endif
190
191/*----------------------------------------------------------------------------
192; FUNCTION CODE
193----------------------------------------------------------------------------*/
194
195/*----------------------------------------------------------------------------
196; Define all local variables
197----------------------------------------------------------------------------*/
198
199
200/*----------------------------------------------------------------------------
201; Function body here
202----------------------------------------------------------------------------*/
203
204
205/*----------------------------------------------------------------------------
206; Return nothing or data or data pointer
207----------------------------------------------------------------------------*/
208
209