GARS

GARS, originally the Gemini Advanced Review Software and later the General Advanced Review Software, was one of my first software projects in nuclear non-proliferation. It was originally called View32 and was written for Bernard Jargeac of the CEC/Euratom in early 1995. It was designed to replace an application called MARS, the MIVS Advanced Review Software, that was written for an analog surveillance system, MIVS, the Modular Integrated Video System, which the digital surveillance system Gemini was designated to replace.

Specifications

The initial specifications for GARS were mostly pretty nebulous: easy to use, intuitive user interface, etc. except one particular specification from the MARS and that was playback had to be 20 fields per second. Since the MIVS was an analog system, 20 fields per second resulted in three images per second playback because it required approximately seven fields to make one image.  When generating the specification for GARS, the question was asked as to what was comparable to fields in a digital system and the answer given, incorrectly, was frames, which for a still camera-based system became images. The official specification for GARS then became image playback at 20 JPEG images per second.

Background

The hardware of the Gemini Surveillance System consisted of two Dycam digital cameras re-badged by Logitech that recorded grayscale JPEG images, a single board computer from Megatel that used an Intel 386 processor and a proprietary timer/controller board. The name Gemini came from the use of two digital cameras which, because each camera had a different field of view, in theory would prevent the system from being spoofed.  The digital camera could hold up to a maximum of 20 images, each with a time stamp in the header. The Megatel would download the 20 images from the digital camera, bundle them into a file and store the file on a removable SCSI hard disk. And for reasons never adequately explained, the images were not stored in the file sequentially.  With the system designed to prove that a treaty violation occurred and not to prevent them, the SCSI hard disks were only retrieved for review every 90 days. The image taking interval was around five minutes which resulted in approximately 850 files that contained 25,000 images that needed to be reviewed by an inspector.

Before I started on the GARS project, the Gemini Surveillance System had a test program called GemRev written by a highly regarded programmer that was no longer on the project. It would ‘play’ the images and display when they were taken on average of about four images per second on Windows 3.1 using a Pentium processor. It would load an image file contingent upon the time-based name of the file, read in the 20 images, sort them according to the individual time stamps of the images and then display them.  Playback speed was a bit inconsistent due to reading of the file and sorting versus just displaying. While there were some areas where the performance could have been optimized, it was felt that a 400% improvement was impossible.

Hardware

At this time, Microsoft was making a big push for Windows NT 3.51 and HAL, which would allow NT to run on different processors. I was provided a Windows NT machine using a DEC Alpha 21064 and started development on View32. There was some discussion that a UNIX system would provide better performance but since the users were primarily accustomed to Windows 3.1, it was felt that Windows NT 3.51 would result in a shallower learning curve.  The greater computer power of the Alpha processor and Windows NT did provide a substantial increase of playback to nine images per second but still far short of the 20 images per second needed.

Optimizations

I then began looking at where the bottlenecks in the code were. Clearly opening and closing upwards of 850 files was a lengthy activity both for indexing and for display (remember the images were not stored sequentially in the files). Even the task of getting a list of all the files was hindered by how many files there were in one directory.  So I made the executive decision that ‘playback time’ did not include ‘index time’ and made the surveillance review a two-step processes. The removable disk used the FAT32 file system which would allow a nearly four gigabyte file, so during the indexing processes I combined all the images into one file which generally was about 500 megabytes. I also wrote the images sequentially which would allow me to be more predictive on what part of the file I should read into RAM. The image index file had about 64 bytes of information for each image which was small enough to keep in RAM. While the indexing process could take up to as many as 20 minutes, playback speed did increase to nearly 13 images per second. And with the availability of an index file, direct access of images could be provided to the user which allowed me to add a search function to GARS. It was basically a flat file database.

Lastly I began to look at the code to display the images. One of the time consuming processes was that in order for Windows to display the image it had to find a compatible color in the currently loaded palette. Since I had the ability to edit the JPEG decompression code and I knew the images were grayscale, I was able to remove all the chrominance code and just use luminance. And then with only the luminance, I could force the grayscale values to be reduced to sixty-four values and to have them be from 128 and 191. Creating the windows palette with fixed values from 128 to 191 as grayscale values and using DDB bitmaps instead of DIB bitmaps got the performance to 18 images per second. Some more optimizations in the JPEG code and using the actual image size instead of zooming finally pushed the playback to 20 images per second.

Release

GARS was made available to customers in August of 1995 as part of the Gemini Review Station which was essentially a Windows NT 3.51 Workstation using a DEC Alpha with a dock for the removable SCSI drive. The cost was about $15K for the system with the software basically included for free. Later, after processor improvements by Intel and advancements to Microsoft's non-workstation operating systems, GARS would be sold as stand-alone software. Ironically, one of the first customer feedback items was to add speed control since any image playback greater than eight images per second was unusable.

Over the next year or so, improvements to GARS included motion detection, image enhancement and with the addition of public/private key support in the camera, the ability to authenticate that the images were not tampered with.  By the middle of 1997, however, the IAEA became involved and it was decided that the Gemini Surveillance System was to be phased out for a system from Dr. Neumann GMBH called the DCM 14. The official reason for this was that the Gemini Surveillance System, based on a digital camera, did not record motion well and the DCM 14, which used a digitized video signal, did. While many called this reasoning flawed, the surveillance system seldom needed to record motion but did require a quality image and the DCM14 produced an image much like an image capture from a VCR, the Gemini Surveillance System‘s days were numbered.

Gemini to General

While the DCM 14 came with review software it was poorly received and the decision was made to rewrite the GARS to support the DCM 14. I made the decision to move the surveillance specific code, reading the image files, decompressing the images, encryption and authentication into surveillance specific dynamic link libraries (DLLs) that would allow the user interface and main program to remain consistent across different surveillance system. It was at this time that GARS became the General Advanced Review Software instead of the Gemini Advanced Review Software. This decision would turn out to be the main reason for GARS success in that while GARS would ultimately support five different surveillance systems, the user interface remained consistent which negated the need for the inspectors to constantly be retrained.

Deprecation

I actively supported GARS for the next ten years and added many new features mostly thanks to suggestions by Kent Brown at the IAEA: memory-mapped files, user configurable UI, multi-threading, multi-camera review, etc. As hardware performance increased, I could slowly back out many of the performance tricks that were required originally to meet the specifications. In the end, it wasn’t so much the change in technology that killed GARS but a change in management.

 GARS User Interface at End-of-life