Number Systems
Denary (Base 10, 0-9)
Binary (Base 2, 0 -1) (2024)
Hex(Base 16, 0 -9 and A-F) (2024)
Binary Manipulations
Binary Addition
0+0=0
0+1=1
1+0=1
1+1=10
Overflow error
When two binary numbers are added by a computer and an overflow error may occur due to:
The result of the calculation is greater than 255 // The value generated is larger than can be stored in the register
The result of the calculation would require more than 8 bits to be represented // A register has a predetermined number of bits and there are too many bits for it
Negative Binary numbers
Two's complement
Invert all the values in the binary numbers (1s to 0s and vice versa)
Add 1 to the result
Logical shift left (2024)
Each/All/Every value/digit/bit in the binary number is shifted/moved to the left
The left most/most significant bit is lost
A 0 is added as the right most/least significant bit
The binary integer is multiplied by 2
Text, images & sound
Converting text to binary
Uses Character set (2024)
ASCII (represents up to 256 characters, 7-bit encoding, limited/fewer characters/limited set of languages)
Unicode (represents up to 65000 characters, 8/16/32-bit encoding, more characters/includes many languages/emojis) (2024)
Converting images to binary
An image is made up of pixels
Pixels- One square/circle of one colour // the smallest component of the image
Each image has
Resolution: The number of pixels per set area/cm/inch // the number of pixels wide by the number of pixels high // number of pixels in an image
Colour depth: Represents each colour, 8-bit/32-bit (greater number of bits- greater the quality)
Converting sound to binary
Sound is made up of sound waves
When sound is recorded, this is done at set time intervals called Sound Sampling
Number of samples taken in a second is called the Sample rate (measured in Hertz, 1 Hz= 1 sample/second)
Number of bits that represents each sample is called the Sample Resolution
Example (How analogue sound is recorded and converted to digital):
(The analogue sound is) recorded using a microphone
The sound wave is sampled (measuring the height/amplitude)
Each amplitude has a unique binary value
The sample rate is set(number of samples taken per second)
The sample resolution is set(number of bits used for each sample)
Each sample taken is converted to binary
Data Storage
Bit (Smallest unit) [2024]
Nibble (1 Nibble = 4 bits) [2024]
Byte (1 Byte = 8 bits)
kibibytes (KiB)
mebibytes (MiB)
gibibytes (GiB)
tebibytes (TiB)
pebibytes (PiB)
exbibytes (EiB)
Calculating file size
Image
Image width * Image height * Colour depth * number of images
Sound
Sample rate * sample resolution * length of soundtrack (in seconds)
Data Compression
Benefits (2024)
Reduce the file size
Reduce storage space required
Increase transmission speed // Reduce transmission time//Takes less time to transmit
Quicker to upload/download
Less bandwidth is required for transmission
More likely to meet file size limits set by email clients/apps
Types
Lossy
Finds unnecessary/redundant data
used by image or sound files
Images
Colours that the human eye can not distinguish
reduces color depth/resolution/pixels
permanently removed
Sound
sounds that can not be heard by the human ear (using perceptual music shaping)
soft sounds
reducing sampling rate/resolution
Lossless
mainly used for text files
reduces size without permanently removing any data
Find repeating data
Group them
Lossless Compression in Images
Uses Run Length encoding (RLE) that finds, groups, and stores similar pixels
Image can be recreated without any loss