changeset 262:573afa985df6

libgsmfr2: split pp_state.h from pp_internal.h
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Apr 2024 00:43:36 +0000
parents cfcb3ce9c778
children ffdcdb27d673
files libgsmfr2/Makefile libgsmfr2/comfort_noise.c libgsmfr2/pp_bad.c libgsmfr2/pp_good.c libgsmfr2/pp_internal.h libgsmfr2/pp_state.c libgsmfr2/pp_state.h libgsmfr2/prng.c libgsmfr2/typedef.h
diffstat 9 files changed, 43 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/libgsmfr2/Makefile	Fri Apr 12 23:29:18 2024 +0000
+++ b/libgsmfr2/Makefile	Sat Apr 13 00:43:36 2024 +0000
@@ -3,7 +3,7 @@
 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 \
 	unpack_frame2.o xmaxc_mean.o
-HDRS=	pp_internal.h tw_gsmfr.h
+HDRS=	pp_internal.h pp_state.h tw_gsmfr.h typedef.h
 LIB=	libgsmfr2.a
 
 INSTALL_PREFIX=	/usr/local
--- a/libgsmfr2/comfort_noise.c	Fri Apr 12 23:29:18 2024 +0000
+++ b/libgsmfr2/comfort_noise.c	Sat Apr 13 00:43:36 2024 +0000
@@ -6,6 +6,7 @@
 #include <stdint.h>
 #include <string.h>
 #include "tw_gsmfr.h"
+#include "pp_state.h"
 #include "pp_internal.h"
 
 static const uint8_t fold_table_8to6[24] = {
--- a/libgsmfr2/pp_bad.c	Fri Apr 12 23:29:18 2024 +0000
+++ b/libgsmfr2/pp_bad.c	Sat Apr 13 00:43:36 2024 +0000
@@ -6,6 +6,7 @@
 #include <stdint.h>
 #include <string.h>
 #include "tw_gsmfr.h"
+#include "pp_state.h"
 #include "pp_internal.h"
 
 static int reduce_xmaxc(uint8_t *frame)
--- a/libgsmfr2/pp_good.c	Fri Apr 12 23:29:18 2024 +0000
+++ b/libgsmfr2/pp_good.c	Sat Apr 13 00:43:36 2024 +0000
@@ -5,6 +5,7 @@
 #include <stdint.h>
 #include <string.h>
 #include "tw_gsmfr.h"
+#include "pp_state.h"
 #include "pp_internal.h"
 
 void gsmfr_preproc_good_frame(struct gsmfr_preproc_state *st, uint8_t *frame)
--- a/libgsmfr2/pp_internal.h	Fri Apr 12 23:29:18 2024 +0000
+++ b/libgsmfr2/pp_internal.h	Sat Apr 13 00:43:36 2024 +0000
@@ -1,30 +1,8 @@
 /*
- * This header file is internal to libgsmfr2;
- * here we define our state structure for the Rx DTX preprocessor component.
+ * This header file is internal to libgsmfr2; it contains declarations
+ * of internal functions for the Rx DTX preprocessor component.
  */
 
-enum rx_dtx_st {
-	NO_DATA = 0,
-	SPEECH,
-	SPEECH_MUTING,
-	COMFORT_NOISE,
-	LOST_SID,
-	CN_MUTING,
-};
-
-struct gsmfr_preproc_state {
-	enum rx_dtx_st	rx_state;
-	uint8_t		speech_frame[GSMFR_RTP_FRAME_LEN];
-	uint8_t		sid_prefix[5];
-	uint8_t		sid_xmaxc;
-	uint32_t	cn_random_lfsr;
-	unsigned	cn_random_6fold;
-};
-
-/* we use the same LFSR PRNG for CN as ETSI EFR implementation */
-#define PN_INITIAL_SEED 0x70816958L   /* Pseudo noise generator seed value  */
-
-/* internal functions */
 extern void gsmfr_preproc_gen_cn(struct gsmfr_preproc_state *state,
 				 uint8_t *frame);
 extern void gsmfr_preproc_sid2cn(struct gsmfr_preproc_state *state,
--- a/libgsmfr2/pp_state.c	Fri Apr 12 23:29:18 2024 +0000
+++ b/libgsmfr2/pp_state.c	Sat Apr 13 00:43:36 2024 +0000
@@ -7,7 +7,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "tw_gsmfr.h"
-#include "pp_internal.h"
+#include "pp_state.h"
 
 struct gsmfr_preproc_state *gsmfr_preproc_create(void)
 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmfr2/pp_state.h	Sat Apr 13 00:43:36 2024 +0000
@@ -0,0 +1,25 @@
+/*
+ * This header file is internal to libgsmfr2;
+ * here we define our state structure for the Rx DTX preprocessor component.
+ */
+
+enum rx_dtx_st {
+	NO_DATA = 0,
+	SPEECH,
+	SPEECH_MUTING,
+	COMFORT_NOISE,
+	LOST_SID,
+	CN_MUTING,
+};
+
+struct gsmfr_preproc_state {
+	enum rx_dtx_st	rx_state;
+	uint8_t		speech_frame[GSMFR_RTP_FRAME_LEN];
+	uint8_t		sid_prefix[5];
+	uint8_t		sid_xmaxc;
+	uint32_t	cn_random_lfsr;
+	unsigned	cn_random_6fold;
+};
+
+/* we use the same LFSR PRNG for CN as ETSI EFR implementation */
+#define PN_INITIAL_SEED 0x70816958L   /* Pseudo noise generator seed value  */
--- a/libgsmfr2/prng.c	Fri Apr 12 23:29:18 2024 +0000
+++ b/libgsmfr2/prng.c	Sat Apr 13 00:43:36 2024 +0000
@@ -10,6 +10,7 @@
 
 #include <stdint.h>
 #include "tw_gsmfr.h"
+#include "pp_state.h"
 #include "pp_internal.h"
 
 uint16_t gsmfr_preproc_prng(struct gsmfr_preproc_state *st, uint16_t no_bits)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmfr2/typedef.h	Sat Apr 13 00:43:36 2024 +0000
@@ -0,0 +1,10 @@
+/*
+ * This internal header file provides adaptation between stdint types
+ * and those used by GSM 06.10 code from TU-Berlin.
+ */
+
+typedef int16_t word;
+typedef int32_t longword;
+
+typedef uint16_t uword;
+typedef uint32_t ulongword;