ROHC compression/decompression library
Data Structures | Functions
lsb.h File Reference

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

#include <stdlib.h>
#include <stdint.h>
Include dependency graph for lsb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  d_lsb_decode
 Least Significant Bits decoding object. More...

Functions

void d_lsb_init (struct d_lsb_decode *const lsb, const uint32_t v_ref_d, const short p)
 Initialize a Least Significant Bits (LSB) encoding object.
int d_lsb_decode32 (const struct d_lsb_decode *const lsb, const uint32_t m, const size_t k, uint32_t *const decoded)
 Decode a 32-bit LSB-encoded value.
int d_lsb_decode16 (const struct d_lsb_decode *const lsb, const uint16_t m, const size_t k, uint16_t *const decoded)
 Decode a 16-bit LSB-encoded value.
void d_lsb_update (struct d_lsb_decode *const lsb, const uint32_t v_ref_d)
 Update the LSB reference value.
void d_lsb_sync_ref (struct d_lsb_decode *const lsb)
 Replace the previous LSB reference value with the current one.
uint32_t d_get_lsb_ref (struct d_lsb_decode *const lsb)
 Get the current LSB reference value.
uint32_t d_get_lsb_old_ref (struct d_lsb_decode *const lsb)
 Get the previous LSB reference value.

Detailed Description

Least Significant Bits (LSB) encoding.

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

Function Documentation

uint32_t d_get_lsb_old_ref ( struct d_lsb_decode *const  lsb)

Get the previous LSB reference value.

Parameters:
lsbThe LSB object
Returns:
The previous reference value

References d_lsb_decode::old_v_ref_d.

uint32_t d_get_lsb_ref ( struct d_lsb_decode *const  lsb)

Get the current LSB reference value.

Parameters:
lsbThe LSB object
Returns:
The current reference value

References d_lsb_decode::v_ref_d.

Referenced by d_generic_get_sn(), and ts_decode_scaled().

int d_lsb_decode16 ( const struct d_lsb_decode *const  lsb,
const uint16_t  m,
const size_t  k,
uint16_t *const  decoded 
)

Decode a 16-bit LSB-encoded value.

See d_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:
1 in case of success, 0 otherwise

References d_lsb_decode32().

Referenced by decode_uo0(), decode_uo1(), decode_uor2(), and main().

int d_lsb_decode32 ( const struct d_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:
1 in case of success, 0 otherwise

References f(), d_lsb_decode::p, and d_lsb_decode::v_ref_d.

Referenced by d_lsb_decode16(), and ts_decode_scaled().

void d_lsb_init ( struct d_lsb_decode *const  lsb,
const uint32_t  v_ref_d,
const short  p 
)

Initialize a Least Significant Bits (LSB) encoding object.

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

Parameters:
lsbThe LSB object to initialize
v_ref_dThe reference value
pThe p value used to efficiently encode the values

References d_lsb_decode::old_v_ref_d, d_lsb_decode::p, and d_lsb_decode::v_ref_d.

Referenced by d_create_sc(), ip_decode_dynamic_ip(), main(), and rtp_decode_dynamic_rtp().

void d_lsb_sync_ref ( struct d_lsb_decode *const  lsb)

Replace the previous LSB reference value with the current one.

Parameters:
lsbThe LSB object

References d_lsb_decode::old_v_ref_d, and d_lsb_decode::v_ref_d.

Referenced by decode_uo0(), decode_uo1(), decode_uor2(), and ts_update_context().

void d_lsb_update ( struct d_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 d_lsb_decode::v_ref_d.

Referenced by decode_uo0(), decode_uo1(), decode_uor2(), main(), and ts_update_context().