3.3 Data Rep Flashcards

1
Q

How is all data stored in a computer (2 marks)

A
  • In a computer, all data is stored in binary form.

- A binary digit has two possible states, 1 and 0.

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

What base is binary

A

Base 2

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

What is data - simply (3)

A
  • Units of information
  • In computing there can be different data types, including integers, characters and Boolean. - Data is often acted on by instructions.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Binary digit:

  • name
  • how big
A

A binary digit is known as a bit.

A bit is the smallest unit of data a computer can use

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

What can a bit be

A

0 or 1

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

Symbol of a bit

A

b (lower case b)

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

How many bits in a byte

A

A byte if a group of 8 bits

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

What is the fundamental unit of information

A

A bit

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

Symbol of byte

A

B (upper case B)

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

All the quantities in the binary unit system :

A

8 bits 1 byte (B)
1,000 bytes (1,000 B) 1 kilobyte (KB)
1,000 kilobytes (1,000 KB) 1 megabyte (MB)
1,000 megabytes (1,000 MB) 1 gigabyte (GB)
1,000 gigabytes (1,000 GB) 1 terabyte (TB)
1,000 terabytes (1,000 TB) 1 petabyte (PB)

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

What’s a nibble?

A

Four bits or half a byte is known as a nibble.

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

When calculating storage space for disk drives, it is common to use multiples of __.
These are shown in the table above as ?

A

When calculating storage space for disk drives, it is common to use multiples of 1,000. These are shown in the table above as kilobytes, megabytes etc.

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

Decimal system is base what?

A

10

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

The digits in the decimal system:

A

0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.

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

How computers use decimal numbers

A

Decimal numbers must be converted into their binary equivalent before a computer can use them.

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

Denary

A

Decimal

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

The first eight binary place values are:

A

128 64 32 16 8 4 2 1

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

binary number 1111100

In decimal?

A

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

Result - (0 × 128) + (1 × 64) + (1 × 32) + (1 × 16) + (1 × 8) + (1 × 4) + (0 × 2) + (0 × 1) = 124

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

What would these binary numbers be in decimal?

1001
10101
11001100

A

9
21
204

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

In words - to convert binary to decimal…

A

To convert binary to decimal, simply take each place value that has a 1, and add them together.

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

In words, to convert decimal to binary…

A

To convert from decimal to binary, start by subtracting the biggest place value possible from the decimal number, then place a 1 in that place value column. Next, subtract the second biggest place value possible, and place a 1 in the column. Repeat this process until zero is reached. Finally, place a 0 in any empty place value columns.

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

84 in decimal in binary?

A

Result - 84 in decimal is 01010100 in binary.

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

To check that binary conversion is right?

A

To check that this is right, convert the binary back to decimal:

(0 × 128) + (1 × 64) + (0 × 32) + (1 × 16) + (0 × 8) + (1 × 4) + (0 × 2) + (0 × 1) = 84

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

Alternative way to convert a decimal number to binary

A

Another way to convert a decimal number to binary is to divide the starting number by two. If it divides evenly, the binary digit is 0. If it does not and there is a remainder, the binary digit is 1. Finally, reverse the digits and you have the correct number.

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

What would these decimal numbers be in binary?

12
42
188

A

1100
101010
10111100

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

When two numbers are added together in decimal, we take the first number, add the second number to it, and get an answer. For example, 1 + 2 = 3.

When we add two binary numbers together the process is different.

There are four rules that need to be followed when adding two binary numbers. These are:

A

0 + 0 = 0
1 + 0 = 1
1 + 1 = 10 (binary for decimal 2)
1 + 1 + 1 = 11 (binary for decimal 3)

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

adding 01010011 + 01110110

A

1 + 0 = 1

1 + 1 = 0, carry 1

1 + 0 + 1 = 0, carry 1

1 + 0 + 0 = 1

1 + 1 = 0, carry 1

1 + 0 + 1 = 0, carry 1

1 + 1 + 1 = 1, carry 1

1 + 0 + 0 = 1

Result in binary - 11001001 (which is decimal 201). You can check your answers by converting each binary number into decimal and checking your addition. In this example, 01010011 is 83 in decimal and 01110110 is 118 in decimal. So, 83 + 118 is 201.

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

Overflow:

When does unit occur?

A

Overflow occurs when the result of a calculation requires more bits - place values - than are in the available range.

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

Example of an overflow error?

A

For example, when using eight bits, the largest number that can be recorded is 11111111 (decimal 255). When adding together two eight-bit numbers, a situation may occur when the result requires more than eight bits to hold it. For example, adding the binary numbers 11111110 (decimal 254) and 00000010 (decimal 2) would give:

Binary addition: 1 1 1 1 1 1 1 0 plus 0 0 0 0 0 0 1 0 equals 0 0 0 0 0 0 0 0
The result is actually 10000000 (decimal 256), which requires nine bits. However, as only eight bits are available to hold the number, the result would be 00000000 (decimal 0).

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

Consequences of overflow? - key word

The answer refers to last card

A

As you can see, overflow can have serious consequences for the validity of calculations.

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

How are binary numbers multiplied and divided - name

A

Binary shifts

Binary numbers are multiplied and divided through a process called shifting.

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

Multiplication

To multiply a number, a binary shift moves all the digits in the binary number along to the __ and (does what with the gaps?)

  • to multiply by two, ?
  • to multiply by four, ?
  • to multiply by eight, ?
A

Multiplication

To multiply a number, a binary shift moves all the digits in the binary number along to the left and fills the gaps after the shift with 0:

  • to multiply by two, all digits shift one place to the left
  • to multiply by four, all digits shift two places to the left
  • to multiply by eight, all digits shift three places to the left
    and so on
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

1100 (decimal 12) × 2

A

Result - shifting one place to the left gives 11000 (decimal 24)

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

Example - 10110 (decimal 22) × 4

A

Result - shifting two places to the left gives 1011000 (decimal 88)

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

Quick note for binary addition on the spec - regarding what maximum number of bits for exam

A

‘answers will be a maximum of 8 bits in length and will not involve carrying beyond the 8th bit’

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

Shifting left by n bits on a signed or unsigned binary number has the effect of multiplying it by __.

A

Shifting left by n bits on a signed or unsigned binary number has the effect of multiplying it by 2^n.

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

To divide, the digits are moved one place to the __, and the rightmost digit (?).

A

To divide, the digits are moved one place to the right, and the rightmost digit is discarded.

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

Effect of losing digits in right binary shift - key word

A

losing precision. It can happen with too much shifting.

Too much division means losing precision

 The number is divided by 4
 Loss of accuracy …
 … the bits on the right are removed

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

What is the name of the binary shift we do in gcse

A

Logical binary shift

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

Hexadecimal

  • what base
  • how many units
  • what are the units
A

Base 16
Hexadecimal, also known as hex, is the third commonly used number system.
It has 16 units - 0-9 and the letters A, B, C, D, E and F.

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

Decimal vs binary vs hex

A
0	0000	0
1	0001	1
2	0010	2
3	0011	3
4	0100	4
5	0101	5
6	0110	6
7	0111	7
8	1000	8
9	1001	9
10	1010	A
11	1011	B
12	1100	C
13	1101	D
14	1110	E
15	1111	F
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

Why is hex useful (2), with examples

A

Hex is useful because large numbers can be represented using fewer digits. For example, colour values and MAC addresses are often represented in hex.

Additionally, hex is easier for humans to understand than binary. Programmers often use hex to represent binary values as they are simpler to write and check than when using binary.

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

Does hex save memory? Why?

A

Hex does not save memory as it must be converted to binary for the computer to understand it.

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

What powers are hex place values - with examples of the first 5

A

Whereas decimal place values are powers of 10, and binary place values are powers of 2, hex place values are powers of 16.

65,536 4,096 256 16 1

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

HEX:

Each place value can be represented by the units ?

A

Each place value can be represented by the units 0 through to F.

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

Hex to decimal ?

hex number 7C

A

65,536 4,096 256 16 1
——————————. 7 C

(7 × 16) + (C × 1) = (7 × 16) + (12 × 1) = (112) + (12) = 124

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

What would these hex numbers be in decimal?

11
2B
FA

A

17
43
250

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

In words - to convert from decimal to hex (2)

A
  • If the decimal number is bigger than 16, divide it by 16. Take the hexadecimal equivalent of this result - this represents the first digit. Take the hexadecimal equivalent of the remainder - this represents the second digit.
  • If the decimal number is smaller than 16, take the hexadecimal equivalent of the decimal number.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

Example - convert decimal 22 to hexadecimal

A

16 goes into 22 once with 6 left over, so 22 ÷ 16 = 1 remainder 6

1 = hex 1

6 = hex 6

Result - 16

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

Example - convert 138 to hexadecimal

A

138 ÷ 16 = 8 remainder 10

8 = hex 8

10 = hex A

Result - 8A

51
Q

Binary to hex - in words (4)

A
  • Start at the rightmost digit and break the binary number up into groups of four digits. These are known as nibbles. If there are less than four digits, use just that number of digits for that group.
  • Next, convert each group of four digits into decimal.
  • Convert each decimal value into its hex equivalent.
  • Put the hex digits together
52
Q

Example - 1101 to hex

A

1101 = decimal 13

13 = hex D

Result - D

53
Q

Example - 11000011 to hex

A

Break into groups of four - 1100 0011

1100 = decimal 12 
0011 = decimal 3
12 = hex C 
3 = hex 3

Result - C3

54
Q

Example - 110011 to hex

A

Break into groups of four - 0011 0011. In this example, extra 0s are added at the highest values to create two groups of four bits.

0011 = decimal 3 
0011 = decimal 3
3 = hex 3 
3 = hex 3

Result - 33

55
Q

Hex to binary - steps in words (4)

A
  • Split the hex number into individual values.
  • Convert each hex value into its decimal equivalent.
  • Next, convert each decimal digit into binary, making sure to write four digits for each value.
  • Combine all four digits to make one binary number.
56
Q

Example - hex 28 to binary

A

Example - hex 28 to binary

2 = decimal 2 
8 = decimal 8
2 = binary 0010 
8 = binary 1000

Result - 00101000

57
Q

Example - hex FC to binary

A
F = decimal 15 
C = decimal 12
15 = binary 1111 
12 = binary 1100

Result - 11111100

58
Q

hat would these hex numbers be in binary?

11
2B
AA

A

00010001
00101011
10101010

59
Q

all characters, whether they are letters, punctuation or digits are stored as ?
+ why

A

Computers work in binary. As a result, all characters, whether they are letters, punctuation or digits are stored as binary numbers.

60
Q

Character set?

A

All of the characters that a computer can use are called a character set.

61
Q

Two standard character sets in common use are: (In full names)

A

Two standard character sets in common use are:

  • American Standard Code for Information Interchange (ASCII)
  • Unicode
62
Q

ASCII-

  • how many bits?
  • character set size?
  • what this includes?
A

ASCII uses seven bits, giving a character set of 128 characters. The characters are represented in a table, called the ASCII table. The 128 characters include:

32 control codes - mainly to do with printing
32 punctuation codes, symbols, and space
26 upper case letters
26 lower case letters

63
Q

ASCII - A

A

65

64
Q

ASCII - Z

A

90

65
Q

ASCII - a

A

97

66
Q

ASCII - z

A

122

67
Q

ASCII - 0

A

48

68
Q

ASCII - 9

A

57

69
Q

When data is stored or transmitted, what is used

+ example - the word ‘computer’

A

When data is stored or transmitted, its ASCII or Unicode number is used, not the character itself.

For example, in binary, the word “Computer” would be represented as:

1000011 1101111 1101110 1110000 1110101 1110100 1100101 1110010

70
Q

‘A’ is represented by the decimal number 65 (binary __, hex __)

A

‘A’ is represented by the decimal number 65 (binary 1000001, hex 41)

71
Q

Note that there are 127 active characters i.e. show or do something, however code 000 means ?

A

Note that there are 127 active characters i.e. show or do something, however code 000 means NUL which means do or show nothing, thus making up the 128 combinations.

72
Q

Since computer architecture is built around the byte (which has 8 bits) the 7-bit ASCII table is a little inconvenient.
So ASCII characters are padded out to 8 bits, with the first bit always set to 0. This makes __ __ a little easier.

  • but the 8th bit is used for what?
A

Since computer architecture is built around the byte (which has 8 bits) the 7-bit ASCII table is a little inconvenient.
So ASCII characters are padded out to 8 bits, with the first bit always set to 0. This makes memory management a little easier.

  • used as a parity bit to perform a parity check (a form of error checking).
73
Q

Extended ASCII vs ASCII
4

+ difference with Unicode

A
  • ASCII uses 7 bits of an byte to represent a character
  • ASCII can represent 128 characters
  • ASCII sets the most significant bit as a parity bit or as 0
  • Extended ASCII uses the most significant bit and can allow for the representation of 256 characters
  • ASCII is less demanding on memory use than Unicode
74
Q

Limitation of ASCII

A

The 128 or 256 character limits of ASCII and Extended ASCII limits the number of character sets that can be held. Representing the character sets for several different language structures is not possible in ASCII, there are just not enough available characters.

75
Q

UNicdoe

  • why it was needed
  • how many bits
  • how many characters
  • example of additional character
A

While suitable for representing English characters, 256 characters is far too small to hold every character in other languages, such as Chinese or Arabic. Unicode uses 16 bits, giving a range of over 65,000 characters. This makes it more suitable for those situations.

Unicode also allows us to represent additional characters that are more visual such as emojis and emoticons.

76
Q

What does Unicode aim to include - what key thing is it

A

Unicode is a universal character set. It is aimed to include all the characters needed for any writing system or language.

77
Q

Unicode vs ASCII

  • characters
  • space
A
  • Unicode represents a wide range of characters including different languages, mathematical symbols and emojis
  • Unicode can represent a greater range of characters than ASCII
  • Unicode occupies more space and is more demanding on memory than ASCII
78
Q

Purpose of ASCII over Unicode - spec

A
  • data representation of different alphabets and of special symbols allowing far greater range of characters
79
Q

Images used in what form and why

A

Computers work in binary. All data must be converted into binary in order for a computer to process it. Images are no exception.

80
Q

What’s a pixel (2)

A
  • short for Picture Element

- a single point in an image

81
Q

What are bitmapped images made of?

+ colours in images cause of pixels?

A

made up of pixels, a small square of solid colour

In many images, the pixels are too small for the human eye to see, so the colours appear to merge together.

82
Q

Digital bitmapped images are made up of __. Each (1) is represented by a __ __.

A

Digital bitmapped images are made up of pixels. Each pixel is represented by a binary number.

83
Q

NOT in advanced info:

Is 0/1 what colours in simple black and white image

A

0 - black

1 - white

84
Q

What is colour depth

A

The number of bits used to represent each pixel

85
Q

The greater the colour depth —> (purpose)

A

Many images need to use colours. To add colour, more bits are required for each pixel. The number of bits determines the range of colours
- greater number of colours

86
Q

How many colours if colour depth of 2

A

For example, using a colour depth of two, ie two bits per pixel, would allow four possible colours, such as:

00 - black
01 - dark grey
10 - light grey
11 - white

87
Q

Each extra bit __ the range of colours that are available:

  • one bit per pixel (0 or 1) - __ possible colours
  • two bits per pixel (00 to 11) - __ possible colours
  • three bits per pixel (000 to 111) - __ possible colours
  • four bits per pixel (0000 to 1111) - __ possible colours
  • 16 bits per pixel (0000 0000 0000 0000 to 1111 1111 1111 1111) - over __ possible colours
A

Each extra bit doubles the range of colours that are available:

  • one bit per pixel (0 or 1) - two possible colours
  • two bits per pixel (00 to 11) - four possible colours
  • three bits per pixel (000 to 111) - eight possible colours
  • four bits per pixel (0000 to 1111) - 16 possible colours
  • 16 bits per pixel (0000 0000 0000 0000 to 1111 1111 1111 1111) - over 65,000 possible colours
88
Q

How more colours affects image file size (3 mark)

A

The more colours an image requires, the more bits per pixel are needed. Therefore, the more the colour depth, the larger the image file will be.

89
Q

How is the size of an image expressed

A
  • expressed directly as the width of image on pixels by height of image in pixels
  • using the notation width x height
90
Q

Tell me about image resolution (is this on our spec?)

  • what does it effect
  • what it means
  • 2 units its expressed as
  • difference of low resolution vs high, in terms of the pixels
  • and link to file size
A

Image quality is affected by the resolution of the image.

Image resolution is the number of pixels in a specific area of an image. It is expressed as dots per inch (dpi), or pixels per inch (ppi), eg:

72dpi = 72 dots per inch
200 ppi = 200 pixels per inch
In a low-resolution image, the pixels are larger and therefore, fewer are needed to fill the space. This results in images that look blocky or pixelated. An image with a high resolution has more pixels, so it looks a lot better when it is enlarged or stretched. The higher the resolution of an image, the larger its file size will be.

91
Q

Bitmap file size is based on (2)

A

Number of pixels and colour depth

92
Q

Bitmap file size (bits) =

A

Image width x image height x colour depth in bits

93
Q

Bitmap file size (bytes) =

A

(Image width x image height x colour depth in bits)/8

94
Q

Metadata meaning

+ 3 examples (in terms of a file)

A

Data about data

Files contain extra data called metadata. Metadata includes data about the file itself, such as:

  • file type
  • date created
  • author
95
Q

An image file also includes metadata about the image data itself, such as: (3)

A
  • the height and width of the image - this defines how many rows and columns the pixels are to be arranged in
  • the resolution
  • the colour depth
96
Q

Without metadata - consequences on image data …

A

Without this metadata, the image data would not be correctly interpreted, meaning the image could not be correctly displayed.

97
Q

How sound is converted to binary (from what also)

2

A

analogue sound is captured - usually by a microphone - and then converted into a digital signal

An analogue-to-digital converter will capture a sound wave at regular time intervals by measuring the height - amplitude - of the sound wave. This measurement is known as a sample.

98
Q

Why (2) and what must sound be converted SPEC

A

Sound is analogue and must be converted to a digital form for storage and processing in a computer

99
Q

SAMPLE meaning - spec

A
  • measure of amplitude at a point in time
100
Q

In one sentece, how does sound go from analogue to digital

A
  • analogue signals are sampled to create the digital version of sounds
101
Q

(Do we need to know)

  • how sampling actually works
A
  • sound recorded at each sample point is converted to its nearest numeric equivalent (in binary)
  • the data is then stored in a file for later use

E.g. sample 1: has an amplitude of 8 in decimal = 1000 in binary

102
Q

Define sample rate

+ how’s it measured

A
  • the number of samples taken in a second

- usually measure din hertz (1 hertz = 1 sample per second)

103
Q

The higher the sample rate, ? (2)

A

The higher the sample rate, the closer the recorded signal is to the original.

However, the higher the sample rate, the larger the resulting file. As a result, sound files are often a compromise between quality and size of file.

104
Q

Sample resolution - define

A

The number of bits per sample

105
Q

Calculate sound file sizes based on sampling rate and sample resolution
- formula

A

File size (bits) = sampling rate x sample resolution x number of seconds

106
Q

Bit depth:

  • what is it
  • high bit depth = (2)
  • typical bit depths
A

Bit depth refers to the number of bits used to record each sample. For images, the higher the bit depth, the more accurately a sound can be recorded, but the larger the file size. Typical bit depths are 16 bit and 24 bit.

107
Q

Bit rate

  • what
  • formula
  • higher bit rate
A

Bit rate is simply a measure of how much data is processed for each second of sound. Bit rate is calculated by:

Sample rate × bit depth

As with sample rate, the higher the bit rate, the better quality of the recorded sound.

108
Q

So bit depth vs bit rate

A

Bit depth refers to the number of bits used to record each sample.
Bit rate is a measure of how much data is processed for each second of sound.

109
Q

What is compression

+why

A

A method of reducing file sizes, particularly in digital media such as photos, audio and video.

Modern computers often generate files of very large sizes. For example, audio files often run to megabytes, while high definition video can be gigabytes in size. Such files require lots of storage space, and, because of their size, are difficult to transmit. These problems can be overcome by using compression.

110
Q

There are two types of compression that can be applied to files:

A

There are two types of compression that can be applied to files:

lossy compression
lossless compression

111
Q

What is lossy compression

A

With lossy compression, some data is removed and discarded, thereby reducing the overall amount of data and the size of the file.

112
Q

Lossy compression in images

A

An image can be compressed by reducing its colour depth. This reduces the range of colours that the image contains. In practice, this results in an averaging of shades of colours. For example, a very light shade of green could be averaged with a not so light shade - the very light shade might be discarded, and the pixels affected by it re-coloured with the darker shade. If done carefully, this is not likely to significantly damage the quality of the image.

113
Q

Lossy compression in sound (2)

A

For sound, lossy compression may remove sounds outside the human range of hearing that were nevertheless picked up during recording. This would produce no noticeable loss of quality, but would reduce the file size.

Similarly, an audio file can be compressed by reducing the bit depth of the samples. MP3 is a lossy audio file format.

114
Q

3 lossy standards

A
  • the JPEG file format works on this principle, which is why JPEG files tend to be smaller in size
  • the MPEG file format compresses audio and video, making it more suitable for streaming media
  • MP3 is a lossy format for audio, including music
115
Q

Lossless compression

  • what
  • file size reduction
A

With lossless compression, files are reduced in size without the loss of data. However, lossless compression does not usually achieve the same file size reduction as lossy compression.

116
Q

When would we want lossless compression

A

There are some files that we would not want to lose data from. For example:

  • text files
  • spreadsheets
  • financial records
  • emails
117
Q

Various lossless standards exist: (2)

A
  • PDF allows lossless compression of text documents

- PNG is a lossless image file format

118
Q

How run length encoding works

A

One method of lossless compression is run length encoding (RLE). RLE looks at the data in a file for consecutive runs of the same data. These runs are stored as one item of data, instead of many.

Consider this row in a bitmap image:

119
Q

Do RLE on
00 00 00 11 11 11 11 00 00 00

+ affect of RLE

A

The data for this is 00 00 00 11 11 11 11 00 00 00, which is ten data values of two characters each, giving 20 characters in total. RLE looks for the runs of each data, and records what the data is and how many times in succession it occurs. These values are stored instead of the original data.

For example:

00000011111111000000 becomes:

60 81 60 (six 0s, eight 1s, six 6s)

In large files, this can result in significant space savings.

120
Q

What kind of compression if Huffman coding?

A

Lossless

121
Q

How Huffman coding works

A

Huffman coding is a form of lossless compression which makes files smaller using the frequency with which characters appear in a message. This works particularly well when characters appear multiple times in a string as these can then be represented using fewer bits. This reduces the overall size of a file.

122
Q

8 steps of Huffman coding

A
  1. Calculate how many times each character appears in the string.
  2. Put these in order of least to most frequent.
  3. Place the two least common characters along with their frequency in a binary tree. This is done by combining these in a new node and adding the individual frequencies of each character together.
  4. Update the table showing the combined characters.
  5. Take the next two frequent characters and repeat steps 3 and 4 using single letters first until all characters are combined.
  6. Next, follow each branch until the bottom is reached, recording a 0 for branches on the left and a 1 for branches on the right.
  7. This creates a unique code for each character which can be identified by following various paths down the tree.
  8. A set of optimal and completely unique bit patterns will have been created by following the tree until each individual character is reached.
123
Q

Why is Huffman coding efficient

A

This particular technique is efficient because the letters that appear most frequently are assigned the shortest bit patterns. This makes the memory used for the compressed file optimal while preventing any confusion between the binary patterns.

124
Q

Total bits per character worked out by

NOT IN ADVCACND INFO

A

Number of bits to store each character - so 10 is 2 bits

Multiplied by times used - so could be used 3 times

If B has a bit pattern 10 and is used 3 times - total bits is 6