encode_4bit_base¶
-
baseband.base.encoding.
encode_4bit_base
(values)[source] [edit on github]¶ Generic encoder for data stored using four bits.
This returns an unsigned integer array containing encoded sample values that range from 0 to 15. Floating point sample values are converted to unsigned int by first scaling them by
FOUR_BIT_1_SIGMA = 2.95
, then adding 8.5 (the 0.5 to ensure proper rounding when typecasting to uint8). Some sample output levels are:Input range
Output
value*scale < -7.5
0
-7.5 < value*scale < -6.5
1
-0.5 < value*scale < +0.5
8
6.5 < value*scale
15
This does not pack the samples into bytes.