5 04092023191225 C NumberSystem Lecture Part 2
5 04092023191225 C NumberSystem Lecture Part 2
Data Representation
Handout: Part - 2
Number System:
Text, sound and images:
Character set :
A list of characters (ASCII character set consist of 7 bits i.e. 0 to 127 denary, 00 to 7F in
hexadecimal number).
It consists of letters, number, symbols of standard keyboard.
It has been defined/recognized by computer hardware and software .
ASCII – ASCII code is coding system for all the characters on an English standard keyboard and
control codes (Ctrl, Alt, Shift…., Esc, Fn)
A unique numerical or denary value of each key of English standard keyboard. Like A : 65
ASCII originally uses seven (7) bits to encode each character. 27=128 characters
Extended ASCII uses 8 bits codes:
1
Chapter - 1
Data Representation
Image
• Each pixel is a single colour and is given a binary value which represents that colour e.g. 11000000 might
equal Red
• Pixels are small blocks of addressable areas and the color they have is represented by binary & stored as
bits
1 = Black, 0 = White
0 0 0 0 1 0 0 0 0 0
0 0 0 1 1 0 0 0 0 0
0 0 1 1 1 0 1 0 0 0
0 1 1 1 1 0 1 1 0 0
1 1 1 1 1 0 1 1 1 0
0 0 0 0 1 0 1 0 0 0
1 1 1 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 1 0
0 0 1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0
2
Chapter - 1
Data Representation
• 4 bits = 16 Colours
Image Resolution: the amount of pixels an image contains per inch or per centimeter/area in unit.
• The area is defined by the image width and height in pixels e.g. 3264x2448
Colour depth: number of bits used to represent the color of a single pixel.
E.g. a 1 bit image can only store 2 to the power 1 pixels which equals to 2. Therefore, a 1 bit image is
monochromatic o
• The higher the colour depth, the larger the file size/requires higher storage.
sample rate (in Hz) × sample resolution (bits) × length of sample (secs)
3
Chapter - 1
Data Representation
1024 × 1080 × 32 = 35 389 440 bits ≡ 4 423 680 bytes ≡ 4.22 MiB
For example, an audio file which is 60 minutes in length uses a sample rate of 44 100 and a sample
resolution of 16 bits. We can work out the file size as follows:
44100 × 16 × (60 × 60) = 2 540 160 000 bits ≡ 317 520 000 bytes ≡ 302.8 MiB
4
Chapter - 1
Data Representation
Q3. How many bits per pixel required for 256 colours?
………………………………..
5
Chapter - 1
Data Representation
Sound:
Definition & characteristic
Number of samples taken per second/unit time. How often the computer takes a measure of the
sound.
A higher sampling rate means the waveform will be converted from analog to digital form more
accurately.
The sampling resolution allows you to set the range of volumes storable for each sample
The quality of a sound produced using a sound sampler depends on the sampling rate and sampling
resolution.
Higher sampling rate/resolution means larger file size
Example : a 16 bit sampling resolution is used when recording CDs to gives better sound quality.
Bit Rate:
Number of bits required to store 1 sec of sound. How many bits are used for each sample (bps).
Higher bit rates result in higher quality of sound but also higher storages requirement.
Bit Rate= Sample Rate (in Hz) x sample resolution(in bits) x Length of Sound sample (in
sec)
6
Chapter - 1
Data Representation
The amplitude of the sound wave is first determined at a set time intervals (sampling rate)
This gives approximate representation of the sound wave.
The sound is encoded as a series of binary digits and stored in order.
The pros and cons of using a larger sampling resolution when recording sound
Pros Cons
Larger dynamic range Produces larger file size
Better sound quality Takes longer to transmit/download sound file
Less sound distortion Requires greater processing power
Recording sound using software: Common Features of software include the ability to:…..
Activity:
4 bits=Nibble
8 bits =1 bytes
1024 bytes=1 KiB
1 KiB (kibibyte) = 210 bytes
1 MiB (mebibyte) = 220 bytes
1 GiB (gibibyte) = 230 bytes
1 TiB (tebibyte) = 240 bytes
1 PiB (pebibyte) = 250 bytes
1 EiB (exbibyte) = 260 bytes
For example, a photograph is taken by a camera that uses a colour depth of 8 bits; the photograph is 1000 ×
200 pixels in size.
7
Chapter - 1
Data Representation
sample rate (in Hz) × sample resolution (bits) × length of sample (secs).
For example, an audio file which is 3 minutes in length uses a sample rate of 44 100 and a sample
resolution of 16 bits. We can work out the file size as follows:
None of the original data is lost File size reduction is greater than using lossless.
The file needs to be of high precision & accuracy. The file may not need to be of high precision &
accuracy.
8
Chapter - 1
Data Representation
For Image:
For audio/sound:
End of handout