Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Representation The method of data representation in a computer system depends upon the type of data which is being used. Three types of data are considered.

Similar presentations


Presentation on theme: "Data Representation The method of data representation in a computer system depends upon the type of data which is being used. Three types of data are considered."— Presentation transcript:

1 Data Representation The method of data representation in a computer system depends upon the type of data which is being used. Three types of data are considered at this stage: 1. Numbers 2. Text 3. Graphics

2 The Binary System Regardless of the type of data, all data is ultimately stored as binary numbers. Two-state machine A computer is known as a two state machine because the processing and storage have two states only. “On” or “Off” On – 1 Off – 0

3 Why Binary? The computer is a two-state (binary) machine. All components inside a computer and all backing storage devices have only two states. e.g. a switch is “on” or “off” a transistor conducts or does not conduct a signal is a pulse of electricity or no pulse an area of magnetic disk is positive or negative a laser can direct in two different directions

4 Advantages of Binary 1.Less arithmetic rules need to be built into the computer, making calculations simpler. e.g. only four rules: 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 carry 1 2. Less chance of signal degradation as each line carries a voltage or no voltage. 3. Two states are easy to represent in storage devices. e.g. the presence or absence of a pit oon the surface of a CD-ROM.

5 Units used in binary Remember the units used in the binary system. 1 byte = 1 Kilobyte = 1 Terabyte = 1 Gigabyte = 1 Megabyte = 2048 Kilobytes = ? A. 1024 Megabytes B. 1 Gigabyte C. 2 Megabytes D. 4096 bytes 8 bits 1024 bytes 1024 Kilobytes 1024 Megabytes 1024 Gigabytes ☺ 3 Gigabytes = ? A. 24 Terabytes B. 3072 Megabytes C. 24 Kilobytes D. 3072 Terabytes ☺

6 Converting between units Recap Questions 1.Gary uses a 2Gb memory stick to store is music. How many 4.5Mb Mp3 files can Gary store on his stick? 2 Gb = 2048/4.5 = 455 mp3’s 2. Calculate the file size of this black and white image. 700 * 1200 = 840000/8 = 105000 bytes = 102.5 Kb 1200 pixels 700 pixels

7 Representing Numbers Numbers are classified as real numbers or integers. Real Numbers (single) All numbers including whole and fractional. e.g. 3.575 Integer Numbers Whole numbers that can be positive or negative. e.g. -18, -98

8 Representing Numbers (Positive Integers) When numbers are represented electronically, the base number is 2. Convert binary numbers to decimal numbers 1286432168421 Convert the following 8 bit binary numbers: 1. 11001011 2. 01110010 3. 00000011 4. 11001101 27262524232221202726252423222120

9 Convert decimal to binary 1286432168421 Demo on board

10 Examples 1. 79 2. 35 3. 99 4. 103 Answers 1.01001111 2.00100011 3.01100011 4.01100111

11 Representing Numbers (Negative Integers) There are two method used to store negative numbers in a computer system. Sign Bit & Two’s Complement

12 Two’s Compliment This is when the negative of a number is obtained. Steps 1.Find the positive binary number 2.Change the 1’s to 0 and the 0’s to 1 3.Add 1 Example -35 1.Positive 35 = 00100011 2.Change the numbers = 11011100 3.Add 1 = 1101100 1 -35 = 11011101

13 Floating Point Representation Positive numbers – Positive Numbers can be converted directly to their equivalent binary number. Negative numbers - Two’s Complement Real Numbers (decimal point) and very large numbers - Floating Point Representation

14 Floating Point Representation is when two parts are used to store a number. M * base M - Mantissa (actual number) E - Exponent (power to which the base is raised)

15 Range The range of numbers that can be stored depends on the number of bits being used. To find the range of numbers - calculate of the power and half it. The positive range will be one less than the negative range as it includes zero.

16 Range If you increase the exponent then you increase the range of numbers. Precision The more bits the more precise the mantissa will be. If there is not enough bits set aside for the mantissa the system has to round it down losing precision.

17 Representing Text Each character has a unique 8 bit ASCII code associated with it and this code is converted into binary before being stored. To store all the characters on a keyboard only 7 bits are needed but very often 8 bits are used. 2^7 = 128 different characters 2^8 = 256 different characters – extended ASCII which allows additional characters.

18 Character Set The set of characters represented by a computer. All numbers, letters and symbols. Control Characters ASCII characters that do not print on the screen in the normal way. There are 32 special characters, for example, Space bar, return, tab, cursor up

19 The increase in worldwide communication led to a need for a larger standard code to cope with other foreign alphabets, technical symbols etc. Unicode Designed to represent the writing schemes of all of the world’s major languages. Unicode is a 16 bit code and can represent 65536 different characters. Applications such as Office use Unicode in document files. Mobile phones use Unicode to support all the different symbols.

20 UnicodeASCII AdvantageCan store 65536 characters which can represent world wide languages Only 8 bit code which takes up less storage than Unicode DisadvantageA 16 bit code which will take up more memory 2^7 which represents only 128 characters UnicodeASCII AdvantageCan store 65536 characters which can represent world wide languages Only 8 bit code which takes up less storage than Unicode DisadvantageA 16 bit code which will take up more memory 2^7 which represents only 128 characters

21 Representing Graphics An image can be stored in memory in two ways: Bit-mapped and Vector graphics Bit-Mapped An image on a computer screen is made up of tiny dots called pixels. (Picture element) Each pixel can be “on” or “off” depending whether the value of the pixel in the computers memory is 1 or 0. (Black & White)

22 Graphic Resolution The smaller the size of pixels the finer the detail that can be displayed on screen. Small pixels = high resolution Large pixels = low resolution Problem!! Increasing the resolution will increase the storage requirements of the image.

23 Features of a Bit Mapped Image Bit mapped packages paint pictures by changing the colour of the pixels which make up the screen display. A commonly known package used for bit mapped is a paint package.

24 Advantages of Bit-Mapped Each pixel can be changed individually i.e. colour Edit a bit mapped graphic by deleting pixels anywhere on the image. Disadvantages of Bit-Mapped Bit-Mapped images require a large amount of storage space, as every pixel is stored including white space. Does not take advantage of resolutions. Once they are enlarged to much, they look unnatural and blocky. But reducing a picture too much also has a bad influence as it looses sharpness.

25 Features of Vector Images Object is represented by a series of object attributes. It stores a description of the objects that make up the image. It stores mathematical definitions of: The shape of graphic objects Their position on the screen Their attribute such as fill, line colour, pattern The value of each of the objects attributes are stored in memory as binary.

26 Advantages of vector images Take up less storage space Do not lose their quality when resized Objects can be grouped to form larger objects Images are resolution independent. The picture will be printed out at the full resolution available on the printer. Disadvantages of vector images User cannot edit individual pixels Complex objects with many layers can demand a lot of storage space.

27 Resolution Refers to the number of pixels in the width and height of the image. Bit Depth Refers to the number of bits needed to represent the colour of each pixel. Greyscale simply means shades of grey and so each shade needs its own code. 1-Bit2 Colours 2-Bits4 Colours 8-Bits256 Colours 16-Bit65536 Colours 24-Bit16 Million Colours (true colour) Increasing the number of colours that are available increases the size of the code for each colour. 600 pixels 800 pixels

28 Calculation of memory and backing storage requirements for bit mapped image. Formula Storage requirements = total pixels number of bits used to represent colours or shades of grey x

29 Calculating Memory How much memory will the following screen require (Black & white) Calculate the total number of pixels Multiply by the number of bits per pixel Divide by 8 (to change into bytes) Example 1 36 x 80 = 2880 pixels 2880 bits/8= 360 bytes 80 pixels 36 pixels 80 pixels

30 Calculating Memory How much memory will the following screen require (Greyscale) 640 pixels 200 pixels Example 2 640 * 200 = 128’000 pixels 128’000 * 2 = 256’000 bits 256’000/8 = 32’000 bytes Greyscale uses 4 colours 2 bits per pixel

31 Calculating Memory How much memory will the following screen require (Colour) 640 pixels 200 pixels Calculate the total number of pixels Multiply by the number of bits per pixel Divide by 8 (to change into bytes) Example 640 x 200 = 128000 pixels/bits 640 x 200 x 8 (colour depth) = 1024000 bits/8 = 128000 bytes/1024 = 125 Kb An image is 640 x 200 and has a colour depth of 8 bits. What is the storage requirements of this image?

32 Calculation storage requirements for a single image 7 pixels 5 pixels Example 4 = (7 x 72) X (5 X 72) = 504 X 360 = 181440 X 16 = 2903040 pixels/8 = 362880 bytes/1024 = 354.4 Kb An image is 7 x 5 pixels, and each pixel can display 65536 different colours. 65536 colours = 16 bits 2^16

33 Calculate the following Question 1 Calculate the storage requirements of an image with 4 x 6 inches, has a resolution of 800 dpi and each pixel can display 256 different colours. Question 2 Calculate the storage requirements of an image with 8 x 12 inches, has a resolution of 1200 dpi and each pixel can display 65536 different colours. Question 3 An A4 image, at 10 x 8 inches, has to be scanned at 300 dpi in 65536 colours. Calculate the storage requirements.

34 Image Compression Images using 24-bit colour graphics will be of an extremely high standard. Images using 24-bit colour can require several megabytes of memory for storage and can take time to transmit across a network. File compression can be used to reduce storage requirements. The result looks unchanged to the human eye.

35 Compression cont… A process that reduces the number of bytes required to define an image in order to save disk space or transmission time. Compression is achieved by replacing commonly occurring sequences of pixels with shorter codes. Solves the problem by: Reducing the file size Reducing the time taken to transmit the file across a network

36 Types of Compression There are two types of compression: Lossless Compression & Lossy Compression Lossless Compression A lossless compression method reduces the size of the image with no lost information. The decompressed image is exactly the same as the original image. No data is discarded. GIF is an example of lossless compression. How does it work? Uses an algorithm to store patterns of bits that occur repeatedly throughout the graphic.

37 Lossy Compression Refers to data compression techniques in which some amount of data is lost. Lossy compression technologies attempt to eliminate redundant or unnecessary information. JPEG is an example of this type if compression. MORE ABOUT THIS IN UNIT 3 - MULTIMEDIA


Download ppt "Data Representation The method of data representation in a computer system depends upon the type of data which is being used. Three types of data are considered."

Similar presentations


Ads by Google