Jump to content




Lempel Ziv Welch (LZW) Compression


  • You cannot reply to this topic
4 replies to this topic

#1 HaddockDev

  • Members
  • 61 posts
  • LocationSomewhere, deep down under a rainbow.

Posted 13 February 2017 - 06:32 PM

LZW is a sorta not really kinda compression algorithm thingy created by Abraham Lempel, Jacob Ziv, and Terry Welch hence the name, Lempel Ziv Welch. It is used in the *nix program compress, and GIF images.

I have ported somebody's implementation of it in Lua, you can find the original here.

It isn't really that bad, but it has it's quirks. (Shaves 1 character off of "This is a test.", your mileage may vary.)
It is also fast, less than a second for "This is a test."

Usage

You can download it with: pastebin get WZKTR9q4 lzw
Yeah, I know about the typos. I originally thought it was LWZ.
Also, sorry about the sad mush of a post I made. Couldn't upload much because were dealing with a storm at the moment

The API is licensed under MIT because of the original file.
You can find a layman term page for MIT here.

Edited by Haddock, 25 February 2017 - 11:55 AM.


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 14 February 2017 - 12:03 AM

Don't forget to follow the terms of the original license!

You might consider adding linebreak codes, such as \n and perhaps \r, to your dictionary. Tabs (\009) wouldn't hurt either.

#3 HaddockDev

  • Members
  • 61 posts
  • LocationSomewhere, deep down under a rainbow.

Posted 14 February 2017 - 02:43 PM

View PostBomb Bloke, on 14 February 2017 - 12:03 AM, said:

Don't forget to follow the terms of the original license!
There was none, so I just ported it. But, I still gave credit.

View PostBomb Bloke, on 14 February 2017 - 12:03 AM, said:

You might consider adding linebreak codes, such as \n and perhaps \r, to your dictionary. Tabs (\009) wouldn't hurt either.

Yeah, I could. I'll update it later.

#4 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 14 February 2017 - 03:44 PM

Read the first four lines of the file you linked.

Specifically,

Quote

This code is MIT licensed, see http://www.opensourc...mit-license.php
© 2013 - Guava

Edited by KingofGamesYami, 14 February 2017 - 03:45 PM.


#5 HaddockDev

  • Members
  • 61 posts
  • LocationSomewhere, deep down under a rainbow.

Posted 25 February 2017 - 11:52 AM

View PostKingofGamesYami, on 14 February 2017 - 03:44 PM, said:

Read the first four lines of the file you linked.

Specifically,

Quote

This code is MIT licensed, see http://www.opensourc...mit-license.php
© 2013 - Guava

Ah, my bad. I'll write a little notice now.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users