FreeCalypso > hg > gsm-codec-lib
diff libgsmefr/reorder.c @ 53:49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 25 Nov 2022 16:18:21 +0000 |
parents | |
children | 9ad6bf2f1ee1 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmefr/reorder.c Fri Nov 25 16:18:21 2022 +0000 @@ -0,0 +1,34 @@ +/************************************************************************* + * + * FUNCTION: Reorder_lsf() + * + * PURPOSE: To make sure that the LSFs are properly ordered and to keep a + * certain minimum distance between adjacent LSFs. * + * The LSFs are in the frequency range 0-0.5 and represented in Q15 + * + *************************************************************************/ + +#include "typedef.h" +#include "basic_op.h" +#include "count.h" + +void Reorder_lsf ( + Word16 *lsf, /* (i/o) : vector of LSFs (range: 0<=val<=0.5) */ + Word16 min_dist, /* (i) : minimum required distance */ + Word16 n /* (i) : LPC order */ +) +{ + Word16 i; + Word16 lsf_min; + + lsf_min = min_dist; move16 (); + for (i = 0; i < n; i++) + { + test (); + if (sub (lsf[i], lsf_min) < 0) + { + lsf[i] = lsf_min; move16 (); + } + lsf_min = add (lsf[i], min_dist); + } +}