Log in
Sign up for FREE
arrow_back
Library

STIG AS Level Compression

star
star
star
star
star
Last updated 8 months ago
9 questions
1
1
1
1
1
1
1
3
Question 1
1.

Knowledge DUMP LOSSY COMPRESSION

Question 2
2.

Knowledge DUMP LOSSLESS COMPRESSION

Understanding Compression

For NOOBS ONLY

Think of compression as packing for a trip. When you pack your suitcase, you fold your clothes neatly and arrange them to take up less space. This allows you to fit more items in your suitcase. Compression works similarly - it reduces the size of data so that it takes up less storage space and can be transmitted more quickly over a network.

Understanding Compression

For Techie People


Compression is the process of encoding information using fewer bits than the original representation. It involves identifying and eliminating redundancy or irrelevant information. There are two main types of compression:
  1. Lossless compression: No information is lost, and the original data can be perfectly reconstructed from the compressed data. It's like folding your clothes - no clothes are lost, and you can unfold them back to their original state.
  2. Lossy compression: Some less important information is discarded to achieve higher compression. The reconstructed data is an approximation of the original. It's like deciding to leave some less essential items out of your suitcase to save space.
In computing, data compression is used in many different file formats. Here are some concrete examples:
  1. Text Files (.zip, .rar):Techniques like Huffman coding are used, which assign shorter bit sequences to frequently occurring characters. Lossless compression ensures the original text can be perfectly reconstructed.
  2. Images (.jpg, .png):Lossy compression like JPEG discards imperceptible color information and details. Lossless compression like PNG uses techniques like run-length encoding (RLE), which replaces repeated "runs" of identical pixel values with a single instance and a count.
  3. Audio (.mp3, .aac):Lossy compression identifies and removes frequencies that are less perceptible to the human ear based on psychoacoustic models. Lossless compression like FLAC encodes audio in a way that allows perfect reconstruction.

Geeky - What are compression algorithms?


At a technological level, compression algorithms identify patterns, remove redundancy, and efficiently encode the remaining information using techniques.
Question 3
3.

Vector Graphics Compression

Removing redundant information:
  • Eliminating duplicate definitions of shapes, colors, or gradients.
  • Removing unnecessary metadata.
Simplifying mathematical expressions:
  • Rounding coordinates to reduce decimal places.
  • Simplifying complex paths into simpler ones.
Encoding techniques:
  • Using binary encoding for paths and shapes.
BEFORE

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg">
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red"/>
</svg>




BITMAP COMPRESSION
Bitmap images represent images as a grid of pixels. Each pixel has a specific color value. Compression techniques for bitmaps include:
  1. Run-Length Encoding (RLE):Lossless compression technique. Replaces repeated "runs" of identical pixel values with a single instance and a count. Effective for images with large areas of uniform color.
Question 4
4.

State the minimum number of bits needed to represent each pixel in the image

Question 5
5.

Calculate the minimum file size of the image shown

Question 6
6.

The designer takes a photograph to put on the poster. The photograph has a resolution of 50000 pixels by 50000 pixels. The colours are represented using 4 bytes per pixel. Estimate the file size of the photograph in gigabytes. Show your working.

Question 7
7.
Lossy
Lossless
Cropping the image
Reducing the resolution of the image
Using run-length encoding (RLE)
Reducing the colour depth of the image
Question 8
8.

Explain how run-length encoding would compress the image

Lossy Compression:

  • Reduces file size by discarding some data that the human ear is less likely to notice.
  • Perceptual music shaping: Identifies and removes sound frequencies that are outside the range of human hearing, or that are masked by louder sounds in the same range.
  • Approximation techniques: Simplifies the audio by reducing the precision of certain elements, such as softer background noises.
  • Bitrate reduction or bit-depth reduction, and it involves decreasing the precision of each sound sample. In audio, higher bit-depth means more detailed sound information per sample. By reducing the bit-depth (e.g., from 16-bit to 8-bit), some of the finer audio details are lost, but the file size is significantly reduced.
  • Common formats: MP3
This process makes the compressed file smaller by permanently removing parts of the audio, so the decompressed file isn’t identical to the original.


Lossless Compression:

  • Compresses audio without losing any data, maintaining the original sound quality.
  • Redundancy removal: Identifies and eliminates repetitive or redundant data. For instance, if certain sound patterns or notes repeat, the file compresses them more efficiently without loss. Reversible algorithms: Uses complex encoding techniques like Huffman coding or FLAC’s run-length encoding, which allow the exact original audio file to be recreated when decompressed.
  • Common formats: FLAC
The decompressed file is identical to the original, making lossless ideal for professional audio or archival purposes.
1
Question 9
9.

Key Points/Questions

Text Compression

Redundancy Removal: Text often contains repeated patterns or characters. Compression algorithms identify these patterns and replace them with shorter representations.

Encoding Schemes for Redundancy Removal: Compression uses specific algorithms to encode the data. Some common methods include:
  • Run-Length Encoding (RLE): Replaces consecutive repeated characters with a single character and a count (e.g., "aaa" becomes "a3").
hello hello hello

Identifying Patterns:"hello" appears three times.
Compressed Representation: Using RLE: The string could be represented as "3hello".
Stored Size:Original: 15 bytes (including spaces). Compressed: 8 bytes ("3hello").


  • Huffman Coding: Assigns shorter codes to more frequently occurring characters and longer codes to less common ones based on their frequencies. - don't need to know how it works for A-Level
AFTER

<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" stroke="#000" stroke-width="3" fill="red"/></svg>

Now let's apply some compression techniques:
  1. Remove the XML declaration and doctype, as they're not strictly necessary.
  2. Remove unnecessary whitespace and newlines.
  3. Simplify the circle element by removing redundant attributes and shortening values.


Why use Lossy and why use lossless:

Lossy Compression
  • The human ear will not notice that parts of the original data have been discarded or altered.
  • Results in greater file size reduction compared to lossless compression.
  • Useful when smaller file size is necessary for faster transmission, like email attachments.
Lossless Compression
  • Maintains high precision and accuracy, with no loss of the original data.
  • The decompressed file is identical to the original.
  • Often requested when high-quality formats are needed, such as flac files.