4.5.6.2 Analogue and Digital

Analog has a continuous range of values, whereas digital has only two states. On or off, one or zero

|
|               ###
|             ##   ##
|            #       #
|-#---------#---------#---------#--> Time
|  #       #           #       #
|   ##   ##             ##   ##
|     ###                 ###
|

An example analog wave

|
|    ########      ########
|    #      #      #      #
|    #      #      #      #
|#####------########------########-> Time
|
|
|
|

An example digital wave

4.5.6.4 Bitmapped Graphics

Bitmaps rely on a series of square blocks called pixels. Each pixel is a square, and each pixel is defined with it's own colour.

PPI defines the density of the image, pixels by inch.

Bitmap graphics are usually photographs. They can be scanned or photographged with a digital camera. You can create/draw images with appropriate hardware and bitmap graphic software, e.g. Adobe Photohop or the GNU Image Manipulation Program

Bitmap graphics are made up of thousands of individual dots called pixels. Resolution is determined by how many pixels are are per square inch. Pixels are placed side-by-side to create a continuous image.

Lossy image formats include:

  • .jpeg
  • .jpg

Lossless image formats include:

  • .gif
  • .png (image/png)
  • .xcf
  • .tiff

Note that information is lost whenever the image is enlarged.

Colours

RGB

The RGB colour model is an additive colour model in which red, green and blue are added together to create colours.

CYMK

The CYMK colour model is a subtractive colour model in which cyan, magenta, yellow and a key.

Bit Depth

The bit depth defines the number of colours the image has. The chosen file depth determines the file depth.

The more bits per pixel, the greater the colour depth. Decreasing the bits per pixel makes the image look posterised.

Resolution

The resolution is the number of pixels that an image has. A higher resolution image can store more image detail.

Alpha

As well as RGB, a fourth channel "Alpha" may be included for transparency.

Metadata

Metadata is information stored in the file about the data itself. This data describes the format of the file, the resolution, the colour depth, etc. This is usually encoded in the file using the Exif metadata standard.

Information that can be encoded includes:

  • Aperture
  • GPS
  • Make and model of camera
  • Height
  • Width

File Size

\({Width \times Height \times Bit Depth \over 8} + Metadata = Size\) (In Bytes)

Max non-compressed crap storage format

4.5.6.5 Vector Graphics

A vector graphic is made of mathematic instructions.

Geometrical primitives include:

  • points
  • lines
  • curves
  • shapes
  • polygons

B├ęzier curves allow magical curves to appear.

Circletine

4.5.6.6 Vector Graphics vs Bitmapped Graphics

Vector graphics are significantly smaller in size, but are primitive. Because vector graphics are calculated, scaling is possible at any size. Bitmapped images do not scale well

Vector

+ Low file size + Quality Maintained - Only colour of whole lines or shapes chan be changed - Complex images are hard to reproduce - Thin lines may disappear if shrank to small - Small errors can be magnified when scaled

Bitmap

+ Easy to work with + Colour of each dot can be changed + Common and widely used - Lossy when resolution increased - Takes up a lot of computer backing storage

4.5.6.7 Digital representation of sound

Keywords include:

A sound wave is a change in air pressure, which ears interpret as sound. A microphone records an analog signal, and a DAC converts it into a digital signal.

Advantages of a digital signal

+ Can copy without loss of data - Not exactly the original sound

Frequency

CDs use 44.1 kHz as this is two times 20kHz, the maximum frequency that the human ear can hear. This is to record both the peak and trouch of the wave, so give a close representation of the true sound.

Bit Depth

The bit depth determines the range of volumes storable for each sample. If you have a low sampling resolution (bit depth) then the rangew of volumes will be very limited, if you have a high sampling resolution (bit depth) then the file size may become unfeasible. The sampling resolution (bit depth) for a CD is 16 bits per sample.

Bit Depth Usually...
16 CD
24 DVD

Bit Rate

The bit rate of a file tells us how many bits of data are processed every second. Bit rates are usually measured in kilobits per second (kbps).

Calculating bit rate

The bit rate is calculated using the formula:

\(frequency * bit depth * channels = bit rate\)

For example, the file size of an audio file that:

  • Lasts for 5 minutes
  • Has a sample rate of 411000 samples per second
  • Has a bit depth of 24 bits
  • Is stereo
591840000 ........ Bits 73980000 ........ Bytes 73.98 ..... Megabytes 70.55282593 Mibibytes

4.5.6.9 Compression

  • Know why images and sound files are often compressed
  • Understand the difference between lossless and lossy compression and explain the advantages and disadvantages

Compression is a useful tool for reducing file sizes. When images, sound or videos are compressed, data is compressed to reduce the file size. This is very helpful when streaming and downloading files.

Streamed music and downloadable files, such as mp3s are usually between 128kbps and 320kbps, much lower than 1.4 mbps of an uncompressed file.

Videos are also compressed when they are streamed over a network. Streaming HD video requires a high-speed internet connection. Without it, the user would experience buffering and regular drops in quality. HD video is around 3 Mbps, while SD is 1.5 Mbps

+ Uses less internet bandwidth when they are downloaded so transfer speed is quicker + Takes up less storage space on the servers of storage providers or on devices + Smaller files reduces congestion on the internet, which is good for everyone + It makes audio and video files suitable for streaming + Email services usually normally have restrictions on the size of the attachment you can send
_Video is copyright LinusMediaGroup_

Lossless compression

Lossless compression means that as the file size is compressed, the image or audio quality remains the same It does not get worse. Also, the file can be restored to it's original state. FLAC and ALAC are open source lossless compression formats.

Lossy compression

Lossy compression permanently removes data. For example, a WAV file compressed to an MP3 would be lossy compression. The bit rate could be set at 64kbps, which would reduce the size and the quality of the file. However, it would not be possible to recreate a 1411kbps quality file from a 64kbps MP3.

With lossy compression, the original bit depth is reduced to remove data and reduce the file size. The bit depth becomes variable.

MP3 and AAC are lossy compressed audio file formats widely supported on different platforms. MP3 and AAC are both patented codecs.

Audio compression

Audio files can be compressed in a similar way to image files. Digital audio files that contain all of the sound data are saved in a Waveform Audio (WAV) format. Typically a 3 minute recording will have a file size of 30MB. There are frequencies and tones we cannot hear and slight differences in volume and frequency we cannot distinguish. These are removed to reduce the size and an MP3 file is usually a tenth of the size of a wav file.

Digital Video Compression

A digital film is created from a series of static images played at high speed. Films have a frame rate.

Media Rate
Console Peasants 30fps
Film 24fps
TV (PAL) 25fps
TV (NTSC) 30fps
Computers 60fps (usually, 120, 144, 240+ are available)

Videos are compressed to:

  • Reduce the resolution
  • Reduce the dimensions
  • Reduce the bit rate

Delta encoding is used to reduce the file size of a film by storing pixels that do not change between each frames instead of replicating them for each frame.

_Video is copyright LinusMediaGroup_

Codecs

Codecs are programs that encode data as usable files, whether images, audio or video.

_Video is copyright LinusMediaGroup_

Run Length Encoding (RLE)

One of the simplest examples of compression is RLE. RLE is a basic form of data compression that converts consecutive identical values into a code sonsisting of the character and the number marking the length of the run. The more similar values there are, the more values can be compressed. The sequence of data is stored as a single value and count.

Encoding Size Text
None 71B BASIC AND STUPID, THE RLE IS CRAP COMPARED TO OTHER SIZE SAVING METHODS
RLE 71B BASIC AND STUPID, THE RLE IS CRAP COMPARED TO OTHER SIZE SAVING METHODS
None 52B AAAAAABBCCCCCCCDDDDDEEEEEEEE XXXXXXDDDDDDDD TWAISUUU
RLE 23B 6A2B7C5D8E 6X8D TWAIS3U

The RLE is not the best compression method available.

Questions

Answer

A line graph

  1. Convert this analogue signal to an 3 bit depth digital representation
hhhhhheeeeeeeeemmmmmttttttttttiihhhhha
  1. How many bytes are used for the above string?
  2. What is the RLE encoded string for this string?
  3. How many bytes are used after encoding?
  4. How many bytes have been saved?