logo

Study resource

Representing images, sound and other data revision notes

Study Representing images, sound and other data with curriculum-aligned Revision Notes resources, practice links, and exam-focused support.

At a glance

revision notes

Resource type

Topic

Representing images, sound and other data

AqaA LevelComputer ScienceFundamentals of data representation

Revision notes

  • Representing Images, Sound and Other Data

    Analogue and digital data

    Analogue data can take a continuous range of values. Digital data is represented using discrete values, commonly as patterns of bits. An analogue signal is continuous, whereas a digital signal uses discrete levels. Digital representation allows information such as images and sound to be stored as binary data.

    Analogue-to-digital conversion

    An analogue-to-digital converter (ADC) samples an analogue signal at regular intervals and represents each sample as a digital value. ADCs are used with analogue sensors. The sampling rate determines how frequently samples are taken, while the sample resolution determines how many bits are used to represent each sample. A greater sample resolution allows more possible values for each sample.

    A digital-to-analogue converter (DAC) converts digital values into an analogue signal. A common use is converting a digital audio signal into an analogue signal.

    Bitmapped graphics

    A bitmap stores an image as a grid of pixels. The size in pixels is:

    width in pixels × height in pixels

    The colour depth is the number of bits stored for each pixel. Ignoring metadata, storage requirement is:

    width × height × colour depth bits

    To convert bits to bytes, divide by 8. For example, an image measuring 800 × 600 pixels with a colour depth of 24 bits has 800 × 600 × 24 = 11,520,000 bits, or 1,440,000 bytes, ignoring metadata. Bitmap metadata may include width, height and colour depth. Resolution may mean the image size in pixels, but it is also expressed as dots per inch, where a dot is a pixel.

    Increasing resolution increases the number of pixels and usually increases storage requirements. Increasing colour depth allows more bits to describe each pixel and also increases storage requirements. A common error is to multiply by colour depth in bytes when it is given in bits.

    Vector graphics

    A vector graphic represents an image using a list of objects. Each geometric object has stored properties, such as its shape, position, dimensions, colour or line properties. A simple graphic can be built from primitives such as a rectangle, circle or line. For example, a scene could be represented by a list containing a rectangle for a background and a circle with its position, size and colour.

    Vector graphics can be resized without storing a separate pixel for every position, so they are appropriate for images made from geometric shapes. Bitmaps are appropriate where the exact colour of individual pixels is important. Bitmap images can show detailed pixel-based images, but enlarging them can reduce apparent quality. Vector images are based on objects, but are less suitable for images that depend on complex pixel-by-pixel detail.

    Digital sound

    Sound is represented digitally by taking samples of an analogue sound signal. Sample resolution is the number of bits used for each sample. Sampling rate is the number of samples taken per second. The Nyquist theorem requires the sampling rate to be at least twice the highest frequency being recorded. If the sampling rate is too low, the original sound cannot be represented accurately.

    For uncompressed sound, a typical calculation is:

    sample size in bytes = sampling rate × duration in seconds × sample resolution in bits ÷ 8

    If more than one channel is specified, multiply by the number of channels. Check that time is in seconds and that the sample resolution is converted from bits to bytes.

    MIDI

    MIDI represents music using event messages rather than storing the complete sound waveform. Event messages can describe actions such as a note being played or stopped. MIDI files can therefore represent music using less storage than a recording of sampled sound and can allow the musical events to be edited or used by different instruments.

    Compression

    Images, sound files and text files may be compressed to reduce storage requirements. Lossless compression allows the original data to be reconstructed exactly. It is suitable when no information can be lost, but it may not reduce the size as much as lossy compression. Lossy compression removes information that is considered unnecessary or less noticeable. It can produce smaller files, but the original data cannot be reconstructed exactly.

    Run length encoding (RLE) replaces consecutive repeated values with a value and a count. Dictionary-based methods replace repeated sequences with references to entries in a dictionary. These techniques are lossless when decompressed correctly.

    Encryption

    Encryption transforms plaintext into ciphertext using a cipher and a key. Decryption transforms ciphertext back into plaintext. A Caesar cipher shifts letters by a fixed amount. It is easily cracked because the number of possible shifts is limited and the pattern of the substitution can be investigated.

    A Vernam cipher, or one-time pad, uses a key chosen uniformly at random. The key must be used once only. The ciphertext is uniformly distributed, and the Vernam cipher is mathematically proved to have perfect security. Other ciphers rely on computational security: in theory, they can be broken given enough ciphertext and time, although this may be impractical.

Related topics

Study nearby topics next