libosmocore 1.9.0.196-9975
Osmocom core library
Bit compression

Files

file  bitcomp.h
 Osmocom bit compression routines.
 
file  bitcomp.c
 Osmocom bit compression routines.
 

Functions

int osmo_t4_encode (struct bitvec *bv)
 encode bit vector in-place using T4 encoding Assumes MSB first encoding. More...
 
static int t4_rle (struct bitvec *bv, unsigned len, bool b)
 Make-up codes for a given length. More...
 

Variables

static const unsigned t4_term [2][64]
 
static const unsigned t4_term_length [2][64]
 
static const unsigned t4_make_up_length [2][15]
 
static const unsigned t4_make_up [2][15]
 

Detailed Description

Function Documentation

◆ osmo_t4_encode()

int osmo_t4_encode ( struct bitvec bv)

encode bit vector in-place using T4 encoding Assumes MSB first encoding.

Parameters
[in]bvbit 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().

◆ t4_rle()

static int t4_rle ( struct bitvec bv,
unsigned  len,
bool  b 
)
inlinestatic

Make-up codes for a given length.

Returns
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(), len(), t4_make_up, t4_make_up_length, t4_term, and t4_term_length.

Referenced by osmo_t4_encode().

Variable Documentation

◆ t4_make_up

const unsigned t4_make_up[2][15]
static

Referenced by t4_rle().

◆ t4_make_up_length

const unsigned t4_make_up_length[2][15]
static
Initial value:
= {
{10, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13},
{5, 5, 6, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9}
}

Referenced by t4_rle().

◆ t4_term

const unsigned t4_term[2][64]
static

Referenced by t4_rle().

◆ t4_term_length

const unsigned t4_term_length[2][64]
static
Initial value:
= {
{10, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 9, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
{8, 6, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}
}

Referenced by t4_rle().