Tips

Pelli-Zhang Video Attenuator

VideoToolbox
PsychToolbox
Tips
 
speed
displays
how to
mac software
bibliographies

visitors since September 17, 1996.
9 January 2003

THE Pelli-Zhang VIDEO ATTENUATOR

Macintosh computers are great for synthesizing and displaying images for vision experiments. However, the 8-bit resolution of their digital-to-analog converters is inadequate to render threshold-contrast stimuli, typically yielding on-screen contrasts that are only accurate to about 7 bits, because of the monitor's factor-of-two contrast gain. (See more-than-8-bit DACs.) Pelli and Zhang (1991) describe a simple electronic circuit, a video attenuator, that provides accurate contrast control, achieving 12-bit on-screen accuracy from any 8-bit DAC. You can build one yourself, from their schematic, or you can order one pre-made either from the ISR Instruments, which calls it the "ISR Video Attenuator" (with 15-pin D connectors, as documented below) or from Vision Research Graphics, which calls it a "Gray Scale Expander" (with BNC connectors, documented at their web site).

D. G. Pelli and L. Zhang (1991) Accurate control of contrast on microcomputer displays. Vision Research, 31:1337-1360. [pdf]


THE VISION RESEARCH GRAPHICS "GRAY SCALE EXPANDER"

Vision Research Graphics (VRG) sells the Gray-Scale Expander for $300. It uses BNC connectors for both input and output.

SVGA HD-15 to BNC cables are readily available, so this version would be a better fit for computers that don't have old-style Macintosh D-15 video ports. Mac DB-15 to BNC connectors are also available, so it should also work with old Macs.

The VRG Gray-Scale Attenuator, like any Pelli-Zhang attenuator, can be used to drive one gun on any monitor. To drive all three guns, the monitor must have a "termination switch", which removes the 75 ohm termination on each input, allowing the VRG unit to provide the 75 ohm termination instead. Without that switch, tying together the three 75 ohm monitor inputs would yield an input impedance of 25 ohms, which is too low for the attenuator to work properly.

(Thanks to Allen Ingling.)


THE ISR VIDEO ATTENUATOR

Installation instructions are near the end of this document.

The ISR Video Attenuator is a small box with Macintosh-video-compatible connectors at either end that connects to the video cable between the computer and monitor. It combines the three color RGB signals from a color video card to produce a single monochrome signal of higher grayscale resolution. It is designed for use with monochrome monitors; it may also be used with a color monitor, but will drive only the green gun. Only programs using special software (provided) will achieve this benefit. Physically, it is a small satin-finish machined-aluminum box, about the size of a matchbox (2"x1.2"x0.7"), with a 15-pin D Macintosh video connector at each end. Inside are precision resistors on a two-sided printed circuit board with controlled-impedance microstrip traces. This passive resistor network combines the three 8-bit RGB signals from your video card to produce a single much-higher-accuracy signal to drive your monitor.

HISTORICAL NOTE: There are two versions of the ISR Attenuator: the original (no longer available), and the new multisynch-compatible version, which is distinguished by a gold (or black) "M" stamped onto its case. The multisynch-compatible version of the Attenuator is compatible with all computers and monitors that use Macintosh-compatible 15-pin video connectors. Owners of the original attenuator--which is incompatible with multisynch monitors--can upgrade to multisynch compatibility by ordering the upgrade from ISR or by doing the upgrade themselves: see Appendix 2, below.

MULTISYNCH COMPATIBILITY

The original Attenuator was designed in 1989. It was designed to attach to the monitor, not the computer, but many of Apple's new monitors have permanently attached cables, with no connector at the monitor, making it impossible to attach directly to the monitor. Attaching the original Attenuator directly to the computer will result in it being installed backwards, producing a uselessly dim display. The new multisynch-compatible version of the Attenuator comes with a pair of compact gender changers that will correctly connect the Attenuator to your computer. Furthermore, many pins that were unimportant in 1989 now carry essential signals for autosensing and synching the latest displays. Six wires have been added to the new Attenuator to relay these signals. The multisynch-compatible version of the Attenuator is compatible with all computers and monitors that use Macintosh-compatible 15-pin video connectors. Owners of the original Attenuator can order the upgrade from ISR or do the upgrade themselves, by following instructions that appear in Appendix 2, below.

PACKING LIST

SOFTWARE AVAILABILITY

The VideoToolbox software is updated several times a year. You can download the latest edition from InfoMac (search for "video-toolbox") or the VideoToolbox web site. To get future editions automatically, just send me, denis@psych.nyu.edu, your name and email address. Each time I post a new version of the VideoToolbox to the Info-Mac Archive, I email a copy to everyone on the subscription list; there are currently nearly two hundred subscribers.

YOU WILL ALSO NEED

YOU MAY ALSO WANT TO HAVE

ORDERING INFORMATION

The multisynch-compatible ISR Video Attenuator is for research. As such it is licensed, not sold. The license has no time limit and is transferable. The accompanying Video Toolbox software for creating visual stimuli is supplied free, and is available separately to anyone, but may not be sold without permission.

Checks should be made payable to Syracuse University. The price of US$175 includes shipping in US. If you're in New York State then you either need to add sales tax or attach the New York State document excusing your institution from paying sales tax.

UPGRADES

Owners of the original ISR Video Attenuator may upgrade for US$35. Ship the Attenuator to the address below. It will be modified, adding the new wires, stamped with a gold (or black) "M", and shipped back to the sender, along with a pair of gender changers. The price includes shipping within the US.

SEND ORDERS TO

ISR Instruments
Institute for Sensory Research
Syracuse University
Merrill Lane
Syracuse, NY 13244-5290
(315)-443-4164
arpajian@syr.edu

DISCLAIMER

Denis Pelli has no financial involvement in the ISR Video Attenuator.

INSTALLING THE ATTENUATOR AT THE MONITOR

To install your ISR Video Attenuator, unplug your video cable from your monitor, plug the cable into the attenuator and plug the attenuator into your monitor. Note that the ISR logo should be at the end of the attenuator that's closest to the monitor.

However, you can't do that if your monitor has a permanently attached cable or an incompatible connector. In that case, you must install the attenuator at the computer end of the video cable.

INSTALLING THE ATTENUATOR AT THE COMPUTER

When the ISR Video Attenuator was designed in 1989, all Apple Macintosh modular computers connected to video monitors by means of a separate cable that plugged into both the computer and the display. The video attenuator was designed to plug into the back of the monitor, not the computer. If you plug it directly into the computer it will be backwards and won't work. (As noted above, the ISR logo should be at the end of the attenuator that's closest to the monitor.) Unfortunately, since 1989, Apple's cost-saving designs for their new monitors have replaced the connector at the back of the monitor by a permanently attached cable, making it impossible to install the video attenuator as originally intended. The solution is to use a pair of gender changers (included with the new multisynch-compatible version of the Attenuator), one for each end of the video attenuator, so that it can be installed in the correct orientation at the back of the computer. Unplug the video cable from your computer. Put a gender changer at either end of your video attenuator, plug it into your computer's video port, and plug the monitor's video cable into it. Confirm that the ISR logo is at the end of the attenuator that's closest to the monitor.

CALIBRATION

Once the attenuator is installed, you should run the program CalibrateLuminance to calibrate your monitor, attenuator, and video card. You will need a photometer in order to use that program. Once it's finished CalibrateLuminance will produce a new file called LuminanceRecord?.h, where "?" is the screen number of your monitor. (This screen number is similar to but not the same as the monitor number used by the Monitors control panel device.) This file describes the gamma function and RGB gains of your video card and attenuator. It is a C header file. You can cause its contents to be included in any program by writing
#include <LuminanceRecord1.h>
where "1" must be replaced by the screen number of your monitor, as determined by the program CalibrateLuminance or the subroutine GetScreenDevice(). Alternatively,
you can read the file at runtime by calling
ReadLuminanceRecord("LuminanceRecord1.h",&LR,0);
where &LR is a pointer to your luminance record struct. We recommend the latter approach, because it makes your program portable across monitors. Later, when you write programs (or compile the supplied demonstrations), your LuminanceRecord file will allow them to accurately control the luminance of your display. The relevant subroutines are all in the file called Luminance.c. Documentation is in the file Luminance.h. Note that LuminanceRecord1.h and LuminanceRecord2.h are provided as samples in the VideoToolboxSources folder, so that the demonstration programs can be compiled even before you have calibrated your own display. However, before doing any serious experiment it is essential that you replace the example by a new LuminanceRecord file that describes your own display.

Good luck.

APPENDIX 1: Signal Assignments for the Macintosh DB-15 External Video Connector
From Apple's Tech Note "HW 30 - Sense Lines.note", which you can find in the VideoToolbox:Notes folder.

Pin Name Description
1 RED.GND Red Ground
2 RED.VID Red Video Signal
3 /CSYNC Composite Sync Signal
4 SENSE0 Monitor Sense Line 0
5 GRN.VID Green Video Signal
6 GRN.GND Green Ground
7 SENSE1 Monitor Sense Line 1
8 n.c. Not Connected
9 BLU.VID Blue Video Signal
10 SENSE2 Monitor Sense Line 2
11 C&VSYNC.GND Ground for CSYNC & VSYNC
12 /VSYNC Vertical Sync Signal
13 BLU.GND Blue Ground
14 HSYNC.GND HSYNC Ground
15 /HSYNC Horizontal Sync Signal

APPENDIX 2: DO-IT-YOURSELF UPGRADE OF THE ORIGINAL VIDEO ATTENUATOR TO SUPPORT AUTOSENSING & MULTI-RESOLUTION MONITORS

The upgrade is also available from ISR, see ordering instructions above. But it's not hard to do it yourself, if you prefer, by following these step-by-step instructions.

You can make your own gender changers, or buy any brand, but those made by GC Electronics are particularly compact and inexpensive. Buy both the GC Electronics male-to-male 15-pin D gender changer 45-0527 and the female-to-female 15-pin D gender changer 45-0528. They cost $6.65 each, according to a 1994 catalog. They are sold by most electronics supply houses, e.g. Newark Electronics.

When the printed circuit for the video attenuator was designed in 1989, video pins 4, 7, 10, 11, 12, and 15 were not important. Since then Apple has defined pins 4, 7, and 10 as Monitor Sense Pins, and pins 11, 12, and 15 as carrying horizontal and vertical synch. (For details read Apple's "HW.30 Sense Lines.note" in the VideoToolbox:Notes folder.) To use your ISR Video Attenuator with anything other than a fixed-resolution 640x480 67 Hz display, e.g. a multiple-resolution monitor, you need to update the Video Attenuator to pass those 6 signals through. After this update your Video Attenuator will be compatible with all computers and monitors that use Macintosh-compatible 15-pin D video connectors. (As always, when used with a color monitor only the green gun will be used.) If you're comfortable with a soldering iron you can do this in about 15 minutes.

Here's how to update your original ISR Video Attenuator. Unscrew and remove the standoffs on either side of the female 15-pin connector (otherwise you won't be able to open the case). Use a 5/64 inch Allen key to unscrew the allen screw in the middle of the ISR Video Attenuator. Remove the metal case (top and bottom). Place the circuit board on the table so that you can see the resistors, with the male connector (with 15 gold-plated pins) on your right. You can now see the connections of pins 1 to 8 to the circuit board. On both right and left of the circuit board, pin 1 is nearest you, ..., and pin 8 is furthest from you. Use an X-ACTO or razor blade to cut the copper foil connected to pin 4 on both the right and the left. Scrape or fold back the foil to create a visible gap, to make sure the break is permanent. Now solder a wire connecting pin 4 on the left to pin 4 on the right. (Any wire will do, but 22 gauge solid-conductor insulated wire is particularly easy to handle.) Now solder a wire connecting pin 7 on the left to pin 7 on the right. Now turn the printed circuit upside down, so the resistors are hidden, and the male connector is on your left. Pins 9 to 15 are now visible. Pin 9 is nearest to you, on both right and left. Now solder a wire connecting pin 10 on the left to pin 10 on the right. Similarly, connect pin 11 to 11, 12 to 12, and 15 to 15. The video attenuator is now functional. You may test it now, before putting the case back on. The standard orientation for the metal case is to put the unlabeled half on the side of the circuit board with no resistors, and the labeled half ("VIDEO ATTENUATOR") on the side with resistors, oriented so that the writing is right-side-up when the male connector is on your right. Use the Allen key to replace the Allen screw. (You needn't bother to replace the stand-offs, since the gender changers won't use them.) You're done. (Here at ISR, we would also stamp "M" onto the case and fill the impression with gold or black laquer.) Your updated Video Attenuator is compatible with all computers and monitors that use Macintosh-compatible 15-pin D video connectors, but for the newer monitors you will need to buy a pair of gender changers to achieve the proper connection, as noted above.

APPENDIX 3: Using monochrome monitors in color mode.

Tom Busey, busey@indiana.edu, writes, "I'm trying to get around Apple's "feature" on the vram card driver on the Power Mac 7100 that doesn't allow one to select a color mode when it is attached to a grayscale monitor (e.g. Apple 2-page grayscale monitor). So I installed a MacLiberty Adapter to fool the computer into thinking I've got a color monitor. It works."

"However, unlike most monochrome monitors, which take their input from the "green" video line, the Apple 2-page monitor seems to be driven by the "blue" video line. (I put the monitor into thousands of colors mode, which shows the 4 color strips at the bottom of the control panel. When I drag this control panel over to the grayscale monitor, the color strips that were red and green on the color monitor are now black, and the formerly blue and gray strips are now identical gray strips.) I realize that I need to update my ISR Video Attenuator to pass all the sense lines correctly, and I presume that the blue/green anomaly will require a custom modification."

Yep, this will require connecting the Video Attenuator output to the Blue (pin 9) instead of the Green line (pin 5).