FreeCalypso > hg > gsm-codec-lib
annotate dev/gsmfr-dhf.c @ 485:751f06541fbb
doc/Codec-utils: clarify lack of DHF in gsmfr-decode-rb
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 20 May 2024 01:47:22 +0000 |
parents | 37dc5c84bbe9 |
children |
rev | line source |
---|---|
1
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
277
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
2 * This program is meant to be run only once by the developer - it |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
3 * generates RTP-packed form of the decoder homing frame for GSM-FR, |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
4 * as specified in more recent versions of GSM 06.10 spec. |
1
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */ |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
276
e4ca04586118
dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents:
25
diff
changeset
|
8 #include <stdint.h> |
1
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdlib.h> |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <string.h> |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <strings.h> |
276
e4ca04586118
dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents:
25
diff
changeset
|
12 |
e4ca04586118
dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents:
25
diff
changeset
|
13 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
|
14 |
277
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
15 static const int16_t larc[8] = {9, 23, 15, 8, 7, 3, 3, 2}; |
1
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 main(argc, argv) |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 char **argv; |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 { |
277
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
20 int16_t params[76], *pp; |
276
e4ca04586118
dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents:
25
diff
changeset
|
21 uint8_t frame[33]; |
277
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
22 unsigned m, n; |
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 /* gather params */ |
277
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
25 bcopy(larc, params, sizeof(int16_t) * 8); |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
26 pp = params + 8; |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
27 for (m = 0; m < 4; m++) { |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
28 *pp++ = 40; |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
29 *pp++ = 0; |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
30 *pp++ = 0; |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
31 *pp++ = 0; |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
32 for (n = 0; n < 13; n++) { |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
33 if (m == 3 && n == 4) |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
34 *pp++ = 3; |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
35 else |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
36 *pp++ = 4; |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
37 } |
37dc5c84bbe9
dev: generate RTP-packed GSM-FR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
276
diff
changeset
|
38 } |
1
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 /* generate frame */ |
276
e4ca04586118
dev/gsm0611-silence-fr: rework to eliminate libgsm dependency
Mychaela Falconia <falcon@freecalypso.org>
parents:
25
diff
changeset
|
40 gsmfr_pack_to_rtp(params, frame); |
1
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 /* print the frame */ |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 for (n = 0; n < 33; n++) { |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 printf("0x%02X,", frame[n]); |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 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
|
45 putchar('\n'); |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 else |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 putchar(' '); |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 } |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 exit(0); |
6780b23654bd
libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 } |