changeset 87:41d8e8f4058d

libgsmefr: pstfilt2.c compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 26 Nov 2022 10:27:34 +0000
parents 9aef9e54b19d
children 03599300d2db
files libgsmefr/Makefile libgsmefr/pstfilt2.c
diffstat 2 files changed, 16 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/libgsmefr/Makefile	Sat Nov 26 09:56:19 2022 +0000
+++ b/libgsmefr/Makefile	Sat Nov 26 10:27:34 2022 +0000
@@ -5,8 +5,8 @@
 	dec_lag6.o dtx.o e_homing.o enc_create.o enc_lag6.o frame2params.o \
 	g_code.o g_pitch.o int_lpc.o inter_6.o inv_sqrt.o lag_wind.o levinson.o\
 	log2.o lsp_az.o lsp_lsf.o oper_32b.o params2frame.o pitch_f6.o \
-	pitch_ol.o pow2.o pre_proc.o pred_lt6.o preemph.o sid_class.o \
-	sid_insert.o tls_flags.o
+	pitch_ol.o pow2.o pre_proc.o pred_lt6.o preemph.o pstfilt2.o \
+	sid_class.o sid_insert.o tls_flags.o
 HDRS=	basic_op.h cnst.h codec.h d_homing.h dec_state.h dtx.h e_homing.h \
 	enc_state.h gains_tb.h gsm_efr.h memops.h namespace.h no_count.h \
 	oper_32b.h sig_proc.h typedef.h vad.h
--- a/libgsmefr/pstfilt2.c	Sat Nov 26 09:56:19 2022 +0000
+++ b/libgsmefr/pstfilt2.c	Sat Nov 26 10:27:34 2022 +0000
@@ -8,12 +8,16 @@
  *
  *************************************************************************/
 
+#include "gsm_efr.h"
 #include "typedef.h"
+#include "namespace.h"
 #include "basic_op.h"
 #include "sig_proc.h"
-#include "count.h"
+#include "memops.h"
+#include "no_count.h"
 #include "codec.h"
 #include "cnst.h"
+#include "dec_state.h"
 
 /*---------------------------------------------------------------*
  *    Postfilter constant parameters (defined in "cnst.h")       *
@@ -32,14 +36,6 @@
  *   static vectors                                           *
  *------------------------------------------------------------*/
 
- /* inverse filtered synthesis */
-
-static Word16 res2[L_SUBFR];
-
- /* memory of filter 1/A(z/0.75) */
-
-static Word16 mem_syn_pst[M];
-
  /* Spectral expansion factors */
 
 const Word16 F_gamma3[M] =
@@ -61,11 +57,11 @@
  *
  *************************************************************************/
 
-void Init_Post_Filter (void)
+void Init_Post_Filter (struct EFR_decoder_state *st)
 {
-    Set_zero (mem_syn_pst, M);
+    Set_zero (st->mem_syn_pst, M);
 
-    Set_zero (res2, L_SUBFR);
+    Set_zero (st->res2, L_SUBFR);
 
     return;
 }
@@ -86,6 +82,7 @@
  *************************************************************************/
 
 void Post_Filter (
+    struct EFR_decoder_state *st,
     Word16 *syn,    /* in/out: synthesis speech (postfiltered is output)    */
     Word16 *Az_4    /* input: interpolated LPC parameters in all subframes  */
 )
@@ -120,7 +117,7 @@
 
         /* filtering of synthesis speech by A(z/0.7) to find res2[] */
 
-        Residu (Ap3, &syn[i_subfr], res2, L_SUBFR);
+        Residu (Ap3, &syn[i_subfr], st->res2, L_SUBFR);
 
         /* tilt compensation filter */
 
@@ -157,15 +154,16 @@
             temp2 = div_s (temp2, temp1);
         }
 
-        preemphasis (res2, temp2, L_SUBFR);
+        preemphasis (st, st->res2, temp2, L_SUBFR);
 
         /* filtering through  1/A(z/0.75) */
 
-        Syn_filt (Ap4, res2, &syn_pst[i_subfr], L_SUBFR, mem_syn_pst, 1);
+        Syn_filt (Ap4, st->res2, &syn_pst[i_subfr], L_SUBFR,
+                  st->mem_syn_pst, 1);
 
         /* scale output to input */
 
-        agc (&syn[i_subfr], &syn_pst[i_subfr], AGC_FAC, L_SUBFR);
+        agc (st, &syn[i_subfr], &syn_pst[i_subfr], AGC_FAC, L_SUBFR);
 
         Az += MP1;
     }