Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known...

22
Mulmedia Data and Its Encoding Lecture 15 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

Transcript of Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known...

Page 1: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Multimedia Data and Its Encoding

Lecture 15

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 · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Graphics – Data Formats and Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 2

Graphics represented and processed in a computer are traditionally prepared in the form of vector graphics or

bitmap graphics (also referred to as raster graphics).

● With vector graphics, lines, polygons or curves are defined by the specification of key points.

● A program reconstructs the geometric figure to be displayed from these key points.

● Bitmap graphics consist of a set of numeric values, color and brightness information of individual pixels or whole picture elements.

● Encoding such an image means that it has to be put into the form of a grid and spatially discretized (screened), with each pixel assigned a color or brightness value.

An advantage of vector graphics is that the image to be represented may be scaled as desired without any quality-

reduction effects.

Page 3: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Graphics – Data Formats and Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 3

In the efficient storage of graphic data, the following properties must be taken into account when characterizing a graph:

● Picture Resolution : The picture resolution is determined by the number of pixels along the x axis and the y axis.

● Color Depth : The color depth determines the number of colors a pixel has. It is given as logarithm log(c) of the actual number of possible colors c (e.g., color depth 8 corresponds to 28 = 256 colors).

● Palette Size : Some graphics systems limit the number of available bits for specifying colors. From the outset, there is a fixed color palette with a reduced number of colors from which the image can be made. The palette colors are selected in such a way that they come as close as possible to the original colors of the image to be coded.

● Picture Resolution (Density) : The picture resolution is given as the density of the individual pixels per length unit. The common unit of measure is dpi (dots per inch).

● Aspect Ratio : The aspect ratio of an image describes the relation of the image length to the image width.

Page 4: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Color and Color Model

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 4

The color systems developed all have the goal of arranging colors in a way that they can be described by a geometric

arrangement or provide a guidelines for the mixing of new colors.

In an additive color model, colors are mixed with the base color black to create new colors. The more colors are added, the more the color mixture tends toward white. Each of the colors are self-illuminating in an additive color model.

A subtractive color model works in the opposite way. Fundamentally speaking, individual colors are subtracted from the base color white to create new colors. The more colors are removed, the more the color mixture tends toward black.

Page 5: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Color and Color Model

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 5

In a color model, according to the degree of the mixing of the primary colors involved colors may be subdivided into

● primary colors● secondary colors● tertiary colors

● The basic colors of the color model are the primary colors. ● If two primary colors are mixed together in equal parts the results is a

secondary color. ● If a primary color and a secondary color are mixed together, the result

is a tertiary color.

The most common color models are ● the RGB color model● the CMY(K) color model● the HUV color model ● the YUV color model

Page 6: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Color Standard Table

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 6

● Each given color could be described unambiguously with the three determined numerical values.

● Through suitable transformation and scaling these three coordinates could be mapped in a two-dimensional coordinate system. Because of the fundamental condition x + y + z = 1 the z-share ( z = 1 − x − y ) can be determined easily.

● Within this coordinate system all of the colors perceived by those with normal vision lie within a horseshoe-formation whose upper border is delineated by a pure Spectral Color.

Page 7: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

RGB (Red-Green-Blue)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 7

It is an additive color mixing system in which respectively

changing shares of the primary colors red (R, λ = 700 nm), green (G, λ = 546,1 nm) or blue (B, λ =

435,8 nm) are additively mixed to the initial black to generate new

colors.

The graphics data formats use for representing a pixel in the RGB color system a color triplet of the numerical values (r,g,b).

● For example, the triplet (0,0,0) represents the color black and (255,255,255) the color white.

Page 8: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

CMY (Cyan-Magenta-Yellow)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 8

CMY is a subtractive color model that is used by printers and in

photography and is based on a white surface.

● Thus, in a 24-bit true color system, the CMY triplet (255,255,255) represents the color black and (0,0,0) the color white.

● Since, practically speaking, no perfect black can be achieved through mixing the three primary colors, the extended CMYK has prevailed. K stands for the key color , black.

Page 9: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

HSV (Hue-Saturation-Value)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 9

● Hue determines the color tone in the literal sense, such as red, orange, blue, etc. The specification of the hue appears as a color angle on the color wheel (e.g., 0◦ = red, 120◦ = green, 240◦ = blue).

● Saturation specifies the amount of the white in the selected hue.

● If, for example, red is chosen and a saturation of 50%, the resulting color is pink.

● Value indicates the degree of self-luminosity of a hue, i.e., how much light the hue emits.

● A hue with a high self-luminosity appears light, while a hue with low self-luminosity appears dark.

Page 10: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

YUV (Y-signal, U-signal, V-signal)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 10

The YUV color model belongs to a family of color models distinguished from other models in its separation of image brightness from color difference.

The brightness (luminance) (Y components) were therefore, separated from the color components (chrominance) (U and V

components).

With a simple transformation the RGB components of a color image can be easily converted into its corresponding YUV counterpart.

Page 11: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Run Length Encoding for Graphics Data

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 11

Run length encoding for graphic files are as a rule lossless.

The 2-dimensional image is disassembled into a 1-dimensional data stream consisting of the color information contained in the individual pixels.

This process can be carried out ● line by line from top left to bottom right (X-axis encoding), ● column by column in the same order (Y-axis encoding) or● even diagonally in an alternating direction (zig-zag encoding).

Page 12: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Run Length Encoding for Graphics Data

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 12

● The color values of the individual pixels are indicated by several numerical values.

● These numerical values can take the form of a binary number and thus be presented in a continuous form as a single, long bit string.

● The connected groups of zeros and ones can be summarized as discussed previously.

● The longer the connected groups, the higher the degree of compression.

This type of encoding is known as bit-level run length encoding.In contrast, byte-level run length encoding considers the identical byte values of image information to encode.

On a higher level of abstraction the pixel-level run length encoding begins● It is implemented if two or more bytes are used to store the color values of a

pixel. ● If a complete line in an image file repeats, it is then sufficient to mark this

repetition by using a special, reserved codeword. ● A considerable amount of space can be saved this way.

Page 13: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

LZW Method

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 13

One of the most used compression methods for graphics data is the so-called LZW method, named after its three creators Abraham Lempel, Jakob Zif and Terry Welch.

LZW is a dictionary-based compression algorithm, which is based on encoding a dictionary (Data Dictionary, Translation Table) from the

character string (8-bit binary words) of an uncompressed data stream.

● Read characters from the input stream and accumulate them to a string S, as long as S is found as a dictionary entry.

● As soon as a character x is read, for which the string Sx no longer belongs to the dictionary table, proceed with the following steps:

● Add the string Sx to the dictionary table,● build a new string beginning with the character x.

● Repeat these steps until the end of the input stream has been reached.

Page 14: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

LZW Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 14

The LZW procedure is implemented in the compression of graphics data in the formats GIF and TIFF.

The following test string is to be compressed with the help of the LZW algorithm:

ABRAKADABRAABRAKADABRA

The algorithm starts with a dictionary in which the first 256 entries consist of the respectively 1 byte long individual characters (00

16 – FF

16 ).

Page 15: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

LZW Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 15

After compression, we obtain the following code (column output read from top to bottom):

ABRAKAD<256><258><263><259><261><265>

Page 16: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

LZW Compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 16

The original string is:

ABRAKADABRAABRAKADABRA

After compression, (column output read from top to bottom):

ABRAKAD<256><258><263><259><261><265>

● The original character string needs 176 bits (22 characters of each 8 bits long)

● The LZW compressed character string needs 156 bits (13 characters of each 12 bits long)

Page 17: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

LZW Decompression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 17

The compressed codeword:ABRAKAD<256><258><263><259><261><265>

The column output read from top to bottom gives the input string:ABRAKADABRAABRAKADABRA

Page 18: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Standard graphics file formats with compression

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 18

Page 19: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Graphic Interchange Format (GIF)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 19

Two types of GIF data formats:

GIF87a and GIF89a

● Every GIF file begins with a Header and a Logical Screen Descriptor, containing information about the images stored in the GIF files.

● After this normally comes a global color palette output● Then the stored images in the GIF file, each of which can be re-

initiated by a local color palette. ● The GIF file ends with a special terminating character.

Page 20: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Graphic Interchange Format (GIF)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 20

Page 21: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Graphic Interchange Format (GIF)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 21

Page 22: Multimedia Data and Its Encoding - WordPress.com · 3/15/2019  · This type of encoding is known as bit-level run length encoding. In contrast, byte-level run length encoding considers

Graphic Interchange Format (GIF)

prepared by M. Adnan QuaiumCSE 4295 : Multimedia Communication 22

A major disadvantage of the GIF format is the reduction of the color space to only 256 colors.

To still be able to create an impression of realism with a limited color palette, the so-called dithering procedure may be used in image coding.

This technique exploits the interaction of different, adjacent color pixels, whereby the absent colors appear present to the human system of perception.