Please enable JavaScript.
Coggle requires JavaScript to display documents.
1.Information representation, Binary addition - Coggle Diagram
1.Information representation
Binary is a base 2 system, written as 10112
Denary is a base 10 system
A computer has millions of switches (1s and 0s)
Prefixes for bytes:
kB = 1000 bytes
MB = 1,000,000 bytes
GB = 1,000,000,000 bytes
TB = 1,000,000,000,000 bytes
New prefixes for bytes:
KiB = 2^10 = 1024 bytes
MiB = 2^20 = 1,048,576 bytes
GiB = 3^30 = 1,073,741,824 bytes
TiB = 2^40 = 1,099,511,627,776 bytes
Range of positive binary numbers:
Number of bits determines how many values can be represented in binary
0...2^n - 1
Negative binary
Two's complement
Found by flipping all of the bits in a positive binary value and adding 1
Two's complement range:
The number of values that can be represented is the same as for positive binary numbers
However, half the range of values now represents negative numbers
Equation for range: -(2^(n-1)) ... 2^(n-1) -1
Subtraction with two's complement:
Two's complement can be used to ensure subtraction will occur when adding negative values
For example, 65 + -43 = 22 so we can add together a positive and a negative binary number instead of subtracting as it has the same result
One's complement
Flip all of the bits of a positive binary number to find its corresponding negative value
Sign and magnitude
The first (most left) bit of a binary number is assigned either 0 (positive) or 1 (negative), depending on whether the number is positive or negative
Hexadecimal
Benefits of hex
Easier to read and remember than binary
Quicker to type than binary, as a hex digit only take up one character, rather than 4 binary bits
Less chance of making an error
Easy to convert to and from binary
A base 16 number system, using values from 0 - F
A single hex digit is represented by 4 bits (eg. 0100)
Uses of hex
Memory dumps:
It is much easier to work with B5A4 than 1011010110100100
Hex is often used when trying to trace errors , as it is more manageable than using binary
Settings colours on web pages
:
RGB values of colours are represented by hex (eg. 3D7EB5
MAC addressing
Media Access Control
12 digit hexadecimal number
Identifies internet enabled devices
Created during the manufacturing process
Usually 48 bits long
Binary Coded Decimal (BCD)
BCD represents denary integers using blocks of four binary digits
eg. 1001 0011 = 93
Uses of BCD
Representation of digits in a calculator/ digital clock display
Enables fast conversions from denary to binary (eg. pocket calculators)
BCD calculation is also important (look up a YouTube video idk)
ASCII
American Standard Code for Information Interchange
Each character on the keyboard has a unique ASCII value
Extended ASCII has 8 bits to represent extra characters
Unicode
16 or 32 bits
Provides a standard across all documents where ASCII can exchange
If 32 bit ASCII is used 4,294,967,296 possible characters can be represented, enough for all known languages
Images
How a camera works:
A light sensor measures and approximates the intensity of colour in each pixel
The image is projected onto a grid of photosensitive receptors
The colour of each pixel is converted into binary using an ADC and a digital representation of the image is stored
Bitmap images
Each pixel has a colour (binary) value
Created using a grid of pixels
Types of bitmap file:
BMP
JPG
GIF
PNG
TIF
Resolution - the number of pixels in an image
Colour bit depth- the amount of bits used to describe the colour of each pixel. The higher the bit depth, the more colours that can be represented
File size: width x height x colour bit depth
A bitmap image is larger than the size of the image due to metadata: date created, resolution, colour depth, where the photo was taken
Vector images
Made up of geometric shapes such as lines, curves, arcs and polygons
The properties of each shape are stored and retrieved in order to mathematically redraw the shape
Properties stored:
Shape type and position
Fill colour
Line colour and weight
Length and width or radius
Benefits of vector images:
Vector images won't lose quality when they are resized
Vector images have a much smaller file size
Vector images load and transmit faster due to their smaller file sizes
Negatives of vector images:
Can't replicate images that aren't made of simple shapes, such as photos of people
Usually used for company logos
Sounds
Analogue vs digital
Analogue to digital conversion:
Analogue sound samples are recorded via an amplifier
Each sample is quantised to measure its wave height and translate this into an integer value
The integer value is then converted and stored digitally as a binary value
Analogue signals are continuous
Digital signals are discrete
ADC (Analogue to digital converter): microphone
DAC (Digital to analogue converter): speaker
Sampling
The process of converting analogue sounds into digital form
A series of readings at fixed intervals are taken from the analogue wave to create discrete data values
These readings are stored as binary
The amplitude of the sound wave is referred to as the
sample resolution (audio bit depth)
Sample rate
- the number of times the sound is sampled per second (Hz). Higher sample rate = greater accuracy of sound
File size = sample rate x audio bit depth (resolution) x length of track x number of channels
Nyquist Theorem
Samples must be twice the highest frequency in order to replicate the original sound wave
E.g. a sound with a frequency of 10,000Hz must be sampled at a minimum of 20,000Hz in order to accurately reproduce the original
MIDI
Musical Instrument Digital Interface
A synthesised sound
Creates sounds as requested
A MIDI controller carries 'event messages' that specify pitch and duration of a note, timbre, vibrato, volume changes, and synchronize tempo between multiple devices
Benefits of MIDI:
MIDI messages usually only 2 or 3 bytes long (can use 1000x less disk space than a conventional recording
The instrument can be changed
Reduces amount of data transferred
Quality can be higher than a conventional recording since no data is lost
Allows for a wide range of musical instruments and computers to communicate with each other
Data compression
Benefits of compression:
Data sent more quickly
Less bandwidth used
Buffering on audio and video streams is less likely to occur
Less storage is required
Lossy compression
Non-essential data is permanently removed
Tries to reconstruct an image without the missing data
MP3
Perceptual music shaping:
Quieter notes played at the same time as louder sounds are removed
Lossy compression removes the sound in the frequency ranges that we can't easily hear
MP3 music quality never matches the original audio quality, but the quality is satisfactory for most purposes
MP3 files can't be uncompressed
Lossless compression
Records patterns in the data
No data is lost
Less compression than lossy
RLE (Run-Length Encoding)
Repeating string is encoded into 2 values - the first value represents the number of identical data items in the run, the second value represents the code of the data item
Summarises consecutive patterns of the same data in 2 bytes
Quality doesn't change
RLE of sound:
The same note played for a fraction of a second could result in hundreds of identical samples
RLE records one example of the sample and how many times it repeats
Dictionary compression
Spots regularly occurring data and stores it separately in a dictionary
The dictionary is stored alongside the file so the file size is slightly larger than the compressed file
Binary addition
Computers are built from combinations of electronics called logic gates
Binary addition rules:
0 + 0 = 0
0 + 1 = 1
1 + 1 = 10
1 + 1 + 1 = 11
Overflow error: when the result of an addition is too large for the number of bits the computer works with, there will be an overflow error