0% found this document useful (0 votes)
3 views71 pages

Chapter 5 Data Compression

The document discusses data compression techniques, emphasizing the need for efficient storage, transmission, and performance enhancement in multimedia systems. It covers various coding methods including lossy and lossless compression, as well as specific algorithms like Run-Length Encoding, Huffman Coding, and Arithmetic Encoding. Additionally, it highlights the importance of balancing quality and efficiency in different application modes such as dialogue and retrieval.

Uploaded by

ASHLEY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views71 pages

Chapter 5 Data Compression

The document discusses data compression techniques, emphasizing the need for efficient storage, transmission, and performance enhancement in multimedia systems. It covers various coding methods including lossy and lossless compression, as well as specific algorithms like Run-Length Encoding, Huffman Coding, and Arithmetic Encoding. Additionally, it highlights the importance of balancing quality and efficiency in different application modes such as dialogue and retrieval.

Uploaded by

ASHLEY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

1

Multimedia System

CSC 319 CSIT - V


Unit 5 – Data Compression
2025
2
Chapter Outlines

 Storage Space –Basic knowledge about  Lossy Sequential DCT based Mode
Storage Space
 Steps of Lossy Sequential DCT- based
 Coding Requirements- Basic knowledge Mode
about Coding Requirements
 Expanded Lossy DCT based Mode
 Source, Entropy and Hybrid Coding
 Steps of Expanded Lossy DCT-based
 Run length encoding Mode
 Huffman Encoding  JPEG and MPEG JPEG and MPEG
 Arithmetic encoding (introduction only)
compression process
3
Need of Compression
 Need for Data Compression

 Data compression is the process of reducing the size of a data file or a dataset by re-encoding its contents using fewer bits than
the original representation.

 Storage Efficiency
 Reduces the amount of storage space needed for data.

 Allows for more data to be stored in the same physical space.

 Transmission Speed
 Decreases the time required to transmit data over networks.

 Enables faster data transfer rates, improving communication efficiency.

 Cost Savings
 Lowers costs associated with data storage and transmission.

 Reduces expenses for bandwidth and storage infrastructure.

 Performance Enhancement
 Improves system performance by reducing load times.

 Enhances the responsiveness of applications and services.


4
Need of Compression

 Data Backup and Recovery


 Facilitates faster and more efficient data backup processes.
 Simplifies the recovery of large datasets in case of data loss.
 Scalability
 Allows for easier scaling of systems to handle growing data volumes.
 Supports the management of big data environments.
 Environmental Impact
 Reduces energy consumption associated with data storage and transmission.
 Contributes to a smaller carbon footprint and sustainable practices.
5
Data Compression
 Storage Space

 Storage Space Requirement


 The storage space required for uncompressed data is significantly larger compared to compressed
data.
 Transmission Complications
 Uncompressed data, when transmitted over digital networks, requires more storage space and higher
bandwidth.
 This makes the transmission of uncompressed data highly complicated, especially for point-to-point
communication.
 Solution through Compression
 To address these complications and improve cost efficiency, multimedia systems use compressed
formats for digital audio and video streams.
6
Coding Requirements

 Coding Requirements
 Images need more storage space than text.
 Audio and video files need even more storage and also require higher data transfer
rates.
 Multimedia files, such as images, audio, and video, can consume large amounts of
storage space.
 Efficient coding and compression techniques are essential to reduce the file sizes,
making it easier to store more files on devices with limited storage capacity.
 Compressing multimedia files has some limitations. When decompressing, the quality
should be as good as possible.
 Multimedia coding requirements focus on balancing storage, transfer rates, and quality,
with specific considerations for different application modes.
7
Application Mode

 Dialogue Mode Application


 This application mode involves real-time interaction, such as video conferencing or online
gaming.
 Compression algorithms must balance quality and latency, ensuring that data is transmitted
quickly without significant degradation.
 Retrieval Mode Application
 This application mode involves storing and retrieving multimedia files, such as streaming services
or digital libraries.
 Compression algorithms can focus more on reducing file size while maintaining high quality
since the files are not required to be transmitted in real-time
8
Source coding ,Entropy and Hybrid
Coding
 Multimedia systems, such as images, videos, and audio files, require efficient
compression techniques to reduce data size while maintaining quality.
 Compression techniques can be categorized into source coding, entropy coding,
and hybrid coding.
 Source Coding
 Source coding refers to the process of reducing redundancy in the original
multimedia data.
 It aims to represent the source information using the least number of bits without
significant loss of information but quality may degraded.
 Source coding is type of lossy coding where some data is discarded to achieve
high compression rates.
9
Source coding ,Entropy and Hybrid
Coding

 Some source coding techniques are:


 DPCM (Differential Pulse Code Modulation)
 DM (Delta Modulation)
 DCT (Discrete Cosine Transform)
10
Source coding ,Entropy and Hybrid
Coding
 Entropy Coding
 Entropy coding is use to compress data without losing any information, ensuring
perfect reconstruction.
 Entropy coding techniques are applied in both text and image compression,
regardless of the media type.
 In entropy coding, data is treated as a sequence of symbols, enabling efficient
encoding based on frequency.
 Ex:
 Run-length coding
 Huffman coding
 Arithmetic coding
11
Source coding ,Entropy and Hybrid
Coding

 Hybrid Coding
 Hybrid Coding combines two or more coding techniques to improve the efficiency and
effectiveness of data compression.
 The goal is to exploit the strengths of different coding methods to achieve better compression
ratios and performance.
 Examples of Hybrid Coding:
 JPEG Compression
 Combines discrete cosine transform (DCT) for spatial domain transformation with Huffman coding for
entropy coding.

 MP3 Compression
 Uses a combination of perceptual coding, MDCT (Modified Discrete Cosine Transform), and Huffman
coding.
12
13
Compression

 Compression is the process of reducing the size of data (text, image,


audio, or video) to save storage space and improve transmission speed. It
works by removing redundant or unnecessary data while preserving the
essential information.
 Lossless Compression
 Lossy Compression
Lossless Compression

 A method of data compression where the original data can be perfectly reconstructed
from the compressed data.
 Examples: ZIP files, PNG images, FLAC audio.
 The most common models based on lossless technique are-
 RLE (Run Length Encoding)
 Dictionary Coder (LZ77, LZ78, LZR, LZW, LZSS, LZMA, LZMA2)
 Prediction by Partial Matching (PPM)
 Deflate
 Content Mixing
Cont.

 Huffman Encoding
 Adaptive Huffman Coding
 Shannon Fano Encoding
 Arithmetic Encoding
 Lempel Ziv Welch Encoding
 ZStandard
 Bzip2 (Burrows and Wheeler)
Run Length Encoding(RLE)

 Run-Length Encoding (RLE) is a simple way to compress data.


 It works by reducing the size of repeating characters in a string.
 RLE saves data in its value and count format.
 Algorithm:
 Initialization:
 Start with the first character of the input data.

 Set the count to 1.

 Processing:
 Move to the next character.

 If it is the same as the previous character, increase the count.

 If it is different, write down the previous character and the count, then reset the count to 1.

 Completion:
 After reaching the end of the string, write down the last character and its count.
Examples:RLE

 Syntax: X!Y
 Where
 x :Repeating Character
 !-marking flag
 Y –no of total count
OR
Character/Value Count
 Suppose a string :AAAAABBBCCDAA

RLE : A!5B!3C!2D!1A!2
RLE

 Suppose a binary string 0000010000100001111000=22


 RLE: (0,5)(1,1)(0,4)(1,1)(0,4)(1,4)(0,3)
 RLE encoded data is
 (0,101)(1,001)(0,010) (1,001) (0,010) (1,010)(0,011) 101001010001010010011=21
RLE

 Advantages
 Simple and efficient for data with long consecutive sequences; lossless
compression.
 Disadvantages
 Ineffective for data lacking long runs; limited applicability beyond specific
repetitive patterns.
 i.e if non repeating run sequence is present in inputs it forms outputs bigger than
inputs so, it is ineffective for short sequence or non-repetative sequence.
Huffman Encoding

 Huffman coding is a compression technique that assigns variable-


length codes to different symbols based on their frequencies, with
more frequent symbols assigned shorter codes to achieve
efficient data compression.
 Purpose of Huffman Coding is:
 Lossless Data Compression
 Data Encoding
Algorithm(HC)

 1.Frequency Calculation:
 Count the occurrences of each character in your input data.
 2.Priority Queue Initialization:
 Create a priority queue (min-heap) based on the frequencies of the characters.
 3.Construct Huffman Tree:
 Combine nodes until only one node remains in the priority queue, using the two nodes with the lowest
frequencies each time.
 3.Assign Codes:
 Traverse the Huffman tree to assign binary codes (0 and 1) to each character. Characters that appear more
frequently will get shorter codes.
 5.Encoding:
 Replace each character in the original data with its corresponding Huffman code to create the
compressed data and print output.
22
Huffman Coding

 E.g., let the word to be encoded be AABABBEEEEFEFC


 Length of String = 14
 No. of A =3 ;Probability of occurrence of A=3/14=0.214
 No. of B=3 ;Probability of occurrence of B=3/14=0.214
 No. of E=5 ;Probability of occurrence of E=5/14=0.357
 No. of F=2 ;Probability of occurrence of F=2/14=0.142
 No. of C=1 ;Probability of occurrence of C=1/14=0.01
23
Huffman Coding

Coding of character
C= 111
F= 110
B= 10
A=01
E=00
24
Huffman Coding

 Class work
1. Perform Huffman coding on the string: AAAABBBCCDDDEEFFGGGHHHH.
2. Perform Huffman coding on the string: XXYYYZZZZZZZZZZWWWWWWWW.
3. Perform Huffman coding on the string:
MMMNNNOOOOPPPPPPQQQQQQQQ.
4. Perform Huffman coding on the string: RRRRRSSSSSTTTTTUUUUUVVVV.
5. Perform Huffman coding on the string:
KKKKLLLLMMMMMMNNNNNNNOOOO.
Arithmetic Encoding
 Unlike Huffman coding which used a separate codeword for each
character, arithmetic coding yields a single codeword for each encoded
string of characters.
 The first step is to divide the numeric range from 0 to 1 into a number of
different characters present in the message to be sent – including the
termination character – and the size of each segment by the probability of
the related character.
Examples: AE
 Encode the message NEPAL using arithmetic encoding.
 Suppose probability of each character N=E=P=A=L=0.2.
 Now Initialization: Start with the interval [0, 1).
 Encoding 'n':
 Divide the interval [0, 1) into sub-intervals based on the probabilities of each character.
 Interval for 'n': [0, 0.2)
 Interval for 'e': [0.2, 0.4)
 Interval for 'p': [0.4, 0.6)
 Interval for 'a': [0.6, 0.8)
 Interval for 'l': [0.8, 1)
 The interval for 'n' is [0, 0.2).
27
(Contd.)

 Encoding 'e' in the interval [0, 0.2):


 Divide the interval [0, 0.2) into sub-intervals based on the probabilities.
 Interval for 'n': [0, 0.04)
 Interval for 'e': [0.04, 0.08)
 Interval for 'p': [0.08, 0.12)
 Interval for 'a': [0.12, 0.16)
 Interval for 'l': [0.16, 0.2)
 The interval for 'e' is [0.04, 0.08).
28
(Contd.)

 Encoding 'p' in the interval [0.04,  Encoding 'a' in the interval [0.056,
0.08): 0.064):
 Divide the interval [0.04, 0.08) into  Divide the interval [0.056, 0.064) into
sub-intervals based on the sub-intervals based on the
probabilities. probabilities.
 Interval for 'n': [0.04, 0.048)  Interval for 'n': [0.056, 0.0576)
 Interval for 'e': [0.048, 0.056)  Interval for 'e': [0.0576, 0.0592)
 Interval for 'p': [0.056, 0.064)  Interval for 'p': [0.0592, 0.0608)
 Interval for 'a': [0.064, 0.072)  Interval for 'a': [0.0608, 0.0624)
 Interval for 'l': [0.072, 0.08)  Interval for 'l': [0.0624, 0.064)
 The interval for 'p' is [0.056, 0.064).
(Contd.)

 The interval for 'a' is [0.0608, 0.0624).


 Encoding 'l' in the interval [0.0608, 0.0624):
 Divide the interval [0.0608, 0.0624) into sub-intervals based on the probabilities.
 Interval for 'n': [0.0608, 0.06112)
 Interval for 'e': [0.06112, 0.06144)
 Interval for 'p': [0.06144, 0.06176)
 Interval for 'a': [0.06176, 0.06208)
 Interval for 'l': [0.06208, 0.0624)
 The interval for 'l' is [0.06208, 0.0624).
 Final Step:
 Choose any value within the final interval [0.06208, 0.0624). For instance, you could choose the midpoint:
(0.06208 + 0.0624)/2 = 0.06224.
30
lossless and lossy compression
Lossless Compression Lossy Compression

Retains all original data, allowing for Sacrifices some data for size reduction,
Data Integrity
perfect reconstruction. resulting in a close approximation.

Suitable for text documents and


Commonly used for multimedia files like
File Types certain image formats (e.g., PNG,
audio (MP3) and video (MP4).
BMP).
Cannot fully restore the original data
Reconstruction Allows full recovery of the original data. due to permanent loss of some
information.
Used where data integrity is critical Used where reduced file size is more
Applications (e.g., medical imaging, legal important than perfect quality (e.g.,
documents). streaming).
Achieves a lower compression ratio, as Achieves a higher compression ratio by
Compression Ratio
it retains all data. discarding less important data.
May result in noticeable quality
Maintains the original quality of the
Quality degradation, especially at higher
data, ensuring no degradation.
compression levels.
Lossy Sequential DCT-Based Mode

 The lossy sequential DCT-based mode a method used in


image compression.
 It applies the Discrete Cosine Transform (DCT) to image
data in a sequential manner, typically processing one
line or block at a time.
 This approach helps in reducing redundancy and
spatial information in the image, allowing for efficient
compression while maintaining perceptual quality within
acceptable limits for various applications.
(Contd.)
Step1.Block Preparation

 This step involves the block preparation.


For e.g. let us assume the input to be
640*480 RGB image with 24 bits/pixel.
 The luminance Y and chrominance
components Cb, Cr of the image is
calculated using model for NTSC system.
 Separate matrices are constructed for Y,
Cb and Cr each elements in the range
of 0 and 255.
 The square blocks of four pixels are
averaged in the I and Q matrices to
reduce them to 320*240.
 Thus the data is compressed by a factor
of two and the reduction is lossy.
(Contd.)

 Now, 128 is subtracted from each


element of all three matrices to put 0
in the middle of the range.
 Each image is divided up into 8*8
blocks. The Y matrix has 4800 blocks;
the other two have 1200 blocks
Step 2 :Forward DCT

 Discrete Cosine
Transformation is applied to
each blocks separately.
 The output of each DCT is an
8*8 matrix of DCT coefficients.
DCT element (0,0) is the
average value of the block.
 The other element tells how
much spectral power is
present at each spatial
frequency.
3.Quantization

 Image processing is followed by quantization.


 The entire lossy process occurs in quantization.
 Specific frequencies are given more importance than
others.
 Tables are used for quantization and dequantization.
 Image quality may decrease due to quantization.
(Contd.)
• Example: Here, we see the initial DCT matrix, the quantization
table and the result obtained by dividing each DCT element
by the corresponding quantization table element.
• Figure: Computation of the quantized DCT coefficients
4.Entropy Encoding

 Entropy Encoding:
 Quantization is followed by Entropy Encoding (using Huffman Encoding only).
 DC coefficients are encoded by subtracting the DC coefficients of the previous unit.
 Huffman coding is preferred as it is free .
 Coding tables for each DC and AC coefficient must be provided.
 AC coefficients are processed using a zigzag sequence.
 DC Coefficients
 These represent the average brightness or intensity level of a block of pixels after applying
the Discrete Cosine Transform (DCT).
 AC Coefficients
 These represent the variations or high-frequency components in the block of pixels after
DCT.
(Contd.)

Let's take a simple 8×8 DCT


coefficient matrix as an example

Using zigzag order, we read the


values in the following sequence:
10,5,6,3,4,3,2,2,1,2,1,1,0,0,0,0,1,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0……..
Expanded Lossy DCT-Based Mode

 This method is particularly relevant for multimedia data, such as images,


audio, and video, where some loss of quality is acceptable in exchange
for significant reductions in file size.
 In this methods JPEG specifies progressive encoding,i.e. the image is
compressed in multiple scans.
 The first scan creates a blurry, low-quality version of the image.
 Each subsequent scan adds more detail to the image, making it clearer.
(Contd.)

Fig: Progressive Runs


(Contd.)

 Progressiveness is achieved in two different ways:


 Spectral selection
 Successive approximation
 By using a spectral selection in the first run only, the quantized DCT
coefficients of low frequencies of each data unit are passed in the
entropy encoding.
 Selection according to importance of DC, AC value .
 All DC values of whole image first .
 All AC values in order of important.
(Contd.)

 In successive runs, the coefficients of higher frequencies are processed.


 Successive approximation transfers all of the quantized coefficients in
each run, but single bits are differentiated according to their significance.
 The most-significant bits are encoded first, then the less-significant bits.
 Selection according to position of bits
 First the most significant bit of all blocks
 Then the second significant bit of all blocks
 Until the least significant bit of all blocks
44
Data compression
Major Steps of Data Compression
Compression of Still Images and Video/Audio Data Streams

1. Picture preparation: Generates digital representation of information in the compressed medium.


For example, a picture might be divided into blocks of 8×8 pixels with a fixed number of bits per pixel.

2. Processing step: Uses various compression algorithms for the first step.

 Discrete Cosine Transform (DCT): Transforms time domain to frequency domain.

 Interframe coding: Determining motion vectors for each 8x8 pixel block.
3. Quantization in Picture Processing

 Quantization occurs after the exact picture processing step.

 Values are quantized according to a specific resolution and characteristic curve.

 This can also be considered equivalent to the µ-law and A-law, which are used for audio data [JN84].
 Results can be treated differently based on their importance (e.g., quantized with different numbers of bits).
45
Data compression
Major Steps of Data Compression
4. Entropy Coding

 Starts with a sequential data stream of individual bits and bytes.


 Techniques can be used for final, lossless compression.

 For example, long sequences of zeroes can be compressed by specifying the number of occurrences followed by
the zero.
 After four compression steps, digital data is converted into a formatted data stream, which may include the image starting
point and interpretation type, and an error correction code may be added.

 Decompression is the inverse process of compression. Specific coders and decoders can be implemented very differently.
JPEG Compression and Decompression
Process
Encoding Process

 1.Color Space Conversion


 Converts the image from RGB (Red, Green, Blue) to YCbCr (Luminance and
Chrominance components).
 Y (luminance) stores brightness, while Cb and Cr (chrominance) store color
information.
 This is done because the human eye is more sensitive to brightness than color.
 2.Subsampling
 The chrominance channels (Cb and Cr) are downsampled (e.g., 4:2:0) to
reduce data size since the human eye is less sensitive to color details.
(Contd.)

 3.Discrete Cosine Transform (DCT)


 Each 8×8 pixel block undergoes DCT, converting spatial data (pixel intensities)
into frequency components.
 Lower frequencies capture most of the image details, while higher frequencies
store fine details.
 4.Quantization
 Higher frequency components are divided by a quantization matrix to reduce
precision, which removes less perceptible details.
 This is the main step responsible for compression.
(Contd.)

 5. Encoding (Entropy Coding)


 Uses Huffman coding or Run-Length Encoding (RLE) to further compress the
data.
 The result is the JPEG-compressed image data.
Decoding Process

 1.Decoding (Entropy Decoding)


 The compressed data is decoded using Huffman or Run-Length decoding.
 2.Dequantization
 The quantized values are multiplied back by the quantization matrix to restore
approximate frequency components.
 3.Inverse DCT (IDCT)
 Converts frequency components back into spatial domain pixel values.
 4.Inverse Subsampling
 Since chrominance components (Cb and Cr) were down sampled earlier, they are
upsampled back to match the original image resolution.
 This step reconstructs the missing color details.
Decoding Process(Contd.)

 5.Inverse Color Space Conversion


 Converts the image from YCbCr back to RGB for display.
 This restores the image in a format suitable for screens and other applications.
 6.Raw Image Data Output
 The decompressed image is now available in its near-original form, though some
loss of quality may have occurred due to quantization.
Video compression – MPEG Encoding

 The Moving Picture Experts Group (MPEG) method is used to compress video.
 In principle, a motion picture is a rapid sequence of a set of frames in which each frame is a
picture.
 In other words, a frame is a spatial combination of pixels, and a video is a temporal
combination of frames that are sent one after another.
 Compressing video, then, means spatially compressing each frame and temporally
compressing a set of frames.
53
Video compression – MPEG Encoding
 MPEG
 MPEG (stands for Moving Picture Experts Group) is also a joint ISO and CCITT working group for developing standards for
compressing still images.

 The MPEG video compression standard became an international standard in 1993.

 MPEG uses technology defined in other standards, such as JPEG and H.261.

 MPEG was formed by the ISO to formulate a set of standards relating to a range of multimedia applications that involve the
use of video with sound.

 MPEG can deliver a data rate of at most 1856000 bits/second, which should not be exceeded.

 Data rates for audio are between 32 and 448 Kbits/second; this data rate enables video and audio compression of
acceptable quality.

 The MPEG standard exploits the other standards and they are

 JPEG:

 JPEG is used as the motion picture is a continuous sequence of still image.


54
Video compression – MPEG Encoding
 MPEG

 H.261:

 H.261 video compression standard has been defined by the ITU-T for the provision of video telephony and
videoconferencing services over an Integrated Services Digital Network (ISDN).

 It specifies two resolution formats with an aspect ratio of 4:3 are specified. Common Intermediate Format
(CIF) defines a luminance component of 288 lines, each with 352 pixels. The chrominance components have
a resolution with a rate of 144 lines and 176 pixels per line.

 Quarter CIF (QCIF) has exactly half of the CIF resolution i.e., 76*144 pixels for the luminance and 88*72 pixels
for the other components.
55
Video compression – MPEG Encoding
 Basic of Video Compression:

 Video is made up of multiple images called frames.

 Images are having highly redundant data i.e. adjacent pixels are highly correlated.

 JPEG compresses images.

 Temporal Correlation – Adjacent frames are similar and changes are due to object motion

 Predict a new frame from previous frame and specify the prediction error.

 Prediction error can be coded by using image coding methods (e.g., JPEG)
 Prediction from past frames are known as forward prediction.

 Prediction error can be coded with fewer bits and regions can’t predicted well are coded directly.
56
Video compression – MPEG Encoding
 Basic of Video Compression:
 Previous of next frame is known as reference image.

 Video compression makes use of motion compensation to predict a frame from the previous and/or next
frame.

 Macro blocs: Compression works on a block of 16*16 pixels called macro blocks.
57
Video compression – MPEG Encoding
 MPEG video uses video compression algorithms called Motion-Compensated Discrete Cosine Transform algorithms.

 The algorithms use the following basic algorithm

 Temporal Prediction: It exploits the temporal redundancy between video pictures.

 Frequency Domain Decomposition: It uses DCT to decompose spatial blocks of image data to exploit statistical and
perceptual spatial redundancy.

 Quantization: It reduces bit rate while minimizing loss of perceptual quality.

 Variable-length Coding: It exploits the statistical redundancy in the symbol sequence resulting from quantization as well
as in various types of side information.

 As far as audio compression is concerned the time-varying audio input signal is first sampled and quantized using PCM, the
sampling rate and number of bits per sample being determined by the specific application.

 The bandwidth that is available for transmission is divided into a number of frequency sub-bands using a bank of analysis
function which because of their role, are also known as critical-band filters.
58
Video compression – MPEG Encoding
 Video Encoding

 Video is simply a sequence of digitized pictures. The video that MPEG expects to process is composed of a sequence of
frames or fields of luma and chroma.

 Image Preparation

 An image must consist of three components, luminance Y and Cr and Cb (similar to the YUV format).

 The luminance component has twice as many samples in the horizontal and vertical axes as the other components, i.e.
there is color subsampling.

 The resolution of the luminance component should not exceed 768×576 pixels. The pixel depth is eight bits in each
component.

 MPEG provides 14 different aspect rations which are coded in data stream. Some of them are: A square pixel (1:1), for 625
line image (16:9, European HDTV), 702 X 575 pixel images (4:3).

 The image refresh frequency is also encoded in the data stream So far, eight frequencies have been defined (23.976Hz,
24Hz, 25Hz, 29.97Hz, 30Hz, 50Hz, 59.94Hz,and 60Hz), so no low image refresh frequencies are permitted.
59
Video compression – MPEG Encoding
 Temporal Prediction in Still Images

 Offers significant data reduction.

 Reduction in areas with strong, irregular motions is similar to intraframe coding.

 Requires large storage of previously determined information and image data.

 Prediction efficiency is determined by balancing storage capacity and compression rate.

 The technique that is used to exploit the high correlation between successive frames is to predict the content of many of
the frames.

 Instead of sending the source video as a set of individually-compressed frames, just a selection is sent in this form and, for
the remaining frames, only the differences between the actual frame contents and the predicted frame contents are sent.
This operation is known as motion estimation and, since to indicate any small differences between the predicted and actual
positions of the moving segments involved. The latter is known as motion compensation.
60
Video compression – MPEG Encoding
 Types of Image Frames in MPEG

 There are two basic types of compressed frame: those that are encoded independently and those that are predicted. The
first are as intra-coded frames or I frames.

 In practice, there are two types of predicted frames: predictive or P-frames and bidirectional or B-frames and because of
the way they are derived, the latter are also known as inter-coded or interpolation frames.

 I - frames (Intra-coded Images):

 Independent frames i.e. encoded without reference to any other frames.

 Each frame is treated as a separate (digitized) picture and the Y, Cb , and Cr matrices are encoded independently using
the JPEG algorithm.

 The level of compression obtained with I-frames is relatively small.

 I - frames must be present in the output stream at regular intervals in order to allow for the possibility of the contents of an
encoded I - frame being corrupted during transmission.

 The number of frames/pictures between successive I-frames is known as a group of pictures or GOP.
61
Video compression – MPEG Encoding
 P-frames (Predictive-Coded Frames):

 Not Independent

 These frames are predicted from a past frame( I or P)

 In practice, the number of P-frames between each successive pair of I-frames is limited since any errors present in the first P-
frame will be propagated to the next.

 The number of frames between a P-frame and the immediately preceding I- or P-frame is called the prediction span. It is
given the symbol M and typical values range from 1 through 3.

 P-frames consist of I-frame macro blocks and six predictive macro blocks.

 The coder must determine if a macro block should be coded predicatively or as a macro block of an I-frame and
furthermore, if there is a motion vector that must be encoded.

 A P-frame can contain macro blocks that are encoded using the same technique as I-frames.
62
Video compression – MPEG Encoding
63
Video compression – MPEG Encoding
 B frames (bidirectionally predictive coded)

 Due to an unexpected movement in real scenes, the regret may not have good matching in previous frame.

 So, b frames are coded with reference to both previous and future reference frames ( either I or P)

 Motion estimation involves comparing small segments of two consecutive frames for differences and, a search is carried out
to determine to which neighboring segment the original segments has moved.

 In order to minimize the time for each search, the search region is limited to just a few neighboring segments.

 It is possible for a segment to have moved outside the search region. To allow for this possibility, in applications such as
movies, in addition to P-frames, second types of frames are used called B-frames.

 It requires information from previous and following I and/or P frames.

 B frames yield the highest compression ratio attainable in MPEG.

 A B frame is defined as the difference from a prediction based on a previous and a following I or P frame.

 It cannot, however, ever serve as a reference for prediction coding of other pictures.
64
Video compression – MPEG Encoding
 B frames (bidirectionally predictive coded pictures)

 The content of the B-frames are predicted using search regions in both past and future frames.

 In addition to allowing for occasional fast moving objects, this also provides better motion estimation when, for example, an
object moves in front of or behind or another object.

 B-frames provide the highest level of compression and, because they are not involved in the coding of other frames, they
do not propagate errors.

 D-frames (DC-Coded Frames):

 D-frame has been defined for use in movie/video-on-demand applications.

 D-frames are used for display in fast-forward or fast-rewind modes.

 D-frames are inserted at regular intervals throughout the stream. These are highly compressed frames and are ignored
during the decoding of P- and B-

 compression algorithm, the DC coefficient associated with each 8 * 8 block pixels- both for the luminance and the two
chrominance signals- is the mean of all the values in the related block.
65
Video compression – MPEG Encoding
 D-frames (DC-Coded Frames):

 Hence by using only encoded DC coefficients of each block of pixels in the periodically inserted D-frames, a low-resolution
sequence of frames is provided each of which can be decoded at the higher speeds that are expected with the rewind
and fast-forward operations.

 Quantization

 Concerning quantization, it should be noted that AC-coefficients of B and P frames are usually very large values, whereas
those of I frames are very small.

 Thus, MPEG quantization, quantization adjusts itself accordingly. If the data rate increases too much, quantization becomes
more coarse. If the data rate falls, then quantization is performed with finer granularity.
66
Video compression – MPEG Encoding
 MPEG Compression Process Overview

 Sampling:

 Video and audio signals are sampled and converted into digital formats, dividing the video into frames and then into
smaller blocks of pixels.

 Video and audio signals are sampled at regular intervals to produce digital audio signals.

 Quantization:

 Video and audio signals are quantized to reduce data precision and size.

 Discrete Cosine Transform (DCT) is applied for video, and Modified Discrete Cosine Transform (MDCT) for audio.

 Motion Estimation and Compensation:

 Motion estimates and compensates for changes between frames.

 MPEG reduces information needed to describe frame changes.


67
Video compression – MPEG Encoding
 Entropy Coding:

 Video and audio data are compressed using entropy coding techniques.

 Bitstream Formatting:

 Compressed data is organized into a bitstream format.

 Error Handling and Synchronization:

 MPEG compression includes mechanisms for error handling and synchronization.

 Entropy Coding:

 Video and audio data are compressed using entropy coding techniques.

 Bitstream Formatting:

 Compressed data is organized into a bitstream format.

 Error Handling and Synchronization:

 MPEG compression includes mechanisms for error handling and synchronization.


68
Audio Compression
 Audio Encoding:

 MPEG audio coding is compatible with compact Disc Digital Audio (CD-DA) and Digital Audio Tape (DAT) audio data
coding.

 Important criterion : the choice of sample rate of 44.1kHz or 48kHz (additionally 32kHz) at 16bits per sample value.

 Each audio signal is compressed to either 64, 96, 128, or 192Kbit/s.

 Three quality levels (layers) defined with varying encoding and decoding complexity.

 Higher layer implementation must decode MPEG audio signals of lower layers.

 Fast Fourier Transform (FFT) applied for audio transformation into frequency domain.

 Audio signal divided into 32 non-overlapping sub-bands for quantization.

 Noise level in each sub-band determined using psychoacoustic model for quantization.

 PCM-encoded spectral components in first and second layers.

 Huffman coding performed in third layer.


Audio Compression

 Audio compression can be used for speech or music. For speech, we need
to compress a 64 kHz digitized signal, while for music, we need to compress
a 1.411 MHz signal.
 Two categories of techniques are used for audio compression:
 predictive encoding and perceptual encoding.
70
Audio Compression
Thank you!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy