MCPcopy Create free account
hub / github.com/bamler-lab/constriction / test_range_coding_decode2

Function test_range_coding_decode2

tests/python/test_docexamples.py:605–616  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

603
604
605def test_range_coding_decode2():
606 # Use the same concrete entropy model as in the previous example:
607 probabilities = np.array([0.1, 0.6, 0.3], dtype=np.float64)
608 model = constriction.stream.model.Categorical(probabilities, perfect=False)
609
610 # Decode 9 symbols from some example compressed data, using the
611 # same (fixed) entropy model defined above for all symbols:
612 compressed = np.array([369323576], dtype=np.uint32)
613 decoder = constriction.stream.queue.RangeDecoder(compressed)
614 symbols = decoder.decode(model, 9)
615 assert np.all(symbols == np.array(
616 [0, 2, 1, 2, 0, 2, 0, 2, 1], dtype=np.int32))
617
618
619def test_range_coding_seek():

Callers

nothing calls this directly

Calls 1

decodeMethod · 0.95

Tested by

no test coverage detected