Академический Документы
Профессиональный Документы
Культура Документы
384 288 3 25 frames = 8294400 bytes: Multimedia elements are very large.
Throughput — continuous media require We need to reduce the data size using
very large throughput. For example, an compression.
COMP3600 Multimedia Systems 8. Data Compression COMP3600 Multimedia Systems 8. Data Compression
(199901) Slide 1 (199901) Slide 2
COMP3600 Multimedia Systems 8. Data Compression COMP3600 Multimedia Systems 8. Data Compression
(199901) Slide 3 (199901) Slide 4
Coding techniques Run-length coding
Vector Quantisation — a data stream is Since the code is shorter than the data Digital images, audio and video data For example:
divided into blocks of n bytes (where n > pattern, compression is achieved. The stream often contain sequences of the same
ABCD CCCCCCCC
| {z } DBEC
1 ). A predefined table contains a set of popular zip application used this method bytes.
compressed to
patterns is used to code the data blocks. to compress files.
#
LZW — a general compression algorithm ABCD C !8 DBEC
capable of working on almost any type Differential coding — (also know as By replacing the sequence with its length,
prediction or relative coding) The most In practice, there are many variances of this
of data. It builds a data dictionary a substantial reduction of data can be
known coding of this kind is DPCM (Dif- basic compression techniques.
of data occurring in an uncompressed achieved.
ferential Pulse Code Modulation). This One particular variance, known as zero
data stream. Patterns of data are
method encodes the difference between suppression, assumes that only one symbol
identified and are matched to entries in
the consecutive samples instead of the in the data stream appear very often, for
the dictionary. When a match is found
sample values. For example, A special flag that does not occur in the example, a 0 in scanned text. A sequence
the code of the entry is output.
data can be used to indicate the length of of zeros is replaced by a flag and the number
Pattern Code sequence. of occurrences.
Begin 1 PCM 215 218 210 212 208 . . .
End 2 DPCM 215 3 -8 2 -4 . . .
tion 3
... ...
DM (Delta Modulation) is a modification
Input function Begin x := 3; . . . of DPCM. The difference is coded with a
Output func@3 @1@4 . . . single bit.
COMP3600 Multimedia Systems 8. Data Compression COMP3600 Multimedia Systems 8. Data Compression
(199901) Slide 5 (199901) Slide 6
COMP3600 Multimedia Systems 8. Data Compression COMP3600 Multimedia Systems 8. Data Compression
(199901) Slide 7 (199901) Slide 8
An example of Huffman code tree JPEG
JPEG (stands for Joint Photographic The JPEG standard have three levels of
p(AD)
=0.29
Experts Group) is a joint ISO and CCITT definition as follows:
p(CE)
working group for developing standards
for compressing still images
Baseline system — must reasonably
=0.20 decompress colour images, maintain a
p(D) =0.13 p(A)=0.16 Completed Tree The JPEG image compression standard high compression ratio, and handle from
STEP 2 became an international standard in 4bits/pixel to 16bits/pixel.
p(ABCDE)
p(C) =0.09 p(E)=0.11 =1.00 1992
Extended system — covers the various
JPEG can be applied to colour or gray-
0 1
STEP 1 encoding aspects such as variable-
p(CEAD)
scale images length encoding, progressive encoding,
p(B)=0.51
0
=0.49
1 By changing appropriate parameters, the and hierarchical mode of encoding.
p(CEAD)
=0.49 user can select Special lossless function — ensures that
p(CE) p(AD)
– the quality of the reproduced image at the resolution at which the image is
=0.20 =0.29
1
compressed, decompression results in
0 1 0 – compression processing time
p(CE)=0.20 p(AD)=0.29
no loss of any detail the was in the
– the size of the compressed image original image.
p(C) =0.09 p(E)=0.11 p(D) =0.13 p(A)=0.16
STEP 3
COMP3600 Multimedia Systems 8. Data Compression COMP3600 Multimedia Systems 8. Data Compression
(199901) Slide 9 (199901) Slide 10
Entropy
Preparation Processing encoding
Huffman
255 planes.
C3
Block, MCU FDCT Each plane Ci may have different number of pixels C2
Arithmetic in the horizontal (Xi) and vertical (Yi) dimension. C1
COMP3600 Multimedia Systems 8. Data Compression COMP3600 Multimedia Systems 8. Data Compression
(199901) Slide 11 (199901) Slide 12
JPEG — Discrete Cosine Transform JPEG — Quantisation
DCT transforms the data from a spatial The DCT algorithm is symmetrical, and The DCT output matrix is quantised to coefficient can be dropped to reduce the
domain to a frequency domain. an inverse DCT algorithm can be used to reduce the precision of the coefficients data size
It removes redundancy in the data. decompress an image.
This increases the compression JPEG baseline algorithm defines a set of
It is proven to be the optimal transform for The DCT coefficients of each 8 8 blocks are DCT ; is known as the DC coefficient
(0 0) quantisation tables
large classes of images. calculated using the formula below. which represents the basic colour, i.e.,
2 3 2 3 wave-length, of the image block Each element q in the table, known as
(2x + 1)i (2y j 7
DCT (i; j ) = p 1
CiCj
7 X
X 7
pxy cos 6
4
N
7
5 cos
6
4
+ 1)
N
5 The other DCT coefficients are known
quantum is used in the following formula
2N x=0 y=0 2 2 to calculate the quantised coefficients Q:
as AC coefficients which represent the
where Ci; Cj = p12 for i; j = 0, otherwise Ci; Cj = 1. frequency components of the data block DCTij
Here is an example. On the left is the 8 8 block of pixels, and on the right is the DCT Qij
AC coefficients further away from the DC
=
qij
coefficients.
On the left is quantum matrix for quality level 1, and on the right the result of quantising
the example from previous page.
132 126 138 140 144 145 147 155 172 -18 15 -8 23 -9 -14 19
136 140 140 147 140 148 155 156 21 -34 24 -8 -10 11 14 7 4 7 10 13 16 19 22 25 43 3 2 0 0 0 0 0
140 143 144 148 150 152 154 155 -9 -8 -4 6 -5 4 3 -1 7 10 13 16 19 22 25 28 3 3 2 0 0 0 0 0
144 144 146 145 149 150 153 160 -10 6 -5 4 -4 4 2 1 10 13 16 19 22 25 28 31 1 0 0 0 0 0 0 0
150 152 155 156 150 145 144 140 -8 -2 -3 5 -3 3 4 6 13 16 19 22 25 28 31 34 1 0 0 0 0 0 0 0
144 145 146 148 143 158 150 140 4 -2 -4 6 -4 4 2 1 16 19 22 25 28 31 34 37 0 0 0 0 0 0 0 0
150 156 157 156 140 146 156 145 4 -3 -4 5 6 3 1 1 19 22 25 28 31 34 37 40 0 0 0 0 0 0 0 0
148 145 146 148 156 160 140 145 0 -8 -4 3 2 1 4 0 22 25 28 31 34 37 40 43 0 0 0 0 0 0 0 0
25 28 31 34 37 40 43 46 0 0 0 0 0 0 0 0
COMP3600 Multimedia Systems 8. Data Compression COMP3600 Multimedia Systems 8. Data Compression
(199901) Slide 13 (199901) Slide 14
DCi 1 DCi
standards, such as JPEG and H.261 The luminance component has twice as
It defines a basic data rate of many samplesin the horizontal and ver-
1.2Mbits/sec tical axes as the other two components
Blocki 1 Blocki
It is suitable for symmetric as well
(known as colour sub-sampling
COMP3600 Multimedia Systems 8. Data Compression COMP3600 Multimedia Systems 8. Data Compression
(199901) Slide 15 (199901) Slide 16
How MPEG encode the video stream Group of Pictures
In order to achieve higher compression coded using the predictive technique with The I-, P- and B-frames are often arranged I P B B P B B P B B B B
ratio, MPEG uses the fact the image on reference to the previous I-frame and/or into groups, known as Group of pictures
consecutive frames differ relative small. It previous P-frame. (GOP). A typical GOP consists of twelve This is known as the transmission sequence.
uses a temporal prediction technique to
encode the frame so that the storage B-frame (Bi-directionally predictive-
frames in the following sequence:
When random access function is required,
coded frame) — It requires information IBBPBBPBBPBB the I-frames will be used as index, and the
requirement is greatly reduced.
Common MPEG data stream consists of of the previous and following I- and P- When the video is transfered and decoded, accessing to the video will be in a resolution
four kinds of frames: frames for encoding and decoding. the frames are in the following order: of twelve frames.
I-frame (Intra-frame) — it is a self D-frame (DC-coded frame) Only the
contained frame, and it is coded without lowest frequency component of image is I B B P B B P
reference to any other frames. encoded. It is used in fast forward or fast
P-frame (Predictive-coded frame) — It is rewind.
COMP3600 Multimedia Systems 8. Data Compression COMP3600 Multimedia Systems 8. Data Compression
(199901) Slide 17 (199901) Slide 18
COMP3600 Multimedia Systems 8. Data Compression COMP3600 Multimedia Systems 8. Data Compression
(199901) Slide 19 (199901) Slide 20
Original frames
1 2 3 4 5 6 7 8 9
MPEG
Compression
I B B P B B P B B
I P B B P B B B B
Transmission / receiving order
COMP3600 Multimedia Systems 8. Data Compression
(199901) Slide 21