FreeCalypso > hg > vband-misc
diff pcmu2efr/gen160.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/gen160.c Tue Apr 16 23:30:49 2024 +0000 @@ -0,0 +1,41 @@ +/* + * 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); +}