SlideShare a Scribd company logo
LZW
Compression
Compression:
 It is a process of reducing size by encoding it’s information
more efficiently.
 Due to this there is a reduction in the number of bits and bytes
used to store the information.
 A smaller file size is generated in order to achieve a faster
transmission of electronic files and a smaller space required
for its downloading.
LZW compression:
 LZW is the first letter of the names of the scientists Abraham
Lempel, Jakob Ziv, and Terry Welch, who developed this
algorithm.
 Is a lossless compression algorithm.
 It is simple and is dictionary based.
Working of LZW compression:
 It is a simple process.
 It replaces strings of characters with single codes.
 A new string of characters is added every time it sees to a
table of strings.
 Compression occurs when a single code is output instead of a
string of characters.
 The first 256 codes are by default assigned to the standard
character set.
Continue…
 Starts with a dictionary of all the single characters and
gradually builds the dictionary as the information is sent
through.
 Lossless compression hence works good for text compression.
 Uses a code table with 4096 as a common choice for number
entries.
Why to use LZW compression:
 Two reasons . . .
 For most palette color images LZW yields the highest
compression efficiency without sacrificing image data.
 The GIF image file format is the de facto standard for images
on the web. Most GIF files use the LZW compression.
LZW Algorithm:
 The LZW Compression Algorithm can summarised as follows:
w = NIL;
while ( read a character k )
{
if wk exists in the dictionary
w = wk;
else
add wk to the dictionary;
output the code for w;
w = k;
}
LZW Encoding:
 If the message to be encoded consists of only one character,
LZW outputs the code for this character; otherwise it inserts
two-or multi-character, overlapping.
 The last character of a pattern is the first character of the next
pattern.
LZW Encoding algorithm:
 Prefix←first input character;
CodeWord←256;
while(not end of character stream)
{ Char← next input character;
if(Prefix+ Char exists in the Dictionary)
Prefix ←Prefix + Char;
Else
{
Output : the code for Prefix;
insertInDictionary( (CodeWord, Prefix + Char) ) ;
CodeWord++;
Prefix←Char;
}
}
Example:
LZW Decoding:
 The LZW decompressor creates the same string table during
decompression.
 Initialize Dictionary with 256 ASCII codes and corresponding
single character strings as their translations.
LZW Decoding algorithm:
 output: string(firstCodeWord);
while(there are more CodeWords)
{
If(Current code word is in the dictionary)
Output: String(Current Code Word);
Else
Ouput: PreviousOutput+Previous Output First character;
Insert in the dictionary: Previous output+ current output First
character.
}
Example:
Advantages :
 This is a lossless compression technique, none of the contents
in the file are lost during or after compression.
 LZW algorithm is efficient because it does not need to pass the
string table to the decompression code.
 The table can be recreated as it was during compression, using
the input stream as data. This avoids insertion of large string
translation table with the compression data.
Disadvantages:
 What happens when the dictionary becomes too large?
 One approach is to throw the dictionary away when it reaches
a certain size.
 Useful only for large amount of text data when redundancy is
high.
Applications:
 A large English text file can typically be compressed via LZW
to about half its original size.
 LZW became very widely used when it became part of
the GIF image format in 1987. It may also (optionally) be used
in TIFF and PDF files.
Lzw compression

More Related Content

What's hot

Image compression .
Image compression .Image compression .
Image compression .
Payal Vishwakarma
 
Lecture 8 audio compression
Lecture 8 audio compressionLecture 8 audio compression
Lecture 8 audio compression
Mr SMAK
 
Huffman Coding
Huffman CodingHuffman Coding
Huffman Coding
anithabalaprabhu
 
Data compression
Data  compressionData  compression
Data compression
Ashutosh Kawadkar
 
Introduction to Image Compression
Introduction to Image CompressionIntroduction to Image Compression
Introduction to Image Compression
Kalyan Acharjya
 
Facial expression recognition
Facial expression recognitionFacial expression recognition
Facial expression recognition
ElyesMiri
 
Image compression
Image compressionImage compression
Data compression
Data compressionData compression
Data compression
Abhishek Grover
 
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standardsComparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Rishab2612
 
LZ77 and LZ78 Compression Algorithms
LZ77 and LZ78 Compression AlgorithmsLZ77 and LZ78 Compression Algorithms
LZ77 and LZ78 Compression Algorithms
Mustafa GÖKÇE
 
SIFT
SIFTSIFT
Data compression
Data compressionData compression
Data compression
VIKAS SINGH BHADOURIA
 
Introduction To Video Compression
Introduction To Video CompressionIntroduction To Video Compression
Introduction To Video Compression
guestdd7ccca
 
Lzw coding technique for image compression
Lzw coding technique for image compressionLzw coding technique for image compression
Lzw coding technique for image compression
Tata Consultancy Services
 
Dictionary Based Compression
Dictionary Based CompressionDictionary Based Compression
Dictionary Based Compression
anithabalaprabhu
 
Lz77 by ayush
Lz77 by ayushLz77 by ayush
Lz77 by ayush
Ayush Gupta
 
Image segmentation
Image segmentation Image segmentation
4.intensity transformations
4.intensity transformations4.intensity transformations
4.intensity transformations
Yahya Alkhaldi
 
Data compression
Data compression Data compression
Data compression
Muhammad Irtiza
 
Interpixel redundancy
Interpixel redundancyInterpixel redundancy
Interpixel redundancy
Naveen Kumar
 

What's hot (20)

Image compression .
Image compression .Image compression .
Image compression .
 
Lecture 8 audio compression
Lecture 8 audio compressionLecture 8 audio compression
Lecture 8 audio compression
 
Huffman Coding
Huffman CodingHuffman Coding
Huffman Coding
 
Data compression
Data  compressionData  compression
Data compression
 
Introduction to Image Compression
Introduction to Image CompressionIntroduction to Image Compression
Introduction to Image Compression
 
Facial expression recognition
Facial expression recognitionFacial expression recognition
Facial expression recognition
 
Image compression
Image compressionImage compression
Image compression
 
Data compression
Data compressionData compression
Data compression
 
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standardsComparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
 
LZ77 and LZ78 Compression Algorithms
LZ77 and LZ78 Compression AlgorithmsLZ77 and LZ78 Compression Algorithms
LZ77 and LZ78 Compression Algorithms
 
SIFT
SIFTSIFT
SIFT
 
Data compression
Data compressionData compression
Data compression
 
Introduction To Video Compression
Introduction To Video CompressionIntroduction To Video Compression
Introduction To Video Compression
 
Lzw coding technique for image compression
Lzw coding technique for image compressionLzw coding technique for image compression
Lzw coding technique for image compression
 
Dictionary Based Compression
Dictionary Based CompressionDictionary Based Compression
Dictionary Based Compression
 
Lz77 by ayush
Lz77 by ayushLz77 by ayush
Lz77 by ayush
 
Image segmentation
Image segmentation Image segmentation
Image segmentation
 
4.intensity transformations
4.intensity transformations4.intensity transformations
4.intensity transformations
 
Data compression
Data compression Data compression
Data compression
 
Interpixel redundancy
Interpixel redundancyInterpixel redundancy
Interpixel redundancy
 

Similar to Lzw compression

LZW Presentation.pptx
LZW Presentation.pptxLZW Presentation.pptx
LZW Presentation.pptx
IsraaAkramBasheer
 
Design and Implementation of LZW Data Compression Algorithm
Design and Implementation of LZW Data Compression AlgorithmDesign and Implementation of LZW Data Compression Algorithm
Design and Implementation of LZW Data Compression Algorithm
ijistjournal
 
Design and Implementation of LZW Data Compression Algorithm
Design and Implementation of LZW Data Compression AlgorithmDesign and Implementation of LZW Data Compression Algorithm
Design and Implementation of LZW Data Compression Algorithm
ijistjournal
 
Lossless LZW Data Compression Algorithm on CUDA
Lossless LZW Data Compression Algorithm on CUDALossless LZW Data Compression Algorithm on CUDA
Lossless LZW Data Compression Algorithm on CUDA
IOSR Journals
 
lempel_ziv
lempel_zivlempel_ziv
lempel_ziv
Litu Rout
 
Lossless
LosslessLossless
Lossless
LosslessLossless
Lossless
Vishal Suri
 
Secret key cryptography
Secret key cryptographySecret key cryptography
Secret key cryptography
Prabhat Goel
 
Data Compression Technique
Data Compression TechniqueData Compression Technique
Data Compression Technique
nayakslideshare
 
Dictor
DictorDictor
Text compression
Text compressionText compression
Text compression
Sammer Qader
 
Language for specifying lexical Analyzer
Language for specifying lexical AnalyzerLanguage for specifying lexical Analyzer
Language for specifying lexical Analyzer
Archana Gopinath
 
Sienna 12 huffman
Sienna 12 huffmanSienna 12 huffman
Sienna 12 huffman
chidabdu
 
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
Helan4
 
Assem -lect-6
Assem -lect-6Assem -lect-6
Assem -lect-6
Dolly Angel
 
Exploitation Crash Course
Exploitation Crash CourseExploitation Crash Course
Exploitation Crash Course
UTD Computer Security Group
 
Data Communication & Computer Networks : LZW compression method
Data Communication & Computer Networks : LZW compression methodData Communication & Computer Networks : LZW compression method
Data Communication & Computer Networks : LZW compression method
Dr Rajiv Srivastava
 
DEFUN 2008 - Real World Haskell
DEFUN 2008 - Real World HaskellDEFUN 2008 - Real World Haskell
DEFUN 2008 - Real World Haskell
Bryan O'Sullivan
 
Lex & yacc
Lex & yaccLex & yacc
Lex & yacc
Taha Malampatti
 

Similar to Lzw compression (19)

LZW Presentation.pptx
LZW Presentation.pptxLZW Presentation.pptx
LZW Presentation.pptx
 
Design and Implementation of LZW Data Compression Algorithm
Design and Implementation of LZW Data Compression AlgorithmDesign and Implementation of LZW Data Compression Algorithm
Design and Implementation of LZW Data Compression Algorithm
 
Design and Implementation of LZW Data Compression Algorithm
Design and Implementation of LZW Data Compression AlgorithmDesign and Implementation of LZW Data Compression Algorithm
Design and Implementation of LZW Data Compression Algorithm
 
Lossless LZW Data Compression Algorithm on CUDA
Lossless LZW Data Compression Algorithm on CUDALossless LZW Data Compression Algorithm on CUDA
Lossless LZW Data Compression Algorithm on CUDA
 
lempel_ziv
lempel_zivlempel_ziv
lempel_ziv
 
Lossless
LosslessLossless
Lossless
 
Lossless
LosslessLossless
Lossless
 
Secret key cryptography
Secret key cryptographySecret key cryptography
Secret key cryptography
 
Data Compression Technique
Data Compression TechniqueData Compression Technique
Data Compression Technique
 
Dictor
DictorDictor
Dictor
 
Text compression
Text compressionText compression
Text compression
 
Language for specifying lexical Analyzer
Language for specifying lexical AnalyzerLanguage for specifying lexical Analyzer
Language for specifying lexical Analyzer
 
Sienna 12 huffman
Sienna 12 huffmanSienna 12 huffman
Sienna 12 huffman
 
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
 
Assem -lect-6
Assem -lect-6Assem -lect-6
Assem -lect-6
 
Exploitation Crash Course
Exploitation Crash CourseExploitation Crash Course
Exploitation Crash Course
 
Data Communication & Computer Networks : LZW compression method
Data Communication & Computer Networks : LZW compression methodData Communication & Computer Networks : LZW compression method
Data Communication & Computer Networks : LZW compression method
 
DEFUN 2008 - Real World Haskell
DEFUN 2008 - Real World HaskellDEFUN 2008 - Real World Haskell
DEFUN 2008 - Real World Haskell
 
Lex & yacc
Lex & yaccLex & yacc
Lex & yacc
 

Recently uploaded

CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
Aditya Rajan Patra
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
enizeyimana36
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 

Recently uploaded (20)

CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 

Lzw compression

  • 2. Compression:  It is a process of reducing size by encoding it’s information more efficiently.  Due to this there is a reduction in the number of bits and bytes used to store the information.  A smaller file size is generated in order to achieve a faster transmission of electronic files and a smaller space required for its downloading.
  • 3. LZW compression:  LZW is the first letter of the names of the scientists Abraham Lempel, Jakob Ziv, and Terry Welch, who developed this algorithm.  Is a lossless compression algorithm.  It is simple and is dictionary based.
  • 4. Working of LZW compression:  It is a simple process.  It replaces strings of characters with single codes.  A new string of characters is added every time it sees to a table of strings.  Compression occurs when a single code is output instead of a string of characters.  The first 256 codes are by default assigned to the standard character set.
  • 5. Continue…  Starts with a dictionary of all the single characters and gradually builds the dictionary as the information is sent through.  Lossless compression hence works good for text compression.  Uses a code table with 4096 as a common choice for number entries.
  • 6. Why to use LZW compression:  Two reasons . . .  For most palette color images LZW yields the highest compression efficiency without sacrificing image data.  The GIF image file format is the de facto standard for images on the web. Most GIF files use the LZW compression.
  • 7. LZW Algorithm:  The LZW Compression Algorithm can summarised as follows: w = NIL; while ( read a character k ) { if wk exists in the dictionary w = wk; else add wk to the dictionary; output the code for w; w = k; }
  • 8. LZW Encoding:  If the message to be encoded consists of only one character, LZW outputs the code for this character; otherwise it inserts two-or multi-character, overlapping.  The last character of a pattern is the first character of the next pattern.
  • 9. LZW Encoding algorithm:  Prefix←first input character; CodeWord←256; while(not end of character stream) { Char← next input character; if(Prefix+ Char exists in the Dictionary) Prefix ←Prefix + Char; Else { Output : the code for Prefix; insertInDictionary( (CodeWord, Prefix + Char) ) ; CodeWord++; Prefix←Char; } }
  • 10.
  • 12. LZW Decoding:  The LZW decompressor creates the same string table during decompression.  Initialize Dictionary with 256 ASCII codes and corresponding single character strings as their translations.
  • 13. LZW Decoding algorithm:  output: string(firstCodeWord); while(there are more CodeWords) { If(Current code word is in the dictionary) Output: String(Current Code Word); Else Ouput: PreviousOutput+Previous Output First character; Insert in the dictionary: Previous output+ current output First character. }
  • 14.
  • 16. Advantages :  This is a lossless compression technique, none of the contents in the file are lost during or after compression.  LZW algorithm is efficient because it does not need to pass the string table to the decompression code.  The table can be recreated as it was during compression, using the input stream as data. This avoids insertion of large string translation table with the compression data.
  • 17. Disadvantages:  What happens when the dictionary becomes too large?  One approach is to throw the dictionary away when it reaches a certain size.  Useful only for large amount of text data when redundancy is high.
  • 18. Applications:  A large English text file can typically be compressed via LZW to about half its original size.  LZW became very widely used when it became part of the GIF image format in 1987. It may also (optionally) be used in TIFF and PDF files.