libosmocore
0.9.3.20160317
Osmocom core library
|
Files | |
file | bitcomp.h |
Osmocom bit compression routines. | |
file | bitcomp.c |
Osmocom bit compression routines. | |
Enumerations | |
enum | dec_state { EXPECT_TERM, TOO_LONG, NEED_MORE_BITS, CORRUPT, OK } |
Functions | |
int | osmo_t4_encode (struct bitvec *bv) |
encode bit vector in-place using T4 encoding Assumes MSB first encoding. More... | |
int | osmo_t4_decode (const struct bitvec *in, bool cc, struct bitvec *out) |
decode T4-encoded bit vector Assumes MSB first encoding. More... | |
static int | t4_rle_term (unsigned w, bool b, unsigned bits) |
Attempt to decode compressed bit vector. More... | |
static int | t4_rle_makeup (unsigned w, bool b, unsigned bits) |
static int | t4_rle (struct bitvec *bv, unsigned len, bool b) |
Make-up codes for a given length. More... | |
static enum dec_state | _t4_step (struct bitvec *v, uint16_t w, bool b, unsigned bits, bool term_only) |
decode T4-encoded bit vector Assumes MSB first encoding.
[in] | in | bit vector with encoded data |
[in] | cc | color code (whether decoding should start with 1 or 0) |
[out] | out | the bit vector to store result into returns 0 on success, negative value otherwise |
References bitvec_get_int16_msb(), bitvec_shiftl(), bitvec_zero(), bitvec::cur_bit, bitvec::data, and bitvec::data_len.
int osmo_t4_encode | ( | struct bitvec * | bv | ) |
encode bit vector in-place using T4 encoding Assumes MSB first encoding.
[in] | bv | bit vector to be encoded returns color code (if the encoding started with 0 or 1) or -1 on failure (encoded is bigger than original) |
References bitvec_rl(), bitvec_shiftl(), bitvec_zero(), bitvec::cur_bit, bitvec::data, bitvec::data_len, and t4_rle().
|
inlinestatic |
Make-up codes for a given length.
Return proper make-up code word for an uninterrupted sequence of b bits of length len according to modified ITU-T T.4 from TS 44.060 Table 9.1.10.2
References bitvec_set_uint().
Referenced by osmo_t4_encode().
|
inlinestatic |
Attempt to decode compressed bit vector.
Return length of RLE according to modified ITU-T T.4 from TS 44.060 Table 9.1.10.2 or -1 if no applicable RLE found N. B: we need explicit bit length to make decoding unambiguous
|
static |
|
static |