FreeCalypso > hg > gsm-codec-lib
changeset 338:5db2c920fc23
libtwamr: gains.tab integrated
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 18 Apr 2024 23:28:29 +0000 |
parents | 190c4c9a3693 |
children | a723d9f9f697 |
files | libtwamr/Makefile libtwamr/gains_tab.c libtwamr/gains_tab.h libtwamr/namespace.h |
diffstat | 4 files changed, 98 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libtwamr/Makefile Thu Apr 18 23:06:59 2024 +0000 +++ b/libtwamr/Makefile Thu Apr 18 23:28:29 2024 +0000 @@ -3,9 +3,9 @@ OBJS= a_refl.o agc.o autocorr.o az_lsp.o b_cn_cod.o basicop2.o bgnscd.o \ bitno.o bits2prm.o c1035pf.o c2_11pf.o c2_9pf.o c3_14pf.o c4_17pf.o \ c8_31pf.o c_g_aver.o calc_cor.o calc_en.o cbsearch.o convolve.o cor_h.o\ - d1035pf.o d2_11pf.o d2_9pf.o d3_14pf.o d4_17pf.o d8_31pf.o gc_pred.o \ - gmed_n.o graytab.o inv_sqrt.o log2.o oper_32b.o pow2.o prmno.o \ - s10_8pf.o set_sign.o sqrt_l.o tls_flags.o window.o + d1035pf.o d2_11pf.o d2_9pf.o d3_14pf.o d4_17pf.o d8_31pf.o gains_tab.o \ + gc_pred.o gmed_n.o graytab.o inv_sqrt.o log2.o oper_32b.o pow2.o \ + prmno.o s10_8pf.o set_sign.o sqrt_l.o tls_flags.o window.o LIB= libtwamr.a INSTALL_PREFIX= /usr/local
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libtwamr/gains_tab.c Thu Apr 18 23:28:29 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 : gains.tab +* Purpose : Scalar quantization tables of the pitch gain and +* : the codebook gain. +* $Id $ +* +******************************************************************************** +*/ + +#include "namespace.h" +#include "typedef.h" +#include "gains_tab.h" + +const Word16 qua_gain_pitch[NB_QUA_PITCH] = +{ + 0, 3277, 6556, 8192, 9830, 11469, 12288, 13107, + 13926, 14746, 15565, 16384, 17203, 18022, 18842, 19661 +}; + +const Word16 qua_gain_code[NB_QUA_CODE*3] = +{ +/* gain factor (g_fac) and quantized energy error (qua_ener_MR122, qua_ener) + * are stored: + * + * qua_ener_MR122 = log2(g_fac) (not the rounded floating point value, but + * the value the original EFR algorithm + * calculates from g_fac [using Log2]) + * qua_ener = 20*log10(g_fac); (rounded floating point value) + * + * + * g_fac (Q11), qua_ener_MR122 (Q10), qua_ener (Q10) + */ + 159, -3776, -22731, + 206, -3394, -20428, + 268, -3005, -18088, + 349, -2615, -15739, + 419, -2345, -14113, + 482, -2138, -12867, + 554, -1932, -11629, + 637, -1726, -10387, + 733, -1518, -9139, + 842, -1314, -7906, + 969, -1106, -6656, + 1114, -900, -5416, + 1281, -694, -4173, + 1473, -487, -2931, + 1694, -281, -1688, + 1948, -75, -445, + 2241, 133, 801, + 2577, 339, 2044, + 2963, 545, 3285, + 3408, 752, 4530, + 3919, 958, 5772, + 4507, 1165, 7016, + 5183, 1371, 8259, + 5960, 1577, 9501, + 6855, 1784, 10745, + 7883, 1991, 11988, + 9065, 2197, 13231, + 10425, 2404, 14474, + 12510, 2673, 16096, + 16263, 3060, 18429, + 21142, 3448, 20763, + 27485, 3836, 23097 +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libtwamr/gains_tab.h Thu Apr 18 23:28:29 2024 +0000 @@ -0,0 +1,20 @@ +/* + * This header file contains preprocessor definitions and extern + * declarations for the tables which originally resided in gains.tab + * and were multiply included in many source modules. + */ + +#ifndef gains_tab_h +#define gains_tab_h + +#include "typedef.h" + +#define NB_QUA_PITCH 16 + +extern const Word16 qua_gain_pitch[NB_QUA_PITCH]; + +#define NB_QUA_CODE 32 + +extern const Word16 qua_gain_code[NB_QUA_CODE*3]; + +#endif
--- a/libtwamr/namespace.h Thu Apr 18 23:06:59 2024 +0000 +++ b/libtwamr/namespace.h Thu Apr 18 23:28:29 2024 +0000 @@ -93,6 +93,8 @@ #define window_200_40 AMR__window_200_40 #define window_160_80 AMR__window_160_80 #define window_232_8 AMR__window_232_8 +#define qua_gain_pitch AMR__qua_gain_pitch +#define qua_gain_code AMR__qua_gain_code #define Cb_gain_average AMR__Cb_gain_average #define Cb_gain_average_reset AMR__Cb_gain_average_reset