Skip to contentSkip to conversation

PAtch: gspca-sonixb-ov6650-expo-clamp.patch

PATCH Hans de Goede 1 participant 1 message Jul 16, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi,

This patches fixing oscilating in daylight with clouds with the sonixb driver in combination with the ov6650 sensor.

Regards,

Hans

This patches fixing oscilating in daylight with clouds with the sonixb driver in combination with the ov6650 sensor.

linux/drivers/media/video/gspca/sonixb.c +11 -3
diff -r 086f909be17c linux/drivers/media/video/gspca/sonixb.c
@@ -712,8 +712,13 @@
 		/* frame exposure time in ms = 1000 * reg11 / 30    ->
 		reg10 = sd->exposure * 2 * reg10_max / (1000 * reg11 / 30) */
 		reg10 = (sd->exposure * 60 * reg10_max) / (1000 * reg11);
-		if (reg10 < 1) /* 0 is a valid value, but is very _black_ */
-			reg10 = 1;
+		
+		/* Don't allow this to get below 10 when using autogain, the
+		   steps become very large (relatively) when below 10 causing
+		   the image to oscilate from much too dark, to much too bright
+		   and back again. */
+		if (sd->autogain && reg10 < 10)
+			reg10 = 10;
 		else if (reg10 > reg10_max)
 			reg10 = reg10_max;
 
@@ -796,8 +801,11 @@
 		sd->autogain_ignore_frames--;
 	else if (gspca_auto_gain_n_exposure(gspca_dev, avg_lum,
 			sd->brightness * DESIRED_AVG_LUM / 127,
-			AUTOGAIN_DEADZONE, GAIN_KNEE, EXPOSURE_KNEE))
+			AUTOGAIN_DEADZONE, GAIN_KNEE, EXPOSURE_KNEE)) {
+		PDEBUG(D_FRAM, "autogain: gain changed: gain: %d expo: %d\n",
+			(int)sd->gain, (int)sd->exposure);
 		sd->autogain_ignore_frames = AUTOGAIN_IGNORE_FRAMES;
+	}
 }
 
 /* this function is called at probe time */

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list