multimedia data and its encoding - wordpress.com...mar 16, 2019  · cse 4295: multimedia...

28
Mulmedia Data and Its Encoding Lecture 16 prepared by M. Adnan Quaium CSE 4295 : Mulmedia Communicaon M. Adnan Quaium Assistant Professor Department of Electrical and Electronic Engineering Ahsanullah University of Science and Technology Room – 4A07 Email – [email protected] URL- hp://adnan.quaium.com/aust/cse4295 1

Upload: others

Post on 14-Oct-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

Multimedia Data and Its Encoding

Lecture 16

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication

M. Adnan Quaium

Assistant ProfessorDepartment of Electrical and Electronic Engineering

Ahsanullah University of Science and TechnologyRoom – 4A07

Email – [email protected] URL- http://adnan.quaium.com/aust/cse4295

1

Page 2: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

PNG (Portable Network Graphics)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 2

The PNG can display of grayscale images with up to 65,536 levels of brightness and color images with a color depth of

48 bits.

● PNG may contain transparency information (alpha channel) in increments of up to 16 bits. Therefore, a seamless display of arbitrarily shaped images across a background is possible.

● PNG also offers the possibility of embedding color profile data, color and brightness correction (gamma correction) for the adjustment of graphics data in various output devices. But other than RGB and grayscale there are no alternative color spaces supported. For this reason, the PNG graphics format has never found widespread use in the professional field.

Page 3: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

PNG (Portable Network Graphics)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 3

PNG formats with transparent Background

Page 4: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

PNG (Portable Network Graphics)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 4

In encoding,

● PNG allows a line by line pre-filtering of the data. Because adjacent pixels can barely be distinguished from one another in many images, it is an advantage to process only the value difference between neighboring pixels.

● Substantial differences are rare in natural images such as photographs.

● Long sequences of identical difference values are advantageous in data compression.

Substantial differences are common Substantial differences are rare

Page 5: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

PNG (Portable Network Graphics)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 5

In decoding,

● Inverse filters are used on the stored difference values to reconstruct the original image data.

● Compression of the filtered image data proceeds with the lossless deflate algorithm, which is also used in various file archive formats such as the zip of gz.

The PNG graphics standard also has integrated checksum mechanisms that allow data transmission errors to be recognized early.

Page 6: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG (Joint Photographic Expert Group)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 6

JPEG involves a compression procedure that is particularly well suited for the compression of natural, e.g.,

photographic, depictions.

The compression technology used is based on the de-correlation of image elements through the use of the Discrete Cosine Transformation (DCT) together with Huffman coding.

Based on the JPEG compression technology for static images, a compression procedure was developed for animated image sequences: the MPEG compression procedure (Motion JPEG).

Page 7: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 7

Four Main steps for JPEG compression

● Color Conversion and Sampling● Discrete Cosine Transformation (DCT)● Quantization● Entropy Coding

For image files compressed with the JPEG method, the American company C-Cube developed a suitable data format, the JPEG File Interchange Format (JFIF). This format makes the exchange of JPEG encoded information possible between incompatible computer systems

Page 8: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 8

Page 9: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 9

Four Main steps for JPEG compression

● Color Conversion and Sampling● Discrete Cosine Transformation (DCT)● Quantization● Entropy Coding

For image files compressed with the JPEG method, the American company C-Cube developed a suitable data format, the JPEG File Interchange Format (JFIF). This format makes the exchange of JPEG encoded information possible between incompatible computer systems

Page 10: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 10

Step 1 : Color Conversion and Sampling

● In the first part of JPEG compression every color component (red, green, blue) is decomposed into the components: Luminance (brightness) and Chrominance (color information).

● Because the human eye is less sensitive in terms of chrominance, JPEG allows a higher information loss in this area.

● The RGB information is transformed into the components Y (equivalent to the brightness), C

b (equivalent to the blue component)

and Cr (equivalent to the red components).

Page 11: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 11

Step 1 : Color Conversion and Sampling

Original Image

Page 12: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 12

Step 1 : Color Conversion and Sampling

In the image separation process (sampling) the parts C

b and C

r are assigned a lower resolution

than the Y components.

Thus, four (r,g,b) pixels that originally occupy a memory of 4×3 byte = 12 bytes can be reduced to 4(Y) + 1(C

b ) + 1(C

r ) = 6 bytes.

Page 13: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 13

Step 1 : Color Conversion and Sampling

Original Image Downsampled Image

Because the human eye is less sensitive in terms of chrominance, JPEG allows a higher information loss in this area.

Page 14: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 14

Step 2 : Discrete Cosine Transformation (DCT)

With the help of DCT, intensity data is transformed into frequency data, which indicates how quickly the intensity of

the color and brightness information vary in the image.

● If image resolution < output device resolution, then must interpolate extra pixels

● Always leads to loss of quality.● If image resolution > output device resolution, then must

downsample (discard pixels):● Quality will often be better than that of an image at device

resolution (uses more information).● Image sampled at a higher resolution than that of intended

output device is over sampled.

Page 15: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 15

● A Fourier-related transform similar to the Discrete Fourier Transform (DFT), but using only real numbers.

● Often used in signal and image processing.● Maps values from spatial domain to frequency domain – image areas

with low frequency (large blocks of single color) are compressed more efficiently.

● Used in JPEG, MJPEG, MPEG, and DV Compression

Step 2 : Discrete Cosine Transformation (DCT)

Page 16: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 16

The spectral portions of an image vary from section to section. Thus the transformation is not calculated for the entire image but only for the individual image segments.

Step 2 : Discrete Cosine Transformation (DCT)

Page 17: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 17

Each image component (Y,Cb,Cb) is processed separately.

The image is divided into image blocks of 8 × 8 pixels in JPEG encoding.

Step 2 : Discrete Cosine Transformation (DCT)

Page 18: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 18

Step 2 : Discrete Cosine Transformation (DCT)

Page 19: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 19

Via the DCT transformation, a time-discrete signal is transformed from the local into the frequency range.

This means that the transformation of gray values results in 64 DCT coefficients. Instead of storing the intensity of the 64 individual pixels in a 8 × 8 pixel size block, every 8 × 8 block is displayed via a linear combination, represented by 64 individual blocks on a DCT coefficient basis.

Because of the DCT transformation there results a frequency matrix indicating the frequency and amplitude distribution for the considered space. The 64 function values of the original matrix, dependent on the two spatial dimensions x and y, are transformed in their spectrum.

Step 2 : Discrete Cosine Transformation (DCT)

Page 20: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 20

F(0,0) expresses the average value (direct current) of 8 × 8-Matrix, F(1,0) describes the proportion in which the image values change slowly (low frequencies) and F(7,7) the proportion in which the image values change quickly in both directions (high frequencies)

Step 2 : Discrete Cosine Transformation (DCT)

Page 21: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 21

Step 3 : Quantization

● The coefficients of the 8 × 8 matrix are quantized. ● The DCT coefficient values F(u,v) are divided by a value Q(u,v),

derived from a quantization table determined by the JPEG committee, and rounded to the next whole number:

Page 22: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 22

Step 3 : Quantization

Order in which the quantized values are transmitted

Page 23: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 23

Step 4 : Entropy Coding

● After quantization, there will be many zero coefficients.● Use RLE on zig-zag sequence (maximizes runs).● Use Huffman coding of other coefficients (best use of available

bits).

● The new code words created from the combination of run length and category are assigned code words of entropy coding.

● They are followed by further bits that establish the actual coefficient value within the category.

● The number of available bits is determined by the category number.

Page 24: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 24

Step 4 : Entropy Coding

Page 25: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG Decoding

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 25

The of a compressed JPEG image file is carried out in the reverse manner of compression,

● Entropy-decoding● Reverse sorting of the image data in the zigzag arrangement● Re-quantization (inverse quantization)● Inverse Discrete Cosine Transformation (IDCT)● Reversal of the downsampling for the chrominance components of

the image data● Color space conversion of the YCbCr color space in the target color

space.

Due to quantization and downsampling, information is lost in JPEG compression. For this reason, an exact reconstruction of the output data after decompression is not possible most of the time.

Page 26: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG – File Structure

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 26

Page 27: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG – File Structure

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 27

Page 28: Multimedia Data and Its Encoding - WordPress.com...Mar 16, 2019  · CSE 4295: Multimedia Communication prepared by M. Adnan Quaium 19 Via the DCT transformation, a time-discrete signal

JPEG – File Structure

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 28