Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 There are 10 types of people in this world: those that understand binary numbers, and those that dont... Bits and Bytes.

Similar presentations


Presentation on theme: "1 There are 10 types of people in this world: those that understand binary numbers, and those that dont... Bits and Bytes."— Presentation transcript:

1 1 There are 10 types of people in this world: those that understand binary numbers, and those that dont... Bits and Bytes

2 2 Bits and Binary Numbers A bit is a Binary digIT – a digit that can have two values: one or zero. Binary numbers are composed of bits, just like decimal numbers are composed of digits 0-9 Binary numbers can be used to represent letters, numbers, pictures, sound, or just about anything. The exact same pattern of 1s and 0s might represent many different things, depending on where it is and what program is using it. For instance, the bits b could represent the number 66, or the letter A, or part of a picture, or part of a sound, or... The interpretation depends on the context. This includes things like the file extension, and the program that's reading the data. What does coin mean?

3 3 Decimal Numbers and Place Value Base 10 is our old friend: 5473 = (5 * 1000) + (4 * 100) + (7 * 10) + (3 * 1) Can also be written as: (5 * 10 3 ) + (4 * 10 2 ) + (7 * 10 1 ) + (3 * 10 0 ) We could use any number as a base – 10 just happens to be convenient if you have 10 fingers.

4 4 Binary Numbers 128's64's32's16's8's4's2's1's Example: b = (1*2 7 ) + (0*2 6 ) + (0*2 5 ) + (1*2 4 ) + (0*2 3 ) + (1*2 2 ) + (1*2 1 ) + (1*2 0 ) = Base two only uses 0 and 1. The place values are powers of 2: 1, 2, 4, 8, 16, 32, 64, 128, and so forth, ad infinitum. = 151

5 5 16's8's4's2's1's And so on, ad infinitum... 10's1's Binary:Decimal: A Binary Odometer

6 6 Example Convert 198 to binary: 198 / 128 = 1, remainder is / 64 = 1, remainder is 6 6 / 32 = 0, remainder = 6 6 / 16 = 0, remainer = 6 6 / 8 = 0, remainder = 6 6 / 4 = 1, remainder is 2 2 / 2 = 1, remainder is 0 0 / 1 = 0 128's64's32's16's8's4's2's1's = b

7 7 Bytes A byte is 8 bits. 8 bits can represent 256 different values. Computers generally use a byte or a series of bytes to represent information. 16 bits will represent 256*256=65536 different values. 24 bits will represent 256*256*256=16,777,216 different values. and so on...

8 8 Counting Bytes: Kilo, Mega, Giga, Tera, and Lotta PrefixApproximately?Abbrev.Exactly?How many bytes? KiloThousand (10 3 )KB1024 MegaMillion (10 6 )MB1024 KB1,048,576 GigaBillion (10 9 )GB1024 MB1,073,741,824 TeraTrillion(10 12 )TB1024 GB1,099,511,627,776 PetaQuadrillion (10 15 ) PB1024 TB1,125,899,906,842,624 ExaQuintillion (10 18 ) EB1024 PBA whole lot... ZettaSextillion (10 21 )ZB1024 EBEven more... YottaSeptillion (10 24 )YB1024 ZBFuggedabaddit...

9 9 Hexadecimal – Base 16 An 8 bit byte is frequently shown as a pair of hexadecimal (hex) digits. Hex is widely used to represent colors in HTML tags: color=#00FF0E 6 hex digits are enough to specify 16.7 million different combinations of R,G,B decbinhexdecbinhex b 0x b 0x b 0x b 0x b 0x b 0xA b 0x b 0xB b 0x b 0xC b 0x b 0xD b 0x b 0xE b 0x b 0xF one byte 0x6A 4 bits: 16 different values two hex digits:

10 10 Decimal to Hex: Convert 0xBE to decimal: 0xBD = (11 * 16) + (14 * 1) 0xBE = 's1's AD Convert decimal 173 to hex: 173 / 16 = 10 (0xA), remainder = 13 (0xD) 173 = 0xAD 16's1's BE Hex to Decimal:

11 11 Binary to Hex Example 128's64's32's16's8's4's2's1's 's4's2's1's8's4's2's1's DC Starting from the right-most bit, break the binary number into groups of 4 bits, and convert each group to the equivalent hex digit. 0xDC

12 12 Encoding Text Fundamentally, computers just deal with numbers. They store letters and other characters by assigning a number for each one. Characters are generally represented in a computer as ASCII or Unicode values, where numbers are assigned to letters, digits, punctuation, etc. BinaryDecimalSymbol ……… A B C ……… Sample ASCII:

13 13 Analog Digital

14 14 What is Sound? Sound is variations in air pressure – air moving back and forth quickly. Your ear and your brain turn these variations in air pressure into sound.

15 15 How Do Speakers and Microphones Work? A speaker converts an electrical signal into movement of air, using magnets to push the air back and forth. When it pushes forward, the air is compressed. When it pulls back, the air is rarified, or decompressed. A microphone does the opposite – it converts the movement of air into an electrical signal.

16 16 Digital-to-Analog and Analog-to-Digital Conversion Analog-to-digital Converter Digital-to-analog Converter

17 17 Digitization: Turning Sound into 1s and 0s Sampling: Converting analog information into a digital representation by measuring the value of the analog signal at regular intervals, and encoding these integer values in digital form – 1s and 0s. Sampling rate (or frequency): How often the measurements are taken. Sampling resolution: How many different values you quantize into. 8 bit resolution allows 256 different values, 16 bit resolution allows different values. Another way to look at it is, how many marks are there on your ruler? The finer the gradations, the more accurate the representation can be. Quantization error: The difference between the actual signal level and the integer value chosen to represent it

18 18 Making Images With Ones and Zeroes

19 19 Original ImageDivided into pixelsEach pixel is averaged Turning Pictures into Numbers

20 20 Turning Pictures into Numbers Palette: maps colors to numbers

21 21 Digitizing Gone Bad... Original Resolution too low Not enough colors in palette

22 22 A Possible Image File Format An image file could be constructed like this: –First, include the palette of colors that are used –Second, give the height and width in pixels –Third, give the pixel data More specifically, if the image used 256 different colors: –palette of 256 colors, each color 3 bytes: 768 bytes total –image width in pixels – 2 bytes –image height in pixels – 2 bytes –1 byte for each pixel – indicates which of the 256 colors goes in that spot So an image that's 512 x 512 pixels would be: = bytes total

23 23 Run-Length Encoding There are many ways to compress a bitmapped image. One simple way is run-length encoding, which is effective if an image has a lot of consecutive pixels of the same color. The image is then expressed as a series of pairs, where each pair is a pixel color, and the number of pixels in a row of that color. For the image at left, it could be W, 20, B, 3, W, 1,B, 1, W, 11, B, 1, etc.

24 24 GIF and JPEG Compression JPEG (Joint Photographic Experts Group) better for photos, images with complex color schemes GIF (Graphics Interchange Format) better for line art, images with large areas of single color

25 25 Medical Imaging – the CAT Scan The idea behind Computed Axial Tomography is to take X-rays from many different angles and use the information to construct an image of the object. We are essentially sampling the object with X-rays. The elements in a 3D image are called voxels.

26 26 A Thought Experiment... Imagine that you had a BB gun that always shot BBs at the same velocity, and you also had a radar gun that could measure the speed of a BB... You take some measurements, and discover that different substances slow the BB down by different amounts: Substance (1 cm thick):BB Slows down by: hamburger20 m/sec jello15 m/sec slurpee10 m/sec water5 m/sec

27 27 A Thought Experiment (cont) 100 m/sec Slows down hamburger20 m/sec jello15 m/sec slurpee10 m/sec water5 m/sec 70 m/sec 75 m/sec 65 m/sec A B C D each square is 1 cm 2 – Can you determine what A, B, C, and D are?

28 28 Computed Axial Tomography X-ray tube and detectors revolve around patient Detectors measure intensity of X-rays after passing through the patient Computer uses information to reconstruct a 3-D image


Download ppt "1 There are 10 types of people in this world: those that understand binary numbers, and those that dont... Bits and Bytes."

Similar presentations


Ads by Google