diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2009-01-07 14:49:57 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:30 -0400 |
commit | 36e819db435a61819d50c57c424a5ab2b9634e59 (patch) | |
tree | 298bc85147b5fb60eaf5e6ecb745382a9a3580fa /drivers/media/video/gspca/zc3xx.c | |
parent | 96ff65144c3e302698d6c53b8d05098844c6b064 (diff) |
V4L/DVB (10345): gspca - jpeg subdrivers: One quantization table per subdriver.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/zc3xx.c')
-rw-r--r-- | drivers/media/video/gspca/zc3xx.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c index 2482f9163adb..226aafc9688d 100644 --- a/drivers/media/video/gspca/zc3xx.c +++ b/drivers/media/video/gspca/zc3xx.c | |||
@@ -31,6 +31,7 @@ MODULE_LICENSE("GPL"); | |||
31 | 31 | ||
32 | static int force_sensor = -1; | 32 | static int force_sensor = -1; |
33 | 33 | ||
34 | #define QUANT_VAL 1 /* quantization table */ | ||
34 | #include "jpeg.h" | 35 | #include "jpeg.h" |
35 | #include "zc3xx-reg.h" | 36 | #include "zc3xx-reg.h" |
36 | 37 | ||
@@ -45,7 +46,6 @@ struct sd { | |||
45 | __u8 lightfreq; | 46 | __u8 lightfreq; |
46 | __u8 sharpness; | 47 | __u8 sharpness; |
47 | 48 | ||
48 | char qindex; | ||
49 | signed char sensor; /* Type of image sensor chip */ | 49 | signed char sensor; /* Type of image sensor chip */ |
50 | /* !! values used in different tables */ | 50 | /* !! values used in different tables */ |
51 | #define SENSOR_CS2102 0 | 51 | #define SENSOR_CS2102 0 |
@@ -6536,7 +6536,6 @@ static void setquality(struct gspca_dev *gspca_dev) | |||
6536 | { | 6536 | { |
6537 | struct sd *sd = (struct sd *) gspca_dev; | 6537 | struct sd *sd = (struct sd *) gspca_dev; |
6538 | struct usb_device *dev = gspca_dev->dev; | 6538 | struct usb_device *dev = gspca_dev->dev; |
6539 | __u8 quality; | ||
6540 | __u8 frxt; | 6539 | __u8 frxt; |
6541 | 6540 | ||
6542 | switch (sd->sensor) { | 6541 | switch (sd->sensor) { |
@@ -6547,26 +6546,18 @@ static void setquality(struct gspca_dev *gspca_dev) | |||
6547 | return; | 6546 | return; |
6548 | } | 6547 | } |
6549 | /*fixme: is it really 0008 0007 0018 for all other sensors? */ | 6548 | /*fixme: is it really 0008 0007 0018 for all other sensors? */ |
6550 | quality = sd->qindex; | 6549 | reg_w(dev, QUANT_VAL, 0x0008); |
6551 | reg_w(dev, quality, 0x0008); | ||
6552 | frxt = 0x30; | 6550 | frxt = 0x30; |
6553 | reg_w(dev, frxt, 0x0007); | 6551 | reg_w(dev, frxt, 0x0007); |
6554 | switch (quality) { | 6552 | #if QUANT_VAL == 0 || QUANT_VAL == 1 || QUANT_VAL == 2 |
6555 | case 0: | 6553 | frxt = 0xff; |
6556 | case 1: | 6554 | #elif QUANT_VAL == 3 |
6557 | case 2: | 6555 | frxt = 0xf0; |
6558 | frxt = 0xff; | 6556 | #elif QUANT_VAL == 4 |
6559 | break; | 6557 | frxt = 0xe0; |
6560 | case 3: | 6558 | #else |
6561 | frxt = 0xf0; | 6559 | frxt = 0x20; |
6562 | break; | 6560 | #endif |
6563 | case 4: | ||
6564 | frxt = 0xe0; | ||
6565 | break; | ||
6566 | case 5: | ||
6567 | frxt = 0x20; | ||
6568 | break; | ||
6569 | } | ||
6570 | reg_w(dev, frxt, 0x0018); | 6561 | reg_w(dev, frxt, 0x0018); |
6571 | } | 6562 | } |
6572 | 6563 | ||
@@ -7156,7 +7147,6 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
7156 | cam->cam_mode = sif_mode; | 7147 | cam->cam_mode = sif_mode; |
7157 | cam->nmodes = ARRAY_SIZE(sif_mode); | 7148 | cam->nmodes = ARRAY_SIZE(sif_mode); |
7158 | } | 7149 | } |
7159 | sd->qindex = 1; | ||
7160 | sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; | 7150 | sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; |
7161 | sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; | 7151 | sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; |
7162 | sd->gamma = gamma[(int) sd->sensor]; | 7152 | sd->gamma = gamma[(int) sd->sensor]; |
@@ -7358,9 +7348,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
7358 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, | 7348 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, |
7359 | data, 0); | 7349 | data, 0); |
7360 | /* put the JPEG header in the new frame */ | 7350 | /* put the JPEG header in the new frame */ |
7361 | jpeg_put_header(gspca_dev, frame, | 7351 | jpeg_put_header(gspca_dev, frame, 0x21); |
7362 | ((struct sd *) gspca_dev)->qindex, | ||
7363 | 0x21); | ||
7364 | /* remove the webcam's header: | 7352 | /* remove the webcam's header: |
7365 | * ff d8 ff fe 00 0e 00 00 ss ss 00 01 ww ww hh hh pp pp | 7353 | * ff d8 ff fe 00 0e 00 00 ss ss 00 01 ww ww hh hh pp pp |
7366 | * - 'ss ss' is the frame sequence number (BE) | 7354 | * - 'ss ss' is the frame sequence number (BE) |