Loading...
Searching...
No Matches
codec.h File Reference
`#include <stdint.h>`
`#include <stdbool.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/core/bits.h>`

Go to the source code of this file.

## Macros

#define | GSM_FR_BYTES 33
#define | GSM_HR_BYTES 14
#define | GSM_EFR_BYTES 31
#define | GSM_HR_BYTES_RTP_RFC5993 (GSM_HR_BYTES + 1)
#define | GSM_HR_BYTES_RTP_TS101318 (GSM_HR_BYTES)

## Enumerations

enum | osmo_amr_type { AMR_4_75 = 0 , AMR_5_15 = 1 , AMR_5_90 = 2 , AMR_6_70 = 3 , AMR_7_40 = 4 , AMR_7_95 = 5 , AMR_10_2 = 6 , AMR_12_2 = 7 , AMR_SID = 8 , AMR_GSM_EFR_SID = 9 , AMR_TDMA_EFR_SID = 10 , AMR_PDC_EFR_SID = 11 , AMR_NO_DATA = 15 }
enum | osmo_amr_quality { AMR_BAD = 0 , AMR_GOOD = 1 }
enum | osmo_gsm631_sid_class { OSMO_GSM631_SID_CLASS_SPEECH = 0 , OSMO_GSM631_SID_CLASS_INVALID = 1 , OSMO_GSM631_SID_CLASS_VALID = 2 }

## Functions

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.
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).
static bool | osmo_amr_is_speech (enum osmo_amr_type ft)
| Check if given AMR Frame Type is a speech frame.
int | osmo_amr_param_to_sbits (ubit_t *s_bits, const uint16_t *param, enum osmo_amr_type mode)
| Convert AMR codec frame from parameters to s-bits.
int | osmo_amr_sbits_to_param (uint16_t *param, const ubit_t *s_bits, enum osmo_amr_type mode)
| Convert AMR codec frame from s-bits to parameters.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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).
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).
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).
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.

## Variables

const uint16_t | gsm610_bitorder []
const uint16_t | gsm620_unvoiced_bitorder []
const uint16_t | gsm620_voiced_bitorder []
const uint16_t | gsm660_bitorder []
const uint16_t | gsm690_12_2_bitorder []
const uint16_t | gsm690_10_2_bitorder []
const uint16_t | gsm690_7_95_bitorder []
const uint16_t | gsm690_7_4_bitorder []
const uint16_t | gsm690_6_7_bitorder []
const uint16_t | gsm690_5_9_bitorder []
const uint16_t | gsm690_5_15_bitorder []
const uint16_t | gsm690_4_75_bitorder []
const uint8_t | osmo_gsm611_silence_frame [GSM_FR_BYTES]
const uint8_t | osmo_gsm620_silence_frame [GSM_HR_BYTES]
const uint8_t | osmo_gsm620_homing_frame [GSM_HR_BYTES]
const uint8_t | osmo_gsm660_homing_frame [GSM_EFR_BYTES]
const struct value_string | osmo_amr_type_names []
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.
const uint8_t | osmo_amr_sbits_per_mode [AMR_NO_DATA+1]
| This table provides the number of s-bits (as defined in TS 26.090 and TS 26.092, clause 7 in each spec) for every possible speech or SID mode in AMR.
const uint8_t | osmo_amr_params_per_mode [AMR_NO_DATA+1]
| This table provides the number of distinct codec parameters (groupings of s-bits into 16-bit parameter words as implemented in 3GPP reference C code and assumed in TS 26.073 definition of decoder homing frames) that exist for every possible speech or SID mode in AMR.
const uint16_t | osmo_amr_dhf_4_75 []
const uint16_t | osmo_amr_dhf_5_15 []
const uint16_t | osmo_amr_dhf_5_90 []
const uint16_t | osmo_amr_dhf_6_70 []
const uint16_t | osmo_amr_dhf_7_40 []
const uint16_t | osmo_amr_dhf_7_95 []
const uint16_t | osmo_amr_dhf_10_2 []
const uint16_t | osmo_amr_dhf_12_2 []

## Macro Definition Documentation

## GSM_EFR_BYTES

#define GSM_EFR_BYTES 31

Referenced by osmo_efr_sid_classify().

## GSM_FR_BYTES

#define GSM_FR_BYTES 33

Referenced by conceal_frame(), ecu_fr_frame_in(), ecu_fr_frame_out(), fr_ecu_input(), fr_ecu_output(), osmo_ecu_fr_conceal(), osmo_ecu_fr_reset(), and osmo_fr_sid_classify().

## GSM_HR_BYTES

#define GSM_HR_BYTES 14

Referenced by osmo_hr_check_sid().

## GSM_HR_BYTES_RTP_RFC5993

#define GSM_HR_BYTES_RTP_RFC5993 (GSM_HR_BYTES + 1)

## GSM_HR_BYTES_RTP_TS101318

#define GSM_HR_BYTES_RTP_TS101318 (GSM_HR_BYTES)

## Enumeration Type Documentation

## osmo_amr_quality

enum osmo_amr_quality

Enumerator
AMR_BAD |
AMR_GOOD |

## osmo_amr_type

enum osmo_amr_type

Enumerator
AMR_4_75 |
AMR_5_15 |
AMR_5_90 |
AMR_6_70 |
AMR_7_40 |
AMR_7_95 |
AMR_10_2 |
AMR_12_2 |
AMR_SID |
AMR_GSM_EFR_SID |
AMR_TDMA_EFR_SID |
AMR_PDC_EFR_SID |
AMR_NO_DATA |

## osmo_gsm631_sid_class

enum osmo_gsm631_sid_class

Enumerator
OSMO_GSM631_SID_CLASS_SPEECH |
OSMO_GSM631_SID_CLASS_INVALID |
OSMO_GSM631_SID_CLASS_VALID |

## Function Documentation

## osmo_amr_d_to_s()

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

Parameters

  [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 ts26101_reorder_table::len, ts26101_reorder_table::s_to_d, and ts26101_reorder_tables.

## osmo_amr_is_speech()

bool osmo_amr_is_speech | ( | enum osmo_amr_type | ft | ) |

inline static

Check if given AMR Frame Type is a speech frame.

Parameters

  [in] | ft | AMR Frame Type

Returns
  true if AMR with given Frame Type contains voice, false otherwise

References AMR_10_2, AMR_12_2, AMR_4_75, AMR_5_15, AMR_5_90, AMR_6_70, AMR_7_40, and AMR_7_95.

## osmo_amr_param_to_sbits()

int osmo_amr_param_to_sbits | ( | ubit_t * | s_bits,
|  | const uint16_t * | param,
|  | enum osmo_amr_type | mode )

Convert AMR codec frame from parameters to s-bits.

Parameters

  [out] | s_bits | Caller-provided array of unpacked bits to be filled with s-bits of the converted codec frame.
  [in] | param | Array of AMR codec speech or SID parameters.
  [in] | mode | Speech or SID mode according to which conversion shall be performed.

Returns
  0 if successful, or negative if mode is invalid.

References AMR_SID, bit_counts_per_mode, and osmo_amr_params_per_mode.

## osmo_amr_rtp_dec()

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.

Parameters

  [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

Returns
  length of AMR data or negative value on error

References amr_len_by_ft, and AMR_SID.

## osmo_amr_rtp_enc()

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

Parameters

  [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

Returns
  length of AMR data (header + ToC + speech data) or negative value on error

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.

## osmo_amr_s_to_d()

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.

Parameters

  [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 ts26101_reorder_table::len, ts26101_reorder_table::s_to_d, and ts26101_reorder_tables.

## osmo_amr_sbits_to_param()

int osmo_amr_sbits_to_param | ( | uint16_t * | param,
|  | const ubit_t * | s_bits,
|  | enum osmo_amr_type | mode )

Convert AMR codec frame from s-bits to parameters.

Parameters

  [out] | param | Caller-provided buffer for array of AMR codec speech or SID parameters.
  [in] | s_bits | Unpacked s-bits of the frame to be converted.
  [in] | mode | Speech or SID mode according to which conversion shall be performed.

Returns
  0 if successful, or negative if mode is invalid.

References AMR_SID, bit_counts_per_mode, and osmo_amr_params_per_mode.

## osmo_amr_type_name()

const char * osmo_amr_type_name | ( | enum osmo_amr_type | type | ) |

inline static

References osmo_amr_type_names.

## osmo_efr_check_sid()

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.

Parameters

  [in] | rtp_payload | Buffer with RTP payload
  [in] | payload_len | Length of payload

Returns
  true if code word is found, false otherwise

References bitvec::data, bitvec::data_len, and sid_code_word_bits.

## osmo_efr_is_any_sid()

bool osmo_efr_is_any_sid | ( | const uint8_t * | rtp_payload | ) |

inline static

Check if given EFR codec frame is any kind of SID, valid or invalid.

Parameters

  [in] | rtp_payload | Buffer with RTP payload

Returns
  true if the frame is an "accepted SID frame" in GSM 06.81 definition, false otherwise.

References osmo_efr_sid_classify(), and OSMO_GSM631_SID_CLASS_SPEECH.

## osmo_efr_sid_classify()

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.

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:

1. 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.
2. The third possible state of invalid SID is not handled at all by the simpler osmo_efr_check_sid() function.
3. 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 bitvec::data, bitvec::data_len, GSM_EFR_BYTES, 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().

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

Parameters

  [in] | rtp_payload | Buffer with RTP payload - must be writable!

Returns
  true if the frame is good, false otherwise

References osmo_efr_sid_classify(), osmo_efr_sid_reset(), OSMO_GSM631_SID_CLASS_INVALID, OSMO_GSM631_SID_CLASS_SPEECH, and OSMO_GSM631_SID_CLASS_VALID.

## osmo_efr_sid_reset()

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

## osmo_fr_check_sid()

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.

Parameters

  [in] | rtp_payload | Buffer with RTP payload
  [in] | payload_len | Length of payload

Returns
  true if code word is found, false otherwise

References bitvec::data, bitvec::data_len, and sid_code_word_bits.

Referenced by conceal_frame().

## osmo_fr_is_any_sid()

bool osmo_fr_is_any_sid | ( | const uint8_t * | rtp_payload | ) |

inline static

Check if given FR codec frame is any kind of SID, valid or invalid.

Parameters

  [in] | rtp_payload | Buffer with RTP payload

Returns
  true if the frame is an "accepted SID frame" in GSM 06.31 definition, false otherwise.

References osmo_fr_sid_classify(), and OSMO_GSM631_SID_CLASS_SPEECH.

## osmo_fr_sid_classify()

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.

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:

1. 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.
2. The third possible state of invalid SID is not handled at all by the simpler osmo_fr_check_sid() function.
3. 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 bitvec::data, bitvec::data_len, GSM_FR_BYTES, OSMO_GSM631_SID_CLASS_INVALID, OSMO_GSM631_SID_CLASS_SPEECH, OSMO_GSM631_SID_CLASS_VALID, and sid_code_word_bits.

Referenced by fr_ecu_input(), osmo_fr_is_any_sid(), and osmo_fr_sid_preen().

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

Parameters

  [in] | rtp_payload | Buffer with RTP payload - must be writable!

Returns
  true if the frame is good, false otherwise

References osmo_fr_sid_classify(), osmo_fr_sid_reset(), OSMO_GSM631_SID_CLASS_INVALID, OSMO_GSM631_SID_CLASS_SPEECH, and OSMO_GSM631_SID_CLASS_VALID.

## osmo_fr_sid_reset()

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

## 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_payload | Buffer with RTP payload
  [in] | payload_len | Length 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_classify()

enum osmo_gsm631_sid_class osmo_hr_sid_classify | ( | const uint8_t * | rtp_payload,
|  | bool | bci_flag,
|  | bool * | bfi_from_bci )

References class2_mask_unvoiced, class2_mask_voiced, count_ones_under_mask(), OSMO_GSM631_SID_CLASS_INVALID, OSMO_GSM631_SID_CLASS_SPEECH, OSMO_GSM631_SID_CLASS_VALID, sid_field_last10_mask, and sid_field_misordered.

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

## Variable Documentation

## gsm610_bitorder

const uint16_t gsm610_bitorder[]

extern

## gsm620_unvoiced_bitorder

const uint16_t gsm620_unvoiced_bitorder[]

extern

## gsm620_voiced_bitorder

const uint16_t gsm620_voiced_bitorder[]

extern

## gsm660_bitorder

const uint16_t gsm660_bitorder[]

extern

## gsm690_10_2_bitorder

const uint16_t gsm690_10_2_bitorder[]

extern

## gsm690_12_2_bitorder

const uint16_t gsm690_12_2_bitorder[]

extern

## gsm690_4_75_bitorder

const uint16_t gsm690_4_75_bitorder[]

extern

## gsm690_5_15_bitorder

const uint16_t gsm690_5_15_bitorder[]

extern

## gsm690_5_9_bitorder

const uint16_t gsm690_5_9_bitorder[]

extern

## gsm690_6_7_bitorder

const uint16_t gsm690_6_7_bitorder[]

extern

## gsm690_7_4_bitorder

const uint16_t gsm690_7_4_bitorder[]

extern

## gsm690_7_95_bitorder

const uint16_t gsm690_7_95_bitorder[]

extern

## gsm690_bitlength

const uint8_t gsm690_bitlength[AMR_NO_DATA+1]

extern

These constants refer to the length of one "AMR core frame" as per TS 26.101 Section 4.2.2 / Table 2.

## osmo_amr_dhf_10_2

const uint16_t osmo_amr_dhf_10_2[]

extern

## osmo_amr_dhf_12_2

const uint16_t osmo_amr_dhf_12_2[]

extern

## osmo_amr_dhf_4_75

const uint16_t osmo_amr_dhf_4_75[]

extern

## osmo_amr_dhf_5_15

const uint16_t osmo_amr_dhf_5_15[]

extern

## osmo_amr_dhf_5_90

const uint16_t osmo_amr_dhf_5_90[]

extern

## osmo_amr_dhf_6_70

const uint16_t osmo_amr_dhf_6_70[]

extern

## osmo_amr_dhf_7_40

const uint16_t osmo_amr_dhf_7_40[]

extern

## osmo_amr_dhf_7_95

const uint16_t osmo_amr_dhf_7_95[]

extern

## osmo_amr_params_per_mode

const uint8_t osmo_amr_params_per_mode[AMR_NO_DATA+1]

extern

This table provides the number of distinct codec parameters (groupings of s-bits into 16-bit parameter words as implemented in 3GPP reference C code and assumed in TS 26.073 definition of decoder homing frames) that exist for every possible speech or SID mode in AMR.

The array is allocated up to AMR_NO_DATA in order to reduce the probability of buggy code making an out-of-bounds read access.

Referenced by osmo_amr_param_to_sbits(), and osmo_amr_sbits_to_param().

## osmo_amr_sbits_per_mode

const uint8_t osmo_amr_sbits_per_mode[AMR_NO_DATA+1]

extern

This table provides the number of s-bits (as defined in TS 26.090 and TS 26.092, clause 7 in each spec) for every possible speech or SID mode in AMR.

It differs from gsm690_bitlength[] in the case of SID: there are 35 s-bits in the original 2G definition that started out as GSM 06.92, captured in this table, whereas 3G-oriented TS 26.101 AMR Core Frame definition captured in gsm690_bitlength[] has 39 d-bits for SID instead.

The array is allocated up to AMR_NO_DATA in order to reduce the probability of buggy code making an out-of-bounds read access.

## osmo_amr_type_names

const struct value_string osmo_amr_type_names[]

extern

Referenced by osmo_amr_type_name().

## osmo_gsm611_silence_frame

const uint8_t osmo_gsm611_silence_frame[GSM_FR_BYTES]

extern

Referenced by fr_ecu_output().

## osmo_gsm620_homing_frame

const uint8_t osmo_gsm620_homing_frame[GSM_HR_BYTES]

extern

## osmo_gsm620_silence_frame

const uint8_t osmo_gsm620_silence_frame[GSM_HR_BYTES]

extern

## osmo_gsm660_homing_frame

const uint8_t osmo_gsm660_homing_frame[GSM_EFR_BYTES]

extern