view pcmu2efr/gen160.c @ 21:3eb407b08b4c

pcmu2efr: confirm that we got 280 distinct outputs so far
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 12 May 2024 03:15:23 +0000
parents 528eef871e23
children f4420403219a
line wrap: on
line source

/*
 * The code in this module generates 160 versions of linearized seqsyncu,
 * shifted by one sample each, intended for feeding to EFR and AMR encoders.
 */

#include <stdint.h>

extern const uint8_t seqsyncu_last_frame[160];
extern const uint16_t pcmu_decode_table[256];

uint16_t linear_inputs[160][160];

static void
gen_first_seq(void)
{
	unsigned n;

	for (n = 0; n < 160; n++)
		linear_inputs[0][n] = pcmu_decode_table[seqsyncu_last_frame[n]];
}

static void
gen_sequence_m(unsigned m)
{
	unsigned n, s;

	for (n = 0; n < m; n++)
		linear_inputs[m][n] = 0x0008;
	for (s = 0; n < 160; n++, s++)
		linear_inputs[m][n] = linear_inputs[0][s];
}

void
generate_linear_inputs(void)
{
	unsigned m;

	gen_first_seq();
	for (m = 1; m < 160; m++)
		gen_sequence_m(m);
}