ROHC compression/decompression library
Defines | Functions
wlsb.h File Reference

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

#include "interval.h"
#include "dllexport.h"
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for wlsb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define C_WINDOW_WIDTH   4
 Default window width for W-LSB encoding.

Functions

struct c_wlsb *ROHC_EXPORT c_create_wlsb (const size_t bits, const size_t window_width, const rohc_lsb_shift_t p)
 Create a new Window-based Least Significant Bits (W-LSB) encoding object.
void ROHC_EXPORT c_destroy_wlsb (struct c_wlsb *s)
 Destroy a Window-based LSB (W-LSB) encoding object.
void ROHC_EXPORT c_add_wlsb (struct c_wlsb *const wlsb, const uint32_t sn, const uint32_t value)
 Add a value into a W-LSB encoding object.
bool ROHC_EXPORT wlsb_get_k_16bits (const struct c_wlsb *const wlsb, const uint16_t value, size_t *const bits_nr)
 Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recreate it given the window.
bool ROHC_EXPORT wlsb_get_k_32bits (const struct c_wlsb *const wlsb, const uint32_t value, size_t *const bits_nr)
 Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recreate it given the window.
void ROHC_EXPORT c_ack_sn_wlsb (struct c_wlsb *s, const uint32_t sn)
 Acknowledge based on the Sequence Number (SN)
int ROHC_EXPORT c_sum_wlsb (struct c_wlsb *s)
 Compute the sum of all the values stored in the W-LSB window.
int ROHC_EXPORT c_mean_wlsb (struct c_wlsb *s)
 Compute the mean of all the values stored in the W-LSB window.

Detailed Description

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

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

Define Documentation

#define C_WINDOW_WIDTH   4

Default window width for W-LSB encoding.

Referenced by rohc_alloc_compressor().


Function Documentation

void ROHC_EXPORT c_ack_sn_wlsb ( struct c_wlsb s,
const uint32_t  sn 
)

Acknowledge based on the Sequence Number (SN)

Removes all entries older than the given SN in the window.

Parameters:
sThe W-LSB object
snThe SN to acknowledge

References c_wlsb::count, c_wlsb::oldest, c_window::sn, c_wlsb::window, and c_wlsb::window_mask.

Referenced by c_generic_feedback().

void ROHC_EXPORT c_add_wlsb ( struct c_wlsb *const  wlsb,
const uint32_t  sn,
const uint32_t  value 
)

Add a value into a W-LSB encoding object.

Parameters:
wlsbThe W-LSB object
snThe Sequence Number (SN) for the new entry
valueThe value to base the LSB coding on

References c_wlsb::count, c_wlsb::next, c_wlsb::oldest, sn, c_window::sn, c_window::value, c_wlsb::window, c_wlsb::window_mask, and c_wlsb::window_width.

Referenced by add_scaled(), rohc_compress(), and rohc_decompress().

struct c_wlsb* ROHC_EXPORT c_create_wlsb ( const size_t  bits,
const size_t  window_width,
const rohc_lsb_shift_t  p 
) [read]

Create a new Window-based Least Significant Bits (W-LSB) encoding object.

Parameters:
bitsThe maximal number of bits for representing a value
window_widthThe number of entries in the window (power of 2)
pShift parameter (see 4.5.2 in the RFC 3095)
Returns:
The newly-created W-LSB encoding object

References c_wlsb::bits, c_wlsb::count, c_wlsb::next, c_wlsb::oldest, c_wlsb::p, rohc_debugf, c_wlsb::window_mask, and c_wlsb::window_width.

Referenced by c_create_sc(), c_generic_create(), c_init_header_info(), and context_create().

void ROHC_EXPORT c_destroy_wlsb ( struct c_wlsb *const  wlsb)

Destroy a Window-based LSB (W-LSB) encoding object.

Parameters:
wlsbThe W-LSB object to destroy

Referenced by c_destroy_sc(), c_generic_destroy(), context_create(), and context_free().

int ROHC_EXPORT c_mean_wlsb ( struct c_wlsb s)

Compute the mean of all the values stored in the W-LSB window.

This function is used for statistics.

Parameters:
sThe W-LSB object
Returns:
The mean over the W-LSB window

References c_wlsb::count, c_wlsb::oldest, c_window::value, c_wlsb::window, and c_wlsb::window_mask.

Referenced by rohc_c_context(), and rohc_d_context().

int ROHC_EXPORT c_sum_wlsb ( struct c_wlsb s)

Compute the sum of all the values stored in the W-LSB window.

This function is used for statistics.

Parameters:
sThe W-LSB object
Returns:
The sum over the W-LSB window

References c_wlsb::count, c_wlsb::oldest, c_window::value, c_wlsb::window, and c_wlsb::window_mask.

Referenced by rohc_c_context(), and rohc_d_context().

bool ROHC_EXPORT wlsb_get_k_16bits ( const struct c_wlsb *const  wlsb,
const uint16_t  value,
size_t *const  bits_nr 
)

Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recreate it given the window.

The function is dedicated to 16-bit fields.

Parameters:
wlsbThe W-LSB object
valueThe value to encode using the LSB algorithm
bits_nrOUT: The number of bits required to uniquely recreate the value
Returns:
true in case of success, false if the minimal number of bits can not be found

References c_wlsb::bits, c_wlsb::count, c_wlsb::oldest, c_wlsb::p, c_window::value, c_wlsb::window, and c_wlsb::window_mask.

bool ROHC_EXPORT wlsb_get_k_32bits ( const struct c_wlsb *const  wlsb,
const uint32_t  value,
size_t *const  bits_nr 
)

Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recreate it given the window.

The function is dedicated to 32-bit fields.

Parameters:
wlsbThe W-LSB object
valueThe value to encode using the LSB algorithm
bits_nrOUT: The number of bits required to uniquely recreate the value
Returns:
true in case of success, false if the minimal number of bits can not be found

References c_wlsb::bits, c_wlsb::count, c_wlsb::oldest, c_wlsb::p, c_window::value, c_wlsb::window, and c_wlsb::window_mask.

Referenced by nb_bits_scaled().