Digital Media Daniel Fuller ITEC 2110
Daily Question: Which statement is True? 5 + 5 = 10 1 + 1 = 10 F + 1 = 10 Email answer to DFullerDailyQuestion@gmail.com Subject Line: ITEC2110-26
First, some mac software you will be using Grab: used to do a screen capture TextEdit: used as a simple word processor PhotoBooth: used to take your picture with the built in camera and take video with the built in camera Preview: Change image file formats
About file formats and extensions.au,.doc,.ppt,.mov, etc. Indication to us (the humans) what kind of file this is Some software looks at the extension Some software will try to open improper files with extensions that have changed Results in corrupted file and an error message Try it: change the extension from.doc to.jpg
File formats and extensions Some software looks at the data in the file for more definitive answer (the header) Important file-related information is encoded in the data of the file For example: some image formats have color tables to reduce the size of the file Some video just saves the changes from one frame to the next We ve seen the header before when we used the hex viewer to look at images Image size is stored in the header
Numbering Systems
The Question: How do you put stuff in a computer So that you can manipulate it So that you can send it So that someone else can see and use it How do you represent the real world in a digital world?
The Answer: Represent the real world as numbers Store the numbers Transmit the numbers Retrieve the numbers Display them in a form humans understand
Remember this?
Numbering systems Decimal Binary Hexadecimal
Which statement is True? 5 + 5 = 10 1 + 1 = 10 F + 1 = 10
Well it depends: 5 + 5 = 10 (in decimal) 1 + 1 = 10 (in binary) F + 1 = 10 (in hexadecimal) Welcome to numbering systems!
Numbering systems Humans: decimal 10 fingers, 10 digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Computers: binary 1 finger, 2 digits 0 & 1
Hexadecimal 16 fingers, 16 digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Why Hexadecimal? You can use one hexadecimal digit instead of 4 binary digits While this seems complicated.. it is actually easier (after some practice!) for humans to deal with 16 different digits than 4 0s and 1s In Hex: 0123456789ABCDEF In binary: 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
How many different numbers? In Decimal 1 digits can represent 10 different numbers: 0 1 2 3 4 5 6 7 8 9 In Decimal 2 digits can represent 100 different numbers: 00 01 02 03 04 05 06 07 08 09 10 11 12 97 98 99 In Binary 1 digit can represent 2 different numbers: 0 and 1 In Binary 2 digits can represent 4 different numbers: 00 01 10 11 In Hexadecimal 1 digit can represent 16 different numbers: 0 1 2 3 4 5 6 7 8 9 A B C D E F In Hexadecimal 2 digits can represent 256 different numbers: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 F9 FA FB FC FD FE FF
How many different things? How many things can you count with 4 hex digits? [number of digits in the numbering system] x [number of digits used] [16] ^ [4] = 65,536 How many things can you count with 4 decimal digits? [number of digits in the numbering system] x [number of digits used] [10] ^ [4] = 10,000 How many things can you count with 4 binary digits? [number of digits in the numbering system] x [number of digits used] [2] ^ [4] = 16
Counting with a different number of fingers It s the same process but different number sets 10 fingers: Counting in decimal 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 then start over with 0 and increment the digit to the left ==> 10 1 finger: Counting in binary 0, 1 then start over with 0 and increment the digit to the left ==> 10 16 fingers: Counting in hexadecimal 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F then start over with 0 and increment the digit to the left ==> 10
Binary Coding Data for a computer: Binary 0 s and 1 s Data for humans: Hex 1 Hexadecimal digits represents 4 binary digits Data for humans: ASCII (the alphabet) 2 hex codes = 1 ASCII code
Example: ASCII Code Humans and Computers: ASCII The ASCII code for T Hexadecimal: 54 (Decimal: 84) Binary: 0101 0100
Stuff in the real world to stuff on a computer: HOW? A message Letters of the alphabet => bits (0s and 1s) A picture Reflected light => bits (0s and 1s) A song Pressure waves in air => bits (0s and 1s) A video Pressure waves in air and reflected light => bits (0s and 1s)
Sizes of Data Bit: binary digit Byte: 8 Bits KB: kilobyte (1,000 bytes) MB: megabyte (1,000,000 bytes) GB: gigabyte (1,000,000,000 bytes) TB: terabyte (1,000,000,000,000 bytes) KBPS: kilo (1,000) bits per second MBPS: mega (1,000,000) bits per second
A valuable distinction Communications are usually stated in bps (bits per second) File size is usually stated in bytes There are 8 bits per byte You will have to convert from one to the other when you do download/upload calculations (coming later)
Discrete & Continuous
Phenomena in the Real world: discrete vs. continuous Things in the real world can be discrete They either ARE or they ARE NOT These things can be counted Examples: The number of cars in the parking lot The number of beans in a jar
Phenomena in the Real world: discrete vs. continuous Things in the real world can be continuous Continuous cannot be counted; it must be measured Examples: Atmospheric pressure Height of an ocean wave Frequency of a sound wave
The problem is computers can only count Discrete data is easy for a computer Count it and store it as a number Continuous data: not so much Music Measure the frequency & amplitude Encode as a collection of numbers Pictures: Measure the amount (intensity) and frequency of light (color) in a number of spots of light (pixels) Encode the frequency and the intensity as a collection of numbers
But wait Question If computers only store 0s and 1s, how does all this continuous stuff end up in a computer such that we can save it and play it back? Answer Continuous data must be converted to discrete data
Converting continuous phenomenon to digital data You must SAMPLE the phenomenon Sampling consists of two processes 1) Determine when to take the measurement The number of samples per time period is called the sample rate 2) Take the measurement The number of different values each sample can take on is called the quantization level
Digital data back to continuous phenomenon Display samples using sample and hold Play the sample for the duration of the sample time
How many samples do you need?
Single Sample
Single Sample
Single sample (sample and hold)
2 Samples
2 Samples
2 Samples (sample and hold)
3 Samples
3 Samples
3 Samples (sample and hold)
4 Samples
4 Samples
4 Samples (sample and hold)
5 Samples
5 Samples
5 Samples (sample and hold)
And so on
And even more
Now it s beginning to look like a curve
How frequently should I sample? Too few Small file size (good) But not a faithful representation when replayed Too many Large file size (bad) Excellent representation when replayed The Nyquist rate Sample twice as many samples as the frequency being captured Results in an ok file size Results in faithful representation when replayed
CD quality is 44,100 samples per second Why? Human hearing response is in the range of 20 to 22,000 cycles per second Nyquist sample rate Highest frequency to be captured = 22,050 2 x 22,050 = 44,100 samples per second
JurassicParkTheme.mp3 4 42 = 282 seconds long 282 x 44,100 samples per second = 12,436,200 samples 12,436,200 x 2 bytes/sample (2 bytes = 16 bits) = 24,872,400 bytes Stereo: 2 channels => 49,744,800 bytes Should be 49+ megabytes! Why does it show only 4.3 megabytes?
Looking at JurassicParkTheme.mp3 4 minutes and 42 seconds long 4,519,379 bytes in length Is this right? CD quality 44,100 samples per second (sample rate) 16 bit samples (quantization level is 16 bit) 16 bits can store 65,536 different levels (2 x 16 = 65,536 individual levels)
Why 49+ megabytes not 4.3 megabytes? This is an MP3 The data is COMPRESSED
Two types of compression Lossy Loses some data from the original file *.jpeg, *.mp3 Lossless Doesn t lose any data *.zip
Two types of compression
Sampling Artifacts
Sampling Artifacts Sampling Artifacts are the negative side effects caused by having to sample continuous data
Sampling Artifacts Under-sampling: not enough samples being taken of continuous data can produce undesired artifacts Examples: Moire patterns on images Retrograde motion on video
Sampling Artifacts Not enough quantization levels when sampling continuous data can produce undesired artifacts Examples might be: Too few grey levels: gradients become steps Too few brightness levels: posterization
Posterization
Sampling Artifacts Retrograde Motion 4 samples/cycle, 2 cycles 2 samples/cycle, 2 cycles
Sampling Artifacts (cont.) Audio Too few amplitude levels, quantization noise 8 bits (256 amplitude levels) produces discernable noise 16 bits (65,536 amplitude levels) CD quality, no discernable hiss General sound fuzziness or a flat sound
Data Representations How things are stored on the computer
Data Representations Images Bitmap/Raster Vector Audio Animation Video Text
Images: Bitmap/Raster Are stored as arrays of pixels Can be stored directly e.g. TIFF, PNG Can have an associated color model e.g. JPG Generating these pixels from the stored model is called rendering
An image made up of pixels Photograph by Chuck DeLuca
Images: Vector Are stored as mathematical descriptions Often smaller than bitmapped Size of the file is independent of resolution or image size Not suitable for some type of images (e.g. a photograph) Requires computation to render
Comparison Bitmapped graphics Defined as spots (pixels) of color Has problems scaling File size unaffected by image complexity File size affected by the image size Vector graphics Defined by their mathematically described parts File size affected by image complexity File size unaffected by the image size Scaling is easy
Moving images Captured live with camera Stored as a series of images Or generated from animation Can be a series of images Can be like vector graphics, with a formula for how to move 2D or 3D objects Can be generated using software like Blender
Network Communication
Types of Network access Asymmetric Max downstream (internet to modem) speed is different from the max upstream (modem to internet) speed Adequate for normal web browsing e.g. Dial-up connection, ADSL Symmetric Max downstream and max upstream speeds are the same Preferable for videoconferencing, uploading large files e.g. T1, T3
Time-to-Download/Upload Calculations NOTE: bps is bits per second while file size is stated in bytes (capital B) Bits per second / 8 = Bytes per second File size in Bytes / Bytes per second = Time in seconds
Time-to-Load Calculation How long would it take to upload a 1.2 MB video it to youtube with an upload speed of 1 Mbps? 1 Mbps / 8 = 0.125 MBps
Time-to-Load Calculation How long would it take to upload a 1.2 MB video it to youtube with an upload speed of 1 Mbps? 1 Mbps / 8 =.125 MBps 1.2 MB /.125 = 9.6 s
Time-to-Download Calculation How long would it take to download a 1.5 GB movie with a download speed of 1.3 Mbps?
Time-to-Download Calculation How long would it take to download a 1.5 GB movie with a download speed of 1.3 Mbps? 1.3 Mbps / 8 = 0.1625 MBps
Time-to-Download Calculation How long would it take to download a 1.5 GB movie with a download speed of 1.3 Mbps? 1.3 Mbps / 8 = 0.1625 MBps 1.5 GB * 1000 = 1500 MB
Time-to-Download Calculation How long would it take to download a 1.5 GB movie with a download speed of 1.3 Mbps? 1.3 Mbps / 8 = 0.1625 MBps 1.5 GB * 1024 = 1500 MB 1500 MB / 0.1625 = 9231 Seconds to dowload ~Two and a half hours
Servers and Clients
Servers & Clients... Clients consume and display internet content Your browser is a client Clients request content from servers Send a server an HTTP://URL message which is a request for a web page Servers respond to requests for internet content Send requested web pages to Clients The content is sent in HTML code HTML sent by the server is interpreted by the client (browser) and displayed on your display View source
URL Uniform resource locator A human-readable name URL takes the form: http://www.kongregate.com/games/armorgames/achievement-unlocked URL has 3 parts The protocol that you are using: http:// The domain name: www.kongregate.com The directory/file you want to see: games/armorgames/achievement-unlocked The URL maps to a number called an IP address
Servers & Clients... Servers have fixed IPs so they are easy to find Your computer probably uses DHCP which is a dynamic (changing from connection to connection) IP
IPv4 vs. IPv6 Mostly an issue of number of available addresses IPv4 32-bit 2^32 (about 4 billion) addresses IPv6 128-bit 2^128 addresses That s about 340,000,000,000,000,000,000,000,000,000,000,000,000
Your computer DHCP: Request IP Address The Internet (Your ISP)
Your computer DHCP: 135.10.34.143 135.10.34.143 The Internet (Your ISP)
Your Computer DHCP: 135.10.34.143 Browser: www.yahoo.com yahoo.com 235.01.30.164 Requested webpage: www.yahoo.com The Internet (Your ISP) Domain Name System (DNS)
Your Computer DHCP: 135.10.34.143 Browser: www.yahoo.com yahoo.com 235.01.30.164 The Internet (Your ISP) Requested webpage: www.yahoo.com Domain Name System (DNS)
Your Computer DHCP: 135.10.34.143 Browser: www.yahoo.com yahoo.com 235.01.30.164 The Internet (Your ISP) Requested webpage: IP = 235.01.30.164 Domain Name System (DNS) http://www.yahoo.com = 235.01.30.164
Your Computer DHCP: 135.10.34.143 Browser: www.yahoo.com yahoo.com 235.01.30.164 The Internet (Your ISP) Requested webpage: IP = 235.01.30.164 Domain Name System (DNS) http://www.yahoo.com = 235.01.30.164
Your Computer DHCP: 135.10.34.143 Browser: www.yahoo.com yahoo.com 235.01.30.164 The Internet (Your ISP) Requested webpage: IP = 235.01.30.164 Domain Name System (DNS) http://www.yahoo.com = 235.01.30.164
Your Computer DHCP: 135.10.34.143 Browser: www.yahoo.com Requested content yahoo.com 235.01.30.164 The Internet (Your ISP) Domain Name System (DNS) http://www.yahoo.com = 235.01.30.164
Your Computer DHCP: 135.10.34.143 Browser: www.yahoo.com Requested content yahoo.com 235.01.30.164 The Internet (Your ISP) Domain Name System (DNS) http://www.yahoo.com = 235.01.30.164
Questions?
Homework Read Ch. 1 if you have not already Read Ch. 4