IPT - A Virtual Approach IPT A Virtual Approach by Peter Whitehouse
Quick Links:
 
 
Hardware Home
Information and Intelligent Systems Social and Ethical Implications Human Computer Interaction Software and Systems Engineering eXercise Files Course Outline and Assessment A-Z of Geeky Acronyms Terrace Work Program 2004 Sillybus FAQ = Frequently Asked Questions Help
 
 

Graphics and Sound

The Monitor

Computer graphics control what you see when you interact with the most common output device - the Monitor. The pictures that are created on your computer screen to display the text, animations and even the mouse pointer are created differently to images you have seen all your life on your TV screen.

Initial discussion will concentrate on display cards - which to a large degree control what you see on the tube.

Firstly, some terminology....

Computer monitors are divided up into lines (called scan lines) of pixels. A pixel (short for picture cell) is a 'spot' of phosphorescent material that can either glow or not glow (in a monochrome monitor), or parts of it glow in RED, GREEN and BLUE (in a colour display). Various compinations of RGB, along with varying intensities create the colours we see on a computer screen using the additive spectrum.

a pixel
an RGB pixel

Electron beams are shot at the pixels, causing them to glow very briefly (usually, a pixel glows for less than 1/60th of a second). A monochrome monitor has a single electron gun. In a colour monitor, there are three (3) electron guns - one for each colour within a pixel (RGB), which must be aimed very precisely. Maintaining a 'solid' colour on a monitor requires regular bombardment by the electron gun - fortunately our eyes are relatively insensitive, and can not detect the pixel going on and off but rather we 'see' solid colour.

To improve the contrast of the pixels, most monitors use a SHADOW MASK, which consists of dark material with holes corresponding to where the pixels are. A typical monitor has a DOT PITCH of 0.30 mm or closer - meaning the holes in the shadow mask and therefore the pixels are that far apart.

Two methods of image display are commonly in use - VECTOR and RASTER. Raster display draws screen images line by line top to bottom.

There are two standards in RASTER video refresh which describe the method used for drawing images on screen: Interlaced and Non-Interlaced.

scan types

Interlaced monitors are a 'relic' from early television where electron gun technology was sufficiently primitive to not allow quick drawing of the entire screen - to combat this every second scan line was drawn down the screen, then the gun looped back and filled in the missing lines. If the refresh rate was 30Hz (or cycles per second) then each pixel could be visited at most once every 1/60th of a second.

Non-Interlaced monitors are now fairly standard, and every scan line from top to bottom is drawn in each pass. Refresh rates of 75Hz and higher are common these days, assisted by graphics accellerator cards to render very crisp images and animations.

The monitor's image is controlled by the video card it is attached to. There are a large number of video standards available through standard video cards:

  • MDA=Monochrome Display Adaptor - 4Kb vid RAM, (9x14 text cell), high quality text, NO graphics
  • CGA=Color Graphics Adaptor - 16Kb vid RAM, (8x8 text cell), 3 graphics modes, 4 text modes, low quality text (as composed of RGB pixels, 16 colors 4 at a time (+ intensities)
  • HERCULES=16 Kb vid RAM, Monochrome standard text with mono graphics (9x14 text cell)
  • EGA=Enhanced Graphics Adaptor - 128 Kb vid RAM, (8x14 text cell), reasonable text quality, High resolution graphics 64 colours 16 at a time
  • VGA=(standard) Video Graphics Adaptor - 128 Kb vid RAM, 640x480 pixels, 262144 colours 16 at a time (plus intensities)
  • MCGA=Multi-Colour Graphics Adaptor - 128 Kb vid RAM, 262144 colours 256 at a time
  • SVGA=Super VGA - 512+ Kb vid RAM, 1024x768 with millions of colours, unlimited combinations.

Graphics Accellerator cards usually are equipped with extra processors and memory built into them to relieve much of the graphics pre-processing and frame buffering normally handled badly on a PC by the existing graphics sub-system. Significant display improvements can result from such additions to systems, thus relieving some of the chip congestion at the CPU. The IBM Clone was never designed with graphics in mind, but rather graphics appeared as an add-on afterthought. As such, PC graphics has always lagged behind other types of machines with graphics sub-systems built in (like Silicon Graphics and Apple Computers).

Television uses a COMPOSITE colour signal - where the image information arrives on a single co-axial cable. Computer video displays usually use color separation to display images. With color separation, the primary colours RED GREEN and BLUE are sent separately, and mixed on screen via an RGB PIXEL. Using INTENSITY with RGB it is possible to create any color using ADDITIVE color mixing.

additive spectra
the additive spectrum

RESOLUTION refers to the number of pixels, their size, and closeness to each other

Video RAM is scanned at least 30 times a second (often many times faster than that), and that information is passed to the monitor as a REFRESH. Refresh rate determines image quality (together with resolution).

Refresh rates can greatly effect the appearance of multimedia/animation and realtime applications, however faster and sharper monitors fail to render images realistically, and so artificial aids like fog and motion blur are often added to make images appear more real.

TEXT MODE

The text monitor is divided into cells (usually 80 by 25 = 2000 per page). Each cell is 8 or 9 pixels wide and tall. Each text cell occupies 2 bytes of video RAM (the ASCII code, and the attribute byte) - this means a PAGE is approximately 4Kb. The cursor is on a page of memory, pages of memory are moved in and out depending on cursor movement

a text cell

Text mode usually uses BITMAPPED FONTS as displayed above. The ASCII code is 'looked up'in a table stored on the video card for the corresponding pixel pattern before the text cell can be displayed on the screen in a bitmapped font.

OUTLINE FONTS are different (and usually reserved for graphics modes). Instead of each pixel being stored, vertices (or corners) and fill characteristics for each letter are stored instead. Outline fonts have the advantage of being scalable - that is they can be displayed with variable pitch (or size) using the same set of instructions - they also scale cleanly (without jaggies/aliasing), whereas a bitmapped font required each letter to be stored pixel by pixel, and can use some 'ugly' scaling effects.

Raster Displays

Raster generated images are drawn as part of a whole screen refresh. Shapes and letters are constructed by (either by interlaced or non-interlaced) scanning of the whole screen at a usual rate of 50-90 Hz. Monitors using raster display are used for full screen animation and complex image display and generation. Most personal computers use raster display monitors.

Raster images suffer from scaling (either up or down). When scaled up (ie. made bigger, the pixels become visible 'blocks' and the image loses resolution. When a raster image is reduced, small areas may become un-renderable and thus 'disappear', thus the image loses quality corresponding to the highest resolution available.

Vector Displays

Specialised graphics applications require accurate rendering of lines and polygons, such as high-end graphics workstations and CAD screens. Vector images are defined by their vertices (corners or end points) and other key points along the paths of lines. Their display differs from that of raster images, as the computer places the vertices, then joins them up with line segments. In a vector display, only those sections of active image are drawn, rather like a plotter.

Vector images can be (theoretically) infinitely scaled up or down, as they are merely a collection of control vertices, that are joined up later. Unlike raster images, enlarging or diminishing the image does not effect the appearance of the image (the edges and corners still appear to be rendered sharp), depending on the resolution of the monitor as the final determiner of image quality.

To animate vector images, only certain sections of the screen need to be re-drawn, the rest is not touched. Vector displays form the basis of the majority of high-res computer animation.

Some Visual Problems

Perfect human eyes can distinguish approximately 14Million colours in the reflective (subtractive) spectrum, with most of us able to distinguish much less. 'FULL COLOUR' rendering on computer screens (also referred to as 24bit colour) uses 16.7 Millionish colours (256 different levels of R x 256G x 256B) - although this exceeds the capacity of the eyes perception, it is the closest multiple of 2 and so is a standard. It is unlikely that we will need to exceeed this standard as we will never be able to appreciate further refinement in colour level generation. Resoloution and refresh rates, however, are always on the improve - the biggest barrier to refinement is the sheer volume of information that needs to be moved from one part of memory to another each refresh.

24 bit colour refers to the number of bits of information used to control the relative intensities of RGB in each of the pixels. 8 bits are used for each of the primarys (Red, Green and Blue) totalling 24 bits per pixel. The memory required for some of the larger resolution monitors (1024x768 pixels x 24 bits per pixel drawn 75 times a second) represent formidable challenges to the makers of video and animation.

Screen images are composed in VideoRAM in a section of memory called the VIDEO or FRAME BUFFER. The bits representing a pixel in the frame buffer don't always specify the pixel's colour directly. In some colour architectures (eg. the 256 colour system), the bits represent the colour code in a pre-defined table of display colours called a PALETTE. Systems employing palettes can actually display any colour, but are limited to 256 colours on the screen at once. This explains why sometimes the images displayed have 'unusual' colours displayed (when all 256 colours are on screen, the display allocated any 'additional' colour to an existing palette entry, leading to some very strange results.

One way to cope with the 'limited' range of colours available in a 256 colour display is to use DITHERING.

ordered dither
This is one way of making
yellow using an ordered dither pattern

There are many variations to the basic dithering model, all of which rely on the eye's relative insensitivity which blends adjacent pixels colours together.

Resolution and colour depth can greatly effect the quality of an image:

full colour - 16.7 Million colours
Full/True colour - 16.7 Million Colours
256 colours - Ordered Dither
256 colours - Ordered Dithering
16 colours - ordered dither
16 colours - ordered dithering
16 colours - nearest colour
16 colours - nearest colour
16 colours - error diffusion
16 colours - error diffusion

All versions of the above image are still recognisably my very cute cat (named PC), but the image quality varies considerably.

A basic limitation of pixel-based display technology is the inability to represent sloped or curved lines accurately. with a fixed grid of pixels used for display, stepped edges are common on sloping and curved lines. The effect is exaggerated by close inspection:


A pair of curved lines, the left one drawn using antialiasing, the one on the right without. In the magnified view on the right, you can clearly see the antialiasing - blocks of tonally similar colour 'bleed' out from the edges of original colour to give the visual appearance of smooth lines.

The stepped appearance is called ALIASING, using various intensities of the same colour to blur the edges is called ANTIALIASING.

The REFRESH RATE must be 30Hz or better to be 'flicker free' (that is the image must be re-drawn on the screen at least 30 times a second for it to appear stable) - the glow from a typical pixel lasts for approx. 10 microseconds. You may have noticed when video cameras film computer screens, the image breaks up - this is caused by the frame rate of the vid-cam corresponding to the times in between refreshes when the monitor has an incolmplete image displayed - the continual picture is an illusion made possible because of the relatively poor performance of our eyes.


Graphic File Formats

There are many different graphics file formats available on computers, with conventions and naming conventions varying depending on whether they are raster or vector images

Bitmap (raster) formats include BMP, GIF, JPEG, TIFF, PCX
Vector formats include WMF, EPS, CGM, CDR

BMP

Bitmap files (BMP) are a native raster file format used in Windows and OS2. The information contained in their files is encoded using the following definition:

File Header BM signature (2 bytes)
File size (4 bytes)
Reserved (4 bytes)
Location of bitmap data (4 bytes)
Information Header Size of info header (4 bytes)
Image height (4 bytes)
Image width (4 bytes)
Number of colour planes (2 bytes)
Number of bits per pixel (2 bytes)
Compression method used (4 bytes)
Number of bytes of bitmap data (4 bytes)
Horizontal screen resolution (4 bytes)
Vertical screen resolution (4 bytes)
Number of colours used in image (4 bytes)
Number of important colours (4 bytes)
Colour Table 4 byte entries for each of the colours in the image
Bitmap Data bottom row of pixels
second bottom row of pixels
:
top row of pixels

The colour table is either used to construct a 256 colour palette on a 256 colour system, or used as-is to encode the colours for each pixel of the image.

RLE Encoding

Using RLE, it is possible to greatly reduce the size a file occupies. When you examine a bitmap's data, it is not unusual to find sequences of adjacent pixels that are the same. RLE uses 2 reserved codes as tokens (a token to indicate the number of pixels that have the same colour, a different token to indicate the number of non-repeating pixels). When there are 3 or more of the same coloured pixel then they are replaced by 2 codes - a RLE token and a copy of the pixel value, otherwise a non-repeating token is inserted before the sequence of non-repeating pixel values.

for example: 4,5,3,12,52,1,3,76,4,81,5,0,56,12,4,16

would expand to: 5,5,5,5,12,52,1,76,76,76,81,81,81,81,0,56,12,4,16

RLE is hopeless on images that have huge continuous variations in colours, as the RLE form of the file can actually be larger than the non-compressed file due to the tokens outnumbering the actual pixel information. RLE is, however, a lossless compression technique - the uncompressed image is undamaged. There are a number of lossy compression algorithms - JPEG being one that uses complex mathematics to 'average' colour values for blocks of the image. Depending on the block size and the amount of 'averaging', the image can suffer in quality quite severly


PC Sound and Sound Cards

Most PC's these days are fitted with sound cards, and are often supplied with CDROM and speakers. All PC's are also equipped with a small speaker fitted inside the chassis, and this speaker used to be the sole sound output - the PC speaker is activated via software, and you are able to effect the PITCH (high or low, controlled by varying the frequency of vibration of the speaker cone - fast vibrations make high pitched noises, slow vibrations make low pitched noises), VOLUME (loud or soft, by varying the amound of vibration) and DURATION (how long the note plays for). Whilst this may have been satisfactory for early PC games, improvement was inevitable.

The SOUND CARD contains specialised digital to analogue signal processors, synthesiser chips, and MIDI processors. 8bit, 16bit, 32bit and 64bit cards are available these days, in stereo. Sampling rates varying from 5kHz to over 50kHz are common, all making for convincing sound (very important when playing Quake IV to be able to distinguish the dull splat of a bit of your opponent landing at your feet from a grenade doing the same:)

Video

(Many thanks to John Latham for the following information).

Desktop video, whilst still 'klunky' is an emerging priority on computer systems. A number of things affect the size of the video files.

  • MPEG1 - picture size, bit rate, frame rate, sound quality and bitrate.
  • AVI - picture size, colour depth, frame rate, sound quality and compression (there are various types).

Generally AVI files are much, much larger than MPEG1 files of the same picture size, there are a number of other factors affect this.

MPEG1

  • Picture Size: 352 x 288 Bit rate: 1820000 bits/sec Frame rate: 25.00 frames/sec Approx 15 Megabytes per minute
  • Picture Size: 352 x 288 Bit rate: 1600000 bits/sec Frame rate: 25.00 frames/sec approx 12.5 Megabytes per minute
  • Picture Size: 352 x 288 Bit rate: 1150000 bits/sec Frame rate: 25.00 frames/sec approx 10 Megabytes per minute

AVI can be confusing with these specs as other factors are often come into play AVI

  • Size: 320 x 240 (NTSC) Frames/sec: 15 approx 25.8 Megabytes per minute (compression + no sound)
  • Size: 352 x 288 (PAL) Frames/sec: 12 approx 240 megabytes per minute (no compression + no sound)
  • Size: 160 x 120 Frames/sec: 8 approx 5 megabytes per minute (sound + compression)
  • Size: 352 x 288 Frames/sec: 25 approx 9 megabytes per minute (sound + compression)

What constantly amazes the author is that we seem to spend inordinate amounts of time/money getting a computer to do what a VCR and TV have been doing perfectly well for years ... still, it is on computer so it must be better (right?)

 

 

wonko@wonko.info
©Copyright t 1992..2017+. Edition 25.150117
wonkosite
Creative Commons License
This work is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 2.1 Australia License
.