0% found this document useful (0 votes)
98 views24 pages

Open CompSci Notes - Unit 1 - MST Creator 2

This document provides an overview of different data representation systems including binary, hexadecimal, ASCII, and multimedia file formats. It discusses how to convert between number bases and perform basic operations in binary. It also covers topics like bit-mapped images, vector graphics, sound files, video, and lossless and lossy compression techniques.

Uploaded by

caroline.lekha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views24 pages

Open CompSci Notes - Unit 1 - MST Creator 2

This document provides an overview of different data representation systems including binary, hexadecimal, ASCII, and multimedia file formats. It discusses how to convert between number bases and perform basic operations in binary. It also covers topics like bit-mapped images, vector graphics, sound files, video, and lossless and lossy compression techniques.

Uploaded by

caroline.lekha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

AS Computer Science Table of Contents 9/14/2023

2023

Information Representation
and Multimedia
Unit 1

Abstract:
These are the notes for unit 1, Information representation in
multimedia for AS & A level Chemistry.

Note:
These notes may not be completely accurate so please forgive
me for any oversights, please contact me via website chat or
email if you find any problems.

By Sarem Tahir Muhammad Sarem Tahir


Information Representation and Multimedia Page 0
AS & A Levels
9/14/2023
AS Computer Science Table of Contents 9/14/2023

Table of Contents
Table of Contents ............................................................... 1
Data Representation ............................................................. 3
Number Systems ................................................................ 3
Binary Numbering System ....................................................... 3
Conversions ................................................................. 3
Addition & Subtraction ...................................................... 5
Measurement of the Size of Computer Memories ................................ 9
Hexadecimal System ............................................................ 9
Converting Hexadecimal to Binary ............................................ 9
Converting Binary to Hexadecimal ........................................... 10
Use(s) of the Hexadecimal System ........................................... 10
Binary Coded Decimal (BCD) System ............................................ 11
Half Byte Method ........................................................... 11
Complete Byte Method ....................................................... 11
Uses of BCD ................................................................ 11
BCD Addition ............................................................... 12
ASCII & Unicode .............................................................. 12
Standard ASCII ............................................................. 12
Extended ASCII ............................................................. 12
Unicode .................................................................... 13
Multimedia ..................................................................... 13
Bit-map Images ............................................................... 13
Storing Bit-map Images ..................................................... 13
File Header ................................................................ 14
Vector Graphics .............................................................. 15
Vector Graphics vs Bit-map Images .......................................... 15
How to choose between the two .............................................. 16
Sound Files .................................................................. 16
Sound Varies ............................................................... 17
Vocabulary Time! ........................................................... 17
Pros & Cons of High Sampling Rate/Resolution ............................... 17

By Sarem Tahir Information Representation and Multimedia Page 1


AS Computer Science Table of Contents 9/14/2023
Sound Editing Software ..................................................... 17
Video ........................................................................ 18
File Compression ............................................................... 18
Lossless & Lossy Compression ................................................. 18
Applications ................................................................. 18
MPEG-3 or MP3 (Audio) ...................................................... 18
MPEG-4 or MP4 (Video) ...................................................... 19
Photographic (bit-map) Images .............................................. 19
Run-Length Encoding (RLE) .................................................. 19
General Methods of Compressing Files ......................................... 21
Sources (and Resources) Used ................................................... 22
Licence Information ............................................................ 22

By Sarem Tahir Information Representation and Multimedia Page 2


AS Computer Science Data Representation 9/14/2023

Data Representation
Number Systems
There are 3 main number systems which we need to be aware of.
We have already learnt this in IGCSE so I will summarize most of it into this
nifty little table:
Name Binary Denary Hexadecimal
Base Base-2 Base-10 Base-16
Example Uses Computers Everyday language Color codes
What does “base” mean?
When we say “base”, we are referring to the number of digits used by the
numbering system.
For example, the denary system is base 10 meaning it can use 10 digits (0 – 9).

Binary Numbering System


The binary system uses 1s and 0s which gives us these weights:
128 64 32 16 8 4 2 1
27 26 25 24 23 22 21 20

Conversions
Binary to Denary
Let’s say we want to convert 11010001 to denary:
1 1 0 1 0 0 0 1
Now, write down the weightings above the digits:
128 64 32 16 8 4 2 1
1 1 0 1 0 0 0 1
Now, we multiply the weight values with the binary values:
128 64 32 16 8 4 2 1
1 1 0 1 0 0 0 1
128 64 0 16 0 0 0 1
Finally, add up the final values:
128 + 64 + 16 + 1 = 209

By Sarem Tahir Information Representation and Multimedia Page 3


AS Computer Science Data Representation 9/14/2023
Denary to Binary
Let’s say we want to convert 156 to binary.
First up, write down the weights:
128 64 32 16 8 4 2 1

Now, the trick is to take the biggest weight which is smaller than the value and
put a one there.
In this case, 128 is the biggest weight which fits into 156.
128 64 32 16 8 4 2 1
1
Now, subtract the weight you chose in step one and then find the biggest weight
which is smaller than the answer.
In this case, 156 – 128 is 28.
The biggest weight which can fit in the number 28 is 16.
128 64 32 16 8 4 2 1
1 1
Now, do step 2 over and over until we have nothing left.
So, 28 – 16 = 12 and the largest weight which goes in 12 is 8.
12 – 8 is 4 and the largest weight which fits into 4 is 4.
So we end up with:
128 64 32 16 8 4 2 1
1 1 1 1
Now, fill the rest of the empty spaces with 0:
128 64 32 16 8 4 2 1
1 0 0 1 1 1 0 0
This means that the binary for 156 is 10011100.

By Sarem Tahir Information Representation and Multimedia Page 4


AS Computer Science Data Representation 9/14/2023
Addition & Subtraction
One’s Complement
When we use one’s complement, we simply invert each digit.
For example, let’s say we need to perform one’s complement on 11010011
(211 in denary).
First, let’s write down the value:
1 1 0 1 0 0 1 1

Now, just invert the digits (1 to 0 and 0 to 1):


1 1 0 1 0 0 1 1
0 0 1 0 1 1 0 0
This gives us 00101100 which is -211.
Two’s Complement
When we use two’s complement, we invert each digit and add 1.
For example, let’s say we need to convert 01011010 (90 in denary).
First, we invert the digits of the binary value:
0 1 0 1 1 0 1 0
1 0 1 0 0 1 0 1
Now, we add a 1 to the value:
1 0 1 0 0 1 0 1
+ 1
1
1 0 1 0 0 1 1 0
Note: When we add 1 and 1, we carry 1 to the next digit and 0 remains

This gives us 10100110 (binary for -90).


Binary Addition
Let’s look at a few examples:
Example 1
Add 00100101 (37) with 01011111 (58).
First, write down the weights and the binary numbers:
-128 64 32 16 8 4 2 1
0 0 1 0 0 1 0 1
0 0 1 1 1 0 1 0
You may notice that we have a -128 weight, this is for the two’s complement used
for binary subtraction.
By Sarem Tahir Information Representation and Multimedia Page 5
AS Computer Science Data Representation 9/14/2023
Now, we simply add each digit.
-128 64 32 16 8 4 2 1
0 0 1 0 0 1 0 1
0 0 1 1 1 0 1 0
1
0 1 0 1 1 1 1 1
There are 4 main rules of addition:
1. 0 + 1 = 1
2. 0 + 0 = 0
3. 1 + 1 = 0 remainder 1
4. 1 + 1 + 1 = 1 remainder 1
Example 2
Let’s say we want to add 00110111 (55) with 00011100 (28):
First, write down the weights and the binary numbers:
-128 64 32 16 8 4 2 1
0 0 1 1 0 1 1 1
0 0 0 1 1 1 0 0
Now, we add them up using the previous technique:

This leaves us with the binary value of 01010011 which is 83 in denary.

By Sarem Tahir Information Representation and Multimedia Page 6


AS Computer Science Data Representation 9/14/2023
Binary Subtraction
When we do binary subtraction, it’s a bit complicated.
Basically, instead of simply subtracting the way we did in addition, we perform
two’s complement on one of the values and then add them together.
Example 1
Perform 69 – 21.
1. Convert the numbers to binary:
69 = 01000101
21 = 00010101
2. Find the two’s complement for the second value (21 in this case):
First we invert:
0 0 0 1 0 1 0 1
1 1 1 0 1 0 1 0
Then we add 1:
1 1 1 0 1 0 1 0
+ 1
1 1 1 0 1 0 1 1
This gives us 11101011 (-21).
3. Now, we add the two’s complement value with the first value (69):
-128 64 32 16 8 4 2 1
0 1 0 0 0 1 0 1
1 1 1 0 1 0 1 1
1 1 1 1 1
1 0 0 1 1 0 0 0 0
So we end with 100110000.
However, we have 9 bits instead of 8, this means that there is an “overflow”.
This overflow bit is simple omitted which leaves us with 00110000 (48).

By Sarem Tahir Information Representation and Multimedia Page 7


AS Computer Science Data Representation 9/14/2023
Example 2
Carry out the subtraction 11-53.
1. Convert the numbers to binary:
11 = 00001011
53 = 00110101
2. Find the two’s complement for the second value (53 in this case):
First we invert:
0 0 1 1 0 1 0 1
1 1 0 0 1 0 1 0
Then we add 1:
1 1 0 0 1 0 1 0
+ 1
1 1 0 0 1 0 1 1
This leaves us with 11001011 (-53).
3. Now, we add the two’s complement value with the first value (11):
-128 64 32 16 8 4 2 1
0 0 0 0 1 0 1 1
1 1 0 0 1 0 1 1
1 1 1
1 1 0 1 0 1 1 0
So we end with 11010110 (-43).
How to Check the Answer?
Obviously, we need a way to check if our answer was correct.
Let’s take 11-53 as an example, here we got the answer as 11010110.
To check if this is -43, we first put it in the weights:
-128 64 32 16 8 4 2 1
1 1 0 1 0 1 1 0
Now, we multiply each value with its corresponding weight and add them up:
-128 64 32 16 8 4 2 1
1 1 0 1 0 1 1 0
-128 64 0 16 0 4 2 0
-128 + 64 + 16 + 4 + 2 = -42
And BOOM, done.

By Sarem Tahir Information Representation and Multimedia Page 8


AS Computer Science Data Representation 9/14/2023
Measurement of the Size of Computer Memories
There are 2 systems which are used for computer memory, the book doesn’t give any
specific names but we can call them the “binary system” and “decimal system”.
Decimal System Binary System
The system we are used to is the This is a system which is much more
decimal system, this one uses units accurate than the decimal system; this
which are to the powers of 10s. is because in reality, memory is
measured in powers of 2.
Name Short Form Bytes
1 Kilobyte 1 KB 1 × 103 Name Short Form Bytes
1 Megabyte 1 MB 1 × 106 1 Kibibyte 1 KiB 210
1 Gigabyte 1 GB 1 × 109 1 Mebibyte 1 MiB 220
1 Terabyte 1 TB 1 × 1012 1 Gibibyte 1 GiB 230
1 Petabyte 1 PB 1 × 1015 1 Tebibyte 1 TiB 240
1 Pebibyte 1 PiB 250

Hexadecimal System
This system is very similar to the binary system with the only difference being
that it uses powers of 16.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0 1 2 3 4 5 6 7 8 9 A B C D E F

Converting Hexadecimal to Binary


This is done in the reverse of the binary to hexadecimal method.
Let’s say we want to convert 7D to binary:
1. We split the digits into 2 groups and then make 4 sub-groups with weights:
Group 2 Group 1
7 D
8 4 2 1 8 4 2 1
2. Since we have a letter, we should know what number it is.
In this case, it’s D which is 13.
Now, we do the same thing we did with binary conversions where we shared the
number into the weights:
Group 2 Group 1
7 D
8 4 2 1 8 4 2 1
0 1 1 1 1 1 0 1
3. This leaves us with 01111101.

By Sarem Tahir Information Representation and Multimedia Page 9


AS Computer Science Data Representation 9/14/2023
Converting Binary to Hexadecimal
Let’s say we wish to convert 110111001 to hexadecimal.
1. Split the binary value into groups of 4:
Group 3 Group 2 Group 1
1 1011 1001
Now, since group 3 is not completely filled.
Just put 0s like so:
Group 3 Group 2 Group 1
0001 1011 1001
2. Now, write down a weight above each digit for each group:
Group 3 Group 2 Group 1
8 4 2 1 8 4 2 1 8 4 2 1
0 0 0 1 1 0 1 1 1 0 0 1
3. Now, multiply each of the 1s and 0s with the weightings and add them up:
Group 3 Group 2 Group 1
8 4 2 1 8 4 2 1 8 4 2 1
0 0 0 1 1 0 1 1 1 0 0 1
1 8 2 1 8 1
1 8 + 2 + 1 = 11 8 + 1 = 9
4. Now, we can determine which values are letters and then simply join them:
1 stays the same, 11 is B, and 9 stays the same.
This gives us “1B9”.

Use(s) of the Hexadecimal System


The hexadecimal system has a bunch of uses, this includes:
1. Memory dumps
2. HTML colour codes
3. IP Addresses
4. MAC Addresses
More on Memory Dumps
When we use hexadecimals, it makes much easier for us to read.
This is why we use hexadecimal when developing software which makes error tracing
easier.
For example, when the memory contents are output to a printer/monitor, this is
called a memory dump.

By Sarem Tahir Information Representation and Multimedia Page 10


AS Computer Science Data Representation 9/14/2023
Binary Coded Decimal (BCD) System
This system uses a 4-bit code to represent each denary digit.
Here’s a quick cheat sheet section:

0 0 0 0 = 0 0 0 1 0 = 2 0 1 0 0 = 4 0 1 1 0 = 6 1 0 0 0 = 8
0 0 0 1 = 1 0 0 1 1 = 3 0 1 0 1 = 5 0 1 1 1 = 7 1 0 0 1 = 9
These codes are stored in 2 ways:

Half Byte Method Complete Byte Method


This is when the value takes up half a This is when each value takes up a
byte each since each code is 4 bits. complete byte.
Example: Example:
Store 3615 using BCD. Store 3615 using BCD.
0 0 1 1 0 1 1 0 0 0 0 0 0 0 1 1 3
0 0 0 1 0 1 0 1 0 0 0 0 0 1 1 0 6
This method is much more storage 0 0 0 0 0 0 0 1 1
efficient as compared to the complete 0 0 0 0 0 1 0 1 5
byte method but does not allow us to This method is more costly in storage
have extra information such as but allows us to store more information
negatives or operators. in each value.

Uses of BCD
BCD is used mainly to represent and perform operations on numbers.
BCD is used in accounting systems, calculators, clocks, etc.
One common question is that why not just use binary addition instead?
Well, the answer is that binary addition isn’t entirely accurate which is why we
do not use it in our systems (failing math exams because of your calculator is
nightmare fuel).
Instead, we use BCD which is much more accurate as compared to binary addition.

By Sarem Tahir Information Representation and Multimedia Page 11


AS Computer Science Data Representation 9/14/2023
BCD Addition
Let’s say we want to add 0.04 and 0.07.
1. First, we write down the BCD values of each:
0 0 4 0 0 7
8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1
2. Now, we add the values: 4. Now, we add 1 to the next value (0
in this case):
0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1
1 1
0 0 0 0 0 0 0 0 1 0 1 1
3. As we know, 1011 is 11 but that is 0 0 0 0 0 0 0 1 0 0 0 1
not part of BCD which is why we add 5. This ends up giving us 0000 0001
0110: 0001 which is 0 1 1 which is
correct once formatted into the
decimal place: 0.11.

ASCII & Unicode


Standard ASCII
Some important points:
→ Used to represent letters, numbers, special characters, control codes, etc.
→ Consists of 7 bit codes (0-127).
→ Each character has a different code (uppercase and lowercase a would have
different values despite being the same letter).
→ Supports mainly English.
Note: We are probably going to be given the ASCII table if needed.

Extended ASCII
This character set is different to the standard ASCII set:
→ Consists of 8 bit codes (takes more space than standard ASCII).
→ Supports more languages (mainly European).

By Sarem Tahir Information Representation and Multimedia Page 12


AS Computer Science Multimedia 9/14/2023
Unicode
Since computers were being used all over the world, we needed a system which
supports other languages too (not only a handful of European languages), this is
exactly what Unicode did.
A few important points:
→ Can support many languages (Urdu, Hindi, Arabic, German, English, etc.).
→ Consists of 16-bit codes and 32-bit codes (Takes MUCH more space than Extended
ASCII & Standard ASCII).
→ A superset of both extended ASCII and Standard ASCII.
Note: the 16-bit and 32-bit codes refer to separate systems.
Both systems are knows as encodings and have pros and cons (not needed).

Multimedia
Bit-map Images
Bit-map image is an image made up of pixels stored in a 2D matrix.
A pixel is simply the smallest picture element which makes up an image.

Storing Bit-map Images


First thing we need to look at is the number of bits we have per pixel because
some images may use more colors than the other:
→ For color images, we need at least 8 bits per pixel which gives us 256 possible
colors of varying intensity.
→ True color images require 24 bits per pixel giving us around a million colors.
→ Black & white images require 1 bit per pixel.
Bit-Depth vs Colour-Depth
Colour Depth refers to the number of Bit depth refers to the number of bits
bits used to represent the number of needed to represent the smallest unit
colours in each pixel. in a file (such as audio or image
file).
The formula to find colour depth is:
Bit-depth has the same formula as
2𝐶𝑜𝑙𝑜𝑢𝑟 𝐷𝑒𝑝𝑡ℎ = 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑜𝑙𝑜𝑢𝑟𝑠 colour depth.
A black and white image has 2 colours,
and 21 is 2 therefore the number of bits
needed for each pixel is 1.

The main difference between the two is that colour depth is related only to
colour but bit depth has many uses with a range to different file formats.
By Sarem Tahir Information Representation and Multimedia Page 13
AS Computer Science Multimedia 9/14/2023
Image Resolution vs Screen Resolution
Image resolution Screen resolution
This refers to the number of pixels it This refers to the number of horizontal
takes to form an image. and vertical pixels used to make the
The formula for this is: screen display.

𝐻𝑒𝑖𝑔ℎ𝑡 𝑊𝑖𝑑𝑡ℎ 𝐼𝑚𝑎𝑔𝑒 The formula for this is:


× =
(𝑖𝑛 𝑝𝑖𝑥𝑒𝑙𝑠) (𝑖𝑛 𝑝𝑖𝑥𝑒𝑙𝑠) 𝑅𝑒𝑠𝑜𝑙𝑢𝑡𝑖𝑜𝑛 𝑆𝑐𝑟𝑒𝑒𝑛 𝐻𝑒𝑖𝑔ℎ𝑡 𝑆𝑐𝑟𝑒𝑒𝑛 𝑊𝑖𝑑𝑡ℎ 𝑆𝑐𝑟𝑒𝑒𝑛
× =
For example, if we have a logo with the (𝑖𝑛 𝑝𝑖𝑥𝑒𝑙𝑠) (𝑖𝑛 𝑝𝑖𝑥𝑒𝑙𝑠) 𝑅𝑒𝑠𝑜𝑙𝑢𝑡𝑖𝑜𝑛
resolution of 500x500, the image For example, a display with the
resolution would be 500 × 500 which is resolution of 1920x1080, the screen
250,000 pixels. resolution would be 1920 × 1080 which
gives us 2,073,600.

The main difference between the two is that image resolution stays the same
(unless we reduce the resolution with compression) and is related only to the
image, screen resolution is related to the display and may change for computer to
computer (there are many resolutions from 800x600 to 1920x1080).
What Does Changing Resolution Do?
Resolution Type Change Effect
1. If the screen resolution was less than the image
Resolution
resolution before, then the image would become
Screen Increase
less fuzzy.
Resolution
Resolution 1. May become fuzzy if the screen resolution is less
Decrease than the image resolution.
Resolution 1. Image becomes clearer and carries more detail.
Increase 2. File size increases.
Image
1. Image quality may reduce due to lower resolution
Resolution Resolution
as the amount of pixels for the image is less.
Decrease
2. File size decreases.
Calculating File Size
To calculate the file size of an image, we use the following formula:
𝐹𝑖𝑙𝑒 𝑆𝑖𝑧𝑒 (𝑖𝑛 𝑏𝑖𝑡𝑠) = 𝑅𝑒𝑠𝑜𝑙𝑢𝑡𝑖𝑜𝑛 × 𝐵𝑖𝑡 𝐷𝑒𝑝𝑡ℎ
To find Bit Depth, we use the formula: To find resolution we use the formula:
𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝐵𝑖𝑡𝑠 = 2𝐵𝑖𝑡 𝐷𝑒𝑝𝑡ℎ 𝐻𝑒𝑖𝑔ℎ𝑡 𝑊𝑖𝑑𝑡ℎ
𝑅𝑒𝑠𝑜𝑙𝑢𝑡𝑖𝑜𝑛 = ×
(𝑖𝑛 𝑝𝑖𝑥𝑒𝑙𝑠) (𝑖𝑛 𝑝𝑖𝑥𝑒𝑙𝑠)
File Header
When we save a bit-map image, we need to include a file header which contains
items such as file type, file size, image resolution, etc.

By Sarem Tahir Information Representation and Multimedia Page 14


AS Computer Science Multimedia 9/14/2023
Vector Graphics
Vector graphics are images which use 2D points to describe lines and curves and
their properties that are grouped to form geometric shapes.
These are designed using CAD software using an app which uses a drawing canvas on
the screen.
Vector graphics also contain a drawing list (included in the file header) which
is made up of:
→ The command used for each object in the graphic.
→ The attributes which define the properties that make up each object (these
include the brush thickness, position of points, etc.).
→ The relative position of each object is also included.
→ The dimensions of each object are not defined, but the relative positions of
objects to each other in the final graphic need to be defined; this means that
scaling the graphic will not cause loss of quality.

Vector Graphics vs Bit-map Images


Vector Graphics Bit-map Images
Made up of geometrical shapes which Made up of tiny pixels of different
require definitions/attributes. colours.
We need to change each shape if we wish It is possible to alter/edit each of the
to change the design. pixels to change the image design.
Do not take lots of space as the image These take lots of space as they use
is made up of simple shapes. pixels and are more detailed.
Does not work with realistic images due
Works with realistic images as the
to the limited number of shapes we can
images are built up pixel by pixel.
use.
File formats are .svg, .cgm, etc. File formats are .bmp, .jpeg, etc.

By Sarem Tahir Information Representation and Multimedia Page 15


AS Computer Science Multimedia 9/14/2023
How to choose between the two
There are many questions which ask us to choose which image some imaginary person
should use.
When we are shown such questions, we must consider 4 things:
1. Does the image need to be resized?
→ If yes, then we should use a vector graphic as scaling them does not change
quality.
2. Does the image need to be drawn to scale?
→ If yes, then we should use a vector graphic.
3. Does the image need to be realistic?
→ If yes, we should use a bit-map image as they allow us to make realistic
images.
4. Do we have any file size restrictions?
→ If yes, then we should also consider whether or not we should use vector
graphics or bit-map images.
→ Once decided, we decide on how we can reduce the file size.
► If it was a vector graphic, then it shouldn’t be a problem as they barely
take space.
► If it was a bit-map image, then it’s best to reduce something like the
resolution.

Sound Files
Sound requires a medium through which it travels through, this is because sound
is transmitted by cause oscillations of particles within the medium.
Our ears pick up these oscillations and interpret them as sound.
Each sound wave has the following:
1. Frequency
2. Wavelength
3. Amplitude (determines the loudness of the sound)

By Sarem Tahir Information Representation and Multimedia Page 16


AS Computer Science Multimedia 9/14/2023
Sound Varies
The thing about sound is that it is an analogue value meaning that it varies
heavily and cannot really be stored digitally.
We can convert sound into a digital value to store it, this is done using an ADC
(analogue to digital converter).
How to Convert from Analogue to Digital
This is done by sampling the sound waves at a given time rate, this is what
defines the quality and accuracy of the digital version to the original.
Since we cannot measure the amplitude accurately, we also store it at approximate
values.
We also remove frequencies which are outside the hearing range of humans, this
greatly reduces the amount of measurements and the file size as well.

Vocabulary Time!
Sampling Resolution: Number of bits used to represent sound amplitude (bit rate).
Sample Rate: Number of sound samples taken per second.

Pros & Cons of High Sampling Rate/Resolution


Pros Cons
Larger dynamic range. Larger file size due to increased samples.
Better sound quality. Takes longer to transfer/transmit files.
Less distortion in the sound. Takes more processing power.

Sound Editing Software


There are many software used for editing sound files (such as Audacity).
Most programs used to edit sound have the following general features:
1. Edit the start/stop times of sound. 5. Convert to different audio formats
2. Extract parts of the sound. (.wav, .mp3, etc.).
3. Fade in and out effects. 6. Remove background noise.
4. Merge different sounds. 7. Delete parts of the sound.

By Sarem Tahir Information Representation and Multimedia Page 17


AS Computer Science File Compression 9/14/2023
Video
There are many specialist cameras however we also have cameras in our phones.
These take a lot of photos and simply stitch them, these are called “digital
video cameras”.
They take a lot of compressed JPEG images at a speed of 25mb per second, this is
called motion JPEG.
When we record a video one important term we should know is frame rate which
refers to the number of frames we record per second.

File Compression
Lossless & Lossy Compression
Lossless Lossy
This compression technique makes it so This compression technique deletes all
that we can decompress the file to get the data which does not contribute in
it original form back. making the original detail.
Examples include spreadsheets or Examples include mp3 files, mp4 files,
lossless JPEG. etc.

Applications
MPEG-3 or MP3 (Audio)
MP3 uses many audio compression techniques which allow us to reduce the final
file’s size to 90% of the original and gives us an mp3 file.
MP3 files are played by various devices such as music player, phones, computers,
etc.
While they do reduce the file size, they also reduce audio quality.
Obviously, this loss of quality is hardly noticeable but an mp3 file can never
match up to the quality of an original CD or DVD.
Perpetual Music Shaping
This is one of the techniques we use and it does the following:
Name Description
Removal of This is when we remove sounds which are outside the hearing
unneeded sounds range of humans.
This happens in sections where 2 or more sounds are played, we
Removal of Soft
simply remove the softer ones as they are masked by the louder
Sounds
ones.

By Sarem Tahir Information Representation and Multimedia Page 18


AS Computer Science File Compression 9/14/2023
Bit-Rate
Bit-rate refers to the number of bits per second that can be transmitted over a
network.
This means that the bit-rate also affects the audio quality.
Pros and Cons of High Bit-Rate
Pros Cons
Higher audio quality. File size is increased.
Less distortion.
A bit-rate over 200 kilobits/sec is usually enough to give us audio quality close
to a CD.

MPEG-4 or MP4 (Video)


This file format allows us to compress multimedia files rather than just audio.
This uses various different techniques ranging from MP3 audio compression to the
JPEG image compression alongside many others.
This format also makes it hard for us to tell the compressed version apart from
the uncompressed one.

Photographic (bit-map) Images


Bit-map Images Vector Graphics
When we compress bit-map image Scalable vector graphics (.svg) are
compression, we reduce both the file stored in .xml text files which allow
size and the image quality. compression as we can simply compress
A common file format for images is JPEG the text.
which uses lossy file compression.
Once compressed using the JPEG
compression algorithm, we can no longer
retrieve the original file.

Run-Length Encoding (RLE)


RLE is a lossless compression technique which reduces the size of a string of
adjacent, identical data.
The Format
When we compress data using RLE, we write 2 values:

By Sarem Tahir Information Representation and Multimedia Page 19


AS Computer Science File Compression 9/14/2023
The Problem
The main problem with using RLE is that it works only for repeated data rather
than data with patterns or with unique value.
Using RLE on data which is random or unique usually causes the size to increase.
RLE in Text
Without Flags
Let’s say we wish to compress “aaaaabbb” using RLE, we do the following:
1. Split the repeated sections:
aaaabbb
0
aaaa bbb
2. Note down the ASCII values of the letters which are repeated:
aaaabbb
aaaa bbb
97 98
3. Write down the number of times the letter is repeated on the left side of the
ASCII value:
aaaabbb
aaaa bbb
97 98
4 3
4 97 3 98
4. This gives us “4 97 3 98” which takes much less space as compared to “aaaabbb”.
With Flags
The main problem with RLE is when we must compress data with both jumbled and
repeated data.
To cope with this, we have flags.
A flag is defined like this:

By Sarem Tahir Information Representation and Multimedia Page 20


AS Computer Science File Compression 9/14/2023
RLE in Images
Black & White Images
Let’s say we need to use RLE for the image on the
right.
We can take the white blocks as value 1 and the black
ones as value 0.
For each repeated colour block, we can simply count the
number of white blocks and then attach the colour
value.
The colour values would be:
8W 5B 2W 1B 6W 5B 6W 1B 2W 5B 8W
Now we can replace the colour values with the colour
values:
81 50 21 10 61 50 61 10 21 50 81
Coloured Images
Similar to the black & white images, we do the same
process for coloured images.
The only difference is that the values of each
colour are in RGB values as opposed to 1s and 0s.
That gives us a value like so:
2 255 0 0 2 0 0 255 3 255 0 0 1 0 0 0 2 0 0 255 1 0
0 0 1 255 0 0 12 0 0 255 1 255 0 0 1 0 0 0 2 0 0 255
1 0 0 0 3 255 0 0 2 0 0 255 2 255 0 0 Square Red Green Blue
Colour
0 0 0
0 0 255
255 0 0
General Methods of Compressing Files

Reduce the
sampling rate
Crop the image

Reduce the Decrease


Movie Files
sample resolution
Image Files
colour/bit depth

Reduce the frame Reduce image


rate resolution

By Sarem Tahir Information Representation and Multimedia Page 21


AS Computer Science Sources (and Resources) Used 9/14/2023

Sources (and Resources) Used


Most of the information has come from the AS & A Level Computer Science Student
Book by Hodder Education.
Other resources/tools have also been used and are listed below:

Name Link Use


Sir Majid Tahir’s Notes LINK Mainly understanding
concepts to make them
ZNotes LINK simpler
Designing of figures and
Canva LINK
diagrams
GIMP 2.10.30 LINK Diagrams & Figures
Geogebra LINK Vector diagrams
AS/A Level Syllabus LINK Checking syllabus
Word 2010 LINK Creating the notes
Word 365 LINK Exporting and stuff

Licence Information
AS Level Computer Science Notes (Chapter 1) © 2023 by Muhammad Sarem Tahir is
licensed under Attribution-NonCommercial-NoDerivatives 4.0 International. To view
a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/
License Deed

By Sarem Tahir Information Representation and Multimedia Page 22


AS Computer Science Licence Information 9/14/2023
2023

Information Representation
and Multimedia
Unit 1

Final Words
I hope this resource was useful for you!
This resource is just one of the many resources I have made
till now.
You can find all the other resources at my website.
This includes resources such as revision notes, topical past
papers, and many other helpful resources.

I also work on other projects such as games, art, game assets,


etc.!

By Sarem Tahir Information Representation


AS Level Computer and
Science Notes (Chapter Multimedia
1) © 2023 by Muhammad Page
Sarem Tahir is licensed 23
under CC BY-NC-ND 4.0. To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-nd/4.0/

You might also like