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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 /* Block 4, RECONS */ | 70 /* Block 4, RECONS */ |
71 s->band[band].d[0] = d; | 71 s->band[band].d[0] = d; |
72 s->band[band].r[0] = saturate(s->band[band].s + d); | 72 s->band[band].r[0] = saturate(s->band[band].s + d); |
73 | 73 |
74 /* Block 4, PARREC */ | 74 /* Block 4, PARREC */ |
75 s->band[band].p[0] = saturate(s->band[band].sz + d); | 75 s->band[band].p[0] = saturate(s->band[band].sz + d); |
76 | 76 |
77 /* Block 4, UPPOL2 */ | 77 /* Block 4, UPPOL2 */ |
78 for (i = 0; i < 3; i++) | 78 for (i = 0; i < 3; i++) |
79 s->band[band].sg[i] = s->band[band].p[i] >> 15; | 79 s->band[band].sg[i] = s->band[band].p[i] >> 15; |
80 wd1 = saturate(s->band[band].a[1] << 2); | 80 wd1 = saturate(s->band[band].a[1] * 4); |
81 | 81 |
82 wd2 = (s->band[band].sg[0] == s->band[band].sg[1]) ? -wd1 : wd1; | 82 wd2 = (s->band[band].sg[0] == s->band[band].sg[1]) ? -wd1 : wd1; |
83 if (wd2 > 32767) | 83 if (wd2 > 32767) |
84 wd2 = 32767; | 84 wd2 = 32767; |
85 wd3 = (s->band[band].sg[0] == s->band[band].sg[2]) ? 128 : -128; | 85 wd3 = (s->band[band].sg[0] == s->band[band].sg[2]) ? 128 : -128; |
86 wd3 += (wd2 >> 7); | 86 wd3 += (wd2 >> 7); |
87 wd3 += (s->band[band].a[2]*32512) >> 15; | 87 wd3 += (s->band[band].a[2]*32512) >> 15; |
88 if (wd3 > 12288) | 88 if (wd3 > 12288) |
89 wd3 = 12288; | 89 wd3 = 12288; |
90 else if (wd3 < -12288) | 90 else if (wd3 < -12288) |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 /* WebRtc, tlegrand: added saturation */ | 391 /* WebRtc, tlegrand: added saturation */ |
392 amp[outlen++] = saturate(xout1 >> 11); | 392 amp[outlen++] = saturate(xout1 >> 11); |
393 amp[outlen++] = saturate(xout2 >> 11); | 393 amp[outlen++] = saturate(xout2 >> 11); |
394 } | 394 } |
395 } | 395 } |
396 } | 396 } |
397 return outlen; | 397 return outlen; |
398 } | 398 } |
399 /*- End of function --------------------------------------------------------*/ | 399 /*- End of function --------------------------------------------------------*/ |
400 /*- End of file ------------------------------------------------------------*/ | 400 /*- End of file ------------------------------------------------------------*/ |
OLD | NEW |