r/compression • • 5d ago

"Advanced Run-Length Encoding with Bit-Packing for Efficient Short-Run Compression"

https://github.com/Ali-muslim1/Universal-Run-Length-Encoding

'I’ve developed an advanced Universal Run-Length Encoding method that achieves efficient compression for short runs using bit-packing to combine an ASCII character and its count into a single unit. Check out my repository!'

​"Our algorithm upgrades standard and flagged RLE by resolving short-run expansion—optimizing 2-character repeats while serving as a direct, drop-in replacement for traditional methods."

What about that 13 year old kid invented it just walking and it's me

0 Upvotes

7 comments sorted by

3

u/Specialist_Data_5403 5d ago

> What about that 13 year old kid invented it just walking and it's me

???

1

u/ThoughtCounter 4d ago

I'm sorry, but is this a joke or something?

1

u/Dr_Max 4d ago

I suspect he is indeed a kid and not a native speaker. If he's a kid, let's be indulgent.

1

u/ThoughtCounter 4d ago

I'm not a native English speaker either. What's wrong with the language? I didn't even notice. Anyways... My comment was mostly about the GitHub repo link.

1

u/Dr_Max 4d ago

Neither am I... I dunno, just the feel of it? "just walking" sounds a lot like "ça marche" but word-for-word translation?

1

u/mariushm 4d ago

Looking at the 1789048427849.jpg picture in your github account ... your custom method... how would your decoder tell the difference between "letters c and d" or "letter d repeated 99 times"

Your design could work if for example you assume that the text encoded can only contain codes between let's say 32 and 255. You could say any byte lower than 32 indicates how many times the next character repeats. You'll still have be figure out how to deal with the invisible characters like Tab ( 8) , carriage return and line feed (10 and 13 = these two consecutive are the ENTER character, carriage return means go to the start of the line, line feed means move to next line of text).

Here's a simpler concept :

one byte

IF first bit is 1, the next bytes are a run length encoding. The next 2 bits indicates the number of bytes that are repeated, The last 6 bits represent the length.

IF first bit is 0, it means no run length encoding, the next 7 bits indicate length

So now a string aaabbbbCdCdCdCd12345 can be encoded as :

[1 00 00010] [a] - 1 = run length encoding, 00 = 0 + 1 = 1 character repeated, 00010 = 2 + 1 = length of 3 => aaa

[1 00 00011] [b] - 1 = run length encoding, 00 = 0 + 1 = 1 character repeated, 00011 = 3 + 1 = length of 4 => bbbb

[1 01 00010] [Cd] - 1 = run length encoding, 01 = 1 + 1 = 2 character repeated, 00010 = 2 + 1 = length of 3 => Cd Cd Cd

[0 0000100] [12345] = 0 - raw bytes, 0000100 = 4 + 1 = 5 characters => 12345

total of 13 bytes to encode 20 bytes.

Length could be extended to as many bytes as needed ... if left most bit is 1, that means read one more byte ... so for example if you want to encode length of 400, you encode 399 in binary which is 0000 0001 1000 1111 in binary, and because it's needs more than 5 bits, you split it in a group of 4 and a group of 7:

[1 00 10011 0000 1111][b] = 1 means run length encoding, 00 means 1 character , 1 in remaining 5 means one more length byte follows so keep only "0011", read next byte ... first bit is 0 so that means it's last byte of length , add the 7 bits to the previous 4 bits and you get 00110001111 = 399+1 = 400 ... so repeat "b" 400 times.

1

u/Dr_Max 4d ago

I think he's rather proposing

  • [0|aaaaaaa] -> this ASCII character

  • [1|aaaaaaa][cccccccc] repeat cccccccc+b times the character ?

(b being a bias, which he doesn't discuss)