libosmocodec 1.10.0.27-aec32
Osmocom codec library
|
GSM 06.90 - GSM AMR Codec. More...
#include <stdint.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/bits.h>
#include <osmocom/codec/codec.h>
Data Structures | |
struct | ts26101_reorder_table |
Functions | |
int | osmo_amr_s_to_d (ubit_t *out, const ubit_t *in, uint16_t n_bits, enum osmo_amr_type amr_mode) |
Convert from S-bits (codec output) to d-bits. More... | |
int | osmo_amr_d_to_s (ubit_t *out, const ubit_t *in, uint16_t n_bits, enum osmo_amr_type amr_mode) |
Convert from d-bits to s-bits (codec input). More... | |
int | osmo_amr_rtp_dec (const uint8_t *rtppayload, int payload_len, uint8_t *cmr, int8_t *cmi, enum osmo_amr_type *ft, enum osmo_amr_quality *bfi, int8_t *sti) |
Decode various AMR parameters from RTP payload (RFC 4867) acording to 3GPP TS 26.101. More... | |
int | osmo_amr_rtp_enc (uint8_t *payload, uint8_t cmr, enum osmo_amr_type ft, enum osmo_amr_quality bfi) |
Encode various AMR parameters from RTP payload (RFC 4867) More... | |
Variables | |
const uint16_t | gsm690_12_2_bitorder [244] |
const uint16_t | gsm690_10_2_bitorder [204] |
const uint16_t | gsm690_7_95_bitorder [159] |
const uint16_t | gsm690_7_4_bitorder [148] |
const uint16_t | gsm690_6_7_bitorder [134] |
const uint16_t | gsm690_5_9_bitorder [118] |
const uint16_t | gsm690_5_15_bitorder [103] |
const uint16_t | gsm690_4_75_bitorder [95] |
const uint8_t | gsm690_bitlength [AMR_NO_DATA+1] |
These constants refer to the length of one "AMR core frame" as per TS 26.101 Section 4.2.2 / Table 2. More... | |
static const struct ts26101_reorder_table | ts26101_reorder_tables [8] |
static const uint8_t | amr_len_by_ft [16] |
const struct value_string | osmo_amr_type_names [] |
GSM 06.90 - GSM AMR Codec.
int osmo_amr_d_to_s | ( | ubit_t * | out, |
const ubit_t * | in, | ||
uint16_t | n_bits, | ||
enum osmo_amr_type | amr_mode | ||
) |
Convert from d-bits to s-bits (codec input).
[out] | out | user-provided output buffer for generated unpacked s-bits |
[in] | in | input buffer for unpacked d-bits |
[in] | n_bits | number of bits (in both in and out) |
[in] | AMR | mode (0..7) |
References ARRAY_SIZE, ts26101_reorder_table::len, n, ts26101_reorder_table::s_to_d, and ts26101_reorder_tables.
int osmo_amr_rtp_dec | ( | const uint8_t * | rtppayload, |
int | payload_len, | ||
uint8_t * | cmr, | ||
int8_t * | cmi, | ||
enum osmo_amr_type * | ft, | ||
enum osmo_amr_quality * | bfi, | ||
int8_t * | sti | ||
) |
Decode various AMR parameters from RTP payload (RFC 4867) acording to 3GPP TS 26.101.
[in] | rtppayload | Payload from RTP packet |
[in] | payload_len | length of rtppayload |
[out] | cmr | AMR Codec Mode Request, not filled if NULL |
[out] | cmi | AMR Codec Mode Indicator, -1 if not applicable for this type, not filled if NULL |
[out] | ft | AMR Frame Type, not filled if NULL |
[out] | bfi | AMR Bad Frame Indicator, not filled if NULL |
[out] | sti | AMR SID Type Indicator, -1 if not applicable for this type, not filled if NULL |
References amr_len_by_ft, AMR_SID, ENOTSUP, and type.
int osmo_amr_rtp_enc | ( | uint8_t * | payload, |
uint8_t | cmr, | ||
enum osmo_amr_type | ft, | ||
enum osmo_amr_quality | bfi | ||
) |
Encode various AMR parameters from RTP payload (RFC 4867)
[out] | payload | Payload for RTP packet, contains speech data (if any) except for have 2 first bytes where header will be built |
[in] | cmr | AMR codec Mode Request |
[in] | ft | AMR Frame Type |
[in] | bfi | AMR Bad Frame Indicator |
Note: only octet-aligned mode is supported so the header occupies 2 full bytes. Optional interleaving header is not supported.
References amr_len_by_ft, and ENOTSUP.
int osmo_amr_s_to_d | ( | ubit_t * | out, |
const ubit_t * | in, | ||
uint16_t | n_bits, | ||
enum osmo_amr_type | amr_mode | ||
) |
Convert from S-bits (codec output) to d-bits.
[out] | out | user-provided output buffer for generated unpacked d-bits |
[in] | in | input buffer for unpacked s-bits |
[in] | n_bits | number of bits (in both in and out) |
[in] | AMR | mode (0..7) |
References ARRAY_SIZE, ts26101_reorder_table::len, n, ts26101_reorder_table::s_to_d, and ts26101_reorder_tables.
|
static |
Referenced by osmo_amr_rtp_dec(), and osmo_amr_rtp_enc().
const uint16_t gsm690_10_2_bitorder[204] |
const uint16_t gsm690_12_2_bitorder[244] |
const uint16_t gsm690_4_75_bitorder[95] |
const uint16_t gsm690_5_15_bitorder[103] |
const uint16_t gsm690_5_9_bitorder[118] |
const uint16_t gsm690_6_7_bitorder[134] |
const uint16_t gsm690_7_4_bitorder[148] |
const uint16_t gsm690_7_95_bitorder[159] |
const uint8_t gsm690_bitlength[AMR_NO_DATA+1] |
const struct value_string osmo_amr_type_names[] |
Referenced by osmo_amr_type_name().
|
static |
Referenced by osmo_amr_d_to_s(), and osmo_amr_s_to_d().