MIS 2103 Computer Hardware and System Software PDF
Document Details
2024
Tags
Summary
Lecture notes for MIS 2103, Computer Hardware and System Software, Fall 2024, Lecture #4. The lecture provides an overview of various types of data used in computers, including image data, and different ways of representing images. Topics covered range from bitmap images to object images to different types of computer files.
Full Transcript
MIS 2103 Computer Hardware and System Software Fall 2024 Lecture #4 Image Data § Photographs, figures, icons, drawings, charts and graphs § Two approaches: § Bitmap or raster images (cellular image) of photos and paintings with continuous variation § Object or vector...
MIS 2103 Computer Hardware and System Software Fall 2024 Lecture #4 Image Data § Photographs, figures, icons, drawings, charts and graphs § Two approaches: § Bitmap or raster images (cellular image) of photos and paintings with continuous variation § Object or vector images composed of graphical objects like lines and curves defined geometrically § Differences include: § Quality of the image § Storage space required § Time to transmit § Ease of modification 3-2 Bitmap Images § Used for realistic images with continuous variations in shading, color, shape and texture § Examples: p Scanned photos p Clip art generated by a paint program § Preferred when image contains large amount of detail and processing requirements are fairly simple § Input devices: § Scanners § Digital cameras and video capture devices § Graphical input devices like mice and pens § Managed by photo editing software or paint software § Editing tools to make tedious bit by bit process easier 3-3 Bitmap Images § Each individual pixel (pi(x)cture element) in a graphic stored as a binary number § Pixel: A small area with associated coordinate location § Example: each point below represented by a 4-bit code corresponding to 1 of 16 shades of gray 3-4 Bitmap Display § Monochrome: black or white § 1 bit per pixel § Gray scale: black, white or 254 shades of gray § 1 byte per pixel § Color graphics: 16 colors, 256 colors, or 24-bit true color (16.7 million colors) § 4, 8, and 24 bits respectively 3-5 Storing Bitmap Images § Frequently large files § Example: 600 rows of 800 pixels with 1 byte for each of 3 colors ~1.5MB file § File size affected by § Resolution (the number of pixels per inch) p Amount of detail affecting clarity and sharpness of an image § Levels: number of bits for displaying shades of gray or multiple colors p Palette: color translation table that uses a code for each pixel rather than actual color value § Data compression 3-6 GIF (Graphics Interchange Format) § First developed by CompuServe in 1987 § GIF89a enabled animated images § allows images to be displayed sequentially at fixed time sequences § Color limitation: 256 § Image compressed by LZW (Lempel-Zif- Welch) algorithm § Preferred for line drawings, clip art and pictures with large blocks of solid color § Lossless compression 3-7 JPEG (Joint Photographers Expert Group) § Allows more than 16 million colors § Suitable for highly detailed photographs and paintings § Employs lossy compression algorithm that § Discards data to decreases file size and transmission speed § May reduce image resolution, tends to distort sharp lines 3-8 Other Bitmap Formats § TIFF (Tagged Image File Format):.tif (pronounced tif) § Used in high-quality image processing, particularly in publishing § BMP (BitMaPped):.bmp (pronounced dot bmp) § Device-independent format for Microsoft Windows environment: pixel colors stored independent of output device § PCX:.pcx (pronounced dot pcx) § Windows Paintbrush software § PNG: (Portable Network Graphics):.png (pronounced ping) § Designed to replace GIF and JPEG for Internet applications § Patent-free § Improved lossless compression § No animation support 3-9 Object Images § Created by drawing packages or output from spreadsheet data graphs § Composed of lines and shapes in various colors § Computer translates geometric formulas to create the graphic § Storage space depends on image complexity § number of instructions to create lines, shapes, fill patterns § Movies Shrek and Toy Story use object images 3-10 Object Images § Based on mathematical formulas § Easy to move, scale and rotate without losing shape and identity as bitmap images may § Require less storage space than bitmap images § Cannot represent photos or paintings § Cannot be displayed or printed directly § Must be converted to bitmap since output devices (except plotters) are bitmap 3-11 Popular Object Graphics Software § Most object image formats are proprietary (patent) § Files extensions include.wmf,.dxf,.mgx, and.cgm § Macromedia Flash: low-bandwidth animation § Micrographx Designer: technical drawings to illustrate products § CorelDraw: vector illustration, layout, bitmap creation, image-editing, painting and animation software § Autodesk AutoCAD: for architects, engineers, drafters, and design-related professionals § W3C SVG (Scalable Vector Graphics) based on XML Web description language 3-12 PostScript § Page description language: list of procedures and statements that describe each of the objects to be printed on a page § Stored in ASCII or Unicode text file § Interpreter program in computer or output device reads PostScript to generate image § Scalable font support § Font outline objects specified like other objects 3-13 PostScript Program 3-14 Bitmap vs. Object Images Bitmap (Raster) Object (Vector) Pixel map Geometrically defined shapes Photographic quality Complex drawings Paint software Drawing software Larger storage requirements Higher computational requirements Enlarging images produces jagged Objects scale smoothly edges Resolution of output limited by Resolution of output limited by resolution of image output device 3-15 Video Images § Require massive amount of data § Video camera producing full screen 640 x 480 pixel true color image at 30 frames/sec 27.65 MB of data/sec § 1-minute film clip 1.6 GB storage § Options for reducing file size: decrease size of image, limit number of colors, reduce frame rate § Method depends on how video delivered to users § Streaming video: video displayed as it is downloaded from the Web server p Example: video conferencing § Local data (file on DVD or downloaded onto system) for higher quality p MPEG-2: movie quality images with high compression require substantial processing capability 3-16 Audio Data § Transmission and processing requirements less demanding than those for video § Waveform audio: digital representation of sound § MIDI (Musical Instrument Digital Interface): instructions to recreate or synthesize sounds § Analog sound converted to digital values by A-to-D converter 3-17 Waveform Audio Sampling rate normally 50KHz 3-18 Sampling Rate § Number of times per second that sound is measured during the recording process. § 1000 samples per second = 1 KHz (kilohertz) § Example: Audio CD sampling rate = 44.1KHz § Height of each sample saved as: § 8-bit number for radio-quality recordings § 16-bit number for high-fidelity recordings § 2 x 16-bits for stereo 3-19 Audio Formats § MP3 § Derivative of MPEG-2 (ISO Moving Picture Experts Group) § Uses psychoacoustic compression techniques to reduce storage requirements § Discards sounds outside human hearing range: lossy compression § WAV § Developed by Microsoft as part of its multimedia specification § General-purpose format for storing and reproducing small snippets (pieces) of sound 3-20 Data Compression § Compression: recoding data so that it requires fewer bytes of storage space. § Compression ratio: the amount file is shrunk § Lossless: inverse algorithm restores data to exact original form § Examples: GIF, PCX, TIFF § Lossy: data degradation for file size and download speed § Much higher compression ratios, often 10 to 1 § Example: JPEG § Common in multimedia § MPEG-2: uses both forms for ratios of 100:1 3-21 Compression Algorithms § Repetition § 0587000034000 01587043403 § Example: large blocks of the same color § Pattern Substitution § Scans data for patterns § Substitutes new pattern, makes dictionary entry z Pe ¯ pi v ed § Example: 45 to 30 bytes ð er ¥ ck ° pe plus dictionary µ Pi p Peter Piper picked a peck of pickled peppers. p z t ð µ p 𠯥 v a ° ¥ of ¯ ¥l v ° pp ð s. 3-22 Internal Computer Data Format § All data stored as binary numbers § Interpreted based on § Operations computer can perform § Data types supported by programming language used to create application 3-23 5 Simple Data Types § Boolean: 2-valued variables or constants with values of true or false § Char: Variable or constant that holds alphanumeric character § Enumerated § User-defined data types with possible values listed in definition p Type DayOfWeek = Mon, Tues, Wed, Thurs, Fri, Sat, Sun § Integer: positive or negative whole numbers § Real § Numbers with a decimal point § Numbers whose magnitude, large or small, exceeds computer’s capability to store as an integer 3-24 Number Representation § Numbers can be represented as a combination of § Value or magnitude (or modulus) § Sign (plus or minus) 4-25 32-bit Data Word 4-26 Unsigned Numbers: Integers § Unsigned whole number or integer § Direct binary equivalent of decimal integer § 4 bits: 0 to 9 § 16 bits: 0 to 9,999 § 8 bits: 0 to 99 § 32 bits: 0 to 99,999,999 Decimal Binary BCD (Binary Coded Decimal) 68 = 0100 0100 = 0110 1000 = 26 + 22 = 64 + 4 = 68 = 22 + 21 = 6 23 = 8 99 = 0110 0011 = 1001 1001 (largest 8-bit = 26 + 25 + 21 + 20 = = 23 + 20 23 + 20 BCD) = 64 + 32 + 2 + 1 = 99 = 9 9 255 = 1111 1111 = 0010 0101 0101 (largest 8-bit = 28 – 1 = 255 = 21 22 + 20 22 + 20 binary) = 2 5 5 4-27 Value Range: Binary vs. BCD § BCD range of values < conventional binary representation § Binary: 4 bits can hold 16 different values (0 to 15) § BCD: 4 bits can hold only 10 different values (0 to 9) No. of Bits BCD Range Binary Range 4 0-9 1 digit 0-15 1+ digit 8 0-99 2 digits 0-255 2+ digits 12 0-999 3 digits 0-4,095 3+ digits 16 0-9,999 4 digits 0-65,535 4+ digits 20 0-99,999 5 digits 0-1 million 6 digits 24 0-999,999 6 digits 0-16 million 7+ digits 32 0-99,999,999 8 digits 0-4 billion 9+ digits 64 0-(1016-1) 16 digits 0-16 quintillion 19+ digits 4-28 Conventional Binary vs. BCD § Binary representation generally preferred § Greater range of value for given number of bits § Calculations easier § BCD often used in business applications to maintain decimal rounding and decimal precision 4-29 Floating Point Numbers § Real numbers § Used in computer when the number § Is outside the integer range of the computer (too large or too small) § Contains a decimal fraction 5-30 Exponential Notation § Also called scientific notation § 12345 § 12345 x 100 § 0.12345 x 105 § 123450000 x 10-4 § 4 specifications required for a number 1. Sign (“+” in example) 2. Magnitude or mantissa (12345) 3. Sign of the exponent (“+” in 105) 4. Magnitude of the exponent (5) § Plus 5. Base of the exponent (10) 6. Location of decimal point (or other base) radix point 5-31 Summary of Rules Sign of the mantissa Sign of the exponent -0.35790 x 10-6 Location Mantissa Base Exponent of decimal point 5-32 Format Specification § Predefined format, usually in 8 bits Sign of the mantissa SEEMMMMM 2-digit Exponent 5-digit Mantissa 5-33 Format § Mantissa: sign digit in sign-magnitude format § Assume decimal point located at beginning of mantissa § Excess-N notation: Complementary notation § Pick middle value as offset where N is the middle value Representation 0 49 50 99 Exponent being represented -50 -1 0 49 – Increasing value + 5-34 Overflow and Underflow § Possible for the number to be too large or too small for representation 5-35 Conversion Examples 05324567 = 0.24567 x 103 = 245.67 14810000 = – 0.10000 X 10-2 = – 0.0010000 15555555 = – 0.55555 x 105 = – 55555 04925000 = 0.25000 x 10-1 = 0.025000 5-36 Normalization § Shift numbers left by increasing the exponent until leading zeros eliminated § Converting decimal number into standard format 1. Provide number with exponent (0 if not yet specified) 2. Increase/decrease exponent to shift decimal point to proper position 3. Decrease exponent to eliminate leading zeros on mantissa 4. Correct precision by adding 0’s or discarding/rounding least significant digits 5-37 Example 1: 246.8035 1. Add exponent 246.8035 x 100 2. Position decimal point.2468035 x 103 3. Already normalized 4. Cut to 5 digits.24680 x 103 5. Convert number 05324680 Sign Excess-50 exponent Mantissa 5-38 Example 2: 1255 x 10-3 1. Already in exponential form 1255x 10-3 2. Position decimal point 0.1255 x 10+1 3. Already normalized 4. Add 0 for 5 digits 0.12550 x 10+1 5. Convert number 05112550 5-39 Example 3: - 0.00000075 1. Exponential notation - 0.00000075 x 100 2. Decimal point in position 3. Normalizing - 0.75 x 10-6 4. Add 0 for 5 digits - 0.75000 x 10-6 5. Convert number 14475000 5-40 Floating Point Calculations § Addition and subtraction § Exponent and mantissa treated separately § Exponents of numbers must agree p Align decimal points p Least significant digits may be lost § Mantissa overflow requires exponent again shifted right 5-41 Addition and Subtraction Add 2 floating point numbers 05199520 + 04967850 Align exponents 05199520 0510067850 Add mantissas; (1) indicates a carry (1)0019850 Carry requires right shift 05210019(850) Round 05210020 Check results 05199520 = 0.99520 x 101 = 9.9520 04967850 = 0.67850 x10 -1 = 0.06785 = 10.01985 In exponential form = 0.1001985 x 102 5-42 Floating Point in the Computer § Typical floating point format § 32 bits provide range ~10-38 to 10+38 § 8-bit exponent = 256 levels p Excess-128 notation § 23/24 bits of mantissa: approximately 7 decimal digits of precision 5-43 Programming Considerations § Integer advantages § Easier for computer to perform § Potential for higher precision § Faster to execute § Fewer storage locations to save time and space § Most high-level languages provide 2 or more formats § Short integer (16 bits) § Long integer (64 bits) 5-44 Programming Considerations § Real numbers § Variable or constant has fractional part § Numbers take on very large or very small values outside integer range § Program should use least precision sufficient for the task 5-45 Next Week § Computer architectures Thank you for your participation J