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

Computer science - data representation

The document explains data representation in computer systems, focusing on binary, denary, and hexadecimal number systems, and their conversions. It discusses image and sound digitization, compression methods (lossy and lossless), and file formats, emphasizing the importance of bit depth and resolution. Additionally, it covers character encoding with ASCII and Unicode, highlighting the need for proper representation of different languages.

Uploaded by

Reva Ranjan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Computer science - data representation

The document explains data representation in computer systems, focusing on binary, denary, and hexadecimal number systems, and their conversions. It discusses image and sound digitization, compression methods (lossy and lossless), and file formats, emphasizing the importance of bit depth and resolution. Additionally, it covers character encoding with ASCII and Unicode, highlighting the need for proper representation of different languages.

Uploaded by

Reva Ranjan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Data representation Hexadecimal -> Binary

A computer system is a collection of binary codes, everything a Binary -> Hexadecimal


computer does is because of binary.

While the machine can understand different programming


languages, these are still translated into binary so the machine
can understand and execute instructions.

Bit: binary digit

- Bite: 8 bits
- Nibble: 4 bits Denary -> Hexadecimal
A computer system is a digital system that accepts input, and can Hexadecimal -> Denary
store, retrieve, process, and produce an output.

The three number systems


- Denary - Base 10 (Our number system, 0-9)
- Binary - Base 2 (1s and 0s)
- Hexadecimal – Base 16 (0 -10 – A - F)

Hexadecimal (Base 16) uses A-F to represent 11-16.

(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, A, B, C, D, E, F) - Always start right to left, then left to right


Converting between number systems:
Binary addition
Denary -> Binary
Rules: 0 + 0 = 0 | 1 + 0 = 1 | 1 + 1 = 0 1 | 1 + 1 + 1 = 11
Binary -> Denary
Examples:
Bit overflow – Doesn't fit into a bite (8 bits) Image representation
8 bits – Full bite
Images are made from pixels; a pixel is the smallest identifiable
Logical shift area of an image. Each pixel is represented in binary (to
represent a color).
Used when multiplying and dividing in binary.
- More pixels = bigger resolution
- Right shift: Multiplying (2 right shifts = Multiply by 4). - Bigger resolution = larger file size
- Left shift: Dividing (2 left shifts = Dividing by 4).
Resolution is the number of pixels within a specific area, it is
expressed as width & height

Resolution: W x H = Resolution

Bit depth is how many colors there are in an image. The higher
the bit depth the more colors there are.

- Bigger bit = better quality


- Higher bit depth for audio means an increase in the
precision of audio (improves sound quality).

Color depth is how many colors can be represented, depending


One's compliment & Two’s compliment on bit depth.
- 1 bit depth: Can represent 2 colors (usually black & white).
One’s compliment: Invert binary numbers. (0 -> 1) (1 -> 0) - 2 bits: 4 colors, 3 bits: 8 colors.
Two’s compliment: Find one’s compliment then add - More bits per pixel = more possible color combinations
1 to the least significant.
File size (bits) = Width (pixels) x Height (pixels) x Bit
depth (pits per pixel)
- To convert into byte, divide by 8.
- To convert into kilobyte, divide by 1,000.
Sound is digitized by sampling the sound wave thousands of
times per second and converting the samples to binary.
- Sounds must be converted into a digital form to be stored
and processed by a computer.

Image compression
- Reduces file size
Analogue to Digital conversion
There are two types:
- Lossy compression (JPG, GIF, MP3, MP4)
- Lossless compression (PNG, TIF, SVG)
Lossy compression
Removes data permanently and reconstructs the file using the
remaining data.
- This allows much smaller file sizes but some loss of quality.
How it works:
Decreases the color depth to save space. Similarly colored pixels
are made the same.
- Things like record players and vinyl's sound better as they
Lossless compression
are analogue.
How it works:
Finds areas of the same color and records them as a group Digitized sound quality
instead of individually. Recording quality improves:
- Example: 15 blue pixels rather than blue pixel, blue pixel,
- The more frequently we sample the sound.
and blue pixel.
- The more frequently we record the wave height.
- 11011010, 11011010, 11011010 becomes 00000100-
11011010. Increasing sampling rate and resolution means recording more
No data is lost, and it retains the quality. (Keeps the quality the data points.
same).
- The size of the sound file will therefore increase.
Sound Humans can hear between 20-20,000 Hz – This varies depending
on age.
Lossy compression - MP3 But for text a different system is needed.

Lossy compression removes the sounds in the frequency ranges


that we can't easily hear or that least affect the playback quality.

- Lossy compression leaves out some data – this can affect


sound quality.

Lossless compression - Text

Lossless compression leaves out repeated data and instead,


makes a note of how many times it is repeated.
Explanation: (Representing characters in binary)
- Example: 10 x 5 takes less space than 5 + 5 + 5 + 5....
- Every character on the keyboard is represented by a binary
Sound file formats value.
- Uppercase letters have different values to lowercase
- .WAV: uncompressed files
characters.
- .FLAC / .M4A: lossless compression, slightly smaller files.
- Punctuation symbols have their own characters.
- .MP3: Lossy compression, much smaller files.

MP4 file formats The ASCII code


ASCII: American Standard Code for Information. It has become the
MP4 is a digital multimedia format. Commonly used to store video
standard code used worldwide.
& audio.
- It was originally developed in the 1960s for representing
- Used to store subtitles and still images. the English alphabet.
- Allows different multimedia streams (video, audio, text) to - It encodes 128 characters into 7-bit binary codes.
be combined into one file. 128 characters: Numbers 0 – 9, uppercase/lowercase letters A –
Z, a – z, punctuation symbols & a space character.
MIDI files

MIDI files is a set of instructions for digital instruments to play Converting ASCII to pure binary
synthesized sounds. We cannot do arithmetic (math) with ASCII characters, because
programming languages deal with the input of numbers in
- MIDI stands for musical instrument digital interface. different ways. (So we convert them
- It is not a recording of a live musical source. ASCII represents characters, not numerical values that
Character sets can be used for arithmetic operations.
- Some languages need to decare a variable as type char,
Positive integers can be represented in binary, numbers &
string, int.
negative numbers can be represented as “pure” binary numbers.
- Other languages such as python, all data is input as string,
so it has to be converted using a built-in function.

Using different alphabets


To represent other alphabets for different languages, Unicode
was developed to use 16 bits, giving 65,536 combinations –
enough to represent every character in every language.
- To display a word in a different alphabet you would need to
download the alphabet (on windows using the control
panel).

Then buy a new keyboard to know where the letters are.

You might also like