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

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

#include <strings.h>
#include "rohc.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.

Classes

struct  c_window
 Defines a W-LSB window entry. More...
struct  c_wlsb
 Defines a W-LSB encoding object. More...

Defines

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

Functions

struct c_wlsbc_create_wlsb (int bits, int window_width, int p)
 Create a new Window-based Least Significant Bits (W-LSB) encoding object.
void c_destroy_wlsb (struct c_wlsb *s)
 Destroy a Window-based LSB (W-LSB) encoding object.
void c_add_wlsb (struct c_wlsb *s, int sn, int time, int value)
 Add a value into a W-LSB encoding object.
int c_get_k_wlsb (struct c_wlsb *s, int value)
 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 c_ack_sn_wlsb (struct c_wlsb *s, int sn)
 Acknowledge based on the Sequence Number (SN)
void c_ack_time_wlsb (struct c_wlsb *s, int time)
 Acknowledge based on the time stamp.
int c_sum_wlsb (struct c_wlsb *s)
 Compute the sum of all the values stored in the W-LSB window.
int c_mean_wlsb (struct c_wlsb *s)
 Compute the mean of all the values stored in the W-LSB window.
void print_wlsb_stats (struct c_wlsb *s)
 Print statistics about a W-LSB encoding object.
void f (int v_ref, int k, int p, int *min, int *max)
 The f function as defined in the LSB calculation algorithm.

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 c_generic_create(), c_init_header_info(), and c_rtp_create().


Function Documentation

void c_ack_sn_wlsb ( struct c_wlsb s,
int  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_ack_remove(), c_wlsb::oldest, ROHC_TRUE, c_window::sn, c_window::used, and c_wlsb::window.

Referenced by c_generic_feedback().

void c_ack_time_wlsb ( struct c_wlsb s,
int  time 
)

Acknowledge based on the time stamp.

Removes all entries older than the given time stamp in the window.

Parameters:
sThe W-LSB object
timeThe time stamp to acknowledge

References c_ack_remove(), c_wlsb::oldest, ROHC_TRUE, c_window::time, c_window::used, c_wlsb::window, and c_wlsb::window_width.

void c_add_wlsb ( struct c_wlsb s,
int  sn,
int  time,
int  value 
)

Add a value into a W-LSB encoding object.

Parameters:
sThe W-LSB object
snThe Sequence Number (SN) for the new entry
timeThe time stamp for the new entry
valueThe value to base the LSB coding on (i.e. sn)

References c_wlsb::next, c_wlsb::oldest, rohc_debugf, ROHC_TRUE, c_window::sn, sn, c_window::time, c_window::used, c_window::value, c_wlsb::window, and c_wlsb::window_width.

Referenced by add_scaled(), d_generic_decode_ir(), decode_irdyn(), decode_uo0(), decode_uo1(), decode_uor2(), rohc_compress(), rohc_decompress(), and update_variables().

struct c_wlsb* c_create_wlsb ( int  bits,
int  window_width,
int  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
pShift parameter (see 4.5.2 in the RFC 3095)
Returns:
The newly-created W-LSB encoding object

References c_wlsb::bits, c_wlsb::next, c_wlsb::oldest, c_wlsb::p, rohc_debugf, ROHC_FALSE, c_window::time, c_window::used, c_wlsb::window, c_wlsb::window_width, and zfree.

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

void c_destroy_wlsb ( struct c_wlsb s)

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

Parameters:
sThe W-LSB object to destory

References c_wlsb::window, and zfree.

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

int c_get_k_wlsb ( struct c_wlsb s,
int  value 
)

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

Parameters:
sThe W-LSB object
valueThe value to encode using the LSB algorithm
Returns:
The number of bits required to uniquely recreate the value, 0 if an error occurs and -1 if the minimal number of bits can not be found

References c_wlsb::bits, g(), c_wlsb::p, rohc_debugf, ROHC_TRUE, c_window::used, c_window::value, c_wlsb::window, and c_wlsb::window_width.

Referenced by nb_bits_scaled(), and update_variables().

int 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 ROHC_TRUE, c_window::used, c_window::value, c_wlsb::window, and c_wlsb::window_width.

Referenced by rohc_c_context(), and rohc_d_context().

int 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 ROHC_TRUE, c_window::used, c_window::value, c_wlsb::window, and c_wlsb::window_width.

Referenced by rohc_c_context(), and rohc_d_context().

void f ( int  v_ref,
int  k,
int  p,
int *  min,
int *  max 
)

The f function as defined in the LSB calculation algorithm.

Find out the interval $[v\_ref - p, v\_ref + (2^k - 1) - p]$ for a given k. See 4.5.1 in the RFC 3095.

Parameters:
v_refThe reference value
kThe number of least significant bits of the value that are transmitted
pThe shift parameter
minThe lower limit of the interval
maxThe upper limit of the interval

Referenced by d_ip_id_decode(), d_lsb_decode(), and g().

void print_wlsb_stats ( struct c_wlsb s)

Print statistics about a W-LSB encoding object.

This function is a debug function.

Parameters:
sThe W-LSB object to print stats about

References c_wlsb::next, c_wlsb::oldest, rohc_debugf, ROHC_TRUE, c_window::sn, c_window::time, c_window::used, c_window::value, c_wlsb::window, and c_wlsb::window_width.