# HG changeset patch # User Mychaela Falconia # Date 1712970637 0 # Node ID ffdcdb27d673d127963f05204e9c01541e4f5fb4 # Parent 573afa985df63dbed348f2c84f6093a57fb89bfe libgsmfr2: integrate e/d state from TU-Berlin code diff -r 573afa985df6 -r ffdcdb27d673 libgsmfr2/Makefile --- a/libgsmfr2/Makefile Sat Apr 13 00:43:36 2024 +0000 +++ b/libgsmfr2/Makefile Sat Apr 13 01:10:37 2024 +0000 @@ -1,9 +1,9 @@ CC= gcc CFLAGS= -O2 -OBJS= comfort_noise.o pack_frame.o pack_frame2.o pp_bad.o pp_good.o \ - pp_state.o prng.o sidclass.o silence_frame.o unpack_frame.o \ +OBJS= comfort_noise.o ed_state.o pack_frame.o pack_frame2.o pp_bad.o \ + pp_good.o pp_state.o prng.o sidclass.o silence_frame.o unpack_frame.o \ unpack_frame2.o xmaxc_mean.o -HDRS= pp_internal.h pp_state.h tw_gsmfr.h typedef.h +HDRS= ed_state.h pp_internal.h pp_state.h tw_gsmfr.h typedef.h LIB= libgsmfr2.a INSTALL_PREFIX= /usr/local diff -r 573afa985df6 -r ffdcdb27d673 libgsmfr2/ed_state.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmfr2/ed_state.c Sat Apr 13 01:10:37 2024 +0000 @@ -0,0 +1,28 @@ +/* + * In this module we implement allocation and initialization + * of state structures for our GSM 06.10 encoder & decoder + * based on libgsm from TU-Berlin. + */ + +#include +#include +#include +#include "tw_gsmfr.h" +#include "typedef.h" +#include "ed_state.h" + +struct gsmfr_0610_state *gsmfr_0610_create(void) +{ + struct gsmfr_0610_state *st; + + st = malloc(sizeof(struct gsmfr_0610_state)); + if (st) + gsmfr_0610_reset(st); + return st; +} + +void gsmfr_0610_reset(struct gsmfr_0610_state *st) +{ + memset(st, 0, sizeof(struct gsmfr_0610_state)); + st->nrp = 40; +} diff -r 573afa985df6 -r ffdcdb27d673 libgsmfr2/ed_state.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmfr2/ed_state.h Sat Apr 13 01:10:37 2024 +0000 @@ -0,0 +1,21 @@ +/* + * This header file is internal to libgsmfr2; + * here we define our state structure for GSM 06.10 encoder & decoder component. + */ + +struct gsmfr_0610_state { + word dp0[ 280 ]; + word e[ 50 ]; /* code.c */ + + word z1; /* preprocessing.c, Offset_com. */ + longword L_z2; /* Offset_com. */ + int mp; /* Preemphasis */ + + word u[8]; /* short_term_aly_filter.c */ + word LARpp[2][8]; /* */ + word j; /* */ + + word nrp; /* 40 */ /* long_term.c, synthesis */ + word v[9]; /* short_term.c, synthesis */ + word msr; /* decoder.c, Postprocessing */ +}; diff -r 573afa985df6 -r ffdcdb27d673 libgsmfr2/typedef.h --- a/libgsmfr2/typedef.h Sat Apr 13 00:43:36 2024 +0000 +++ b/libgsmfr2/typedef.h Sat Apr 13 01:10:37 2024 +0000 @@ -8,3 +8,9 @@ typedef uint16_t uword; typedef uint32_t ulongword; + +#define MIN_WORD (-32767 - 1) +#define MAX_WORD 32767 + +#define MIN_LONGWORD (-2147483647 - 1) +#define MAX_LONGWORD 2147483647