21 #ifdef WANT_REGULAR_AUTOGAIN
27 static inline int auto_gain_n_exposure(
35 struct sd *
sd = (
struct sd *) gspca_dev;
44 steps =
abs(desired_avg_lum - avg_lum) / deadzone;
46 PDEBUG(D_FRAM,
"autogain: lum: %d, desired: %d, steps: %d",
47 avg_lum, desired_avg_lum, steps);
49 for (i = 0; i <
steps; i++) {
50 if (avg_lum > desired_avg_lum) {
53 else if (exposure > exposure_knee)
66 else if (exposure < exposure_knee)
68 else if (gain < gain_knee)
79 if (gain != orig_gain) {
84 if (exposure != orig_exposure) {
86 setexposure(gspca_dev);
91 PDEBUG(D_FRAM,
"autogain: changed gain: %d, expo: %d",
97 #ifdef WANT_COARSE_EXPO_AUTOGAIN
113 static inline int coarse_grained_expo_autogain(
114 struct gspca_dev *gspca_dev,
119 struct sd *sd = (
struct sd *) gspca_dev;
121 int gain_low, gain_high;
134 steps = (desired_avg_lum -
avg_lum) / deadzone;
136 PDEBUG(D_FRAM,
"autogain: lum: %d, desired: %d, steps: %d",
137 avg_lum, desired_avg_lum, steps);
139 if ((gain + steps) > gain_high &&
144 }
else if ((gain + steps) < gain_low &&
167 if (gain != orig_gain) {
172 if (exposure != orig_exposure) {
174 setexposure(gspca_dev);
179 PDEBUG(D_FRAM,
"autogain: changed gain: %d, expo: %d",