section 2 Data representation
- Created by: lemon_socks
- Created on: 29-03-23 10:54
Units
A binary digit (or bit) is unit of data storage, and will have a value of 0,0 or 1.
Four bits called a nible
Data converted by binary as computer ony processed two inputs - on and off , or 0 and 1
NameNotationPower of 10Value kilobyte kB 10, cubed,103 1, comma, 000,1,000 bytes megabyte MB 10, to the power 6 ,106 1, comma, 000, comma, 000,1,000,000 bytes gigabyte GB 10, to the power 9 ,109 1, comma, 000, comma, 000, comma, 000,1,000,000,000 bytes terabyte TB 10, to the power 12 ,1012 1, comma, 000, comma, 000, comma, 000, comma, 000,1,000,000,000,000 bytes1,
binary numbers
Denary numbers = base 10
Binary numbers = base 2
place values are powers of two
e.g 128,64,32,16 8,4,21
number 66
0,1,0,0 0,0,1,0
64+2 = 66
binary addition
- 0+0=0
- 0, plus, 1, equals, 1,0+1=1
- 1, plus, 0, equals, 1,1+0=1
- 1, plus, 1, equals, 0,1+1=0 and carry 1,1
- 1, plus, 1, plus, 1, equals, 1+1+1=1 and carry 1,1
Overflow error - when extra bit adding eigth place value e.g 1+1+1 = 1,1
one is carried to ninth place holder
Programme either ignore error so calculation made emits different outcome
or programme crashes
Binary shifts
want to multiple - shift to left
want to divide - shift to right
left shift - left most bit discarded , rightmost bit replaced by a zero
e.g 0001,0001 = 17 shift 2 places left
0100,0100 = 68
shift two places = 2*2=4 the numebr times by 4 17*4=68
Right shift - right most bit discarded , leftmost bit replaced by zero
e.g 1100,1000 = 200
0001,1001
hexadecimal
hexadecimal - base 16
made up of 16 characters . 0-9 and a-f. Each character corresponds to a nibble
0 - 0000 - denary 0
4- 0100 - denary 4
8- 1000 - denary 8
A- 1010 - denary 10
C - 1100 - denary 12
F- 1111 - denary 15
hexadecimal format two numbers - e.g AF
why is hexadecimal used
hexadecimal used by people because
- easier to read
- fewer digits represent the same value
- less likely digit written incorrectly
Hexadecimal used in colours - graphic designers chose colour they want by typing in hexadecimal
most use RGB colour coordinator - requires 24 bits as 8*3 = 24 but it is easier to remember colour with digits e.g FFA445
also used MAC address and memory dumps
convert denary and binary to hexadecimal
convert binary to hexadecimal
step 1 - split binary into nibbles
2 - covert nibbles corresponding hexadecimal
e.g 1100, 0100
1100 - C , 0100 - 4
C4
Convert denary to hexadecimal
1. covert denary into binary
2. convert binary to hexadecimal
e.g number 67 - 0100 , 0011
0100 = 4 0011 = 3 -> HD = 43
convert hexadecimal into binary and denary
convert into binary
1, split up each character
2. find corresponding nibble
e.g 4C 4 = 0100 C = 1100
0100 , 1100
covert into dinary
1. Convert into binary first , then convert into denary
5E 5 = 0101 E = 1110
0101 1100 -> 64+16+8+4 = 92
characters
binary used to represent characters from different languages
know letter - use binary calculate storage space and size of text file required
each character unique bit-pattern . Pattern used for each character becomes numeric character code.
ASCII - american standard code for imformation interchange - use 7 bits - allow 128 charcters represented. Character include letter , numbers , symbols. Eigth byte is used to store each character in a set and used as a parity bit for checking errors during execution of data
Extended ASCII - eight bits , used to represent more characters. Extended set varies in different countries - not useful global communications
Unicode - represents characters from all international langauges. examples UTF-16 and UTF-32 : 16 and 32 bits used per character . More bits allow more representation of symbols , arrows , signs.
Calculate file size - characters * 8 = 3 characters * 8 = 24 bits = 3 bytes
images
pixel - smallest element of bitmap image , only is one colour. All data is stored in 1s and 0s and each colour needs binary code assigned to it.
Bitmap image - image made by grid of pixels
colour depth - how much bits required to code for one colour . Depends on how much colours . 2 colours - one bit. 4 coulours - two bits . 8 colours - 3 bits. you root the number of coulours by two and find indicies . eg 16 is 2^4.
Image resolution - refers to how clear an image is . When you zoom in on an image , poor quality as pixels streched into larger blocks. Resolutione measured how mang pixels per ince e.g 330ppi - 330 pixels per inch. Image resolution also measure in area , by width of pixels * heigt of pixels.
Image file size = image resolution (width * heigth) * colour depth
e.g 4 * 6* 4 = 96 bits - 12 bytes
covert bited in KB or GB
Higher the colour depth - larger storage space required to save the image.
Smaller file size allows image download more quickly and images in emails less time to transmit.
Meta data - additional data stored along with pixel data in file size. Extra data
- Image data - width and height
- file format
- date and time of creation
- file formats - PNG , JPEG
sound
sampling - convert sound to analoque to digital
Analogie - sound waves : Digital - binary patterns
Computer takes measurements of analogue symbols regular time intervals - unique binary pattern identified each interval. Digitised sound processed by sequences 1's and 0's .
sample rate - how much signals pass through per second - equivalent to frequency - measure in hertz.
sample rate = number of samples * 1(seconds) = hertz
sample rate increase , improve sound quality
sample resolution (bit depth) - how much bits are required to store a sample e.g 4 bits - colour depth 4. 2^4 = 16 . 16 different samples stored. Higher bit depth , more accurate sound will be recorded, results higher quality audio file , leads to larger file size.
Bit rate - number of bits used to encode or transmit audio file over communication channel per second
Channel = time period
Bit rate = sampling rate * sample resolution * channel
e.g 30hz * 4 * 5s = 600 bits
compression
compression used for reducing file size e.g memory card or wireless communication link.
storage space limited so image uploaded to cloud storage or web server
store JPEG format - highly compressed
Sound compressed MP3 file - some people uncompressed audio format - WAV
Lossy compression - compression result loss of data. File compressed , data is removed and re-created from orginal data . Re-created data not the same copy but approximation of original data.
used for sound and images because data is lost without noticeable quality
files including words and numbers unsuitable for lossy compression because contents need to be exactly the same and noticeable differences will be spotted
Risks - original data is lost.
lossless compression - no data is lost in the process. Contents are identical to original file
Appropriate for data that cannot be approximated - such as documents containing numbers and letters.
Useful for PNG and GIFs
risks - produce low quality and result in bit depth quality lowering - not suitable for picture.
Comments
No comments have yet been made