annotate qcelpdata.h @ 11560:8a4984c5cacc libavcodec

Define AVMediaType enum, and use it instead of enum CodecType, which is deprecated and will be dropped at the next major bump.
author stefano
date Tue, 30 Mar 2010 23:30:55 +0000
parents 3c98f3e1b719
children 7dd2a45249a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8081
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
1 /*
8147
3b9eefe120e6 Please keep original copyright heading and attribution lines...
reynaldo
parents: 8145
diff changeset
2 * QCELP decoder
8081
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
3 * Copyright (c) 2007 Reynaldo H. Verdejo Pinochet
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
4 *
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
5 * This file is part of FFmpeg.
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
6 *
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
11 *
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
15 * Lesser General Public License for more details.
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
16 *
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
20 */
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
21
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
22 #ifndef AVCODEC_QCELPDATA_H
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
23 #define AVCODEC_QCELPDATA_H
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
24
8147
3b9eefe120e6 Please keep original copyright heading and attribution lines...
reynaldo
parents: 8145
diff changeset
25 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 8258
diff changeset
26 * @file libavcodec/qcelpdata.h
8149
415b7d14ff75 Change to file description suggested by Michael
reynaldo
parents: 8147
diff changeset
27 * Data tables for the QCELP decoder
8147
3b9eefe120e6 Please keep original copyright heading and attribution lines...
reynaldo
parents: 8145
diff changeset
28 * @author Reynaldo H. Verdejo Pinochet
8151
e2c068cb210a Credit Kenan Gillet for his contributions towards merging the SoC QCELP decoder.
reynaldo
parents: 8149
diff changeset
29 * @remark FFmpeg merging spearheaded by Kenan Gillet
8258
b41482ad0ef5 COSMETICS, add missing remarks crediting Ben and Kenan
reynaldo
parents: 8237
diff changeset
30 * @remark Development mentored by Benjamin Larson
8147
3b9eefe120e6 Please keep original copyright heading and attribution lines...
reynaldo
parents: 8145
diff changeset
31 */
3b9eefe120e6 Please keep original copyright heading and attribution lines...
reynaldo
parents: 8145
diff changeset
32
8212
c245082d70f8 Add missing headers to get 'make checkheaders' closer to passing.
diego
parents: 8191
diff changeset
33 #include <stddef.h>
8081
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
34 #include <stdint.h>
8212
c245082d70f8 Add missing headers to get 'make checkheaders' closer to passing.
diego
parents: 8191
diff changeset
35 #include "libavutil/common.h"
8081
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
36
8089
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
37 /**
8230
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
38 * QCELP unpacked data frame
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
39 */
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
40 typedef struct {
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
41 /// @defgroup qcelp_codebook_parameters QCELP excitation codebook parameters
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
42 /// @{
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
43 uint8_t cbsign[16]; ///!< sign of the codebook gain for each codebook subframe
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
44 uint8_t cbgain[16]; ///!< unsigned codebook gain for each codebook subframe
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
45 uint8_t cindex[16]; ///!< codebook index for each codebook subframe
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
46 /// @}
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
47
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
48 /// @defgroup qcelp_pitch_parameters QCELP pitch prediction parameters
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
49 /// @{
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
50 uint8_t plag[4]; ///!< pitch lag for each pitch subframe
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
51 uint8_t pfrac[4]; ///!< fractional pitch lag for each pitch subframe
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
52 uint8_t pgain[4]; ///!< pitch gain for each pitch subframe
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
53 /// @}
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
54
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
55 /**
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
56 * line spectral pair frequencies (LSP) for RATE_OCTAVE,
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
57 * line spectral pair frequencies grouped into five vectors
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
58 * of dimension two (LSPV) for other rates
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
59 */
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
60 uint8_t lspv[10];
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
61
8236
cdfd318f2cfb More OKed parts of the QCELP decoder
vitor
parents: 8230
diff changeset
62 /**
cdfd318f2cfb More OKed parts of the QCELP decoder
vitor
parents: 8230
diff changeset
63 * reserved bits only present in bitrate 1, 1/4 and 1/8 packets
cdfd318f2cfb More OKed parts of the QCELP decoder
vitor
parents: 8230
diff changeset
64 */
cdfd318f2cfb More OKed parts of the QCELP decoder
vitor
parents: 8230
diff changeset
65 uint8_t reserved;
8230
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
66 } QCELPFrame;
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
67
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
68 /**
8089
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
69 * pre-calculated table for hammsinc function
8092
5b379dd32155 cosmetics: small spelling fixes
diego
parents: 8089
diff changeset
70 * Only half of the table is needed because of symmetry.
8089
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
71 *
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
72 * TIA/EIA/IS-733 2.4.5.2-2/3
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
73 */
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
74 static const float qcelp_hammsinc_table[4] = { -0.006822, 0.041249, -0.143459, 0.588863};
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
75
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
76 typedef struct {
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
77 uint8_t index; /*!< index into the QCELPContext structure */
8092
5b379dd32155 cosmetics: small spelling fixes
diego
parents: 8089
diff changeset
78 uint8_t bitpos; /*!< position of the lowest bit in the value's byte */
8089
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
79 uint8_t bitlen; /*!< number of bits to read */
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
80 } QCELPBitmap;
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
81
8230
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
82 #define QCELP_OF(variable, bit, len) {offsetof(QCELPFrame, variable), bit, len}
8089
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
83
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
84 /**
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
85 * bitmap unpacking tables for RATE_FULL
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
86 *
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
87 * TIA/EIA/IS-733 Table 2.4.7.1-1
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
88 */
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
89 static const QCELPBitmap qcelp_rate_full_bitmap[] = {
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
90 // start on bit
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
91 QCELP_OF(lspv [ 2], 0, 3), // 265
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
92 QCELP_OF(lspv [ 1], 0, 7), // 262
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
93 QCELP_OF(lspv [ 0], 0, 6), // 255
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
94 QCELP_OF(lspv [ 4], 0, 6), // 249
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
95 QCELP_OF(lspv [ 3], 0, 6), // 243
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
96 QCELP_OF(lspv [ 2], 3, 4), // 237
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
97 QCELP_OF(cbsign[ 0], 0, 1), // 233
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
98 QCELP_OF(cbgain[ 0], 0, 4), // 232
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
99 QCELP_OF(pfrac [ 0], 0, 1), // 228
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
100 QCELP_OF(plag [ 0], 0, 7), // 227
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
101 QCELP_OF(pgain [ 0], 0, 3), // 220
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
102 QCELP_OF(cindex[ 1], 0, 4), // 217
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
103 QCELP_OF(cbsign[ 1], 0, 1), // 213
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
104 QCELP_OF(cbgain[ 1], 0, 4), // 212
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
105 QCELP_OF(cindex[ 0], 0, 7), // 208
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
106 QCELP_OF(cbgain[ 3], 0, 1), // 201
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
107 QCELP_OF(cindex[ 2], 0, 7), // 200
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
108 QCELP_OF(cbsign[ 2], 0, 1), // 193
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
109 QCELP_OF(cbgain[ 2], 0, 4), // 192
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
110 QCELP_OF(cindex[ 1], 4, 3), // 188
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
111 QCELP_OF(plag [ 1], 0, 3), // 185
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
112 QCELP_OF(pgain [ 1], 0, 3), // 182
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
113 QCELP_OF(cindex[ 3], 0, 7), // 179
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
114 QCELP_OF(cbsign[ 3], 0, 1), // 172
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
115 QCELP_OF(cbgain[ 3], 1, 2), // 171
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
116 QCELP_OF(cindex[ 4], 0, 6), // 169
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
117 QCELP_OF(cbsign[ 4], 0, 1), // 163
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
118 QCELP_OF(cbgain[ 4], 0, 4), // 162
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
119 QCELP_OF(pfrac [ 1], 0, 1), // 158
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
120 QCELP_OF(plag [ 1], 3, 4), // 157
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
121 QCELP_OF(cbgain[ 6], 0, 3), // 153
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
122 QCELP_OF(cindex[ 5], 0, 7), // 150
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
123 QCELP_OF(cbsign[ 5], 0, 1), // 143
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
124 QCELP_OF(cbgain[ 5], 0, 4), // 142
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
125 QCELP_OF(cindex[ 4], 6, 1), // 138
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
126 QCELP_OF(cindex[ 7], 0, 3), // 137
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
127 QCELP_OF(cbsign[ 7], 0, 1), // 134
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
128 QCELP_OF(cbgain[ 7], 0, 3), // 133
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
129 QCELP_OF(cindex[ 6], 0, 7), // 130
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
130 QCELP_OF(cbsign[ 6], 0, 1), // 123
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
131 QCELP_OF(cbgain[ 6], 3, 1), // 122
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
132 QCELP_OF(cbgain[ 8], 0, 1), // 121
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
133 QCELP_OF(pfrac [ 2], 0, 1), // 120
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
134 QCELP_OF(plag [ 2], 0, 7), // 119
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
135 QCELP_OF(pgain [ 2], 0, 3), // 112
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
136 QCELP_OF(cindex[ 7], 3, 4), // 109
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
137 QCELP_OF(cbsign[ 9], 0, 1), // 105
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
138 QCELP_OF(cbgain[ 9], 0, 4), // 104
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
139 QCELP_OF(cindex[ 8], 0, 7), // 100
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
140 QCELP_OF(cbsign[ 8], 0, 1), // 93
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
141 QCELP_OF(cbgain[ 8], 1, 3), // 92
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
142 QCELP_OF(cindex[10], 0, 4), // 89
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
143 QCELP_OF(cbsign[10], 0, 1), // 85
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
144 QCELP_OF(cbgain[10], 0, 4), // 84
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
145 QCELP_OF(cindex[ 9], 0, 7), // 80
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
146 QCELP_OF(pgain [ 3], 0, 2), // 73
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
147 QCELP_OF(cindex[11], 0, 7), // 71
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
148 QCELP_OF(cbsign[11], 0, 1), // 64
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
149 QCELP_OF(cbgain[11], 0, 3), // 63
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
150 QCELP_OF(cindex[10], 4, 3), // 60
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
151 QCELP_OF(cindex[12], 0, 2), // 57
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
152 QCELP_OF(cbsign[12], 0, 1), // 55
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
153 QCELP_OF(cbgain[12], 0, 4), // 54
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
154 QCELP_OF(pfrac [ 3], 0, 1), // 50
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
155 QCELP_OF(plag [ 3], 0, 7), // 49
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
156 QCELP_OF(pgain [ 3], 2, 1), // 42
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
157 QCELP_OF(cindex[13], 0, 6), // 41
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
158 QCELP_OF(cbsign[13], 0, 1), // 35
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
159 QCELP_OF(cbgain[13], 0, 4), // 34
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
160 QCELP_OF(cindex[12], 2, 5), // 30
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
161 QCELP_OF(cbgain[15], 0, 3), // 25
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
162 QCELP_OF(cindex[14], 0, 7), // 22
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
163 QCELP_OF(cbsign[14], 0, 1), // 15
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
164 QCELP_OF(cbgain[14], 0, 4), // 14
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
165 QCELP_OF(cindex[13], 6, 1), // 10
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
166 QCELP_OF(reserved, 0, 2), // 9
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
167 QCELP_OF(cindex[15], 0, 7), // 7
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
168 QCELP_OF(cbsign[15], 0, 1) // 0
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
169 };
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
170
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
171 /**
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
172 * bitmap unpacking tables for RATE_HALF
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
173 *
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
174 * TIA/EIA/IS-733 Table 2.4.7.2-1
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
175 */
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
176 static const QCELPBitmap qcelp_rate_half_bitmap[] = {
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
177 // start on bit
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
178 QCELP_OF(lspv [2], 0, 3), // 123
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
179 QCELP_OF(lspv [1], 0, 7), // 120
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
180 QCELP_OF(lspv [0], 0, 6), // 113
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
181 QCELP_OF(lspv [4], 0, 6), // 107
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
182 QCELP_OF(lspv [3], 0, 6), // 101
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
183 QCELP_OF(lspv [2], 3, 4), // 95
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
184 QCELP_OF(cbsign[0], 0, 1), // 91
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
185 QCELP_OF(cbgain[0], 0, 4), // 90
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
186 QCELP_OF(pfrac [0], 0, 1), // 86
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
187 QCELP_OF(plag [0], 0, 7), // 85
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
188 QCELP_OF(pgain [0], 0, 3), // 78
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
189 QCELP_OF(plag [1], 0, 6), // 75
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
190 QCELP_OF(pgain [1], 0, 3), // 69
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
191 QCELP_OF(cindex[0], 0, 7), // 66
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
192 QCELP_OF(pgain [2], 0, 2), // 59
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
193 QCELP_OF(cindex[1], 0, 7), // 57
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
194 QCELP_OF(cbsign[1], 0, 1), // 50
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
195 QCELP_OF(cbgain[1], 0, 4), // 49
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
196 QCELP_OF(pfrac [1], 0, 1), // 45
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
197 QCELP_OF(plag [1], 6, 1), // 44
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
198 QCELP_OF(cindex[2], 0, 2), // 43
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
199 QCELP_OF(cbsign[2], 0, 1), // 41
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
200 QCELP_OF(cbgain[2], 0, 4), // 40
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
201 QCELP_OF(pfrac [2], 0, 1), // 36
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
202 QCELP_OF(plag [2], 0, 7), // 35
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
203 QCELP_OF(pgain [2], 2, 1), // 28
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
204 QCELP_OF(pfrac [3], 0, 1), // 27
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
205 QCELP_OF(plag [3], 0, 7), // 26
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
206 QCELP_OF(pgain [3], 0, 3), // 19
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
207 QCELP_OF(cindex[2], 2, 5), // 16
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
208 QCELP_OF(cindex[3], 0, 7), // 11
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
209 QCELP_OF(cbsign[3], 0, 1), // 4
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
210 QCELP_OF(cbgain[3], 0, 4) // 3
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
211 };
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
212
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
213 /**
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
214 * bitmap unpacking tables for RATE_QUARTER
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
215 *
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
216 * TIA/EIA/IS-733 Table 2.4.7.3-1
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
217 */
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
218 static const QCELPBitmap qcelp_rate_quarter_bitmap[] = {
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
219 // start on bit
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
220 QCELP_OF(lspv [2], 0, 3), // 53
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
221 QCELP_OF(lspv [1], 0, 7), // 50
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
222 QCELP_OF(lspv [0], 0, 6), // 43
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
223 QCELP_OF(lspv [4], 0, 6), // 37
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
224 QCELP_OF(lspv [3], 0, 6), // 31
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
225 QCELP_OF(lspv [2], 3, 4), // 25
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
226 QCELP_OF(cbgain[3], 0, 4), // 21
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
227 QCELP_OF(cbgain[2], 0, 4), // 17
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
228 QCELP_OF(cbgain[1], 0, 4), // 13
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
229 QCELP_OF(cbgain[0], 0, 4), // 9
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
230 QCELP_OF(reserved, 0, 2), // 5
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
231 QCELP_OF(cbgain[4], 0, 4) // 3
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
232 };
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
233
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
234 /**
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
235 * bitmap unpacking tables for RATE_OCTAVE
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
236 *
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
237 * trick: CBSEED is written into QCELPContext.cbsign[15],
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
238 * which is not used for RATE_OCTAVE.
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
239 * CBSEED is only used to ensure the occurrence of random bit
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
240 * patterns in the 16 first bits that are used as the seed.
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
241 *
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
242 * TIA/EIA/IS-733 Table 2.4.7.4-1
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
243 */
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
244 static const QCELPBitmap qcelp_rate_octave_bitmap[] = {
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
245 // start on bit
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
246 QCELP_OF(cbsign[15], 3, 1), // 19
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
247 QCELP_OF(lspv [0], 0, 1), // 18
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
248 QCELP_OF(lspv [1], 0, 1), // 17
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
249 QCELP_OF(lspv [2], 0, 1), // 16
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
250 QCELP_OF(cbsign[15], 2, 1), // 15
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
251 QCELP_OF(lspv [3], 0, 1), // 14
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
252 QCELP_OF(lspv [4], 0, 1), // 13
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
253 QCELP_OF(lspv [5], 0, 1), // 12
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
254 QCELP_OF(cbsign[15], 1, 1), // 11
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
255 QCELP_OF(lspv [6], 0, 1), // 10
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
256 QCELP_OF(lspv [7], 0, 1), // 9
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
257 QCELP_OF(lspv [8], 0, 1), // 8
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
258 QCELP_OF(cbsign[15], 0, 1), // 7
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
259 QCELP_OF(lspv [9], 0, 1), // 6
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
260 QCELP_OF(cbgain [0], 0, 2), // 7
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
261 QCELP_OF(reserved, 0, 4) // 3
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
262 };
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
263
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
264 /**
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
265 * position of the bitmapping data for each packet type in
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
266 * the QCELPContext
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
267 */
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
268 static const QCELPBitmap * const qcelp_unpacking_bitmaps_per_rate[5] = {
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
269 NULL, ///!< for SILENCE rate
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
270 qcelp_rate_octave_bitmap,
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
271 qcelp_rate_quarter_bitmap,
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
272 qcelp_rate_half_bitmap,
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
273 qcelp_rate_full_bitmap,
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
274 };
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
275
8230
72949bacc1b9 More OKed parts of the QCELP decoder
vitor
parents: 8213
diff changeset
276 static const uint16_t qcelp_unpacking_bitmaps_lengths[5] = {
8089
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
277 0, ///!< for SILENCE rate
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
278 FF_ARRAY_ELEMS(qcelp_rate_octave_bitmap),
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
279 FF_ARRAY_ELEMS(qcelp_rate_quarter_bitmap),
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
280 FF_ARRAY_ELEMS(qcelp_rate_half_bitmap),
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
281 FF_ARRAY_ELEMS(qcelp_rate_full_bitmap),
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
282 };
103e41d62781 More OKed parts of QCELP data tables
vitor
parents: 8081
diff changeset
283
8081
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
284 typedef uint16_t qcelp_vector[2];
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
285
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
286 /**
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
287 * LSP vector quantization tables in x*10000 form
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
288 *
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
289 * TIA/EIA/IS-733 tables 2.4.3.2.6.3-1 through 2.4.3.2.6.3-5
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
290 */
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
291
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
292 static const qcelp_vector qcelp_lspvq1[64]= {
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
293 { 327, 118},{ 919, 111},{ 427, 440},{1327, 185},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
294 { 469, 50},{1272, 91},{ 892, 59},{1771, 193},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
295 { 222, 158},{1100, 127},{ 827, 55},{ 978, 791},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
296 { 665, 47},{ 700,1401},{ 670, 859},{1913,1048},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
297 { 471, 215},{1046, 125},{ 645, 298},{1599, 160},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
298 { 593, 39},{1187, 462},{ 749, 341},{1520, 511},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
299 { 290, 792},{ 909, 362},{ 753, 81},{1111,1058},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
300 { 519, 253},{ 828, 839},{ 685, 541},{1421,1258},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
301 { 386, 130},{ 962, 119},{ 542, 387},{1431, 185},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
302 { 526, 51},{1175, 260},{ 831, 167},{1728, 510},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
303 { 273, 437},{1172, 113},{ 771, 144},{1122, 751},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
304 { 619, 119},{ 492,1276},{ 658, 695},{1882, 615},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
305 { 415, 200},{1018, 88},{ 681, 339},{1436, 325},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
306 { 555, 122},{1042, 485},{ 826, 345},{1374, 743},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
307 { 383,1018},{1005, 358},{ 704, 86},{1301, 586},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
308 { 597, 241},{ 832, 621},{ 555, 573},{1504, 839}};
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
309
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
310 static const qcelp_vector qcelp_lspvq2[128]= {
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
311 { 255, 293},{ 904, 219},{ 151,1211},{1447, 498},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
312 { 470, 253},{1559, 177},{1547, 994},{2394, 242},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
313 { 91, 813},{ 857, 590},{ 934,1326},{1889, 282},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
314 { 813, 472},{1057,1494},{ 450,3315},{2163,1895},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
315 { 538, 532},{1399, 218},{ 146,1552},{1755, 626},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
316 { 822, 202},{1299, 663},{ 706,1732},{2656, 401},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
317 { 418, 745},{ 762,1038},{ 583,1748},{1746,1285},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
318 { 527,1169},{1314, 830},{ 556,2116},{1073,2321},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
319 { 297, 570},{ 981, 403},{ 468,1103},{1740, 243},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
320 { 725, 179},{1255, 474},{1374,1362},{1922, 912},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
321 { 285, 947},{ 930, 700},{ 593,1372},{1909, 576},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
322 { 588, 916},{1110,1116},{ 224,2719},{1633,2220},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
323 { 402, 520},{1061, 448},{ 402,1352},{1499, 775},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
324 { 664, 589},{1081, 727},{ 801,2206},{2165,1157},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
325 { 566, 802},{ 911,1116},{ 306,1703},{1792, 836},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
326 { 655, 999},{1061,1038},{ 298,2089},{1110,1753},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
327 { 361, 311},{ 970, 239},{ 265,1231},{1495, 573},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
328 { 566, 262},{1569, 293},{1341,1144},{2271, 544},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
329 { 214, 877},{ 847, 719},{ 794,1384},{2067, 274},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
330 { 703, 688},{1099,1306},{ 391,2947},{2024,1670},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
331 { 471, 525},{1245, 290},{ 264,1557},{1568, 807},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
332 { 718, 399},{1193, 685},{ 883,1594},{2729, 764},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
333 { 500, 754},{ 809,1108},{ 541,1648},{1523,1385},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
334 { 614,1196},{1209, 847},{ 345,2242},{1442,1747},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
335 { 199, 560},{1092, 194},{ 349,1253},{1653, 507},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
336 { 625, 354},{1376, 431},{1187,1465},{2164, 872},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
337 { 360, 974},{1008, 698},{ 704,1346},{2114, 452},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
338 { 720, 816},{1240,1089},{ 439,2475},{1498,2040},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
339 { 336, 718},{1213, 187},{ 451,1450},{1368, 885},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
340 { 592, 578},{1131, 531},{ 861,1855},{1764,1500},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
341 { 444, 970},{ 935, 903},{ 424,1687},{1633,1102},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
342 { 793, 897},{1060, 897},{ 185,2011},{1205,1855}};
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
343
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
344 static const qcelp_vector qcelp_lspvq3[128]= {
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
345 { 225, 283},{1296, 355},{ 543, 343},{2073, 274},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
346 { 204,1099},{1562, 523},{1388, 161},{2784, 274},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
347 { 112, 849},{1870, 175},{1189, 160},{1490,1088},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
348 { 969,1115},{ 659,3322},{1158,1073},{3183,1363},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
349 { 517, 223},{1740, 223},{ 704, 387},{2637, 234},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
350 { 692,1005},{1287,1610},{ 952, 532},{2393, 646},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
351 { 490, 552},{1619, 657},{ 845, 670},{1784,2280},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
352 { 191,1775},{ 272,2868},{ 942, 952},{2628,1479},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
353 { 278, 579},{1565, 218},{ 814, 180},{2379, 187},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
354 { 276,1444},{1199,1223},{1200, 349},{3009, 307},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
355 { 312, 844},{1898, 306},{ 863, 470},{1685,1241},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
356 { 513,1727},{ 711,2233},{1085, 864},{3398, 527},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
357 { 414, 440},{1356, 612},{ 964, 147},{2173, 738},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
358 { 465,1292},{ 877,1749},{1104, 689},{2105,1311},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
359 { 580, 864},{1895, 752},{ 652, 609},{1485,1699},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
360 { 514,1400},{ 386,2131},{ 933, 798},{2473, 986},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
361 { 334, 360},{1375, 398},{ 621, 276},{2183, 280},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
362 { 311,1114},{1382, 807},{1284, 175},{2605, 636},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
363 { 230, 816},{1739, 408},{1074, 176},{1619,1120},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
364 { 784,1371},{ 448,3050},{1189, 880},{3039,1165},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
365 { 424, 241},{1672, 186},{ 815, 333},{2432, 324},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
366 { 584,1029},{1137,1546},{1015, 585},{2198, 995},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
367 { 574, 581},{1746, 647},{ 733, 740},{1938,1737},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
368 { 347,1710},{ 373,2429},{ 787,1061},{2439,1438},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
369 { 185, 536},{1489, 178},{ 703, 216},{2178, 487},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
370 { 154,1421},{1414, 994},{1103, 352},{3072, 473},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
371 { 408, 819},{2055, 168},{ 998, 354},{1917,1140},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
372 { 665,1799},{ 993,2213},{1234, 631},{3003, 762},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
373 { 373, 620},{1518, 425},{ 913, 300},{1966, 836},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
374 { 402,1185},{ 948,1385},{1121, 555},{1802,1509},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
375 { 474, 886},{1888, 610},{ 739, 585},{1231,2379},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
376 { 661,1335},{ 205,2211},{ 823, 822},{2480,1179}};
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
377
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
378 static const qcelp_vector qcelp_lspvq4[64]= {
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
379 { 348, 311},{ 812,1145},{ 552, 461},{1826, 263},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
380 { 601, 675},{1730, 172},{1523, 193},{2449, 277},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
381 { 334, 668},{ 805,1441},{1319, 207},{1684, 910},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
382 { 582,1318},{1403,1098},{ 979, 832},{2700,1359},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
383 { 624, 228},{1292, 979},{ 800, 195},{2226, 285},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
384 { 730, 862},{1537, 601},{1115, 509},{2720, 354},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
385 { 218,1167},{1212,1538},{1074, 247},{1674,1710},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
386 { 322,2142},{1263, 777},{ 981, 556},{2119,1710},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
387 { 193, 596},{1035, 957},{ 694, 397},{1997, 253},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
388 { 743, 603},{1584, 321},{1346, 346},{2221, 708},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
389 { 451, 732},{1040,1415},{1184, 230},{1853, 919},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
390 { 310,1661},{1625, 706},{ 856, 843},{2902, 702},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
391 { 467, 348},{1108,1048},{ 859, 306},{1964, 463},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
392 { 560,1013},{1425, 533},{1142, 634},{2391, 879},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
393 { 397,1084},{1345,1700},{ 976, 248},{1887,1189},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
394 { 644,2087},{1262, 603},{ 877, 550},{2203,1307}};
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
395
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
396 static const qcelp_vector qcelp_lspvq5[64]= {
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
397 { 360, 222},{ 820,1097},{ 601, 319},{1656, 198},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
398 { 604, 513},{1552, 141},{1391, 155},{2474, 261},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
399 { 269, 785},{1463, 646},{1123, 191},{2015, 223},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
400 { 785, 844},{1202,1011},{ 980, 807},{3014, 793},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
401 { 570, 180},{1135,1382},{ 778, 256},{1901, 179},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
402 { 807, 622},{1461, 458},{1231, 178},{2028, 821},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
403 { 387, 927},{1496,1004},{ 888, 392},{2246, 341},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
404 { 295,1462},{1156, 694},{1022, 473},{2226,1364},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
405 { 210, 478},{1029,1020},{ 722, 181},{1730, 251},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
406 { 730, 488},{1465, 293},{1303, 326},{2595, 387},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
407 { 458, 584},{1569, 742},{1029, 173},{1910, 495},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
408 { 605,1159},{1268, 719},{ 973, 646},{2872, 428},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
409 { 443, 334},{ 835,1465},{ 912, 138},{1716, 442},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
410 { 620, 778},{1316, 450},{1186, 335},{1446,1665},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
411 { 486,1050},{1675,1019},{ 880, 278},{2214, 202},
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
412 { 539,1564},{1142, 533},{ 984, 391},{2130,1089}};
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
413
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
414 static const qcelp_vector * const qcelp_lspvq[5] = {
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
415 qcelp_lspvq1,
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
416 qcelp_lspvq2,
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
417 qcelp_lspvq3,
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
418 qcelp_lspvq4,
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
419 qcelp_lspvq5
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
420 };
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
421
8123
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
422 /**
8127
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
423 * the final gain scalefactor before clipping into a usable output float
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
424 */
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
425 #define QCELP_SCALE 8192.
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
426
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
427 /**
8191
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
428 * the upper boundary of the clipping, depends on QCELP_SCALE
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
429 */
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
430 #define QCELP_CLIP_UPPER_BOUND (8191.75/8192.)
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
431
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
432 /**
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
433 * the lower boundary of the clipping, depends on QCELP_SCALE
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
434 */
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
435 #define QCELP_CLIP_LOWER_BOUND -1.
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
436
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
437 /**
8127
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
438 * table for computing Ga (decoded linear codebook gain magnitude)
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
439 *
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
440 * @note The table could fit in int16_t in x*8 form, but it seems
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
441 * to be slower on x86
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
442 *
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
443 * TIA/EIA/IS-733 2.4.6.2.1-3
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
444 */
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
445
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
446 static const float qcelp_g12ga[61] = {
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
447 1.000/QCELP_SCALE, 1.125/QCELP_SCALE, 1.250/QCELP_SCALE, 1.375/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
448 1.625/QCELP_SCALE, 1.750/QCELP_SCALE, 2.000/QCELP_SCALE, 2.250/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
449 2.500/QCELP_SCALE, 2.875/QCELP_SCALE, 3.125/QCELP_SCALE, 3.500/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
450 4.000/QCELP_SCALE, 4.500/QCELP_SCALE, 5.000/QCELP_SCALE, 5.625/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
451 6.250/QCELP_SCALE, 7.125/QCELP_SCALE, 8.000/QCELP_SCALE, 8.875/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
452 10.000/QCELP_SCALE, 11.250/QCELP_SCALE, 12.625/QCELP_SCALE, 14.125/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
453 15.875/QCELP_SCALE, 17.750/QCELP_SCALE, 20.000/QCELP_SCALE, 22.375/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
454 25.125/QCELP_SCALE, 28.125/QCELP_SCALE, 31.625/QCELP_SCALE, 35.500/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
455 39.750/QCELP_SCALE, 44.625/QCELP_SCALE, 50.125/QCELP_SCALE, 56.250/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
456 63.125/QCELP_SCALE, 70.750/QCELP_SCALE, 79.375/QCELP_SCALE, 89.125/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
457 100.000/QCELP_SCALE, 112.250/QCELP_SCALE, 125.875/QCELP_SCALE, 141.250/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
458 158.500/QCELP_SCALE, 177.875/QCELP_SCALE, 199.500/QCELP_SCALE, 223.875/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
459 251.250/QCELP_SCALE, 281.875/QCELP_SCALE, 316.250/QCELP_SCALE, 354.875/QCELP_SCALE,
8182
ebf5202a8fdf Fix typo in table value.
vitor
parents: 8151
diff changeset
460 398.125/QCELP_SCALE, 446.625/QCELP_SCALE, 501.125/QCELP_SCALE, 562.375/QCELP_SCALE,
8127
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
461 631.000/QCELP_SCALE, 708.000/QCELP_SCALE, 794.375/QCELP_SCALE, 891.250/QCELP_SCALE,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
462 1000.000/QCELP_SCALE};
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
463
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
464 /**
8123
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
465 * circular codebook for rate 1 frames in x*100 form
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
466 *
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
467 * TIA/EIA/IS-733 2.4.6.1-2
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
468 */
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
469 static const int16_t qcelp_rate_full_codebook[128] = {
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
470 10, -65, -59, 12, 110, 34, -134, 157,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
471 104, -84, -34, -115, 23, -101, 3, 45,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
472 -101, -16, -59, 28, -45, 134, -67, 22,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
473 61, -29, 226, -26, -55, -179, 157, -51,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
474 -220, -93, -37, 60, 118, 74, -48, -95,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
475 -181, 111, 36, -52, -215, 78, -112, 39,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
476 -17, -47, -223, 19, 12, -98, -142, 130,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
477 54, -127, 21, -12, 39, -48, 12, 128,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
478 6, -167, 82, -102, -79, 55, -44, 48,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
479 -20, -53, 8, -61, 11, -70, -157, -168,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
480 20, -56, -74, 78, 33, -63, -173, -2,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
481 -75, -53, -146, 77, 66, -29, 9, -75,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
482 65, 119, -43, 76, 233, 98, 125, -156,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
483 -27, 78, -9, 170, 176, 143, -148, -7,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
484 27, -136, 5, 27, 18, 139, 204, 7,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
485 -184, -197, 52, -3, 78, -189, 8, -65
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
486 };
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
487 #define QCELP_RATE_FULL_CODEBOOK_RATIO .01
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
488
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
489 /**
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
490 * circular codebook for rate 1/2 frames in x*2 form
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
491 *
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
492 * TIA/EIA/IS-733 2.4.6.1-1
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
493 */
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
494 static const int8_t qcelp_rate_half_codebook[128] = {
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
495 0, -4, 0, -3, 0, 0, 0, 0,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
496 0, 0, 0, 0, 0, 0, 0, 0,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
497 0, -3, -2, 0, 0, 0, 0, 0,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
498 0, 0, 0, 0, 0, 0, 0, 5,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
499 0, 0, 0, 0, 0, 0, 4, 0,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
500 0, 3, 2, 0, 3, 4, 0, 0,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
501 0, 0, 0, 0, 0, 0, 0, 0,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
502 0, 0, 0, 0, 0, 3, 0, 0,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
503 -3, 3, 0, 0, -2, 0, 3, 0,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
504 0, 0, 0, 0, 0, 0, -5, 0,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
505 0, 0, 0, 3, 0, 0, 0, 3,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
506 0, 0, 0, 0, 0, 0, 0, 4,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
507 0, 0, 0, 0, 0, 0, 0, 0,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
508 0, 3, 6, -3, -4, 0, -3, -3,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
509 3, -3, 0, 0, 0, 0, 0, 0,
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
510 0, 0, 0, 0, 0, 0, 0, 0
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
511 };
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
512 #define QCELP_RATE_HALF_CODEBOOK_RATIO 0.5
cd756806be02 More OKed parts of the QCELP decoder
vitor
parents: 8092
diff changeset
513
8127
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
514 /**
8145
f27d01aff4af More OKed parts of the QCELP decoder
vitor
parents: 8127
diff changeset
515 * sqrt(1.887) is the maximum of the pseudorandom
f27d01aff4af More OKed parts of the QCELP decoder
vitor
parents: 8127
diff changeset
516 * white sequence used to generate the scaled codebook
8191
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
517 * vector for bitrate 1/4.
8145
f27d01aff4af More OKed parts of the QCELP decoder
vitor
parents: 8127
diff changeset
518 *
f27d01aff4af More OKed parts of the QCELP decoder
vitor
parents: 8127
diff changeset
519 * TIA/EIA/IS-733 2.4.8.1.2
f27d01aff4af More OKed parts of the QCELP decoder
vitor
parents: 8127
diff changeset
520 */
f27d01aff4af More OKed parts of the QCELP decoder
vitor
parents: 8127
diff changeset
521 #define QCELP_SQRT1887 1.373681186
f27d01aff4af More OKed parts of the QCELP decoder
vitor
parents: 8127
diff changeset
522
f27d01aff4af More OKed parts of the QCELP decoder
vitor
parents: 8127
diff changeset
523 /**
8127
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
524 * table for impulse response of BPF used to filter
8191
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
525 * the white excitation for bitrate 1/4 synthesis
8127
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
526 *
8190
e596efd84d27 Cosmetic: Fix typo
vitor
parents: 8182
diff changeset
527 * Only half the tables are needed because of symmetry.
8127
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
528 *
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
529 * TIA/EIA/IS-733 2.4.8.1.2-1.1
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
530 */
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
531 static const double qcelp_rnd_fir_coefs[11] = {
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
532 -1.344519e-1, 1.735384e-2, -6.905826e-2, 2.434368e-2,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
533 -8.210701e-2, 3.041388e-2, -9.251384e-2, 3.501983e-2,
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
534 -9.918777e-2, 3.749518e-2, 8.985137e-1
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
535 };
3b5256153553 More OKed parts of the QCELP decoder
vitor
parents: 8123
diff changeset
536
8191
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
537 /**
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
538 * This spread factor is used, for bitrate 1/8 and I_F_Q,
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
539 * to force the LSP frequencies to be at least 80 Hz apart.
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
540 *
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
541 * TIA/EIA/IS-733 2.4.3.3.2
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
542 */
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
543 #define QCELP_LSP_SPREAD_FACTOR 0.02
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
544
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
545 /**
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
546 * predictor coefficient for the conversion of LSP codes
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
547 * to LSP frequencies for 1/8 and I_F_Q
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
548 *
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
549 * TIA/EIA/IS-733 2.4.3.2.7-2
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
550 */
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
551 #define QCELP_LSP_OCTAVE_PREDICTOR 29.0/32
cc1e8c59f1e8 More OKed parts of the QCELP decoder
vitor
parents: 8190
diff changeset
552
9123
36a5caff8540 Part 2 of 2 of Kenan Gillet's 'make ff_qcelp_lspf2lpc
reynaldo
parents: 8718
diff changeset
553 /**
36a5caff8540 Part 2 of 2 of Kenan Gillet's 'make ff_qcelp_lspf2lpc
reynaldo
parents: 8718
diff changeset
554 * initial coefficient to perform bandwidth expansion on LPC
36a5caff8540 Part 2 of 2 of Kenan Gillet's 'make ff_qcelp_lspf2lpc
reynaldo
parents: 8718
diff changeset
555 *
36a5caff8540 Part 2 of 2 of Kenan Gillet's 'make ff_qcelp_lspf2lpc
reynaldo
parents: 8718
diff changeset
556 * @note: 0.9883 looks like an approximation of 253/256.
36a5caff8540 Part 2 of 2 of Kenan Gillet's 'make ff_qcelp_lspf2lpc
reynaldo
parents: 8718
diff changeset
557 *
36a5caff8540 Part 2 of 2 of Kenan Gillet's 'make ff_qcelp_lspf2lpc
reynaldo
parents: 8718
diff changeset
558 * TIA/EIA/IS-733 2.4.3.3.6 6
36a5caff8540 Part 2 of 2 of Kenan Gillet's 'make ff_qcelp_lspf2lpc
reynaldo
parents: 8718
diff changeset
559 */
9629
3c98f3e1b719 Fix bandwith vs. bandwiDth typo.
diego
parents: 9123
diff changeset
560 #define QCELP_BANDWIDTH_EXPANSION_COEFF 0.9883
9123
36a5caff8540 Part 2 of 2 of Kenan Gillet's 'make ff_qcelp_lspf2lpc
reynaldo
parents: 8718
diff changeset
561
8081
2ca605b9c37a OKed parts of QCELP data tables
diego
parents:
diff changeset
562 #endif /* AVCODEC_QCELPDATA_H */