annotate dev/gsm0611-silence-fr.c @ 458:e26b974f7ba3

doc/AMR-study-utils: update for the current situation
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 10 May 2024 18:45:36 +0000
parents e4ca04586118
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This program is meant to be run only once by the developer - it uses
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * libgsm function gsm_implode() to transform the idle frame of GSM 06.11
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * (3GPP TS 46.011) from the table format given in the spec into
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * libgsm/RTP format.
276
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
6 *
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
7 * Later update: this program has been reworked to use the local function
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
8 * in pack_gsmfr_rtp.c instead of gsm_implode(), in order to eliminate
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
9 * all build dependencies on old libgsm.
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 */
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <stdio.h>
276
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
13 #include <stdint.h>
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include <stdlib.h>
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include <string.h>
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #include <strings.h>
276
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
17
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
18 extern void gsmfr_pack_to_rtp(const int16_t *params, uint8_t *frame);
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
276
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
20 static const int16_t lar_params[8] = {42, 39, 21, 10, 9, 4, 3, 2};
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
21 static const int16_t subframe_params[17] =
25
61cb83bd11ec GSM 06.11 silence frame: it's Nc=40 first, then bc=0
Mychaela Falconia <falcon@freecalypso.org>
parents: 1
diff changeset
22 {40, 0, 1, 0, 3, 4, 3, 4, 4, 3, 3, 3, 3, 4, 4, 3, 3};
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 main(argc, argv)
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 char **argv;
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 {
276
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
27 int16_t params[76];
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
28 uint8_t frame[33];
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 unsigned n;
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 /* gather params */
276
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
32 bcopy(lar_params, params, sizeof(int16_t) * 8);
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
33 bcopy(subframe_params, params + 8, sizeof(int16_t) * 17);
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
34 bcopy(subframe_params, params + 25, sizeof(int16_t) * 17);
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
35 bcopy(subframe_params, params + 42, sizeof(int16_t) * 17);
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
36 bcopy(subframe_params, params + 59, sizeof(int16_t) * 17);
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 /* generate frame */
276
e4ca04586118 dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents: 25
diff changeset
38 gsmfr_pack_to_rtp(params, frame);
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 /* print the frame */
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 for (n = 0; n < 33; n++) {
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 printf("0x%02X,", frame[n]);
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 if (n == 4 || n == 11 || n == 18 || n == 25 || n == 32)
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 putchar('\n');
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 else
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 putchar(' ');
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 }
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 exit(0);
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 }