Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction To Computer Science

Similar presentations


Presentation on theme: "Introduction To Computer Science"— Presentation transcript:

1 Introduction To Computer Science
CS500 Introduction To Computer Science Lecture 4

2 Data Representation In Modern Computer

3 Text Representation Data stored in the digital computer can also be in the form of letters, symbols, special characters, not only numbers. An alphanumeric character set, is a set of elements that include the 10 decimal digits (0-9), 26 letters of uppercase alphabet, 26 letters of the lowercase alphabet and 32 special characters and symbols (%. $, #,…). The alphanumeric codes are binary codes that are assigned to characters of the alphanumeric character set. The standard and the most popular alphanumeric codes are ASCII (American Standard Code For Information Interchange) codes.

4 Text Representation (2)
Originally, the ASCII coding uses 7-bits to code 128 (i.e. 27 ) characters as follows: 94 Graphic characters and 34 non-printing characters (i.e. control characters). The 94 graphics characters are the alphanumeric characters set. The 34 non-printing characters are of 3 types: Format effectors: backspace (BS), newline (NL),… Information separator: record separator (RS), file separator (FS). Communication control: used in data transmission such as start of text (SXT), end of text (EXT),… The extended ASCII codes uses 8-bits to code 256 (i.e. 28 ) characters for handling additional symbols and special characters.

5 Text Representation (3)
Extended ASCII Codes Table:

6 Text Representation (4)
Example: Other alphanumeric codes: Extended Binary Coded Decimal Interchange Code (EBCDIC): uses 8-bits Universal Code (UNICODE): uses 16-bits International Standard Organization Code (ISO Code): uses 32-bits

7 Image Representation There are two representation methods of an image in the digital computer : Bitmap (Raster) Method For storing an image, it’s represented as a collection of dots (pixels). Such pixels are arranged in rows and columns over the image.

8 Image Representation (2)
In the case of a simple black and white image, each pixel can be represented by a single bit whose value depends on whether the corresponding pixel is black or white.

9 Image Representation (3)
In the case of a gray-level (grey-scale) image, each pixel can be represented by a single byte to allow a variety of shades of grayness to be represented.

10 Image Representation (4)
In the case of a true-color image, each pixel can be represented by three color component - a red component (R), a green component (G), and a blue component (B)- corresponding to the three primary colors of light. One byte is normally used to represent the intensity of each color component. In turn, three bytes of storage are required to represent a single pixel in the original image.

11 Image Representation (5)
An advantage of raster images is their rich colors details. E.g., a 1” x 1” square image at 300 dpi (dots per inch) have individual pixels of colors information. Another advantage is that a raster image can be edited precisely such that its pixels can be modified, one by one. Popular Raster Image Formats: BMP (Bitmap Image File). TIFF (Tag Image Format File). GIF (Graphic Interchange Format). PNG (Portable Network Graphics). JPG /JPEG (Joint Photographic Experts Groups). PSD (Photoshop Document).

12 Image Representation (6)
A disadvantage of raster images is that they cannot be rescaled (resized) easily to any arbitrary size. Essentially, the only way to enlarge the image is to make the pixels bigger, which leads to a grainy (blurred) appearance. Another disadvantage is their large file sizes, that is if a 1” x 1” square image at 300 dpi have individual pixels of color information for the computer to remember? So the same 18” x 24” image needs pixels information for a computer to process which can quickly slow down even the faster machine.

13 Image Representation (7)
Vector Method For storing an image, the math is used to draw shapes using points, lines and curves. The most common types of vector images are fonts and logos

14 Image Representation (8)
Advantages of Vector Images: Infinitely Scalable: They can be scaled up or down using the math equations as much as you want without losing any image quality. Smaller File Size: Using our previous 1” x 1” square image example, a vector image needs only four points of data to recreate a square versus individual pixels for a raster image

15 Image Representation (9)
Disadvantages of Vector Images: Limited Details: They aren’t practical for complex images that require exact coloring because you’ll never be able to match the color detail available in a raster image where each individual pixel can be its own individual shade. Limited Effects: They can’t handle certain styling effects, like blurring or a drop shadow, that are available with raster images

16 Image Representation (10)
Popular Vector Image Formats: SVG (Scalable Vector Graphics). WMF (Windows Metafile). EPS (Encapsulated PostScript). CGM (Computer Graphics Metafile). DXF (AutoCAD Drawing Exchange Format). CDR (Corel Draw Vector Drawing). AI (Adobe Illustrator). PDF (Adobe Portable Document Format).

17 Image Representation (11)
Which is one of the following is a raster image and the other is a vector image? RASTER VECTOR

18 Image Representation (12)

19 Audio Representation Audio is stored in the computer by sampling the amplitude of the sound wave at regular intervals and record the series of values obtained. To obtain the quality sound reproduction obtained by today’s musical CDs, a sample rate of samples per second is used. The data obtained from each sample are represented in 16 bits (32 bits for stereo recordings). Consequently, each second of music recorded in stereo requires more than a million bits.

20 Audio Representation (2)
An alternative encoding system known as Musical Instrument Digital Interface (MIDI) is widely used in the music synthesizers found in electronic keyboards, for video game sound, and for sound effects accompanying Web sites. By encoding directions for producing music on a synthesizer rather than encoding the sound itself MIDI avoids the large storage requirements of the sampling technique. More precisely, MIDI encodes what instrument is to play which note for what duration of time. Popular Audio Formats: MIDI (Musical Instrument Digital Interface). MP3 (Moving Picture Experts Group Layer-3 Audio). RAM (Real Audio Metadata). WMA (Windows Media Audio). WAV (Waveform Audio File).

21 Video Representation Videos can be encoded as series of image frames with synchronized audio tracks also encoded using bits. Suppose you have a 10 minute video, 256x256 pixels, 24 bits per pixel, and 30 frames of the video per second. Then the file size is 256 × 256 × 24 × 10 × 60 seconds/minute × 30 = approximately 28 Gigabit = 28 / 8 bit = 3.5 Gigabyte !!! Suppose you have a 500 kilobit per second download connection, then this will take 28/500 = about 56,000 seconds (over 15 hours)!!! So video file size can be an issue and there are ways to decrease the file size and hence its transmission time by compression techniques, e.g., taking advantage of the fact that a scene in one frame is usually quite similar to the scene in the next frame.

22 Video Representation (2)
Popular Video Formats: MPEG (Motion Picture Experts Group) . WMV (Windows Media Video). 3GP (Third Generation Platform) AVI (Audio Video Interleave) FLV (Flash Video Format) MOV (Apple QuickTime Movie) AVCHD (Advanced Video Coding High Definition)

23 Internal Main Memory Organization
The internal main memory (RAM) of digital computers consists of a large number of “memory cells” where each memory cell is called a “word”. With this memory organization, each memory cell is addressed, accessible and modified individually. A “word” or a cell in memory is an entity of bits (group of 1’s and 0’s) that can be moved in and out of the memory as a unit. The size of a memory word is multiples of 8-bits in length: 8-bits (i.e.,1 byte), 16-bits (i.e., 2 bytes) , or 32-bits (i.e., 4 bytes), and so on .

24 Internal Main Memory Organization (2)
The capacity of the main memory is simply the total number of bytes that it can store.

25 Internal Main Memory Organization (3)
The units that are usually used for measuring memory capacities:

26 Internal Main Memory Organization (4)

27 Internal Main Memory Addressing
The CPU can access each memory cell (word) by a unique address. Example 1: Go to memory cell 1000 (Absolute Address) Go to memory cell next to memory cell 1000 by 6 cells (Relative Address) A CPU with n-address line (the width of the address bus of a CPU is n bits) can access memory cells up to 2n cells. In this case , the address range from 0 to 2n-1, so the first cell address is 0… and the last cell address is 1… The CPU can access all memory cells equivalently without any differences in accessibility between “low address” and “high address” cells. Therefore, main memory is usually termed RAM (i.e., Random Access Memory) , which means that all memory cells are accessible just by address.

28 Internal Main Memory Addressing (2)
Example 2: What is the total memory capacity that can be addressed using a CPU with 16-address line? Solution: The total memory capacity = 216= 26 × 210= 64 Kilo word (KW). If each word = 1 byte, then the total memory capacity = 64 KB. The address of the first memory cell = The address of the last memory cell = In other words , using hexadecimal notation, the address range is: 0000 to FFFF. Example 3: what is the total number of address lines needed by a CPU to address memory of capacity of 64 MB? Solution: The total memory capacity = 26 × 220 = 226 B. If each word (cell) = 1 byte, then the total memory capacity = 226word (cell) , thus the number of address lines is 26.


Download ppt "Introduction To Computer Science"

Similar presentations


Ads by Google