changeset 283:25649b3a83e9

gsmfr-cod2std: convert to libgsmfr2
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Apr 2024 05:51:42 +0000
parents 9ee8ad3d4d30
children 8d3cfa65a6c2
files frtest/Makefile frtest/cod2std.c
diffstat 2 files changed, 7 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/frtest/Makefile	Sun Apr 14 05:44:47 2024 +0000
+++ b/frtest/Makefile	Sun Apr 14 05:51:42 2024 +0000
@@ -2,6 +2,7 @@
 CFLAGS=	-O2
 PROGS=	gsmfr-cod2std gsmfr-decode gsmfr-decode-r gsmfr-dlcap-gsmx \
 	gsmfr-dlcap-parse gsmfr-encode gsmfr-encode-r gsmfr-preproc
+LIBFR2=	../libgsmfr2/libgsmfr2.a
 LIBPP=	../libgsmfrp/libgsmfrp.a
 LIBTEST=../libtest/libtest.a
 LIBDEC=	${LIBTEST} ${LIBPP}
@@ -9,8 +10,8 @@
 
 all:	${PROGS}
 
-gsmfr-cod2std:	cod2std.o
-	${CC} ${CFLAGS} -o $@ cod2std.o -lgsm
+gsmfr-cod2std:	cod2std.o ${LIBFR2}
+	${CC} ${CFLAGS} -o $@ cod2std.o ${LIBFR2}
 
 gsmfr-decode:	decode.o ${LIBDEC}
 	${CC} ${CFLAGS} -o $@ decode.o ${LIBDEC} -lgsm
--- a/frtest/cod2std.c	Sun Apr 14 05:44:47 2024 +0000
+++ b/frtest/cod2std.c	Sun Apr 14 05:51:42 2024 +0000
@@ -8,12 +8,12 @@
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
-#include <gsm.h>
+#include "../libgsmfr2/tw_gsmfr.h"
 
 static void
 bytes_to_params(bytes, params, big_endian)
 	uint8_t *bytes;
-	gsm_signal *params;
+	int16_t *params;
 {
 	uint8_t *sp;
 	unsigned n;
@@ -35,11 +35,10 @@
 {
 	char *infname, *outfname;
 	FILE *inf, *outf;
-	gsm dummy_state;
 	int big_endian;
 	unsigned frame_no;
 	uint8_t input_bytes[76*2], frame[33];
-	gsm_signal params[76];
+	int16_t params[76];
 	int cc;
 
 	if (argc == 3 && argv[1][0] != '-') {
@@ -65,11 +64,6 @@
 		perror(outfname);
 		exit(1);
 	}
-	dummy_state = gsm_create();
-	if (!dummy_state) {
-		fprintf(stderr, "gsm_create() failed!\n");
-		exit(1);
-	}
 	for (frame_no = 0; ; frame_no++) {
 		cc = fread(input_bytes, 2, 76, inf);
 		if (cc == 0)
@@ -79,7 +73,7 @@
 			exit(1);
 		}
 		bytes_to_params(input_bytes, params, big_endian);
-		gsm_implode(dummy_state, params, frame);
+		gsmfr_pack_from_array(params, frame);
 		fwrite(frame, 1, sizeof frame, outf);
 	}
 	fclose(outf);