OLD | NEW |
1 /* | 1 /* |
2 * SpanDSP - a series of DSP components for telephony | 2 * SpanDSP - a series of DSP components for telephony |
3 * | 3 * |
4 * g722_encode.c - The ITU G.722 codec, encode part. | 4 * g722_encode.c - The ITU G.722 codec, encode part. |
5 * | 5 * |
6 * Written by Steve Underwood <steveu@coppice.org> | 6 * Written by Steve Underwood <steveu@coppice.org> |
7 * | 7 * |
8 * Copyright (C) 2005 Steve Underwood | 8 * Copyright (C) 2005 Steve Underwood |
9 * | 9 * |
10 * All rights reserved. | 10 * All rights reserved. |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 { | 195 { |
196 | 196 |
197 int16_t yl; | 197 int16_t yl; |
198 | 198 |
199 yl = (rl > 16383) ? 16383 : ((rl < -16384) ? -16384 : rl); | 199 yl = (rl > 16383) ? 16383 : ((rl < -16384) ? -16384 : rl); |
200 | 200 |
201 return (yl); | 201 return (yl); |
202 } | 202 } |
203 #endif | 203 #endif |
204 | 204 |
205 int WebRtc_g722_encode(G722EncoderState *s, uint8_t g722_data[], | 205 size_t WebRtc_g722_encode(G722EncoderState *s, uint8_t g722_data[], |
206 const int16_t amp[], int len) | 206 const int16_t amp[], size_t len) |
207 { | 207 { |
208 static const int q6[32] = | 208 static const int q6[32] = |
209 { | 209 { |
210 0, 35, 72, 110, 150, 190, 233, 276, | 210 0, 35, 72, 110, 150, 190, 233, 276, |
211 323, 370, 422, 473, 530, 587, 650, 714, | 211 323, 370, 422, 473, 530, 587, 650, 714, |
212 786, 858, 940, 1023, 1121, 1219, 1339, 1458, | 212 786, 858, 940, 1023, 1121, 1219, 1339, 1458, |
213 1612, 1765, 1980, 2195, 2557, 2919, 0, 0 | 213 1612, 1765, 1980, 2195, 2557, 2919, 0, 0 |
214 }; | 214 }; |
215 static const int iln[32] = | 215 static const int iln[32] = |
216 { | 216 { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 int wd; | 268 int wd; |
269 int wd1; | 269 int wd1; |
270 int ril; | 270 int ril; |
271 int wd2; | 271 int wd2; |
272 int il4; | 272 int il4; |
273 int ih2; | 273 int ih2; |
274 int wd3; | 274 int wd3; |
275 int eh; | 275 int eh; |
276 int mih; | 276 int mih; |
277 int i; | 277 int i; |
278 int j; | 278 size_t j; |
279 /* Low and high band PCM from the QMF */ | 279 /* Low and high band PCM from the QMF */ |
280 int xlow; | 280 int xlow; |
281 int xhigh; | 281 int xhigh; |
282 int g722_bytes; | 282 size_t g722_bytes; |
283 /* Even and odd tap accumulators */ | 283 /* Even and odd tap accumulators */ |
284 int sumeven; | 284 int sumeven; |
285 int sumodd; | 285 int sumodd; |
286 int ihigh; | 286 int ihigh; |
287 int ilow; | 287 int ilow; |
288 int code; | 288 int code; |
289 | 289 |
290 g722_bytes = 0; | 290 g722_bytes = 0; |
291 xhigh = 0; | 291 xhigh = 0; |
292 for (j = 0; j < len; ) | 292 for (j = 0; j < len; ) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 } | 425 } |
426 else | 426 else |
427 { | 427 { |
428 g722_data[g722_bytes++] = (uint8_t) code; | 428 g722_data[g722_bytes++] = (uint8_t) code; |
429 } | 429 } |
430 } | 430 } |
431 return g722_bytes; | 431 return g722_bytes; |
432 } | 432 } |
433 /*- End of function --------------------------------------------------------*/ | 433 /*- End of function --------------------------------------------------------*/ |
434 /*- End of file ------------------------------------------------------------*/ | 434 /*- End of file ------------------------------------------------------------*/ |
OLD | NEW |