diff pcma2efr/gen160.c @ 28:4f47447fd17f

pcma2efr: starting with DHF check
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 13 May 2024 02:45:17 +0000
parents pcmu2efr/gen160.c@f4420403219a
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcma2efr/gen160.c	Mon May 13 02:45:17 2024 +0000
@@ -0,0 +1,29 @@
+/*
+ * The code in this module generates 160 versions of linearized seqsynca,
+ * shifted by one sample each, intended for feeding to EFR and AMR encoders.
+ *
+ * Update: the new version generates a linear array of 480 16-bit PCM samples,
+ * where the first 160 are 0x0008, followed by two copies of linearized
+ * seqsynca.
+ */
+
+#include <stdint.h>
+
+extern const uint8_t seqsynca_last_frame[160];
+extern const uint16_t pcma_decode_table[256];
+
+uint16_t linear_input_array[480];
+
+void
+generate_linear_inputs(void)
+{
+	unsigned n;
+	uint16_t lin;
+
+	for (n = 0; n < 160; n++) {
+		lin = pcma_decode_table[seqsynca_last_frame[n]];
+		linear_input_array[n] = 0x0008;
+		linear_input_array[160+n] = lin;
+		linear_input_array[320+n] = lin;
+	}
+}