session 05 data representation - wordpress.com · 10/4/2015  · data representation • methods...

Post on 15-Apr-2020

6 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Session 05

Data Representation

Data Representation

• Methods used internally to represent information stored in a computer

• Different types of information

– Numbers

– Text

– Graphics (Picture, video, animation)

– Sound

– Data

• All types of information are stored in a computer through a sequence of 0's and 1's.

• Such value is called a binary digit or bit

2

Data (0 and 1)

• Logically 0, 1

• Physically 0v , 5v

• Bit

– A bit is the smallest data on a machine 0 or 1

3

Storage

8 Bits = 1 Byte

1024 Bytes = 1 Kilobyte (KB)

1024 KB = 1 Megabyte (MB)

1024 MB = 1 Gigabyte (GB)

1024 GB = 1 Terabyte (TB)

Example:

How many bits available for the 1.45 MB data file

4

Number Systems

• Binary System { 0,1 }

• Octal System { 0,1,2,3,4,5,6,7 }

• Decimal System { 0,1,2,3,4,5,6,7,8,9 }

• Hexadecimal System

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

5

Number conversion

• Decimal to binary

• Decimal to Octal

• Decimal to Hexadecimal

• Example

13410 → 100001102, 2068, 8616

6

Binary

OctalDecima

l

Hex decimal

Decimal /Octal/

Hexadecimal

• Binary to Octal

10 101 010 111

• Binary to Hexadecimal

101 0101 0111

7/11/2015 Budditha Hettige (budditha@yahoo.com) 7

Data Representation

8

Keyword Description Size/Format

byte Byte-length integer 8-bit two's complement

short Short integer 16-bit two's complement

int Integer 32-bit two's complement

long Long integer 64-bit two's complement

float Single-precision floating point 32-bit IEEE

double Double-precision floating point 64-bit IEEE

char A single character 16-bit Unicode character

boolean A boolean value (true or false) true or false

Integer numbers

9

type Size Range

name bytes bits minimum maximum

byte 1 8 -128 +127

short 2 16 -32,768 +32,767

int 4 32 -2,147,483,648 +2,147,483,647

long 8 64 -9,223,372,036,854,775,808 +9,223,372,036,854,775,807

Character Representation

• ASCII

– American Standard Code for Information

Interchange (ASCII)

– 27 = 128 characters can be represented by ASCII

• Unicode

– Unicode: 16-bit system that can encode the

characters of most languages

– 16 bits = 216 = 65,636 characters

10

ASCII

11

Sinhala Unicode

12

Example

• What are the ASCII Value for the following Name

– Budditha

• What are the ASCII Values for the following Keys

– Enter

– Scape

– Space

• What are the ASCII Value for the following Name

– සමරපාල

7/11/2015 Budditha Hettige (budditha@yahoo.com) 13

Computer Images

Computational Model of Grammar for English to

14

What is Computer image?

• visual representation of an object or scene or person

or abstraction produced on a surface

• Types

– Vector image

– Raster image

15

Raster Images

• Raster image is used raster graphics to display

images

• data structure representing a generally rectangular

grid of pixels

16

Vector Image

• vector graphics to display images

• geometrical primitives such as points, lines, curves,

and polygons, which are all based upon

mathematical equations to represent images in

computer graphics

17

Colour representation

• RGB

• CMYK

• Lab

18

RGB colour mode

• Red, Green, and Blue light are added together in

various ways

• three additive primary colors, red, green, and blue

• the RGB color model is the display of colors on a

cathode ray tube (CRT), liquid crystal display(LCD)

or plasma display

19

CMYK Mode

• Cyan, magenta, yellow, and key (black)

• CMYK model works by partially or entirely masking

certain colors on the typically white background

• save money on ink, and to produce deeper black

tones

20

Lab color

• individual channels: "L" indicates the luminance, "a"

the green-red chrominance and "b" the blue-yellow

chrominance

• well suited for modifying the brightness of an image

without changing the colours and saturation values

• Lab color is designed to approximate human vision

21

Computer Images/ Graphics

• A computer screen consist of pixels

• Pixel has two properties: its location on the screen

and its color

• graphic image can be represented by a list of pixels

– A 16 color image requires 4 bits per pixel

– 24 bits per pixel, which provides an astounding

array of 16.7 million possible colors for each pixel

22

Raster formats

7/11/2015 Budditha Hettige (budditha@yahoo.com) 23

• Raster graphics image is a dot matrix data structure

representing a generally rectangular grid of pixels, or points of

color, viewable via a monitor, paper, or other display medium

• File Format

– JPEG (Joint Photographic Experts Group)

– TIFF (Tagged Image File Format)

– GIF (Graphics Interchange Format)

– BMP

– PNG (Portable Network Graphics)

Vector formats

• vector image formats contain a geometric

description which can be rendered smoothly at any

desired display size.

– SVG (Scalable Vector Graphics)

– PPT

– VML

– AI (Adobe Illustrator Artwork)

– CDR (CorelDRAW)

7/11/2015 Budditha Hettige (budditha@yahoo.com) 24

Compound formats

• These are formats containing both pixel and vector data, possible other data, e.g. the interactive features of PDF.

– EPS (Encapsulated PostScript)

– PDF (Portable Document Format)

– PostScript, a page description language with strong graphics capabilities

– PICT (Classic Macintosh QuickDraw file)

– SWF (Shockwave Flash)

– XAML User interface language using vector graphics for images.

7/11/2015 Budditha Hettige (budditha@yahoo.com) 25

Image Formats

7/11/2015 Budditha Hettige (budditha@yahoo.com) 26

Audio Data

7/11/2015 Budditha Hettige (budditha@yahoo.com) 27

Sound

• Analog signals are converted to digital signals at

a given sampling rate and bit resolution

28

4 Bit

Sound file format

• File format for storing digital audio data on a

computer system.

• The bit layout of the audio data (excluding

metadata) is called the audio coding format and can

be compressed or uncompressed

• Format types

– Uncompressed audio format

– Lossless compressed audio format

– Lossy compressed audio format

7/11/2015 Budditha Hettige (budditha@yahoo.com) 29

Audio file formats

• Uncompressed audio formats

– WAV, AIFF, AU or raw header-less PCM;

• Formats with lossless compression

– FLAC, WavPack, TTA, ATRAC, MPEG-4 SLS,

• Formats with lossy compression,

– Opus, MP3, Vorbis, Musepack, AAC, ATRAC and

Windows Media Audio Lossy (WMA)

7/11/2015 Budditha Hettige (budditha@yahoo.com) 30

Video Files

• file format for storing digital video data on a

computer system.

• Video is almost always stored in compressed form to

reduce the file size.

• File format

– AVI

– MP4

– WMV

7/11/2015 Budditha Hettige (budditha@yahoo.com) 31

Data file format

• Executable and link files

– EXE

– DLL

– COM

• Document files

– DOC

– DOTX

– PPT

7/11/2015 Budditha Hettige (budditha@yahoo.com) 32

top related