Chapter 1
Chapter 1
Number System
Denary: which are also known as decimal numbers are written using one of the symbols
0,1,2,3,4,5,6,7,8,9 for each denary digit
A base-10 number system
Eg:13,59,79,231
Binary: The binary number system is base-2. Each binary digit is written with either of the
symbols O and 1.A binary digit is referred to as a bit
A base-2 number system
Bit: a digit in the binary number system written using either of the symbols 0 and 1
Byte: a group of eight bits treated as a single unit
Eg:10100101,11110101,10101010
Binary to denary:
11110011——》-13
-128 64 32 16 8 4 2 1
1 1 1 1 0 0 1 1
-128*1+64*1+32*1+16*1+2*1+1*1=-13
Denary to binary:
15——》00001111
2|15 1
——
2|7 1
——
2|3 1
——
1
Hexadecimal to binary
5B——》01011011
2|5 1
——
2|2 0
——
1
0101
……
Binary to hexadecimal
01110010——》72
8421 8421
0111 0010
4*1+2*1+1*1=7
2*1=2
72
2
Binary prefix name Symbol used Factor applied to the value
kibi Ki=KB 2^10
mebi Mi=MB 2^20
gibi Gi=GB 2^30
tebi Ti=TB 2^40
Signed integer: The integer that can represents positive number, negative number.
eg: +9,-11,-37,+5,-4
So -12 —》11110100
If positive ?
Normal calculation method
If reversed ?
3
The reversed method
Binary coded decimal (BCD): storage of a binary value representing one denary digit in a nibble
Purpose: Grouping bits in bytes to represent integers
Application: screen of a calculator, a digital time display
eg: 0.89 can be represented in BCD as follows:
0 in BCD = 0000
8 in BCD = 1000
9 in BCD = 1001
So, 0.89 in BCD format is 000010001001
Overflow: a condition when the result of a calculation is too large to fit into the number of bits
defined for storage
eg:
1011
+0111
(1) 0 0 1 0
4
BCD to represent currency values:
When a currency value is $300.25 it is as a fixed-point decimal number (ignoring the
dollar sign). It might be expected that such values would be stored as real numbers but
this cannot be done accurately
One solution to the problem is to store each denary digit as a BCD code.
BCD arithmetic:
Character Codes
ASCII Code (American Standard Code for Information Interchange)
7-bit version of the code
Conversion to and from lower and upper case:
Add 1 on bit-5
⬇️
Before: 0 1 0 0 0 0 1 0 →b
After: 0 1 1 0 0 0 1 0 →B
Unicode scheme:
Why use Unicode instead of ASCII?
ASCII code does not cover all the characters needed.
Aim: It can represent any possible text in code form.
5
Unicode code point identification: Unicode code point identification refers to the process of
identifying the unique numeric value assigned to each character in the Unicode character set.
Vector Graphic
Definition:
Vector graphic: a graphic consisting of drawing objects defined in a drawing list
Drawing object: a component defined by geometric formulae and associated properties
Drawing list: contains one set of values for each drawing object
Property: defines one aspect of the appearance of the drawing object
Bitmap
Picture element (pixel): the smallest identifiable component of a bitmap image, defined by just
two properties: its position in the bitmap matrix and its color
Bit depth: the number of bits used to represent each of the red, green and blue colors
Image resolution: the number of pixels in the bitmap file defined as the product of the width and
the height values
Screen resolution: the product of width and height values for the number of pixels that the screen
can display
Purpose: Displaying images, Image editing and manipulation, Graphics design and digital art,
Printing, Texture mapping.
6
Calculate the size:
Size = resolution * colour depth
= width * height * colour depth
eg: size = 1366 * 768 * 24 = 25178112 bits
Header:
contains information on how the graphic has been constructed.
A bitmap file has a header containing meta data, which defines the colour depth or bit depth and
the resolution
Sound
Analogue data: data obtained by measurement of a physical property which can have any value
from a continuous range of values
Digital data: data that has been stored as a binary value which can have one of a discrete range
of values
Sampling: taking measurements at regular intervals and storing the value
Sampling resolution: the number of bits used to store each sample
Sampling rate: the number of samples taken per second
⇩
to a binary code.
⇩
An Sampling rate increases and an sampling resolution increases
Band-limiting filter(encoder):
Aim: removing high frequency components. A human ear cannot detect these very high
frequencies and they could cause problems for the coding if not removed.
Compression
Benefits: Lower transmission, Lower download rate
Purpose: Reducing the file size
7
Any binary data can be compressed
Lossless Compression:
No information is lost
Can be reversed to re-create the original file.
eg:Run-Length encoding: used for text and bitmap
Process:converts sequences of the same byte value into a code that defines the
byte value and the number of times it is repeated (the count).
eg:Huffman coding(Don’t need to learn)
Lossy Compression:
With some loss of information
Original file can never be recovered
Text data compression must be lossless, if it is lossy compression, the content of text file will be
destructed.