Skip to content

ThisKwasior/wcec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WCEC

Lossless compression format and C/C++ library made out of boredom.

Go to wcec.h for format specification.

Library example - example_one_frame.c

wcec_tool

A program to compress and decompress WCEC data.

Building

$ gcc -o wcec_tool wcec_tool.c wcec/wcec.c -std=c99 -s -O3 -I.

Usage

$ ./wcec_tool
Usage:
        Compression       - ./wcec_tool c <depth 1-12> <file> <output>
        Fixed size frames - ./wcec_tool f <size 1-32> <file> <output>
        Decompression     - ./wcec_tool d <file> <output>

FAQ

Why?

I was bored and wanted to try compressing u8 pcm audio. Got 0.67-0.92 ratios of compression on that, depending on a file.

Is it better than zlib or LZMA?

Of course not.

Should I use it?

Decompression is pretty fast, compression not so much. I'd say try it out.

Benchmark

Sizes

file size wcec c 1 wcec c 2 wcec c 3 wcec f 32 zip -9 xz -9 –format=lzma
lorem.txt 1026 962 (93,8%) 959 (93,5%) 957 (93,3%) 963 (93,9%) 686 (66,9%) 600 (58,5%)
vance_intro_u8_16khz_mono.wav 960078 490517 (51,1%) 467731 (48,7%) 463106 (48,2%) 545815 (56,9%) 359759 (37,5%) 311346 (32,4%)
vance_run.opus 440032 452960 (102,9%) 452279 (102,8%) 452286 (102,8%) 453344 (103,0%) 438225 (99,6%) 441215 (100,3%)
wcec_img.bmp 196662 200959 (102,2%) 200852 (102,1%) 200848 (102,1%) 201035 (102,2%) 37877 (19,3%) 31313 (15,9%)
wcec_img.jpg 67683 69747 (103,0%) 69713 (103,0%) 69712 (103,0%) 69754 (103,1%) 67722 (100,1%) 68092 (100,6%)
wcec_img.png 55817 57560 (103,1%) 57544 (103,1%) 57544 (103,1%) 57562 (103,1%) 56001 (100,3%) 56356 (101,0%)

Time

file wcec c 1 wcec c 2 wcec c 3 wcec f 32 zip -9 xz -9 –format=lzma
lorem.txt 0,004s 0,005s 0,057s 0,007s 0,010s 0,033s
vance_intro_u8_16khz_mono.wav 0,037s 1,311s 41,520s 0,030s 0,161s 0,380s
vance_run.opus 0,014s 0,464s 21,441s 0,005s 0,037s 0,165s
wcec_img.bmp 0,009s 0,225s 9,106s 0,010s 0,094s 0,097s
wcec_img.jpg 0,005s 0,100s 3,424s 0,003s 0,026s 0,054s
wcec_img.png 0,005s 0,072s 2,897s 0,009s 0,011s 0,041s

Acknowledgments

  1. Files samples/vance_intro_u8_16khz_mono.wav and samples/vance_run.opus are licensed under CC BY 4.0. Full playlist of the songs is here.

  2. samples/lorem.txt has been generated using lipsum.com

  3. samples/wcec_img.bmp, samples/wcec_img.jpg and samples/wcec_img.png have been made by me and are licensed under the same license as the library.

About

Lossless compression format and C/C++ library made out of boredom

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages