Work to do to get a better picture out of the cam
- the picture is pixeled -> the jpeg decoder is not working very good (maybe quantization table?)
- the picture is too dark compared with the Windoz driver -> find good register settings (maybe also problem with jpeg decoder, too?)
- don't have much control of the cam -> find the good registers
- find the register to turn off jpeg compression and stream raw data -> good way to compare quality of jpeg decoding.
- And many more I think.....
Ok, all resolution should work, now. A lower pixel clock for the lower resolution broke the JPEG decoding :-(
I have to investigate on this.
Please, don't use the patch gspca-20071224-PAC7311.patch the new patch is gspca-20071224-PAC7311b.patch. This patch applies to the gspcav1-20071224 release (Version 01.00.20).
Copy the patch file in your gspca-20071224 folder, change to this folder and apply with: patch -p1 < gspca-20071224-PAC7311b.patch
JPEG decoding got improved, thanks to Brian Kuschak who found better Qtable :-)
- different Qtable for better JPEG decoding
- fixed brightness and contrast controls
- lower Pixelclock to get a brighter image
Copy the patch file in your gspca-20071224 folder, change to this folder and apply with: patch -p1 < gspca-20071224-PAC7311.patch
My work is included in gspcav1, now.
For users who like to install this version in Ubuntu Feisty, make the following changes to your Makefile (output from diff):
--- Makefile.orig 2007-05-08 17:08:03.000000000 +0200 +++ Makefile 2007-05-09 19:32:47.000000000 +0200 @@ -37,7 +37,8 @@ KERNEL_VERSION = `uname -r` KERNELDIR := /lib/modules/$(KERNEL_VERSION)/build PWD := $(shell pwd) -MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/media/ +#MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/media/ +MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/ubuntu/media/gspcav1/ MODULE_INSTALLDIR2 = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/media/video/
"MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/ubuntu/media/gspcav1/", this is the important part.
Have fun :-)
Today, I just made a little (big in size 34MB, sorry) video with the PAC7311 webcam.
Have fun :-)
- Fixed the "flickering" problem
- Added all reported USB Device IDs
Download the newest version.
Real progress happened last 2 weeks :-) The "Pixart JPEG" is now decoded in the gspca driver module :-)
Now, it is possible to use a standard viewer application to use with this cam.
The picture quality is still not so good and not always all frames are correct decoded :-(
Anyway, I hope somebody has fun with this version.
After some time of testing, I will move the changes into the official gspca code.
Feel free to report to me how this version is going.
Download the newest version.
Some more progress :-) The "Register Play" interface is now working.
Now, everybody can help me to find the registers for getting a good picture from the cam. I made a little table with the registers I played, see PAC7311 Registers. I added contrast and color settings, but I don't know if this is what I think it is :-(
You will find 2 perl scripts in the gspca folder, regwrite.pl and regread.pl.
As root you can use ./regread 0x78 to read the value from a register (e.g.:0x78) and ./regwrite 0xff 0x01 to write to a register (e.g.: 0xff). Use this on your own risk ;-) and it only works while the cam is streaming.
You can find the new version here
It would be nice if somebody could write a nice frontend for the "Register Play Interface", the perl scripts are only a fast hack :-)
I hope somebody will come by this site and help me :-)
Some more news about this cam in the future......
Some days ago I could manage to decode a live stream :-).
I integrated basic support into gspca and patched the spcaview utility with a special "PAC711 jpeg" decoder. The support is something like pre-alpha or so.
This is a development "tool" to do some register hacking, so don't expect to much. There are a lot of hard-coded stuff and my hacks are sometimes (or always?) ugly.
There is still a lot of work to do :-(
Downlod it and use it on your on risk!
In the PAC7311-src-20070403.tar.gz file is the gspca code and the spcaview utility included. PAC7311 works only with these versions!
Should compile fine with some warnings. I use kernel 2.6.17-11-generic with Ubuntu Edgy (6.10)
Don't install this thing to the system. Just use it from the folder you build it.
To load the modul use "(sudo) modprobe -r gspca" to remove the gspca module and insert the "PAC7311" gspca module with "(sudo) insmod ./gspca.ko" in the folder you build the "PAC7311" gspca module. Just run "PAC7311" spcaview without arguments, all the needed arguments are hardcode, e.g.: "./spcaview". When your video device is not /dev/video0, you can use the -d argument.
One can use the b and n key to control the brightness.
That's it :-(
Have fun and happy hacking :-)
With the help of Joerg Schummer we are able to decode the stream now :-)
The stream is somehow jpeg with special markers in the stream.
You see markers 0xff 0xff 0xff 0xnn, 0xnn can be 0x00, 0x01 and 0x02. When it is 0x01 the following block to the next marker is 1024 Bytes. 0x02 then we get 512 Byte to the next marker. And after 0x00 the size is not defined.
In the jpeg stream are again some special markers. After each MCU, we find some markers, usually 0x44 or 0xbc. This marker can be found in the header data of the stream 0xff 0xff 0x00 0xff 0x96 0x61 0x44 <- (We don't know for what this markers are used, so just throw it away).
Joerg did develop a very nice "Webcam Development Kit". With this wonderful "Webcam Development Kit", we are able to decode the stream and play with the registers of the cam :-)
Here are the Registers we could identify so far:
Check this table
Frame start (header):
0xff 0xff 0x00 0xff 0x96 0x61 seems to be the frame marker.
Here is a example of the first 40 Bytes from a frame, in saturation (white picture):
ff ff 00 ff 96 61 44 ef be d7 ff 00 4f 3f f9 3b ff 00 dd 34 7d af fe 9e 7f f2 77 ff 00 ba 6b df f6 1f f4 ef ff 00 25 ff
and more less black picture:
ff ff 00 ff 96 61 7c ef b7 7f b5 ff 00 8f 7f f6 54 9b bf da ff 00 c7 bf fb 2a f7 ed e4 7b f6 f2 1f 0d df ed 7f e3 df fd
So, if anybody will give me a hand, here are the observations I made:
Register Values after I run the cam in VMware and captured the register settings in Linux.
Here are some snoop files and binary streams I made in various conditions in Windoz.
And don't hesitate to contact me. webcam AT kaiser-linux DOT li
No real progress so far, sorry :-(
I could manage to write and read to the registers of this cam with the spca5xx (gspca...) kernel module and from userspace :-) but I have some problems with:
1. Decode the JPEG stream (SO/IEC 10918-1 ?)
2. Find the register to switch off the JPEG compression (should be possible), then I have not to decompress the stream