B A Mahayana Studies 000 209 Introduction to
B. A. (Mahayana Studies) 000 -209 Introduction to Computer Science November 2005 - March 2006 10. Multimedia Data We examine the main types of multimedia data (text, graphics, video, sound), and look at data compression. n
Overview n n n 1. 2. 3. 4. 5. 000 -209 Intro to CS. 10/Multimedia Data Text Graphics Video Sound Data Compression 2
1. Text n Most text files store their text using the ASCII coding scheme. n Each character is translated into 7 bits. n The ASCII character set can contain at most 27 characters (128 symbols) 4 not 000 -209 Intro to CS. 10/Multimedia Data enough for many languages 3
ASCII Code Table 000 -209 Intro to CS. 10/Multimedia Data 4
ANSI: Extended ASCII n The ANSI code uses 8 bits to represent a character. 4 can code 256 letters or symbols (28) 4 better for many European and Asian languages 000 -209 Intro to CS. 10/Multimedia Data 5
Unicode n Unicode is a 16 -bit code which can represent 65, 536 characters (216). 4 enough for any language character set 4 useful in international business documents n Unicode helps with the localization of software 4 the 000 -209 Intro to CS. 10/Multimedia Data modification of software for specific countries 6
2. Graphics n Digital photos are stored as bitmap images 4 the picture is represented by pixels (square dots) 4 each pixel has a single colour 000 -209 Intro to CS. 10/Multimedia Data 7
Black and White Graphics n The simplest bitmap images only uses black and white: 4 each pixel is coloured black or white 4 called monochrome graphics n A pixel can be stored as a '0' (black) or '1' (white) in the graphics file 4 so 000 -209 Intro to CS. 10/Multimedia Data each pixel needs 1 bit of memory continued 8
000 -209 Intro to CS. 10/Multimedia Data 9
Grayscale Graphics n A greyscale graphic is a bitmap using shades of gray 4 e. g. n Each pixel can be white, black, or one of 254 shades of gray. 4 256 n 256 shades of gray is 28, so each pixel requires 8 bits of information Greyscale files are bigger than monochrome files. 000 -209 Intro to CS. 10/Multimedia Data 10
Colour Graphics n Colour images can use 16, 256, 65, 536, or 16. 7 million colours. n More colours needs more bits for each pixel 4 16 colours = 24 = 4 bits needed for each pixel 4 16. 7 M colours = 224 = 24 bits needed for each pixel n Graphics files with full colour can get big! 000 -209 Intro to CS. 10/Multimedia Data 11
File Sizes n A 640 x 480 size bitmap image needs 640 x 480 pixels? How big is the file? n The size depends on the number of colours that need to be represented: 4 307, 200 bytes for 256 colours (28) 4 614, 400 bytes in 65, 536 colours (216) 4 921, 600 bytes in 16. 7 million colours (224) 000 -209 Intro to CS. 10/Multimedia Data 12
Reducing the Size n Three techniques: 4 editing the image (shrinking or cropping) 4 compressing the full image 4 dithering - use groups of pixels composed of two or more colors to produce the illusion of extra colours 000 -209 Intro to CS. 10/Multimedia Data 13
Dithering Example Original ; 16. 7 M colours 000 -209 Intro to CS. 10/Multimedia Data 16 colours ; no dithering 16 colours ; dithering 14
Image File Formats n Common bitmap formats are. bmp, . pcx n For line drawings, with few colours, save the file as a GIF image (file ends with. gif) n For photos, with lots of colours, use the JPG (JPEG) format (file ends with. jpg) 000 -209 Intro to CS. 10/Multimedia Data 15
Painting Software Microsoft Paint 000 -209 Intro to CS. 10/Multimedia Data Painter 25 (free( http: //www. jansfreeware. com/ 16
Photo Editing Software Photoshop 000 -209 Intro to CS. 10/Multimedia Data The Gimp (free( http: //www. gimp. org/ 17
Vector Graphics n Vector graphics store pictures in terms of lines, curves, and other shapes 4 line l drawings look better than in paint programs lines, curves, shapes are smooth 4 photos look worse 4 line drawings require much less hard disk space 4 filename extensions include. wmf, . dxf, . mgx, . eps, and. cgm 000 -209 Intro to CS. 10/Multimedia Data 18
Vector vs. Bitmaps Vector Graphic Picture 000 -209 Intro to CS. 10/Multimedia Data Bitmap Picture 19
Vector Graphics Software Corel. Draw 000 -209 Intro to CS. 10/Multimedia Data Inkscape (free( http: //www. inkscape. org/ 20
3. Video n A video is composed of a series of pictures (frames), displayed at 30 frames per second (FPS). n A video file requires a lot of hard disk space 4 a 2 hour movie may use more than 66 gigabytes (GB) on your hard disk n Video for Windows, Quick. Time, and MPEG are popular video formats. 000 -209 Intro to CS. 10/Multimedia Data 21
Video Playing Software Windows Media Player 000 -209 Intro to CS. 10/Multimedia Data BSPlayer (free( http: //www. bsplayer. org/ 22
4. Sound n Waveform audio is a digital representation of sound. 4 music, voice, and sound effects can be recorded as waveforms n A sound is converted into a waveform by using sampling. 000 -209 Intro to CS. 10/Multimedia Data 23
Sound Wave Sampling Wave is sliced into vertical segments called samples. Analog sound wave is a smooth curve of continuous values. Height of sample is converted to a number. 000 -209 Intro to CS. 10/Multimedia Data 24
Sampling Quality n Sampling rate is the number of times per second that sound is measured during the recording 4 1000 samples per second = 1 KHz (kilohertz) 4 more samples = better quality sound n Height of each sample saved as an: 4 8 -bit number for radio-quality 4 16 -bit number for high-fidelity 4 more bits = better quality sound 000 -209 Intro to CS. 10/Multimedia Data 25
Sound Editing Software Wave. Pad (free( http: //www. nch. com. au/wavepad/ 000 -209 Intro to CS. 10/Multimedia Data 26
MIDI n MIDI (Musical Instrument Digital Interface) files contain instructions that MIDI sound cards use to play the sounds. 4 MIDI is like a music score, played by MIDI 'instruments' in the sound card n MIDI files are much smaller than waveform files 43 000 -209 Intro to CS. 10/Multimedia Data minutes of music can be stored in a ~10 KB file 27
MIDI Software Anvil Studio (free( http: //www. anvilstudio. com/ record, write MIDI 000 -209 Intro to CS. 10/Multimedia Data 28
5. Data Compression n Data compression reduces the amount of hard disk space needed to store data. n Reversing the data compression is called uncompressing, decompressing, extracting, or expanding. n The compression ratio is the percentage reduction in the size of the data when it is compressed. 000 -209 Intro to CS. 10/Multimedia Data 29
File Compression Software Win. Zip http: //www. winzip. com/ Zip. It. Fast (free( http: //www. zipitfast. com/ 000 -209 Intro to CS. 10/Multimedia Data 30
Compressing Text n Adaptive pattern substitution 4 scans text looking for repeating patterns 4 substitute a byte for the pattern and make a dictionary entry n Example 4 there theme is "that was then" becomes 4 Xre X Xme is "that was Xn" 000 -209 Intro to CS. 10/Multimedia Data dictionary X the 31
Compressing Graphics n Bitmap graphics often contain large blocks of the same colour. n Run-length encoding 4 runs of data (long blocks with the same data) are replaced by a single data value and a count 000 -209 Intro to CS. 10/Multimedia Data continued 32
n Example: 4 WWWWWWBWWWWW WWBBBWWWWWWWWWWBWWWWWWW becomes 4 12 WB 12 W 3 B 24 WB 14 W 4 W 000 -209 Intro to CS. 10/Multimedia Data = white; B = black 33
Lossy vs Lossless Compression n Lossy compression “throws away” some data from the graphic 4 what l the human eye won't miss used in the JPEG file format Original Image 12)KB( 000 -209 Intro to CS. 10/Multimedia Data Compressed (85% less info, 1. 8 KB) 34
n Lossless compression 4 the exact same data can be reconstructed from the compressed data 4 used in the PNG file format n Lossless compression is also used in software compression tools such as Win. Zip. 000 -209 Intro to CS. 10/Multimedia Data 35
Compressing Video n The number of frames per second (FPS) affects the perceived smoothness of the video 4 high quality = 30 FPS n Intra-frame compression - shrink each frame using image compression techniques. n Motion compensation stores only the data that changes between one frame and the next 4 can 000 -209 Intro to CS. 10/Multimedia Data produce compression ratios of 200: 1 36
- Slides: 36