2) Databases and Representation of data Flashcards

1
Q

What is data compression?

A

Compression is the process of reducing the number of bits required to represent data.
Different types of techniques of compression are used dependent on the data type being compressed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is compression needed?

A

Compression is important as machines have a finite amount of storage space, meaning that there is limited space as the quality of videos and images has become more prevalent.

The better the compression algorithm used, the faster you will be able to download the same quantity of data over the internet.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Lossy Compression

A

Lossy compression is where compression is achieved by permanently removing un-needed data ( Meta data), but once removed then it can never be retrieved.
Formats are JPG and GIF.

Advantages:

  • Significantly decreases the size of the data in a file from the original, ( 60-70%) reduction.
  • Removes unwanted data (Meta data).

Disadvantages:

  • Image quality decreases
  • Irreversible change so once data has been removed it is permanently gone.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Lossless Compression

A

Lossless compression is where compression is achieved without any data being lost, so the entire document can be retained.
Formats are PNG and RAW.

Advantages:

  • Data removed can be retrieved
  • Produces a reduced image size with image quality remaining the same.

Disadvantages:

  • Very low in reduction of file size.
  • Resultant file is not as small.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Run Length Encoding (RLE)

A

RLE is a method of compressing data by eliminating repeated data.
For example, if there are large blocks of colour it is highly inefficient to hold 32 bits per pixel as instead a colour and repetition value can be stored.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Dictionary Based Compression

A

This form of compression is used to compress a text file as letters and words can be repeated. For each word in a file, a corresponding code is given.

For this compression, a file with all the codes must be saved with the file. This makes dictionary methods impractical for small files.

Example;
In : 00000
Have : 00011
Can : 01100

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How does Lossless Compression Work?

Lossy Compression- MP3

A

Works by recording patterns in the data rather than the data itself. Using pattern information, a new file can be replicated exactly without any loss of data.

Lossy compression removes the sounds that are out of the range of human hearing. Quieter notes are played at the same time as louder sounds are also removed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

RLE of sound

A

A sound recording can have thousands of samples taken per second. The same sound can be played for a second can result in hundreds of identical samples.

RLE records one example of the sample and how many times it should be repeated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Caesar Cipher

A

The caesar cipher is the most basic type of encryption as all letters of the alphabet are shifted by a consistent amount. Spaces are often removed to mask the word length.

To brute forcibly decrypt you could assume the letter that occurs the most frequently are vowels.
E is the most common letter followed by T, A, O, I, N, S, R, H.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Vernam Cipher

A

The Vernam cipher is a method of encryption that uses a one-time pad to create a ciphertext that is mathematically impossible to break.

The one-time pad is a key used once to encrypt and decrypt a message before being discarded.
The one-time pad must be a random sequence and only ever used once.
Must be shared with the recipient by hand and immediately destroyed after use.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Decoding

A

Encryption and decryption of the message is performed bit by bit using an exclusive or (XOR) operation with a shared key.

L = 01001100
XOR
c = 01100011
00101111 = /

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Capturing an image

A

A digital camera breaks up the light through its lens into a grid of pixels.
A light sensor measures the intensity of colour in each pixel. Each measurement is converted into binary code using an analogue-to-digital converter.
The number of pixels recorded in the grid affects the number of bits used and therefore, the size of the file created.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Bitmapped Graphics

A

Bitmapped graphics use a grid of pixels, with each pixel given a specific colour value. E.g. (X=21, Y=3) 75a248

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Number of pixels

A

Resolution = number of pixels wide x the number of pixels high

2438 by 2124 = 5,178,312 pixels 5.2 Megapixels

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Resolution

A

Resolution is the width x height or pixel per inch.
If an image is made bigger or smaller, the size of each pixel grows or shrinks to maintain the required resolution. This is why there is a deterioration in quality when a bitmap is resized.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Creating images

A

More bits per pixel = more colour combinations
2^n
n = number of bits per pixel

2 bits = 4 colours
8 bits = 256 colours
16 bits = 65536 colours

The greater the bit depth, the greater the file size required for that image.

17
Q

Colour Codes and Calculating File Size

A

RGB - (Red, Green and Blue), values range from 0-255.
For 256 variations = 256^3 = 16,777,216 bits

In 32-bit colour, what are the last 8 bits for?
Blue variations

Image file size is determined by the number of pixels used and the number of colour combinations.
Example:
An image is captured on a 2-megapixel camera.
Image captured with a 24-bit colour depth.
2,000,000 x 24 = 48,000,000 bits = 6MB

18
Q

Metadata

A
Metadata is data about data stored in the same file as the image data. 
This includes:
- the date it was created
- the width and height in pixels
- the colour depth
19
Q

Vector Graphics

A

Vector graphics are a store of a series of commands which build up shapes.
A vector graphic can be represented as a list of objects or a list of drawing commands that reference geometric objects.
Shapes are formed from closed paths such as triangles and polygons.

20
Q

Resolution Independence

A

Vector graphics are resolution independent, meaning where elements on a screen are rendered at sizes independent from the pixel grid, resulting in the user interface being displayed at a consistent size.

21
Q

Factors which affect digital image quality?

A
  • Number of bits per pixel
  • Resolution
  • Number of pixels per inch
22
Q

Analogue and digital signals

A

ADC- Microphones
DAC- Speaker
An analogue to digital converter will change analogue signal into data that the computer can understand.

23
Q

Analogue to digital conversion

A

Analogue sound samples are recorded by an amplifier, each sample is quantised to measure its wave height to an integer value. This integer value is converted and stored digitally as a binary value.
To output a sound this processes is repeated but in the reverse order.

24
Q

Sampling and sample resolution

A

Sampling is where an analogue signal is measured in regular periods.
The amplitude of the signal is referred to as the sample resolution. Measured in Hz, the number of samples per second.

The number of bits (bit depth) used to record each measurement is known as the resolution. The more bits used per sample enables the wave to be more accurately measured.

25
Q

Sample Rate

A

The sample rate per second affects the level of detail in the digital representation.

26
Q

Calculating File size

A

File size = Sample rate x resolution x length in seconds
Example:
A 30s audio track is recorded, the sample rate is set to 44,000Hz and the resolution is 16 bit.
30 x 44000 x 16 = 21120000 bits
21120000/8 = 2,640,000 bytes/ 1000000 = 2.64 MB

27
Q

Nyquist Theorem

A

There is a limit to the lowest sample rate as sound is made up of many components each with different frequencies, SAMPLES MUST BE TWICE THE HIGHEST FREQUENCY in order to replicate the original wave.
f (s) > 2f (max)

f(s) = lowest sample rate = 2 per Hz

28
Q

How to capture the full frequency of a wave?

A

Need to sample on both the top and bottom of the waveform.

29
Q

MIDI (Musical Instrument Digital Interface)

A

MIDI created sounds as requested either from an instrument or a piece of software. It is not a live recording, but a synthesis sound.
An example of a MIDI device is an acoustic guitar.

Benefits:

  • The full sound signal doesn’t need to be transmitted.
  • Reduces the amount of data transferred.
  • As sounds are synthesised, they sound less realistic.
30
Q

Event Messages

A

Event messages control the various properties of the sound. These messages are typically encoded into binary providing communication between the MIDI and the processor.

An event message may contain:

  • what pitch a note is
  • how loud to play it
  • timing a note to play with other notes or sounds