FreeCalypso > hg > gsm-codec-lib
comparison libgsmefr/preemph.c @ 86:9aef9e54b19d
libgsmefr: preemph.c compiles
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 26 Nov 2022 09:56:19 +0000 |
parents | 49dd1ac8e75b |
children |
comparison
equal
deleted
inserted
replaced
85:db8e0b69a6bb | 86:9aef9e54b19d |
---|---|
2 * routine preemphasis() * | 2 * routine preemphasis() * |
3 * ~~~~~~~~~~~~~~~~~~~~~ * | 3 * ~~~~~~~~~~~~~~~~~~~~~ * |
4 * Preemphasis: filtering through 1 - g z^-1 * | 4 * Preemphasis: filtering through 1 - g z^-1 * |
5 *---------------------------------------------------------------------*/ | 5 *---------------------------------------------------------------------*/ |
6 | 6 |
7 #include "gsm_efr.h" | |
7 #include "typedef.h" | 8 #include "typedef.h" |
9 #include "namespace.h" | |
8 #include "basic_op.h" | 10 #include "basic_op.h" |
9 #include "count.h" | 11 #include "no_count.h" |
10 | 12 #include "sig_proc.h" |
11 Word16 mem_pre; | 13 #include "cnst.h" |
14 #include "dec_state.h" | |
12 | 15 |
13 void preemphasis ( | 16 void preemphasis ( |
17 struct EFR_decoder_state *st, | |
14 Word16 *signal, /* (i/o) : input signal overwritten by the output */ | 18 Word16 *signal, /* (i/o) : input signal overwritten by the output */ |
15 Word16 g, /* (i) : preemphasis coefficient */ | 19 Word16 g, /* (i) : preemphasis coefficient */ |
16 Word16 L /* (i) : size of filtering */ | 20 Word16 L /* (i) : size of filtering */ |
17 ) | 21 ) |
18 { | 22 { |
19 Word16 *p1, *p2, temp, i; | 23 Word16 *p1, *p2, temp, i; |
20 | 24 |
21 p1 = signal + L - 1; move16 (); | 25 p1 = signal + L - 1; |
22 p2 = p1 - 1; move16 (); | 26 p2 = p1 - 1; |
23 temp = *p1; move16 (); | 27 temp = *p1; |
24 | 28 |
25 for (i = 0; i <= L - 2; i++) | 29 for (i = 0; i <= L - 2; i++) |
26 { | 30 { |
27 *p1 = sub (*p1, mult (g, *p2--)); move16 (); | 31 *p1 = sub (*p1, mult (g, *p2--)); |
28 p1--; | 32 p1--; |
29 } | 33 } |
30 | 34 |
31 *p1 = sub (*p1, mult (g, mem_pre)); move16 (); | 35 *p1 = sub (*p1, mult (g, st->mem_pre)); |
32 | 36 |
33 mem_pre = temp; move16 (); | 37 st->mem_pre = temp; |
34 | 38 |
35 return; | 39 return; |
36 } | 40 } |