Cover image
project image

Lempel Ziv Welch Compression technique

Winyis Salmon

7944896729

Verified

Free

View : 67      Download : 2

Product Discription

18-August-2018

LZW Compression

In this technique trick is that string-to-codeword mapping is created dynamically by the encoder also recreated dynamically by the decoder need not pass the code table between the two is a lossless compression algorithm degree of compression hard to predict depends on data, but gets better as codeword table contains more strings.

step 1.Initialize table with single character strings

step 2.STRING = first input character

step 3.WHILE not end of input stream

  1. CHARACTER  = next input character
  2. IF STRING + CHARACTER is in the string table
    1. STRING = STRING + CHARACTER
  3. ELSE
    1. Output the code for STRING
    2. Add STRING + CHARACTER to the string table
    3. STRING = CHARACTER

step 4.END WHILE

step 5.Output code for string

 

STRING            TABLE

ENCODER         OUTPUT

String

codeword

Representing

output code

BA

256

B

66

AB

257

A

65

BAA

258

BA

256

ABA

259

AB

257

AA

260

A

65

   

AA

260

Represent LZW compression steps for Input string BABAABAAA.

LZW De-Compression

step 1.Initialize table with single character strings

step 2.OLD = first input code

step 3.output translation of OLD

step 4.WHILE not end of input stream

  1. NEW = next input code
  2. IF NEW is not in the string table

S = translation of OLD

S = S + C

step 5.ELSE

S=translation of NEW

  1. EndIF
  2. output S
  3. C = first character of S
  4. OLD + C to the string table
  5. OLD = NEW

step 6.END WHILE

 

STRING TABLE

ENCODER OUTPUT

 

 

String

codeword

string

 

   

B

 

BA

256

A

 

AB

257

BA

 

BAA

258

AB

 

ABA

259

A

 

AA

260

AA

           
Represent LZW De-compression steps for Input string BABAABAAA.

Project Sample Image

Other Detail

Software Requirement :   MATLAB any version

Hardware Requirement :   No Requirement


Application :  


Project Attachement

Doc Algorithm Explanation File
Source Code Complete Code files