| 641 | |
| 642 | |
| 643 | def test_range_coding_decode3(): |
| 644 | # Define a generic quantized Gaussian distribution for all integers |
| 645 | # in the range from -100 to 100 (both ends inclusive): |
| 646 | model_family = constriction.stream.model.QuantizedGaussian(-100, 100) |
| 647 | |
| 648 | # Specify the model parameters for each symbol: |
| 649 | means = np.array([10.3, -4.7, 20.5], dtype=np.float64) |
| 650 | stds = np.array([5.2, 24.2, 3.1], dtype=np.float64) |
| 651 | |
| 652 | # Decode a message from some example compressed data: |
| 653 | compressed = np.array([2655472005], dtype=np.uint32) |
| 654 | decoder = constriction.stream.queue.RangeDecoder(compressed) |
| 655 | symbols = decoder.decode(model_family, means, stds) |
| 656 | assert np.all(symbols == np.array([12, -13, 25], dtype=np.int32)) |
| 657 | |
| 658 | |
| 659 | def test_range_coding_decode4(): |