libosmocodec 1.10.0.27-aec32
Osmocom codec library
gsm620.c File Reference

GSM 06.20 - GSM HR codec. More...

#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <osmocom/codec/codec.h>

Functions

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...
 
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...
 

Variables

const uint16_t gsm620_unvoiced_bitorder [112]
 
const uint16_t gsm620_voiced_bitorder [112]
 

Detailed Description

GSM 06.20 - GSM HR codec.

Function Documentation

◆ osmo_hr_check_sid()

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.

Parameters
[in]rtp_payloadBuffer with RTP payload
[in]payload_lenLength of payload
Returns
true if code word is found, false otherwise

Note that this function checks only for a perfect, error-free SID. Unlike GSM 06.31 for FR or GSM 06.81 for EFR, GSM 06.41 spec for HR does not prescribe exact bit counting rules, hence detection of partially corrupted SID frames in downstream network elements without out-of-band indication is not possible.

References GSM_HR_BYTES.

◆ osmo_hr_sid_reset()

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_payloadBuffer 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.

Variable Documentation

◆ gsm620_unvoiced_bitorder

const uint16_t gsm620_unvoiced_bitorder[112]

◆ gsm620_voiced_bitorder

const uint16_t gsm620_voiced_bitorder[112]