aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2009-01-07 14:49:57 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:30 -0400
commit36e819db435a61819d50c57c424a5ab2b9634e59 (patch)
tree298bc85147b5fb60eaf5e6ecb745382a9a3580fa /drivers/media
parent96ff65144c3e302698d6c53b8d05098844c6b064 (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')
-rw-r--r--drivers/media/video/gspca/conex.c8
-rw-r--r--drivers/media/video/gspca/jpeg.h283
-rw-r--r--drivers/media/video/gspca/mars.c9
-rw-r--r--drivers/media/video/gspca/sonixj.c5
-rw-r--r--drivers/media/video/gspca/spca500.c5
-rw-r--r--drivers/media/video/gspca/stk014.c10
-rw-r--r--drivers/media/video/gspca/sunplus.c7
-rw-r--r--drivers/media/video/gspca/zc3xx.c36
8 files changed, 183 insertions, 180 deletions
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index 2de8906e5661..de2e608bf5ba 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -23,6 +23,7 @@
23 23
24#include "gspca.h" 24#include "gspca.h"
25#define CONEX_CAM 1 /* special JPEG header */ 25#define CONEX_CAM 1 /* special JPEG header */
26#define QUANT_VAL 0 /* quantization table */
26#include "jpeg.h" 27#include "jpeg.h"
27 28
28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 29MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
@@ -36,8 +37,6 @@ struct sd {
36 unsigned char brightness; 37 unsigned char brightness;
37 unsigned char contrast; 38 unsigned char contrast;
38 unsigned char colors; 39 unsigned char colors;
39
40 unsigned char qindex;
41}; 40};
42 41
43/* V4L2 controls supported by the driver */ 42/* V4L2 controls supported by the driver */
@@ -818,7 +817,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
818 cam->cam_mode = vga_mode; 817 cam->cam_mode = vga_mode;
819 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 818 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
820 819
821 sd->qindex = 0; /* set the quantization */
822 sd->brightness = BRIGHTNESS_DEF; 820 sd->brightness = BRIGHTNESS_DEF;
823 sd->contrast = CONTRAST_DEF; 821 sd->contrast = CONTRAST_DEF;
824 sd->colors = COLOR_DEF; 822 sd->colors = COLOR_DEF;
@@ -882,9 +880,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
882 data, 0); 880 data, 0);
883 881
884 /* put the JPEG header in the new frame */ 882 /* put the JPEG header in the new frame */
885 jpeg_put_header(gspca_dev, frame, 883 jpeg_put_header(gspca_dev, frame, 0x22);
886 ((struct sd *) gspca_dev)->qindex,
887 0x22);
888 data += 2; 884 data += 2;
889 len -= 2; 885 len -= 2;
890 } 886 }
diff --git a/drivers/media/video/gspca/jpeg.h b/drivers/media/video/gspca/jpeg.h
index d823b47bd4e6..7d2df9720025 100644
--- a/drivers/media/video/gspca/jpeg.h
+++ b/drivers/media/video/gspca/jpeg.h
@@ -24,171 +24,207 @@
24 * 24 *
25 */ 25 */
26 26
27/* start of jpeg frame + quantization table */ 27/*
28static const unsigned char quant[][0x88] = { 28 * generation options
29/* index 0 - Q40*/ 29 * CONEX_CAM Conexant if present
30 { 30 * QUANT_VAL quantization table (0..8)
31 */
32
33/*
34 * JPEG header:
35 * - start of jpeg frame
36 * - quantization table
37 * - huffman table
38 * - start of SOF0
39 */
40static const u8 jpeg_head[] = {
31 0xff, 0xd8, /* jpeg */ 41 0xff, 0xd8, /* jpeg */
32 0xff, 0xdb, 0x00, 0x84, /* DQT */ 42 0xff, 0xdb, 0x00, 0x84, /* DQT */
43#if QUANT_VAL == 0
44/* index 0 - Q40*/
330, /* quantization table part 1 */ 450, /* quantization table part 1 */
34 20, 14, 15, 18, 15, 13, 20, 18, 16, 18, 23, 21, 20, 24, 30, 50, 46 0x14, 0x0e, 0x0f, 0x12, 0x0f, 0x0d, 0x14, 0x12,
35 33, 30, 28, 28, 30, 61, 44, 46, 36, 50, 73, 64, 76, 75, 71, 64, 47 0x10, 0x12, 0x17, 0x15, 0x14, 0x18, 0x1e, 0x32,
36 70, 69, 80, 90, 115, 98, 80, 85, 109, 86, 69, 70, 100, 136, 101, 48 0x21, 0x1e, 0x1c, 0x1c, 0x1e, 0x3d, 0x2c, 0x2e,
37 109, 49 0x24, 0x32, 0x49, 0x40, 0x4c, 0x4b, 0x47, 0x40,
38 119, 123, 129, 130, 129, 78, 96, 141, 151, 140, 125, 150, 115, 50 0x46, 0x45, 0x50, 0x5a, 0x73, 0x62, 0x50, 0x55,
39 126, 129, 124, 51 0x6d, 0x56, 0x45, 0x46, 0x64, 0x88, 0x65, 0x6d,
52 0x77, 0x7b, 0x81, 0x82, 0x81, 0x4e, 0x60, 0x8d,
53 0x97, 0x8c, 0x7d, 0x96, 0x73, 0x7e, 0x81, 0x7c,
401, /* quantization table part 2 */ 541, /* quantization table part 2 */
41 21, 23, 23, 30, 26, 30, 59, 33, 33, 59, 124, 83, 70, 83, 124, 124, 55 0x15, 0x17, 0x17, 0x1e, 0x1a, 0x1e, 0x3b, 0x21,
42 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 56 0x21, 0x3b, 0x7c, 0x53, 0x46, 0x53, 0x7c, 0x0c,
43 124, 124, 124, 57 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
44 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 58 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
45 124, 124, 124, 59 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
46 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 60 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
47 124, 124, 124}, 61 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
62 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
63#elif QUANT_VAL == 1
48/* index 1 - Q50 */ 64/* index 1 - Q50 */
49 {
50 0xff, 0xd8,
51 0xff, 0xdb, 0x00, 0x84, /* DQT */
520, 650,
53 16, 11, 12, 14, 12, 10, 16, 14, 13, 14, 18, 17, 16, 19, 24, 40, 66 0x10, 0x0b, 0x0c, 0x0e, 0x0c, 0x0a, 0x10, 0x0e,
54 26, 24, 22, 22, 24, 49, 35, 37, 29, 40, 58, 51, 61, 60, 57, 51, 67 0x0d, 0x0e, 0x12, 0x11, 0x10, 0x13, 0x18, 0x28,
55 56, 55, 64, 72, 92, 78, 64, 68, 87, 69, 55, 56, 80, 109, 81, 87, 68 0x1a, 0x18, 0x16, 0x16, 0x18, 0x31, 0x23, 0x25,
56 95, 98, 103, 104, 103, 62, 77, 113, 121, 112, 100, 120, 92, 101, 69 0x1d, 0x28, 0x3a, 0x33, 0x3d, 0x3c, 0x39, 0x33,
57 103, 99, 70 0x38, 0x37, 0x40, 0x48, 0x5c, 0x4e, 0x40, 0x44,
71 0x57, 0x45, 0x37, 0x38, 0x50, 0x6d, 0x51, 0x57,
72 0x5f, 0x62, 0x67, 0x68, 0x67, 0x3e, 0x4d, 0x71,
73 0x79, 0x70, 0x64, 0x78, 0x5c, 0x65, 0x67, 0x63,
581, 741,
59 17, 18, 18, 24, 21, 24, 47, 26, 26, 47, 99, 66, 56, 66, 99, 99, 75 0x11, 0x12, 0x12, 0x18, 0x15, 0x18, 0x2f, 0x1a,
60 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 76 0x1a, 0x2f, 0x63, 0x42, 0x38, 0x42, 0x63, 0x63,
61 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 77 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
62 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}, 78 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
79 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
80 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
81 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
82 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
83#elif QUANT_VAL == 2
63/* index 2 Q60 */ 84/* index 2 Q60 */
64 {
65 0xff, 0xd8,
66 0xff, 0xdb, 0x00, 0x84, /* DQT */
670, 850,
68 13, 9, 10, 11, 10, 8, 13, 11, 10, 11, 14, 14, 13, 15, 19, 32, 86 0x0d, 0x09, 0x0a, 0x0b, 0x0a, 0x08, 0x0d, 0x0b,
69 21, 19, 18, 18, 19, 39, 28, 30, 23, 32, 46, 41, 49, 48, 46, 41, 87 0x0a, 0x0b, 0x0e, 0x0e, 0x0d, 0x0f, 0x13, 0x20,
70 45, 44, 51, 58, 74, 62, 51, 54, 70, 55, 44, 45, 64, 87, 65, 70, 88 0x15, 0x13, 0x12, 0x12, 0x13, 0x27, 0x1c, 0x1e,
71 76, 78, 82, 83, 82, 50, 62, 90, 97, 90, 80, 96, 74, 81, 82, 79, 89 0x17, 0x20, 0x2e, 0x29, 0x31, 0x30, 0x2e, 0x29,
90 0x2d, 0x2c, 0x33, 0x3a, 0x4a, 0x3e, 0x33, 0x36,
91 0x46, 0x37, 0x2c, 0x2d, 0x40, 0x57, 0x41, 0x46,
92 0x4c, 0x4e, 0x52, 0x53, 0x52, 0x32, 0x3e, 0x5a,
93 0x61, 0x5a, 0x50, 0x60, 0x4a, 0x51, 0x52, 0x4f,
721, 941,
73 14, 14, 14, 19, 17, 19, 38, 21, 21, 38, 79, 53, 45, 53, 79, 79, 95 0x0e, 0x0e, 0x0e, 0x13, 0x11, 0x13, 0x26, 0x15,
74 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 96 0x15, 0x26, 0x4f, 0x35, 0x2d, 0x35, 0x4f, 0x4f,
75 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 97 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
76 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79}, 98 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
99 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
100 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
101 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
102 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
103#elif QUANT_VAL == 3
77/* index 3 - Q70 */ 104/* index 3 - Q70 */
78 {
79 0xff, 0xd8,
80 0xff, 0xdb, 0x00, 0x84, /* DQT */
810, 1050,
82 10, 7, 7, 8, 7, 6, 10, 8, 8, 8, 11, 10, 10, 11, 14, 24, 106 0x0a, 0x07, 0x07, 0x08, 0x07, 0x06, 0x0a, 0x08,
83 16, 14, 13, 13, 14, 29, 21, 22, 17, 24, 35, 31, 37, 36, 34, 31, 107 0x08, 0x08, 0x0b, 0x0a, 0x0a, 0x0b, 0x0e, 0x18,
84 34, 33, 38, 43, 55, 47, 38, 41, 52, 41, 33, 34, 48, 65, 49, 52, 108 0x10, 0x0e, 0x0d, 0x0d, 0x0e, 0x1d, 0x15, 0x16,
85 57, 59, 62, 62, 62, 37, 46, 68, 73, 67, 60, 72, 55, 61, 62, 59, 109 0x11, 0x18, 0x23, 0x1f, 0x25, 0x24, 0x22, 0x1f,
110 0x22, 0x21, 0x26, 0x2b, 0x37, 0x2f, 0x26, 0x29,
111 0x34, 0x29, 0x21, 0x22, 0x30, 0x41, 0x31, 0x34,
112 0x39, 0x3b, 0x3e, 0x3e, 0x3e, 0x25, 0x2e, 0x44,
113 0x49, 0x43, 0x3c, 0x48, 0x37, 0x3d, 0x3e, 0x3b,
861, 1141,
87 10, 11, 11, 14, 13, 14, 28, 16, 16, 28, 59, 40, 34, 40, 59, 59, 115 0x0a, 0x0b, 0x0b, 0x0e, 0x0d, 0x0e, 0x1c, 0x10,
88 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 116 0x10, 0x1c, 0x3b, 0x28, 0x22, 0x28, 0x3b, 0x3b,
89 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 117 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
90 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59}, 118 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
119 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
120 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
121 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
122 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
123#elif QUANT_VAL == 4
91/* index 4 - Q80 */ 124/* index 4 - Q80 */
92 {
93 0xff, 0xd8,
94 0xff, 0xdb, 0x00, 0x84, /* DQT */
950, 1250,
96 6, 4, 5, 6, 5, 4, 6, 6, 5, 6, 7, 7, 6, 8, 10, 16, 126 0x06, 0x04, 0x05, 0x06, 0x05, 0x04, 0x06, 0x06,
97 10, 10, 9, 9, 10, 20, 14, 15, 12, 16, 23, 20, 24, 24, 23, 20, 127 0x05, 0x06, 0x07, 0x07, 0x06, 0x08, 0x0a, 0x10,
98 22, 22, 26, 29, 37, 31, 26, 27, 35, 28, 22, 22, 32, 44, 32, 35, 128 0x0a, 0x0a, 0x09, 0x09, 0x0a, 0x14, 0x0e, 0x0f,
99 38, 39, 41, 42, 41, 25, 31, 45, 48, 45, 40, 48, 37, 40, 41, 40, 129 0x0c, 0x10, 0x17, 0x14, 0x18, 0x18, 0x17, 0x14,
130 0x16, 0x16, 0x1a, 0x1d, 0x25, 0x1f, 0x1a, 0x1b,
131 0x23, 0x1c, 0x16, 0x16, 0x20, 0x2c, 0x20, 0x23,
132 0x26, 0x27, 0x29, 0x2a, 0x29, 0x19, 0x1f, 0x2d,
133 0x30, 0x2d, 0x28, 0x30, 0x25, 0x28, 0x29, 0x28,
1001, 1341,
101 7, 7, 7, 10, 8, 10, 19, 10, 10, 19, 40, 26, 22, 26, 40, 40, 135 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x13, 0x0a,
102 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 136 0x0a, 0x13, 0x28, 0x1a, 0x16, 0x1a, 0x28, 0x28,
103 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 137 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
104 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}, 138 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
139 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
140 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
141 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
142 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
143#elif QUANT_VAL == 5
105/* index 5 - Q85 */ 144/* index 5 - Q85 */
106 {
107 0xff, 0xd8,
108 0xff, 0xdb, 0x00, 0x84, /* DQT */
1090, 1450,
110 5, 3, 4, 4, 4, 3, 5, 4, 4, 4, 5, 5, 5, 6, 7, 12, 146 0x05, 0x03, 0x04, 0x04, 0x04, 0x03, 0x05, 0x04,
111 8, 7, 7, 7, 7, 15, 11, 11, 9, 12, 17, 15, 18, 18, 17, 15, 147 0x04, 0x04, 0x05, 0x05, 0x05, 0x06, 0x07, 0x0c,
112 17, 17, 19, 22, 28, 23, 19, 20, 26, 21, 17, 17, 24, 33, 24, 26, 148 0x08, 0x07, 0x07, 0x07, 0x07, 0x0f, 0x0b, 0x0b,
113 29, 29, 31, 31, 31, 19, 23, 34, 36, 34, 30, 36, 28, 30, 31, 30, 149 0x09, 0x0c, 0x11, 0x0f, 0x12, 0x12, 0x11, 0x0f,
150 0x11, 0x11, 0x13, 0x16, 0x1c, 0x17, 0x13, 0x14,
151 0x1a, 0x15, 0x11, 0x11, 0x18, 0x21, 0x18, 0x1a,
152 0x1d, 0x1d, 0x1f, 0x1f, 0x1f, 0x13, 0x17, 0x22,
153 0x24, 0x22, 0x1e, 0x24, 0x1c, 0x1e, 0x1f, 0x1e,
1141, 1541,
115 5, 5, 5, 7, 6, 7, 14, 8, 8, 14, 30, 20, 17, 20, 30, 30, 155 0x05, 0x05, 0x05, 0x07, 0x06, 0x07, 0x0e, 0x08,
116 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 156 0x08, 0x0e, 0x1e, 0x14, 0x11, 0x14, 0x1e, 0x1e,
117 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 157 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
118 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30}, 158 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
159 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
160 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
161 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
162 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
163#elif QUANT_VAL == 6
119/* index 6 - 86 */ 164/* index 6 - 86 */
120{
121 0xff, 0xd8,
122 0xff, 0xdb, 0x00, 0x84, /* DQT */
1230, 1650,
124 0x04, 0x03, 0x03, 0x04, 0x03, 0x03, 0x04, 0x04, 166 0x04, 0x03, 0x03, 0x04, 0x03, 0x03, 0x04, 0x04,
125 0x04, 0x04, 0x05, 0x05, 0x04, 0x05, 0x07, 0x0B, 167 0x04, 0x04, 0x05, 0x05, 0x04, 0x05, 0x07, 0x0B,
126 0x07, 0x07, 0x06, 0x06, 0x07, 0x0E, 0x0A, 0x0A, 168 0x07, 0x07, 0x06, 0x06, 0x07, 0x0e, 0x0a, 0x0a,
127 0x08, 0x0B, 0x10, 0x0E, 0x11, 0x11, 0x10, 0x0E, 169 0x08, 0x0B, 0x10, 0x0e, 0x11, 0x11, 0x10, 0x0e,
128 0x10, 0x0F, 0x12, 0x14, 0x1A, 0x16, 0x12, 0x13, 170 0x10, 0x0f, 0x12, 0x14, 0x1a, 0x16, 0x12, 0x13,
129 0x18, 0x13, 0x0F, 0x10, 0x16, 0x1F, 0x17, 0x18, 171 0x18, 0x13, 0x0f, 0x10, 0x16, 0x1f, 0x17, 0x18,
130 0x1B, 0x1B, 0x1D, 0x1D, 0x1D, 0x11, 0x16, 0x20, 172 0x1b, 0x1b, 0x1d, 0x1d, 0x1d, 0x11, 0x16, 0x20,
131 0x22, 0x1F, 0x1C, 0x22, 0x1A, 0x1C, 0x1D, 0x1C, 173 0x22, 0x1f, 0x1c, 0x22, 0x1a, 0x1c, 0x1d, 0x1c,
1321, 1741,
133 0x05, 0x05, 0x05, 0x07, 0x06, 0x07, 0x0D, 0x07, 175 0x05, 0x05, 0x05, 0x07, 0x06, 0x07, 0x0D, 0x07,
134 0x07, 0x0D, 0x1C, 0x12, 0x10, 0x12, 0x1C, 0x1C, 176 0x07, 0x0D, 0x1c, 0x12, 0x10, 0x12, 0x1c, 0x1c,
135 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 177 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
136 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 178 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
137 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 179 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
138 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 180 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
139 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 181 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
140 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 182 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
141 }, 183#elif QUANT_VAL == 7
142/* index 7 - 88 */ 184/* index 7 - 88 */
143{
144 0xff, 0xd8,
145 0xff, 0xdb, 0x00, 0x84, /* DQT */
1460, 1850,
147 0x04, 0x03, 0x03, 0x03, 0x03, 0x02, 0x04, 0x03, 186 0x04, 0x03, 0x03, 0x03, 0x03, 0x02, 0x04, 0x03,
148 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x06, 0x0A, 187 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x06, 0x0a,
149 0x06, 0x06, 0x05, 0x05, 0x06, 0x0C, 0x08, 0x09, 188 0x06, 0x06, 0x05, 0x05, 0x06, 0x0C, 0x08, 0x09,
150 0x07, 0x0A, 0x0E, 0x0C, 0x0F, 0x0E, 0x0E, 0x0C, 189 0x07, 0x0a, 0x0e, 0x0c, 0x0f, 0x0e, 0x0e, 0x0c,
151 0x0D, 0x0D, 0x0F, 0x11, 0x16, 0x13, 0x0F, 0x10, 190 0x0d, 0x0d, 0x0f, 0x11, 0x16, 0x13, 0x0f, 0x10,
152 0x15, 0x11, 0x0D, 0x0D, 0x13, 0x1A, 0x13, 0x15, 191 0x15, 0x11, 0x0d, 0x0d, 0x13, 0x1a, 0x13, 0x15,
153 0x17, 0x18, 0x19, 0x19, 0x19, 0x0F, 0x12, 0x1B, 192 0x17, 0x18, 0x19, 0x19, 0x19, 0x0f, 0x12, 0x1b,
154 0x1D, 0x1B, 0x18, 0x1D, 0x16, 0x18, 0x19, 0x18, 193 0x1d, 0x1b, 0x18, 0x1d, 0x16, 0x18, 0x19, 0x18,
1551, 1941,
156 0x04, 0x04, 0x04, 0x06, 0x05, 0x06, 0x0B, 0x06, 195 0x04, 0x04, 0x04, 0x06, 0x05, 0x06, 0x0B, 0x06,
157 0x06, 0x0B, 0x18, 0x10, 0x0D, 0x10, 0x18, 0x18, 196 0x06, 0x0B, 0x18, 0x10, 0x0d, 0x10, 0x18, 0x18,
158 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 197 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
159 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 198 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
160 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 199 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
161 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 200 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
162 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 201 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
163 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 202 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
164}, 203#elif QUANT_VAL == 8
165/* index 8 - ?? */ 204/* index 8 - ?? */
166{
167 0xff, 0xd8,
168 0xff, 0xdb, 0x00, 0x84, /* DQT */
1690, 2050,
170 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 206 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
171 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x05, 207 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x05,
172 0x03, 0x03, 0x03, 0x03, 0x03, 0x06, 0x04, 0x05, 208 0x03, 0x03, 0x03, 0x03, 0x03, 0x06, 0x04, 0x05,
173 0x04, 0x05, 0x07, 0x06, 0x08, 0x08, 0x07, 0x06, 209 0x04, 0x05, 0x07, 0x06, 0x08, 0x08, 0x07, 0x06,
174 0x07, 0x07, 0x08, 0x09, 0x0C, 0x0A, 0x08, 0x09, 210 0x07, 0x07, 0x08, 0x09, 0x0c, 0x0a, 0x08, 0x09,
175 0x0B, 0x09, 0x07, 0x07, 0x0A, 0x0E, 0x0A, 0x0B, 211 0x0B, 0x09, 0x07, 0x07, 0x0a, 0x0e, 0x0a, 0x0b,
176 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x08, 0x0A, 0x0E, 212 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x08, 0x0a, 0x0e,
177 0x0F, 0x0E, 0x0D, 0x0F, 0x0C, 0x0D, 0x0D, 0x0C, 213 0x0f, 0x0e, 0x0d, 0x0f, 0x0c, 0x0d, 0x0d, 0x0c,
1781, 2141,
179 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x06, 0x03, 215 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x06, 0x03,
180 0x03, 0x06, 0x0C, 0x08, 0x07, 0x08, 0x0C, 0x0C, 216 0x03, 0x06, 0x0c, 0x08, 0x07, 0x08, 0x0c, 0x0c,
181 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 217 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
182 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 218 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
183 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 219 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
184 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 220 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
185 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 221 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
186 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C 222 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
187} 223#else
188}; 224#error "Invalid quantization table"
225#endif
189 226
190/* huffman table + start of SOF0 */ 227/* huffman table */
191static unsigned char huffman[] = {
192 0xff, 0xc4, 0x01, 0xa2, 228 0xff, 0xc4, 0x01, 0xa2,
193 0x00, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 229 0x00, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01,
194 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 230 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -260,7 +296,7 @@ static unsigned char huffman[] = {
260 */ 296 */
261 297
262/* end of header */ 298/* end of header */
263static unsigned char eoh[] = { 299static u8 eoh[] = {
264 0x00, /* quant Y */ 300 0x00, /* quant Y */
265 0x02, 0x11, 0x01, /* samples CbCr - quant CbCr */ 301 0x02, 0x11, 0x01, /* samples CbCr - quant CbCr */
266 0x03, 0x11, 0x01, 302 0x03, 0x11, 0x01,
@@ -273,17 +309,14 @@ static unsigned char eoh[] = {
273/* -- output the JPEG header -- */ 309/* -- output the JPEG header -- */
274static void jpeg_put_header(struct gspca_dev *gspca_dev, 310static void jpeg_put_header(struct gspca_dev *gspca_dev,
275 struct gspca_frame *frame, 311 struct gspca_frame *frame,
276 int qindex,
277 int samplesY) 312 int samplesY)
278{ 313{
279#ifndef CONEX_CAM 314#ifndef CONEX_CAM
280 unsigned char tmpbuf[8]; 315 u8 tmpbuf[8];
281#endif 316#endif
282 317
283 gspca_frame_add(gspca_dev, FIRST_PACKET, frame, 318 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
284 (unsigned char *) quant[qindex], sizeof quant[0]); 319 jpeg_head, sizeof jpeg_head);
285 gspca_frame_add(gspca_dev, INTER_PACKET, frame,
286 (unsigned char *) huffman, sizeof huffman);
287#ifndef CONEX_CAM 320#ifndef CONEX_CAM
288 tmpbuf[0] = gspca_dev->height >> 8; 321 tmpbuf[0] = gspca_dev->height >> 8;
289 tmpbuf[1] = gspca_dev->height & 0xff; 322 tmpbuf[1] = gspca_dev->height & 0xff;
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index 477441e22bab..54c68ea7e546 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -22,6 +22,7 @@
22#define MODULE_NAME "mars" 22#define MODULE_NAME "mars"
23 23
24#include "gspca.h" 24#include "gspca.h"
25#define QUANT_VAL 1 /* quantization table */
25#include "jpeg.h" 26#include "jpeg.h"
26 27
27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
@@ -31,8 +32,6 @@ MODULE_LICENSE("GPL");
31/* specific webcam descriptor */ 32/* specific webcam descriptor */
32struct sd { 33struct sd {
33 struct gspca_dev gspca_dev; /* !! must be the first item */ 34 struct gspca_dev gspca_dev; /* !! must be the first item */
34
35 char qindex;
36}; 35};
37 36
38/* V4L2 controls supported by the driver */ 37/* V4L2 controls supported by the driver */
@@ -117,13 +116,11 @@ static void bulk_w(struct gspca_dev *gspca_dev,
117static int sd_config(struct gspca_dev *gspca_dev, 116static int sd_config(struct gspca_dev *gspca_dev,
118 const struct usb_device_id *id) 117 const struct usb_device_id *id)
119{ 118{
120 struct sd *sd = (struct sd *) gspca_dev;
121 struct cam *cam; 119 struct cam *cam;
122 120
123 cam = &gspca_dev->cam; 121 cam = &gspca_dev->cam;
124 cam->cam_mode = vga_mode; 122 cam->cam_mode = vga_mode;
125 cam->nmodes = ARRAY_SIZE(vga_mode); 123 cam->nmodes = ARRAY_SIZE(vga_mode);
126 sd->qindex = 1; /* set the quantization table */
127 return 0; 124 return 0;
128} 125}
129 126
@@ -345,7 +342,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
345 __u8 *data, /* isoc packet */ 342 __u8 *data, /* isoc packet */
346 int len) /* iso packet length */ 343 int len) /* iso packet length */
347{ 344{
348 struct sd *sd = (struct sd *) gspca_dev;
349 int p; 345 int p;
350 346
351 if (len < 6) { 347 if (len < 6) {
@@ -368,8 +364,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
368 frame, data, 0); 364 frame, data, 0);
369 365
370 /* put the JPEG header */ 366 /* put the JPEG header */
371 jpeg_put_header(gspca_dev, frame, 367 jpeg_put_header(gspca_dev, frame, 0x21);
372 sd->qindex, 0x21);
373 data += 16; 368 data += 16;
374 len -= 16; 369 len -= 16;
375 break; 370 break;
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 755ca302368e..51d68d35aa73 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -22,6 +22,7 @@
22#define MODULE_NAME "sonixj" 22#define MODULE_NAME "sonixj"
23 23
24#include "gspca.h" 24#include "gspca.h"
25#define QUANT_VAL 4 /* quantization table */
25#include "jpeg.h" 26#include "jpeg.h"
26 27
27#define V4L2_CID_INFRARED (V4L2_CID_PRIVATE_BASE + 0) 28#define V4L2_CID_INFRARED (V4L2_CID_PRIVATE_BASE + 0)
@@ -49,7 +50,6 @@ struct sd {
49 __s8 ag_cnt; 50 __s8 ag_cnt;
50#define AG_CNT_START 13 51#define AG_CNT_START 13
51 52
52 __u8 qindex;
53 __u8 bridge; 53 __u8 bridge;
54#define BRIDGE_SN9C102P 0 54#define BRIDGE_SN9C102P 0
55#define BRIDGE_SN9C105 1 55#define BRIDGE_SN9C105 1
@@ -1025,7 +1025,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
1025 sd->sensor = id->driver_info >> 8; 1025 sd->sensor = id->driver_info >> 8;
1026 sd->i2c_base = id->driver_info; 1026 sd->i2c_base = id->driver_info;
1027 1027
1028 sd->qindex = 4; /* set the quantization table */
1029 sd->brightness = BRIGHTNESS_DEF; 1028 sd->brightness = BRIGHTNESS_DEF;
1030 sd->contrast = CONTRAST_DEF; 1029 sd->contrast = CONTRAST_DEF;
1031 sd->colors = COLOR_DEF; 1030 sd->colors = COLOR_DEF;
@@ -1549,7 +1548,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1549 if (gspca_dev->last_packet_type == LAST_PACKET) { 1548 if (gspca_dev->last_packet_type == LAST_PACKET) {
1550 1549
1551 /* put the JPEG 422 header */ 1550 /* put the JPEG 422 header */
1552 jpeg_put_header(gspca_dev, frame, sd->qindex, 0x21); 1551 jpeg_put_header(gspca_dev, frame, 0x21);
1553 } 1552 }
1554 gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); 1553 gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
1555} 1554}
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c
index 5450c3c4274b..e00f3b53bdff 100644
--- a/drivers/media/video/gspca/spca500.c
+++ b/drivers/media/video/gspca/spca500.c
@@ -22,6 +22,7 @@
22#define MODULE_NAME "spca500" 22#define MODULE_NAME "spca500"
23 23
24#include "gspca.h" 24#include "gspca.h"
25#define QUANT_VAL 5 /* quantization table */
25#include "jpeg.h" 26#include "jpeg.h"
26 27
27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
@@ -39,7 +40,6 @@ struct sd {
39 unsigned char contrast; 40 unsigned char contrast;
40 unsigned char colors; 41 unsigned char colors;
41 42
42 char qindex;
43 char subtype; 43 char subtype;
44#define AgfaCl20 0 44#define AgfaCl20 0
45#define AiptekPocketDV 1 45#define AiptekPocketDV 1
@@ -637,7 +637,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
637 cam->cam_mode = sif_mode; 637 cam->cam_mode = sif_mode;
638 cam->nmodes = ARRAY_SIZE(sif_mode); 638 cam->nmodes = ARRAY_SIZE(sif_mode);
639 } 639 }
640 sd->qindex = 5;
641 sd->brightness = BRIGHTNESS_DEF; 640 sd->brightness = BRIGHTNESS_DEF;
642 sd->contrast = CONTRAST_DEF; 641 sd->contrast = CONTRAST_DEF;
643 sd->colors = COLOR_DEF; 642 sd->colors = COLOR_DEF;
@@ -900,7 +899,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
900 ffd9, 2); 899 ffd9, 2);
901 900
902 /* put the JPEG header in the new frame */ 901 /* put the JPEG header in the new frame */
903 jpeg_put_header(gspca_dev, frame, sd->qindex, 0x22); 902 jpeg_put_header(gspca_dev, frame, 0x22);
904 903
905 data += SPCA500_OFFSET_DATA; 904 data += SPCA500_OFFSET_DATA;
906 len -= SPCA500_OFFSET_DATA; 905 len -= SPCA500_OFFSET_DATA;
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c
index ba31eb318652..d1d54edd80bd 100644
--- a/drivers/media/video/gspca/stk014.c
+++ b/drivers/media/video/gspca/stk014.c
@@ -21,6 +21,8 @@
21#define MODULE_NAME "stk014" 21#define MODULE_NAME "stk014"
22 22
23#include "gspca.h" 23#include "gspca.h"
24#define QUANT_VAL 7 /* quantization table */
25 /* <= 4 KO - 7: good (enough!) */
24#include "jpeg.h" 26#include "jpeg.h"
25 27
26MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); 28MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
@@ -37,9 +39,6 @@ struct sd {
37 unsigned char lightfreq; 39 unsigned char lightfreq;
38}; 40};
39 41
40/* global parameters */
41static int sd_quant = 7; /* <= 4 KO - 7: good (enough!) */
42
43/* V4L2 controls supported by the driver */ 42/* V4L2 controls supported by the driver */
44static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); 43static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
45static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); 44static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
@@ -418,7 +417,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
418 ffd9, 2); 417 ffd9, 2);
419 418
420 /* put the JPEG 411 header */ 419 /* put the JPEG 411 header */
421 jpeg_put_header(gspca_dev, frame, sd_quant, 0x22); 420 jpeg_put_header(gspca_dev, frame, 0x22);
422 421
423 /* beginning of the frame */ 422 /* beginning of the frame */
424#define STKHDRSZ 12 423#define STKHDRSZ 12
@@ -575,6 +574,3 @@ static void __exit sd_mod_exit(void)
575 574
576module_init(sd_mod_init); 575module_init(sd_mod_init);
577module_exit(sd_mod_exit); 576module_exit(sd_mod_exit);
578
579module_param_named(quant, sd_quant, int, 0644);
580MODULE_PARM_DESC(quant, "Quantization index (0..8)");
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c
index d9c9c440f020..2c0b6c3c8760 100644
--- a/drivers/media/video/gspca/sunplus.c
+++ b/drivers/media/video/gspca/sunplus.c
@@ -22,6 +22,7 @@
22#define MODULE_NAME "sunplus" 22#define MODULE_NAME "sunplus"
23 23
24#include "gspca.h" 24#include "gspca.h"
25#define QUANT_VAL 5 /* quantization table */
25#include "jpeg.h" 26#include "jpeg.h"
26 27
27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
@@ -40,7 +41,6 @@ struct sd {
40 unsigned char colors; 41 unsigned char colors;
41 unsigned char autogain; 42 unsigned char autogain;
42 43
43 char qindex;
44 char bridge; 44 char bridge;
45#define BRIDGE_SPCA504 0 45#define BRIDGE_SPCA504 0
46#define BRIDGE_SPCA504B 1 46#define BRIDGE_SPCA504B 1
@@ -849,7 +849,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
849 cam->nmodes = sizeof vga_mode2 / sizeof vga_mode2[0]; 849 cam->nmodes = sizeof vga_mode2 / sizeof vga_mode2[0];
850 break; 850 break;
851 } 851 }
852 sd->qindex = 5; /* set the quantization table */
853 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; 852 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
854 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; 853 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
855 sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; 854 sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
@@ -1154,9 +1153,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1154 ffd9, 2); 1153 ffd9, 2);
1155 1154
1156 /* put the JPEG header in the new frame */ 1155 /* put the JPEG header in the new frame */
1157 jpeg_put_header(gspca_dev, frame, 1156 jpeg_put_header(gspca_dev, frame, 0x22);
1158 ((struct sd *) gspca_dev)->qindex,
1159 0x22);
1160 } 1157 }
1161 1158
1162 /* add 0x00 after 0xff */ 1159 /* add 0x00 after 0xff */
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
32static int force_sensor = -1; 32static 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)