|
static const char * | osmo_amr_type_name (enum osmo_amr_type type) |
|
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...
|
|
static bool | osmo_amr_is_speech (enum osmo_amr_type ft) |
| Check if given AMR Frame Type is a speech frame. More...
|
|
bool | osmo_fr_check_sid (const uint8_t *rtp_payload, size_t payload_len) |
| Check whether RTP frame contains FR SID code word according to TS 101 318 §5.1.2. More...
|
|
bool | osmo_hr_check_sid (const uint8_t *rtp_payload, size_t payload_len) |
| Check whether RTP frame contains HR SID code word according to TS 101 318 §5.2.2. More...
|
|
bool | osmo_efr_check_sid (const uint8_t *rtp_payload, size_t payload_len) |
| Check whether RTP frame contains EFR SID code word according to TS 101 318 §5.3.2. More...
|
|
enum osmo_gsm631_sid_class | osmo_fr_sid_classify (const uint8_t *rtp_payload) |
| Classify potentially-SID FR codec frame in RTP format according to the rules of GSM 06.31 §6.1.1. More...
|
|
enum osmo_gsm631_sid_class | osmo_efr_sid_classify (const uint8_t *rtp_payload) |
| Classify potentially-SID EFR codec frame in RTP format according to the rules of GSM 06.81 §6.1.1. More...
|
|
enum osmo_gsm631_sid_class | osmo_hr_sid_classify (const uint8_t *rtp_payload, bool bci_flag, bool *bfi_from_bci) |
|
static bool | osmo_fr_is_any_sid (const uint8_t *rtp_payload) |
| Check if given FR codec frame is any kind of SID, valid or invalid. More...
|
|
static bool | osmo_efr_is_any_sid (const uint8_t *rtp_payload) |
| Check if given EFR codec frame is any kind of SID, valid or invalid. More...
|
|
bool | osmo_fr_sid_preen (uint8_t *rtp_payload) |
| Preen potentially-SID FR codec frame in RTP format, ensuring that it is either a speech frame or a valid SID, and if the latter, making it a perfect, error-free SID frame. More...
|
|
bool | osmo_efr_sid_preen (uint8_t *rtp_payload) |
| Preen potentially-SID EFR codec frame in RTP format, ensuring that it is either a speech frame or a valid SID, and if the latter, making it a perfect, error-free SID frame. More...
|
|
void | osmo_fr_sid_reset (uint8_t *rtp_payload) |
| Reset the SID field and the unused bits of a potentially corrupted, but still valid GSM-FR SID frame in RTP encoding to their pristine state. More...
|
|
void | osmo_hr_sid_reset (uint8_t *rtp_payload) |
| Reset the SID field of a potentially corrupted, but still valid GSM-HR SID frame in TS 101 318 format to its pristine state (full SID codeword). More...
|
|
void | osmo_efr_sid_reset (uint8_t *rtp_payload) |
| Reset the SID field of a potentially corrupted, but still valid GSM-EFR SID frame in RTP encoding to its pristine state (full SID code word). 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...
|
|
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) |
| Decode various AMR parameters from RTP payload (RFC 4867) acording to 3GPP TS 26.101. More...
|
|
Classify potentially-SID EFR codec frame in RTP format according to the rules of GSM 06.81 §6.1.1.
- Parameters
-
[in] | rtp_payload | Buffer with RTP payload |
- Returns
- enum osmo_gsm631_sid_class, with symbolic values OSMO_GSM631_SID_CLASS_SPEECH, OSMO_GSM631_SID_CLASS_INVALID or OSMO_GSM631_SID_CLASS_VALID corresponding to the 3 possible bit-counting classifications prescribed by the spec.
Differences between the more familiar osmo_efr_check_sid() and the present function are:
- osmo_efr_check_sid() returns true only if the SID frame is absolutely perfect, with all 95 bits of the SID code word set. However, the rules of GSM 06.81 §6.1.1 allow up to one bit to be in error, and the frame is still accepted as valid SID.
- The third possible state of invalid SID is not handled at all by the simpler osmo_efr_check_sid() function.
- osmo_efr_check_sid() includes a check for 0xC RTP signature, and returns false if that signature nibble is wrong. That check is not included in the present version because there is no place for it in the ETSI-prescribed classification, it is neither speech nor SID. The assumption is that this function is used to classify the bit content of received codec frames, not their RTP encoding - the latter needs to be validated beforehand.
Which function should one use? The answer depends on the specific circumstances, and needs to be addressed on a case-by-case basis.
References ARRAY_SIZE, bitvec_get_bit_pos(), bitvec::data, bitvec::data_len, GSM_EFR_BYTES, n, ONE, OSMO_GSM631_SID_CLASS_INVALID, OSMO_GSM631_SID_CLASS_SPEECH, OSMO_GSM631_SID_CLASS_VALID, and sid_code_word_bits.
Referenced by osmo_efr_is_any_sid(), and osmo_efr_sid_preen().
void osmo_efr_sid_reset |
( |
uint8_t * |
rtp_payload | ) |
|
Reset the SID field of a potentially corrupted, but still valid GSM-EFR SID frame in RTP encoding to its pristine state (full SID code word).
- Parameters
-
[in] | rtp_payload | Buffer with RTP payload - must be writable! |
Per GSM 06.62 section 5.3, a freshly minted SID frame consists of 58 bits of comfort noise parameters (LSF and 4 times fixed codebook gain), 95 bits of SID code word (all 1s) and 91 unused bits (all 0s). Network elements that receive SID frames from call leg A uplink and need to retransmit them on leg B downlink should "rejuvenate" received SID frames prior to retransmission by resetting the SID field to its pristine state of all 1s; this function does the job.
Potential TODO: it would be nice to also zero out the remaining 91 bits which the spec leaves as reserved, clearing out leg A radio bit errors - but do we really need to?
Referenced by osmo_efr_sid_preen().
Classify potentially-SID FR codec frame in RTP format according to the rules of GSM 06.31 §6.1.1.
- Parameters
-
[in] | rtp_payload | Buffer with RTP payload |
- Returns
- enum osmo_gsm631_sid_class, with symbolic values OSMO_GSM631_SID_CLASS_SPEECH, OSMO_GSM631_SID_CLASS_INVALID or OSMO_GSM631_SID_CLASS_VALID corresponding to the 3 possible bit-counting classifications prescribed by the spec.
Differences between the more familiar osmo_fr_check_sid() and the present function are:
- osmo_fr_check_sid() returns true only if the SID frame is absolutely perfect, with all 95 bits of the SID code word zeroed. However, the rules of GSM 06.31 §6.1.1 allow up to one bit to be in error, and the frame is still accepted as valid SID.
- The third possible state of invalid SID is not handled at all by the simpler osmo_fr_check_sid() function.
- osmo_fr_check_sid() includes a check for 0xD RTP signature, and returns false if that signature nibble is wrong. That check is not included in the present version because there is no place for it in the ETSI-prescribed classification, it is neither speech nor SID. The assumption is that this function is used to classify the bit content of received codec frames, not their RTP encoding - the latter needs to be validated beforehand.
Which function should one use? The answer depends on the specific circumstances, and needs to be addressed on a case-by-case basis.
References ARRAY_SIZE, bitvec_get_bit_pos(), bitvec::data, bitvec::data_len, GSM_FR_BYTES, n, OSMO_GSM631_SID_CLASS_INVALID, OSMO_GSM631_SID_CLASS_SPEECH, OSMO_GSM631_SID_CLASS_VALID, sid_code_word_bits, and ZERO.
Referenced by fr_ecu_input(), osmo_fr_is_any_sid(), and osmo_fr_sid_preen().
void osmo_fr_sid_reset |
( |
uint8_t * |
rtp_payload | ) |
|
Reset the SID field and the unused bits of a potentially corrupted, but still valid GSM-FR SID frame in RTP encoding to their pristine state.
- Parameters
-
[in] | rtp_payload | Buffer with RTP payload - must be writable! |
Per GSM 06.12 section 5.2, a freshly minted SID frame carries 60 bits of comfort noise parameters (LARc and 4 times Xmaxc), while the remaining 200 bits are all zeros; the latter 200 all-0 bits further break down into 95 bits of SID field (checked by receivers to detect SID) and 105 unused bits which receivers are told to ignore. Network elements that receive SID frames from call leg A uplink and need to retransmit them on leg B downlink should "rejuvenate" received SID frames prior to retransmission; this function does the job.
Referenced by osmo_fr_sid_preen().
void osmo_hr_sid_reset |
( |
uint8_t * |
rtp_payload | ) |
|
Reset the SID field of a potentially corrupted, but still valid GSM-HR SID frame in TS 101 318 format to its pristine state (full SID codeword).
- Parameters
-
[in] | rtp_payload | Buffer with RTP payload - must be writable! |
Per GSM 06.22 section 5.3, a freshly minted SID frame consists of 33 bits of comfort noise parameters and 79 bits of SID codeword (all 1s). Network elements that receive SID frames from call leg A uplink and need to retransmit them on leg B downlink should "rejuvenate" received SID frames prior to retransmission by resetting the SID field to its pristine state of all 1s; this function does the job.
Important note: because of HR-specific quirks (lack of exact bit counting rules in GSM 06.41 spec compared to 06.31 & 06.81, plus the fact that such bit counting can only be done efficiently in the GSM 05.03 channel decoder prior to bit reordering based on voiced or unvoiced mode), a generic (usable from any network element) SID classification function similar to osmo_{fr,efr}_sid_classify() unfortunately cannot exist for HR. Therefore, the triggering condition for invoking this SID rejuvenation/reset function can only be an out-of-band SID indication, as in GSM 08.61 TRAU frames or RFC 5993 ToC octet.