libosmocodec 1.10.0.27-aec32
Osmocom codec library
|
GSM 06.10 - GSM FR 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_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... | |
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... | |
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... | |
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... | |
Variables | |
const uint16_t | gsm610_bitorder [260] |
const uint8_t | osmo_gsm611_silence_frame [GSM_FR_BYTES] |
static const uint16_t | sid_code_word_bits [95] |
GSM 06.10 - GSM FR codec.
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.
[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, sid_code_word_bits, and ZERO.
Referenced by conceal_frame().
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.
[in] | rtp_payload | Buffer with RTP payload |
Differences between the more familiar osmo_fr_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_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().
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.
[in] | rtp_payload | Buffer with RTP payload - must be writable! |
References OSMO_ASSERT, osmo_fr_sid_classify(), osmo_fr_sid_reset(), OSMO_GSM631_SID_CLASS_INVALID, OSMO_GSM631_SID_CLASS_SPEECH, and OSMO_GSM631_SID_CLASS_VALID.
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.
[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().
const uint16_t gsm610_bitorder[260] |
const uint8_t osmo_gsm611_silence_frame[GSM_FR_BYTES] |
Referenced by fr_ecu_output().
|
static |
Referenced by osmo_fr_check_sid(), and osmo_fr_sid_classify().