# HG changeset patch # User Mychaela Falconia # Date 1715121251 0 # Node ID 3ce30a95769e0a7efe34dccb7765a6b7ac3c0a02 # Parent ffd87f972f86dc157b7512aa37cef24e9a0f30b3 libtwamr: implement test sequence input diff -r ffd87f972f86 -r 3ce30a95769e libtwamr/Makefile --- a/libtwamr/Makefile Tue May 07 22:15:23 2024 +0000 +++ b/libtwamr/Makefile Tue May 07 22:34:11 2024 +0000 @@ -17,8 +17,8 @@ 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 r_fft.o reorder.o residu.o s10_8pf.o \ set_sign.o sid_sync.o spreproc.o spstproc.o sqrt_l.o syn_filt.o \ - tls_flags.o ton_stab.o tseq_out.o vad1.o vad2.o vad_reset.o weight_a.o \ - window.o + tls_flags.o ton_stab.o tseq_in.o tseq_out.o vad1.o vad2.o vad_reset.o \ + weight_a.o window.o HDRS= a_refl.h agc.h autocorr.h az_lsp.h b_cn_cod.h basic_op.h bgnscd.h \ bitno.h bits2prm.h c1035pf.h c2_11pf.h c2_9pf.h c3_14pf.h c4_17pf.h \ c8_31pf.h c_g_aver.h calc_cor.h calc_en.h cbsearch.h cl_ltp.h cnst.h \ diff -r ffd87f972f86 -r 3ce30a95769e libtwamr/tseq_in.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libtwamr/tseq_in.c Tue May 07 22:34:11 2024 +0000 @@ -0,0 +1,49 @@ +/* + * In this module we implement decoder input conversion from 3GPP + * test sequence format to our internal struct amr_param_frame. + */ + +#include +#include +#include "tw_amr.h" +#include "namespace.h" +#include "typedef.h" +#include "cnst.h" +#include "bits2prm.h" + +int amr_frame_from_tseq(const uint16_t *cod, int use_rxtype, + struct amr_param_frame *frame) +{ + enum RXFrameType rx_type; + int rc; + + if (use_rxtype) { + if (cod[0] >= RX_N_FRAMETYPES) + return -1; + rx_type = cod[0]; + } else { + rc = amr_txtype_to_rxtype(cod[0], &rx_type); + if (rc < 0) + return -1; + } + frame->type = rx_type; + if (rx_type == RX_NO_DATA) { + frame->mode = 0xFF; + return 0; + } + if (cod[MAX_SERIAL_SIZE+1] > 7) + return -2; + frame->mode = cod[MAX_SERIAL_SIZE+1]; + switch (rx_type) { + case RX_SPEECH_GOOD: + case RX_SPEECH_DEGRADED: + case RX_SPEECH_BAD: + Bits2prm(frame->mode, cod + 1, frame->param); + break; + case RX_SID_UPDATE: + case RX_SID_BAD: + Bits2prm(MRDTX, cod + 1, frame->param); + break; + } + return 0; +}