changeset 574:993cb9273f89

libgsmhr1: add function that sets SID codeword at param level
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 13 Feb 2025 00:41:21 +0000
parents fa81605d83a2
children 5452d6cd64b1
files libgsmhr1/Makefile libgsmhr1/sid_cw_params.c libgsmhr1/tw_gsmhr.h
diffstat 3 files changed, 35 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgsmhr1/Makefile	Thu Feb 13 00:14:09 2025 +0000
+++ b/libgsmhr1/Makefile	Thu Feb 13 00:41:21 2025 +0000
@@ -1,7 +1,7 @@
 OBJS=	dhf_packed.o dhf_params.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 sid_detect.o sid_reset.o sp_rom.o twts002_in.o \
-	twts002_out.o unpack_frame.o
+	rtp_in_direct.o sid_cw_params.o sid_detect.o sid_reset.o sp_rom.o \
+	twts002_in.o twts002_out.o unpack_frame.o
 HDRS=	enc_out_order.h mathdp31.h mathhalf.h namespace.h sp_rom.h tw_gsmhr.h \
 	typedefs.h
 LIB=	libgsmhr1.a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmhr1/sid_cw_params.c	Thu Feb 13 00:41:21 2025 +0000
@@ -0,0 +1,32 @@
+/*
+ * The function in this module fills parameters 4 through 17 of
+ * generated SID frames, setting them to the required SID codeword.
+ * It can also be used to transform a speech frame into a SID frame
+ * with the same R0 and LPC parameters.
+ */
+
+#include <stdint.h>
+#include "tw_gsmhr.h"
+
+void gsmhr_set_sid_cw_params(int16_t *params)
+{
+	/* Int_LPC and Mode */
+	params[4] = 1;
+	params[5] = 3;
+	/* subframe 1 */
+	params[6] = 0xFF;
+	params[7] = 0x1FF;
+	params[8] = 0x1F;
+	/* subframe 2 */
+	params[9] = 0xF;
+	params[10] = 0x1FF;
+	params[11] = 0x1F;
+	/* subframe 3 */
+	params[12] = 0xF;
+	params[13] = 0x1FF;
+	params[14] = 0x1F;
+	/* subframe 4 */
+	params[15] = 0xF;
+	params[16] = 0x1FF;
+	params[17] = 0x1F;
+}
--- a/libgsmhr1/tw_gsmhr.h	Thu Feb 13 00:14:09 2025 +0000
+++ b/libgsmhr1/tw_gsmhr.h	Thu Feb 13 00:41:21 2025 +0000
@@ -68,6 +68,7 @@
 
 int gsmhr_ts101318_is_perfect_sid(const uint8_t *payload);
 void gsmhr_ts101318_set_sid_codeword(uint8_t *payload);
+void gsmhr_set_sid_cw_params(int16_t *params);
 
 /* public const data items */