SlideShare a Scribd company logo
Digital Image Processing
1
Module-IV
IMAGE COMPRESSION
Run-length encoding
2
• Run-length encoding (RLE) is a very simple form of data
compression encoding.
• RLE is a lossless type of compression
• It is based on simple principle of encoding data. This
principle is to every stream which is formed of the same
data values (repeating values is called a run) i.e sequence
of repeated data values is replaced with count number
and a single value.
3
• This intuitive principle works best on certain data types
in which sequences of repeated data values can be
noticed;
• RLE is usually applied to the files that a contain large
number of consecutive occurrences of the same byte
pattern.
4
• RLE may be used on any kind of data regardless of its content, but data which is
being compressed by RLE determines how good compression ratio will be
achieved.
• RLE is used on text files which contains multiple spaces for indention and
formatting paragraphs, tables and charts.
• Digitized signals also consist of unchanged streams so such signals can also be
compressed by RLE.
• A good example of such signal are monochrome images, and questionable
compression would be probably achieved if such compression was used on
continous-tone (photographic) images.
5
• Fair compression ratio may be achieved if RLE is
applied on computer generated color images.
• RLE is a lossless type of compression and cannot
achieve great compression ratios,
• but a good point of that compression is that it
can be easily implemented and quickly executed.
6
Example1
• WWWWWWWWWWWWBWWWWWWWWWWWWBBB
WWWWWWWWWWWWWWWWWWWWWWWW
BWWWWWWWWWWWWWW
• If we apply a simple run-length code to the above hypothetical scan line, we get
the following:
• 12WB12W3B24WB14W
7
Shift code:
A shift code is generated by
• Arranging the source symbols so that their probabilities
are monotonically decreasing
•Dividing the total number of symbols into symbol blocks
of equal size.
•Coding the individual elements within all blocks
identically, and
•Adding special shift-up or shift-down symbols to identify
each block. Each time a shift-up or shift-down symbol is
recognized at the decoder, it moves one block up or down
with respect to a pre-defined reference block.
8
Arithmetic coding
•Unlike the variable-length codes described previously,
arithmetic coding, generates non-block codes.
•In arithmetic coding, a one-to-one correspondence between
source symbols and code words does not exist.
•Instead, an entire sequence of source symbols (or message)
is assigned a single arithmetic code word.
•Arithmetic coding, is entropy coder widely used, the only
problem is it's speed, but compression tends to be better than
can achieve
9
• The code word itself defines an interval of real numbers between
0 and 1
• As the number of symbols in the message increases, the interval
used to represent it becomes smaller and the number of
information units (say, bits) required to represent the interval
becomes larger
• Each symbol of the message reduces the size of the interval in
accordance with the probability of occurrence.
• It is suppose to approach the limit set by entropy.
10
• The idea behind arithmetic coding is to have a
probability line, 0-1
• assign to every symbol a range in this line based on its
probability
• higher the probability, the higher range which assigns
to it.
• Once we have defined the ranges and the probability
line, start to encode symbols
• every symbol defines where the output floating point
number lands
11
Example
Symbol Probability Range
a 2 [0.0 , 0.5)
b 1 [0.5 , 0.75)
c 1 [0.7.5 , 1.0)
12
Algorithm to compute the output number
• Low = 0
• High = 1
• Loop. For all the symbols.
Range = high - low
High = low + range * high_range of
the symbol being coded
Low = low + range * low_range of the symbol
being coded
13
Symbol Range Low value High value
0 1
b 1 0.5 0.75
a 0.25 0.5 0.625
c 0.125 0.59375 0.625
a 0.03125 0.59375 0.609375
The output number will be 0.59375
14
Arithmetic coding
Let the message to be encoded be a1a2a3a3a4
15
0.2
0.4
0.8
0.04
0.08
0.16
0.048
0.056
0.072
0.0592
0.0624
0.0688
0.06368
0.06496
16
So, any number in the interval [0.06752,0.0688) , for example
0.068 can be used to represent the message.
Decode 0.39.
Since 0.8>code word > 0.4, the first symbol should be a3.
1.0
0.8
0.4
0.2
0.8
0.72
0.36
0.28
0.2
0.0
0.72
0.648
0.504
0.432
0.36
0.432
0.8
0.4
0.2
0.36
17

More Related Content

Similar to Module-IV 095.pdf

FUNDAMENTAL OF C
FUNDAMENTAL OF CFUNDAMENTAL OF C
FUNDAMENTAL OF C
KRUNAL RAVAL
 
Fundamentals of Information Encryption
Fundamentals of Information EncryptionFundamentals of Information Encryption
Fundamentals of Information Encryption
Amna Magzoub
 
project ppt on anti counterfeiting technique for credit card transaction system
project ppt on anti counterfeiting technique for credit card transaction systemproject ppt on anti counterfeiting technique for credit card transaction system
project ppt on anti counterfeiting technique for credit card transaction system
Rekha dudiya
 
Wits presentation 6_28072015
Wits presentation 6_28072015Wits presentation 6_28072015
Wits presentation 6_28072015
Beatrice van Eden
 
Digital Communication Techniques
Digital Communication TechniquesDigital Communication Techniques
Digital Communication Techniques
Prof. Swapnil V. Kaware
 
DC04 Image Compression Standards.pdf
DC04 Image Compression Standards.pdfDC04 Image Compression Standards.pdf
DC04 Image Compression Standards.pdf
ssuser1bd081
 
Dot matrix display design using fpga
Dot matrix display design using fpgaDot matrix display design using fpga
Dot matrix display design using fpga
Hossam Hassan
 
Group presentation.pptx
Group presentation.pptxGroup presentation.pptx
Group presentation.pptx
Yonas D. Ebren
 
2019010413470100000524_Sesi10_Multimedia Data Compression II.ppt
2019010413470100000524_Sesi10_Multimedia Data Compression II.ppt2019010413470100000524_Sesi10_Multimedia Data Compression II.ppt
2019010413470100000524_Sesi10_Multimedia Data Compression II.ppt
ReinertYosua
 
Block Ciphers Modes of Operation
Block Ciphers Modes of OperationBlock Ciphers Modes of Operation
Block Ciphers Modes of Operation
Shafaan Khaliq Bhatti
 
Text compression
Text compressionText compression
Text compression
Sammer Qader
 
111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt
AllamJayaPrakash
 
111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt
AllamJayaPrakash
 
Image compression
Image compression Image compression
Image compression
GARIMA SHAKYA
 
Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2
ISMT College
 
Computer security module 2
Computer security module 2Computer security module 2
Computer security module 2
Deepak John
 
Computer Networks
Computer NetworksComputer Networks
Computer Networks
Aabha Tiwari
 
Special purpose computing system document
Special purpose computing system documentSpecial purpose computing system document
Special purpose computing system document
Nof140
 
image compression in data compression
image compression in data compressionimage compression in data compression
image compression in data compression
Zaabir Ali
 
Information and data security pseudorandom number generation and stream cipher
Information and data security pseudorandom number generation and stream cipherInformation and data security pseudorandom number generation and stream cipher
Information and data security pseudorandom number generation and stream cipher
Mazin Alwaaly
 

Similar to Module-IV 095.pdf (20)

FUNDAMENTAL OF C
FUNDAMENTAL OF CFUNDAMENTAL OF C
FUNDAMENTAL OF C
 
Fundamentals of Information Encryption
Fundamentals of Information EncryptionFundamentals of Information Encryption
Fundamentals of Information Encryption
 
project ppt on anti counterfeiting technique for credit card transaction system
project ppt on anti counterfeiting technique for credit card transaction systemproject ppt on anti counterfeiting technique for credit card transaction system
project ppt on anti counterfeiting technique for credit card transaction system
 
Wits presentation 6_28072015
Wits presentation 6_28072015Wits presentation 6_28072015
Wits presentation 6_28072015
 
Digital Communication Techniques
Digital Communication TechniquesDigital Communication Techniques
Digital Communication Techniques
 
DC04 Image Compression Standards.pdf
DC04 Image Compression Standards.pdfDC04 Image Compression Standards.pdf
DC04 Image Compression Standards.pdf
 
Dot matrix display design using fpga
Dot matrix display design using fpgaDot matrix display design using fpga
Dot matrix display design using fpga
 
Group presentation.pptx
Group presentation.pptxGroup presentation.pptx
Group presentation.pptx
 
2019010413470100000524_Sesi10_Multimedia Data Compression II.ppt
2019010413470100000524_Sesi10_Multimedia Data Compression II.ppt2019010413470100000524_Sesi10_Multimedia Data Compression II.ppt
2019010413470100000524_Sesi10_Multimedia Data Compression II.ppt
 
Block Ciphers Modes of Operation
Block Ciphers Modes of OperationBlock Ciphers Modes of Operation
Block Ciphers Modes of Operation
 
Text compression
Text compressionText compression
Text compression
 
111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt
 
111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt111111111111111111111111111111111789.ppt
111111111111111111111111111111111789.ppt
 
Image compression
Image compression Image compression
Image compression
 
Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2
 
Computer security module 2
Computer security module 2Computer security module 2
Computer security module 2
 
Computer Networks
Computer NetworksComputer Networks
Computer Networks
 
Special purpose computing system document
Special purpose computing system documentSpecial purpose computing system document
Special purpose computing system document
 
image compression in data compression
image compression in data compressionimage compression in data compression
image compression in data compression
 
Information and data security pseudorandom number generation and stream cipher
Information and data security pseudorandom number generation and stream cipherInformation and data security pseudorandom number generation and stream cipher
Information and data security pseudorandom number generation and stream cipher
 

More from SamrajECE

Unit 4 -IOT3_IoT_platform_Design_methodology.pptx
Unit 4 -IOT3_IoT_platform_Design_methodology.pptxUnit 4 -IOT3_IoT_platform_Design_methodology.pptx
Unit 4 -IOT3_IoT_platform_Design_methodology.pptx
SamrajECE
 
reservation-policy-required-followed for admission
reservation-policy-required-followed for admissionreservation-policy-required-followed for admission
reservation-policy-required-followed for admission
SamrajECE
 
M4L12.ppt
M4L12.pptM4L12.ppt
M4L12.ppt
SamrajECE
 
Module-V 096.pdf
Module-V 096.pdfModule-V 096.pdf
Module-V 096.pdf
SamrajECE
 
Module-IV 094.pdf
Module-IV 094.pdfModule-IV 094.pdf
Module-IV 094.pdf
SamrajECE
 
Module-IV 093.pdf
Module-IV 093.pdfModule-IV 093.pdf
Module-IV 093.pdf
SamrajECE
 
ModuleII092.pdf
ModuleII092.pdfModuleII092.pdf
ModuleII092.pdf
SamrajECE
 
ModuleII091.pdf
ModuleII091.pdfModuleII091.pdf
ModuleII091.pdf
SamrajECE
 
ModuleII090.pdf
ModuleII090.pdfModuleII090.pdf
ModuleII090.pdf
SamrajECE
 

More from SamrajECE (9)

Unit 4 -IOT3_IoT_platform_Design_methodology.pptx
Unit 4 -IOT3_IoT_platform_Design_methodology.pptxUnit 4 -IOT3_IoT_platform_Design_methodology.pptx
Unit 4 -IOT3_IoT_platform_Design_methodology.pptx
 
reservation-policy-required-followed for admission
reservation-policy-required-followed for admissionreservation-policy-required-followed for admission
reservation-policy-required-followed for admission
 
M4L12.ppt
M4L12.pptM4L12.ppt
M4L12.ppt
 
Module-V 096.pdf
Module-V 096.pdfModule-V 096.pdf
Module-V 096.pdf
 
Module-IV 094.pdf
Module-IV 094.pdfModule-IV 094.pdf
Module-IV 094.pdf
 
Module-IV 093.pdf
Module-IV 093.pdfModule-IV 093.pdf
Module-IV 093.pdf
 
ModuleII092.pdf
ModuleII092.pdfModuleII092.pdf
ModuleII092.pdf
 
ModuleII091.pdf
ModuleII091.pdfModuleII091.pdf
ModuleII091.pdf
 
ModuleII090.pdf
ModuleII090.pdfModuleII090.pdf
ModuleII090.pdf
 

Recently uploaded

BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
sayalidalavi006
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 

Recently uploaded (20)

BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 

Module-IV 095.pdf

  • 3. • Run-length encoding (RLE) is a very simple form of data compression encoding. • RLE is a lossless type of compression • It is based on simple principle of encoding data. This principle is to every stream which is formed of the same data values (repeating values is called a run) i.e sequence of repeated data values is replaced with count number and a single value. 3
  • 4. • This intuitive principle works best on certain data types in which sequences of repeated data values can be noticed; • RLE is usually applied to the files that a contain large number of consecutive occurrences of the same byte pattern. 4
  • 5. • RLE may be used on any kind of data regardless of its content, but data which is being compressed by RLE determines how good compression ratio will be achieved. • RLE is used on text files which contains multiple spaces for indention and formatting paragraphs, tables and charts. • Digitized signals also consist of unchanged streams so such signals can also be compressed by RLE. • A good example of such signal are monochrome images, and questionable compression would be probably achieved if such compression was used on continous-tone (photographic) images. 5
  • 6. • Fair compression ratio may be achieved if RLE is applied on computer generated color images. • RLE is a lossless type of compression and cannot achieve great compression ratios, • but a good point of that compression is that it can be easily implemented and quickly executed. 6
  • 7. Example1 • WWWWWWWWWWWWBWWWWWWWWWWWWBBB WWWWWWWWWWWWWWWWWWWWWWWW BWWWWWWWWWWWWWW • If we apply a simple run-length code to the above hypothetical scan line, we get the following: • 12WB12W3B24WB14W 7
  • 8. Shift code: A shift code is generated by • Arranging the source symbols so that their probabilities are monotonically decreasing •Dividing the total number of symbols into symbol blocks of equal size. •Coding the individual elements within all blocks identically, and •Adding special shift-up or shift-down symbols to identify each block. Each time a shift-up or shift-down symbol is recognized at the decoder, it moves one block up or down with respect to a pre-defined reference block. 8
  • 9. Arithmetic coding •Unlike the variable-length codes described previously, arithmetic coding, generates non-block codes. •In arithmetic coding, a one-to-one correspondence between source symbols and code words does not exist. •Instead, an entire sequence of source symbols (or message) is assigned a single arithmetic code word. •Arithmetic coding, is entropy coder widely used, the only problem is it's speed, but compression tends to be better than can achieve 9
  • 10. • The code word itself defines an interval of real numbers between 0 and 1 • As the number of symbols in the message increases, the interval used to represent it becomes smaller and the number of information units (say, bits) required to represent the interval becomes larger • Each symbol of the message reduces the size of the interval in accordance with the probability of occurrence. • It is suppose to approach the limit set by entropy. 10
  • 11. • The idea behind arithmetic coding is to have a probability line, 0-1 • assign to every symbol a range in this line based on its probability • higher the probability, the higher range which assigns to it. • Once we have defined the ranges and the probability line, start to encode symbols • every symbol defines where the output floating point number lands 11
  • 12. Example Symbol Probability Range a 2 [0.0 , 0.5) b 1 [0.5 , 0.75) c 1 [0.7.5 , 1.0) 12
  • 13. Algorithm to compute the output number • Low = 0 • High = 1 • Loop. For all the symbols. Range = high - low High = low + range * high_range of the symbol being coded Low = low + range * low_range of the symbol being coded 13
  • 14. Symbol Range Low value High value 0 1 b 1 0.5 0.75 a 0.25 0.5 0.625 c 0.125 0.59375 0.625 a 0.03125 0.59375 0.609375 The output number will be 0.59375 14
  • 15. Arithmetic coding Let the message to be encoded be a1a2a3a3a4 15
  • 17. So, any number in the interval [0.06752,0.0688) , for example 0.068 can be used to represent the message. Decode 0.39. Since 0.8>code word > 0.4, the first symbol should be a3. 1.0 0.8 0.4 0.2 0.8 0.72 0.36 0.28 0.2 0.0 0.72 0.648 0.504 0.432 0.36 0.432 0.8 0.4 0.2 0.36 17