changeset 630:f85ef5c4d044 default tip

libgsmhr1: provide sizes of state structures
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 12 Mar 2026 06:19:12 +0000
parents 32cc4b709e0e
children
files libgsmhr1/Makefile libgsmhr1/sizes.c libgsmhr1/tw_gsmhr.h
diffstat 3 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgsmhr1/Makefile	Thu Mar 12 05:59:37 2026 +0000
+++ b/libgsmhr1/Makefile	Thu Mar 12 06:19:12 2026 +0000
@@ -2,7 +2,7 @@
 	dtx_rxfe.o enc_out_order.o enc_state.o err_conc.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_dec.o sp_enc.o sp_frm.o sp_rom.o sp_sfrm.o tfo.o \
+	sid_reset.o sizes.o sp_dec.o sp_enc.o sp_frm.o sp_rom.o sp_sfrm.o tfo.o\
 	twts002_in.o twts002_out.o unpack_frame.o vad.o
 HDRS=	dec_func.h dec_state.h dtx_const.h dtx_dec.h dtx_enc.h dtx_rxfe.h \
 	enc_out_order.h enc_state.h err_conc.h mathdp31.h mathhalf.h \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmhr1/sizes.c	Thu Mar 12 06:19:12 2026 +0000
@@ -0,0 +1,12 @@
+/*
+ * This library module provides const "variables" with sizes of
+ * state structures.
+ */
+
+#include "tw_gsmhr.h"
+#include "dec_state.h"
+#include "enc_state.h"
+
+const unsigned gsmhr_encoder_state_size = sizeof(struct gsmhr_encoder_state);
+const unsigned gsmhr_decoder_state_size = sizeof(struct gsmhr_decoder_state);
+const unsigned gsmhr_rxfe_state_size    = sizeof(struct gsmhr_rxfe_state);
--- a/libgsmhr1/tw_gsmhr.h	Thu Mar 12 05:59:37 2026 +0000
+++ b/libgsmhr1/tw_gsmhr.h	Thu Mar 12 06:19:12 2026 +0000
@@ -75,4 +75,10 @@
 extern const int16_t gsmhr_dhf_params[GSMHR_NUM_PARAMS];
 extern const uint8_t gsmhr_dhf_ts101318[GSMHR_FRAME_LEN_RPF];
 
+/* sizes of state structures, to support alternative malloc schemes */
+
+extern const unsigned gsmhr_encoder_state_size;
+extern const unsigned gsmhr_decoder_state_size;
+extern const unsigned gsmhr_rxfe_state_size;
+
 #endif	/* include guard */