changeset 54:7b11cbe99a0e

libgsmefr: agc.c compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 25 Nov 2022 16:35:07 +0000
parents 49dd1ac8e75b
children 92dc7f0082a3
files libgsmefr/Makefile libgsmefr/agc.c
diffstat 2 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libgsmefr/Makefile	Fri Nov 25 16:18:21 2022 +0000
+++ b/libgsmefr/Makefile	Fri Nov 25 16:35:07 2022 +0000
@@ -1,7 +1,7 @@
 CC=	gcc
 CFLAGS=	-O2
-OBJS=	basicop2.o dec_create.o enc_create.o frame2params.o params2frame.o \
-	sid_class.o sid_insert.o tls_flags.o
+OBJS=	agc.o basicop2.o dec_create.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 namespace.h no_count.h oper_32b.h \
 	sig_proc.h typedef.h vad.h
--- a/libgsmefr/agc.c	Fri Nov 25 16:18:21 2022 +0000
+++ b/libgsmefr/agc.c	Fri Nov 25 16:35:07 2022 +0000
@@ -14,15 +14,17 @@
  *
  *************************************************************************/
 
+#include "gsm_efr.h"
 #include "typedef.h"
+#include "namespace.h"
 #include "basic_op.h"
-#include "count.h"
+#include "no_count.h"
+#include "cnst.h"
+#include "dec_state.h"
 #include "sig_proc.h"
-#include "cnst.h"
-
-Word16 past_gain;               /* initial value of past_gain = 1.0  */
 
 void agc (
+    struct EFR_decoder_state *st,
     Word16 *sig_in,             /* (i)     : postfilter input signal  */
     Word16 *sig_out,            /* (i/o)   : postfilter output signal */
     Word16 agc_fac,             /* (i)     : AGC factor               */
@@ -46,10 +48,9 @@
         s = L_mac (s, temp, temp);
     }
 
-    test (); 
     if (s == 0)
     {
-        past_gain = 0;          move16 (); 
+        st->past_gain = 0;
         return;
     }
     exp = sub (norm_l (s), 1);
@@ -66,10 +67,9 @@
         s = L_mac (s, temp, temp);
     }
 
-    test (); 
     if (s == 0)
     {
-        g0 = 0;                 move16 (); 
+        g0 = 0;
     }
     else
     {
@@ -96,17 +96,16 @@
                         + (1-agc_fac) * sqrt(gain_in/gain_out) */
     /* sig_out[n] = gain[n] * sig_out[n]                        */
 
-    gain = past_gain;           move16 (); 
+    gain = st->past_gain;
 
     for (i = 0; i < l_trm; i++)
     {
         gain = mult (gain, agc_fac);
         gain = add (gain, g0);
         sig_out[i] = extract_h (L_shl (L_mult (sig_out[i], gain), 3));
-                                move16 (); 
     }
 
-    past_gain = gain;           move16 (); 
+    st->past_gain = gain;
 
     return;
 }