FreeCalypso > hg > gsm-codec-lib
comparison libtwamr/reorder.c @ 344:05a46720af0f
libtwamr: integrate d_plsf_3.c
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 19 Apr 2024 01:23:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
343:3f574255c3aa | 344:05a46720af0f |
---|---|
1 /* | |
2 ******************************************************************************** | |
3 * | |
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 | |
5 * R99 Version 3.3.0 | |
6 * REL-4 Version 4.1.0 | |
7 * | |
8 ******************************************************************************** | |
9 * | |
10 * File : reorder.c | |
11 * Purpose : To make sure that the LSFs are properly ordered | |
12 * : and to keep a certain minimum distance between | |
13 * : adjacent LSFs. | |
14 * | |
15 ******************************************************************************** | |
16 */ | |
17 /* | |
18 ******************************************************************************** | |
19 * MODULE INCLUDE FILE AND VERSION ID | |
20 ******************************************************************************** | |
21 */ | |
22 #include "namespace.h" | |
23 #include "reorder.h" | |
24 | |
25 /* | |
26 ******************************************************************************** | |
27 * INCLUDE FILES | |
28 ******************************************************************************** | |
29 */ | |
30 #include "typedef.h" | |
31 #include "basic_op.h" | |
32 #include "no_count.h" | |
33 | |
34 /* | |
35 ******************************************************************************** | |
36 * LOCAL VARIABLES AND TABLES | |
37 ******************************************************************************** | |
38 */ | |
39 | |
40 /* | |
41 ******************************************************************************** | |
42 * PUBLIC PROGRAM CODE | |
43 ******************************************************************************** | |
44 */ | |
45 /************************************************************************* | |
46 * | |
47 * FUNCTION: Reorder_lsf() | |
48 * | |
49 * PURPOSE: To make sure that the LSFs are properly ordered and to keep a | |
50 * certain minimum distance between adjacent LSFs. | |
51 * | |
52 * The LSFs are in the frequency range 0-0.5 and represented in Q15 | |
53 * | |
54 *************************************************************************/ | |
55 void Reorder_lsf ( | |
56 Word16 *lsf, /* (i/o) : vector of LSFs (range: 0<=val<=0.5) */ | |
57 Word16 min_dist, /* (i) : minimum required distance */ | |
58 Word16 n /* (i) : LPC order */ | |
59 ) | |
60 { | |
61 Word16 i; | |
62 Word16 lsf_min; | |
63 | |
64 lsf_min = min_dist; move16 (); | |
65 for (i = 0; i < n; i++) | |
66 { | |
67 test (); | |
68 if (sub (lsf[i], lsf_min) < 0) | |
69 { | |
70 lsf[i] = lsf_min; move16 (); | |
71 } | |
72 lsf_min = add (lsf[i], min_dist); | |
73 } | |
74 } |