| 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_decode.c - The ITU G.722 codec, decode part. | 4 * g722_decode.c - The ITU G.722 codec, decode 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 * Despite my general liking of the GPL, I place my own contributions | 10 * Despite my general liking of the GPL, I place my own contributions |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 /*- End of function --------------------------------------------------------*/ | 182 /*- End of function --------------------------------------------------------*/ |
| 183 | 183 |
| 184 int WebRtc_g722_decode_release(G722DecoderState *s) | 184 int WebRtc_g722_decode_release(G722DecoderState *s) |
| 185 { | 185 { |
| 186 free(s); | 186 free(s); |
| 187 return 0; | 187 return 0; |
| 188 } | 188 } |
| 189 /*- End of function --------------------------------------------------------*/ | 189 /*- End of function --------------------------------------------------------*/ |
| 190 | 190 |
| 191 int WebRtc_g722_decode(G722DecoderState *s, int16_t amp[], | 191 size_t WebRtc_g722_decode(G722DecoderState *s, int16_t amp[], |
| 192 const uint8_t g722_data[], int len) | 192 const uint8_t g722_data[], size_t len) |
| 193 { | 193 { |
| 194 static const int wl[8] = {-60, -30, 58, 172, 334, 538, 1198, 3042 }; | 194 static const int wl[8] = {-60, -30, 58, 172, 334, 538, 1198, 3042 }; |
| 195 static const int rl42[16] = {0, 7, 6, 5, 4, 3, 2, 1, | 195 static const int rl42[16] = {0, 7, 6, 5, 4, 3, 2, 1, |
| 196 7, 6, 5, 4, 3, 2, 1, 0 }; | 196 7, 6, 5, 4, 3, 2, 1, 0 }; |
| 197 static const int ilb[32] = | 197 static const int ilb[32] = |
| 198 { | 198 { |
| 199 2048, 2093, 2139, 2186, 2233, 2282, 2332, | 199 2048, 2093, 2139, 2186, 2233, 2282, 2332, |
| 200 2383, 2435, 2489, 2543, 2599, 2656, 2714, | 200 2383, 2435, 2489, 2543, 2599, 2656, 2714, |
| 201 2774, 2834, 2896, 2960, 3025, 3091, 3158, | 201 2774, 2834, 2896, 2960, 3025, 3091, 3158, |
| 202 3228, 3298, 3371, 3444, 3520, 3597, 3676, | 202 3228, 3298, 3371, 3444, 3520, 3597, 3676, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 int rlow; | 251 int rlow; |
| 252 int ihigh; | 252 int ihigh; |
| 253 int dhigh; | 253 int dhigh; |
| 254 int rhigh; | 254 int rhigh; |
| 255 int xout1; | 255 int xout1; |
| 256 int xout2; | 256 int xout2; |
| 257 int wd1; | 257 int wd1; |
| 258 int wd2; | 258 int wd2; |
| 259 int wd3; | 259 int wd3; |
| 260 int code; | 260 int code; |
| 261 int outlen; | 261 size_t outlen; |
| 262 int i; | 262 int i; |
| 263 int j; | 263 size_t j; |
| 264 | 264 |
| 265 outlen = 0; | 265 outlen = 0; |
| 266 rhigh = 0; | 266 rhigh = 0; |
| 267 for (j = 0; j < len; ) | 267 for (j = 0; j < len; ) |
| 268 { | 268 { |
| 269 if (s->packed) | 269 if (s->packed) |
| 270 { | 270 { |
| 271 /* Unpack the code bits */ | 271 /* Unpack the code bits */ |
| 272 if (s->in_bits < s->bits_per_sample) | 272 if (s->in_bits < s->bits_per_sample) |
| 273 { | 273 { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 /* WebRtc, tlegrand: added saturation */ | 399 /* WebRtc, tlegrand: added saturation */ |
| 400 amp[outlen++] = saturate(xout1 >> 11); | 400 amp[outlen++] = saturate(xout1 >> 11); |
| 401 amp[outlen++] = saturate(xout2 >> 11); | 401 amp[outlen++] = saturate(xout2 >> 11); |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 return outlen; | 405 return outlen; |
| 406 } | 406 } |
| 407 /*- End of function --------------------------------------------------------*/ | 407 /*- End of function --------------------------------------------------------*/ |
| 408 /*- End of file ------------------------------------------------------------*/ | 408 /*- End of file ------------------------------------------------------------*/ |
| OLD | NEW |