comparison libgsmefr/pred_lt6.c @ 53:49dd1ac8e75b

libgsmefr: import most *.c files from ETSI source
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 25 Nov 2022 16:18:21 +0000
parents
children db8e0b69a6bb
comparison
equal deleted inserted replaced
52:988fd7ff514f 53:49dd1ac8e75b
1 /*************************************************************************
2 *
3 * FUNCTION: Pred_lt_6()
4 *
5 * PURPOSE: Compute the result of long term prediction with fractional
6 * interpolation of resolution 1/6. (Interpolated past excitation).
7 *
8 * DESCRIPTION:
9 * The past excitation signal at the given delay is interpolated at
10 * the given fraction to build the adaptive codebook excitation.
11 * On return exc[0..L_subfr-1] contains the interpolated signal
12 * (adaptive codebook excitation).
13 *
14 *************************************************************************/
15
16 #include "typedef.h"
17 #include "basic_op.h"
18 #include "count.h"
19
20 #define UP_SAMP 6
21 #define L_INTERPOL 10
22 #define FIR_SIZE (UP_SAMP*L_INTERPOL+1)
23
24 /* 1/6 resolution interpolation filter (-3 dB at 3600 Hz) */
25
26 static const Word16 inter_6[FIR_SIZE] =
27 {
28 29443,
29 28346, 25207, 20449, 14701, 8693, 3143,
30 -1352, -4402, -5865, -5850, -4673, -2783,
31 -672, 1211, 2536, 3130, 2991, 2259,
32 1170, 0, -1001, -1652, -1868, -1666,
33 -1147, -464, 218, 756, 1060, 1099,
34 904, 550, 135, -245, -514, -634,
35 -602, -451, -231, 0, 191, 308,
36 340, 296, 198, 78, -36, -120,
37 -163, -165, -132, -79, -19, 34,
38 73, 91, 89, 70, 38, 0
39 };
40
41 void Pred_lt_6 (
42 Word16 exc[], /* in/out: excitation buffer */
43 Word16 T0, /* input : integer pitch lag */
44 Word16 frac, /* input : fraction of lag */
45 Word16 L_subfr /* input : subframe size */
46 )
47 {
48 Word16 i, j, k;
49 Word16 *x0, *x1, *x2;
50 const Word16 *c1, *c2;
51 Word32 s;
52
53 x0 = &exc[-T0]; move16 ();
54
55 frac = negate (frac);
56 test ();
57 if (frac < 0)
58 {
59 frac = add (frac, UP_SAMP);
60 x0--;
61 }
62 for (j = 0; j < L_subfr; j++)
63 {
64 x1 = x0++; move16 ();
65 x2 = x0; move16 ();
66 c1 = &inter_6[frac];
67 c2 = &inter_6[sub (UP_SAMP, frac)];
68
69 s = 0; move32 ();
70 for (i = 0, k = 0; i < L_INTERPOL; i++, k += UP_SAMP)
71 {
72 s = L_mac (s, x1[-i], c1[k]);
73 s = L_mac (s, x2[i], c2[k]);
74 }
75
76 exc[j] = round (s); move16 ();
77 }
78
79 return;
80 }