changeset 68:aacdf352576c

libgsmefr: e_homing.c compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 26 Nov 2022 05:21:50 +0000
parents 58b64224d4ac
children e109d8752d60
files libgsmefr/Makefile libgsmefr/e_homing.c
diffstat 2 files changed, 23 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/libgsmefr/Makefile	Sat Nov 26 05:09:07 2022 +0000
+++ b/libgsmefr/Makefile	Sat Nov 26 05:21:50 2022 +0000
@@ -2,8 +2,8 @@
 CFLAGS=	-O2
 OBJS=	agc.o autocorr.o az_lsp.o basicop2.o c1035pf.o cod_12k2.o convolve.o \
 	d1035pf.o d_gains.o d_homing.o d_plsf_5.o dec_12k2.o dec_create.o \
-	dec_lag6.o dtx.o enc_create.o frame2params.o params2frame.o sid_class.o\
-	sid_insert.o tls_flags.o
+	dec_lag6.o dtx.o e_homing.o enc_create.o frame2params.o params2frame.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/e_homing.c	Sat Nov 26 05:09:07 2022 +0000
+++ b/libgsmefr/e_homing.c	Sat Nov 26 05:21:50 2022 +0000
@@ -17,12 +17,16 @@
  *
  **************************************************************************/
 
+#include "gsm_efr.h"
 #include "typedef.h"
+#include "namespace.h"
 #include "cnst.h"
 #include "vad.h"
 #include "dtx.h"
 #include "codec.h"
 #include "sig_proc.h"
+#include "memops.h"
+#include "enc_state.h"
 #include "e_homing.h"
 
 /***************************************************************************
@@ -78,57 +82,41 @@
  *
  **************************************************************************/
 
-void encoder_reset (void)
+void encoder_reset (struct EFR_encoder_state *st)
 {
-    /* External declarations for encoder variables which need to be reset */
-
-    /* Variables defined in levinson.c */
-    /* ------------------------------- */
-    extern Word16 old_A[M + 1]; /* Last A(z) for case of unstable filter */
-
-    /* Variables defined in q_gains.c */
-    /* ------------------------------- */
-    /* Memories of gain quantization: */
-    extern Word16 past_qua_en[4], pred[4];
-
-    /* Variables defined in q_plsf_5.c */
-    /* ------------------------------- */
-    /* Past quantized prediction error */
-    extern Word16 past_r2_q[M];
-
     Word16 i;
 
     /* reset all the encoder state variables */
     /* ------------------------------------- */
 
     /* Variables in cod_12k2.c: */
-    Init_Coder_12k2 ();
+    Init_Coder_12k2 (st);
 
     /* Variables in levinson.c: */
-    old_A[0] = 4096;            /* Last A(z) for case of unstable filter */
+    st->old_A[0] = 4096;        /* Last A(z) for case of unstable filter */
     for (i = 1; i < M + 1; i++)
     {
-        old_A[i] = 0;
+        st->old_A[i] = 0;
     }
 
     /* Variables in pre_proc.c: */
-    Init_Pre_Process ();
+    Init_Pre_Process (st);
 
     /* Variables in q_gains.c: */
     for (i = 0; i < 4; i++)
     {
-        past_qua_en[i] = -2381; /* past quantized energies */
+        st->past_qua_en[i] = -2381; /* past quantized energies */
     }
 
-    pred[0] = 44;               /* MA prediction coeff */
-    pred[1] = 37;               /* MA prediction coeff */
-    pred[2] = 22;               /* MA prediction coeff */
-    pred[3] = 12;               /* MA prediction coeff */
+    st->pred[0] = 44;               /* MA prediction coeff */
+    st->pred[1] = 37;               /* MA prediction coeff */
+    st->pred[2] = 22;               /* MA prediction coeff */
+    st->pred[3] = 12;               /* MA prediction coeff */
 
     /* Variables in q_plsf_5.c: */
     for (i = 0; i < M; i++)
     {
-        past_r2_q[i] = 0;       /* Past quantized prediction error */
+        st->past_r2_q[i] = 0;       /* Past quantized prediction error */
     }
 
     return;
@@ -153,11 +141,13 @@
  *
  **************************************************************************/
 
-void reset_enc (void)
+void EFR_encoder_reset (struct EFR_encoder_state *st, int dtx)
 {
-    encoder_reset (); /* reset all the state variables in the speech encoder*/
-    vad_reset ();     /* reset all the VAD state variables */
-    reset_tx_dtx ();  /* reset all the transmit DTX and CN variables */
+    st->dtx_mode = dtx;
+
+    encoder_reset (st); /* reset all the state variables in the speech encoder*/
+    vad_reset (st);     /* reset all the VAD state variables */
+    reset_tx_dtx (st);  /* reset all the transmit DTX and CN variables */
 
     return;
 }