ROHC compression/decompression library
Data Structures | Functions
lsb_decode.c File Reference

Least Significant Bits (LSB) decoding. More...

#include "lsb_decode.h"
#include "interval.h"
#include <assert.h>
Include dependency graph for lsb_decode.c:

Data Structures

struct  rohc_lsb_decode
 The Least Significant Bits (LSB) decoding object. More...

Functions

struct rohc_lsb_decoderohc_lsb_new (const rohc_lsb_shift_t p)
 Create a new Least Significant Bits (LSB) decoding context.
void rohc_lsb_free (struct rohc_lsb_decode *const lsb)
 Destroy a given Least Significant Bits (LSB) decoding context.
bool rohc_lsb_decode32 (const struct rohc_lsb_decode *const lsb, const uint32_t m, const size_t k, uint32_t *const decoded)
 Decode a 32-bit LSB-encoded value.
bool rohc_lsb_decode16 (const struct rohc_lsb_decode *const lsb, const uint16_t m, const size_t k, uint16_t *const decoded)
 Decode a 16-bit LSB-encoded value.
void rohc_lsb_set_ref (struct rohc_lsb_decode *const lsb, const uint32_t v_ref_d)
 Update the LSB reference value.
uint32_t rohc_lsb_get_ref (struct rohc_lsb_decode *const lsb)
 Get the current LSB reference value.

Detailed Description

Least Significant Bits (LSB) decoding.

Author:
Didier Barvaux <didier.barvaux@toulouse.viveris.com>
Didier Barvaux <didier@barvaux.org>
The hackers from ROHC for Linux

Function Documentation

bool rohc_lsb_decode16 ( const struct rohc_lsb_decode *const  lsb,
const uint16_t  m,
const size_t  k,
uint16_t *const  decoded 
)

Decode a 16-bit LSB-encoded value.

See rohc_lsb_decode32 for details.

Parameters:
lsbThe LSB object used to decode
mThe LSB value to decode
kThe length of the LSB value to decode
decodedOUT: The decoded value
Returns:
true in case of success, false otherwise

References rohc_lsb_decode::is_init, and rohc_lsb_decode32().

Referenced by ip_id_offset_decode().

bool rohc_lsb_decode32 ( const struct rohc_lsb_decode *const  lsb,
const uint32_t  m,
const size_t  k,
uint32_t *const  decoded 
)

Decode a 32-bit LSB-encoded value.

See 4.5.1 in the RFC 3095 for details about LSB encoding.

Parameters:
lsbThe LSB object used to decode
mThe LSB value to decode
kThe length of the LSB value to decode
decodedOUT: The decoded value
Returns:
true in case of success, false otherwise

References rohc_lsb_decode::is_init, rohc_lsb_decode::p, rohc_f_32bits(), and rohc_lsb_decode::v_ref_d.

Referenced by rohc_lsb_decode16(), and ts_decode_scaled().

void rohc_lsb_free ( struct rohc_lsb_decode *const  lsb)

Destroy a given Least Significant Bits (LSB) decoding context.

See 4.5.1 in the RFC 3095 for details about LSB encoding.

Parameters:
lsbThe LSB decoding context to destroy

Referenced by d_rtp_create(), d_udp_create(), d_udp_lite_create(), ip_id_offset_free(), and rohc_ts_scaled_free().

uint32_t rohc_lsb_get_ref ( struct rohc_lsb_decode *const  lsb)

Get the current LSB reference value.

Parameters:
lsbThe LSB object
Returns:
The current reference value

References rohc_lsb_decode::is_init, and rohc_lsb_decode::v_ref_d.

Referenced by d_generic_get_sn(), and ts_decode_scaled().

struct rohc_lsb_decode* rohc_lsb_new ( const rohc_lsb_shift_t  p) [read]

Create a new Least Significant Bits (LSB) decoding context.

See 4.5.1 in the RFC 3095 for details about LSB encoding.

Parameters:
pThe p value used to efficiently encode/decode the values
Returns:
The new LSB decoding context in case of success, NULL otherwise

References rohc_lsb_decode::is_init, and rohc_lsb_decode::p.

Referenced by d_create_sc(), d_ip_create(), d_rtp_create(), d_udp_create(), d_udp_lite_create(), and ip_id_offset_new().

void rohc_lsb_set_ref ( struct rohc_lsb_decode *const  lsb,
const uint32_t  v_ref_d 
)

Update the LSB reference value.

This function is called after a CRC success to update the last decoded value (for example, the SN value). See 4.5.1 in the RFC 3095 for details about LSB encoding.

Parameters:
lsbThe LSB object
v_ref_dThe new reference value

References rohc_lsb_decode::is_init, and rohc_lsb_decode::v_ref_d.

Referenced by ip_id_offset_set_ref(), and ts_update_context().