FreeCalypso > hg > gsm-codec-lib
changeset 596:8e4ecdfadf5a
libgsmhr1: capture decoder state
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 04 Dec 2025 06:25:54 +0000 |
| parents | 1e75556ab6c0 |
| children | e8418167eb1f |
| files | libgsmhr1/Makefile libgsmhr1/dec_state.c libgsmhr1/dec_state.h |
| diffstat | 3 files changed, 62 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libgsmhr1/Makefile Thu Dec 04 04:05:16 2025 +0000 +++ b/libgsmhr1/Makefile Thu Dec 04 06:25:54 2025 +0000 @@ -1,8 +1,8 @@ -OBJS= dec_func.o dhf_packed.o dhf_params.o dtx_rxfe.o enc_out_order.o \ - mathdp31.o mathhalf.o pack_frame.o paramval_cod.o paramval_common.o \ - paramval_dec.o rtp_in.o rtp_in_direct.o rxfe.o rxfe_create.o \ - sid_cw_params.o sid_detect.o sid_reset.o sp_rom.o tfo.o twts002_in.o \ - twts002_out.o unpack_frame.o +OBJS= dec_func.o dec_state.o dhf_packed.o dhf_params.o dtx_rxfe.o \ + enc_out_order.o mathdp31.o mathhalf.o pack_frame.o paramval_cod.o \ + paramval_common.o paramval_dec.o rtp_in.o rtp_in_direct.o rxfe.o \ + rxfe_create.o sid_cw_params.o sid_detect.o sid_reset.o sp_rom.o tfo.o \ + twts002_in.o twts002_out.o unpack_frame.o HDRS= dec_func.h dec_state.h dtx_const.h dtx_rxfe.h enc_out_order.h \ mathdp31.h mathhalf.h namespace.h rxfe.h sp_rom.h tw_gsmhr.h typedefs.h LIB= libgsmhr1.a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmhr1/dec_state.c Thu Dec 04 06:25:54 2025 +0000 @@ -0,0 +1,37 @@ +/* + * Here we implement gsmhr_decoder_create() and gsmhr_decoder_reset() + * functions: allocation and initialization of full speech decoder state. + */ + +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include "tw_gsmhr.h" +#include "typedefs.h" +#include "namespace.h" +#include "dec_state.h" +#include "dtx_const.h" + +struct gsmhr_decoder_state *gsmhr_decoder_create(void) +{ + struct gsmhr_decoder_state *st; + + st = malloc(sizeof(struct gsmhr_decoder_state)); + if (st) + gsmhr_decoder_reset(st); + return st; +} + +void gsmhr_decoder_reset(struct gsmhr_decoder_state *st) +{ + int i; + + memset(st, 0, sizeof(struct gsmhr_decoder_state)); + gsmhr_rxfe_reset(&st->rxfe); + for (i = 0; i < 4; i++) { + st->plSubfrEnergyMem[i] = 80; + st->swLevelMem[i] = -72; + } + st->swRxDTXState = CNINTPER - 1; + st->is_homed = 1; +}
--- a/libgsmhr1/dec_state.h Thu Dec 04 04:05:16 2025 +0000 +++ b/libgsmhr1/dec_state.h Thu Dec 04 06:25:54 2025 +0000 @@ -11,9 +11,29 @@ #include "typedefs.h" #include "rxfe.h" +#define LTP_LEN 147 /* 147==0x93 length of LTP history */ + struct gsmhr_decoder_state { struct gsmhr_rxfe_state rxfe; int is_homed; + /* state variables from err_conc.c */ + Longword plSubfrEnergyMem[4]; + Shortword swLevelMem[4]; + /* state variables from sp_dec.c */ + Shortword gswPostFiltAgcGain; + Shortword gpswPostFiltStateNum[NP]; + Shortword gpswPostFiltStateDenom[NP]; + Shortword swPostEmphasisState; + Shortword pswSynthFiltState[NP]; + Shortword pswOldFrmKsDec[NP]; + Shortword pswOldFrmAsDec[NP]; + Shortword pswOldFrmPFNum[NP]; + Shortword pswOldFrmPFDenom[NP]; + Shortword swOldR0Dec; + Shortword pswLtpStateBaseDec[LTP_LEN + S_LEN]; + Shortword pswPPreState[LTP_LEN + S_LEN]; + Shortword swMuteFlagOld; + Shortword swRxDTXState; }; #endif
