Web lists-archives.org

[Spca50x-devs] Add support light frequency banding filters (gspcaV1)




Hi Michel and all;
Enclosed  bzipped patch for gspca-20060813(original! my prev. patch for 0x041e:0x4051 should be reversed) add support light frequency banding filters for next sensors:
* tas5130c( fv0250 from my Creative Live!Cam Notebook Pro) - Tested. Works correctly.
 Patch also add support Creative Live!Cam Notebook Pro 
*tas5130c(old) - Not tested. NEED TESTS!
*pb0330 - Not tested. NEED TESTS!
*pas106b - Not tested. NEED TESTS!
*icm105a  - Not tested. NEED TESTS!
*hdcs2020b  - Not tested. NEED TESTS!
*cs2102  - Not tested. NEED TESTS!
All data for  banding filters been converted from http://zc0302.sourceforge.net/release/zc030x_new.tar.bz2
Look like that these data were dumped from Windows registry for various sensors.

The patch for spcaview-20051212, changing private ioctl for light frequency banding filters testing also is enclosed to the letter.
In patched  spcaview just need  press key <L>  for switching bandings filters. 

Regards,
Serge A. Suchkov
--
All things are possible, except skiing thru a revolving door.
diff -u -r -N jconfig.h jconfig.h
--- jconfig.h	2005-12-10 17:21:53.000000000 +0100
+++ jconfig.h	2006-08-23 15:41:07.000000000 +0200
@@ -8,15 +8,19 @@
 #define VIDEO_PALETTE_JPEG  21
 #define SWAP_RGB 1
 int bpp;
+/* our own ioctl */
 struct video_param {
 	int chg_para;
 #define CHGABRIGHT 1
 #define CHGQUALITY 2
+#define CHGLIGHTFREQ 3
 #define CHGTINTER  4
 	__u8 autobright;
 	__u8 quality;
 	__u16 time_interval;
+	__u8 light_freq;
 };
+
 /* Our private ioctl */
 #define SPCAGVIDIOPARAM _IOR('v',BASE_VIDIOCPRIVATE + 1,struct video_param)
 #define SPCASVIDIOPARAM _IOW('v',BASE_VIDIOCPRIVATE + 2,struct video_param)
diff -u -r -N spcaview.c spcaview.c
--- spcaview.c	2005-12-11 14:35:17.000000000 +0100
+++ spcaview.c	2006-08-25 14:23:45.000000000 +0200
@@ -1265,6 +1265,40 @@
 		spcaPrintParam (fd,videoparam);
 	
 }
+
+static void spcaSetLightFrequency(int fd, struct video_param * videoparam, int light_freq)
+{			       
+	videoparam->chg_para = CHGLIGHTFREQ;
+	videoparam->light_freq = light_freq;
+	if(ioctl(fd,SPCASVIDIOPARAM, videoparam) == -1){
+		printf ("light freqency error !!\n");
+	} else
+		spcaPrintParam (fd,videoparam);
+}
+
+static int spcaSwitchLightFrequency(int fd, struct video_param * videoparam)
+{			       
+	int light_freq;
+        if(ioctl(fd,SPCAGVIDIOPARAM, videoparam) == -1){
+		printf ("wrong spca5xx device\n");
+	} else {
+	   light_freq = videoparam->light_freq;
+	   if(light_freq == 50)
+	      light_freq +=10;
+	   else if(light_freq == 60) 
+              light_freq = 0;
+	   else if(light_freq == 0)   
+	      light_freq = 50;
+	   if(light_freq)
+	    printf ("Current light frequency filter: %d Hz\n", light_freq);
+	   else
+	    printf ("Current light frequency filter: NoFliker\n");
+	   spcaSetLightFrequency(fd,videoparam,light_freq);
+	}
+	return light_freq;
+}
+
+
 static void spcaSetTimeInterval(int fd, struct video_param *videoparam, unsigned short time)
 {
 	if (time < 1000) {
@@ -1293,8 +1327,8 @@
 	if(ioctl(fd,SPCAGVIDIOPARAM, videoparam) == -1){
 		printf ("wrong spca5xx device\n");
 	} else 
-		printf("quality %d autoexpo %d Timeframe %d \n",
-			 videoparam->quality,videoparam->autobright,videoparam->time_interval);
+		printf("quality %d autoexpo %d Timeframe %d lightfreq %d\n",
+			 videoparam->quality,videoparam->autobright,videoparam->time_interval, videoparam->light_freq);
 }
 static void qualityUp(int fd,struct video_param *videoparam)
 {
@@ -1919,6 +1953,9 @@
 							case SDLK_f:
 							qualityDown(fd, &videoparam); //decrease quality
 							break;
+							case SDLK_l:
+							spcaSwitchLightFrequency(fd, &videoparam); //switch light frequency filter
+							break;
 							case SDLK_q:
 								printf ("\nStop asked\n");
 								run = 0;

Attachment: gspcav1-add-lightfreq.diff.bz2
Description: BZip2 compressed data

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Spca50x-devs mailing list
Spca50x-devs@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/spca50x-devs