diff libgsmefr/agc.c @ 54:7b11cbe99a0e

libgsmefr: agc.c compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 25 Nov 2022 16:35:07 +0000
parents 49dd1ac8e75b
children
line wrap: on
line diff
--- 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;
 }