summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-10-22 09:59:29 +0200
committerJean-Francois Moine <moinejf@free.fr>2008-10-22 09:59:29 +0200
commit2c1d2959d7098e5e5f0acd1bcc6c015c824dac0a (patch)
treebb9d8f99bc366fa358fac05c7a9231feb440e06b
parent3694393e19784ce8396c6ba5d88aff33f46db319 (diff)
downloadmediapointer-dvb-s2-2c1d2959d7098e5e5f0acd1bcc6c015c824dac0a.tar.gz
mediapointer-dvb-s2-2c1d2959d7098e5e5f0acd1bcc6c015c824dac0a.tar.bz2
gspca: Adjust autoexpo values for cams with a vga sensor in sonixb.
From: Hans de Goede <hdegoede@redhat.com> - This patch makes sonixb.c strife to different values during autoexposure for sif versus vga sensors. Priority: normal Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
-rw-r--r--linux/drivers/media/video/gspca/sonixb.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/linux/drivers/media/video/gspca/sonixb.c b/linux/drivers/media/video/gspca/sonixb.c
index 4bae911da..4eec924ad 100644
--- a/linux/drivers/media/video/gspca/sonixb.c
+++ b/linux/drivers/media/video/gspca/sonixb.c
@@ -132,8 +132,6 @@ struct sensor_data {
ignore atleast the 2 next frames for the new settings to come into effect
before doing any other adjustments */
#define AUTOGAIN_IGNORE_FRAMES 3
-#define AUTOGAIN_DEADZONE 1000
-#define DESIRED_AVG_LUM 7000
/* V4L2 controls supported by the driver */
static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
@@ -857,17 +855,28 @@ static void setfreq(struct gspca_dev *gspca_dev)
static void do_autogain(struct gspca_dev *gspca_dev)
{
+ int deadzone, desired_avg_lum;
struct sd *sd = (struct sd *) gspca_dev;
int avg_lum = atomic_read(&sd->avg_lum);
if (avg_lum == -1)
return;
+ /* SIF / VGA sensors have a different autoexposure area and thus
+ different avg_lum values for the same picture brightness */
+ if (sensor_data[sd->sensor].flags & F_SIF) {
+ deadzone = 1000;
+ desired_avg_lum = 7000;
+ } else {
+ deadzone = 3000;
+ desired_avg_lum = 23000;
+ }
+
if (sd->autogain_ignore_frames > 0)
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)) {
+ sd->brightness * desired_avg_lum / 127,
+ 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;