Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Representation.

Similar presentations


Presentation on theme: "Data Representation."— Presentation transcript:

1 Data Representation

2 The binary system Processing and storage devices have two states –on or off 1 = “on” and 0 = “off” Binary number = 1 or 0 Inside the computer:- 0 volts represents 0 1-5 volts represents 1

3 Advantages and Disadvantages of binary
Simple rules for arithmetic Slight drop in voltage still works as any voltage greater than 0 counts as a 1 Storage devices can represent 2 states e.g. CD-ROM Lots of digits needed to represent numbers

4 Bits Bit = Binary digit Column headings for binary are:-
= 43

5 Bytes 8 bits = 1 byte Largest number shown by 1 byte?
= 255 Smallest number is = 0 How many different numbers? 256 (which is 28)

6 More bytes 1 Kilobyte = 1024 bytes 1 Megabyte = 1024 Kb
1 Gigabyte = 1024 Mb 1 Terabyte = 1024 Gb Typical main memory = 2Gb Typical hard disk = 320 Gb

7 Converting between units
Bits to bytes ? ÷ 8 Bytes to bits ? x 8 Bytes to Kb ? ÷ 1024 Kb to bytes ? x 1024

8 Place values (column headings)
Leftmost bit = most significant bit Rightmost bit = least significant bit

9 See the table on Pages 4 & 5 28 = 256 210 = 1024 220 = 1 Mb
28 = 256 210 = 1024 220 = 1 Mb 224 = no of colours in “true” colour 230 = 1 Gb 240 = 1 Tb

10 Calculating the largest integer & range
No of bits Max Number in binary Max number in decimal Easy calculation Range 3 111 7 23 - 1 0 to 7 8 numbers 32 4,294,967,295 0 to 4,294,967,295 4,294,967,296 numbers

11 Changing between binary & decimal
Write down place values Binary to decimal:- where there is a 1 add the place value Decimal to binary:-:- Write a 1 in each place that you want and add them up to make your number

12 Example Convert 00110101 to decimal 128 64 32 16 8 4 2 1
In decimal = 53 Convert 67 to binary In binary =

13 For you to do Page 20 Questions 1 and 2 1.a) 1011 b.) 1001 1111
c.) d.)

14 Answers Q1 a) 1011 = 11 b) = 159 c) = 170 d) = 254 Q2 a) 122 = b) 193 = c) 256 = d) 1023 =

15 Representing integers
Size of positive integers depends on the number of bytes available in memory to store it E.g. using 16 bits to 0 to 65,535 (65,536 different numbers) Negative integers – Signed bit notation Two’s complement

16 Signed bit notation Use leftmost bit to indicate sign + or –
E.g. using 16 bits only 15 bits are left for the number is –(215-1) is to 32767 Rule:- –(2n-1-1) to 2n-1-1

17 Disadvantage of signed bit notation
2 zero’s - aaaargh! e.g is –ve zero is +ve zero It’s just mathematically WRONG!

18 Two’s complement Represents +ve and -ve integers and doesn’t have 2 zeros Write -7 :- +7 using 8 bits Change 1’s and 0’s Add

19 Advantages of two’s complement
1 zero Arithmetic is correct Leftmost bit indicates the sign (0 is +ve and 1 is –ve) Same procedure to read a –ve number i.e. change the 1’sand 0’s then add 1

20 For you to do – small class
Page 20 Question 3

21 Representing real numbers
Decimal Fractions:- 1/10 1/100 1/ /10,000 1/100,000 …. …. Binary Fractions:- ½ ¼ / / / / /128 Questions only have combinations of these fractions – don’t panic, Megan!

22 For you to do Page 20 Question 4

23 Floating point representation
From Maths we know that:- = x 102 M x Base e Mantissa x Base Exponent In binary :- = = x 2 101 5 in decimal is 101 in binary

24 Floating point representation
Store the mantissa & exponent only:- x 2 101 Mantissa = Exponent = 101

25 For you to do Page 20 Question 5,6

26 Text - ASCII American Standard Code for Information Interchange
Character set = all the characters which a computer can store & process 8 bits available in ASCII Using 7 bits allows 27 characters 28 (extended ASCII) allows 256 characters

27 Text - Unicode Universal Character Set
Represents characters from writing schemes of all major languages 16 bits available 216 allows 65,536 characters

28 For you to do Page 20 Question 11, 12, 13, 14
11. a) What is a character? B)What is a character set C)What is a control character? 12. a) What does ASCII stand for? B) How many characters can extended ASCII represent? 13) a)What is Unicode? B) State one advantage of Unicode over ASCII? C) State one disadvantage of Unicode over Ascii and explain.

29 Graphics resolution Monitors – no. of pixels across x no. of pixels down SVGA uses 800 x 600 XGA uses 1024 x 768 Which resolution is lower? Which requires more storage space? Digital cameras – total no. of pixels E.g. 7 Megapixels

30 Bit mapped graphics – Paint packages
Number of bits = bits across x bits down = 8 x 8 = 64 Changes the colour of pixels Stores information about the colour of every pixel

31 Vector graphics – Draw packages
Draw objects on the screen Descriptions of objects stored as a file – called object attributes See p13

32 Differences between bit mapped and vector graphics - 1
When overlapping shapes are separated they behave differently

33 Differences between bit mapped and vector graphics - 2
Bit mapped files are larger – as the colour of every pixel is stored instead of descriptions of shapes

34 Differences between bit mapped and vector graphics - 3
Bit mapped graphic’s resolution is fixed when it is created – a printer with a higher resolution will not improve the image Vector graphics can be printed at a higher resolution by a great printer – called resolution independence

35 Page description languages
Some printers have a processor and high level language interpreter to understand the page set up and objects E.g. moveto lineto lineto closepath fill showpage

36 Differences between bit mapped and vector graphics - 4
Bit mapped graphics allow you to zoom in and change individual pixels Vector graphics can be enlarged to look at but changes involve editing the object attributes

37 15,16, 18, 19, 20 15) Why are bit-mapped graphics so called?
16) How are vector graphics stored? 18) a) a) With respect to graphics, what is: A) resolution B) resolution independence C) What type of graphics use resolution independence? 19) Which of the following are true of a) bit-mapped b) vector graphics Pixels can be edited Resolution independence Overlapping parts can be separated cleanly File size is fixed regardless of complexity of image

38 Bit depth Number of bits used to represent colours or shades of grey is known as the bit depth or colour depth.

39 Storage requirements (bit mapped)
Storage req’s = no of pixels x bit depth Example 1 – Graphic is 1 inch by 2 inches Resolution is 90 dpi 256 colours Pixels = 1 x 90 x 2 x 90 = 16200 Bit depth (no of bits for 256 colours) = 8 (28=256) Storage req’s = x 8 = bits = bytes = Kb

40 storage requirements – example 2
A 4 page (10 inches x 8 inches) Scanned at 300 dpi 65,536 colours Pixels = 10 x 300 x 8 x 300 = Bit depth = 16 (216= 65,536) Storage req’s = x 16 = bits = bytes = Mb Kb

41 True colour Bit depth = 24 i.e. 24 bits are used for each pixel to represent a range of 16,777,216 different colours More colours in real life (analogue) Real colours chopped into separate values (sampling) Eyes can’t distinguish between 200 shades between black and white 8 bits per pixels are used (256 available)

42 True colour - continued
Colours are made by combining Red, Green and Blue True colour uses 256 shades of red, 256 shades of green and 256 shades of blue

43 RGB Model Red, green and blue - additive colours as they combine to create white Mixing them creates most of the visible spectrum Additive colours - used for lighting, video and monitors

44 True colour = 24 bit RGB colour
Each colour has 256 possibilities Range from 0 to 255 See how pink is created

45 17 A) What is true colour B) How many bits are used to represent true colour 25) Which colours are represented by: (0,255,0) (0,0,255) (0,0,0) (255,255,255)

46 Lossless data compression
None of the original data is lost 1 method:- Count the repeating pixels More storage space saved when there are lots of pixels of the same colour beside each other

47 Lossy data compression
Sacrifices some of the data to reduce the file size Uses:- complex mathematical encoding Losses info that we ignore Saves more space than lossless compression Not suitable for all file types e.g. program files

48 JPEG (Joint photographic experts group)
File type - compresses bit mapped files Uses lossy compression Some data is lost – detail may be lost Images may acquire artefacts Slow to compress large files Repeatedly compressing and uncompressing may reduce quality Common on flash cards in cameras See page 19

49 25, 27, 28, 30, 32


Download ppt "Data Representation."

Similar presentations


Ads by Google