FreeCalypso > hg > gsm-codec-lib
view libtwamr/residu.c @ 419:2a094af3d384
libtwamr: implement encoder top level
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 07 May 2024 04:51:04 +0000 |
parents | a2351f2ad4f8 |
children |
line wrap: on
line source
/* ******************************************************************************** * * 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; }