libosmocodec 1.10.0.27-aec32
Osmocom codec library
|
GSM 06.60 - GSM EFR Codec. More...
#include <stdint.h>
#include <stdbool.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/utils.h>
#include <osmocom/codec/codec.h>
Functions | |
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_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... | |
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... | |
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... | |
Variables | |
const uint16_t | gsm660_bitorder [260] |
static const uint8_t | sid_code_word_bits [95] |
GSM 06.60 - GSM EFR Codec.
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.
[in] | rtp_payload | Buffer with RTP payload |
[in] | payload_len | Length of payload |
References ARRAY_SIZE, bitvec_get_bit_pos(), bitvec::data, bitvec::data_len, ONE, and sid_code_word_bits.
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.
[in] | rtp_payload | Buffer with RTP payload |
Differences between the more familiar osmo_efr_check_sid() and the present function are:
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().
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.
[in] | rtp_payload | Buffer with RTP payload - must be writable! |
References OSMO_ASSERT, osmo_efr_sid_classify(), osmo_efr_sid_reset(), OSMO_GSM631_SID_CLASS_INVALID, OSMO_GSM631_SID_CLASS_SPEECH, and OSMO_GSM631_SID_CLASS_VALID.
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).
[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().
const uint16_t gsm660_bitorder[260] |
|
static |
Referenced by osmo_efr_check_sid(), and osmo_efr_sid_classify().