Compress osu replay lzma bytestrings
Project description
WTC
WTC is an extension of the lzma compression format, specifically designed to make osu!std replays smaller before storing them. It reduces the size of certain datatypes in the original .osr format, achieving ~40% lossy compression ratios.
Part | Original lzma datatype | WTC datatype |
---|---|---|
w (ms since preivous frame) | Long (8 bytes) | 24bit Integer (3 bytes) |
x (x-cord) | Float (4 bytes) | Short (2 bytes) |
y (y-cord) | Float (4 bytes) | Short (2 bytes) |
z (bit combination of keypresses) | Integer (4 bytes) | Char (1 byte) |
This compresses the original 20 byte frame to an 8 byte frame, but not without losses. Precision is lost on w, x, and y, but not z, because the keypressed bit combination will never go above 4 bits for osu!standard. Though it may be larger for other gamemodes such as 7k mania, this compressor is explicitly for osu!standard.
WTC compression achieves an average of 40% ±5 compression (Not a formally calculated number - simply based on experience).
Installation:
$ pip install git+git://github.com/osu-anticheat/wtc-lzma-compressor
Usage:
import wtc
# to compress an lzma bytestring
wtc_bytestring = wtc.compress(lzma_bytestring)
# to decompress a wtc bytestring into an lzma bytestring
lzma_bytestring = wtc.decompress(wtc_bytestring)
# compress and decompress are (almost) inverse operations, so lzma_bytestring ≈ wtc.decompress(wtc.compress(lzma_bytestring)).
# some precision is lost, so the strings are not identical.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wtc-1.1.3.tar.gz
.
File metadata
- Download URL: wtc-1.1.3.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a00c531065d849ebdfce9886c8c985b7c2f2996442837d608b6ce62e39ae4e5d |
|
MD5 | 020fdae0494e3ec27275d535494948af |
|
BLAKE2b-256 | 9d2537c995ecd2151ee05b7dae69c0976d6b28cdd83bd4efe7472bd5201a28ed |
File details
Details for the file wtc-1.1.3-py3-none-any.whl
.
File metadata
- Download URL: wtc-1.1.3-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 270c748426b819008aa7a7d4639147e34f5aad8f2db4b6e896f83d239af14b80 |
|
MD5 | 8ea8ecae305c3646a59a0dcb0b92669f |
|
BLAKE2b-256 | 33a28a76e4fa8743b0ace6ed89b935f291787988406e512a989886b68ec9ae2c |