Skip to content

Commit 8ffa226

Browse files
committed
add readme with example
1 parent caf365f commit 8ffa226

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Installation
2+
============
3+
4+
pip install range-coder
5+
6+
7+
Example
8+
=======
9+
10+
```python
11+
data = [2, 0, 1, 0, 0, 0, 1, 2, 2]
12+
prob = [0.5, 0.2, 0.3]
13+
cumFreq = prob_to_cum_freq(prob, resolution=128)
14+
15+
# encode data
16+
encoder = RangeEncoder(filepath)
17+
encoder.encode(data, cumFreq)
18+
encoder.close()
19+
20+
# decode data
21+
decoder = RangeDecoder(filepath)
22+
dataRec = decoder.decode(len(data), cumFreq)
23+
decoder.close()
24+
```

0 commit comments

Comments
 (0)