annotate libgsmfr2/pp_state.c @ 548:583dc4cbee95

efrtest: new program gsmefr-decode-tw5-r
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 04 Oct 2024 20:40:42 +0000
parents 3a617e4e9b27
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we implement allocation and initialization
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * of state structures for our GSM FR preprocessor.
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
4
286d5f097eb4 libgsmfrp: implement comfort noise generation
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
6 #include <stdint.h>
3
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdlib.h>
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <string.h>
256
a33edf624061 libgsmfr2: start with API definition and port of libgsmfrp code
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
9 #include "tw_gsmfr.h"
262
573afa985df6 libgsmfr2: split pp_state.h from pp_internal.h
Mychaela Falconia <falcon@freecalypso.org>
parents: 256
diff changeset
10 #include "pp_state.h"
3
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
533
3a617e4e9b27 libgsmfr2: add const words with struct sizes
Mychaela Falconia <falcon@freecalypso.org>
parents: 262
diff changeset
12 const unsigned gsmfr_preproc_state_size = sizeof(struct gsmfr_preproc_state);
3a617e4e9b27 libgsmfr2: add const words with struct sizes
Mychaela Falconia <falcon@freecalypso.org>
parents: 262
diff changeset
13
3
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 struct gsmfr_preproc_state *gsmfr_preproc_create(void)
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 {
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 struct gsmfr_preproc_state *st;
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 st = malloc(sizeof(struct gsmfr_preproc_state));
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 if (st)
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 gsmfr_preproc_reset(st);
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 return st;
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 }
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 void gsmfr_preproc_reset(struct gsmfr_preproc_state *st)
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 {
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 memset(st, 0, sizeof(struct gsmfr_preproc_state));
4
286d5f097eb4 libgsmfrp: implement comfort noise generation
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
27 st->cn_random_lfsr = PN_INITIAL_SEED;
3
3cd5ad24b1d4 libgsmfrp: implement internal state
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 }