ROHC compression/decompression library
|
Window-based Least Significant Bits (W-LSB) encoding. More...
#include "wlsb.h"
#include "interval.h"
#include "rohc_traces.h"
#include "rohc_debug.h"
#include <string.h>
#include <assert.h>
Functions | |
struct c_wlsb * | c_create_wlsb (const size_t bits, const size_t window_width, const int32_t p) |
Create a new Window-based Least Significant Bits (W-LSB) encoding object. | |
void | c_destroy_wlsb (struct c_wlsb *const wlsb) |
Destroy a Window-based LSB (W-LSB) encoding object. | |
void | c_add_wlsb (struct c_wlsb *const wlsb, const uint16_t sn, const uint32_t value) |
Add a value into a W-LSB encoding object. | |
int | c_get_k_wlsb (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 | c_ack_sn_wlsb (struct c_wlsb *s, int sn) |
Acknowledge based on the Sequence Number (SN) | |
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. |
Window-based Least Significant Bits (W-LSB) encoding.
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.
s | The W-LSB object |
sn | The SN to acknowledge |
References c_window::is_used, c_wlsb::oldest, c_window::sn, and c_wlsb::window.
Referenced by c_generic_feedback().
void c_add_wlsb | ( | struct c_wlsb *const | wlsb, |
const uint16_t | sn, | ||
const uint32_t | value | ||
) |
Add a value into a W-LSB encoding object.
wlsb | The W-LSB object |
sn | The Sequence Number (SN) for the new entry |
value | The value to base the LSB coding on |
References c_window::is_used, c_wlsb::next, c_wlsb::oldest, c_window::sn, sn, 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(), main(), rohc_compress(), and rohc_decompress().
struct c_wlsb* c_create_wlsb | ( | const size_t | bits, |
const size_t | window_width, | ||
const int32_t | p | ||
) | [read] |
Create a new Window-based Least Significant Bits (W-LSB) encoding object.
bits | The maximal number of bits for representing a value |
window_width | The number of entries in the window |
p | Shift parameter (see 4.5.2 in the RFC 3095) |
References c_wlsb::bits, c_window::is_used, c_wlsb::next, c_wlsb::oldest, c_wlsb::p, rohc_debugf, c_wlsb::window, c_wlsb::window_width, and zfree.
Referenced by c_create_sc(), c_generic_create(), c_init_header_info(), c_rtp_create(), context_create(), and main().
void c_destroy_wlsb | ( | struct c_wlsb *const | wlsb | ) |
Destroy a Window-based LSB (W-LSB) encoding object.
wlsb | The W-LSB object to destory |
References c_wlsb::window.
Referenced by c_destroy_sc(), c_generic_destroy(), context_create(), context_free(), and main().
int c_get_k_wlsb | ( | 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.
wlsb | The W-LSB object |
value | The value to encode using the LSB algorithm |
bits_nr | OUT: The number of bits required to uniquely recreate the value |
References c_wlsb::bits, c_window::is_used, c_wlsb::p, c_window::value, c_wlsb::window, and c_wlsb::window_width.
Referenced by main(), and nb_bits_scaled().
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.
s | The W-LSB object |
References c_window::is_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.
s | The W-LSB object |
References c_window::is_used, c_window::value, c_wlsb::window, and c_wlsb::window_width.
Referenced by rohc_c_context(), and rohc_d_context().