encode_2bit

baseband.mark5b.payload.encode_2bit(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.