提交 36e819db 编写于 作者: J Jean-Francois Moine 提交者: Mauro Carvalho Chehab

V4L/DVB (10345): gspca - jpeg subdrivers: One quantization table per subdriver.

Signed-off-by: NJean-Francois Moine <moinejf@free.fr>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 96ff6514
......@@ -23,6 +23,7 @@
#include "gspca.h"
#define CONEX_CAM 1 /* special JPEG header */
#define QUANT_VAL 0 /* quantization table */
#include "jpeg.h"
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
......@@ -36,8 +37,6 @@ struct sd {
unsigned char brightness;
unsigned char contrast;
unsigned char colors;
unsigned char qindex;
};
/* V4L2 controls supported by the driver */
......@@ -818,7 +817,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->cam_mode = vga_mode;
cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
sd->qindex = 0; /* set the quantization */
sd->brightness = BRIGHTNESS_DEF;
sd->contrast = CONTRAST_DEF;
sd->colors = COLOR_DEF;
......@@ -882,9 +880,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
data, 0);
/* put the JPEG header in the new frame */
jpeg_put_header(gspca_dev, frame,
((struct sd *) gspca_dev)->qindex,
0x22);
jpeg_put_header(gspca_dev, frame, 0x22);
data += 2;
len -= 2;
}
......
......@@ -24,171 +24,207 @@
*
*/
/* start of jpeg frame + quantization table */
static const unsigned char quant[][0x88] = {
/* index 0 - Q40*/
{
/*
* generation options
* CONEX_CAM Conexant if present
* QUANT_VAL quantization table (0..8)
*/
/*
* JPEG header:
* - start of jpeg frame
* - quantization table
* - huffman table
* - start of SOF0
*/
static const u8 jpeg_head[] = {
0xff, 0xd8, /* jpeg */
0xff, 0xdb, 0x00, 0x84, /* DQT */
#if QUANT_VAL == 0
/* index 0 - Q40*/
0, /* quantization table part 1 */
20, 14, 15, 18, 15, 13, 20, 18, 16, 18, 23, 21, 20, 24, 30, 50,
33, 30, 28, 28, 30, 61, 44, 46, 36, 50, 73, 64, 76, 75, 71, 64,
70, 69, 80, 90, 115, 98, 80, 85, 109, 86, 69, 70, 100, 136, 101,
109,
119, 123, 129, 130, 129, 78, 96, 141, 151, 140, 125, 150, 115,
126, 129, 124,
0x14, 0x0e, 0x0f, 0x12, 0x0f, 0x0d, 0x14, 0x12,
0x10, 0x12, 0x17, 0x15, 0x14, 0x18, 0x1e, 0x32,
0x21, 0x1e, 0x1c, 0x1c, 0x1e, 0x3d, 0x2c, 0x2e,
0x24, 0x32, 0x49, 0x40, 0x4c, 0x4b, 0x47, 0x40,
0x46, 0x45, 0x50, 0x5a, 0x73, 0x62, 0x50, 0x55,
0x6d, 0x56, 0x45, 0x46, 0x64, 0x88, 0x65, 0x6d,
0x77, 0x7b, 0x81, 0x82, 0x81, 0x4e, 0x60, 0x8d,
0x97, 0x8c, 0x7d, 0x96, 0x73, 0x7e, 0x81, 0x7c,
1, /* quantization table part 2 */
21, 23, 23, 30, 26, 30, 59, 33, 33, 59, 124, 83, 70, 83, 124, 124,
124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
124, 124, 124,
124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
124, 124, 124,
124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
124, 124, 124},
0x15, 0x17, 0x17, 0x1e, 0x1a, 0x1e, 0x3b, 0x21,
0x21, 0x3b, 0x7c, 0x53, 0x46, 0x53, 0x7c, 0x0c,
0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
#elif QUANT_VAL == 1
/* index 1 - Q50 */
{
0xff, 0xd8,
0xff, 0xdb, 0x00, 0x84, /* DQT */
0,
16, 11, 12, 14, 12, 10, 16, 14, 13, 14, 18, 17, 16, 19, 24, 40,
26, 24, 22, 22, 24, 49, 35, 37, 29, 40, 58, 51, 61, 60, 57, 51,
56, 55, 64, 72, 92, 78, 64, 68, 87, 69, 55, 56, 80, 109, 81, 87,
95, 98, 103, 104, 103, 62, 77, 113, 121, 112, 100, 120, 92, 101,
103, 99,
0x10, 0x0b, 0x0c, 0x0e, 0x0c, 0x0a, 0x10, 0x0e,
0x0d, 0x0e, 0x12, 0x11, 0x10, 0x13, 0x18, 0x28,
0x1a, 0x18, 0x16, 0x16, 0x18, 0x31, 0x23, 0x25,
0x1d, 0x28, 0x3a, 0x33, 0x3d, 0x3c, 0x39, 0x33,
0x38, 0x37, 0x40, 0x48, 0x5c, 0x4e, 0x40, 0x44,
0x57, 0x45, 0x37, 0x38, 0x50, 0x6d, 0x51, 0x57,
0x5f, 0x62, 0x67, 0x68, 0x67, 0x3e, 0x4d, 0x71,
0x79, 0x70, 0x64, 0x78, 0x5c, 0x65, 0x67, 0x63,
1,
17, 18, 18, 24, 21, 24, 47, 26, 26, 47, 99, 66, 56, 66, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99},
0x11, 0x12, 0x12, 0x18, 0x15, 0x18, 0x2f, 0x1a,
0x1a, 0x2f, 0x63, 0x42, 0x38, 0x42, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
#elif QUANT_VAL == 2
/* index 2 Q60 */
{
0xff, 0xd8,
0xff, 0xdb, 0x00, 0x84, /* DQT */
0,
13, 9, 10, 11, 10, 8, 13, 11, 10, 11, 14, 14, 13, 15, 19, 32,
21, 19, 18, 18, 19, 39, 28, 30, 23, 32, 46, 41, 49, 48, 46, 41,
45, 44, 51, 58, 74, 62, 51, 54, 70, 55, 44, 45, 64, 87, 65, 70,
76, 78, 82, 83, 82, 50, 62, 90, 97, 90, 80, 96, 74, 81, 82, 79,
0x0d, 0x09, 0x0a, 0x0b, 0x0a, 0x08, 0x0d, 0x0b,
0x0a, 0x0b, 0x0e, 0x0e, 0x0d, 0x0f, 0x13, 0x20,
0x15, 0x13, 0x12, 0x12, 0x13, 0x27, 0x1c, 0x1e,
0x17, 0x20, 0x2e, 0x29, 0x31, 0x30, 0x2e, 0x29,
0x2d, 0x2c, 0x33, 0x3a, 0x4a, 0x3e, 0x33, 0x36,
0x46, 0x37, 0x2c, 0x2d, 0x40, 0x57, 0x41, 0x46,
0x4c, 0x4e, 0x52, 0x53, 0x52, 0x32, 0x3e, 0x5a,
0x61, 0x5a, 0x50, 0x60, 0x4a, 0x51, 0x52, 0x4f,
1,
14, 14, 14, 19, 17, 19, 38, 21, 21, 38, 79, 53, 45, 53, 79, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79},
0x0e, 0x0e, 0x0e, 0x13, 0x11, 0x13, 0x26, 0x15,
0x15, 0x26, 0x4f, 0x35, 0x2d, 0x35, 0x4f, 0x4f,
0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
#elif QUANT_VAL == 3
/* index 3 - Q70 */
{
0xff, 0xd8,
0xff, 0xdb, 0x00, 0x84, /* DQT */
0,
10, 7, 7, 8, 7, 6, 10, 8, 8, 8, 11, 10, 10, 11, 14, 24,
16, 14, 13, 13, 14, 29, 21, 22, 17, 24, 35, 31, 37, 36, 34, 31,
34, 33, 38, 43, 55, 47, 38, 41, 52, 41, 33, 34, 48, 65, 49, 52,
57, 59, 62, 62, 62, 37, 46, 68, 73, 67, 60, 72, 55, 61, 62, 59,
0x0a, 0x07, 0x07, 0x08, 0x07, 0x06, 0x0a, 0x08,
0x08, 0x08, 0x0b, 0x0a, 0x0a, 0x0b, 0x0e, 0x18,
0x10, 0x0e, 0x0d, 0x0d, 0x0e, 0x1d, 0x15, 0x16,
0x11, 0x18, 0x23, 0x1f, 0x25, 0x24, 0x22, 0x1f,
0x22, 0x21, 0x26, 0x2b, 0x37, 0x2f, 0x26, 0x29,
0x34, 0x29, 0x21, 0x22, 0x30, 0x41, 0x31, 0x34,
0x39, 0x3b, 0x3e, 0x3e, 0x3e, 0x25, 0x2e, 0x44,
0x49, 0x43, 0x3c, 0x48, 0x37, 0x3d, 0x3e, 0x3b,
1,
10, 11, 11, 14, 13, 14, 28, 16, 16, 28, 59, 40, 34, 40, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59},
0x0a, 0x0b, 0x0b, 0x0e, 0x0d, 0x0e, 0x1c, 0x10,
0x10, 0x1c, 0x3b, 0x28, 0x22, 0x28, 0x3b, 0x3b,
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
#elif QUANT_VAL == 4
/* index 4 - Q80 */
{
0xff, 0xd8,
0xff, 0xdb, 0x00, 0x84, /* DQT */
0,
6, 4, 5, 6, 5, 4, 6, 6, 5, 6, 7, 7, 6, 8, 10, 16,
10, 10, 9, 9, 10, 20, 14, 15, 12, 16, 23, 20, 24, 24, 23, 20,
22, 22, 26, 29, 37, 31, 26, 27, 35, 28, 22, 22, 32, 44, 32, 35,
38, 39, 41, 42, 41, 25, 31, 45, 48, 45, 40, 48, 37, 40, 41, 40,
0x06, 0x04, 0x05, 0x06, 0x05, 0x04, 0x06, 0x06,
0x05, 0x06, 0x07, 0x07, 0x06, 0x08, 0x0a, 0x10,
0x0a, 0x0a, 0x09, 0x09, 0x0a, 0x14, 0x0e, 0x0f,
0x0c, 0x10, 0x17, 0x14, 0x18, 0x18, 0x17, 0x14,
0x16, 0x16, 0x1a, 0x1d, 0x25, 0x1f, 0x1a, 0x1b,
0x23, 0x1c, 0x16, 0x16, 0x20, 0x2c, 0x20, 0x23,
0x26, 0x27, 0x29, 0x2a, 0x29, 0x19, 0x1f, 0x2d,
0x30, 0x2d, 0x28, 0x30, 0x25, 0x28, 0x29, 0x28,
1,
7, 7, 7, 10, 8, 10, 19, 10, 10, 19, 40, 26, 22, 26, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40},
0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x13, 0x0a,
0x0a, 0x13, 0x28, 0x1a, 0x16, 0x1a, 0x28, 0x28,
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
#elif QUANT_VAL == 5
/* index 5 - Q85 */
{
0xff, 0xd8,
0xff, 0xdb, 0x00, 0x84, /* DQT */
0,
5, 3, 4, 4, 4, 3, 5, 4, 4, 4, 5, 5, 5, 6, 7, 12,
8, 7, 7, 7, 7, 15, 11, 11, 9, 12, 17, 15, 18, 18, 17, 15,
17, 17, 19, 22, 28, 23, 19, 20, 26, 21, 17, 17, 24, 33, 24, 26,
29, 29, 31, 31, 31, 19, 23, 34, 36, 34, 30, 36, 28, 30, 31, 30,
0x05, 0x03, 0x04, 0x04, 0x04, 0x03, 0x05, 0x04,
0x04, 0x04, 0x05, 0x05, 0x05, 0x06, 0x07, 0x0c,
0x08, 0x07, 0x07, 0x07, 0x07, 0x0f, 0x0b, 0x0b,
0x09, 0x0c, 0x11, 0x0f, 0x12, 0x12, 0x11, 0x0f,
0x11, 0x11, 0x13, 0x16, 0x1c, 0x17, 0x13, 0x14,
0x1a, 0x15, 0x11, 0x11, 0x18, 0x21, 0x18, 0x1a,
0x1d, 0x1d, 0x1f, 0x1f, 0x1f, 0x13, 0x17, 0x22,
0x24, 0x22, 0x1e, 0x24, 0x1c, 0x1e, 0x1f, 0x1e,
1,
5, 5, 5, 7, 6, 7, 14, 8, 8, 14, 30, 20, 17, 20, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30},
0x05, 0x05, 0x05, 0x07, 0x06, 0x07, 0x0e, 0x08,
0x08, 0x0e, 0x1e, 0x14, 0x11, 0x14, 0x1e, 0x1e,
0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
#elif QUANT_VAL == 6
/* index 6 - 86 */
{
0xff, 0xd8,
0xff, 0xdb, 0x00, 0x84, /* DQT */
0,
0x04, 0x03, 0x03, 0x04, 0x03, 0x03, 0x04, 0x04,
0x04, 0x04, 0x05, 0x05, 0x04, 0x05, 0x07, 0x0B,
0x07, 0x07, 0x06, 0x06, 0x07, 0x0E, 0x0A, 0x0A,
0x08, 0x0B, 0x10, 0x0E, 0x11, 0x11, 0x10, 0x0E,
0x10, 0x0F, 0x12, 0x14, 0x1A, 0x16, 0x12, 0x13,
0x18, 0x13, 0x0F, 0x10, 0x16, 0x1F, 0x17, 0x18,
0x1B, 0x1B, 0x1D, 0x1D, 0x1D, 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, 0x1c,
#elif QUANT_VAL == 7
/* index 7 - 88 */
{
0xff, 0xd8,
0xff, 0xdb, 0x00, 0x84, /* DQT */
0,
0x04, 0x03, 0x03, 0x03, 0x03, 0x02, 0x04, 0x03,
0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x06, 0x0A,
0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x06, 0x0a,
0x06, 0x06, 0x05, 0x05, 0x06, 0x0C, 0x08, 0x09,
0x07, 0x0A, 0x0E, 0x0C, 0x0F, 0x0E, 0x0E, 0x0C,
0x0D, 0x0D, 0x0F, 0x11, 0x16, 0x13, 0x0F, 0x10,
0x15, 0x11, 0x0D, 0x0D, 0x13, 0x1A, 0x13, 0x15,
0x17, 0x18, 0x19, 0x19, 0x19, 0x0F, 0x12, 0x1B,
0x1D, 0x1B, 0x18, 0x1D, 0x16, 0x18, 0x19, 0x18,
0x07, 0x0a, 0x0e, 0x0c, 0x0f, 0x0e, 0x0e, 0x0c,
0x0d, 0x0d, 0x0f, 0x11, 0x16, 0x13, 0x0f, 0x10,
0x15, 0x11, 0x0d, 0x0d, 0x13, 0x1a, 0x13, 0x15,
0x17, 0x18, 0x19, 0x19, 0x19, 0x0f, 0x12, 0x1b,
0x1d, 0x1b, 0x18, 0x1d, 0x16, 0x18, 0x19, 0x18,
1,
0x04, 0x04, 0x04, 0x06, 0x05, 0x06, 0x0B, 0x06,
0x06, 0x0B, 0x18, 0x10, 0x0D, 0x10, 0x18, 0x18,
0x06, 0x0B, 0x18, 0x10, 0x0d, 0x10, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x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08, 0x0c, 0x0c,
0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
#else
#error "Invalid quantization table"
#endif
/* huffman table + start of SOF0 */
static unsigned char huffman[] = {
/* huffman table */
0xff, 0xc4, 0x01, 0xa2,
0x00, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
......@@ -260,7 +296,7 @@ static unsigned char huffman[] = {
*/
/* end of header */
static unsigned char eoh[] = {
static u8 eoh[] = {
0x00, /* quant Y */
0x02, 0x11, 0x01, /* samples CbCr - quant CbCr */
0x03, 0x11, 0x01,
......@@ -273,17 +309,14 @@ static unsigned char eoh[] = {
/* -- output the JPEG header -- */
static void jpeg_put_header(struct gspca_dev *gspca_dev,
struct gspca_frame *frame,
int qindex,
int samplesY)
{
#ifndef CONEX_CAM
unsigned char tmpbuf[8];
u8 tmpbuf[8];
#endif
gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
(unsigned char *) quant[qindex], sizeof quant[0]);
gspca_frame_add(gspca_dev, INTER_PACKET, frame,
(unsigned char *) huffman, sizeof huffman);
jpeg_head, sizeof jpeg_head);
#ifndef CONEX_CAM
tmpbuf[0] = gspca_dev->height >> 8;
tmpbuf[1] = gspca_dev->height & 0xff;
......
......@@ -22,6 +22,7 @@
#define MODULE_NAME "mars"
#include "gspca.h"
#define QUANT_VAL 1 /* quantization table */
#include "jpeg.h"
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
......@@ -31,8 +32,6 @@ MODULE_LICENSE("GPL");
/* specific webcam descriptor */
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
char qindex;
};
/* V4L2 controls supported by the driver */
......@@ -117,13 +116,11 @@ static void bulk_w(struct gspca_dev *gspca_dev,
static int sd_config(struct gspca_dev *gspca_dev,
const struct usb_device_id *id)
{
struct sd *sd = (struct sd *) gspca_dev;
struct cam *cam;
cam = &gspca_dev->cam;
cam->cam_mode = vga_mode;
cam->nmodes = ARRAY_SIZE(vga_mode);
sd->qindex = 1; /* set the quantization table */
return 0;
}
......@@ -345,7 +342,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
int p;
if (len < 6) {
......@@ -368,8 +364,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
frame, data, 0);
/* put the JPEG header */
jpeg_put_header(gspca_dev, frame,
sd->qindex, 0x21);
jpeg_put_header(gspca_dev, frame, 0x21);
data += 16;
len -= 16;
break;
......
......@@ -22,6 +22,7 @@
#define MODULE_NAME "sonixj"
#include "gspca.h"
#define QUANT_VAL 4 /* quantization table */
#include "jpeg.h"
#define V4L2_CID_INFRARED (V4L2_CID_PRIVATE_BASE + 0)
......@@ -49,7 +50,6 @@ struct sd {
__s8 ag_cnt;
#define AG_CNT_START 13
__u8 qindex;
__u8 bridge;
#define BRIDGE_SN9C102P 0
#define BRIDGE_SN9C105 1
......@@ -1025,7 +1025,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->sensor = id->driver_info >> 8;
sd->i2c_base = id->driver_info;
sd->qindex = 4; /* set the quantization table */
sd->brightness = BRIGHTNESS_DEF;
sd->contrast = CONTRAST_DEF;
sd->colors = COLOR_DEF;
......@@ -1549,7 +1548,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
if (gspca_dev->last_packet_type == LAST_PACKET) {
/* put the JPEG 422 header */
jpeg_put_header(gspca_dev, frame, sd->qindex, 0x21);
jpeg_put_header(gspca_dev, frame, 0x21);
}
gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
}
......
......@@ -22,6 +22,7 @@
#define MODULE_NAME "spca500"
#include "gspca.h"
#define QUANT_VAL 5 /* quantization table */
#include "jpeg.h"
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
......@@ -39,7 +40,6 @@ struct sd {
unsigned char contrast;
unsigned char colors;
char qindex;
char subtype;
#define AgfaCl20 0
#define AiptekPocketDV 1
......@@ -637,7 +637,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->cam_mode = sif_mode;
cam->nmodes = ARRAY_SIZE(sif_mode);
}
sd->qindex = 5;
sd->brightness = BRIGHTNESS_DEF;
sd->contrast = CONTRAST_DEF;
sd->colors = COLOR_DEF;
......@@ -900,7 +899,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
ffd9, 2);
/* put the JPEG header in the new frame */
jpeg_put_header(gspca_dev, frame, sd->qindex, 0x22);
jpeg_put_header(gspca_dev, frame, 0x22);
data += SPCA500_OFFSET_DATA;
len -= SPCA500_OFFSET_DATA;
......
......@@ -21,6 +21,8 @@
#define MODULE_NAME "stk014"
#include "gspca.h"
#define QUANT_VAL 7 /* quantization table */
/* <= 4 KO - 7: good (enough!) */
#include "jpeg.h"
MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
......@@ -37,9 +39,6 @@ struct sd {
unsigned char lightfreq;
};
/* global parameters */
static int sd_quant = 7; /* <= 4 KO - 7: good (enough!) */
/* V4L2 controls supported by the driver */
static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
......@@ -418,7 +417,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
ffd9, 2);
/* put the JPEG 411 header */
jpeg_put_header(gspca_dev, frame, sd_quant, 0x22);
jpeg_put_header(gspca_dev, frame, 0x22);
/* beginning of the frame */
#define STKHDRSZ 12
......@@ -575,6 +574,3 @@ static void __exit sd_mod_exit(void)
module_init(sd_mod_init);
module_exit(sd_mod_exit);
module_param_named(quant, sd_quant, int, 0644);
MODULE_PARM_DESC(quant, "Quantization index (0..8)");
......@@ -22,6 +22,7 @@
#define MODULE_NAME "sunplus"
#include "gspca.h"
#define QUANT_VAL 5 /* quantization table */
#include "jpeg.h"
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
......@@ -40,7 +41,6 @@ struct sd {
unsigned char colors;
unsigned char autogain;
char qindex;
char bridge;
#define BRIDGE_SPCA504 0
#define BRIDGE_SPCA504B 1
......@@ -849,7 +849,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->nmodes = sizeof vga_mode2 / sizeof vga_mode2[0];
break;
}
sd->qindex = 5; /* set the quantization table */
sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
......@@ -1154,9 +1153,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
ffd9, 2);
/* put the JPEG header in the new frame */
jpeg_put_header(gspca_dev, frame,
((struct sd *) gspca_dev)->qindex,
0x22);
jpeg_put_header(gspca_dev, frame, 0x22);
}
/* add 0x00 after 0xff */
......
......@@ -31,6 +31,7 @@ MODULE_LICENSE("GPL");
static int force_sensor = -1;
#define QUANT_VAL 1 /* quantization table */
#include "jpeg.h"
#include "zc3xx-reg.h"
......@@ -45,7 +46,6 @@ struct sd {
__u8 lightfreq;
__u8 sharpness;
char qindex;
signed char sensor; /* Type of image sensor chip */
/* !! values used in different tables */
#define SENSOR_CS2102 0
......@@ -6536,7 +6536,6 @@ static void setquality(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
__u8 quality;
__u8 frxt;
switch (sd->sensor) {
......@@ -6547,26 +6546,18 @@ static void setquality(struct gspca_dev *gspca_dev)
return;
}
/*fixme: is it really 0008 0007 0018 for all other sensors? */
quality = sd->qindex;
reg_w(dev, quality, 0x0008);
reg_w(dev, QUANT_VAL, 0x0008);
frxt = 0x30;
reg_w(dev, frxt, 0x0007);
switch (quality) {
case 0:
case 1:
case 2:
frxt = 0xff;
break;
case 3:
frxt = 0xf0;
break;
case 4:
frxt = 0xe0;
break;
case 5:
frxt = 0x20;
break;
}
#if QUANT_VAL == 0 || QUANT_VAL == 1 || QUANT_VAL == 2
frxt = 0xff;
#elif QUANT_VAL == 3
frxt = 0xf0;
#elif QUANT_VAL == 4
frxt = 0xe0;
#else
frxt = 0x20;
#endif
reg_w(dev, frxt, 0x0018);
}
......@@ -7156,7 +7147,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->cam_mode = sif_mode;
cam->nmodes = ARRAY_SIZE(sif_mode);
}
sd->qindex = 1;
sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
sd->gamma = gamma[(int) sd->sensor];
......@@ -7358,9 +7348,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
data, 0);
/* put the JPEG header in the new frame */
jpeg_put_header(gspca_dev, frame,
((struct sd *) gspca_dev)->qindex,
0x21);
jpeg_put_header(gspca_dev, frame, 0x21);
/* remove the webcam's header:
* ff d8 ff fe 00 0e 00 00 ss ss 00 01 ww ww hh hh pp pp
* - 'ss ss' is the frame sequence number (BE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册