encode_2bit_base

baseband.base.encoding.encode_2bit_base(values)[source] [edit on github]

Generic encoder for data stored using two bits.

This returns an unsigned integer array containing encoded sample values that range from 0 to 3. The conversion from floating point sample value to unsigned int is given below, with lv = TWO_BIT_1_SIGMA = 2.1745:

Input range

Output

value < -lv

0

-lv < value < 0.

2

  1. < value < lv

1

lv < value

3

This does not pack the samples into bytes.