comparison src/preemph.c @ 0:56410792419a

src: original EFR source from ETSI
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 03 Apr 2024 05:31:37 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:56410792419a
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 }