Skip to main content

Python implementation of carry-less range coder

Both static and dynamic encoding can be used.

Install

$ pip install CarryLessRangeCoder

Examples

from collections import Counter
import carryless_rangecoder as rc
from io import BytesIO

data = list(map(ord, 'qawsedrftgyhujikolp;'))
count = [1] * 256
for i, c in Counter(data).items():
    count[i] += c
count_cum = [0] * 256
for i in range(1, 256):
    count_cum[i] = count[i] + count_cum[i - 1]

out = BytesIO()
# Encode
with rc.Encoder(out) as enc:  # or enc.finish()
    for index in data:
        enc.encode(count, count_cum, index)
# Decode
decoded = []
with rc.Decode(out) as dec:  # or dec.start()
    for _ in range(len(data)):
        decoded.append(dec.decode(count, count_cum))

assert decoded == data

Metadata

Release files for CarryLessRangeCoder 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for CarryLessRangeCoder 1.0.2
File Size Uploaded Provenance Actions
CarryLessRangeCoder-1.0.2.tar.gz 3.0 kB Without provenance Details for CarryLessRangeCoder-1.0.2.tar.gz

Release files / CarryLessRangeCoder-1.0.2.tar.gz

Download URL CarryLessRangeCoder-1.0.2.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f56d69ef2b745d979d223601a2810ddfd0dd3da0fafdd7b194aa2606b7ac1314
BLAKE2b-256 checksum
How to use checksums
32f6641bf20c6b5d29bb866e8ed222a9800ea60be120dea99483f12945853b9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Security for CarryLessRangeCoder 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page