FreeCalypso > hg > gsm-codec-lib
annotate libgsmefr/reorder.c @ 200:33487966077e
libgsmefr/q_gains.c: perf opt
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 04 Jan 2023 04:42:28 +0000 |
parents | 9ad6bf2f1ee1 |
children | 0faf23a9286f |
rev | line source |
---|---|
53
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /************************************************************************* |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * FUNCTION: Reorder_lsf() |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * PURPOSE: To make sure that the LSFs are properly ordered and to keep a |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * certain minimum distance between adjacent LSFs. * |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * The LSFs are in the frequency range 0-0.5 and represented in Q15 |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 * |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 *************************************************************************/ |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
90
9ad6bf2f1ee1
libgsmefr: reorder.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
53
diff
changeset
|
11 #include "gsm_efr.h" |
53
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "typedef.h" |
90
9ad6bf2f1ee1
libgsmefr: reorder.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
53
diff
changeset
|
13 #include "namespace.h" |
53
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include "basic_op.h" |
90
9ad6bf2f1ee1
libgsmefr: reorder.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
53
diff
changeset
|
15 #include "no_count.h" |
9ad6bf2f1ee1
libgsmefr: reorder.c compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
53
diff
changeset
|
16 #include "sig_proc.h" |
53
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 void Reorder_lsf ( |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 Word16 *lsf, /* (i/o) : vector of LSFs (range: 0<=val<=0.5) */ |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 Word16 min_dist, /* (i) : minimum required distance */ |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 Word16 n /* (i) : LPC order */ |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 ) |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 { |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 Word16 i; |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 Word16 lsf_min; |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 lsf_min = min_dist; move16 (); |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 for (i = 0; i < n; i++) |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 { |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 test (); |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 if (sub (lsf[i], lsf_min) < 0) |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 { |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 lsf[i] = lsf_min; move16 (); |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 } |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 lsf_min = add (lsf[i], min_dist); |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 } |
49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 } |