+ All Categories
Home > Documents > 1.3 Data Encoding · 2019. 5. 20. · Bits and binary •All computer data is represented using...

1.3 Data Encoding · 2019. 5. 20. · Bits and binary •All computer data is represented using...

Date post: 05-Feb-2021
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
145
1.3 Data Encoding Department of CSE,Coimbatore
Transcript
  • 1.3

    Data Encoding

    Department of CSE,Coimbatore

  • Objectives

    • To understand positional numeral systems.

    • To describe how integer and real numbers can be encoded.

    • To show that computers can be imprecise.

    • To depict how complex information such as text, colors, pictures,

    and sound can be encoded as bit strings.

    Department of CSE,Coimbatore

  • Introduction

    • A number system defines how a number can be represented using

    distinct symbols.

    • A number can be represented differently in different systems.

    For example, the two numbers (2A)16 and (52)8 both refer to the

    same quantity, (42)10, but their representations are different.

    Department of CSE,Coimbatore

  • Common Number Systems

    Department of CSE,Coimbatore

    System Base Symbols

    Used by

    humans?

    Used in

    computers?

    Decimal 10 0, 1, … 9 Yes No

    Binary 2 0, 1 No Yes

    Octal 8 0, 1, … 7 No No

    Hexa-

    decimal16

    0, 1, … 9,

    A, B, … FNo No

  • The decimal system (base 10)

    • The word decimal is derived from the Latin root decem (ten). In this

    system the base b = 10 and we use ten symbols.

    • The symbols in this system are often referred to as decimal digits or

    just digits.

    S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

    Department of CSE,Coimbatore

  • Integers

    • Integers are generally represented in the form as …

    Eg.

    • The place values for the integer number +24 is …

    Department of CSE,Coimbatore

  • Real Numbers

    • Real Numbers are generally represented in the form as …

    Eg.

    • The place values for the real number +24.13 is …

    Department of CSE,Coimbatore

  • S = {0, 1}

    Department of CSE

    The binary system (base 2)

    • The word binary is derived from the Latin root bini(or two by two).

    • In this system the base b = 2 and we use only two symbols.

    • The symbols in this system are often referred to as binary digits or

    bits(binary digit).

    Department of CSE,Coimbatore

  • Bits and binary

    • All computer data is represented using binary, a number system that

    uses 0s and 1s.

    • Binary digits can be grouped together into bytes.

    • Computers use binary - the digits 0 and 1 - to store data.

    • A binary digit, or bit, is the smallest unit of data in computing.

    • It is represented by a 0 or a 1.

    • Binary numbers are made up of binary digits (bits), eg the

    binary number 1001.

    9 Department of CSE

    http://www.bbc.co.uk/education/guides/zwsbwmn/revisionhttp://www.bbc.co.uk/education/guides/zwsbwmn/revision

  • Bits and binary

    • The circuits in a computer's processor are made up of billionsof transistors.

    • A transistor is a tiny switch that is activated by the electronic signalsit receives.

    • The digits 1 and 0 used in binary reflect the on and offstates of a transistor.

    • Computer programs are sets of instructions.

    • Each instruction is translated into machine code - simple binarycodes that activate the CPU.

    • Programmers write computer code and this is converted bya translator into binary instructions that the processorcan execute.

    10 Department of CSE

    http://www.bbc.co.uk/education/guides/zwsbwmn/revisionhttp://www.bbc.co.uk/education/guides/zwsbwmn/revisionhttp://www.bbc.co.uk/education/guides/zwsbwmn/revisionhttp://www.bbc.co.uk/education/guides/zwsbwmn/revisionhttp://www.bbc.co.uk/education/guides/zwsbwmn/revision

  • Byte to Terabyte

    • Bits can be grouped together to make them easier to work with. Agroup of 8 bits is called a byte.

    • Other groupings include:

    • Nibble - 4 bits (half a byte)

    • Byte - 8 bits

    • Kilobyte (KB) - 1024 bytes (or 1024 x 8 bits)

    • Megabyte (MB) - 1024 kilobytes (or 1048576 bytes)

    • Gigabyte (GB) - 1024 megabytes

    • Terabyte (TB) - 1024 gigabytes

    • Most computers can process millions of bits every second. A harddrive's storage capacity is measured in gigabytes or terabytes. RAM isoften measured in megabytes or gigabytes.

    11 Department of CSE

    http://www.bbc.co.uk/education/guides/zwsbwmn/revision/2http://www.bbc.co.uk/education/guides/zwsbwmn/revision/2http://www.bbc.co.uk/education/guides/zwsbwmn/revision/2

  • Big Data: Volume

    Byte Kilobyte Megabyte Gigabyte Terabyte Petabyte Exabyte Zettabyte Yottabyte

    KB MB GB TB PB EB ZB YB

    1000 bytes 1000 KB 1000 MB 1000 GB 1000 TB 1000 PB 1000 ZB 1000YB

    30KB

    One page

    of text

    5 MB

    One song

    5 GB

    One movie 6 million

    books

    1 TB

    55 storeys

    of DVD

    1 PB

    Data

    up to

    2003

    5 EB

    Data

    in 2011

    1.8

    ZB

    NSA

    data center

    1 YB

  • Decimal to Binary Conversion

    Department of CSE,Coimbatore

    • The number (156)10 in decimal is the same as (10011100)2 in binary.

    • Let us see how the conversion is done!

  • Decimal to Binary Conversion Cntd..

    Department of CSE,Coimbatore

    • If the decimal number to be converted is (156.6875)10 , let us see

    how the fractional part can be converted to binary!

  • Decimal to Binary Conversion Cntd..

    Department of CSE,Coimbatore

    • If the decimal number to be converted is (156.6875)10 , let us see

    how the fractional part can be converted to binary!

    • The binary of (156)10 is (10011100)2 and the binary of (0.6875)10 is

    (0.1011)2

    So the complete answer is (156.6875)10 = (10011100.1011)2

  • Binary to Decimal Conversion

    Department of CSE,Coimbatore

    • The number (11001)2 in binary is the same as 25 in decimal and is

    represented as…

    • The equivalent decimal number is N = 16 + 8 + 0 + 0 + 1 = 25.

    • The number (101.11)2 in binary is equal to the number 5.75 in

    decimal .

  • Department of CSE,Coimbatore

  • S = {0, 1}

    Department of CSEDepartment of CSE,Coimbatore

  • Can you perform the indicated conversion?

    Department of CSE,Coimbatore

    Decimal to Binary

    a) 1310 = ?

    b) 2210 = ?

    c) 4310 = ?

    d) 15810 = ?

    Binary to Decimal

    a) 0110 2 = ?

    b) 11010 2 = ?

    c) 0110101 2 = ?

    d) 11010011 2 = ?

  • Decimal → Binary ………..Answers

    a) 1310 = ?

    b) 2210 = ?

    c) 4310 = ?

    d) 15810 = ?

    1 1 0 1 2

    1 0 1 1 0 2

    1 0 1 0 1 1 2

    1 0 0 1 1 1 1 0 2

  • Binary → Decimal ……….Answers

    a) 0110 2 = ?

    b) 11010 2 = ?

    c) 0110101 2 = ?

    d) 11010011 2 = ?

    6 10

    26 10

    53 10

    211 10

  • The hexadecimal system (base 16)

    • The word hexadecimal is derived from the Greek root hex (six) and

    the Latin root decem (ten). In this system the base b = 16 and we

    use sixteen symbols to represent a number.

    • The set of symbols are:

    Note that the symbols A, B, C, D, E, F are equivalent to

    10, 11, 12, 13, 14, and 15 respectively. The symbols in

    this system are often referred to as hexadecimal digits.

    Department of CSE,Coimbatore

    S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,A, B, C, D, E, F}

  • The hexadecimal system (base 16) contd---

    • The number (2AE)16 in hexadecimal is equivalent to 686 in

    decimal is represented as…

    • The equivalent decimal number is N = 512 + 160 + 14 = 686.

    Department of CSE,Coimbatore

  • Using hexadecimal

    • Hex codes are used in many areas of computing to simplify

    binary codes.

    • It is important to note that computers do not use hexadecimal - it is

    used by humans to shorten binary to a more easily understandable

    form.

    • Hexadecimal is translated into binary for computer use. Some

    examples of where hex is used include:

    • colour references

    • assembly language programs

    • error messages

    24 Department of CSE

    http://www.bbc.co.uk/education/guides/zp73wmn/revision/2http://www.bbc.co.uk/education/guides/zp73wmn/revision/2http://www.bbc.co.uk/education/guides/zp73wmn/revision/2

  • Hex colour model

    • Hex can be used to represent colours on web pages and image-

    editing programs

    • using the format #RRGGBB (RR = reds, GG = greens, BB =

    blues).

    • The # symbol indicates that the number has been written in hex

    format.

    • eg #FF6600.

    25 Department of CSE

  • The Hex color model uses two hex digits for each colour

    Eg: #FF 66 00

    26 Department of CSE

    As one hex digit represents

    4 bits

    Two hex digits together

    make 8 bits (1 byte).

    http://www.bbc.co.uk/education/guides/zp73wmn/revision/2http://www.bbc.co.uk/education/guides/zp73wmn/revision/2

  • • The values for each colour run between 00 and FF.

    • In binary,

    • 00 is 0000 0000

    • FF is 1111 1111

    • That provides 2^8 = 256 possible values for each of the three

    colours.

    • That gives a total spectrum of 256 reds x 256 greens x 256 blues -

    which is over 16 million colours in total.

    27 Department of CSE

    http://www.bbc.co.uk/education/guides/zp73wmn/revision/2

  • • #FF0000 will be the purest red - red only, no green or blue.

    • Black is #000000 - no red, no green and no blue.

    • White is #FFFFFF.

    • An orange colour can be represented by the code #FF6600.

    • The hex code is much easier to read than the binary equivalent

    1111 1111 0110 0110 0000 0000

    28 Department of CSE

  • • The figure on the left shows the additive mixing of red, green and blue primaries to form the three secondary colors yellow (red + green), cyan (blue + green) and magenta (red + blue), and white ((red + green + blue).

    • RGB model – Computer display

    • The figure on the right shows the three subtractive primaries, and their pairwise combinations to form red, green and blue, and finally black by subtracting all three primaries from white.

    • CMYK model - Used in Printing

    Department of CSE,Coimbatore

    Colour model

  • • If you are making a web page with HTML or CSS you can use hex codes to choose the colours.

    • The RGB model ( Additive ) is used for color monitors and most video cameras.

    • Hex values have equivalents in the RGB colour model.

    • The RGB model is very similar to the hex colour model,

    you use a value between 0 and 255 for each colour.

    • So an orange colour that is #FF 66 00 in hex would be

    255, 102, 0 in RGB.

    • Cyan color is 0,255,255

    •Teal color is 0,128,128

    30 Department of CSE

    http://www.bbc.co.uk/education/guides/zp73wmn/revision/2http://www.bbc.co.uk/education/guides/zp73wmn/revision/2

  • Hex and RGB colour codes

    • Red #FF0000 (255,0,0)

    • Tomato #FF6347 (255,99,71)

    • Coral #FF7F50 (255,127,80)

    • indian red #CD5C5C (205,92,92)

    Department of CSE,Coimbatore

  • Department of CSE,Coimbatore

    Color HTML / CSS Name Hex Code#RRGGBBDecimal

    Code(R,G,B)

    Black #000000 (0,0,0)

    White #FFFFFF (255,255,255)

    Red #FF0000 (255,0,0)

    Lime #00FF00 (0,255,0)

    Blue #0000FF (0,0,255)

    Yellow #FFFF00 (255,255,0)

    Cyan / Aqua #00FFFF (0,255,255)

    Magenta / Fuchsia #FF00FF (255,0,255)

    Silver #C0C0C0 (192,192,192)

    Gray #808080 (128,128,128)

    Maroon #800000 (128,0,0)

    Olive #808000 (128,128,0)

    Green #008000 (0,128,0)

    Purple #800080 (128,0,128)

    Teal #008080 (0,128,128)

    Navy #000080 (0,0,128)

  • • Errors

    • Hex is often used in error messages on your computer.

    • The hex number refers to the memory location of the error.

    • This helps programmers to find and then fix problems.

    33 Department of CSE

    http://www.bbc.co.uk/education/guides/zp73wmn/revision/2

  • So far….

    Department of CSE,Coimbatore

    Table : summary of four positional number systems

  • Department of CSE,Coimbatore

    Table : Four positional number systems

  • Figure : Converting decimal to other bases (integral part)

    Decimal to any base

    Department of CSE,Coimbatore

  • Department of CSE,Coimbatore

    Figure : decimal to other bases (fractional part )

  • Department of CSE,Coimbatore

    Converting FROM the base 10 To base 3

    3 4 10 = __________3

    Figure : Base 3

    33 32 3 1

    3 3 4

    1 1 - 13

    3 - 23

    1 - 0

    1 0 2 1

  • Binary-octal (base 8) conversion

    Department of CSE,Coimbatore

    • The binary bits are grouped into 3 and converted….

    • Binary to octal and octal to binary conversion eg.

  • Binary-hexadecimal conversion

    Department of CSE,Coimbatore

    • The binary bits are grouped into 4 and converted…

    • Binary to hexadecimal and hexadecimal to binary conversion eg.

  • Octal (base 8)-hexadecimal conversion

    Department of CSE,Coimbatore

    • Convert into binary first and then perform the required

    conversion.

    • Octal to hexadecimal and hexadecimal to octal conversion eg.

  • Try it yourself

    Department of CSE,Coimbatore

    Convert these binary numbers into octal numbers...

    (a) 001011112 (8 bits) (b) 111101002 (8 bits)

    Convert the following octal numbers into hexadecimal (16 bits)

    (a) 658 (b) 1238Can you find out .........

    What is the biggest binary number one can write with n bits?

    How many unique patterns does a sequence of 5 bits generate?

    Write all the patterns of a sequence of 5 bits.

  • Try it yourself

    Department of CSE,Coimbatore

    Convert these binary numbers into octal numbers...

    (a) 001011112 (8 bits) (b) 111101002 (8 bits)

    Convert the following octal numbers into hexadecimal (16 bits)

    (a) 658 (b) 1238Can you find out .........

    What is the biggest binary number one can write with n bits?

    How many unique patterns does a sequence of 5 bits generate?

    Write all the patterns of a sequence of 5 bits.

  • Binary Octal ........ Answers

    Refer to the binary-octal

    conversion table

    000 101 111

    = 578

    0 5 7

    Refer to the binary-octal

    conversion table

    011 110 100

    = 3648

    3 6 4

  • Refer to the binary-octal conversion table

    68 58

    110 101

    0000 0000 0011 01012

    0 0 3 5

    = 3516

    Refer to the binary-octal conversion table

    18 28 38

    001 010 011

    0000 0000 0101 00112

    0 0 5 3

    = 5316

    Octal Hexadecimal Answers

  • Can we find out .........Answers

    What is the biggest binary number one can write with n

    bits?

    N 1’s

    How many unique patterns does a sequence of 5 bits generate?

    2^5

    Write all the patterns of a sequence of 5 bits.

    00000,00001,00010…..11111

  • Conversion from Hexadecimal to Binary

    Replace each hex digit by the 4 equivalent bits, for examples,

    • A3C5H = 1010 0011 1100 0101B

    • 102AH = 0001 0000 0010 1010B

    Department of CSE,Coimbatore

  • Conversion from Binary to Hexadecimal

    Starting from the right-most bit (least-significant bit), replace each

    group of 4 bits by the equivalent hex digit (pad the left-most bits with

    zero if necessary), for examples,

    • 1001001010B = 0010 0100 1010B = 24AH

    • 10001011001011B = 0010 0010 1100 1011B = 22CBH

    Department of CSE,Coimbatore

  • Exercises (Number Systems Conversion)

    Convert the following decimal numbers into binary and hexadecimal

    numbers:

    • 108

    • 4848

    • 9000

    Department of CSE,Coimbatore

  • Answers……………

    • 108 = 1101100 = 6C

    • 4848 = 1001011110000 = 12F0

    • 9000 = 10001100101000 = 2328

    Department of CSE,Coimbatore

  • Exercises (Number Systems Conversion)

    Convert the following binary numbers into hexadecimal and

    decimal numbers:

    • 1000011000

    • 10000000

    • 101010101010

    Department of CSE,Coimbatore

  • Answers……………

    • 1000011000 = 218H = 536D

    • 10000000 = 80H = 128D

    • 101010101010 = AAAH = 2730D

    Department of CSE,Coimbatore

  • Exercises (Number Systems Conversion)

    Convert the following hexadecimal numbers into binary and

    decimal numbers:

    • ABCDE

    • 1234

    • 80F

    Department of CSE,Coimbatore

  • Answers……………

    • ABCDE = 10101011110011011110 = 703710D

    • 1234 = 1001000110100 = 4660D

    • 80F = 100000001111 = 2063D

    Department of CSE,Coimbatore

  • Exercises (Number Systems Conversion)

    Convert the following decimal numbers into binary equivalent:

    • 19.25D

    • 123.456D

    Department of CSE,Coimbatore

  • Answers……………

    • 19.25 = 10011.01

    • 123.456 = 1111011.01110100…

    Department of CSE,Coimbatore

  • Can you identify the forms of the data in use?

    Department of CSE,Coimbatore

  • Answer…..

    The different forms of data are text, image,audio,video….

    Department of CSE,Coimbatore

    Image

    Image

    Audio Audio

    Video

    Text

  • Different Forms of Data

    Department of CSE,Coimbatore

  • All software, music, documents, and any other information that is

    processed by a computer, is also stored using binary.

    60 Department of CSE

    http://www.bbc.co.uk/education/guides/zwsbwmn/revision

  • Data in any form (text, audio, video) is represented in binary form only

    in computers.

    Department of CSE,Coimbatore

    Figure : Representation of Different forms of data

  • Amount of storage space required

    Different types of data require different amounts of storage space.

    62 Department of CSE

    Data Storage

    One extended-ASCII character in a text file

    (eg 'A')1 byte

    The word 'Monday' in a document 6 bytes

    A plain-text email 2 KB

    64 pixel x 64 pixel GIF 12 KB

    Hi-res 2000 x 2000 pixel RAW photo 11.4 MB

    Three minute MP3 audio file 3 MB

    One minute uncompressed WAV audio file 15 MB

    One hour film compressed as MPEG4 4 GB

  • Bit number patterns

    • Computer systems and files have limits that are measured in bits.

    For example, image and audio files have bit depth.

    • The bit depth reflects the number of binary numbers available,

    similar to the number of combinations available on a padlock.

    • The more wheels of numbers on a padlock, the more combinations

    of numbers are possible.

    • The greater the bit depth, the more combinations of binary numbers

    are possible.

    63 Department of CSE

    http://www.bbc.co.uk/education/guides/zwsbwmn/revision/8http://www.bbc.co.uk/education/guides/zwsbwmn/revision/8http://www.bbc.co.uk/education/guides/zwsbwmn/revision/8

  • Bit number patterns

    • Every time the bit depth increases by one, the number of binary

    combinations is doubled.

    • A 1-bit system uses combinations of numbers up to one place value

    (1).There are just two options: 0 or 1.

    • A 2-bit system uses combinations of numbers up to two place values

    (11).There are four options: 00, 01, 10 and 11.

    64 Department of CSE

  • Binary combinations

    • These tables show how many binary combinations are available for

    each bit size.

    • One bit

    65 Department of CSE

    Maximum binary number = 1

    Maximum denary number = 1

    Binary combinations = 2

  • Two bit

    • Maximum binary number = 11

    • Maximum denary number = 3

    • Binary combinations = 4

    66 Department of CSE

  • Three bit

    • Maximum binary number = 111

    • Maximum denary number = 7

    • Binary combinations = 8

    67 Department of CSE

  • Bit depth Max (binary) Max (denary)Combinations

    available

    1 1 1 2

    2 11 3 4

    3 111 7 8

    4 1111 15 16

    5 11111 31 32

    68 Department of CSE

    A 1-bit image can have 2 colours,

    a 4-bit image can have 16 colours,

    an 8-bit image can have 256 colours,

    and a 16-bit image can have 65,536 colours.

  • Encoding and Decoding

    • Encoding is the process of putting a sequence of characters (letters,

    numbers, punctuation, and certain symbols) into a specialized digital

    format for efficient transmission or transfer.

    • Decoding is the opposite process -- the conversion of a digital signal

    into a sequence of characters.

    • Encoding and decoding are used in data communications,

    networking, and storage.

    Department of CSE,Coimbatore

  • • Everything on a computer is represented as streams of binary

    numbers.

    • Audio, images and characters all look like binary numbers

    in machine code.

    • These numbers are encoded in different data formats to give them

    meaning,

    eg the 8-bit pattern 01000001 could be

    the number 65,

    the character 'A', or

    a colour in an image.

    70 Department of CSE

  • Encoding formats• Encoding formats have been standardised to help compatibility across

    different platforms.

    • audio is encoded as audio file formats, eg mp3,WAV, AAC

    • video is encoded as video file formats, eg MPEG4, H264

    • text is encoded in character sets, eg ASCII, Unicode

    • images are encoded as file formats, eg BMP, JPEG, PNG

    • The more bits used in a pattern, the more combinations of valuesbecome available.

    • This larger number of combinations can be used to represent manymore things, eg a greater number of different symbols, or morecolours in a picture.

    71 Department of CSE

  • Character sets

    • Every word is made up of symbols or characters.

    • When you press a key on a keyboard, a number is generated that represents the symbol for that key.

    • This is called a character code.

    • A complete collection of characters is a character set.

    72 Department of CSE

    Numbers are generated

    that represent keyboard

    symbols

  • Representing Character

    Department of CSE,Coimbatore

  • 74 Department of CSE

    A standard

    QWERTY

    keyboard

    A keyboard with

    Japanese characters

  • • Different languages use different keyboard layouts.

    • For example, a French keyboard has an é.

    • If we were writing in Japanese or Arabic, we would need even more

    choices of characters.

    • In theory, anyone can create a character set.

    • But it is important that computers can communicate so we use

    global standards for character sets.

    75 Department of CSE

  • • You can check what character encoding your web browser is

    using by looking in your browser settings:

    • Mozilla Firefox >Tools > Page Info: Encoding

    • Microsoft Internet Explorer >View > Encoding

    • Google Chrome >Tools > Encoding

    76 Department of CSE

    http://www.bbc.co.uk/education/guides/zp73wmn/revision/4

  • Text Encoding

    • Characters are usually encoded as integer values using the

    encoding schemes.

    • The associations between numbers and text are known

    collectively as a character encoding scheme.

    Department of CSE,Coimbatore

  • ASCII - American Standard Code for Information Interchange

    • Focus on unaccented, English letters.

    • Every letter, number, capital, etc

    • Represented by codes 0-127.

    • Space, 32; “A”, 65; “a”, 97.

    • Only the 7-bit patterns were standardized under ASCII.

    • Standard 8-bit ASCII codes

    • start with a zero-valued bit (followed by 7-bit ASCII code).

    Department of CSE,Coimbatore

  • • “Extended ASCII” codes start with a one-valued bit;

    • these codes are not standard and vary in meaning among different

    manufactures and equipment.

    • First 32 patterns (when written in hexadecimal, any patterns starting with

    0 or 1): control codes;

    • the most common of these are 0Ah (Line Feed) and 0Dh (Carriage

    Return).

    Department of CSE,Coimbatore

  • Table : ASCII Chart

    Department of CSE,Coimbatore

  • EBCDIC (Extended Binary Coded Decimal

    Interchange Code)

    • Developed by IBM.

    • Restricted mainly to IBM or IBM compatible mainframes.

    • Conversion software to/from ASCII available.

    • Common in archival data.

    • Character codes differ from ASCII.

    Department of CSE,Coimbatore

    ASCII EBCDIC

    Space 2016 4016

    A 4116 C116

    b 6216 8216

  • • Unicode uses between 8 and 32 bits per character

    • so it can represent characters from languages from all around the world.

    • It is commonly used across the internet.

    • As it is larger than ASCII, it might take up more storage space when saving documents.

    • Global companies, like Facebook and Google, would not use the ASCII character set because their users communicate in many different languages.

    Department of CSE,Coimbatore

    Unicode

    http://www.bbc.co.uk/education/guides/zp73wmn/revision/5

  • • Multilingual: defines codes for

    • Nearly every character-basedalphabet.

    • Large set of ideographs forChinese, Japanese andKorean.

    • Composite characters forvowels and syllabic clustersrequired by some languages.

    • Allows software modifications forlocal-languages.

    Department of CSE,Coimbatore

  • ASCII only contains 127 characters

    though an extended version exists with 257 characters

    This is by far not enough as it is too restrictive to the English language.

    UNICODE was developed to alleviate this problem:

    the latest version, UNICODE 5.1.0 contains more than 100,000

    characters, covering most existing languages.

    For more information, see:

    http://www.unicode.org/versions/Unicode5.1.0/

    http://www.unicode.org/versions/Unicode5.1.0/

  • Department of CSE,Coimbatore

  • How Did Photography Go Digital?

    Department of CSE,Coimbatore

  • Department of CSE,Coimbatore

  • PIXELS

    Department of CSE,Coimbatore

  • Pixels

    Department of CSE,Coimbatore

  • Image Encoding

    Department of CSE,Coimbatore

    • Binary representation of bitmap images

    • All bitmap images are stored as array of pixels.

    • A monochrome images store

    • 1 for black pixel and

    • 0 for a white pixel

    • (or vice versa depending on the encoding protocol)

    • It could also be necessary to store the dimensions of the image.

  • Department of CSE,Coimbatore

  • Department of CSE,Coimbatore

    • This image could be represented as following 35 binary digits (5 bytes):

    • 00100 01010 01010 10001 11111 10001 00000

  • Department of CSE,Coimbatore

    Show how to encode

  • Answer

  • Color Images

    Department of CSE,Coimbatore

  • Representing Color

    Department of CSE,Coimbatore

    • Each pixel of the rose flower

    is to be defined using 24

    bits(8 bits/ color RGB)

    • The first 8 bits specifying the

    shade of red,

    • The next 8 bits specifying the

    shade of green and

    • The last 8 bits specifying the

    shade of blue.

  • Department of CSE,Coimbatore

  • Color Images

    Department of CSE,Coimbatore

  • Black and White Image

    Department of CSE,Coimbatore

  • Black and White

    Department of CSE,Coimbatore

  • Improve Efficiency

    Department of CSE,Coimbatore

  • Color Images

    Department of CSE,Coimbatore

  • Color Images

    Department of CSE,Coimbatore

  • Color Images

    Department of CSE,Coimbatore

  • Color Images

    Department of CSE,Coimbatore

  • Color Images

    Department of CSE,Coimbatore

  • Color Images

    Department of CSE,Coimbatore

  • Image - 1

    Department of CSE,Coimbatore

  • Department of CSE,Coimbatore

    1 1 1 1 1 1 1 1 1

    1 1 1 0 1 0 1 1 1

    1 1 1 1 0 1 1 1 1

    1 1 1 0 1 0 1 1 1

    1 1 1 1 0 1 1 1 1

    1 1 1 1 0 1 1 1 1

    1 1 0 0 0 0 0 1 1

    1 1 1 0 0 0 1 1 1

    1 1 1 0 0 0 1 1 1

  • Image - 2

    Department of CSE,Coimbatore

  • Department of CSE,Coimbatore

    1 1 1 1 1 1 1 1 1

    1 1 1 1 1 1 1 1 1

    1 1 0 0 1 0 0 1 1

    1 1 0 0 1 0 0 1 1

    1 1 1 1 1 1 1 1 1

    1 0 0 1 1 1 0 0 1

    1 1 0 1 1 1 0 1 1

    1 1 1 0 0 0 1 1 1

    1 1 1 1 1 1 1 1 1

  • Image - 3

    Department of CSE,Coimbatore

  • Department of CSE,Coimbatore

    1 1 1 1 1 1 1 1 1

    1 1 0 1 1 1 0 1 1

    1 0 0 0 1 0 0 0 1

    1 0 0 0 0 0 0 0 1

    1 0 0 0 0 0 0 0 1

    1 1 0 0 0 0 0 1 1

    1 1 1 0 0 0 1 1 1

    1 1 1 1 0 1 1 1 1

    1 1 1 1 1 1 1 1 1

  • Image - 4

    Department of CSE,Coimbatore

  • Department of CSE,Coimbatore

    1 1 1 1 0 1 1 1 1

    1 1 1 0 0 0 1 1 1

    1 1 0 0 0 0 0 1 1

    1 0 0 0 0 0 0 0 1

    1 1 0 0 0 0 0 1 1

    1 1 0 0 0 0 0 1 1

    1 1 0 0 1 0 0 1 1

    1 1 0 0 1 0 0 1 1

    1 1 0 0 1 0 0 1 1

  • Representing Sound

    Department of CSE,Coimbatore

  • Sound is produced by the vibration of a media like air or water.

    Audio refers to the sound within the range of human hearing.

    Naturally, a sound signal is analog, i.e. continuous in both time

    and amplitude.

    To store and process sound information in a computer or to

    transmit it through a computer network, we must first convert the

    analog signal to digital form using an analog-to-digital converter (

    ADC )

    The conversion involves two steps:

    (1) sampling, and (2) quantization.

    Sound Encoding

  • Sampling

    Sampling is the process of examining the value of a continuous

    function at regular intervals.

    Sampling usually occurs at uniform intervals, which are referred

    to as sampling intervals.

  • Sound can also be stored in a computer as binary codes

    To represent the varying values of a soundwave, it’s height must be

    measured at regular intervals and the measurements given binary codes.

    This process is called Sampling and the number of samples taken in a

    second is called the sampling rate

    The sampled measurements make up the digital sound file

    Sampling rate

    Analogue signal

    Time

    Am

    pli

    tud

    e

  • Quantization

    Quantization is the process of limiting the value of a sample of a

    continuous function to one of a predetermined number

    of allowed values, which can then be represented by a

    finite number of bits.

  • Quantization

    The number of bits used to store each intensity defines the

    accuracy of the digital sound:

    Adding one bit makes the sample twice as accurate

  • How much space do we need to store one minute of music?

    - 60 seconds

    - 44,100 samples

    -16 bits (2 bytes) per sample

    - 2 channels (stereo)

    S = 60x44100x2x2 = 10,534,000 bytes ≈ 10 MB !!

    1 hour of music would be more than 600 MB !

  • Sound Encoding

    Department of CSE,Coimbatore

  • Department of CSE,Coimbatore

    • Sound Data As Bytes: Sound occurs

    naturally as an analog wave.

    • The data is represented as a pair of

    decimal number.

    • The first part representing the time

    and the second part representing

    the voltage value {0000 — low and

    1111-high}

  • • A microphone translates the change in air pressure and converts it to

    a wave form.

    • A converter within the sound card of the computer takes readings

    each second.

    • These readings are positions (voltages, actually) on the wave in

    relation to the zero line.

    • They are recorded and converted from decimal to binary numbers.

    • The process of measuring and recording the voltage of the

    signal is called sampling.

    Department of CSE,Coimbatore

  • • Using 2 bit sampling to represent the audio signal ...

    Department of CSE,Coimbatore

    11100100

    t1 t2 t3 t4 t10

  • • Using 2 bit sampling to represent the audio signal ...

    • At t1 : 01

    Department of CSE,Coimbatore

    11100100

    t1 t2 t3 t4 t10

  • • Using 2 bit sampling to represent the audio signal ...

    • AT t2 it is : 00

    • We have 01 00

    Department of CSE,Coimbatore

    11100100

    t1 t2 t3 t4 t10

  • • Using 2 bit sampling to represent the audio signal ...

    • At t3 it is: 01

    • We have 01 00 01

    Department of CSE,Coimbatore

    11100100

    t1 t2 t3 t4 t10

  • • Using 2 bit sampling to represent the audio signal ...

    • The complete wave is represented by specifying the region to which it

    belongs i.e at time 1 it is in region 01, at time 2 it is in 00… and so on .

    • Here we are not representing time as we are sampling continuously at

    time = 1, 2, 3…

    Department of CSE,Coimbatore

    11100100

  • 01 00 01 01 11

    01 10 01 11 01

    The complete representation of the

    signal is….

  • Inside the computer, however, all data is stored as

    numbers:

    • Numbers – are stored as numbers, obviously!

    • Text characters are stored as a code that represents each – e.g.

    ASCII.

    • Images are stored as numbers representing the amounts of red,

    green and blue for each pixel.

    • Sounds are stored as numbers representing the loudness at given

    intervals.

    Department of CSE,Coimbatore

  • Data Compression

    • To reduce the volume of data to be transmitted (text, fax,

    images).

    • To reduce the bandwidth required for transmission and to

    reduce storage requirements (speech, audio, video).

    Department of CSE,Coimbatore

  • Classification

    • Lossless compression

    • Lossless compression for legal and medical documents, computer

    programs.

    • Lossy compression

    • Digital audio, image, video where some errors or loss can be

    tolerated.

    Department of CSE,Coimbatore

  • Video and Audio Compression

    • Video and Audio files are very large. Unless we develop and

    maintain very high bandwidth networks (Gigabytes per second or

    more) we have to compress the data.

    • Relying on higher bandwidths is not a good option.

    • Compression becomes part of the representation or coding scheme

    which have become popular audio, image and video formats.

    Department of CSE,Coimbatore

  • Run-length Encoding

    • This encoding method is frequently applied to images (or pixels

    in a scan line).

    • It is a small compression component used in JPEG

    compression.

    • In this instance, sequences of image elements X1, X2, …, Xn

    are mapped to pairs (c1, l1), (c1, l2), …, (cn, ln)

    where ci represent image intensity or colour and

    li the length of the ith run of pixelsDepartment of CSE,Coimbatore

  • Run-length Encoding

    Department of CSE,Coimbatore Figure: An encoded figure

  • Run Length Code

    Department of CSE,Coimbatore

  • Department of CSE,Coimbatore

  • Run Length encoding – 8 X 8

    Department of CSE,Coimbatore

  • Department of CSE,Coimbatore

  • • A Sequence:

    111122233333311112222

    Can be encoded as:

    (1,4),(2,3),(3,6),(1,4),(2,4)

    • In the first row we have 3 white pixels followed by 3 black pixels, 5

    white pixels, 4 black pixels and 3 white pixels hence it is encoded as

    (3,3,5,4,3).

    The image is represented as {(3,3,5,4,3), (1,6,3,7,1) …….}

    Start with white pixel always…

    Department of CSE,Coimbatore

  • How would AAAAAAA be encoded?

    *n5*x9ccc*h6 some other text *k8eee is decoded as what?

    Department of CSE,Coimbatore

  • Answers……………

    AAAAAAA is encoded as *A7

    *n5*x9ccc*h6 some other text *k8eee is decoded as …

    nnnnnxxxxxxxxxccchhhhhh some other text

    kkkkkkkkeee

  • What has been described?

    • Number systems and conversion between different bases.

    • The data encoding schemes for text, color, image and sound.

    • Compression technique and how data can be compressed using

    RLE method.

    Credits

    Foundations of Computer Science --- Behrouz Forouzan, Firouz Mosharral

    www.bbc.co.uk › Home › KS3 › Computing › Data representation

    Google imagesDepartment of CSE,Coimbatore


Recommended