/* ******************************************************************************** * * 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 "residu.h" const char residu_id[] = "@(#)$Id $" residu_h; /* ******************************************************************************** * INCLUDE FILES ******************************************************************************** */ #include "typedef.h" #include "basic_op.h" #include "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_ex (x[i], a[0]); for (j = 1; j <= M; j++) { s = L_mac_ex (s, a[j], x[i - j]); } s = L_shl_ex (s, 3); y[i] = round_ex (s); move16 (); } return; }