comparison libgsmefr/d1035pf.c @ 60:d273a77d5523

libgsmefr: d1035pf.c compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 25 Nov 2022 19:22:05 +0000
parents 49dd1ac8e75b
children d80e9f12a1d1
comparison
equal deleted inserted replaced
59:8de2f0f9bd78 60:d273a77d5523
7 * 7 *
8 * See c1035pf.c for more details about the algebraic codebook structure. 8 * See c1035pf.c for more details about the algebraic codebook structure.
9 * 9 *
10 *************************************************************************/ 10 *************************************************************************/
11 11
12 #include "gsm_efr.h"
12 #include "typedef.h" 13 #include "typedef.h"
14 #include "namespace.h"
13 #include "basic_op.h" 15 #include "basic_op.h"
14 #include "count.h" 16 #include "memops.h"
17 #include "no_count.h"
18 #include "codec.h"
15 19
16 #define L_CODE 40 /* codevector length */ 20 #define L_CODE 40 /* codevector length */
17 #define NB_PULSE 10 /* number of pulses */ 21 #define NB_PULSE 10 /* number of pulses */
18 #define NB_TRACK 5 /* number of track */ 22 #define NB_TRACK 5 /* number of track */
19 23
23 ) 27 )
24 { 28 {
25 static const Word16 dgray[8] = {0, 1, 3, 2, 5, 6, 4, 7}; 29 static const Word16 dgray[8] = {0, 1, 3, 2, 5, 6, 4, 7};
26 Word16 i, j, pos1, pos2, sign, tmp; 30 Word16 i, j, pos1, pos2, sign, tmp;
27 31
28 for (i = 0; i < L_CODE; i++) 32 Set_zero (cod, L_CODE);
29 {
30 cod[i] = 0; move16 ();
31 }
32 33
33 /* decode the positions and signs of pulses and build the codeword */ 34 /* decode the positions and signs of pulses and build the codeword */
34 35
35 for (j = 0; j < NB_TRACK; j++) 36 for (j = 0; j < NB_TRACK; j++)
36 { 37 {
42 43
43 i = extract_l (L_shr (L_mult (i, 5), 1)); 44 i = extract_l (L_shr (L_mult (i, 5), 1));
44 pos1 = add (i, j); /* position of pulse "j" */ 45 pos1 = add (i, j); /* position of pulse "j" */
45 46
46 i = shr (tmp, 3) & 1; logic16 (); 47 i = shr (tmp, 3) & 1; logic16 ();
47 test ();
48 if (i == 0) 48 if (i == 0)
49 { 49 {
50 sign = 4096; move16 (); /* +1.0 */ 50 sign = 4096; move16 (); /* +1.0 */
51 } 51 }
52 else 52 else
62 i = dgray[i]; move16 (); 62 i = dgray[i]; move16 ();
63 i = extract_l (L_shr (L_mult (i, 5), 1)); 63 i = extract_l (L_shr (L_mult (i, 5), 1));
64 64
65 pos2 = add (i, j); /* position of pulse "j+5" */ 65 pos2 = add (i, j); /* position of pulse "j+5" */
66 66
67 test ();
68 if (sub (pos2, pos1) < 0) 67 if (sub (pos2, pos1) < 0)
69 { 68 {
70 sign = negate (sign); 69 sign = negate (sign);
71 } 70 }
72 cod[pos2] = add (cod[pos2], sign); move16 (); 71 cod[pos2] = add (cod[pos2], sign); move16 ();