Home

Awesome

<a href="https://github.com/rainerzufalldererste/hypersonic-rle-kit"><img src="https://raw.githubusercontent.com/rainerzufalldererste/hypersonic-rle-kit/master/docs/logo.png" alt="hypersonic rle kit logo" style="width: 533pt; max-width: 100%; margin: 50pt auto;"></a> <br>

What is it?

Benchmark

See Full Benchmark with Graphs, the tables below only contain a tiny selection of the 100+ codecs.

<a href="https://rainerzufalldererste.github.io/hypersonic-rle-kit/"><img src="https://raw.githubusercontent.com/rainerzufalldererste/hypersonic-rle-kit/master/docs/screenshot.png" alt="hypersonic rle kit pareto graph screenshot" style="width: 100%;"></a> <br>

video-frame.raw (heavily quantized video frame DCTs, 88,473,600 Bytes)

TypeRatioEncoding SpeedDecoding SpeedEntropy<br/>Compressible To
8 Bit19.34 %3,319.6 MiB/s25,830.4 MiB/s9.50 %
8 Bit Packed17.95 %2,907.5 MiB/s19,783.6 MiB/s9.69 %
8 Bit 1LUT Short16.93 %2,365.1 MiB/s11,069.1 MiB/s9.87 %
8 Bit 3LUT17.41 %2,146.7 MiB/s15,819.2 MiB/s9.80 %
8 Bit 3LUT Short16.49 %2,085.6 MiB/s8,100.4 MiB/s9.93 %
8 Bit 7LUT17.46 %2,094.6 MiB/s16,100.9 MiB/s9.94 %
8 Bit Single18.31 %1,654.7 MiB/s23,750.2 MiB/s9.71 %
8 Bit Single Short17.05 %1,414.4 MiB/s14,143.6 MiB/s9.81 %
16 Bit 1LUT Short (Symbol)18.23 %3,783.5 MiB/s13,705.5 MiB/s9.72 %
16 Bit 1LUT Short (Byte)18.11 %3,745.3 MiB/s12,951.5 MiB/s9.90 %
16 Bit 3LUT (Byte)17.74 %3,708.2 MiB/s15,577.4 MiB/s9.82 %
16 Bit 7LUT (Byte)17.53 %3,526.7 MiB/s13,249.8 MiB/s9.96 %
16 Bit 7LUT Short Greedy (Byte)15.37 %691.3 MiB/s3,075.2 MiB/s10.59 %
24 Bit Packed (Byte)19.19 %6,890.9 MiB/s21,560.0 MiB/s9.57 %
24 Bit 3LUT (Byte)18.52 %5,367.1 MiB/s18,636.5 MiB/s9.49 %
24 Bit 7LUT (Byte)18.44 %5,196.5 MiB/s17,679.4 MiB/s9.59 %
24 Bit 7LUT Short Greedy (Byte)15.46 %639.3 MiB/s3,375.4 MiB/s10.67 %
32 Bit Packed (Byte)19.82 %8,946.4 MiB/s23,569.8 MiB/s9.46 %
32 Bit 3LUT (Byte)19.25 %7,149.3 MiB/s23,580.3 MiB/s9.34 %
32 Bit 7LUT (Byte)19.22 %7,066.1 MiB/s23,033.8 MiB/s9.45 %
32 Bit 7LUT Short Greedy (Byte)15.09 %663.1 MiB/s3,298.1 MiB/s10.59 %
48 Bit Packed (Byte)20.84 %10,911.9 MiB/s26,397.7 MiB/s9.40 %
48 Bit 3LUT (Byte)20.41 %9,304.9 MiB/s25,603.9 MiB/s9.25 %
48 Bit 3LUT Short Greedy (Byte)15.88 %931.3 MiB/s6,064.8 MiB/s10.04 %
48 Bit 7LUT (Byte)20.42 %9,457.1 MiB/s25,088.5 MiB/s9.34 %
64 Bit Packed (Symbol)22.34 %12,697.9 MiB/s26,375.4 MiB/s9.23 %
64 Bit (Byte)23.66 %13,514.1 MiB/s25,773.6 MiB/s9.63 %
64 Bit Packed (Byte)21.63 %13,306.5 MiB/s26,183.1 MiB/s9.40 %
64 Bit 3LUT (Byte)21.30 %11,442.9 MiB/s27,864.0 MiB/s9.25 %
64 Bit 3LUT Short Greedy (Byte)15.66 %905.2 MiB/s6,293.0 MiB/s9.95 %
64 Bit 7LUT (Byte)21.32 %11,479.3 MiB/s26,879.6 MiB/s9.32 %
8 Bit RLE + Huffman-esque12.51 %332.0 MiB/s1,676.7 MiB/s9.82 %
Low Entropy19.93 %800.2 MiB/s2,690.6 MiB/s9.05 %
Low Entropy Single19.96 %802.4 MiB/s4,389.0 MiB/s9.10 %
-----
memcpy100.00 %28,667.8 MiB/s28,590.1 MiB/s14.03 %
trle16.0 %1,177.7 MiB/s5,356.0 MiB/s-
srle 017.8 %1,182.3 MiB/s11,214.7 MiB/s-
srle 818.7 %2,044.3 MiB/s12,300.2 MiB/s-
srle 1621.3 %1,997.0 MiB/s15,479.0 MiB/s-
srle 3224.2 %3,782.2 MiB/s18,975.8 MiB/s-
srle 6427.5 %6,581.4 MiB/s23,128.3 MiB/s-
mrle19.7 %450.3 MiB/s3,168.4 MiB/s-

1034.db (Checkers program "End Game Table Base", 419,225,625 Bytes)

TypeRatioEncoding SpeedDecoding SpeedEntropy<br/>Compressible To
8 Bit23.02 %2,443.8 MiB/s21,198.0 MiB/s12.08 %
8 Bit Packed20.10 %2,199.4 MiB/s15,151.8 MiB/s12.74 %
8 Bit 1LUT Short18.91 %1,767.7 MiB/s7,905.5 MiB/s12.46 %
8 Bit 3LUT19.77 %1,841.7 MiB/s14,211.6 MiB/s12.31 %
8 Bit 7LUT19.75 %1,768.7 MiB/s14,629.5 MiB/s12.50 %
8 Bit Single20.59 %1,325.0 MiB/s18,469.7 MiB/s12.06 %
8 Bit Single Short18.55 %1,157.3 MiB/s9,756.9 MiB/s12.09 %
16 Bit Packed (Byte)20.65 %3,378.7 MiB/s15,516.6 MiB/s12.59 %
16 Bit 3LUT (Byte)20.20 %2,641.6 MiB/s15,500.6 MiB/s12.30 %
16 Bit 7LUT (Byte)20.14 %2,708.0 MiB/s13,971.5 MiB/s12.35 %
24 Bit Packed (Byte)22.05 %4,233.2 MiB/s17,670.5 MiB/s12.34 %
24 Bit 3LUT (Byte)21.52 %3,448.9 MiB/s16,464.5 MiB/s11.96 %
32 Bit Packed (Byte)23.44 %5,240.1 MiB/s17,864.4 MiB/s12.15 %
32 Bit 3LUT (Byte)22.86 %4,289.1 MiB/s20,829.1 MiB/s11.79 %
32 Bit 7LUT (Byte)22.89 %4,294.6 MiB/s20,065.2 MiB/s11.86 %
48 Bit Packed (Byte)25.87 %6,516.7 MiB/s22,210.4 MiB/s11.95 %
48 Bit 3LUT (Byte)25.41 %5,712.4 MiB/s20,904.4 MiB/s11.66 %
64 Bit 3LUT (Symbol)28.66 %6,464.5 MiB/s23,401.9 MiB/s11.56 %
64 Bit (Byte)31.66 %8,034.7 MiB/s21,153.2 MiB/s12.16 %
64 Bit Packed (Byte)27.29 %7,836.3 MiB/s22,219.0 MiB/s11.90 %
64 Bit 3LUT (Byte)26.90 %6,780.3 MiB/s23,777.1 MiB/s11.63 %
64 Bit 7LUT (Byte)27.05 %6,839.2 MiB/s22,970.8 MiB/s11.76 %
128 Bit (Byte)37.25 %6,763.4 MiB/s24,011.4 MiB/s12.28 %
128 Bit Packed (Byte)31.21 %6,582.9 MiB/s23,994.6 MiB/s11.98 %
8 Bit RLE + Huffman-esque16.76 %326.5 MiB/s1,456.9 MiB/s12.36 %
Low Entropy21.15 %799.7 MiB/s4,282.1 MiB/s10.37 %
Low Entropy Single21.15 %765.9 MiB/s4,292.2 MiB/s10.37 %
-----
memcpy100.00 %26,689.1 MiB/s27,304.6 MiB/s16.76 %
trle17.4 %1,112.8 MiB/s4,097.4 MiB/s-
srle 020.2 %1,080.3 MiB/s8,027.7 MiB/s-
srle 822.0 %1,816.5 MiB/s8,802.3 MiB/s-
srle 1627.1 %1,644.2 MiB/s9,915.1 MiB/s-
srle 3232.7 %2,870.4 MiB/s13,289.7 MiB/s-
srle 6439.5 %4,763.9 MiB/s18,966.4 MiB/s-
mrle21.0 %446.9 MiB/s3,115.4 MiB/s-

enwik9.bwt (Wikipedia extract enwiki9 encoded using libdivsufsort, 1,000,000,124 Bytes)

TypeRatioEncoding SpeedDecoding SpeedEntropy<br/>Compressible To
8 Bit48.80 %1,225.6 MiB/s16,097.6 MiB/s34.13 %
8 Bit Short44.42 %899.3 MiB/s6,975.0 MiB/s32.26 %
8 Bit Packed44.86 %1,038.7 MiB/s7,514.9 MiB/s32.95 %
8 Bit 1LUT Short41.87 %828.2 MiB/s4,088.0 MiB/s31.38 %
8 Bit 3LUT43.29 %775.1 MiB/s6,116.6 MiB/s32.27 %
8 Bit 3LUT Short40.34 %765.3 MiB/s3,046.5 MiB/s30.63 %
8 Bit 7LUT42.98 %720.4 MiB/s4,845.2 MiB/s32.42 %
16 Bit Packed (Symbol)47.89 %1,871.4 MiB/s9,417.5 MiB/s34.25 %
16 Bit 1LUT Short (Symbol)46.43 %1,425.4 MiB/s5,926.8 MiB/s33.47 %
16 Bit Packed (Byte)46.99 %1,975.6 MiB/s8,322.4 MiB/s33.96 %
16 Bit 1LUT Short (Byte)46.15 %1,404.6 MiB/s5,410.5 MiB/s33.47 %
16 Bit 3LUT (Byte)44.91 %1,332.9 MiB/s5,786.9 MiB/s33.36 %
16 Bit 7LUT (Byte)44.17 %1,269.3 MiB/s4,792.9 MiB/s33.00 %
24 Bit Packed (Byte)49.39 %2,846.0 MiB/s10,096.3 MiB/s35.00 %
24 Bit 3LUT (Byte)47.63 %2,154.2 MiB/s8,316.6 MiB/s34.23 %
24 Bit 7LUT (Byte)47.15 %2,021.5 MiB/s7,081.2 MiB/s33.86 %
32 Bit Packed (Byte)51.63 %3,991.3 MiB/s12,316.8 MiB/s35.94 %
32 Bit 3LUT (Byte)50.02 %3,049.7 MiB/s11,014.7 MiB/s35.15 %
32 Bit 7LUT (Byte)49.72 %2,929.3 MiB/s9,734.1 MiB/s34.97 %
48 Bit (Byte)57.58 %5,568.3 MiB/s17,036.4 MiB/s38.86 %
48 Bit Packed (Byte)55.01 %5,463.9 MiB/s16,106.6 MiB/s37.48 %
48 Bit 3LUT (Byte)53.66 %4,511.6 MiB/s14,552.7 MiB/s36.78 %
48 Bit 7LUT (Byte)53.48 %4,362.4 MiB/s13,340.3 MiB/s36.64 %
64 Bit Packed (Symbol)58.87 %6,995.2 MiB/s17,252.6 MiB/s39.42 %
64 Bit (Byte)59.94 %7,594.6 MiB/s17,821.4 MiB/s40.05 %
64 Bit Packed (Byte)57.33 %7,285.0 MiB/s16,557.0 MiB/s38.65 %
64 Bit 1LUT Short (Byte)57.24 %6,176.4 MiB/s16,263.8 MiB/s38.60 %
64 Bit 3LUT (Byte)56.28 %6,050.7 MiB/s17,019.3 MiB/s38.04 %
64 Bit 7LUT (Byte)56.10 %5,933.0 MiB/s16,061.7 MiB/s37.92 %
128 Bit Packed (Symbol)64.32 %5,640.8 MiB/s20,237.7 MiB/s42.35 %
128 Bit Packed (Byte)62.94 %5,650.8 MiB/s20,158.4 MiB/s41.61 %
8 Bit MMTF 12863.49 %1,101.2 MiB/s1,299.9 MiB/s29.84 %
Low Entropy64.19 %383.3 MiB/s913.9 MiB/s34.06 %
Low Entropy Single89.22 %561.6 MiB/s7,491.0 MiB/s59.50 %
Low Entropy Short66.17 %394.1 MiB/s1,412.4 MiB/s36.11 %
Low Entropy Short Single89.65 %576.5 MiB/s9,841.2 MiB/s61.05 %
Multi MTF 128 Bit (Transform)100.00 %1,206.2 MiB/s1,289.8 MiB/s33.92 %
Multi MTF 256 Bit (Transform)100.00 %2,012.2 MiB/s1,966.1 MiB/s35.65 %
Bit MMTF 8 Bit (Transform)100.00 %1,843.2 MiB/s1,973.5 MiB/s35.87 %
Bit MMTF 16 Bit (Transform)100.00 %2,309.8 MiB/s2,272.9 MiB/s38.34 %
-----
memcpy100.00 %26,973.3 MiB/s27,041.2 MiB/s65.94 %
trle42.0 %697.6 MiB/s2,062.9 MiB/s-
srle 046.4 %680.6 MiB/s5,004.5 MiB/s-
srle 846.9 %858.6 MiB/s6,095.1 MiB/s-
srle 1654.4 %906.4 MiB/s8,676.0 MiB/s-
srle 3261.0 %1,766.0 MiB/s13,019.7 MiB/s-
srle 6466.8 %3,289.0 MiB/s18,491.6 MiB/s-
mrle64.1 %320.2 MiB/s1,104.0 MiB/s-

The 24 Bit and 48 Bit Variants allow for run length encoding of common data layouts that are usually not covered by RLE implementations:

Pixel Art Bitmap Image (PNG converted to BMP, 123,710,454 Bytes)

TypeRatioEncoding SpeedDecoding SpeedEntropy<br/>Compressible To
8 Bit99.99 %6,995.3 MiB/s18,357.0 MiB/s76.10 %
8 Bit 1LUT Short99.98 %6,974.3 MiB/s18,023.2 MiB/s75.63 %
8 Bit 3LUT99.99 %6,936.1 MiB/s18,595.7 MiB/s75.94 %
8 Bit Single100.00 %3,512.8 MiB/s18,470.1 MiB/s77.03 %
16 Bit Short (Byte)99.99 %18,127.2 MiB/s18,953.0 MiB/s75.56 %
16 Bit 3LUT Short (Byte)99.99 %17,991.9 MiB/s19,252.9 MiB/s75.71 %
24 Bit (Symbol)1.84 %24,537.1 MiB/s33,067.5 MiB/s1.32 %
24 Bit Short (Symbol)2.08 %21,904.2 MiB/s32,713.6 MiB/s1.52 %
24 Bit Packed (Symbol)2.00 %23,590.4 MiB/s32,955.6 MiB/s1.39 %
24 Bit 1LUT Short (Symbol)2.08 %19,894.5 MiB/s32,751.7 MiB/s1.51 %
24 Bit 3LUT (Symbol)1.31 %21,232.5 MiB/s33,073.5 MiB/s0.93 %
24 Bit 3LUT Short (Symbol)1.53 %19,147.7 MiB/s32,890.5 MiB/s1.04 %
24 Bit 7LUT (Symbol)1.20 %20,599.0 MiB/s32,846.9 MiB/s0.83 %
24 Bit 7LUT Short (Symbol)1.41 %18,916.5 MiB/s31,750.2 MiB/s0.92 %
24 Bit (Byte)2.13 %25,939.7 MiB/s33,113.4 MiB/s1.44 %
24 Bit Short (Byte)2.17 %23,579.9 MiB/s32,825.6 MiB/s1.58 %
24 Bit Packed (Byte)2.32 %26,738.2 MiB/s32,812.0 MiB/s1.51 %
24 Bit 1LUT Short (Byte)2.17 %21,550.6 MiB/s32,835.9 MiB/s1.59 %
24 Bit 1LUT Short Greedy (Byte)2.17 %5,534.5 MiB/s32,679.0 MiB/s1.59 %
24 Bit 3LUT (Byte)1.49 %23,408.0 MiB/s33,010.6 MiB/s1.03 %
24 Bit 3LUT Short (Byte)1.63 %21,063.2 MiB/s32,713.6 MiB/s1.14 %
24 Bit 3LUT Short Greedy (Byte)1.63 %5,403.1 MiB/s32,578.9 MiB/s1.14 %
24 Bit 7LUT (Byte)1.37 %22,589.6 MiB/s32,629.3 MiB/s0.98 %
24 Bit 7LUT Short (Byte)1.52 %20,560.6 MiB/s31,915.9 MiB/s0.97 %
24 Bit 7LUT Short Greedy (Byte)1.52 %5,436.8 MiB/s32,009.5 MiB/s0.97 %
32 Bit Packed (Byte)99.99 %16,961.2 MiB/s19,048.9 MiB/s75.71 %
32 Bit 7LUT Short (Byte)99.99 %16,887.8 MiB/s19,240.9 MiB/s75.79 %
48 Bit (Symbol)2.78 %23,645.9 MiB/s32,870.0 MiB/s2.12 %
48 Bit Short (Symbol)2.79 %21,386.8 MiB/s32,833.3 MiB/s2.26 %
48 Bit Packed (Symbol)2.87 %22,575.5 MiB/s32,913.6 MiB/s2.17 %
48 Bit 1LUT Short (Symbol)3.09 %19,362.4 MiB/s32,750.9 MiB/s2.41 %
48 Bit 3LUT (Symbol)1.71 %20,826.5 MiB/s32,843.5 MiB/s1.33 %
48 Bit 3LUT Short (Symbol)1.99 %18,834.0 MiB/s32,717.0 MiB/s1.47 %
48 Bit 7LUT (Symbol)1.49 %20,185.7 MiB/s32,619.2 MiB/s1.15 %
48 Bit 7LUT Short (Symbol)1.77 %18,184.3 MiB/s31,846.0 MiB/s1.26 %
48 Bit (Byte)3.16 %25,473.5 MiB/s32,911.9 MiB/s2.31 %
48 Bit Short (Byte)3.20 %23,439.2 MiB/s32,689.1 MiB/s2.48 %
48 Bit Packed (Byte)3.35 %25,371.9 MiB/s32,548.7 MiB/s2.40 %
48 Bit 1LUT Short (Byte)3.20 %20,935.0 MiB/s32,603.2 MiB/s2.48 %
48 Bit 1LUT Short Greedy (Byte)3.20 %9,723.8 MiB/s32,490.3 MiB/s2.48 %
48 Bit 3LUT (Byte)1.98 %22,790.5 MiB/s32,861.4 MiB/s1.49 %
48 Bit 3LUT Short (Byte)2.13 %20,273.7 MiB/s32,717.9 MiB/s1.62 %
48 Bit 3LUT Short Greedy (Byte)2.13 %8,178.3 MiB/s32,537.9 MiB/s1.62 %
48 Bit 7LUT (Byte)1.76 %21,776.5 MiB/s32,615.9 MiB/s1.34 %
48 Bit 7LUT Short (Byte)1.90 %20,145.3 MiB/s31,847.6 MiB/s1.35 %
48 Bit 7LUT Short Greedy (Byte)1.90 %7,895.9 MiB/s31,782.1 MiB/s1.35 %
64 Bit (Symbol)99.99 %14,820.8 MiB/s19,040.6 MiB/s75.87 %
64 Bit 7LUT (Byte)99.99 %14,692.8 MiB/s19,217.2 MiB/s75.78 %
8 Bit MMTF 12817.70 %5,287.0 MiB/s2,978.1 MiB/s12.31 %
Multi MTF 128 Bit (Transform)100.00 %3,474.5 MiB/s3,482.1 MiB/s19.94 %
Multi MTF 256 Bit (Transform)100.00 %5,030.6 MiB/s5,028.6 MiB/s27.52 %
Bit MMTF 8 Bit (Transform)100.00 %1,861.6 MiB/s1,984.2 MiB/s73.85 %
Bit MMTF 16 Bit (Transform)100.00 %2,340.1 MiB/s2,293.9 MiB/s72.48 %
-----
memcpy100.00 %28,288.5 MiB/s28,261.3 MiB/s77.03 %
trle100.0 %420.41 MiB/s5,473.00 MiB/s-
srle 0100.0 %329.09 MiB/s18,106.88 MiB/s-
srle 8100.0 %468.74 MiB/s17,951.84 MiB/s-
srle 16100.0 %575.39 MiB/s20,198.96 MiB/s-
srle 32100.0 %1,195.77 MiB/s18,437.51 MiB/s-
srle 64100.0 %2,294.94 MiB/s19,407.80 MiB/s-
mrle100.0 %383.18 MiB/s2,551.12 MiB/s-

Variants

8, 16, 24, 32, 48, 64, 128 Bit (Byte Aligned + Symbol Aligned)

8, 16, 24, 32, 48, 64, 128 Bit Packed (Byte Aligned + Symbol Aligned)

1 Sym LUT / 3 Sym LUT / 3 Sym LUT Short / 7 Sym LUT / 7 Sym LUT Short

1 Sym LUT Short Greedy / 3 Sym LUT Short Greedy / 7 Sym LUT Short Greedy

Low Entropy / Low Entropy Short

8 Bit RLE + MMTF (Multi Move-To-Front Transformation)

RLE + Huffman-esque

Raw MMTF (Multi Move-To-Front Transformation)

Setup

git clone https://github.com/rainerzufalldererste/hypersonic-rle-kit.git
cd hypersonic-rle-kit
git submodule update --init --recursive

On Windows

create_project.bat

Choose your preferred compiler toolset

MSBuild /p:Configuration=Release /nologo /v:m

On Linux

premake/premake5 gmake2
config=release_x64 make

How to use it?

#include "rle.h"

uint8_t *pUncompressedData; // Some Data.
uint32_t fileSize; // Some Size.

// Get Compress Bounds.
const uint32_t compressedBufferSize = rle_compress_bounds(fileSize);
uint8_t *pCompressedData = (uint8_t *)malloc(compressedBufferSize);

// Compress.
const uint32_t compressedSize = rle8_multi_compress(pUncompressedData, fileSize, pCompressedData, compressedBufferSize);

// Allocate Output Buffer.
uint8_t *pDecompressedData = (uint8_t *)malloc(fileSize + rle_decompress_additional_size());

// Decompress.
const uint32_t decompressedSize = rle8_decompress(pCompressedData, compressedSize, pDecompressedData, fileSize);

// Cleanup.
free(pCompressedData);
free(pDecompressedData);

License

Two Clause BSD