annotate src/reorder.c @ 5:799b56cbccb6

EFR2 decoder: add post-processing step from AMR
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 03 Apr 2024 06:09:10 +0000
parents 56410792419a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*************************************************************************
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 *
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * FUNCTION: Reorder_lsf()
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 *
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * PURPOSE: To make sure that the LSFs are properly ordered and to keep a
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * certain minimum distance between adjacent LSFs. *
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 * The LSFs are in the frequency range 0-0.5 and represented in Q15
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 *
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *************************************************************************/
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "typedef.h"
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "basic_op.h"
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include "count.h"
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 void Reorder_lsf (
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 Word16 *lsf, /* (i/o) : vector of LSFs (range: 0<=val<=0.5) */
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 Word16 min_dist, /* (i) : minimum required distance */
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 Word16 n /* (i) : LPC order */
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 )
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 {
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 Word16 i;
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 Word16 lsf_min;
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 lsf_min = min_dist; move16 ();
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 for (i = 0; i < n; i++)
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 {
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 test ();
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 if (sub (lsf[i], lsf_min) < 0)
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 {
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 lsf[i] = lsf_min; move16 ();
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 }
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 lsf_min = add (lsf[i], min_dist);
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 }
56410792419a src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 }