comparison libgsmefr/preemph.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 9aef9e54b19d
comparison
equal deleted inserted replaced
52:988fd7ff514f 53:49dd1ac8e75b
1 /*---------------------------------------------------------------------*
2 * routine preemphasis() *
3 * ~~~~~~~~~~~~~~~~~~~~~ *
4 * Preemphasis: filtering through 1 - g z^-1 *
5 *---------------------------------------------------------------------*/
6
7 #include "typedef.h"
8 #include "basic_op.h"
9 #include "count.h"
10
11 Word16 mem_pre;
12
13 void preemphasis (
14 Word16 *signal, /* (i/o) : input signal overwritten by the output */
15 Word16 g, /* (i) : preemphasis coefficient */
16 Word16 L /* (i) : size of filtering */
17 )
18 {
19 Word16 *p1, *p2, temp, i;
20
21 p1 = signal + L - 1; move16 ();
22 p2 = p1 - 1; move16 ();
23 temp = *p1; move16 ();
24
25 for (i = 0; i <= L - 2; i++)
26 {
27 *p1 = sub (*p1, mult (g, *p2--)); move16 ();
28 p1--;
29 }
30
31 *p1 = sub (*p1, mult (g, mem_pre)); move16 ();
32
33 mem_pre = temp; move16 ();
34
35 return;
36 }