# HG changeset patch # User Mychaela Falconia # Date 1715021053 0 # Node ID a2351f2ad4f85c5b519a0d3e76139c0b8fd548a9 # Parent a0f914a283717713602e79142038666b251e58d1 libtwamr: integrate residu.c diff -r a0f914a28371 -r a2351f2ad4f8 libtwamr/Makefile --- a/libtwamr/Makefile Mon May 06 18:37:52 2024 +0000 +++ b/libtwamr/Makefile Mon May 06 18:44:13 2024 +0000 @@ -12,8 +12,8 @@ lsp_az.o lsp_lsf.o lsp_tab.o mac_32.o oper_32b.o ph_disp.o pitch_fr.o \ 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 s10_8pf.o set_sign.o sqrt_l.o tls_flags.o \ - window.o + qua_gain_tab.o reorder.o residu.o s10_8pf.o set_sign.o sqrt_l.o \ + tls_flags.o window.o HDRS= namespace.h LIB= libtwamr.a diff -r a0f914a28371 -r a2351f2ad4f8 libtwamr/namespace.list --- a/libtwamr/namespace.list Mon May 06 18:37:52 2024 +0000 +++ b/libtwamr/namespace.list Mon May 06 18:44:13 2024 +0000 @@ -29,7 +29,7 @@ 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 +Q_plsf_reset Q_plsf_3 Q_plsf_5 Qua_gain Residu agc agc2 agc_reset pseudonoise build_CN_code build_CN_param diff -r a0f914a28371 -r a2351f2ad4f8 libtwamr/residu.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libtwamr/residu.c Mon May 06 18:44:13 2024 +0000 @@ -0,0 +1,74 @@ +/* +******************************************************************************** +* +* 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 : residu.c +* Purpose : Computes the LP residual. +* Description : The LP residual is computed by filtering the input +* : speech through the LP inverse filter A(z). +* +******************************************************************************** +*/ +/* +******************************************************************************** +* MODULE INCLUDE FILE AND VERSION ID +******************************************************************************** +*/ +#include "namespace.h" +#include "residu.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 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; +} diff -r a0f914a28371 -r a2351f2ad4f8 libtwamr/residu.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libtwamr/residu.h Mon May 06 18:44:13 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 : residu.h +* Purpose : Computes the LP residual. +* Description : The LP residual is computed by filtering the input +* : speech through the LP inverse filter A(z). +* +* +******************************************************************************** +*/ +#ifndef residu_h +#define residu_h "$Id $" + +/* +******************************************************************************** +* INCLUDE FILES +******************************************************************************** +*/ +#include "typedef.h" + +/* +******************************************************************************** +* DEFINITION OF DATA TYPES +******************************************************************************** +*/ + +/* +******************************************************************************** +* DECLARATION OF PROTOTYPES +******************************************************************************** +*/ + +void Residu ( + Word16 a[], /* (i) : prediction coefficients */ + Word16 x[], /* (i) : speech signal */ + Word16 y[], /* (o) : residual signal */ + Word16 lg /* (i) : size of filtering */ +); + +#endif