annotate libtwamr/reorder.c @ 485:751f06541fbb

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