FreeCalypso > hg > gsm-codec-lib
changeset 582:7d0e565aa1ae
libgsmhr1: implement TFO wrapper around RxFE
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 13 Feb 2025 23:24:17 +0000 |
parents | e2d5cad04cbf |
children | 9cda792c0dd7 |
files | libgsmhr1/Makefile libgsmhr1/tfo.c |
diffstat | 2 files changed, 32 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libgsmhr1/Makefile Thu Feb 13 10:02:45 2025 +0000 +++ b/libgsmhr1/Makefile Thu Feb 13 23:24:17 2025 +0000 @@ -1,7 +1,7 @@ OBJS= 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 sid_cw_params.o sid_detect.o \ - sid_reset.o sp_rom.o twts002_in.o twts002_out.o unpack_frame.o + sid_reset.o sp_rom.o tfo.o twts002_in.o twts002_out.o unpack_frame.o HDRS= 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/tfo.c Thu Feb 13 23:24:17 2025 +0000 @@ -0,0 +1,31 @@ +/* + * In this module we implement the TFO transform for HRv1. Our implementation + * of this transform is a wrapper around our RxFE block that was specifically + * designed to be usable both for the full decoder and for TFO. + */ + +#include <stddef.h> +#include <stdint.h> +#include <string.h> +#include "tw_gsmhr.h" +#include "namespace.h" +#include "rxfe.h" + +void gsmhr_tfo_xfrm(struct gsmhr_rxfe_state *st, int dtxd, const int16_t *ul, + int16_t *dl) +{ + rxfe_main(st, ul, dl, dtxd, NULL, NULL, dl + 19); + if (dtxd) { + dl[18] = 0; /* VAD=0 dummy setting */ + if (!dl[19]) /* turn CN into re-emission of SID */ + gsmhr_set_sid_cw_params(dl); + } else { + /* sans-DTX: VAD=1 SP=1 always */ + dl[18] = 1; + dl[19] = 1; + } + /* homing logic */ + if (!ul[18] && + !memcmp(ul, gsmhr_dhf_params, sizeof(int16_t) * GSMHR_NUM_PARAMS)) + gsmhr_rxfe_reset(st); +}