annotate libgsmefr/gsm_efr.h @ 585:3c6bf0d26ee7 default tip

TW-TS-005 reader: fix maximum line length bug TW-TS-005 section 4.1 states: The maximum allowed length of each line is 80 characters, not including the OS-specific newline encoding. The implementation of this line length limit in the TW-TS-005 hex file reader function in the present suite was wrong, such that lines of the full maximum length could not be read. Fix it. Note that this bug affects comment lines too, not just actual RTP payloads. Neither Annex A nor Annex B features an RTP payload format that goes to the maximum of 40 bytes, but if a comment line goes to the maximum allowed length of 80 characters not including the terminating newline, the bug will be triggered, necessitating the present fix.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 25 Feb 2025 07:49:28 +0000
parents f2d0f2f15d5f
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 /*
425
9499d12d315b libgsmefr/gsm_efr.h: update header comment
Mychaela Falconia <falcon@freecalypso.org>
parents: 33
diff changeset
2 * This header file is the external public interface to libgsmefr:
9499d12d315b libgsmefr/gsm_efr.h: update header comment
Mychaela Falconia <falcon@freecalypso.org>
parents: 33
diff changeset
3 * Themyscira Wireless implementation of GSM-EFR speech codec
9499d12d315b libgsmefr/gsm_efr.h: update header comment
Mychaela Falconia <falcon@freecalypso.org>
parents: 33
diff changeset
4 * based on the original ETSI code of GSM 06.53, adapted to the
9499d12d315b libgsmefr/gsm_efr.h: update header comment
Mychaela Falconia <falcon@freecalypso.org>
parents: 33
diff changeset
5 * RTP frame format of ETSI TS 101 318.
9499d12d315b libgsmefr/gsm_efr.h: update header comment
Mychaela Falconia <falcon@freecalypso.org>
parents: 33
diff changeset
6 *
9499d12d315b libgsmefr/gsm_efr.h: update header comment
Mychaela Falconia <falcon@freecalypso.org>
parents: 33
diff changeset
7 * This header file should be installed in some system include directory
9499d12d315b libgsmefr/gsm_efr.h: update header comment
Mychaela Falconia <falcon@freecalypso.org>
parents: 33
diff changeset
8 * such that it can be included by C sources as <gsm_efr.h>.
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 */
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
30
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
11 #ifndef __GSM_EFR_H
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
12 #define __GSM_EFR_H
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
30
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
14 #include <stdint.h>
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
33
88468d5b3590 libgsmefr: implement frame packing
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
16 #define EFR_RTP_FRAME_LEN 31
88468d5b3590 libgsmefr: implement frame packing
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
17 #define EFR_NUM_PARAMS 57
88468d5b3590 libgsmefr: implement frame packing
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
18
30
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
19 struct EFR_encoder_state; /* opaque to external users */
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
20 struct EFR_decoder_state; /* ditto */
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
30
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
22 extern struct EFR_encoder_state *EFR_encoder_create(int dtx);
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
23 extern struct EFR_decoder_state *EFR_decoder_create(void);
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
24 /* use standard free() call to free both afterward */
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 /* reset state to initial */
30
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
27 extern void EFR_encoder_reset(struct EFR_encoder_state *st, int dtx);
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
28 extern void EFR_decoder_reset(struct EFR_decoder_state *st);
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
29
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
30 /* encoder public functions */
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
31
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
32 extern void EFR_encode_params(struct EFR_encoder_state *st, const int16_t *pcm,
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
33 int16_t *params, int *sp, int *vad);
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
34 extern void EFR_encode_frame(struct EFR_encoder_state *st, const int16_t *pcm,
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
35 uint8_t *frame, int *sp, int *vad);
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
36
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
37 /* decoder public functions */
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
30
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
39 extern void EFR_decode_params(struct EFR_decoder_state *st,
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
40 const int16_t *params, int bfi, int sid, int taf,
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
41 int16_t *pcm);
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
42 extern void EFR_decode_frame(struct EFR_decoder_state *st, const uint8_t *frame,
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
43 int bfi, int taf, int16_t *pcm);
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
44 extern void EFR_decode_bfi_nodata(struct EFR_decoder_state *st, int taf,
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
45 int16_t *pcm);
542
f2d0f2f15d5f libgsmefr: add wrapper for TW-TS-001 RTP input
Mychaela Falconia <falcon@freecalypso.org>
parents: 541
diff changeset
46 extern int EFR_decode_rtp(struct EFR_decoder_state *st, const uint8_t *rtp_pl,
f2d0f2f15d5f libgsmefr: add wrapper for TW-TS-001 RTP input
Mychaela Falconia <falcon@freecalypso.org>
parents: 541
diff changeset
47 unsigned rtp_pl_len, int16_t *pcm);
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48
30
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
49 /* stateless utility functions */
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50
30
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
51 extern int EFR_sid_classify(const uint8_t *frame);
2272ba6f6879 libgsmefr: beginning with API definition
Mychaela Falconia <falcon@freecalypso.org>
parents: 2
diff changeset
52 extern void EFR_frame2params(const uint8_t *frame, int16_t *params);
33
88468d5b3590 libgsmefr: implement frame packing
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
53 extern void EFR_params2frame(const int16_t *params, uint8_t *frame);
88468d5b3590 libgsmefr: implement frame packing
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
54 extern void EFR_insert_sid_codeword(uint8_t *frame);
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55
470
ea89eb8291bf libgsmefr: add RTP-encoded DHF const datum to public API
Mychaela Falconia <falcon@freecalypso.org>
parents: 425
diff changeset
56 /* public const data item */
ea89eb8291bf libgsmefr: add RTP-encoded DHF const datum to public API
Mychaela Falconia <falcon@freecalypso.org>
parents: 425
diff changeset
57
ea89eb8291bf libgsmefr: add RTP-encoded DHF const datum to public API
Mychaela Falconia <falcon@freecalypso.org>
parents: 425
diff changeset
58 extern const uint8_t EFR_decoder_homing_frame[EFR_RTP_FRAME_LEN];
ea89eb8291bf libgsmefr: add RTP-encoded DHF const datum to public API
Mychaela Falconia <falcon@freecalypso.org>
parents: 425
diff changeset
59
541
23656d874524 libgsmefr: add const words with struct sizes
Mychaela Falconia <falcon@freecalypso.org>
parents: 470
diff changeset
60 /* sizes of state structures, to support alternative malloc schemes */
23656d874524 libgsmefr: add const words with struct sizes
Mychaela Falconia <falcon@freecalypso.org>
parents: 470
diff changeset
61
23656d874524 libgsmefr: add const words with struct sizes
Mychaela Falconia <falcon@freecalypso.org>
parents: 470
diff changeset
62 extern const unsigned EFR_encoder_state_size;
23656d874524 libgsmefr: add const words with struct sizes
Mychaela Falconia <falcon@freecalypso.org>
parents: 470
diff changeset
63 extern const unsigned EFR_decoder_state_size;
23656d874524 libgsmefr: add const words with struct sizes
Mychaela Falconia <falcon@freecalypso.org>
parents: 470
diff changeset
64
1
6780b23654bd libgsmfrp: starting with the silence frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 #endif /* include guard */