SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
MULTIMEDIA
COMMUNICATIONS
Image Compression-JPEG
BY: Dr. KAPIL GUPTA
Associate Professor
MMEC, MMU, Mullana
2
Digitized pictures
• The amount of memory required to store and
display digitized picture ranged from 307kbytes
through to 2.4Mbytes .
• This would result in unacceptably long delays in
most interactive applications that involve low bit
rate networks.
• The most widely adopted standard relating to the
compression of digitized pictures has been
developed by an international standards body
known as the “Joint Photography Experts Group”
JPEG.
JPEG
• JPEG is defined in the International Standard IS 10918.
• The standard defines a range of different compression
modes, each of which is intended for use in a particular
application domain.
• Lossy Sequential Mode/Baseline Mode is intended for
the compression of both monochromatic and color
digitized pictures/images as used in multimedia
communication applications.
• There are five main stages associated with this mode:
image/block preparation, forward DCT, quantization,
entropy encoding, and frame building.
4
JPEG Encoder schematic
5
Image/Block Preparation
• Once the source image format has been selected
and prepared, the set of values in each matrix are
compressed separately using the DCT.
• Before performing DCT, a second step known as
“ Block preparation” carried out.
• It would be too time consuming to compute the
DCT of the total matrix in a single step so each
matrix is first divided into set of smaller 8 × 8
sub-matrics as a block.
• These are then fed sequentially to the DCT which
transform each block separately.
6
7
Forward DCT
• Each pixel value is quantized using 8 bits which
produces a value in the range 0 to 255 for the
intensity/luminance values-R,G,B or Y - and a
value in the range -128 to +127 for the two
chrominance values-Cb and Cr
• All the values are first centered around zero by
subtracting 128
• The input 2-D matrix is represented by :P[x,y]
and the transformed matrix by F[i, j]
• The DCT of each 8x8 block of values is computed using
the expression:
• Where C(i) and C(j) =1/√2 for i, j=0
= 1 for all other value of i and j ;
and x, y, i and j all vary from 0 through 7.
We can deduce a number of points by considering the
expression above:
1. All 64 values in the input matrix, P[x,y] contribute to each
entry in the transformed matrix, F[i,j].
2. for i=j=0, the two cosine terms are both 0. It is the
mean of all 64 values in the matrix and is known
as the DC coefficient.
3. All other locations of the transformed matrix have
a frequency coefficient associated with them-they
are known as AC coefficient.
4. For j=0, only horizontal frequency coefficient
are present which increase in frequency for i=1-7.
5. For i=0, only vertical frequency coefficient are
present which increase in frequency for j=1-7.
6. In all other locations in the transformed matrix,
both horizontal and vertical frequency coefficient
are present to varying degrees.
10
DCT computation features.
11
Quantization
The human eye responds primarily to the DC
coefficient and the lower spatial frequency
coefficients.
• If the magnitude of a higher frequency coefficient
is below a certain threshold, the eye will not
detect it.
• This property is exploited in the Quantization
phase by dropping-in practice, setting to zero-
those spatial frequency coefficients in the
transformed matrix whose amplitudes are less
than a defined threshold value.
12
Quantization
• The quantization process aims to reduce the size
of the DC and AC coefficients so that less
bandwidth is required for their transmission.
• A division operation is performed using the
defined threshold value as the divisor.
• If the resulting quotient is zero, the coefficient is
less than the threshold value.
• while if it is non-zero, this indicates the number
of times the coefficient is greater than the
threshold rather than the absolute value.
• The quantization table with the threshold value to
be used with a particular DCT coefficient in the
corresponding position in the matrix.
• The choice of threshold values is a compromise
between the level of compression that is required
and the resulting amount of information loss that is
acceptable.
• The JPEG standard includes two default
quantization table values-one for use with the
luminance coefficients and the other for use with
the two sets of chrominance coefficients.
14
Example computation of a set of quantized DCT
coefficients.
15
• An example set of threshold values is given in the
quantization table, together with a set of DCT
coefficient and their corresponding quantized values.
it can conclude a number of points:
• The computation of the quantized coefficients
involves rounding the quotients to the nearest integer
value.
• The threshold values used, increase in magnitude
with increasing spatial frequency.
• The DC coefficient in the transformed matrix is
largest.
• Many of the higher-frequency coefficients are zero.
16
• Entropy Encoding
The entropy encoding stage comprises four steps: vectoring,
differential encoding, run-length encoding, and Huffman
encoding
• Vectoring
The o/p of the quantization stage is a 2-D matrix of values. We
must first represent the values in the form of a single- dimension
vector as vectoring.
• Zig-zag scan
- the DC coefficient and lower-frequency AC coefficients-both
horizontal and vertical-are scanned first.
- All the higher-frequency coefficients are in a sequential order so
making his form of representation more suitable for compression.
17
Vectoring using a zig-zag scan:
(a) principle (b) vector
18
• Differential encoding applied to the DC
coefficient only.
• the first element in each transformed block is the
DC coefficient which is a measure of the average
color/luminance/chrominance associated with the
corresponding 8x8 block of pixel values.
• the DC coefficient varies only slowly from one
block to the next
• the most efficient type of compression is
differential encoding since this encodes only the
difference between each pair of values.
• for example, if the sequence of DC coefficients in
consecutive quantized blocks-one per block –was:
12, 13, 11, 11, 10, …
19
• the corresponding difference values would be :
12, 1, -2, 0, -1, …
• the first difference value always being encoded
relative to zero. the difference values are then
encoded in the form (SSS,value)
• the SSS field indicates the number of bits needed to
encode the value
• the value field the actual bits that represent the value.
20
• The number of bits required to encode each value
is determined by its magnitude.
• a positive value is then encoded using the
unsigned binary form and a negative value by the
complement of this.
22
Run-length encoding
• The remaining 63 values in the vector are the AC
coefficients. These coefficients are encoded in the
form of a string of pairs of values.
• Each pair is made up of (skip, value) where skip
is the number of zeros in the run and value the
next non-zero coefficient.
• Previous Figure would be encoded as:
(0,6) (0,7)(0,3)(0,3) (0,3) (0,2)(0,2)(0,2)(0,2)(0,0)
• Final pair (0,0) indicates the end of the string for
this block and that all the remaining coefficients
in the block are zero
23
Huffman encoding
• Significant levels of compression can be obtained
by replacing long string of binary digits by a
string of much shorter codewords.
• The length of each codeword being a function of
its relative frequency of occurrence .
• A table of codewords is used with the set of
codewords pre-computed using the huffman
coding algorithm.
• The same approach is used to encode the output
of both the differential and run-length encoders.
24
Frame building
• The compressed version of a printed picture- is
stored in the memory of a computer ready for
either integrating with other media if necessary or
accessing from a remote computer.
• The JPEG standard, also includes a definition of
the structure of the total bit stream relating to a
particular image/picture. This is known as frame.
• The frame builder is to encapsulate all the
information relating to an encoded image/picture
in this format.
25
JPEG encoder output bit stream format
• The role of the frame builder is to encapsulate all
the information relating to an encoded
image/picture in this format.
• The frame header contains a number of fields that
include:
1. the overall width and height of the image in
pixels.
2. the number and type of components that are
used to represent the image (CLUT,R/G/B,
Y/Cb/Cr);
3. the digitization format used.
• A frame consists of a number of components each
of which is known as a scan.
• These are also preceded by a header which contains
fields that include:
• The identity of the components (R/G/B) etc.
• The number of bits used to digitize each component;
• The quantization table of values that have been used to
encode each component.
• Each scan comprises one or more segments each of
which can contain a group of 8x8 blocks preceded by a
header.
• This contains the Huffman table of values that have
been used to encode each block in the segment should
the default table not be used.
• Each complete frame contains all the information
necessary to enable the JPEG decoder to identify each
field in a received frame and then perform the
corresponding decoding operation.
28
JPEG decoding
• A JPEG decoder is made up of a number of stages
which are simply the corresponding decoder sections of
those used in the encoder.
• On receipt of the encoded bitstream the frame decoder
first identifies the control information and tables within
the various headers.
• It then load the content of each table into the related
table and passes the control information to the image
builder.
• The huffman decoder decompressed the compressed
bitstream by using preloaded table of codewords.
• The two decompressed streams containing the DC and
AC coefficients of each block are then passed to the
differential and run-length decoders respectively.
• The resulting matrix of values is then dequantized using
either the default or the preloaded values in the
quantization table.
• Each resulting block of 8x8 spatial frequency
coefficients is passed to the inverse DCT which
transforms them back into their spatial form.
• The image builder then reconstructs the original image
from these blocks using the control information passed
to it by the frame decoder.
• Compression ratio is 20:1 for the pictures whose
content is relatively simple-that is, have relatively few
color transitions.
• For more complicated picture the compression ratio is
10:1.
Reference
• Fred Halsall “ Multimedia Communications
Applications, Networks, Protocols and
Standards”

Contenu connexe

Tendances

video compression techique
video compression techiquevideo compression techique
video compression techique
Ashish Kumar
 

Tendances (20)

Mpeg 2
Mpeg 2Mpeg 2
Mpeg 2
 
Multimedia communication networks
Multimedia communication networksMultimedia communication networks
Multimedia communication networks
 
Run length encoding
Run length encodingRun length encoding
Run length encoding
 
Predictive coding
Predictive codingPredictive coding
Predictive coding
 
Fundamentals and image compression models
Fundamentals and image compression modelsFundamentals and image compression models
Fundamentals and image compression models
 
Image segmentation
Image segmentation Image segmentation
Image segmentation
 
MPEG video compression standard
MPEG video compression standardMPEG video compression standard
MPEG video compression standard
 
Multimedia basic video compression techniques
Multimedia basic video compression techniquesMultimedia basic video compression techniques
Multimedia basic video compression techniques
 
Compression
CompressionCompression
Compression
 
Image compression
Image compression Image compression
Image compression
 
Chapter 6 : VIDEO
Chapter 6 : VIDEOChapter 6 : VIDEO
Chapter 6 : VIDEO
 
Image compression
Image compressionImage compression
Image compression
 
Computer Networks: Quality of service
Computer Networks: Quality of serviceComputer Networks: Quality of service
Computer Networks: Quality of service
 
video compression techique
video compression techiquevideo compression techique
video compression techique
 
Video
VideoVideo
Video
 
Data Redundacy
Data RedundacyData Redundacy
Data Redundacy
 
Image restoration and degradation model
Image restoration and degradation modelImage restoration and degradation model
Image restoration and degradation model
 
Multimedia:Multimedia compression
Multimedia:Multimedia compression Multimedia:Multimedia compression
Multimedia:Multimedia compression
 
Multimedia lossless compression algorithms
Multimedia lossless compression algorithmsMultimedia lossless compression algorithms
Multimedia lossless compression algorithms
 
Video on demand
Video on demandVideo on demand
Video on demand
 

Similaire à Multimedia communication jpeg

CyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdfCyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdf
MohammadAzreeYahaya
 
image compression in data compression
image compression in data compressionimage compression in data compression
image compression in data compression
Zaabir Ali
 

Similaire à Multimedia communication jpeg (20)

Jpeg
JpegJpeg
Jpeg
 
notes_Image Compression_edited.ppt
notes_Image Compression_edited.pptnotes_Image Compression_edited.ppt
notes_Image Compression_edited.ppt
 
Image compression Algorithms
Image compression AlgorithmsImage compression Algorithms
Image compression Algorithms
 
JPEG
JPEGJPEG
JPEG
 
Compression: Images (JPEG)
Compression: Images (JPEG)Compression: Images (JPEG)
Compression: Images (JPEG)
 
SOC Application Studies: Image Compression
SOC Application Studies: Image CompressionSOC Application Studies: Image Compression
SOC Application Studies: Image Compression
 
Jpeg standards
Jpeg   standardsJpeg   standards
Jpeg standards
 
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
 
Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...
Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...
Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...
 
Mmclass4
Mmclass4Mmclass4
Mmclass4
 
PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...
PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...
PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...
 
MDCT audio coding with pulse vector quantizers
MDCT audio coding with pulse vector quantizersMDCT audio coding with pulse vector quantizers
MDCT audio coding with pulse vector quantizers
 
Data compression
Data compressionData compression
Data compression
 
B070306010
B070306010B070306010
B070306010
 
JPEG Image Compression
JPEG Image CompressionJPEG Image Compression
JPEG Image Compression
 
MPEG-1 Part 2 Video Encoding
MPEG-1 Part 2 Video EncodingMPEG-1 Part 2 Video Encoding
MPEG-1 Part 2 Video Encoding
 
CyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdfCyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdf
 
image compression in data compression
image compression in data compressionimage compression in data compression
image compression in data compression
 
I3602061067
I3602061067I3602061067
I3602061067
 
FPGA based JPEG Encoder
FPGA based JPEG EncoderFPGA based JPEG Encoder
FPGA based JPEG Encoder
 

Plus de Dr. Kapil Gupta (7)

Research Methodology & IPR-I
Research Methodology & IPR-IResearch Methodology & IPR-I
Research Methodology & IPR-I
 
Research Methodology & IPR-II
Research Methodology & IPR-IIResearch Methodology & IPR-II
Research Methodology & IPR-II
 
Current mirror-A constant current circuit
Current mirror-A constant current circuitCurrent mirror-A constant current circuit
Current mirror-A constant current circuit
 
RSA Algoritmn
RSA AlgoritmnRSA Algoritmn
RSA Algoritmn
 
Sampling theorem
Sampling theorem Sampling theorem
Sampling theorem
 
Symmetric Encryption Techniques
Symmetric Encryption Techniques Symmetric Encryption Techniques
Symmetric Encryption Techniques
 
Chapter 1 Introduction of Cryptography and Network security
Chapter 1 Introduction of Cryptography and Network security Chapter 1 Introduction of Cryptography and Network security
Chapter 1 Introduction of Cryptography and Network security
 

Dernier

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 

Dernier (20)

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 

Multimedia communication jpeg

  • 1. MULTIMEDIA COMMUNICATIONS Image Compression-JPEG BY: Dr. KAPIL GUPTA Associate Professor MMEC, MMU, Mullana
  • 2. 2 Digitized pictures • The amount of memory required to store and display digitized picture ranged from 307kbytes through to 2.4Mbytes . • This would result in unacceptably long delays in most interactive applications that involve low bit rate networks. • The most widely adopted standard relating to the compression of digitized pictures has been developed by an international standards body known as the “Joint Photography Experts Group” JPEG.
  • 3. JPEG • JPEG is defined in the International Standard IS 10918. • The standard defines a range of different compression modes, each of which is intended for use in a particular application domain. • Lossy Sequential Mode/Baseline Mode is intended for the compression of both monochromatic and color digitized pictures/images as used in multimedia communication applications. • There are five main stages associated with this mode: image/block preparation, forward DCT, quantization, entropy encoding, and frame building.
  • 5. 5 Image/Block Preparation • Once the source image format has been selected and prepared, the set of values in each matrix are compressed separately using the DCT. • Before performing DCT, a second step known as “ Block preparation” carried out. • It would be too time consuming to compute the DCT of the total matrix in a single step so each matrix is first divided into set of smaller 8 × 8 sub-matrics as a block. • These are then fed sequentially to the DCT which transform each block separately.
  • 6. 6
  • 7. 7 Forward DCT • Each pixel value is quantized using 8 bits which produces a value in the range 0 to 255 for the intensity/luminance values-R,G,B or Y - and a value in the range -128 to +127 for the two chrominance values-Cb and Cr • All the values are first centered around zero by subtracting 128 • The input 2-D matrix is represented by :P[x,y] and the transformed matrix by F[i, j]
  • 8. • The DCT of each 8x8 block of values is computed using the expression: • Where C(i) and C(j) =1/√2 for i, j=0 = 1 for all other value of i and j ; and x, y, i and j all vary from 0 through 7. We can deduce a number of points by considering the expression above: 1. All 64 values in the input matrix, P[x,y] contribute to each entry in the transformed matrix, F[i,j].
  • 9. 2. for i=j=0, the two cosine terms are both 0. It is the mean of all 64 values in the matrix and is known as the DC coefficient. 3. All other locations of the transformed matrix have a frequency coefficient associated with them-they are known as AC coefficient. 4. For j=0, only horizontal frequency coefficient are present which increase in frequency for i=1-7. 5. For i=0, only vertical frequency coefficient are present which increase in frequency for j=1-7. 6. In all other locations in the transformed matrix, both horizontal and vertical frequency coefficient are present to varying degrees.
  • 11. 11 Quantization The human eye responds primarily to the DC coefficient and the lower spatial frequency coefficients. • If the magnitude of a higher frequency coefficient is below a certain threshold, the eye will not detect it. • This property is exploited in the Quantization phase by dropping-in practice, setting to zero- those spatial frequency coefficients in the transformed matrix whose amplitudes are less than a defined threshold value.
  • 12. 12 Quantization • The quantization process aims to reduce the size of the DC and AC coefficients so that less bandwidth is required for their transmission. • A division operation is performed using the defined threshold value as the divisor. • If the resulting quotient is zero, the coefficient is less than the threshold value. • while if it is non-zero, this indicates the number of times the coefficient is greater than the threshold rather than the absolute value.
  • 13. • The quantization table with the threshold value to be used with a particular DCT coefficient in the corresponding position in the matrix. • The choice of threshold values is a compromise between the level of compression that is required and the resulting amount of information loss that is acceptable. • The JPEG standard includes two default quantization table values-one for use with the luminance coefficients and the other for use with the two sets of chrominance coefficients.
  • 14. 14 Example computation of a set of quantized DCT coefficients.
  • 15. 15 • An example set of threshold values is given in the quantization table, together with a set of DCT coefficient and their corresponding quantized values. it can conclude a number of points: • The computation of the quantized coefficients involves rounding the quotients to the nearest integer value. • The threshold values used, increase in magnitude with increasing spatial frequency. • The DC coefficient in the transformed matrix is largest. • Many of the higher-frequency coefficients are zero.
  • 16. 16 • Entropy Encoding The entropy encoding stage comprises four steps: vectoring, differential encoding, run-length encoding, and Huffman encoding • Vectoring The o/p of the quantization stage is a 2-D matrix of values. We must first represent the values in the form of a single- dimension vector as vectoring. • Zig-zag scan - the DC coefficient and lower-frequency AC coefficients-both horizontal and vertical-are scanned first. - All the higher-frequency coefficients are in a sequential order so making his form of representation more suitable for compression.
  • 17. 17 Vectoring using a zig-zag scan: (a) principle (b) vector
  • 18. 18 • Differential encoding applied to the DC coefficient only. • the first element in each transformed block is the DC coefficient which is a measure of the average color/luminance/chrominance associated with the corresponding 8x8 block of pixel values. • the DC coefficient varies only slowly from one block to the next • the most efficient type of compression is differential encoding since this encodes only the difference between each pair of values. • for example, if the sequence of DC coefficients in consecutive quantized blocks-one per block –was: 12, 13, 11, 11, 10, …
  • 19. 19 • the corresponding difference values would be : 12, 1, -2, 0, -1, … • the first difference value always being encoded relative to zero. the difference values are then encoded in the form (SSS,value) • the SSS field indicates the number of bits needed to encode the value • the value field the actual bits that represent the value.
  • 20. 20
  • 21. • The number of bits required to encode each value is determined by its magnitude. • a positive value is then encoded using the unsigned binary form and a negative value by the complement of this.
  • 22. 22 Run-length encoding • The remaining 63 values in the vector are the AC coefficients. These coefficients are encoded in the form of a string of pairs of values. • Each pair is made up of (skip, value) where skip is the number of zeros in the run and value the next non-zero coefficient. • Previous Figure would be encoded as: (0,6) (0,7)(0,3)(0,3) (0,3) (0,2)(0,2)(0,2)(0,2)(0,0) • Final pair (0,0) indicates the end of the string for this block and that all the remaining coefficients in the block are zero
  • 23. 23 Huffman encoding • Significant levels of compression can be obtained by replacing long string of binary digits by a string of much shorter codewords. • The length of each codeword being a function of its relative frequency of occurrence . • A table of codewords is used with the set of codewords pre-computed using the huffman coding algorithm. • The same approach is used to encode the output of both the differential and run-length encoders.
  • 24. 24 Frame building • The compressed version of a printed picture- is stored in the memory of a computer ready for either integrating with other media if necessary or accessing from a remote computer. • The JPEG standard, also includes a definition of the structure of the total bit stream relating to a particular image/picture. This is known as frame. • The frame builder is to encapsulate all the information relating to an encoded image/picture in this format.
  • 25. 25 JPEG encoder output bit stream format
  • 26. • The role of the frame builder is to encapsulate all the information relating to an encoded image/picture in this format. • The frame header contains a number of fields that include: 1. the overall width and height of the image in pixels. 2. the number and type of components that are used to represent the image (CLUT,R/G/B, Y/Cb/Cr); 3. the digitization format used. • A frame consists of a number of components each of which is known as a scan.
  • 27. • These are also preceded by a header which contains fields that include: • The identity of the components (R/G/B) etc. • The number of bits used to digitize each component; • The quantization table of values that have been used to encode each component. • Each scan comprises one or more segments each of which can contain a group of 8x8 blocks preceded by a header. • This contains the Huffman table of values that have been used to encode each block in the segment should the default table not be used. • Each complete frame contains all the information necessary to enable the JPEG decoder to identify each field in a received frame and then perform the corresponding decoding operation.
  • 29. • A JPEG decoder is made up of a number of stages which are simply the corresponding decoder sections of those used in the encoder. • On receipt of the encoded bitstream the frame decoder first identifies the control information and tables within the various headers. • It then load the content of each table into the related table and passes the control information to the image builder. • The huffman decoder decompressed the compressed bitstream by using preloaded table of codewords. • The two decompressed streams containing the DC and AC coefficients of each block are then passed to the differential and run-length decoders respectively.
  • 30. • The resulting matrix of values is then dequantized using either the default or the preloaded values in the quantization table. • Each resulting block of 8x8 spatial frequency coefficients is passed to the inverse DCT which transforms them back into their spatial form. • The image builder then reconstructs the original image from these blocks using the control information passed to it by the frame decoder. • Compression ratio is 20:1 for the pictures whose content is relatively simple-that is, have relatively few color transitions. • For more complicated picture the compression ratio is 10:1.
  • 31. Reference • Fred Halsall “ Multimedia Communications Applications, Networks, Protocols and Standards”