FreeCalypso > hg > gsm-codec-lib
changeset 384:a8dab7028e4d
libtwamr: integrate lag_wind.c
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 06 May 2024 05:56:50 +0000 |
parents | 838ed426bb76 |
children | c713061b6edf |
files | libtwamr/Makefile libtwamr/lag_wind.c libtwamr/lag_wind.h libtwamr/lag_wind.tab libtwamr/namespace.list |
diffstat | 5 files changed, 183 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libtwamr/Makefile Mon May 06 05:49:47 2024 +0000 +++ b/libtwamr/Makefile Mon May 06 05:56:50 2024 +0000 @@ -8,10 +8,11 @@ dec_lag6.o dhf_check.o dhf_tables.o e_homing.o ec_gains.o enc_lag3.o \ enc_lag6.o ex_ctrl.o g_adapt.o g_code.o g_pitch.o gain_q.o gains_tab.o \ gc_pred.o gmed_n.o graytab.o hp_max.o int_lpc.o int_lsf.o inter_36.o \ - inv_sqrt.o log2.o lsfwt.o lsp_az.o lsp_lsf.o mac_32.o oper_32b.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 + inv_sqrt.o lag_wind.o log2.o lsfwt.o lsp_az.o lsp_lsf.o mac_32.o \ + oper_32b.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 HDRS= namespace.h LIB= libtwamr.a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libtwamr/lag_wind.c Mon May 06 05:56:50 2024 +0000 @@ -0,0 +1,73 @@ +/* +******************************************************************************** +* +* 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 : lag_wind.c +* Purpose : Lag windowing of autocorrelations. +* +******************************************************************************** +*/ +/* +******************************************************************************** +* MODULE INCLUDE FILE AND VERSION ID +******************************************************************************** +*/ +#include "namespace.h" +#include "lag_wind.h" + +/* +******************************************************************************** +* INCLUDE FILES +******************************************************************************** +*/ +#include "typedef.h" +#include "basic_op.h" +#include "oper_32b.h" +#include "no_count.h" + +/* +******************************************************************************** +* LOCAL VARIABLES AND TABLES +******************************************************************************** +*/ +#include "lag_wind.tab" /* Table for Lag_Window() */ + +/* +******************************************************************************** +* PUBLIC PROGRAM CODE +******************************************************************************** +*/ +/************************************************************************* + * + * FUNCTION: Lag_window() + * + * PURPOSE: Lag windowing of autocorrelations. + * + * DESCRIPTION: + * r[i] = r[i]*lag_wind[i], i=1,...,10 + * + * r[i] and lag_wind[i] are in special double precision format. + * See "oper_32b.c" for the format. + * + *************************************************************************/ +void Lag_window ( + Word16 m, /* (i) : LPC order */ + Word16 r_h[], /* (i/o) : Autocorrelations (msb) */ + Word16 r_l[] /* (i/o) : Autocorrelations (lsb) */ +) +{ + Word16 i; + Word32 x; + + for (i = 1; i <= m; i++) + { + x = Mpy_32 (r_h[i], r_l[i], lag_h[i - 1], lag_l[i - 1]); + L_Extract (x, &r_h[i], &r_l[i]); + } + return; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libtwamr/lag_wind.h Mon May 06 05:56:50 2024 +0000 @@ -0,0 +1,42 @@ +/* +******************************************************************************** +* +* 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 : lag_wind.h +* Purpose : Lag windowing of autocorrelations. +* +******************************************************************************** +*/ +#ifndef lag_wind_h +#define lag_wind_h "$Id $" + +/* +******************************************************************************** +* INCLUDE FILES +******************************************************************************** +*/ +#include "typedef.h" + +/* +******************************************************************************** +* DEFINITION OF DATA TYPES +******************************************************************************** +*/ + +/* +******************************************************************************** +* DECLARATION OF PROTOTYPES +******************************************************************************** +*/ +void Lag_window ( + Word16 m, /* (i) : LPC order */ + Word16 r_h[], /* (i/o) : Autocorrelations (msb) */ + Word16 r_l[] /* (i/o) : Autocorrelations (lsb) */ +); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libtwamr/lag_wind.tab Mon May 06 05:56:50 2024 +0000 @@ -0,0 +1,62 @@ +/* +******************************************************************************** +* +* 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 : lag_wind.tab +* Purpose : Table of lag_window for autocorrelation. +* $Id $ +* +******************************************************************************** +*/ +/*-----------------------------------------------------* + | Table of lag_window for autocorrelation. | + | | + | noise floor = 1.0001 = (0.9999 on r[1] ..r[10]) | + | Bandwitdh expansion = 60 Hz | + | | + | | + | lag_wind[0] = 1.00000000 (not stored) | + | lag_wind[1] = 0.99879038 | + | lag_wind[2] = 0.99546897 | + | lag_wind[3] = 0.98995781 | + | lag_wind[4] = 0.98229337 | + | lag_wind[5] = 0.97252619 | + | lag_wind[6] = 0.96072036 | + | lag_wind[7] = 0.94695264 | + | lag_wind[8] = 0.93131179 | + | lag_wind[9] = 0.91389757 | + | lag_wind[10]= 0.89481968 | + -----------------------------------------------------*/ + +static const Word16 lag_h[10] = +{ + 32728, + 32619, + 32438, + 32187, + 31867, + 31480, + 31029, + 30517, + 29946, + 29321 +}; + +static const Word16 lag_l[10] = +{ + 11904, + 17280, + 30720, + 25856, + 24192, + 28992, + 24384, + 7360, + 19520, + 14784 +};
--- a/libtwamr/namespace.list Mon May 06 05:49:47 2024 +0000 +++ b/libtwamr/namespace.list Mon May 06 05:56:50 2024 +0000 @@ -25,6 +25,7 @@ G_code G_pitch Int_lpc_1and3 Int_lpc_1and3_2 Int_lpc_1to3 Int_lpc_1to3_2 Int_lsf Interpol_3or6 +Lag_window Lsf_lsp Lsp_lsf Reorder_lsf Lsf_wt Lsp_Az Q_plsf_reset Q_plsf_3 Q_plsf_5 Qua_gain