230 likes | 310 Views
Data Types. Level 3 Extended Diploma Unit 19 Computer Systems Architecture. Previously …. We learnt how values can be represented in: Decimal Binary Hexadecimal Now we look at how other things can be represented in a computer. Text.
E N D
Data Types Level 3 Extended Diploma Unit 19 Computer Systems Architecture
Previously …. • We learnt how values can be represented in: • Decimal • Binary • Hexadecimal • Now we look at how other things can be represented in a computer
Text • We need a method of coding the alphabet and other characters • This has to be recognised across all computers • ASCII (American Standard Code for Information Interchange) is a method of doing this • Standardises binary codes eg: • 01000001 is uppercase A
Text • One bit to switch between upper and lower case • A = 0100 0001 a = 0110 0001 • No information about font, size, colour (this is the job of scripting languages – HTML etc, or word processors) • Similar values for punctuation etc
Exercise • Write out your surname in binary and hex • Decode this message (x20 is a space) 537475666620666F722073747564656E7473 • What are the ASCII codes for ? @ # £ $
Graphics • 2 ways to represent graphics • Bitmaps • Vectors
Bit maps • Resolution – horizontal x vertical pixels or bits • 640 x 480, 1280 x 1024 etc • This example is 5x7, a 0 is black and a 1 is white
Colour bit maps • Images made up of coloured pixels
Colour bit maps • Colour depth – number of colour bits per pixel • 1 bit – monochrome 0 = white 1 = black • 8 bit – grey scale – 256 shades 00000000 = black 00001111 = mid grey 11111111= white
Colour • 24 bit = 8 bits per red/green/blue = 16 million colours • Exercise – how many colours in 30 bit Deep Colour
Vector graphics • Lines are drawn • Can be scaled up or down without loss of quality • Allows much smaller file sizes than bitmaps
Vector graphics • What is going to be drawn (eg line) • Start point (x1,y1) • End point (x2,y2) • Where x and y are co-ordinates on a grid Y – axis 0 1 2 3 4 5 0 1 2 3 4 5 X – axis
Draw a square // set the starting point for the line graphics.moveTo(10,10); // move the line through a series of coordinates graphics.lineTo(10,100); graphics.lineTo(100,100); graphics.lineTo(100,10); graphics.lineTo(10,10);
Exercise • What applications allow you to create and edit bitmaps or vector graphics? • What are the advantages of each method of drawing images? • Consider • File size • What happens when you scale the image • Colour reproduction
Sound • Sound consists of a continuously varying waveform • It is an analogue signal
A-D conversion • An A-D convertor (analogue to digital) is used to sample the waveform for amplitude at fixed intervals • The values are stored digitally Amplitude Sample period
Sampling rates and bits • For CD the sampling rate is 44.1kHz • Higher sampling rates give better quality • HD-DVD uses 192 kHz • The bit depth determines the range of amplitude from loudest to softest • 16 bits are used for CD quality • 24 bits professionally
Bit rate • Bit rate = (sampling rate) x (bit depth) x (number of channels) • For a recording with a 44.1 kHz sampling rate, a 16 bit depth, and 2 channels (stereo): 44100 x 16 x 2 = 1411200 bits per second, or 1.4112 Mbit/s
Compression • Audio can be compressed to reduce file sizes • Uncompressed files contain as many bits for silence as for sound • Lossless compression replaces the silence with information about how long the silence lasts. Can reduce file size by half • Lossy compression eliminates the less audible sounds and can reduce files to one tenth of the original size
File types • Uncompressed • WAV, AVI • Lossless • FLAC, Apple lossless • Lossy • Mp3, mp4, Vorbis, AAC, ATRAC
D-A conversion • To convert a digital file back to sound • The bits are fed into a D-A converter • This produces a voltage with the amplitude proportional to the value of the 16 bits • This is played back at the sampling rate