diff options
author | Jean-François Moine <moinejf@free.fr> | 2011-02-10 07:30:03 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-21 20:32:06 -0300 |
commit | dccdcccdd36bf7570967ff53411c7401b8e645d6 (patch) | |
tree | 2f16087541f52e2b694b86036e788844a2ada40a /drivers/media/video/gspca/sonixj.c | |
parent | a4a3076ffcdbcf40358edc2068aa4d9103fe0a28 (diff) |
[media] gspca - sonixj: Have the same JPEG quality for encoding and decoding
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/sonixj.c')
-rw-r--r-- | drivers/media/video/gspca/sonixj.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 21f0330885d..d465022b802 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c @@ -63,7 +63,6 @@ struct sd { #define QUALITY_MIN 60 #define QUALITY_MAX 95 #define QUALITY_DEF 80 - u8 jpegqual; /* webcam quality */ u8 reg01; u8 reg17; @@ -1786,7 +1785,6 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->ag_cnt = -1; sd->quality = QUALITY_DEF; - sd->jpegqual = 80; return 0; } @@ -2273,18 +2271,12 @@ static void setfreq(struct gspca_dev *gspca_dev) static void setjpegqual(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - int i, sc; - if (sd->jpegqual < 50) - sc = 5000 / sd->jpegqual; - else - sc = 200 - sd->jpegqual * 2; + jpeg_set_qual(sd->jpeg_hdr, sd->quality); #if USB_BUF_SZ < 64 #error "No room enough in usb_buf for quantization table" #endif - for (i = 0; i < 64; i++) - gspca_dev->usb_buf[i] = - (jpeg_head[JPEG_QT0_OFFSET + i] * sc + 50) / 100; + memcpy(gspca_dev->usb_buf, &sd->jpeg_hdr[JPEG_QT0_OFFSET], 64); usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0x08, @@ -2292,9 +2284,7 @@ static void setjpegqual(struct gspca_dev *gspca_dev) 0x0100, 0, gspca_dev->usb_buf, 64, 500); - for (i = 0; i < 64; i++) - gspca_dev->usb_buf[i] = - (jpeg_head[JPEG_QT1_OFFSET + i] * sc + 50) / 100; + memcpy(gspca_dev->usb_buf, &sd->jpeg_hdr[JPEG_QT1_OFFSET], 64); usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0x08, @@ -2340,7 +2330,6 @@ static int sd_start(struct gspca_dev *gspca_dev) /* create the JPEG header */ jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, 0x21); /* JPEG 422 */ - jpeg_set_qual(sd->jpeg_hdr, sd->quality); /* initialize the bridge */ sn9c1xx = sn_tb[sd->sensor]; @@ -2901,7 +2890,7 @@ static int sd_set_jcomp(struct gspca_dev *gspca_dev, else sd->quality = jcomp->quality; if (gspca_dev->streaming) - jpeg_set_qual(sd->jpeg_hdr, sd->quality); + setjpegqual(gspca_dev); return 0; } |