MARS MR97310 STILLCAM DRIVER
Theodore Kilgore <kilgota@auburn.edu> April, 2004.

(Driver is LGPL like most of the rest of libgphoto2; see any of the 
source files for a more complete statement of the license.)

INTRODUCTION

This driver is for a camera which uses the Mars MR97310 chip. I understand 
that there are several of these. Mine is an Aiptek PenCam VGA+ (Vendor:Product
ID 0x08ca:0x0111). The interface is proprietary, and these cameras are 
supported commercially only in Windows.

FEATURES OF THE CAMERA

The Aiptek PenCam VGA+ is a "budget" camera. The camera has resolution settings 
of 640x480 and 320x240. The default behavior of the manufacturer's camera 
driver is to save photos in JPEG format, with BMP format optional. However, 
the raw data is in Bayer array format. Here, everything is saved in PPM format. 
The camera can also be used as a webcam (unsupported here) or to make a "video 
clip." This driver supports the 640x480 and 320x240 *uncompressed* stillcam 
and "clip" modes only. Clips download nicely as a succession of PPM files. 
There is an optional compression mode, proprietary and not obvious. 
The adventurous and persistent are hereby encouraged to play with it. 
Update 09/12/05: Decompression sort of works, now. Thanks to Bertrik Sikkens 
for the basic algorithm, and to Michel Xhaard for testing my additional tweaks. 
With some of the cameras it is possible now to get decent photos in compressed 
mode, at least some of the time. For this, the camera seems to function best 
at outdoor use. 

The outside of the package advertises "Interpolated XGA (1024x768) Resolution" 
(which can be turned on or off). If "enhancement" is turned on, the appearance 
of the photos does change, but not much to the better. The photos are only 
slightly sharper but become much more blocky with jagged lines and curves.  
It seems  not worth the trouble. If you find that the "enhancement" does 
something nice, please let me know. Especially if you can understand how to 
get "Interpolated 1024x768 Resolution" from 640x480 bytes downloaded from a 
640x480 Bayer array.  

The camera uses a configuration "block," as do the sq905 cameras. However, 
here the information can be used to run options such as gphoto2 -p 3 and 
gphoto2 -p 3-5. Whether this flexibility is of any practical effect or not 
is another question, since apparently the camera will not download thumbnails. 
The driver provided with the camera is for Windows only, and that driver does 
not take full advantage even of the mentioned abilities. There, one has the 
choice either to download all photos, or none. If all are downloaded, then 
thumbnails are created. The user can then do previews and decide what to save. 


STATUS NOTES ON SUPPORTED CAMERAS (7 Feb. 2006)

The only problem with using any of these cameras is the compression codec. 
Bertrik's decompression algorithm seems basically correct, but it has a problem 
with leaving diagonal color artifacts, a problem which can be severe in bad 
lighting conditions, especially if there are lots of dark colors in the photo. 
I have recently been able to alleviate this problem, to a great extent, but 
not completely. Also, not all of the cameras seem to perform equally well 
in compressed mode, when used to shoot similar photos under similar lighting 
conditions. Here is a report on the cameras which I own. I can not say anything 
about the others unless their performance in compressed mode is reported to me:

Aiptek Pencam VGA+: Compressed mode is very sensitive to bad lighting, 
especially when there are dark colors in the image. The camera also will refuse
to shoot both in compressed and in uncompressed moed if the light is very bad 
(indoors, in the evening) and that is probably all for the best. 

Argus DC-1620: Compressed mode only. No uncompressed photos. The compressed 
mode works pretty well, though. Outdoor photos are pretty good, and if you are
willing to put up with a cheap, compressed-mode-only camera it might even be 
worth your money. The camera does have some problems in bad light, but not so
severe as with the Aiptek Pencam VGA+.

Sakar Digital #77379: Also compressed mode only. Seems to work pretty well. Has 
a very high cutoff threshold and will not take photos in the evening, even if 
one points it at a bright monitor screen. 

Argus QuickClix: Compressed mode only. The compression algorithm is different 
from the compression algorithm in the other known Mars cameras, too. I have 
no idea how the compression algorithm works, either. Thus, this camera is a 
paperweight unless someone figures out how to decompress the data. Don't buy 
one unless you are adventurous, patient, and want to help out. That's why it 
is listed as DEPRECATED. 

SPECIFIC WARNING REGARDING ARGUS QUICKCLIX

For the Mars cameras, all data for raw photos begins with a signature. The 
uncompressed photos begin with FF FF 00 FF 96 64 00, and raw photos using the 
compression which is solved begin with FF FF 00 FF 96 64 50. If you get a 
camera in which the raw data begins with the signature FF FF 00 FF 96 64 20 
then your camera uses the same compression algorithm as the Argus QuickClix, 
and obviously it also will not work. 

Finally, one can not distinguish an Argus QuickClix from an Argus DC-1620 by 
appearance. From the outside they are identical. Also they and several other 
cameras use the same USB Vendor:Product number and do not give any 
identification string after they are connected, either. So, unless the new 
compression algorithm is unlocked, there is a real problem here. 


USABILITY OF DRIVER WITH GUI FRONTENDS

The camera library presented here seems to work with gtkam as a frontend. To 
use gtkam for the first time with the camera, you must choose the camera. 
For this purpose, after starting gtkam click on "Camera." Then choose 
"Add Camera." Then "Detect." After this, AFAICT gtkam will be fully functional,
including in particular the production of thumbnails for the photos. 

The use of digikam as a frontend works almost as well, but for some reason 
digikam seems unable to display thumbnails from this camera. Anyone who knows 
what the problem is here, please let me know. Meanwhile, as I said, gtkam seems
to work without problems. 



FURTHER DETAILS

Further details are given in "protocol.txt". These details have been obtained 
through trial and error and are intended solely to meet the problems of 
compatibility in other than a Microsoft Windows (trademark) environment. 

WARRANTY?

Absolutely none. Remember, I did not sell you this software. I have written 
this driver for my own edification and in the sincere hope that it might help 
you to use of your camera. Please see also the warranty clauses 
in the LGPL license. 