comparison libgsmefr/pstfilt2.c @ 87:41d8e8f4058d

libgsmefr: pstfilt2.c compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 26 Nov 2022 10:27:34 +0000
parents 49dd1ac8e75b
children
comparison
equal deleted inserted replaced
86:9aef9e54b19d 87:41d8e8f4058d
6 * 6 *
7 * FUNCTIONS INCLUDED: Init_Post_Filter() and Post_Filter() 7 * FUNCTIONS INCLUDED: Init_Post_Filter() and Post_Filter()
8 * 8 *
9 *************************************************************************/ 9 *************************************************************************/
10 10
11 #include "gsm_efr.h"
11 #include "typedef.h" 12 #include "typedef.h"
13 #include "namespace.h"
12 #include "basic_op.h" 14 #include "basic_op.h"
13 #include "sig_proc.h" 15 #include "sig_proc.h"
14 #include "count.h" 16 #include "memops.h"
17 #include "no_count.h"
15 #include "codec.h" 18 #include "codec.h"
16 #include "cnst.h" 19 #include "cnst.h"
20 #include "dec_state.h"
17 21
18 /*---------------------------------------------------------------* 22 /*---------------------------------------------------------------*
19 * Postfilter constant parameters (defined in "cnst.h") * 23 * Postfilter constant parameters (defined in "cnst.h") *
20 *---------------------------------------------------------------* 24 *---------------------------------------------------------------*
21 * L_FRAME : Frame size. * 25 * L_FRAME : Frame size. *
29 #define L_H 22 /* size of truncated impulse response of A(z/g1)/A(z/g2) */ 33 #define L_H 22 /* size of truncated impulse response of A(z/g1)/A(z/g2) */
30 34
31 /*------------------------------------------------------------* 35 /*------------------------------------------------------------*
32 * static vectors * 36 * static vectors *
33 *------------------------------------------------------------*/ 37 *------------------------------------------------------------*/
34
35 /* inverse filtered synthesis */
36
37 static Word16 res2[L_SUBFR];
38
39 /* memory of filter 1/A(z/0.75) */
40
41 static Word16 mem_syn_pst[M];
42 38
43 /* Spectral expansion factors */ 39 /* Spectral expansion factors */
44 40
45 const Word16 F_gamma3[M] = 41 const Word16 F_gamma3[M] =
46 { 42 {
59 * 55 *
60 * PURPOSE: Initializes the postfilter parameters. 56 * PURPOSE: Initializes the postfilter parameters.
61 * 57 *
62 *************************************************************************/ 58 *************************************************************************/
63 59
64 void Init_Post_Filter (void) 60 void Init_Post_Filter (struct EFR_decoder_state *st)
65 { 61 {
66 Set_zero (mem_syn_pst, M); 62 Set_zero (st->mem_syn_pst, M);
67 63
68 Set_zero (res2, L_SUBFR); 64 Set_zero (st->res2, L_SUBFR);
69 65
70 return; 66 return;
71 } 67 }
72 68
73 /************************************************************************* 69 /*************************************************************************
84 * - adaptive gain control 80 * - adaptive gain control
85 * 81 *
86 *************************************************************************/ 82 *************************************************************************/
87 83
88 void Post_Filter ( 84 void Post_Filter (
85 struct EFR_decoder_state *st,
89 Word16 *syn, /* in/out: synthesis speech (postfiltered is output) */ 86 Word16 *syn, /* in/out: synthesis speech (postfiltered is output) */
90 Word16 *Az_4 /* input: interpolated LPC parameters in all subframes */ 87 Word16 *Az_4 /* input: interpolated LPC parameters in all subframes */
91 ) 88 )
92 { 89 {
93 /*-------------------------------------------------------------------* 90 /*-------------------------------------------------------------------*
118 Weight_Ai (Az, F_gamma3, Ap3); 115 Weight_Ai (Az, F_gamma3, Ap3);
119 Weight_Ai (Az, F_gamma4, Ap4); 116 Weight_Ai (Az, F_gamma4, Ap4);
120 117
121 /* filtering of synthesis speech by A(z/0.7) to find res2[] */ 118 /* filtering of synthesis speech by A(z/0.7) to find res2[] */
122 119
123 Residu (Ap3, &syn[i_subfr], res2, L_SUBFR); 120 Residu (Ap3, &syn[i_subfr], st->res2, L_SUBFR);
124 121
125 /* tilt compensation filter */ 122 /* tilt compensation filter */
126 123
127 /* impulse response of A(z/0.7)/A(z/0.75) */ 124 /* impulse response of A(z/0.7)/A(z/0.75) */
128 125
155 { 152 {
156 temp2 = mult (temp2, MU); 153 temp2 = mult (temp2, MU);
157 temp2 = div_s (temp2, temp1); 154 temp2 = div_s (temp2, temp1);
158 } 155 }
159 156
160 preemphasis (res2, temp2, L_SUBFR); 157 preemphasis (st, st->res2, temp2, L_SUBFR);
161 158
162 /* filtering through 1/A(z/0.75) */ 159 /* filtering through 1/A(z/0.75) */
163 160
164 Syn_filt (Ap4, res2, &syn_pst[i_subfr], L_SUBFR, mem_syn_pst, 1); 161 Syn_filt (Ap4, st->res2, &syn_pst[i_subfr], L_SUBFR,
162 st->mem_syn_pst, 1);
165 163
166 /* scale output to input */ 164 /* scale output to input */
167 165
168 agc (&syn[i_subfr], &syn_pst[i_subfr], AGC_FAC, L_SUBFR); 166 agc (st, &syn[i_subfr], &syn_pst[i_subfr], AGC_FAC, L_SUBFR);
169 167
170 Az += MP1; 168 Az += MP1;
171 } 169 }
172 170
173 /* update syn[] buffer */ 171 /* update syn[] buffer */