SlideShare a Scribd company logo
1 of 40
Data Compression
Presented to: Prof. Dr. Maha Sharkas
presented by: Sherif Mohamed

1
Data Compression
Outline
1)
2)
3)
4)
5)
6)

Introduction.
Types of Data Compression.
Lossless Compression.
Lossless Algorithms.
Lossy Compression.
Lossy Algorithms .
2
Data Compression
• It is the process of reducing the amount of
data required to represent a given quantity of
information.
• Save time and help to optimize resources
i. In sending data over communication line:
less time to transmit and less storage to
host.
• Reduce length of data transmission time over
the network.
3
Types of Data Compression
1. Lossless Compression.
2. Lossy Compression.

4
Data Compression Algorithm
• Lossless Compression
If the compressed data is reconstructed and
the original data is obtain without any loss of
information then this technique is called
lossless compression.

5
Types of Data Compression
• Lossy Compression
If the compressed data is reconstructed and
the approximation of original data is obtain
and loss of information occurs then this
technique is called lossy compression.
The original message can never be recovered
exactly as it was before it was compressed.

6
Types of Data Compression

Lossless

Original Data

Compressed
Data

Original Data
Approximated

7
Data Compression Algorithm

8
Lossless Algorithm
• Huffman Encoding
 There’s no unique Huffman code.
 Algorithm:
①
②

③

Make a leaf node for each code symbol
Add the generation probability of each symbol to the leaf node
Take the two leaf nodes with the smallest probability and connect them into
a new node
Add 1 or 0 to each of the two branches
The probability of the new node is the sum of the probabilities of the
two connecting nodes
If there is only one node left, the code construction is completed. If not, go
back to (2)

9
Huffman Coding
• z

10
Huffman Coding
• Encoding

• Decoding

11
Lossless Algorithm
• Lempel Ziv Walsh (LZW) Encoding
• It is dictionary based encoding
• Basic idea:
 Create a dictionary or a code table of strings used during
communication.
 If both sender and receiver have a copy of the dictionary, then
previously-encountered strings can be substituted by their index
in the dictionary.

• LZW to compress text, executable code and similar
data files to about one half their original size.
12
LZW Coding
 Have 2 phases:
 Building an indexed dictionary
 Compressing a string of symbols

• Algorithm:
 Extract the smallest substring that cannot be found in the
remaining uncompressed string.
 Store that substring in the dictionary as a new entry and
assign it an index value
 Substring is replaced with the index found in the dictionary
 Insert the index and the last character of the substring into
the compressed string
13
LZW Coding
• Lempel Ziv Compression

14
15
LZW Coding
• Lempel Ziv Decompression

16
17
Lossless Algorithm
• Run Length Encoding
• Simplest method of compression.
• Replace consecutive repeating occurrences of
a symbol by 1 occurrence of the symbol itself,
then followed by the number of occurrences.

18
Run Length Coding
• The method can be more efficient if the data
uses only 2 symbols (0s and 1s) in bit patterns
and 1 symbol is more frequent than another.

19
Lossy Algorithm
• Used for compressing images and video files (our
eyes cannot distinguish subtle changes, so lossy data
is acceptable).
• These methods are cheaper, less time and space.
• Several methods:
 JPEG: compress pictures and graphics
 MPEG: compress video
 MP3: compress audio

20
Lossy Algorithm
• JPEG Encoding
• Used to compress pictures and graphics.
• In JPEG, a grayscale picture is divided into 8x8
pixel blocks to decrease the number of calculations.
• Basic idea:
 Change the picture into a linear (vector) sets of numbers that
reveals the redundancies.
 The redundancies is then removed by one of lossless

21
JPEG Encoding

22
JPEG Encoding
• DCT(Discrete Cosine Transform)
• Image is divided into blocks of 8*8 pixels.
• For grey-scale images, pixel is represented by 8-bits.
• For color images, pixel is represented by 24-bits or
three 8-bit groups.

23
JPEG Encoding
• DCT takes an 8*8 matrix and produces another 8*8
matrix and its values represent by this equation:

T[i][j] = 0.25 C(i) C(j) ∑ ∑ P[x][y] Cos(2x+1)iπ/16
* Cos (2y+1)jπ/16
 i = 0, 1, …7, j = 0, 1, …7
 C(i) = 1/√2, i =0
= 1 otherwise
T contains values called ‘Spatial frequencies’
24
JPEG Encoding
• T[0][0] is called the DC coefficient, related to
average values in the array, Cos 0 = 1
• Other values of T are called AC coefficients, cosine
functions of higher frequencies
 Case 1: all P’s are same, image of single color with no variation
at all, AC coefficients are all zeros.
 Case 2: little variation in P’s, many, not all, AC coefficients are
zeros.
 Case 3: large variation in P’s, a few AC coefficients are zeros.
25
JPEG Encoding

26
JPEG Encoding
P-matrix
T-matrix
• 20 30 40 50 60 …
720 -182 0 -19 0 …
30 40 50 60 70
-182 0 0 0 0
40 50 60 70 80
0
0 0 0 0
50 60 70 80 90
-19 0 0 0 0
60 70 80 90 100
0
0 0 0 0
…
…
‘Uniform color change and little fine detail, easier to
compress after DCT’
27
JPEG Encoding
P-matrix
T-matrix
• 100 150 50 100 100 …
835 15 -17 59 5…
200 10 110 20 200
46 -60 -36 11 14
10 200 130 30 200
-32 -9 130 105 -37
100 10 90 190 120
59 -3 27 -12 30
10 200 200 120 90
50 -71 -24 -56 -40
….
….
‘Large color change, difficult to compress after DCT’
28
JPEG Encoding
• Quantization
• Provides an way of ignoring small differences in an
image that may not be perceptible.
• Another array Q is obtained by dividing each
element of T by some number and rounding-off to
nearest integer ( The loss is occur in this step)

29
JPEG Encoding
T-matrix
Q-matrix
• 152 0 -48 0 -8…
15 0 -5 0 -1…
0 0 0 0 0
0 0 0 0 0
-48 0 38 0 -3
-5 0 4 0 0
0 0 0 0 0
0 0 0 0 0
-8 0 -3 0 13
-1 0 0 0 1
…
…
‘Divide by 10 and round-off ’
.
30
JPEG Encoding
• Dividing T-elements by the same number is not
practical, may result in too much loss.
• Retain the effects of lower frequencies as much as
possible.
• To define a quantization array Q, then
Q[i][j] = Round (T[i][j] ÷ U[i][j]),
i = 0, 1,.........7, j = 0, 1, …7

31
JPEG Encoding
• U = 1 3 5 7 9… Q= 152 0 -10 0 -1 …
3 5 7 9 11
0 0 0 0 0
5 7 9 11 13
-10 0 4 0 0
7 9 11 13 15
0 0 0 0 0
9 11 13 15 17
-1 0 0 0 0
…
…
‘Q can be well compressed due to redundant
elements’
32
JPEG Encoding
• Compression
 Quantized values are read from the matrix and redundant
0s are removed.
 To cluster the 0s together, the matrix is read diagonally
in an zigzag fashion. The reason is if the matrix doesn’t
have fine changes, the bottom right corner of the matrix
is all 0s.
 JPEG usually uses lossless run-length encoding at the
compression phase.

33
JPEG Encoding

34
JPEG Encoding

8x8
pixel
block

Discrete
Cosine
Transform

Quantization

Run Length,
Huffman
Encoding

to .jpg file

35
MPEG Encoding
Used to compress video.
 Basic idea:


 Each video is a rapid sequence of a set of frames. Each
frame is a spatial combination of pixels, or a picture.
 Compressing video =
spatially compressing each frame
+
temporally compressing a set of frames.

36
MPEG Encoding
• Spatial Compression
 Each frame is spatially compressed by JPEG.
• Temporal Compression
 Redundant frames are removed.
 Usually little difference from one to the next frame
is suitable for compression.
{For example, in a static scene in which someone is
talking, most frames are the same except for the
segment around the speaker’s lips, which changes
from one frame to the next}.
 Three frames: I, P, B.
37
MPEG Encoding
• I (intra-picture) frame: Just a JPEG encoded
image.
• P (predicted) frame: Encoded by computing
the differences between a current and a
previous frame.
• B (bidirectional) frame: Similar to P-frame
except that it is interpolated between previous
and future frame.
38
MPEG Encoding
• order in which to transmit: I – P – I
P is sandwiched between groups of B
P is the difference from the previous I-frame
B is interpolated from the nearest I and P
order in which to display I – B – B – P – B – B – I

39
Thank You
40

More Related Content

What's hot

Data compression techniques
Data compression techniquesData compression techniques
Data compression techniquesDeep Bhatt
 
image basics and image compression
image basics and image compressionimage basics and image compression
image basics and image compressionmurugan hari
 
Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)Project Student
 
Chapter 5 - Data Compression
Chapter 5 - Data CompressionChapter 5 - Data Compression
Chapter 5 - Data CompressionPratik Pradhan
 
Presentation of Lossy compression
Presentation of Lossy compressionPresentation of Lossy compression
Presentation of Lossy compressionOmar Ghazi
 
Chapter 8 image compression
Chapter 8 image compressionChapter 8 image compression
Chapter 8 image compressionasodariyabhavesh
 
Image Filtering in the Frequency Domain
Image Filtering in the Frequency DomainImage Filtering in the Frequency Domain
Image Filtering in the Frequency DomainAmnaakhaan
 
comparision of lossy and lossless image compression using various algorithm
comparision of lossy and lossless image compression using various algorithmcomparision of lossy and lossless image compression using various algorithm
comparision of lossy and lossless image compression using various algorithmchezhiyan chezhiyan
 
Introduction to Image Compression
Introduction to Image CompressionIntroduction to Image Compression
Introduction to Image CompressionKalyan Acharjya
 
Fundamental steps in image processing
Fundamental steps in image processingFundamental steps in image processing
Fundamental steps in image processingPremaPRC211300301103
 

What's hot (20)

Data compression techniques
Data compression techniquesData compression techniques
Data compression techniques
 
image compression ppt
image compression pptimage compression ppt
image compression ppt
 
image basics and image compression
image basics and image compressionimage basics and image compression
image basics and image compression
 
Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)
 
Chapter 5 - Data Compression
Chapter 5 - Data CompressionChapter 5 - Data Compression
Chapter 5 - Data Compression
 
Compression techniques
Compression techniquesCompression techniques
Compression techniques
 
Data Redundacy
Data RedundacyData Redundacy
Data Redundacy
 
Data compression
Data compressionData compression
Data compression
 
Image compression
Image compressionImage compression
Image compression
 
Compression
CompressionCompression
Compression
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Lzw coding technique for image compression
Lzw coding technique for image compressionLzw coding technique for image compression
Lzw coding technique for image compression
 
Presentation of Lossy compression
Presentation of Lossy compressionPresentation of Lossy compression
Presentation of Lossy compression
 
Chapter 8 image compression
Chapter 8 image compressionChapter 8 image compression
Chapter 8 image compression
 
Image compression
Image compressionImage compression
Image compression
 
Image Filtering in the Frequency Domain
Image Filtering in the Frequency DomainImage Filtering in the Frequency Domain
Image Filtering in the Frequency Domain
 
comparision of lossy and lossless image compression using various algorithm
comparision of lossy and lossless image compression using various algorithmcomparision of lossy and lossless image compression using various algorithm
comparision of lossy and lossless image compression using various algorithm
 
JPEG
JPEGJPEG
JPEG
 
Introduction to Image Compression
Introduction to Image CompressionIntroduction to Image Compression
Introduction to Image Compression
 
Fundamental steps in image processing
Fundamental steps in image processingFundamental steps in image processing
Fundamental steps in image processing
 

Viewers also liked

Data compression introduction
Data compression introductionData compression introduction
Data compression introductionRahul Khanwani
 
Data Compression Technique
Data Compression TechniqueData Compression Technique
Data Compression Techniquenayakslideshare
 
data compression technique
data compression techniquedata compression technique
data compression techniqueCHINMOY PAUL
 
4 data compression
4 data compression4 data compression
4 data compressionRejin Thomas
 
G zip compresser ppt
G zip compresser pptG zip compresser ppt
G zip compresser pptgaurav kumar
 
Data compression
Data compressionData compression
Data compressionNizar Sbaih
 
Data Compression In SQL
Data Compression In SQLData Compression In SQL
Data Compression In SQLBoosh Booshan
 
Text compression in LZW and Flate
Text compression in LZW and FlateText compression in LZW and Flate
Text compression in LZW and FlateSubeer Rangra
 
Spandana image processing and compression techniques (7840228)
Spandana   image processing and compression techniques (7840228)Spandana   image processing and compression techniques (7840228)
Spandana image processing and compression techniques (7840228)indianspandana
 
A new algorithm for data compression technique using vlsi
A new algorithm for data compression technique using vlsiA new algorithm for data compression technique using vlsi
A new algorithm for data compression technique using vlsiTejeswar Tej
 
Image compression
Image compressionImage compression
Image compressionAle Johnsan
 
Data compression in Modern Application
Data compression in Modern ApplicationData compression in Modern Application
Data compression in Modern ApplicationLivePerson
 
Evm Test Impairements
Evm Test ImpairementsEvm Test Impairements
Evm Test Impairementschiportal
 
An Implementation of Quadtree for Image Compression
An Implementation of Quadtree for Image CompressionAn Implementation of Quadtree for Image Compression
An Implementation of Quadtree for Image CompressionMohammad Shaker
 
Adaptive Huffman and Lossless Compression Techniques - Documentation
Adaptive Huffman and Lossless Compression Techniques - DocumentationAdaptive Huffman and Lossless Compression Techniques - Documentation
Adaptive Huffman and Lossless Compression Techniques - DocumentationMohammad Shaker
 
Computer software 2
Computer software 2Computer software 2
Computer software 2Suresh Kumar
 

Viewers also liked (16)

Data compression introduction
Data compression introductionData compression introduction
Data compression introduction
 
Data Compression Technique
Data Compression TechniqueData Compression Technique
Data Compression Technique
 
data compression technique
data compression techniquedata compression technique
data compression technique
 
4 data compression
4 data compression4 data compression
4 data compression
 
G zip compresser ppt
G zip compresser pptG zip compresser ppt
G zip compresser ppt
 
Data compression
Data compressionData compression
Data compression
 
Data Compression In SQL
Data Compression In SQLData Compression In SQL
Data Compression In SQL
 
Text compression in LZW and Flate
Text compression in LZW and FlateText compression in LZW and Flate
Text compression in LZW and Flate
 
Spandana image processing and compression techniques (7840228)
Spandana   image processing and compression techniques (7840228)Spandana   image processing and compression techniques (7840228)
Spandana image processing and compression techniques (7840228)
 
A new algorithm for data compression technique using vlsi
A new algorithm for data compression technique using vlsiA new algorithm for data compression technique using vlsi
A new algorithm for data compression technique using vlsi
 
Image compression
Image compressionImage compression
Image compression
 
Data compression in Modern Application
Data compression in Modern ApplicationData compression in Modern Application
Data compression in Modern Application
 
Evm Test Impairements
Evm Test ImpairementsEvm Test Impairements
Evm Test Impairements
 
An Implementation of Quadtree for Image Compression
An Implementation of Quadtree for Image CompressionAn Implementation of Quadtree for Image Compression
An Implementation of Quadtree for Image Compression
 
Adaptive Huffman and Lossless Compression Techniques - Documentation
Adaptive Huffman and Lossless Compression Techniques - DocumentationAdaptive Huffman and Lossless Compression Techniques - Documentation
Adaptive Huffman and Lossless Compression Techniques - Documentation
 
Computer software 2
Computer software 2Computer software 2
Computer software 2
 

Similar to Data compression

lossy compression JPEG
lossy compression JPEGlossy compression JPEG
lossy compression JPEGMahmoud Hikmet
 
notes_Image Compression_edited.ppt
notes_Image Compression_edited.pptnotes_Image Compression_edited.ppt
notes_Image Compression_edited.pptHarisMasood20
 
image processing for jpeg presentati.ppt
image processing for jpeg presentati.pptimage processing for jpeg presentati.ppt
image processing for jpeg presentati.pptnaghamallella
 
CyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdfCyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdfMohammadAzreeYahaya
 
SQUASHED JPEG IMAGE COMPRESSION VIA SPARSE MATRIX
SQUASHED JPEG IMAGE COMPRESSION VIA SPARSE MATRIXSQUASHED JPEG IMAGE COMPRESSION VIA SPARSE MATRIX
SQUASHED JPEG IMAGE COMPRESSION VIA SPARSE MATRIXijcsit
 
Compression: Images (JPEG)
Compression: Images (JPEG)Compression: Images (JPEG)
Compression: Images (JPEG)danishrafiq
 
image compression in data compression
image compression in data compressionimage compression in data compression
image compression in data compressionZaabir Ali
 
Why Image compression is Necessary?
Why Image compression is Necessary?Why Image compression is Necessary?
Why Image compression is Necessary?Prabhat Kumar
 
Compression of digital voice and video
Compression of digital voice and videoCompression of digital voice and video
Compression of digital voice and videosangusajjan
 
SOC Application Studies: Image Compression
SOC Application Studies: Image CompressionSOC Application Studies: Image Compression
SOC Application Studies: Image CompressionA B Shinde
 
Digital Image Processing - Image Compression
Digital Image Processing - Image CompressionDigital Image Processing - Image Compression
Digital Image Processing - Image CompressionMathankumar S
 
Multimedia image compression standards
Multimedia image compression standardsMultimedia image compression standards
Multimedia image compression standardsMazin Alwaaly
 

Similar to Data compression (20)

lossy compression JPEG
lossy compression JPEGlossy compression JPEG
lossy compression JPEG
 
notes_Image Compression_edited.ppt
notes_Image Compression_edited.pptnotes_Image Compression_edited.ppt
notes_Image Compression_edited.ppt
 
Source coding
Source codingSource coding
Source coding
 
JPEG Image Compression
JPEG Image CompressionJPEG Image Compression
JPEG Image Compression
 
image processing for jpeg presentati.ppt
image processing for jpeg presentati.pptimage processing for jpeg presentati.ppt
image processing for jpeg presentati.ppt
 
Jpeg compression
Jpeg compressionJpeg compression
Jpeg compression
 
CyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdfCyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdf
 
Squashed JPEG Image Compression via Sparse Matrix
Squashed JPEG Image Compression via Sparse MatrixSquashed JPEG Image Compression via Sparse Matrix
Squashed JPEG Image Compression via Sparse Matrix
 
SQUASHED JPEG IMAGE COMPRESSION VIA SPARSE MATRIX
SQUASHED JPEG IMAGE COMPRESSION VIA SPARSE MATRIXSQUASHED JPEG IMAGE COMPRESSION VIA SPARSE MATRIX
SQUASHED JPEG IMAGE COMPRESSION VIA SPARSE MATRIX
 
Squashed JPEG Image Compression via Sparse Matrix
Squashed JPEG Image Compression via Sparse MatrixSquashed JPEG Image Compression via Sparse Matrix
Squashed JPEG Image Compression via Sparse Matrix
 
Compression: Images (JPEG)
Compression: Images (JPEG)Compression: Images (JPEG)
Compression: Images (JPEG)
 
Image compression and jpeg
Image compression and jpegImage compression and jpeg
Image compression and jpeg
 
image compression in data compression
image compression in data compressionimage compression in data compression
image compression in data compression
 
Why Image compression is Necessary?
Why Image compression is Necessary?Why Image compression is Necessary?
Why Image compression is Necessary?
 
Compression of digital voice and video
Compression of digital voice and videoCompression of digital voice and video
Compression of digital voice and video
 
Data Compression
Data CompressionData Compression
Data Compression
 
SOC Application Studies: Image Compression
SOC Application Studies: Image CompressionSOC Application Studies: Image Compression
SOC Application Studies: Image Compression
 
Jpeg
JpegJpeg
Jpeg
 
Digital Image Processing - Image Compression
Digital Image Processing - Image CompressionDigital Image Processing - Image Compression
Digital Image Processing - Image Compression
 
Multimedia image compression standards
Multimedia image compression standardsMultimedia image compression standards
Multimedia image compression standards
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Data compression

  • 1. Data Compression Presented to: Prof. Dr. Maha Sharkas presented by: Sherif Mohamed 1
  • 2. Data Compression Outline 1) 2) 3) 4) 5) 6) Introduction. Types of Data Compression. Lossless Compression. Lossless Algorithms. Lossy Compression. Lossy Algorithms . 2
  • 3. Data Compression • It is the process of reducing the amount of data required to represent a given quantity of information. • Save time and help to optimize resources i. In sending data over communication line: less time to transmit and less storage to host. • Reduce length of data transmission time over the network. 3
  • 4. Types of Data Compression 1. Lossless Compression. 2. Lossy Compression. 4
  • 5. Data Compression Algorithm • Lossless Compression If the compressed data is reconstructed and the original data is obtain without any loss of information then this technique is called lossless compression. 5
  • 6. Types of Data Compression • Lossy Compression If the compressed data is reconstructed and the approximation of original data is obtain and loss of information occurs then this technique is called lossy compression. The original message can never be recovered exactly as it was before it was compressed. 6
  • 7. Types of Data Compression Lossless Original Data Compressed Data Original Data Approximated 7
  • 9. Lossless Algorithm • Huffman Encoding  There’s no unique Huffman code.  Algorithm: ① ② ③ Make a leaf node for each code symbol Add the generation probability of each symbol to the leaf node Take the two leaf nodes with the smallest probability and connect them into a new node Add 1 or 0 to each of the two branches The probability of the new node is the sum of the probabilities of the two connecting nodes If there is only one node left, the code construction is completed. If not, go back to (2) 9
  • 12. Lossless Algorithm • Lempel Ziv Walsh (LZW) Encoding • It is dictionary based encoding • Basic idea:  Create a dictionary or a code table of strings used during communication.  If both sender and receiver have a copy of the dictionary, then previously-encountered strings can be substituted by their index in the dictionary. • LZW to compress text, executable code and similar data files to about one half their original size. 12
  • 13. LZW Coding  Have 2 phases:  Building an indexed dictionary  Compressing a string of symbols • Algorithm:  Extract the smallest substring that cannot be found in the remaining uncompressed string.  Store that substring in the dictionary as a new entry and assign it an index value  Substring is replaced with the index found in the dictionary  Insert the index and the last character of the substring into the compressed string 13
  • 14. LZW Coding • Lempel Ziv Compression 14
  • 15. 15
  • 16. LZW Coding • Lempel Ziv Decompression 16
  • 17. 17
  • 18. Lossless Algorithm • Run Length Encoding • Simplest method of compression. • Replace consecutive repeating occurrences of a symbol by 1 occurrence of the symbol itself, then followed by the number of occurrences. 18
  • 19. Run Length Coding • The method can be more efficient if the data uses only 2 symbols (0s and 1s) in bit patterns and 1 symbol is more frequent than another. 19
  • 20. Lossy Algorithm • Used for compressing images and video files (our eyes cannot distinguish subtle changes, so lossy data is acceptable). • These methods are cheaper, less time and space. • Several methods:  JPEG: compress pictures and graphics  MPEG: compress video  MP3: compress audio 20
  • 21. Lossy Algorithm • JPEG Encoding • Used to compress pictures and graphics. • In JPEG, a grayscale picture is divided into 8x8 pixel blocks to decrease the number of calculations. • Basic idea:  Change the picture into a linear (vector) sets of numbers that reveals the redundancies.  The redundancies is then removed by one of lossless 21
  • 23. JPEG Encoding • DCT(Discrete Cosine Transform) • Image is divided into blocks of 8*8 pixels. • For grey-scale images, pixel is represented by 8-bits. • For color images, pixel is represented by 24-bits or three 8-bit groups. 23
  • 24. JPEG Encoding • DCT takes an 8*8 matrix and produces another 8*8 matrix and its values represent by this equation: T[i][j] = 0.25 C(i) C(j) ∑ ∑ P[x][y] Cos(2x+1)iπ/16 * Cos (2y+1)jπ/16  i = 0, 1, …7, j = 0, 1, …7  C(i) = 1/√2, i =0 = 1 otherwise T contains values called ‘Spatial frequencies’ 24
  • 25. JPEG Encoding • T[0][0] is called the DC coefficient, related to average values in the array, Cos 0 = 1 • Other values of T are called AC coefficients, cosine functions of higher frequencies  Case 1: all P’s are same, image of single color with no variation at all, AC coefficients are all zeros.  Case 2: little variation in P’s, many, not all, AC coefficients are zeros.  Case 3: large variation in P’s, a few AC coefficients are zeros. 25
  • 27. JPEG Encoding P-matrix T-matrix • 20 30 40 50 60 … 720 -182 0 -19 0 … 30 40 50 60 70 -182 0 0 0 0 40 50 60 70 80 0 0 0 0 0 50 60 70 80 90 -19 0 0 0 0 60 70 80 90 100 0 0 0 0 0 … … ‘Uniform color change and little fine detail, easier to compress after DCT’ 27
  • 28. JPEG Encoding P-matrix T-matrix • 100 150 50 100 100 … 835 15 -17 59 5… 200 10 110 20 200 46 -60 -36 11 14 10 200 130 30 200 -32 -9 130 105 -37 100 10 90 190 120 59 -3 27 -12 30 10 200 200 120 90 50 -71 -24 -56 -40 …. …. ‘Large color change, difficult to compress after DCT’ 28
  • 29. JPEG Encoding • Quantization • Provides an way of ignoring small differences in an image that may not be perceptible. • Another array Q is obtained by dividing each element of T by some number and rounding-off to nearest integer ( The loss is occur in this step) 29
  • 30. JPEG Encoding T-matrix Q-matrix • 152 0 -48 0 -8… 15 0 -5 0 -1… 0 0 0 0 0 0 0 0 0 0 -48 0 38 0 -3 -5 0 4 0 0 0 0 0 0 0 0 0 0 0 0 -8 0 -3 0 13 -1 0 0 0 1 … … ‘Divide by 10 and round-off ’ . 30
  • 31. JPEG Encoding • Dividing T-elements by the same number is not practical, may result in too much loss. • Retain the effects of lower frequencies as much as possible. • To define a quantization array Q, then Q[i][j] = Round (T[i][j] ÷ U[i][j]), i = 0, 1,.........7, j = 0, 1, …7 31
  • 32. JPEG Encoding • U = 1 3 5 7 9… Q= 152 0 -10 0 -1 … 3 5 7 9 11 0 0 0 0 0 5 7 9 11 13 -10 0 4 0 0 7 9 11 13 15 0 0 0 0 0 9 11 13 15 17 -1 0 0 0 0 … … ‘Q can be well compressed due to redundant elements’ 32
  • 33. JPEG Encoding • Compression  Quantized values are read from the matrix and redundant 0s are removed.  To cluster the 0s together, the matrix is read diagonally in an zigzag fashion. The reason is if the matrix doesn’t have fine changes, the bottom right corner of the matrix is all 0s.  JPEG usually uses lossless run-length encoding at the compression phase. 33
  • 36. MPEG Encoding Used to compress video.  Basic idea:   Each video is a rapid sequence of a set of frames. Each frame is a spatial combination of pixels, or a picture.  Compressing video = spatially compressing each frame + temporally compressing a set of frames. 36
  • 37. MPEG Encoding • Spatial Compression  Each frame is spatially compressed by JPEG. • Temporal Compression  Redundant frames are removed.  Usually little difference from one to the next frame is suitable for compression. {For example, in a static scene in which someone is talking, most frames are the same except for the segment around the speaker’s lips, which changes from one frame to the next}.  Three frames: I, P, B. 37
  • 38. MPEG Encoding • I (intra-picture) frame: Just a JPEG encoded image. • P (predicted) frame: Encoded by computing the differences between a current and a previous frame. • B (bidirectional) frame: Similar to P-frame except that it is interpolated between previous and future frame. 38
  • 39. MPEG Encoding • order in which to transmit: I – P – I P is sandwiched between groups of B P is the difference from the previous I-frame B is interpolated from the nearest I and P order in which to display I – B – B – P – B – B – I 39