SlideShare a Scribd company logo
Data Compression
Manish T I
• If a data item d occurs n consecutive times in the
input stream, replace the n occurrences with the
single pair nd.
• The n consecutive occurrences of a data item are
called a run length of n, and this approach to
data compression is called run-length encoding
or RLE.
Run Length Encoding
We have to adopt the convention that only three or
more repetitions of the same character will be
replaced with a repetition factor.
The main problems with this method are the
following:
• In plain English text there are not many repetitions.
• There are many “doubles” but a “triple” is rare.
• The most repetitive character is the space.
• Dashes or asterisks may sometimes also repeat.
• In mathematical texts, digits may repeat.
• Example Paragraph
The abbott from Abruzzi accedes to the demands of all
abbesses from Narragansett and Abbevilles from Abyssinia.
He will accommodate them, abbreviate his sabbatical, and
be an accomplished accessory.
• The character “@” may be part of the text in the input
stream, in which case a different escape character must
be chosen.
• Sometimes the input stream may contain every possible
character in the alphabet.
• Example
An example is an object file, the result of compiling a
program. Such a file contains machine instructions and can
be considered a string of bytes that may have any values.
• Since the repetition count is written on the output
stream as a byte, it is limited to counts of up to 255.
• This limitation can be softened somewhat when we
realize that the existence of a repetition count means
that there is a repetition (at least three identical
consecutive characters).
• We may adopt the convention that a repeat count of 0
means three repeat characters, which implies that a
repeat count of 255 means a run of 258 identical
characters.
• The MNP class 5 method was used for data
compression in old modems.
• It has been developed by Microcom, Inc., a
maker of modems (MNP stands for Microcom
Network Protocol), and it uses a combination
of run-length and adaptive frequency
encoding.
Performance
We assume that the string contains M repetitions of
average length L each. Each of the M repetitions is
replaced by 3 characters (escape, count, and data)
Size of the compressed string is N − M × L +M ×3
= N −M(L − 3)
Compression factor = N / N −M(L − 3)
Digram Encoding
• A variant of run length encoding for text is digram
encoding.
• This method is suitable for cases where the data
to be compressed consists only of certain
characters, e.g., just letters, digits, and
punctuation.
• Good results can be obtained if the data can be
analyzed beforehand.
• “E”, “T”, “TH”, and “A”, occur often.
Pattern Substitution
For compressing computer programs, where certain
words, such as for, repeat, and print, occur often.
Each such word is replaced with a control character
or, if there are many such words, with an escape
character followed by a code character.
Assuming that code “a” is assigned to the word
print, the text “m:print,b,a;” will be compressed to
“m:@a,b,a;”.
Relative Encoding [Differencing]
• Successive temperatures normally do not differ
by much, so the sensor needs to send only the
first temperature, followed by differences.
The sequence of temperatures 70, 71, 72.5, 73.1, . .
can be compressed to 70, 1, 1.5, 0.6, . . ..
The differences are small and can be expressed in
fewer bits.
The sequence 110, 115, 121, 119, 200, 202, . . .
can be compressed to 110, 5, 6,−2, 200, 2, . . . .
Now need to distinguish between a difference and
an actual value.
The compressor creating an extra bit (a flag) for each
number sent, accumulating those bits, and sending
them to the de compressor from time to time, as part
of the transmission.
Assuming that each difference is sent as a byte, the
compressor should follow (or precede) a group of 8 bytes
with a byte consisting of their 8 flags.
Another practical way to send differences mixed with actual
values is to send pairs of bytes. Each pair is either an actual
16-bit measurement (positive or negative) or two 8-bit
signed differences.
Thus actual measurements can be between 0 and ±32K and
differences can be between 0 and ±255.
For each pair, the compressor creates a flag: 0 if the pair is
an actual value, 1 if it is a pair of differences.
After 16 pairs are sent, the compressor sends the 16 flags.
• The sequence of measurements 110, 115, 121,
119, 200, 202, . . . is sent as (110), (5, 6), (−2,−1),
(200), (2, . . .), where each pair of parentheses
indicates a pair of bytes.
• The −1 has value 11111111 (binary) , which is
ignored by the de-compressor (it indicates that
there is only one difference in this pair).
Reference:-
 Data Compression: The Complete Reference, David
Salomon, Springer Science & Business Media, 2004
For any queries contact:
Web: www.iprg.co.in
E-mail: manishti2004@gmail.com
Facebook: @ImageProcessingResearchGroup

More Related Content

What's hot

High Definition Television
High Definition TelevisionHigh Definition Television
High Definition Television
Murtaza Abbas
 
Trusted systems
Trusted systemsTrusted systems
Trusted systems
ahmad abdelhafeez
 
Audio compression
Audio compressionAudio compression
Audio compression
priyanka pandey
 
Dictionary Based Compression
Dictionary Based CompressionDictionary Based Compression
Dictionary Based Compressionanithabalaprabhu
 
SPEECH CODING
SPEECH CODINGSPEECH CODING
SPEECH CODING
Shradheshwar Verma
 
Pgp smime
Pgp smimePgp smime
Pgp smime
Tania Agni
 
Data Communication And Networking - DATA RATE LIMITS
Data Communication And Networking - DATA RATE LIMITSData Communication And Networking - DATA RATE LIMITS
Data Communication And Networking - DATA RATE LIMITS
Avijeet Negel
 
Audio compression
Audio compressionAudio compression
Audio compression
Miled Othmen
 
JPEG
JPEGJPEG
Internetworking.49
Internetworking.49Internetworking.49
Internetworking.49myrajendra
 
Comparison between Lossy and Lossless Compression
Comparison between Lossy and Lossless CompressionComparison between Lossy and Lossless Compression
Comparison between Lossy and Lossless Compression
rafikrokon
 
Hamming codes
Hamming codesHamming codes
Hamming codes
GIGI JOSEPH
 
data compression technique
data compression techniquedata compression technique
data compression technique
CHINMOY PAUL
 
Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)
Project Student
 
Mp3
Mp3Mp3

What's hot (20)

High Definition Television
High Definition TelevisionHigh Definition Television
High Definition Television
 
Trusted systems
Trusted systemsTrusted systems
Trusted systems
 
Audio compression
Audio compressionAudio compression
Audio compression
 
Dictionary Based Compression
Dictionary Based CompressionDictionary Based Compression
Dictionary Based Compression
 
SPEECH CODING
SPEECH CODINGSPEECH CODING
SPEECH CODING
 
Pgp smime
Pgp smimePgp smime
Pgp smime
 
Audio compression
Audio compressionAudio compression
Audio compression
 
H261
H261H261
H261
 
Data Communication And Networking - DATA RATE LIMITS
Data Communication And Networking - DATA RATE LIMITSData Communication And Networking - DATA RATE LIMITS
Data Communication And Networking - DATA RATE LIMITS
 
Audio compression
Audio compressionAudio compression
Audio compression
 
JPEG
JPEGJPEG
JPEG
 
Internetworking.49
Internetworking.49Internetworking.49
Internetworking.49
 
Huffman Coding
Huffman CodingHuffman Coding
Huffman Coding
 
Turbo codes.ppt
Turbo codes.pptTurbo codes.ppt
Turbo codes.ppt
 
Comparison between Lossy and Lossless Compression
Comparison between Lossy and Lossless CompressionComparison between Lossy and Lossless Compression
Comparison between Lossy and Lossless Compression
 
Hamming codes
Hamming codesHamming codes
Hamming codes
 
Data compression
Data compressionData compression
Data compression
 
data compression technique
data compression techniquedata compression technique
data compression technique
 
Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)
 
Mp3
Mp3Mp3
Mp3
 

Viewers also liked

RLE - Run Length Encoding (UFP)
RLE - Run Length Encoding (UFP)RLE - Run Length Encoding (UFP)
RLE - Run Length Encoding (UFP)
Diogo Silva
 
Huffman coding
Huffman codingHuffman coding
Huffman coding
Bagus Nugroho
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
MANISH T I
 
Quantization
QuantizationQuantization
Quantizationwtyru1989
 
Quantization
QuantizationQuantization
Quantization
Maj. Sanjaya Prasad
 
Discrete cosine transform
Discrete cosine transformDiscrete cosine transform
Discrete cosine transformaniruddh Tyagi
 
Data compression huffman coding algoritham
Data compression huffman coding algorithamData compression huffman coding algoritham
Data compression huffman coding algorithamRahul Khanwani
 
Research Methodology - Introduction
Research  Methodology - IntroductionResearch  Methodology - Introduction
Research Methodology - Introduction
MANISH T I
 
Text compression in LZW and Flate
Text compression in LZW and FlateText compression in LZW and Flate
Text compression in LZW and FlateSubeer Rangra
 
Sampling
SamplingSampling
Sampling theorem
Sampling theoremSampling theorem
Sampling theorem
Shanu Bhuvana
 
Run-Length Encoding algorithm
Run-Length Encoding algorithmRun-Length Encoding algorithm
Run-Length Encoding algorithm
Hyeon Sik Song
 

Viewers also liked (20)

Run length encoding
Run length encodingRun length encoding
Run length encoding
 
RLE - Run Length Encoding (UFP)
RLE - Run Length Encoding (UFP)RLE - Run Length Encoding (UFP)
RLE - Run Length Encoding (UFP)
 
Compression
CompressionCompression
Compression
 
image compression ppt
image compression pptimage compression ppt
image compression ppt
 
Huffman Student
Huffman StudentHuffman Student
Huffman Student
 
Huffman coding
Huffman codingHuffman coding
Huffman coding
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Quantization
QuantizationQuantization
Quantization
 
Quantization
QuantizationQuantization
Quantization
 
Huffman codes
Huffman codesHuffman codes
Huffman codes
 
Discrete cosine transform
Discrete cosine transformDiscrete cosine transform
Discrete cosine transform
 
quantization
quantizationquantization
quantization
 
Data compression huffman coding algoritham
Data compression huffman coding algorithamData compression huffman coding algoritham
Data compression huffman coding algoritham
 
Research Methodology - Introduction
Research  Methodology - IntroductionResearch  Methodology - Introduction
Research Methodology - Introduction
 
Text compression in LZW and Flate
Text compression in LZW and FlateText compression in LZW and Flate
Text compression in LZW and Flate
 
Sampling
SamplingSampling
Sampling
 
Huffman Coding
Huffman CodingHuffman Coding
Huffman Coding
 
Sampling theorem
Sampling theoremSampling theorem
Sampling theorem
 
Run-Length Encoding algorithm
Run-Length Encoding algorithmRun-Length Encoding algorithm
Run-Length Encoding algorithm
 
Sampling theory
Sampling theorySampling theory
Sampling theory
 

Similar to Data Compression - Text Compression - Run Length Encoding

Data communication & computer networking: Huffman algorithm
Data communication & computer networking:  Huffman algorithmData communication & computer networking:  Huffman algorithm
Data communication & computer networking: Huffman algorithm
Dr Rajiv Srivastava
 
1 PCM & Encoding
1  PCM & Encoding1  PCM & Encoding
1 PCM & Encoding
Water Birds (Ali)
 
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
SHIVAM691605
 
3 mathematical priliminaries DATA compression
3 mathematical priliminaries DATA compression3 mathematical priliminaries DATA compression
3 mathematical priliminaries DATA compression
Shubham Jain
 
Chapter 4 Lossless Compression Algorithims.pptx
Chapter 4 Lossless Compression Algorithims.pptxChapter 4 Lossless Compression Algorithims.pptx
Chapter 4 Lossless Compression Algorithims.pptx
MedinaBedru
 
Source coding
Source codingSource coding
Source coding
MOHIT KUMAR
 
Presentation ppt 3.pptx
Presentation ppt 3.pptxPresentation ppt 3.pptx
Presentation ppt 3.pptx
temesgen545750
 
9-Lect_9-2.pptx DataLink Layer DataLink Layer
9-Lect_9-2.pptx DataLink Layer DataLink Layer9-Lect_9-2.pptx DataLink Layer DataLink Layer
9-Lect_9-2.pptx DataLink Layer DataLink Layer
ZahouAmel1
 
Language Model.pptx
Language Model.pptxLanguage Model.pptx
Language Model.pptx
Firas Obeid
 
Design and Performance Analysis of Convolutional Encoder and Viterbi Decoder ...
Design and Performance Analysis of Convolutional Encoder and Viterbi Decoder ...Design and Performance Analysis of Convolutional Encoder and Viterbi Decoder ...
Design and Performance Analysis of Convolutional Encoder and Viterbi Decoder ...
IJERA Editor
 
111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt
AllamJayaPrakash
 
111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt
AllamJayaPrakash
 
Lab01
Lab01Lab01
Introduction to data compression.pptx
Introduction to data compression.pptxIntroduction to data compression.pptx
Introduction to data compression.pptx
jesna40
 

Similar to Data Compression - Text Compression - Run Length Encoding (20)

Data communication & computer networking: Huffman algorithm
Data communication & computer networking:  Huffman algorithmData communication & computer networking:  Huffman algorithm
Data communication & computer networking: Huffman algorithm
 
Lecft3data
Lecft3dataLecft3data
Lecft3data
 
1 PCM & Encoding
1  PCM & Encoding1  PCM & Encoding
1 PCM & Encoding
 
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
 
3 mathematical priliminaries DATA compression
3 mathematical priliminaries DATA compression3 mathematical priliminaries DATA compression
3 mathematical priliminaries DATA compression
 
Chapter 4 Lossless Compression Algorithims.pptx
Chapter 4 Lossless Compression Algorithims.pptxChapter 4 Lossless Compression Algorithims.pptx
Chapter 4 Lossless Compression Algorithims.pptx
 
Source coding
Source codingSource coding
Source coding
 
Presentation ppt 3.pptx
Presentation ppt 3.pptxPresentation ppt 3.pptx
Presentation ppt 3.pptx
 
9-Lect_9-2.pptx DataLink Layer DataLink Layer
9-Lect_9-2.pptx DataLink Layer DataLink Layer9-Lect_9-2.pptx DataLink Layer DataLink Layer
9-Lect_9-2.pptx DataLink Layer DataLink Layer
 
Compression Ii
Compression IiCompression Ii
Compression Ii
 
Compression Ii
Compression IiCompression Ii
Compression Ii
 
Language Model.pptx
Language Model.pptxLanguage Model.pptx
Language Model.pptx
 
Compression ii
Compression iiCompression ii
Compression ii
 
Lec5 Compression
Lec5 CompressionLec5 Compression
Lec5 Compression
 
Design and Performance Analysis of Convolutional Encoder and Viterbi Decoder ...
Design and Performance Analysis of Convolutional Encoder and Viterbi Decoder ...Design and Performance Analysis of Convolutional Encoder and Viterbi Decoder ...
Design and Performance Analysis of Convolutional Encoder and Viterbi Decoder ...
 
111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt
 
111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt
 
Data compression
Data compressionData compression
Data compression
 
Lab01
Lab01Lab01
Lab01
 
Introduction to data compression.pptx
Introduction to data compression.pptxIntroduction to data compression.pptx
Introduction to data compression.pptx
 

More from MANISH T I

Budgerigar
BudgerigarBudgerigar
Budgerigar
MANISH T I
 
NAAC Criteria 3
NAAC  Criteria 3NAAC  Criteria 3
NAAC Criteria 3
MANISH T I
 
Artificial intelligence - An Overview
Artificial intelligence - An OverviewArtificial intelligence - An Overview
Artificial intelligence - An Overview
MANISH T I
 
The future of blogging
The future of bloggingThe future of blogging
The future of blogging
MANISH T I
 
Socrates - Most Important of his Thoughts
Socrates - Most Important of his ThoughtsSocrates - Most Important of his Thoughts
Socrates - Most Important of his Thoughts
MANISH T I
 
Technical writing
Technical writingTechnical writing
Technical writing
MANISH T I
 
Shannon-Fano algorithm
Shannon-Fano algorithmShannon-Fano algorithm
Shannon-Fano algorithm
MANISH T I
 
Solar Image Processing
Solar Image Processing  Solar Image Processing
Solar Image Processing
MANISH T I
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory Introduction
MANISH T I
 
Rooted & binary tree
Rooted & binary treeRooted & binary tree
Rooted & binary tree
MANISH T I
 
JPEG
JPEGJPEG
Colourful Living - Way of Life
Colourful Living - Way of LifeColourful Living - Way of Life
Colourful Living - Way of Life
MANISH T I
 
Introduction to Multimedia
Introduction to MultimediaIntroduction to Multimedia
Introduction to Multimedia
MANISH T I
 
Soft Computing
Soft ComputingSoft Computing
Soft Computing
MANISH T I
 
Research Methodology - Methods of data collection
 Research Methodology - Methods of data collection Research Methodology - Methods of data collection
Research Methodology - Methods of data collection
MANISH T I
 
15 lessons of lord buddha
15 lessons of lord buddha15 lessons of lord buddha
15 lessons of lord buddha
MANISH T I
 
DBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORMDBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORM
MANISH T I
 
Simple Dictionary Compression
Simple Dictionary CompressionSimple Dictionary Compression
Simple Dictionary Compression
MANISH T I
 
Introduction for Data Compression
Introduction for Data Compression Introduction for Data Compression
Introduction for Data Compression
MANISH T I
 
Lz77 (sliding window)
Lz77 (sliding window)Lz77 (sliding window)
Lz77 (sliding window)
MANISH T I
 

More from MANISH T I (20)

Budgerigar
BudgerigarBudgerigar
Budgerigar
 
NAAC Criteria 3
NAAC  Criteria 3NAAC  Criteria 3
NAAC Criteria 3
 
Artificial intelligence - An Overview
Artificial intelligence - An OverviewArtificial intelligence - An Overview
Artificial intelligence - An Overview
 
The future of blogging
The future of bloggingThe future of blogging
The future of blogging
 
Socrates - Most Important of his Thoughts
Socrates - Most Important of his ThoughtsSocrates - Most Important of his Thoughts
Socrates - Most Important of his Thoughts
 
Technical writing
Technical writingTechnical writing
Technical writing
 
Shannon-Fano algorithm
Shannon-Fano algorithmShannon-Fano algorithm
Shannon-Fano algorithm
 
Solar Image Processing
Solar Image Processing  Solar Image Processing
Solar Image Processing
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory Introduction
 
Rooted & binary tree
Rooted & binary treeRooted & binary tree
Rooted & binary tree
 
JPEG
JPEGJPEG
JPEG
 
Colourful Living - Way of Life
Colourful Living - Way of LifeColourful Living - Way of Life
Colourful Living - Way of Life
 
Introduction to Multimedia
Introduction to MultimediaIntroduction to Multimedia
Introduction to Multimedia
 
Soft Computing
Soft ComputingSoft Computing
Soft Computing
 
Research Methodology - Methods of data collection
 Research Methodology - Methods of data collection Research Methodology - Methods of data collection
Research Methodology - Methods of data collection
 
15 lessons of lord buddha
15 lessons of lord buddha15 lessons of lord buddha
15 lessons of lord buddha
 
DBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORMDBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORM
 
Simple Dictionary Compression
Simple Dictionary CompressionSimple Dictionary Compression
Simple Dictionary Compression
 
Introduction for Data Compression
Introduction for Data Compression Introduction for Data Compression
Introduction for Data Compression
 
Lz77 (sliding window)
Lz77 (sliding window)Lz77 (sliding window)
Lz77 (sliding window)
 

Recently uploaded

TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 

Recently uploaded (20)

TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 

Data Compression - Text Compression - Run Length Encoding

  • 2. • If a data item d occurs n consecutive times in the input stream, replace the n occurrences with the single pair nd. • The n consecutive occurrences of a data item are called a run length of n, and this approach to data compression is called run-length encoding or RLE. Run Length Encoding
  • 3.
  • 4. We have to adopt the convention that only three or more repetitions of the same character will be replaced with a repetition factor. The main problems with this method are the following: • In plain English text there are not many repetitions. • There are many “doubles” but a “triple” is rare. • The most repetitive character is the space. • Dashes or asterisks may sometimes also repeat. • In mathematical texts, digits may repeat.
  • 5. • Example Paragraph The abbott from Abruzzi accedes to the demands of all abbesses from Narragansett and Abbevilles from Abyssinia. He will accommodate them, abbreviate his sabbatical, and be an accomplished accessory. • The character “@” may be part of the text in the input stream, in which case a different escape character must be chosen. • Sometimes the input stream may contain every possible character in the alphabet. • Example An example is an object file, the result of compiling a program. Such a file contains machine instructions and can be considered a string of bytes that may have any values.
  • 6. • Since the repetition count is written on the output stream as a byte, it is limited to counts of up to 255. • This limitation can be softened somewhat when we realize that the existence of a repetition count means that there is a repetition (at least three identical consecutive characters). • We may adopt the convention that a repeat count of 0 means three repeat characters, which implies that a repeat count of 255 means a run of 258 identical characters.
  • 7. • The MNP class 5 method was used for data compression in old modems. • It has been developed by Microcom, Inc., a maker of modems (MNP stands for Microcom Network Protocol), and it uses a combination of run-length and adaptive frequency encoding.
  • 8. Performance We assume that the string contains M repetitions of average length L each. Each of the M repetitions is replaced by 3 characters (escape, count, and data) Size of the compressed string is N − M × L +M ×3 = N −M(L − 3) Compression factor = N / N −M(L − 3)
  • 9. Digram Encoding • A variant of run length encoding for text is digram encoding. • This method is suitable for cases where the data to be compressed consists only of certain characters, e.g., just letters, digits, and punctuation. • Good results can be obtained if the data can be analyzed beforehand. • “E”, “T”, “TH”, and “A”, occur often.
  • 10. Pattern Substitution For compressing computer programs, where certain words, such as for, repeat, and print, occur often. Each such word is replaced with a control character or, if there are many such words, with an escape character followed by a code character. Assuming that code “a” is assigned to the word print, the text “m:print,b,a;” will be compressed to “m:@a,b,a;”.
  • 11. Relative Encoding [Differencing] • Successive temperatures normally do not differ by much, so the sensor needs to send only the first temperature, followed by differences. The sequence of temperatures 70, 71, 72.5, 73.1, . . can be compressed to 70, 1, 1.5, 0.6, . . .. The differences are small and can be expressed in fewer bits.
  • 12. The sequence 110, 115, 121, 119, 200, 202, . . . can be compressed to 110, 5, 6,−2, 200, 2, . . . . Now need to distinguish between a difference and an actual value. The compressor creating an extra bit (a flag) for each number sent, accumulating those bits, and sending them to the de compressor from time to time, as part of the transmission. Assuming that each difference is sent as a byte, the compressor should follow (or precede) a group of 8 bytes with a byte consisting of their 8 flags.
  • 13. Another practical way to send differences mixed with actual values is to send pairs of bytes. Each pair is either an actual 16-bit measurement (positive or negative) or two 8-bit signed differences. Thus actual measurements can be between 0 and ±32K and differences can be between 0 and ±255. For each pair, the compressor creates a flag: 0 if the pair is an actual value, 1 if it is a pair of differences. After 16 pairs are sent, the compressor sends the 16 flags.
  • 14. • The sequence of measurements 110, 115, 121, 119, 200, 202, . . . is sent as (110), (5, 6), (−2,−1), (200), (2, . . .), where each pair of parentheses indicates a pair of bytes. • The −1 has value 11111111 (binary) , which is ignored by the de-compressor (it indicates that there is only one difference in this pair).
  • 15. Reference:-  Data Compression: The Complete Reference, David Salomon, Springer Science & Business Media, 2004 For any queries contact: Web: www.iprg.co.in E-mail: manishti2004@gmail.com Facebook: @ImageProcessingResearchGroup