aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/sonixb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/sonixb.c')
-rw-r--r--drivers/media/video/gspca/sonixb.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index bde9ea9b980e..64bc758fbae5 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -52,6 +52,7 @@ MODULE_LICENSE("GPL");
52struct sd { 52struct sd {
53 struct gspca_dev gspca_dev; /* !! must be the first item */ 53 struct gspca_dev gspca_dev; /* !! must be the first item */
54 atomic_t avg_lum; 54 atomic_t avg_lum;
55 int prev_avg_lum;
55 56
56 unsigned char gain; 57 unsigned char gain;
57 unsigned char exposure; 58 unsigned char exposure;
@@ -1022,10 +1023,19 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1022 } else { 1023 } else {
1023 lum = data[i + 8] + (data[i + 9] << 8); 1024 lum = data[i + 8] + (data[i + 9] << 8);
1024 } 1025 }
1025 if (lum == 0) { 1026 /* When exposure changes midway a frame we
1027 get a lum of 0 in this case drop 2 frames
1028 as the frames directly after an exposure
1029 change have an unstable image. Sometimes lum
1030 *really* is 0 (cam used in low light with
1031 low exposure setting), so do not drop frames
1032 if the previous lum was 0 too. */
1033 if (lum == 0 && sd->prev_avg_lum != 0) {
1026 lum = -1; 1034 lum = -1;
1027 sd->frames_to_drop = 2; 1035 sd->frames_to_drop = 2;
1028 } 1036 sd->prev_avg_lum = 0;
1037 } else
1038 sd->prev_avg_lum = lum;
1029 atomic_set(&sd->avg_lum, lum); 1039 atomic_set(&sd->avg_lum, lum);
1030 1040
1031 if (sd->frames_to_drop) { 1041 if (sd->frames_to_drop) {