summaryrefslogtreecommitdiffstats
path: root/include/osmocom/codec/codec.h
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-05-25 18:13:51 +0200
committerHolger Freyther <holger@freyther.de>2016-05-31 10:11:51 +0000
commit92db150488bdadf6577a4968feabd5a3ab694c5e (patch)
treebbe91ee76c6dd6e41077ba22d29dc9c574b13516 /include/osmocom/codec/codec.h
parentadef12a3497d14aafe677b77b468b952f4c6b5d5 (diff)
Add helper functions for AMR codec
* add functions to encode/decode various codec paramters from RTP payload with AMR frame according to RFC 4867 * those functions are extended version based on code from osmo-bts' amr.c by Andreas Eversberg * add corresponding enum types and strings for logging * add regression tests It's useful both to replace manual parsing in osmo-bts with fuctions covered by test suite and as a debugging helpers for issues related to AMR. Change-Id: Ia217679a07d3fbc970f435e20f6eac33d34bd597 Related: OS#1562 Reviewed-on: https://gerrit.osmocom.org/118 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
Diffstat (limited to 'include/osmocom/codec/codec.h')
-rw-r--r--include/osmocom/codec/codec.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/osmocom/codec/codec.h b/include/osmocom/codec/codec.h
index d126e0f7..b7bcc788 100644
--- a/include/osmocom/codec/codec.h
+++ b/include/osmocom/codec/codec.h
@@ -2,6 +2,8 @@
#include <stdint.h>
+#include <osmocom/core/utils.h>
+
extern const uint16_t gsm610_bitorder[]; /* FR */
extern const uint16_t gsm620_unvoiced_bitorder[]; /* HR unvoiced */
extern const uint16_t gsm620_voiced_bitorder[]; /* HR voiced */
@@ -15,3 +17,32 @@ extern const uint16_t gsm690_6_7_bitorder[]; /* AMR 6.7 kbits */
extern const uint16_t gsm690_5_9_bitorder[]; /* AMR 5.9 kbits */
extern const uint16_t gsm690_5_15_bitorder[]; /* AMR 5.15 kbits */
extern const uint16_t gsm690_4_75_bitorder[]; /* AMR 4.75 kbits */
+
+extern const struct value_string osmo_amr_type_names[];
+
+enum osmo_amr_type {
+ AMR_4_75 = 0,
+ AMR_5_15 = 1,
+ AMR_5_90 = 2,
+ AMR_6_70 = 3,
+ AMR_7_40 = 4,
+ AMR_7_95 = 5,
+ AMR_10_2 = 6,
+ AMR_12_2 = 7,
+ AMR_SID = 8,
+ AMR_GSM_EFR_SID = 9,
+ AMR_TDMA_EFR_SID = 10,
+ AMR_PDC_EFR_SID = 11,
+ AMR_NO_DATA = 15,
+};
+
+enum osmo_amr_quality {
+ AMR_BAD = 0,
+ AMR_GOOD = 1
+};
+
+int osmo_amr_rtp_enc(uint8_t *payload, uint8_t cmr, enum osmo_amr_type ft,
+ enum osmo_amr_quality bfi);
+int osmo_amr_rtp_dec(const uint8_t *payload, int payload_len, uint8_t *cmr,
+ int8_t *cmi, enum osmo_amr_type *ft,
+ enum osmo_amr_quality *bfi, int8_t *sti);