diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2009-03-02 04:40:52 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:22 -0400 |
commit | 77ac0baf24d1a43498f7bdf6efa2ee6c4ed0ebaa (patch) | |
tree | d5a6108117df3bbf9f93ce5e69bd29ee386c9945 /drivers/media/video/gspca/sonixj.c | |
parent | 71cb2764fcc51bd9e1b95be5b0f2da6f026634c7 (diff) |
V4L/DVB (11040): gspca - most jpeg subdrivers: Have the JPEG quality settable.
The JPEG quality of the images (quantization tables) is now settable by the
VIDIOC_S_JPEGCOMP ioctl.
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/sonixj.c')
-rw-r--r-- | drivers/media/video/gspca/sonixj.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 363c0fa39d9e..7d0d949b72ba 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -47,6 +47,9 @@ struct sd { | |||
47 | u8 vflip; /* ov7630/ov7648 only */ | 47 | u8 vflip; /* ov7630/ov7648 only */ |
48 | u8 infrared; /* mt9v111 only */ | 48 | u8 infrared; /* mt9v111 only */ |
49 | u8 quality; /* image quality */ | 49 | u8 quality; /* image quality */ |
50 | #define QUALITY_MIN 60 | ||
51 | #define QUALITY_MAX 95 | ||
52 | #define QUALITY_DEF 80 | ||
50 | u8 jpegqual; /* webcam quality */ | 53 | u8 jpegqual; /* webcam quality */ |
51 | 54 | ||
52 | u8 reg18; | 55 | u8 reg18; |
@@ -1295,7 +1298,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
1295 | else | 1298 | else |
1296 | sd->vflip = 1; | 1299 | sd->vflip = 1; |
1297 | sd->infrared = INFRARED_DEF; | 1300 | sd->infrared = INFRARED_DEF; |
1298 | sd->quality = 80; | 1301 | sd->quality = QUALITY_DEF; |
1299 | sd->jpegqual = 80; | 1302 | sd->jpegqual = 80; |
1300 | 1303 | ||
1301 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; | 1304 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; |
@@ -2130,6 +2133,34 @@ static int sd_getinfrared(struct gspca_dev *gspca_dev, __s32 *val) | |||
2130 | return 0; | 2133 | return 0; |
2131 | } | 2134 | } |
2132 | 2135 | ||
2136 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | ||
2137 | struct v4l2_jpegcompression *jcomp) | ||
2138 | { | ||
2139 | struct sd *sd = (struct sd *) gspca_dev; | ||
2140 | |||
2141 | if (jcomp->quality < QUALITY_MIN) | ||
2142 | sd->quality = QUALITY_MIN; | ||
2143 | else if (jcomp->quality > QUALITY_MAX) | ||
2144 | sd->quality = QUALITY_MAX; | ||
2145 | else | ||
2146 | sd->quality = jcomp->quality; | ||
2147 | if (gspca_dev->streaming) | ||
2148 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
2149 | return 0; | ||
2150 | } | ||
2151 | |||
2152 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, | ||
2153 | struct v4l2_jpegcompression *jcomp) | ||
2154 | { | ||
2155 | struct sd *sd = (struct sd *) gspca_dev; | ||
2156 | |||
2157 | memset(jcomp, 0, sizeof *jcomp); | ||
2158 | jcomp->quality = sd->quality; | ||
2159 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT | ||
2160 | | V4L2_JPEG_MARKER_DQT; | ||
2161 | return 0; | ||
2162 | } | ||
2163 | |||
2133 | /* sub-driver description */ | 2164 | /* sub-driver description */ |
2134 | static const struct sd_desc sd_desc = { | 2165 | static const struct sd_desc sd_desc = { |
2135 | .name = MODULE_NAME, | 2166 | .name = MODULE_NAME, |
@@ -2142,6 +2173,8 @@ static const struct sd_desc sd_desc = { | |||
2142 | .stop0 = sd_stop0, | 2173 | .stop0 = sd_stop0, |
2143 | .pkt_scan = sd_pkt_scan, | 2174 | .pkt_scan = sd_pkt_scan, |
2144 | .dq_callback = do_autogain, | 2175 | .dq_callback = do_autogain, |
2176 | .get_jcomp = sd_get_jcomp, | ||
2177 | .set_jcomp = sd_set_jcomp, | ||
2145 | }; | 2178 | }; |
2146 | 2179 | ||
2147 | /* -- module initialisation -- */ | 2180 | /* -- module initialisation -- */ |