Ok, here's Brad Levy's explanation of life, the universe, gamma, and bandwidth, and monitor calibration. (Well, ok, at least the last three...) I've started with some fundamentals, trying to state them both thoroughly and concisely for the benefit of non-technical readers. Copyright 1993 Bradford K. Levy, Worldwide rights reserved. Address comments to brad at CIS id 72170,1503, or blevy@acm.org. Most computer displays on crt's produce the image by varying the intensity of an electron beam aimed at phosphors on the back face of the CRT. The beam intensity (# of electrons) is controlled by a voltage (which comes from a digital-to-analog converter (DAC) on your computer's display adapter card, and is then amplified by the circuitry inside your monitor, raising if from about the 0..1volt range to a hundreds-of-volts range). The number of electrons (and hence, the output), is not directly proportional to the voltage, however. It is more like: output = constant x (voltage to the power gamma) where gamma is typically in the range 1.4 to 2.2. (OK, there's the definition of gamma.) (See note 1) Graphically, this looks like: Output brightness | y | yx | y x | y x | y x | y x | y x | y x | y x | y x | y x |y -------------------------------------- 0 1 Input voltage where the y's indicate a gamma of 1.0 (output directly proportional to input), and the x's indicate a gamma of maybe 1.6. Note that at the intermediate voltage levels, the output will brightness will be lower than it anticipated without correcting for the gamma. This electron beam (See note 2) is not fixed pointing at one spot. It actually covers a very small area at one time. It starts off being aimed at the top left corner of the screen. But it sweeps across the screen, left to right (this is one scan line). The beam is then turned off (the horizontal blanking interval) while it is moved back to the left side of the screen (horizontal retrace), and is moved down a tiny bit at the same time, ready to draw another scan line just below the first. (See note 3) This happens for 200 to 1024 scan lines (depending on the system's resolution), until one "field" has been painted. Then the beam is turned off again (the vertical blanking interval), while it is being repositioned vertically back to the top of the screen (vertical retrace). Then the process starts all over. (This has been for non-interlaced displays. For interlaced displays, a second set of scan lines is displayed a half line down from the first set, so it takes to fields to display the whole set of scan lines.) The rate at which the scan lines are displayed is the horizontal scan frequency. It varies from 15.625 thousand per second (kilohertz) for a tv set, to 64 kilohertz (or more) for good workstation displays. Similarly, the rate at which fields are displayed is the vertical scan frequency. It ranges from 50 per second (PAL television), to 87 per second for some high res interlaced displays. Higher vertical frequency means less flicker, except that an interlaced display is only display half the lines each time, so the full picture is only drawn at half the vertical frequency, which is what should be used for comparison purposes when comparing to non-interlaced displays... (See note 4). Where do pixels come in? The display would be pretty boring (a solid rectangle) if the beam was fully on whenever it was on. On a tv set, the signal from the station or cable provides the voltage that controls the beam intensity, as well as signalling (synchronizing) when the horizontal and vertical retrace should occurr. On a computer display, the display adapter card steps through a large memory called the display buffer, fetching the information to be displayed. In graphics modes, the display buffer is logically organized into scan lines, (horizontal slices of screen data), and within those lines, into some discrete number of pixels, each one specifying the color to be displayed at the corresponding spot within the scan line. On a 1024x768 display, there are 768 scan lines, each one divided into 1024 pixels. The display adapter has an internal signal that it uses as a "metronome" as it steps through the pixels, so each pixel will control the beam(s) on the crt for the same amount of time, so the pixels will all be the same width. This metronome is called the dot clock (or pixel clock). The pixel clock has to be "ticking" at a rate fast enough to fit all the pixels in during one scan line at the horizontal scan rate, plus leave enough time for the horizontal retrace. Assuming 100 ticks for the retrace, this means 1124 ticks, 64000 times a second (64khz horizontal rate). This means the dot clock is running at 71.936 million ticks per second! And during each tick, the display adapter reads a pixel from the display buffer, and passes it to the digital-to-analog converter (frequently getting adjusted in a look-up table along the way). The converted "stream" of output voltages then goes through the cable to the monitor. Now we are ready to talk about using a test pattern to determine the gamma correction to apply to a monitor. What we really want to know is, what values should we feed the digital to analog converter if we want half the full brightness? (see note 5) The solution is to make an image that has a checkerboard pattern (half the squares black, and half the squares full brightness), adjacent to a solid area whose value we will "adjust" until it matches the surrounding checkerboard in apparent brightness. Let's see why this should work. With an ideal monitor and video card the light from the apparent (average) brightness from the checkerboard area should be: 0% brightness (black) x 1/2 (portion of total checkerboard that is black) +100% (full bright) x 1/2 (portion of total checkerboard that is full bright) ----- = 0 + 50 = 50% brightness. This takes advantage that full brightness is full brightness, regardless of gamma, and 0 brightness is 0 brightness, regardless of gamma. So the checkerboard brightness should be independent of the monitor's gamma. Now if we alter the brightness of the solid portion of the test image, (which is affected by gamma) until it matches (either by choosing different test images with different values for the solid area, or filling in the lookup table in the DAC with values corresponding to different gammas), we can find the proper value for gamma for our monitor. (The math is omitted here, but its really pretty simple.) One could also make the solid area a gradient fill instead, with a scale alongside that one could read off the gamma at the point where the gradient brightness matches the checkerboard. This gets around the need for an iterative process. Now lets go back to where we said "with an ideal monitor and video card", and see what happens when the monitor and video card are not "ideal" or "perfect", but have the inevitable real-world limitations. For purposes of discussion, lets assume the range of values to the DAC is 0 to 63 (6 bits), corresponding to 0 to 1 volt out to the monitor. (The actual values may be 0 to 32(5 bits) or 0 to 255(8 bits) instead, depending on the DAC and video mode.) Now lets look at part of one scan line of the checkerboard: Increasing time ->->-> Values to DAC 00 63 00 63 00 63 00 63 00 63 00 63 Desired Voltage out 0 1.0 0 1.0 0 1.0 0 1.0 0 1.0 0 1.0 Desired Brightness (%) 0 100 0 100 0 100 0 100 0 100 0 100 Unfortunately, real world electronics (in the DAC, and in the CRT amplifier) aren't ideal. Let's consider the amplifier. The amplifier's task is to trace the input, creating a similar (but scaled up) output. Kind of like a "game" where I might be trying to mimic each of your steps, but for every one step you moved, I moved 5 steps in the same direction that you did. I would trace out a path 5 times as large as you did, but the pattern would be the same. But what if you start stepping very frequently? My feet can only move so fast, so I might have to start cutting back to 4 or 3 or 2 (or eventually even 1) step for every step you took, in order to keep up. Thus, my high frequency response might be only 1/3 the amplitude (magnitude, size of excursion) of my response at lower frequencies. (I might fall asleep or get distracted if you move too slowly, too, limiting my very-low-frequency response. And at the high frequency end, I might end up taking too many steps in my haste to keep up with you before I start scaling down to a smaller amplitude.) The range of frequencies (steps/unit time) over which my output can (in some sense) trace your input is referred to as the bandwidth of the amplifier. It usually includes a low and upper limit, at some specified tolerance or accuracy level (such as the output pattern being within at least 1/3 of the desired output level of the desired output level). So as a "human amplifier" my BANDWIDTH might be described as "3 to 120 steps per minute, +/- 1/3 of full output". (See notes 6 and 7) The bandwidth can be shown graphically as a frequency response in a chart like the following: Output | | | x 0db - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x (full) | x x | x x | x x | x a b c dxe f g -3db - x x (.708 x | x x intended| x x voltage)| x x | x x -6db - x x (.501 x | x x intended|x x voltage)|x x |x x ~x x ~x x |x x --------------------------------------------------------------- 0 10 100 1000 10000 100000 1000000 Input Frequency (ignore the letters a b c d e f g for the moment) This is actually a fairly typical shape for the frequency response of an amplifier. Some won't have any problems with low frequencies at all, and the graph for those would be flat all the way to the left axis (DC). Some amplifiers might not be as careful in tracking the input even when its not "too fast" for them, so might have more fluctuation (not be as "flat") in the center frequencies as this graph. But the falloff with high frequencies is nearly universal in amplifiers. Note that while I've explained bandwidth in terms of amplifiers, it applies to anything with an input signal (voltage, pressure, etc.) and an output signal. (Even to a wire, or a piece of garden hose.) A further note: if the bandwidth is specified as just two frequencies, without a "tolerance", a tolerance of 3db is _usually_ implied. (Some car stereo manufacturers excepted) Now, how does this bandwidth apply to our gamma test chart problem? To answer that, we need to take one more excursion into the technical realm. When I described the "human" amplifier, I described it in terms of taking discrete (digital) steps. But most electronics (esp. the high frequency ones!) work and are specified in the analog (continuously varying) domain. (See note 8) When talking about frequency in the analog domain, the input and output aren't fed (or measured) with steps, but rather with sine wave oscillations. This is done because a guy named Fourier came up with a theorem that states that a sine wave is the only pure frequency, and any distortion of the sine shape represents harmonic frequencies (higher multiples of the original frequency) present in addition to the fundamental sine wave. Thus, if we measure a system's bandwidth or frequency response with anything other than a sine wave, we will be measuring its response to these harmonic frequencies as well, which will just muddy the waters. In fact, a square wave at frequency x is actually the 4/pi times the sum of a sine wave at the same frequency, plus 1/3 times a sine wave at 3x frequency, plus 1/5 times a sine wave at frequency 5x, plus 1/7 times a sine wave at frequency 7x, ... continuing on up into higher frequencies (and smaller multipliers) forever. Which brings us back to the our checkerboard test pattern and its signal to the CRT! Remember, we said its signal looked like this: Desired Voltage out 0 1.0 0 1.0 0 1.0 0 1.0 0 1.0 0 1.0 which is graphically: Volts | 1 | ____ ____ ____ ____ ____ ____ | | | | | | | | | | | | | 0 |___|__|___|__|___|__|___|__|___|__|___|__|___ time ->->-> which is a square wave at 1/2 the dot clock frequency - because 1 dot "on" and 1 dot "off" = 2 dots make up a "cycle" of the pattern. So lets see how our CRT responds to that. Lets assume a dot clock of 72 million pixels per second. And a CRT bandwidth of 135 Megahertz (Mhz) +/- 3db. The "fundamental" frequency of the square wave is then 72/2 = 36 Megahertz. So our test pattern can be considered the 2/pi time the sum of: (Note 9) a 1.0 volt 36Mhz sine wave a .333 volt 108Mhz sine wave (108 = 36 x 3) a .2 volt 180Mhz sine wave (180 = 36 x 5) a .14 volt 252Mhz sine wave (252 = 36 x 7) a .11 volt 324Mhz sine wave (324 = 36 x 9) ... Now, when those go through the CRT's amplifier, we might end up with the following approximate amplitudes due to the falloff in frequency response at the higher end of the bandwidth: the .333 volt 108 Mhz wave becomes .333x.85 = .28333 volt the .2 volt 180 Mhz wave becomes .2 x .63 = .126 volt the .14 volt 252 Mhz wave becomes .14 x .5 = .07 volt the .11 volt 324 Mhz wave becomes .11 x .4 = .044 volt ... If we add these attenuated sine waves together (along with the fundamental), we get a result that looks like this: 1 | xxxxxx xxxxxx | x x x x | x x x x |x x x x |x x x x Voltage |x x x x x | x x x x | x x x x | x x x x | x x x x | x x x x | x x x x 0 ------------xxxxxx------------xxxxxx-- 0 1 Time ->->-> In other words, the sharp corners have been rounded. So no longer are all the values at the full on or full off point, where gamma doesn't matter. Now our "no-longer-so-square wave" is itself affected by the gamma response of the CRT, so the average brightness is no longer exactly 50%. For a CRT gamma of 1.8, our checkerboard will have a brightness of about 48% instead of 50%. For a CRT with 100Mhz bandwidth instead of 135, the value drops to more like 42.5% brightness for the checkerboard. So what can we do? If we made our checkerboard out of squares (or rectangles) two pixels wide instead of one pixel wide, the average brightness (on an ideal monitor) would still be 50%. (We might need to stand back a little further to help our eyes do the averaging.) On the non-ideal, bandwidth-limited monitor, the frequencies of all thoses sine waves we are adding up will be only half what they were. The monitor will have an easier time reproducing them. If the original set of sine waves was at points b c d e f g on the frequency response graph from a while back, the set of sine waves for the "fat checkerboard" will be at points a b c d e f on the frequency axis. The higher frequency ones will still be attenuated (cut back) some, but the average brightness will now be more like 49.4% instead of 48%. For the monitor with the 100Mhz bandwidth, it will be more like 48% instead of 42%. We could get even closer to ideal by making the checkerboard squares 3 pixels wide. But then we have to stand back even farther to help our eye do the averaging. Now, what haven't we covered? The CRT's amplifier is not the only part of the system that has trouble reproducing high frequencies or making rapid changes. The DAC on the video card has similar problems. Even the connecting cable has capacitance and inductance that can limit the high frequencies. Some CRT's (like the NEC 5FG) have BNC connector inputs in addition to the D-sub type connector. The bandwidth rating through the BNC inputs is significantly better (higher) than through the D-sub connector. The overall frequency response and bandwidth will be the cummulative result of all the limitations of the system. A great monitor with a lousy video card or cable can still limit the checkerboard. (See note 10) We have assumed the crt is making square pixels. It doesn't. They are actually pretty round. The beam may also cover an area larger than one pixel. These could be topics for a whole nother analysis, but suffice it to say that using a larger square (2 or 3 pixel) checkerboard helps cut down the errors due to these factors as well. These factors also affect the beam in both directions, while the bandwidth only affects the horizontal direction. (Yet more opportunities for a cleverly designed test pattern to help measure the different sources of error and evaluate a CRT's quality!) And we aren't even going to touch the price of tea in China. Note 1: A good background on lots of things related to graphics and display systems is "Fundamentals of Interactive Computer Graphics", by J.D. Foley and A. Van Dam, published by Addison-Wesley, ISBN 0-201-14468-9 Note 2: There are actually three electron beams in a color system. Note 3: Actually, the vertically downward movement is continuous, rather than making a step at the end of each horizontal scan line. The slight resulting tilt can be compensated one of several ways. Note 4: Actually, the persistance of the eye helps out some, so use .7 x the interlaced display's vertical frequency, instead of .5 x, for comparison purposes. Note 5: The eye does not respond "linearly" to light intensity either. To keep the eye out of the equation, when I say half the brightness, I mean as measured by # of photons, not as perceived by a human. Note 6: The ratio of one output level (power) to another (desired) output level (i.e., the tolerance) is usually expressed in units called decibels (db for short). 3db represents a power ratio of about 2:1, or a voltage ratio of about 1.413:1. A negative value indicates the ratio is reversed (inverted). So -3db would be a voltage ratio of 1:1.413 instead of 1.413:1. Note 7: Lets see - the bandwidth of a one man band is maybe 3 feet, depending on the instrument. And the bandwidth of a marching band depends on the formation.... Note 8: Even most so-called "digital" electronics like computer chips really works in the analog domain. The digital electronics just uses high amplification and limiters (saturation) to stay in or switch between "all on" or "all off" states. As the digital circuits start operating at higher and higher frequencies, the analog nature gets harder and harder to avoid. There are a few experimental quantum devices that do actually work in the truly digital domain. Note 9: The voltage of a sine wave can be measured several ways. For this example, I am using peak-to-peak voltage. Note 10: A test pattern with 1, 2, and 3pixel checkerboards is a pretty good way to test the combined quality of the video card+cable+ monitor! (Along with a grid test pattern to check for geometric distortions.)