Window-based Least Significant Bits (W-LSB) encoding.
More...
#include "comp_wlsb.h"
#include "interval.h"
#include <string.h>
#include <assert.h>
|
static size_t | wlsb_get_next_older (const size_t entry, const size_t max) |
| Get the next older entry. More...
|
|
bool | wlsb_new (struct c_wlsb *const wlsb, const size_t window_width) |
| Create a new Window-based Least Significant Bits (W-LSB) encoding object. More...
|
|
bool | wlsb_copy (struct c_wlsb *const dst, const struct c_wlsb *const src) |
| Create a new Window-based Least Significant Bits (W-LSB) encoding object from another. More...
|
|
void | wlsb_free (struct c_wlsb *const wlsb) |
| Destroy a Window-based LSB (W-LSB) encoding object. More...
|
|
void | 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. More...
|
|
bool | wlsb_is_kp_possible_8bits (const struct c_wlsb *const wlsb, const uint8_t value, const size_t k, const rohc_lsb_shift_t p) |
| Find out whether the given number of bits is enough to encode value. More...
|
|
bool | wlsb_is_kp_possible_16bits (const struct c_wlsb *const wlsb, const uint16_t value, const size_t k, const rohc_lsb_shift_t p) |
| Find out whether the given number of bits is enough to encode value. More...
|
|
bool | wlsb_is_kp_possible_32bits (const struct c_wlsb *const wlsb, const uint32_t value, const size_t k, const rohc_lsb_shift_t p) |
| Find out whether the given number of bits is enough to encode value. More...
|
|
size_t | wlsb_ack (struct c_wlsb *const wlsb, const uint32_t sn_bits, const size_t sn_bits_nr) |
| Acknowledge based on the Sequence Number (SN) More...
|
|
bool | wlsb_is_sn_present (struct c_wlsb *const wlsb, const uint32_t sn) |
| Whether the given SN is present in the given WLSB window. More...
|
|
◆ c_add_wlsb()
void 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
-
wlsb | The W-LSB object |
sn | The Sequence Number (SN) for the new entry |
value | The value to base the LSB coding on |
◆ wlsb_ack()
size_t wlsb_ack |
( |
struct c_wlsb *const |
wlsb, |
|
|
const uint32_t |
sn_bits, |
|
|
const size_t |
sn_bits_nr |
|
) |
| |
Acknowledge based on the Sequence Number (SN)
Removes all window entries older (and including) than the one that matches the given SN bits.
- Parameters
-
wlsb | The W-LSB object |
sn_bits | The LSB of the SN to acknowledge |
sn_bits_nr | The number of LSB of the SN to acknowledge |
- Returns
- The number of acked window entries
◆ wlsb_copy()
bool wlsb_copy |
( |
struct c_wlsb *const |
dst, |
|
|
const struct c_wlsb *const |
src |
|
) |
| |
Create a new Window-based Least Significant Bits (W-LSB) encoding object from another.
- Parameters
-
[in,out] | dst | The W-LSB encoding object to create |
| src | The W-LSB encoding object to copy |
- Returns
- true if the W-LSB encoding object was created, false if it was not
◆ wlsb_free()
void wlsb_free |
( |
struct c_wlsb *const |
wlsb | ) |
|
Destroy a Window-based LSB (W-LSB) encoding object.
- Parameters
-
wlsb | The W-LSB object to destroy |
◆ wlsb_get_next_older()
static size_t wlsb_get_next_older |
( |
const size_t |
entry, |
|
|
const size_t |
max |
|
) |
| |
|
static |
Get the next older entry.
- Parameters
-
entry | The entry for which to get the next older entry |
max | The max entry value |
- Returns
- The next older entry
◆ wlsb_is_kp_possible_16bits()
bool wlsb_is_kp_possible_16bits |
( |
const struct c_wlsb *const |
wlsb, |
|
|
const uint16_t |
value, |
|
|
const size_t |
k, |
|
|
const rohc_lsb_shift_t |
p |
|
) |
| |
Find out whether the given number of bits is enough to encode value.
The function is dedicated to 16-bit fields.
- Parameters
-
wlsb | The W-LSB object |
value | The value to encode using the LSB algorithm |
k | The number of bits for encoding |
p | The shift parameter p |
- Returns
- true if the number of bits is enough for encoding or not
◆ wlsb_is_kp_possible_32bits()
bool wlsb_is_kp_possible_32bits |
( |
const struct c_wlsb *const |
wlsb, |
|
|
const uint32_t |
value, |
|
|
const size_t |
k, |
|
|
const rohc_lsb_shift_t |
p |
|
) |
| |
Find out whether the given number of bits is enough to encode value.
The function is dedicated to 32-bit fields.
- Parameters
-
wlsb | The W-LSB object |
value | The value to encode using the LSB algorithm |
k | The number of bits for encoding |
p | The shift parameter p |
- Returns
- true if the number of bits is enough for encoding or not
◆ wlsb_is_kp_possible_8bits()
bool wlsb_is_kp_possible_8bits |
( |
const struct c_wlsb *const |
wlsb, |
|
|
const uint8_t |
value, |
|
|
const size_t |
k, |
|
|
const rohc_lsb_shift_t |
p |
|
) |
| |
Find out whether the given number of bits is enough to encode value.
The function is dedicated to 8-bit fields.
- Parameters
-
wlsb | The W-LSB object |
value | The value to encode using the LSB algorithm |
k | The number of bits for encoding |
p | The shift parameter p |
- Returns
- true if the number of bits is enough for encoding or not
◆ wlsb_is_sn_present()
bool wlsb_is_sn_present |
( |
struct c_wlsb *const |
wlsb, |
|
|
const uint32_t |
sn |
|
) |
| |
Whether the given SN is present in the given WLSB window.
- Parameters
-
wlsb | The WLSB in which to search for the SN |
sn | The SN to search for |
- Returns
- true if the SN is found, false if not
◆ wlsb_new()
bool wlsb_new |
( |
struct c_wlsb *const |
wlsb, |
|
|
const size_t |
window_width |
|
) |
| |
Create a new Window-based Least Significant Bits (W-LSB) encoding object.
- Parameters
-
[in,out] | wlsb | The W-LSB encoding object to create |
| window_width | The number of entries in the window (power of 2) |
- Returns
- true if the W-LSB encoding object was created, false if it was not