()
| 354 | |
| 355 | |
| 356 | def test_ans_encode_reverse2(): |
| 357 | # Use the same concrete entropy model as in the previous example: |
| 358 | probabilities = np.array([0.1, 0.6, 0.3], dtype=np.float64) |
| 359 | model = constriction.stream.model.Categorical(probabilities, perfect=False) |
| 360 | |
| 361 | # Encode an example message using the above `model` for all symbols: |
| 362 | symbols = np.array([0, 2, 1, 2, 0, 2, 0, 2, 1], dtype=np.int32) |
| 363 | coder = constriction.stream.stack.AnsCoder() |
| 364 | coder.encode_reverse(symbols, model) |
| 365 | assert np.all(coder.get_compressed() == np.array( |
| 366 | [1276728145, 172], dtype=np.uint32)) |
| 367 | |
| 368 | |
| 369 | def test_ans_encode_reverse3(): |
nothing calls this directly
no test coverage detected