diff libgsmefr/residu.c @ 53:49dd1ac8e75b

libgsmefr: import most *.c files from ETSI source
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 25 Nov 2022 16:18:21 +0000
parents
children de9dc80c1312
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmefr/residu.c	Fri Nov 25 16:18:21 2022 +0000
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ *  FUNCTION:  Residu
+ *
+ *  PURPOSE:  Computes the LP residual.
+ *
+ *  DESCRIPTION:
+ *     The LP residual is computed by filtering the input speech through
+ *     the LP inverse filter A(z).
+ *
+ *************************************************************************/
+
+#include "typedef.h"
+#include "basic_op.h"
+#include "count.h"
+
+/* m = LPC order == 10 */
+#define m 10
+
+void Residu (
+    Word16 a[], /* (i)     : prediction coefficients                      */
+    Word16 x[], /* (i)     : speech signal                                */
+    Word16 y[], /* (o)     : residual signal                              */
+    Word16 lg   /* (i)     : size of filtering                            */
+)
+{
+    Word16 i, j;
+    Word32 s;
+
+    for (i = 0; i < lg; i++)
+    {
+        s = L_mult (x[i], a[0]);
+        for (j = 1; j <= m; j++)
+        {
+            s = L_mac (s, a[j], x[i - j]);
+        }
+        s = L_shl (s, 3);
+        y[i] = round (s);       move16 (); 
+    }
+    return;
+}