0% found this document useful (0 votes)
7 views

Chapter 1-1

Uploaded by

rashidbhatti40
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Chapter 1-1

Uploaded by

rashidbhatti40
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 174

0101110 CHAPTER 1.

1
AE73F9?
?

Number
System
Binary
System
Motivation
Why Binary System
• Any form of information needs to be converted into a binary format so
that it can be processed by a computer
• Computer contains millions and millions of tiny switches, which can be
turned on and off.
• Therefore, the binary system is chosen as the way for a computer to
represent any sort of data.

On = 1 Off =
0
Explanation
Denary System

Eg.
365 102 =100 101 =10 100 =1

3 6 5
Explanation: Multiply the digit value (eg.3) by the place value
(eg. 100)
(3x100) + (6x10) + (5x1)
Explanation

Binar Denar
y y
Denar Binar
y y
Binar Denary Explanation
y

22 =4 21 =2 20 =1

1 1 1

(1x4)+ + = 7 in
(1x2) (1x1) denary
Binar Denary Explanation
y

Eg.
"1011"
2 =8 3 22 =4 21 =2 20 =1

1 0 1 1
Explanation: Multiply the digit value (eg.1) by the place value
(eg. 8). Then sum it all up!

(1x8) + + + = 11 in denary
Binar Denary DIY
y

What is the denary form of "11100"?


24 =16 23 =8 22 =4 21 =2 20 =1

1 1 1 0 0
Binar Denary DIY
y

ANSWER
24 =16 23 =8 22 =4 21 =2 20 =1

1 1 1 0 0
(1x16)+ + + +
(1x8) (1x4)=(0x2)
28 in (0x1)
Denary Binar Explanation
y

Convert 5 to binary:

5
2 2 remainder
1 Read the remainder
2 1 remainder
0 from bottom to top

2 0 remainder
1

Answer: 101
Denary Binar Explanation
y

Convert 39 to
binary:
3
2 1 remainde
1
2 9
9
r
remainde
1
3 9
r
Read the remainder
2 4 remainde
r
1 from bottom to top
2 2 remainde
r
0
2 1 remainde
r
0
2 0 remainde
1
9
r

Answer:
Denary Binar DIY
y

What is the binary form of 42?


25 =32 24 =16 23 =8 22 =4 21 =2 20 =1
Denary Binar DIY
y
ANSWER
Convert 42 to
binary:
4
2 2 remainde
0
2 2
1
r
remainde
1
4 1
r
Read the remainder
2 5 remainde
0
2 0
2
r
remainde
1
from bottom to top
r
2 1 remainde
r
0
2 0 remainde
1
2
r

Answer:
RECAP
Denary System
102 101 100

(7x100) + (6x10)
7 6 5
+ (5x1) = 765
Hundredth Tenth Ones
RECAP
Denary System
102 101 100

(7x100) + (6x10)
7 6 5
+ (5x1) = 765
Binary System
22 21 20
(1x4) + (1x2)
1 1 1 + (1x1) = 7
Binar Denary DIY
y

What is the denary form of "1010"?


23 =8 22 =4 21 =2 20 =1

1 0 1 0
Binar Denary DIY
y

ANSWER
23 =8 22 =4 21 =2 20 =1

1 0 1 0
(1x8)+ = 10 in
(1x2) denary
Denary Binar DIY
y

What is the binary form of 38?


25 =32 24 =16 23 =8 22 =4 21 =2 20 =1
Denary Binar (Method DIY
y 2)
ANSWER
Convert 38 to
binary:
3
2 1 remainde
0
2 8
9
r
remainde
1
3 9
r
Read the remainder
2 4 remainde
r
1 from bottom to top
2 2 remainde
r
0
2 1 remainde
r
0
2 0 remainde
1
8
r

Answer:
PA S T Y E A R Q U E S T I O N
ANSWER
Hexadecima
l System
Motivation
Hexadecimal System

• It is a base 16 system.
• It uses 16 digits to represent each value

Number System Digits used to represent each value

Denary 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Binary 0, 1

Hexadecimal 0, 1, 2, 3, 4, 5, 6, 7, 8, ,9A, B, C, D, E, F
Explanation
Hexadecimal System
Denary System Binary System

102 =100101 =10 100 =1 22 =4 21 =2 20 =1

3 6 5 1 0 1
(3x100) + (6x10) + (5x1) (1x4) + (0x2) + (1x1) = 5
= 365
Hexadecimal System

?2 =? ?1 =? ?0 =?

3 E 5
Explanation
Hexadecimal System
Denary System Binary System

102 =100101 =10 100 =1 22 =4 21 =2 20 =1

3 6 5 1 0 1
(3x100) + (6x10) + (5x1) (1x4) + (0x2) + (1x1) = 5

= 365
Hexadecimal System

162 =256161 =16 160 =1

3 E 5
Conversion

Binary Hexadecima
l

Hexadecima Binar
l
y
Binar Hexadecima Explanation
l
y
• Since 16 = 24 this means that FOUR binary digits are equivalent to each
hexadecimal digit.
Binar Hexadecimal Explanation

1011111000
01
1011 1110 0001

B E 1

ANSWER :
Binar Hexadecima Explanation
l
y

10 000111111
101
0 1 000 111 110
0 0 1 1 1

2 1 F D

ANSWER :
Binar Hexadecima DIY
l
y

What is the hexadecimal form of


0111010011100?
Binar Hexadecima DIY
l
y
ANSWER

01110100111
00
000 111 100 110
0 0 1 0

0 E 9 C
Hexadecima Binar Explanation
l
y

F 9 3
111 5 001 010
1 100 1 1
1

Answer 111 100 001 010


: 1 1 1 1
Hexadecima Binar DIY
l
y

What is the binary form of


BF08?
Hexadecim Binar DIY
al
y

B F 0
101 8 000 100
1 111 0 0
1

Answer 101 111 000 100


: 1 1 0 0
Conversion

Hexadecim Denar
al
y
Denar Hexadecima
l
y
Binar Denary RECAP
y

Eg.
"111" 22 =4 21 =2 20 =1

1 1 1

(1x4) + (1x2) + (1x1) = 7 in


denary
Hexadecim Denar Explanation
al
y

Eg.
"45A" 162 =256 161 =16 160 =1

4 5 A
Note:
A=10
(4x256) + (5x16) + (10x1) = 1114 in
denary
Hexadecima Denar Explanation
l
y

Eg.
"C8F" 162 =256 161 =16 160 =1

C 8 F Note: C=12, F=15

(12x256) + (8x16) + (15x1) = 3215 in


denary
Hexadecima Denar DIY
l
y

What is the denary form of BF08?

163 =4096 162 =256 161 =16 160 =1

B F 0 8
Hexadecima Denar DIY
l
y

ANSWER

163 =4096 162 =256 161 =16 160 =1

B F 0 8

(11x4096) + (15x256) + (0x16) + (8x1) = 48904


Denary Binar (Method RECAP
y 2)

Convert 5 to binary:

5
2 2 remainde
r
1 Read the remainder
2 1 remainde
r
0 from bottom to top

2 0 remainde
r
1

Answer:
Denar Hexadecimal Explanation

Eg.
"2004"
2004/16 =
125
remainder = 4 200
1 12
4
remainde
r
4
1
6 7
5
remainde
1
125/16 =7 r
1 0 remainde
7
remainder = 13 6 r 3
Note: 13=D
6
Answer:
Denar Hexadecima DIY
l
y

What is the hexadecimal form of 3179?

3179/16 = ?
317
1 19
9
remainde
r
?
1
6 ?
8
remainde
?
r
1 ? remainde
?
6 r

6
Denar Hexadecima DIY
l
y

What is the hexadecimal form of 3179?

3179/16= 198
remainder = 11 317
1 19
9
remainder
1
198/16 = 12 1 1
6 8
remainder
6
1
remainder = 6 0 1
1
6 2
remainder

6 2

Answer:
PA S T Y E A R Q U E S T I O N
ANSWER
PA S T Y E A R Q U E S T I O N
ANSWER
Chapter 1.2
Use of hexadecimal
system
Use of hexadecimal Discussion
system
Time
Binary Hexadecimal

11010111111
1AFD3
0100111001
9
Brainstorm time: Why is Hexadecimal used?
Use of hexadecimal Explanation
system

• One hex digit represents four binary digits


• The hex number is far easier for humans to
remember, copy and work with
• Four uses of the hexadecimal system
Usage 1: Error Explanation
Code

• Error codes are often shown as


hexadecimal values.
• These numbers refer to the memory
location of the error.
• They are generated by the computer.
• The programmer needs to know how to
interpret the hexadecimal error codes.
Usage 1: Error Explanation
Code
Usage 2: MAC Explanation
address

• Media Access Control (MAC) address refers to


a number which uniquely identifies a device on a network.
• The MAC address refers to the network interface card
(NIC) which is part of the device
• The MAC address is rarely changed so that a particular
device can always be identified no matter where it is.
Usage 2: MAC Explanation
address

00_1C_B3_4F_25_FE

Message 00_1C_C3_4F_23_AE

Mac address uniquely identify a device on a Local Area Network


Usage 2: MAC Explanation
address
Form 1
NN-NN-NN-DD-DD-DD

00-1C-B3-4F-25-FE

Form 2
NN:NN:NN:DD:DD:DD
2
00:1C:B3:4F:25:FE

Mac Address comes with 2 forms


Usage 2: MAC Explanation
address

00-1C-B3 4F-25-FE

Identity number of Serial number of


the manufacturer a device
Eg. 00 – 14 – 22 which identifies devices made by Dell
00 – a0 – c9 which identifies devices made by Intel
Usage 3: Internet
Protocol Addresses Explanation

• Each device connected to a network is given an address


known as the Internet Protocol address
• An IPv4 address is a 32-bit number written in denary or
hexadecimal form e.g. 109.108.158.1 (or 77.76.9e.01 in
hex)
• IPv4 has recently been improved upon by the adoption of
IPv6. An IPv6 address is a 128-bit number broken down
into 16-bit chunks, represented by a hexadecimal numbe
Usage 4: HyperText Markup
Language (HTML) colour code Explanation

• HyperText Mark-up Language (HTML) is used when writing


and developing web pages.
• It is not a programming language, but a markup language.
• A mark-up language is used in the processing, definition
and presentation of text.
Overview
Explanation

The 4 usages of Hexadecimals - EMIH


1. E - Error Codes
2. M - MAC Address
3. I - Internet Protocol Address
4. H - HTML Colour Code
PA S T Y E A R Q U E S T I O N
ANSWER
PA S T Y E A R Q U E S T I O N
ANSWER
Chapter 1.3
Addition of
binary number
Addition of binary number
Explanatio
n
How do we perform add and carry in denary?

1
0+0= 9
0 +09 = +
9 +90 =
110
9 +91 =
Addition of binary number
Explanation

How do we perform add and carry in denary?

1 1
6+9 = 15
1+5+7
(>9) = 13
56
(>9)
1+7
35
Addition of binary number
Explanatio
n
How do we perform add and carry in binary?

0+0=
0 +01 =
1 +10 =
1 +1 1 =
Addition of binary number
Explanation

How do we perform add and carry in binary?

111
00100111
+01001010
01110001
Addition of binary number
DIY

How do we perform add and carry in binary?

Perform

01111110 +
00111110
Addition of binary number
Explanation

The overflow condition


1 11 111
01101110
+11011110
1 01001100
Addition of binary number
Explanatio
1 1 1n1 1 1
The overflow condition 01101110
+11011110
1 01001100
• The maximum denary of an 8-bit binary number
(11111111) is (28 - 1 ) = 255
• The generation of a 9th bit is a clear indication that
the sum has exceeded this value.
• This is known as an overflow error. The sum is too
big to be stored using 8 bits.
Addition of binary number
Explanatio
1 1 1n1 1 1
The overflow condition 01101110
01101110 = 110 +11011110
\ 11011110 = 222 1 01001100

110 + 222 = 322


322 > 255 (overflow)
The sum is too big to be stored in a 8 bit binary.
Lesson Objectives
Chapter 1.4: Binary
Shifting
Last lesson on the binary system

BINARY SHIFTING TWO


COMPLEMENTS
Represent
Multiplicatio
negative
n and
number in
division of
binary binary
BINARY SHIFTING

• Binary shift is a process that a CPU uses


to perform multiplication and division.
BINARY SHIFTING -
MULTIPLICATION
• For a CPU to multiply a binary number,
the number needs to be shifted to the
left and will fill the remaining gaps with
zeros.
BINARY SHIFTING -
MULTIPLICATION
Examples: 111 (Binary)
64 32 16 8 4 2 1
0 0 0 0 1 1 1
Examples: 1110 (Binary)
64 32 16 8 4 2 1
0 0 0 1 1 1 0

Examples: 11100 (Binary)


64 32 16 8 4 2 1
0 0 1 1 1 0 0
BINARY SHIFTING -
MULTIPLICATION
Examples: 111 (Binary)
64 32 16 8 4 2 1
0 0 0 0 1 1 1

Multiply by 2, shift 1 place to the left 11


Multiply by 4, shift 2 place to the left111
10
Multiply by 8, shift 3 place to the left1110
00
00
Multiply by 2^n, shift n place to the left
BINARY SHIFTING - DIVISION

• For a CPU to multiply a binary number,


the number needs to be shifted to the
right.
BINARY SHIFTING - DIVISION

Examples: 101100 (Binary)


32 16 8 4 2 1
1 0 1 1 0 0
Examples: 10110 (Binary)
32 16 8 4 2 1
0 1 0 1 1 0
Examples: 1011 (Binary)
32 16 8 4 2 1
0 0 1 0 1 1
BINARY SHIFTING - DIVISION

Examples: 101100 (Binary)


32 16 8 4 2 1
1 0 1 1 0 0

Divide by 2, shift 1 place to the right1011


Divide by 4, shift 2 place to the right 101
0
Divide by 8, shift 3 place to the right 10
1
1
Divide by 2^n, shift n place to the right
BINARY SHIFTING WITH 8-BIT BINARY
NUMBERS
• Registers contained within the CPU often
have 8-bits limits on the amount of data they
can hold at any one time.
• The multiplying shifting process can cause
bits to be lost at one end of the register, and
zeros added at the opposite end.
• This process is known as losing the most
significant bit.
BINARY SHIFTING WITH 8-BIT BINARY
NUMBERS

Examples: 10110101 (181 in denary)


12 64 32 16 8 4 2 1
1
8 0 1 1 0 1 0 1

10110101 ->
106 in denary

01101010
The bit lost is called the most significant bit,
and when it is shifted beyond the furthest-
column the binary data that is stored loses
BINARY SHIFTING WITH 8-BIT BINARY
NUMBERS

The same process can happen when dividing


an 8-bit binary number.
Example: 10111101 (189 in denary)
12 64 32 16 8 14 2
1
8 0 1 1 1 11 0
Divide this number by 32 (move 5 places to
the
12right)
64 32 16 8 4 2 1
0
8 0 0 0 0 1 0 1
The division shift 111
Least
produces the binary Significa 01
number 101 = 5, not nt bit
Lesson Objectives
Chapter 1.5: Two
Complements
Last lesson on the binary system

BINARY SHIFTING TWO


COMPLEMENTS
Represent
Multiplicatio
negative
n and
number in
division of
binary binary
TWO
COMPLEMENTS

• A PROCESSOR CAN ALSO REPRESENT


NEGATIVE NUMBERS.
• ONE OF THE METHOD THAT A
PROCESS REPRESENT NEGATIVE
NUMBERS IS CALLED TWO'S
COMPLEMENT.
TWO
COMPLEMENTS
TWO
COMPLEMENTS

• TO REPRESENT NEGATIVE NUMBERS, IT IS


IMPORTANT TO THINK ABOUT THE PLACE VALUE
OF THE FURTHEST-LEFT BIT IN A DIFFERENT WAY.
• PROCESSOR CAN BE SET UP TO SEE THE BIT IN
THE EIGHTH COLUMN AS A SIGN BIT.

0 = POSITIVE
1 = NEGATIVE
CONVERT POSITIVE BINARY INTEGER TO A TWO'S
COMPLEMENT 8-BIT INTEGER

Examples:13
Step 1: Convert 13 into binary.
1101 in
Step 2: Put the number into the place value
binary
column
- 64 32 16 8 4 2 1
0
128 0 0 0 1 1 0 1

Step 3: Ensure that the the leftmost bit is 0


(+).
DI
Y

Convert 19 into a Two's complement


8-bit Integer
CONVERT POSITIVE BINARY INTEGER TO A TWO'S
COMPLEMENT 8-BIT INTEGER

Examples:19
Step 1: Convert 19 into binary.
10011 in
Step 2: Put the number into the place value
binary
column
- 64 32 16 8 4 2 1
0
128 0 0 1 0 0 1 1
Step 3: Ensure that the the leftmost bit is 0
(+).
Answer:
00010011
CONVERT TWO'S COMPLEMENT 8-BIT INTEGER TO A POSITIVE
BINARY INTEGER

Examples: Convert 00010011 (two's


complement)
Step 1: Put to
thedenary
number into the place value
column
- 64 32 16 8 4 2 1
0
128 0 0 1 0 0 1 1
Step 2: This shows that it is a positive
number, we can just convert the binary into
denary directly.
Step 3: Calculate the denary value.

(1x16) + (1x2) + (1x1)


= 19
DI
Y

Convert 01010011 (two's complement)


to denary
CONVERT TWO'S COMPLEMENT 8-BIT INTEGER TO A POSITIVE
BINARY INTEGER

Examples: Convert 01010011 (two's


complement)
Step 1: Put to
thedenary
number into the place value
column
- 64 32 16 8 4 2 1
0
128 1 0 1 0 0 1 1
Step 2: This shows that it is a positive
number, we can just convert the binary into
denary directly.
Step 3: Calculate the denary value.

(1x64) + (1x16) + (1x2) +


(1x1) = 83
CONVERT NEGATIVE BINARY NUMBERS IN TWO'S COMPLEMENT
FORMAT AND CONVERT TO DENARY

Examples: 10010011
Step 1: Put the number into the place value
column
- 64 32 16 8 4 2 1
1
128 0 0 1 0 0 1 1
Step 2: The left-most bit is 1, this means
that it is a negative number.
Step 3: Compute the denary value as usual.
(1x -128) + (1x16) + (1x2) +
(1x1)
= -128 + 16 + 2 + 1
DI
Y

Convert 10110011 (Two's Complement)


to denary
CONVERT NEGATIVE BINARY NUMBERS IN TWO'S COMPLEMENT
FORMAT AND CONVERT TO DENARY

Examples: 10110011
Step 1: Put the number into the place value
column
- 64 32 16 8 4 2 1
1
128 0 1 1 0 0 1 1
Step 2: The left-most bit is 1, this means
that it is a negative number.
Step 3: Compute the denary value as usual.
(1x -128) (1x32)+ (1x16) + (1x2) +
(1x1)
= -128 + 32 + 16 + 2 + 1
CONVERTING NEGATIVE DENARY NUMBERS INTO BINARY
NUMBERS IN TWO’S COMPLEMENT FORMAT

Examples: -67
Step 1: Convert the number to positive.
6
7
Step 2: Write the number in binary form (8
bits). 010000
Step 3: Invert each11
binary value.
101111
00
Step 4: Add 1 to the binary number.
101111
+ 00 1
101111
01
Step 5: This gives us -67.
- 64 32 16 8 4 2 1
1
128 0 1 1 1 1 0 1
-128 + 32 + 16 + 8 + 4 + 1 = -
67
DI
Y

Convert -65 to 8 bit two's complement


binary number
CONVERTING NEGATIVE DENARY NUMBERS INTO BINARY
NUMBERS IN TWO’S COMPLEMENT FORMAT

Examples: -65
Step 1: Convert the number to positive.
6
5
Step 2: Write the number in binary form (8
bits). 010000
Step 3: Invert each01
binary value.
101111
10
Step 4: Add 1 to the binary number.
101111
+ 10 1
101111
11
Step 5: This gives us -65.
- 64 32 16 8 4 2 1
1
128 0 1 1 1 1 1 1
-128 + 32 + 16 + 8 + 4 + 2 + 1 =
-65
Summary: Convert negative denary to two's
complement
Examples: -65

65 Convert to (+)

010000 Convert to binary


01
101111 Invert the digit

10
1 +1

101111 Final result


11
Chapter 1.6
The number of bits used to represent sound amplitude in
digital sound recording, as known as bit depth
Chapter 1.7

Measurement of
Data Storage and
Calculation of file
size
Measurement
of Data
Storage

• A bit is the basic unit of all computing


memory storage terms and is either 1 or
0.
• The byte is the smallest unit of memory
in a computer.

8 bits = 1 byte
4 bits = 1 nibble
Memory
Size
System

Based on the SI (base 10) system of units where


1 kilo is equal to 1000.
Memory
Size As memory size is actually measured in terms of powers of 2...
System

Based on the IEC (base 2) system of units where


1 kilo is equal to 1024 (2^10).
Memory
Size
System
Converting Bytes into KiB, MiB and GiB

68719476736 Bytes
= 68719476736 Bytes / 1024 = 67108864
= 67108864 KiB / 1024 =
KiB65536 MiB
= 65536 MiB / 1024 = 64 GiB
Memory
Size
System
Converting Gib, Mib, Kib into bytes

64 GiB
= 64 x 1024 = 65536 MiB
= 65536 x 1024 = 67108864 KiB
= 67108864 x 1024 = 68719476736 Bytes
DIY

Convert the size of GTA-V to bytes

72 GiB
= 72 x 1024 = 73728 MiB
= 65536 x 1024 = 75497472 KiB
= 75497472 x 1024 = 77309411328 Bytes
Calculation
of file
size

Ima Aud
ge io
Calculation
of file
size - Image

Image Resolution - The number


of pixels that make up an
image.
The higher the image resolution,
the higher the quality of the
image.
Calculation
of file
size - Image

Formula

image resolution (pixels) x colour


depths (bits)
Calculation Example 1
of file
size - Image

2px

2px
00 0
1 1
Total pixels = 2 x 2 Colour depth
=4
0
=2 1
Calculation = (2x2)
x2 = 8 bits = 1 byte
Calculation Example 2
of file
size - Image
Formula : image resolution (pixels) x colour
depths (bits)
Question:
Image Resolution = 1024 x 1080
Colour depth = 32

Calculate the size of this image in Bytes.


Workings:

1024 x 1080 = 1105920 pixels


1105920 x 32 = 35389440 bits
Answer in byte: 35389440/8 = 4423680
Calculation Example 2
of file
size - Image
Question:
Image Resolution = 1024 x 1080
Colour depth = 32

Calculate the size of this image in Bytes. How many


photograph of this size would fit onto a memory
Each image = 4423680
stick of 64Gib.
First convert 64 Gib
bytes
into
64 xbytes:
1024 = 65536
65536 xMiB
1024 = 67108864
67108864 x 1024 = 68719476736
KiB
bytes
Calculation Example 2
of file
size - Image
Question:
Image Resolution = 1024 x 1080
Colour depth = 32

Calculate the size of this image in Bytes. How many


photograph of this size would fit onto a memory
Each image = 4423680
stick of 64Gib.
First convert 64 Gib into bytes =
bytes
68719476736 bytes
68719476736/4423680 = 15534 photos.
DI
Y
Question:
Image Resolution = 2048 x 2048
Colour depth = 16

Calculate the size of this image in Bytes.


DANSWE
R
Question:
Image Resolution = 2048 x 2048
Colour depth = 16

Calculate the size of this image in Bytes.


Answer:

2048 x 2048 x 16 = 67108864 bits


= 67108864/8
= 8388608 bytes
DIY
Question:
Image Resolution = 2048 x 2048
Colour depth = 16

Calculate the size of this image in Bytes (Answer:


8388608 bytes).
What is the size of the image in MiB.
DANSWE
Question:
R
Image Resolution = 2048 x 2048
Colour depth = 16

Calculate the size of this image in Bytes (Answer:


8388608 bytes).
What is the/ size
8388608 1024 of=the image
8192 KiBin MiB.
8192 / 1024 = 8 MiB
Calculation Formula
of file
size - Sound

Sample Rate (in Hz) x Sample Resolution (in bits) x length of sample
(in seconds)
Calculation
of file
size - Sound

Mono Sound vs Stereo


Sound
Comparison
Calculation Example 1 - Mono Sound
of file
size - Sound
Question:
Sample Rate: 44100
Sample Resolution: 8 bits
Length of the music: 20 seconds

Calculate the size of the audio in KiB.


44100 x 8 x 20 = 7056000 bits
7056000/8 = 882000 bytes
882000 / 1024 = 861.328 KiB
Calculation
of file
Example 1 - Stereo
size - Sound
Sound

An audio CD has a sample rate of 44100 and a sample


resolution of 16 bits. The music being sampled uses two
channels to allow for stereo recording. Calculate the file size
for a 60-minute recording.
44100 x 16 x 3600 = 2540160000 bits
2540160000 x 2 = 5080320000 bits
5080320000 / 8 = 635040000 bytes

635040000 / 1024 = 620156.25 KiB

620156.25 / 1024 = 605.62 MiB


DI
Y
An audio CD has a sample rate of 44100 and a sample
resolution of 8 bits. The music being sampled uses two
channels to allow for stereo recording. Calculate the file size
for a 25-minute recording.
DI
Y
An audio CD has a sample rate of 44100 and a sample
resolution of 8 bits. The music being sampled uses two
channels to allow for stereo recording. Calculate the file size
for a 25-minute44100
recording in MiB.
x 8 x 1500 = 529200000 bits
529200000 x 2 = 1058400000 bits
1058400000 / 8 = 132300000 bytes

132300000 / 1024 = 129199.218 KiB

129199.218 / 1024 = 126.17 MiB


PA S T Y E A R Q U E S T I O N
ANSWER
DATA
CO M PR E S
S I ON
Chapter 1.8
DATA
COMPRESSION
DATA
COMPRESSION
DATA
COMPRESSI
ON

• FILE SIZE OF IMAGES AND SOUND CAN BE


VERY LARGE.
• THEREFORE, DATA COMPRESSION IS NEEDED
TO REDUCE THE SIZE OF A FILE.
DATA
COMPRESSI
ON

WHAT ARE SOME BENEFITS OF


REDUCING THE FILE SIZE?
Benefits of
Data
Compressi REDUCE
on STREAMIN
REDUCE
G TIME
COST
SAVE
RE DU CE
STORAGE
TIME
SPACE
TAKEN TO
UPLOAD
A ND
DOWNLOA
D MEDIA
DATA
COMPRESSI
ON

LOSSY LOSSLESS
FILE FILE
COMPRES COMPRES
SION SION
LOSSY FILE
COMPRESSI
ON• FILE COMPRESSION ALGORITHM ELIMINATES
UNNECESSARY DATA FROM THE FILE.
• ORIGINAL FILE CANNOT BE RECONSTRUCTED
ONCE IT HAS BEEN COMPRESSED.
• IMAGE - REDUCE THE RESOLUTION // COLOUR
DEPTH
• SOUND - REDUCE THE SAMPLING RATE //
SAMPLING RESOLUTION
• SOME
MPEG-3 LOSSY FILE MPEG-4
COMPRESSION ALGORITHMS
JPEG
ARE:
LOSSY FILE • A COMPRESSION TECHNOLOGY
COMPRESSI
ON THAT REDUCES THE SIZE OF A
NORMAL MUSIC FILE BY ABOUT
90%.
SECRET
MPEG-3 • REMOVE
SOUNDS
OUTSIDE THE
HUMAN EAR
RANGE
• ELIMINATE
THE SOFTER
SOUND -
PERCEPTUAL
LOSSY FILE
COMPRESSI ALLOWS STORAGE OF MULTIMEDIA
ON FILES RATHER THAN JUST SOUND.

SECRET
MPEG-4 • MOVIES CAN
BE
STREAMED
USING THE
MP4 FORMAT
WITHOUT
LOSING ANY
REAL
DISCERNIBLE
LOSSY FILE
A LOSSY COMPRESSION ALGORITHM
COMPRESSI
ON USED FOR BITMAP IMAGES.
ORIGINAL FILE CAN NO LONGER BE
CONSTRUCTED
SECRET
JPEG • REMOVE
COLOUR
SHADES
(HUMAN
CAN'T
NOTICE
THEM)
LOSSY FILE
COMPRESSI
ON
LOSSY FILE
COMPRESSI
ON
DATA
COMPRESSI
ON

• ALL THE DATA FROM THE ORIGINAL


UNCOMPRESSED FILE CAN BE
RECONSTRUCTED
LOSSLESS • THIS IS IMPORTANT FOR FILES
FILE WHERE LOSS OF DATA WOULD BE
DISASTROUS (COMPLEX
COMPRES SPREADSHEET).
SION • LOSSLESS FILE COMPRESSION IS
DESIGNED SO THAT NONE OF THE
ORIGiNAL DETAIL FROM THE FILE IS
LOST.
LOSSLESS
FILE
COMPRESSI
ON
1. CAN BE USED FOR LOSSLESS COMPRESSION OF A
NUMBER OF DIFFERENT FILE FORMATS.
RUN-
LENGTH 2. IT REDUCES THE SIZE OF A STRING OF ADJACENT,
ENCODIN IDENTICAL DATA.
G
3. A REPEATED STRING IS ENCODED INTO TWO VALUES.

NUMBER DATA ITEM


OF
IDENTICAL
DATA
LOSSLESS
FILE RUN-
COMPRESSI LENGTH
ON
ENCODIN
G
IN
ACTION

16
LOSSLESS
FILE RUN-
Does not work well when no repeated data!
COMPRESSI LENGTH
ON
ENCODING
IN
ACTION

Each digit - 1 byte


Total size = 8 bytes (50% reduction in size)
LOSSLESS
FILE
3,2,5,2
COMPRESSI ,4
2,4,3,4
ON ,3
1.6.1.6
0,.2
15,1

TO BE
CONTINUE
DIY
DIY

REDUCE REDUCE
COLOUR IMAGE
DEPTH RESOLUTI
ON
LOSSY FILE
A LOSSY COMPRESSION ALGORITHM
COMPRESSI
ON USED FOR BITMAP IMAGES.
ORIGINAL FILE CAN NO LONGER BE
CONSTRUCTED
SECRET
JPEG • REMOVE
COLOUR
SHADES
(HUMAN
CAN'T
NOTICE
THEM)
PA S T Y E A R Q U E S T I O N
ANSWER
PA S T Y E A R Q U E S T I O N
ANSWER

You might also like