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

Window-based Least Significant Bits (W-LSB) decoding. More...

#include "wlsb.h"
#include "interval.h"
#include <string.h>
#include <assert.h>
Include dependency graph for decomp/schemes/wlsb.c:

Data Structures

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

Functions

static bool rohc_lsb_decode32 (const struct rohc_lsb_decode *const lsb, const rohc_lsb_ref_t ref_type, const uint32_t v_ref_d_offset, const uint32_t m, const size_t k, const rohc_lsb_shift_t p, uint32_t *const decoded)
 Decode a 32-bit LSB-encoded value.
static bool rohc_lsb_decode16 (const struct rohc_lsb_decode *const lsb, const rohc_lsb_ref_t ref_type, const uint16_t v_ref_d_offset, const uint16_t m, const size_t k, const rohc_lsb_shift_t p, uint16_t *const decoded)
 Decode a 16-bit LSB-encoded value.
struct rohc_lsb_decoderohc_lsb_new (const rohc_lsb_shift_t p, const size_t max_len)
 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.
rohc_lsb_shift_t lsb_get_p (const struct rohc_lsb_decode *const lsb)
 Get the shift parameter p of the LSB decoding context.
bool rohc_lsb_decode (const struct rohc_lsb_decode *const lsb, const rohc_lsb_ref_t ref_type, const uint32_t v_ref_d_offset, const uint32_t m, const size_t k, const rohc_lsb_shift_t p, uint32_t *const decoded)
 Decode a LSB-encoded value.
void rohc_lsb_set_ref (struct rohc_lsb_decode *const lsb, const uint32_t v_ref_d, const bool keep_ref_minus_1)
 Update the LSB reference value.
uint32_t rohc_lsb_get_ref (const struct rohc_lsb_decode *const lsb, const rohc_lsb_ref_t ref_type)
 Get the current LSB reference value (ref 0)

Detailed Description

Window-based Least Significant Bits (W-LSB) decoding.

Author:
Didier Barvaux <didier.barvaux@toulouse.viveris.com>
Didier Barvaux <didier@barvaux.org>

Function Documentation

rohc_lsb_shift_t lsb_get_p ( const struct rohc_lsb_decode *const  lsb)

Get the shift parameter p of the LSB decoding context.

Parameters:
lsbThe LSB object used to decode
Returns:
The shift parameter p
bool rohc_lsb_decode ( const struct rohc_lsb_decode *const  lsb,
const rohc_lsb_ref_t  ref_type,
const uint32_t  v_ref_d_offset,
const uint32_t  m,
const size_t  k,
const rohc_lsb_shift_t  p,
uint32_t *const  decoded 
)

Decode a LSB-encoded value.

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

Parameters:
lsbThe LSB object used to decode
ref_typeThe reference value to use to decode (used for context repair upon CRC failure)
v_ref_d_offsetThe offset to apply on v_ref_d (used for context repair upon CRC failure)
mThe LSB value to decode
kThe length of the LSB value to decode
pThe shift value p used to efficiently encode/decode the values
decodedOUT: The decoded value
Returns:
true in case of success, false otherwise
static bool rohc_lsb_decode16 ( const struct rohc_lsb_decode *const  lsb,
const rohc_lsb_ref_t  ref_type,
const uint16_t  v_ref_d_offset,
const uint16_t  m,
const size_t  k,
const rohc_lsb_shift_t  p,
uint16_t *const  decoded 
) [static]

Decode a 16-bit LSB-encoded value.

See rohc_lsb_decode32 for details.

Parameters:
lsbThe LSB object used to decode
ref_typeThe reference value to use to decode (used for context repair upon CRC failure)
v_ref_d_offsetThe offset to apply on v_ref_d (used for context repair upon CRC failure)
mThe LSB value to decode
kThe length of the LSB value to decode
pThe shift value p used to efficiently encode/decode the values
decodedOUT: The decoded value
Returns:
true in case of success, false otherwise
static bool rohc_lsb_decode32 ( const struct rohc_lsb_decode *const  lsb,
const rohc_lsb_ref_t  ref_type,
const uint32_t  v_ref_d_offset,
const uint32_t  m,
const size_t  k,
const rohc_lsb_shift_t  p,
uint32_t *const  decoded 
) [static]

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
ref_typeThe reference value to use to decode (used for context repair upon CRC failure)
v_ref_d_offsetThe offset to apply on v_ref_d (used for context repair upon CRC failure)
mThe LSB value to decode
kThe length of the LSB value to decode
pThe shift value p used to efficiently encode/decode the values
decodedOUT: The decoded value
Returns:
true in case of success, false otherwise
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
uint32_t rohc_lsb_get_ref ( const struct rohc_lsb_decode *const  lsb,
const rohc_lsb_ref_t  ref_type 
)

Get the current LSB reference value (ref 0)

Parameters:
lsbThe LSB object
ref_typeThe reference value to retrieve
Returns:
The current reference value
struct rohc_lsb_decode* rohc_lsb_new ( const rohc_lsb_shift_t  p,
const size_t  max_len 
) [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
max_lenThe max length (in bits) of the non-compressed field
Returns:
The new LSB decoding context in case of success, NULL otherwise
void rohc_lsb_set_ref ( struct rohc_lsb_decode *const  lsb,
const uint32_t  v_ref_d,
const bool  keep_ref_minus_1 
)

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
keep_ref_minus_1Keep ref -1 unchanged (used for SN context repair after CRC failure, see RFC3095 ยง5.3.2.2.5)