diff pcmu2efr/gen-efr.c @ 15:528eef871e23

pcmu2efr project started
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 16 Apr 2024 23:30:49 +0000
parents
children f4420403219a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcmu2efr/gen-efr.c	Tue Apr 16 23:30:49 2024 +0000
@@ -0,0 +1,32 @@
+/*
+ * The code in this module takes linear_inputs[][] from gen160.c
+ * and generates standard EFR-encoded frames.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <gsm_efr.h>
+
+extern uint16_t linear_inputs[160][160];
+
+uint8_t standard_efr[160][31];
+
+void
+generate_std_efr(void)
+{
+	struct EFR_encoder_state *st;
+	unsigned m;
+
+	st = EFR_encoder_create(0);
+	if (!st) {
+		fprintf(stderr, "error: EFR_encoder_create() failed\n");
+		exit(1);
+	}
+	for (m = 0; m < 160; m++) {
+		EFR_encoder_reset(st, 0);
+		EFR_encode_frame(st, (const int16_t *) linear_inputs[m],
+				 standard_efr[m], (int *) 0, (int *) 0);
+	}
+	free(st);
+}