# HG changeset patch # User Mychaela Falconia # Date 1713062168 0 # Node ID 19db59c9dc0760afe7a8af5fdecbb412b5cb7106 # Parent d320a8fa33922c93eff8620bc6f14f0fb789d7b5 libgsmfr2: integrate table.c from libgsm diff -r d320a8fa3392 -r 19db59c9dc07 libgsmfr2/Makefile --- a/libgsmfr2/Makefile Sun Apr 14 02:32:25 2024 +0000 +++ b/libgsmfr2/Makefile Sun Apr 14 02:36:08 2024 +0000 @@ -3,7 +3,7 @@ OBJS= add.o comfort_noise.o dec_main.o ed_state.o enc_main.o long_term.o \ lpc.o pack_frame.o pack_frame2.o pp_bad.o pp_good.o pp_state.o \ preprocess.o prng.o rpe.o short_term.o sidclass.o silence_frame.o \ - unpack_frame.o unpack_frame2.o xmaxc_mean.o + table.o unpack_frame.o unpack_frame2.o xmaxc_mean.o HDRS= ed_internal.h ed_state.h pp_internal.h pp_state.h tw_gsmfr.h typedef.h LIB= libgsmfr2.a diff -r d320a8fa3392 -r 19db59c9dc07 libgsmfr2/table.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmfr2/table.c Sun Apr 14 02:36:08 2024 +0000 @@ -0,0 +1,63 @@ +/* + * This C source file has been adapted from TU-Berlin libgsm source, + * original notice follows: + * + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include +#include "tw_gsmfr.h" +#include "typedef.h" +#include "ed_state.h" +#include "ed_internal.h" + +/* 4.4 TABLES USED IN THE FIXED POINT IMPLEMENTATION OF THE RPE-LTP + * CODER AND DECODER + * + * (Most of them inlined, so watch out.) + */ + +/* Table 4.1 Quantization of the Log.-Area Ratios + */ +/* i 1 2 3 4 5 6 7 8 */ +word gsm_A[8] = {20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036}; +word gsm_B[8] = { 0, 0, 2048, -2560, 94, -1792, -341, -1144}; +word gsm_MIC[8] = { -32, -32, -16, -16, -8, -8, -4, -4 }; +word gsm_MAC[8] = { 31, 31, 15, 15, 7, 7, 3, 3 }; + + +/* Table 4.2 Tabulation of 1/A[1..8] + */ +word gsm_INVA[8]={ 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708 }; + + +/* Table 4.3a Decision level of the LTP gain quantizer + */ +/* bc 0 1 2 3 */ +word gsm_DLB[4] = { 6554, 16384, 26214, 32767 }; + + +/* Table 4.3b Quantization levels of the LTP gain quantizer + */ +/* bc 0 1 2 3 */ +word gsm_QLB[4] = { 3277, 11469, 21299, 32767 }; + + +/* Table 4.4 Coefficients of the weighting filter + */ +/* i 0 1 2 3 4 5 6 7 8 9 10 */ +word gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 }; + + +/* Table 4.5 Normalized inverse mantissa used to compute xM/xmax + */ +/* i 0 1 2 3 4 5 6 7 */ +word gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 }; + + +/* Table 4.6 Normalized direct mantissa used to compute xM/xmax + */ +/* i 0 1 2 3 4 5 6 7 */ +word gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 };