changeset 394:2af94ba0c075

libtwamr: integrate syn_filt.c
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 06 May 2024 18:49:17 +0000
parents a2351f2ad4f8
children 8c7d5eec544c
files libtwamr/Makefile libtwamr/namespace.list libtwamr/syn_filt.c libtwamr/syn_filt.h
diffstat 4 files changed, 153 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libtwamr/Makefile	Mon May 06 18:44:13 2024 +0000
+++ b/libtwamr/Makefile	Mon May 06 18:49:17 2024 +0000
@@ -13,7 +13,7 @@
 	post_pro.o pow2.o prmno.o q_gain_c.o q_gain_p.o q_plsf.o q_plsf3_tab.o \
 	q_plsf5_tab.o q_plsf_3.o q_plsf_5.o qgain475.o qgain795.o qua_gain.o \
 	qua_gain_tab.o reorder.o residu.o s10_8pf.o set_sign.o sqrt_l.o \
-	tls_flags.o window.o
+	syn_filt.o tls_flags.o window.o
 HDRS=	namespace.h
 LIB=	libtwamr.a
 
--- a/libtwamr/namespace.list	Mon May 06 18:44:13 2024 +0000
+++ b/libtwamr/namespace.list	Mon May 06 18:49:17 2024 +0000
@@ -29,7 +29,8 @@
 Lsf_lsp Lsp_lsf Reorder_lsf Lsf_wt Lsp_Az
 Pitch_fr Pitch_fr_reset
 Post_Process Post_Process_reset
-Q_plsf_reset Q_plsf_3 Q_plsf_5 Qua_gain Residu
+Q_plsf_reset Q_plsf_3 Q_plsf_5 Qua_gain
+Residu Syn_filt
 
 agc agc2 agc_reset
 pseudonoise build_CN_code build_CN_param
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libtwamr/syn_filt.c	Mon May 06 18:49:17 2024 +0000
@@ -0,0 +1,103 @@
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.6.0   December 12, 2001
+*                                R99   Version 3.3.0                
+*                                REL-4 Version 4.1.0                
+*
+********************************************************************************
+*
+*      File             : syn_filt.c
+*      Purpose          : Perform synthesis filtering through 1/A(z).
+*
+********************************************************************************
+*/
+/*
+********************************************************************************
+*                         MODULE INCLUDE FILE AND VERSION ID
+********************************************************************************
+*/
+#include "namespace.h"
+#include "syn_filt.h"
+
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+#include "basic_op.h"
+#include "no_count.h"
+#include "cnst.h"
+
+/*
+********************************************************************************
+*                         LOCAL VARIABLES AND TABLES
+********************************************************************************
+*/
+/*
+*--------------------------------------*
+* Constants (defined in cnst.h         *
+*--------------------------------------*
+*  M         : LPC order               *
+*--------------------------------------*
+*/
+
+/*
+********************************************************************************
+*                         PUBLIC PROGRAM CODE
+********************************************************************************
+*/
+void Syn_filt (
+    Word16 a[],     /* (i)     : a[M+1] prediction coefficients   (M=10)  */
+    Word16 x[],     /* (i)     : input signal                             */
+    Word16 y[],     /* (o)     : output signal                            */
+    Word16 lg,      /* (i)     : size of filtering                        */
+    Word16 mem[],   /* (i/o)   : memory associated with this filtering.   */
+    Word16 update   /* (i)     : 0=no update, 1=update of memory.         */
+)
+{
+    Word16 i, j;
+    Word32 s;
+    Word16 tmp[80];   /* This is usually done by memory allocation (lg+M) */
+    Word16 *yy;
+
+    /* Copy mem[] to yy[] */
+
+    yy = tmp;                           move16 (); 
+
+    for (i = 0; i < M; i++)
+    {
+        *yy++ = mem[i];                 move16 (); 
+    } 
+
+    /* Do the filtering. */
+
+    for (i = 0; i < lg; i++)
+    {
+        s = L_mult (x[i], a[0]);
+        for (j = 1; j <= M; j++)
+        {
+            s = L_msu (s, a[j], yy[-j]);
+        }
+        s = L_shl (s, 3);
+        *yy++ = round (s);              move16 (); 
+    }
+
+    for (i = 0; i < lg; i++)
+    {
+        y[i] = tmp[i + M];              move16 (); 
+    }
+
+    /* Update of memory if update==1 */
+
+    test (); 
+    if (update != 0)
+    {
+        for (i = 0; i < M; i++)
+        {
+            mem[i] = y[lg - M + i];     move16 (); 
+        }
+    }
+    return;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libtwamr/syn_filt.h	Mon May 06 18:49:17 2024 +0000
@@ -0,0 +1,47 @@
+/*
+********************************************************************************
+*
+*      GSM AMR-NB speech codec   R98   Version 7.6.0   December 12, 2001
+*                                R99   Version 3.3.0                
+*                                REL-4 Version 4.1.0                
+*
+********************************************************************************
+*
+*      File             : syn_filt.h
+*      Purpose          : Perform synthesis filtering through 1/A(z).
+*
+*
+********************************************************************************
+*/
+#ifndef syn_filt_h
+#define syn_filt_h "$Id $"
+ 
+/*
+********************************************************************************
+*                         INCLUDE FILES
+********************************************************************************
+*/
+#include "typedef.h"
+
+/*
+********************************************************************************
+*                         DEFINITION OF DATA TYPES
+********************************************************************************
+*/
+ 
+/*
+********************************************************************************
+*                         DECLARATION OF PROTOTYPES
+********************************************************************************
+*/
+ 
+void Syn_filt (
+    Word16 a[],        /* (i)  : a[m+1] prediction coefficients   (m=10)    */
+    Word16 x[],        /* (i)  : input signal                               */
+    Word16 y[],        /* (o)  : output signal                              */
+    Word16 lg,         /* (i)  : size of filtering                          */
+    Word16 mem[],      /* (i/o): memory associated with this filtering.     */
+    Word16 update      /* (i)  : 0=no update, 1=update of memory.           */
+);
+ 
+#endif