ROHC compression/decompression library
comp_wlsb.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011,2012,2013 Didier Barvaux
3  * Copyright 2007,2009,2010 Viveris Technologies
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 /**
21  * @file schemes/comp_wlsb.h
22  * @brief Window-based Least Significant Bits (W-LSB) encoding
23  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
24  * @author David Moreau from TAS
25  */
26 
27 #ifndef ROHC_COMP_SCHEMES_WLSB_H
28 #define ROHC_COMP_SCHEMES_WLSB_H
29 
30 #include "interval.h" /* for rohc_lsb_shift_t */
31 
32 #include <stdlib.h>
33 #include <stdint.h>
34 #include <stdbool.h>
35 
36 
37 /* The definition of the W-LSB encoding object is private */
38 struct c_wlsb;
39 
40 
41 /*
42  * Public function prototypes:
43  */
44 
45 struct c_wlsb * c_create_wlsb(const size_t bits,
46  const size_t window_width,
47  const rohc_lsb_shift_t p)
48  __attribute__((warn_unused_result));
49 void c_destroy_wlsb(struct c_wlsb *s);
50 
51 void c_add_wlsb(struct c_wlsb *const wlsb,
52  const uint32_t sn,
53  const uint32_t value);
54 
55 size_t wlsb_get_k_8bits(const struct c_wlsb *const wlsb,
56  const uint8_t value)
57  __attribute__((warn_unused_result, nonnull(1)));
58 size_t wlsb_get_kp_8bits(const struct c_wlsb *const wlsb,
59  const uint8_t value,
60  const rohc_lsb_shift_t p)
61  __attribute__((warn_unused_result, nonnull(1)));
62 
63 size_t wlsb_get_k_16bits(const struct c_wlsb *const wlsb,
64  const uint16_t value)
65  __attribute__((warn_unused_result, nonnull(1)));
66 size_t wlsb_get_mink_16bits(const struct c_wlsb *const wlsb,
67  const uint16_t value,
68  const size_t min_k)
69  __attribute__((warn_unused_result, nonnull(1)));
70 size_t wlsb_get_kp_16bits(const struct c_wlsb *const wlsb,
71  const uint16_t value,
72  const rohc_lsb_shift_t p)
73  __attribute__((warn_unused_result, nonnull(1)));
74 size_t wlsb_get_minkp_16bits(const struct c_wlsb *const wlsb,
75  const uint16_t value,
76  const size_t min_k,
77  const rohc_lsb_shift_t p)
78  __attribute__((warn_unused_result, nonnull(1)));
79 
80 size_t wlsb_get_k_32bits(const struct c_wlsb *const wlsb,
81  const uint32_t value)
82  __attribute__((warn_unused_result, nonnull(1)));
83 size_t wlsb_get_mink_32bits(const struct c_wlsb *const wlsb,
84  const uint32_t value,
85  const size_t min_k)
86  __attribute__((warn_unused_result, nonnull(1)));
87 size_t wlsb_get_kp_32bits(const struct c_wlsb *const wlsb,
88  const uint32_t value,
89  const rohc_lsb_shift_t p)
90  __attribute__((warn_unused_result, nonnull(1)));
91 size_t wlsb_get_minkp_32bits(const struct c_wlsb *const wlsb,
92  const uint32_t value,
93  const size_t min_k,
94  const rohc_lsb_shift_t p)
95  __attribute__((warn_unused_result, nonnull(1)));
96 
97 size_t wlsb_ack(struct c_wlsb *const wlsb,
98  const uint32_t sn_bits,
99  const size_t sn_bits_nr)
100  __attribute__((warn_unused_result, nonnull(1)));
101 
102 #endif
103 
rohc_lsb_shift_t
the different values of the shift parameter of the LSB algorithm
Definition: interval.h:42
size_t wlsb_get_minkp_32bits(const struct c_wlsb *const wlsb, const uint32_t value, const size_t min_k, const rohc_lsb_shift_t p)
Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recrea...
Definition: comp_wlsb.c:439
size_t wlsb_get_k_16bits(const struct c_wlsb *const wlsb, const uint16_t value)
Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recrea...
Definition: comp_wlsb.c:274
size_t bits
The maximal number of bits for representing the value.
Definition: comp_wlsb.c:72
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)
Definition: comp_wlsb.c:492
void c_destroy_wlsb(struct c_wlsb *s)
Destroy a Window-based LSB (W-LSB) encoding object.
Definition: comp_wlsb.c:162
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.
Definition: comp_wlsb.c:175
rohc_lsb_shift_t p
Shift parameter (see 4.5.2 in the RFC 3095)
Definition: comp_wlsb.c:74
struct c_wlsb * 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.
Definition: comp_wlsb.c:125
Defines a W-LSB encoding object.
Definition: comp_wlsb.c:55
size_t wlsb_get_mink_16bits(const struct c_wlsb *const wlsb, const uint16_t value, const size_t min_k)
Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recrea...
Definition: comp_wlsb.c:292
size_t wlsb_get_kp_32bits(const struct c_wlsb *const wlsb, const uint32_t value, const rohc_lsb_shift_t p)
Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recrea...
Definition: comp_wlsb.c:418
size_t window_width
The width of the window.
Definition: comp_wlsb.c:58
size_t wlsb_get_k_8bits(const struct c_wlsb *const wlsb, const uint8_t value)
Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recrea...
Definition: comp_wlsb.c:209
size_t wlsb_get_k_32bits(const struct c_wlsb *const wlsb, const uint32_t value)
Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recrea...
Definition: comp_wlsb.c:381
size_t wlsb_get_kp_16bits(const struct c_wlsb *const wlsb, const uint16_t value, const rohc_lsb_shift_t p)
Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recrea...
Definition: comp_wlsb.c:311
size_t wlsb_get_minkp_16bits(const struct c_wlsb *const wlsb, const uint16_t value, const size_t min_k, const rohc_lsb_shift_t p)
Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recrea...
Definition: comp_wlsb.c:332
size_t wlsb_get_mink_32bits(const struct c_wlsb *const wlsb, const uint32_t value, const size_t min_k)
Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recrea...
Definition: comp_wlsb.c:399
size_t wlsb_get_kp_8bits(const struct c_wlsb *const wlsb, const uint8_t value, const rohc_lsb_shift_t p)
Find out the minimal number of bits of the to-be-encoded value required to be able to uniquely recrea...
Definition: comp_wlsb.c:226
Compute the interpretation interval for LSB and W-LSB encoding.