aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2012-04-16 09:45:44 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-14 13:28:19 -0400
commit0bf6b7dc5fd1e60e93657d4fe4b3d788216b9d5e (patch)
tree7fc860e2ee33601d4e2c5a478e0327b8e49538a6
parentcf072139c7952e267a2eff334f224a62c949ee96 (diff)
[media] V4L: Add camera scene mode control
Add control for the scene mode feature available in image sensor with more advanced ISP firmware. The V4L2_CID_SCENE_MODE menu control allows to select a set of parameters or a specific image processing and capture control algorithm optimized for common image capture conditions. Signed-off-by: HeungJun Kim <riverful.kim@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--Documentation/DocBook/media/v4l/controls.xml117
-rw-r--r--drivers/media/video/v4l2-ctrls.c21
-rw-r--r--include/linux/videodev2.h18
3 files changed, 156 insertions, 0 deletions
diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
index e8c63e04741f..ad0d53d3ffdd 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3184,6 +3184,123 @@ sensitivity adjustments.</entry>
3184 </row> 3184 </row>
3185 <row><entry></entry></row> 3185 <row><entry></entry></row>
3186 3186
3187 <row id="v4l2-scene-mode">
3188 <entry spanname="id"><constant>V4L2_CID_SCENE_MODE</constant>&nbsp;</entry>
3189 <entry>enum&nbsp;v4l2_scene_mode</entry>
3190 </row><row><entry spanname="descr">This control allows to select
3191scene programs as the camera automatic modes optimized for common shooting
3192scenes. Within these modes the camera determines best exposure, aperture,
3193focusing, light metering, white balance and equivalent sensitivity. The
3194controls of those parameters are influenced by the scene mode control.
3195An exact behavior in each mode is subject to the camera specification.
3196
3197<para>When the scene mode feature is not used, this control should be set to
3198<constant>V4L2_SCENE_MODE_NONE</constant> to make sure the other possibly
3199related controls are accessible. The following scene programs are defined:
3200</para>
3201</entry>
3202 </row>
3203 <row>
3204 <entrytbl spanname="descr" cols="2">
3205 <tbody valign="top">
3206 <row>
3207 <entry><constant>V4L2_SCENE_MODE_NONE</constant>&nbsp;</entry>
3208 <entry>The scene mode feature is disabled.</entry>
3209 </row>
3210 <row>
3211 <entry><constant>V4L2_SCENE_MODE_BACKLIGHT</constant>&nbsp;</entry>
3212 <entry>Backlight. Compensates for dark shadows when light is
3213 coming from behind a subject, also by automatically turning
3214 on the flash.</entry>
3215 </row>
3216 <row>
3217 <entry><constant>V4L2_SCENE_MODE_BEACH_SNOW</constant>&nbsp;</entry>
3218 <entry>Beach and snow. This mode compensates for all-white or
3219bright scenes, which tend to look gray and low contrast, when camera's automatic
3220exposure is based on an average scene brightness. To compensate, this mode
3221automatically slightly overexposes the frames. The white balance may also be
3222adjusted to compensate for the fact that reflected snow looks bluish rather
3223than white.</entry>
3224 </row>
3225 <row>
3226 <entry><constant>V4L2_SCENE_MODE_CANDLELIGHT</constant>&nbsp;</entry>
3227 <entry>Candle light. The camera generally raises the ISO
3228sensitivity and lowers the shutter speed. This mode compensates for relatively
3229close subject in the scene. The flash is disabled in order to preserve the
3230ambiance of the light.</entry>
3231 </row>
3232 <row>
3233 <entry><constant>V4L2_SCENE_MODE_DAWN_DUSK</constant>&nbsp;</entry>
3234 <entry>Dawn and dusk. Preserves the colors seen in low
3235natural light before dusk and after down. The camera may turn off the flash,
3236and automatically focus at infinity. It will usually boost saturation and
3237lower the shutter speed.</entry>
3238 </row>
3239 <row>
3240 <entry><constant>V4L2_SCENE_MODE_FALL_COLORS</constant>&nbsp;</entry>
3241 <entry>Fall colors. Increases saturation and adjusts white
3242balance for color enhancement. Pictures of autumn leaves get saturated reds
3243and yellows.</entry>
3244 </row>
3245 <row>
3246 <entry><constant>V4L2_SCENE_MODE_FIREWORKS</constant>&nbsp;</entry>
3247 <entry>Fireworks. Long exposure times are used to capture
3248the expanding burst of light from a firework. The camera may invoke image
3249stabilization.</entry>
3250 </row>
3251 <row>
3252 <entry><constant>V4L2_SCENE_MODE_LANDSCAPE</constant>&nbsp;</entry>
3253 <entry>Landscape. The camera may choose a small aperture to
3254provide deep depth of field and long exposure duration to help capture detail
3255in dim light conditions. The focus is fixed at infinity. Suitable for distant
3256and wide scenery.</entry>
3257 </row>
3258 <row>
3259 <entry><constant>V4L2_SCENE_MODE_NIGHT</constant>&nbsp;</entry>
3260 <entry>Night, also known as Night Landscape. Designed for low
3261light conditions, it preserves detail in the dark areas without blowing out bright
3262objects. The camera generally sets itself to a medium-to-high ISO sensitivity,
3263with a relatively long exposure time, and turns flash off. As such, there will be
3264increased image noise and the possibility of blurred image.</entry>
3265 </row>
3266 <row>
3267 <entry><constant>V4L2_SCENE_MODE_PARTY_INDOOR</constant>&nbsp;</entry>
3268 <entry>Party and indoor. Designed to capture indoor scenes
3269that are lit by indoor background lighting as well as the flash. The camera
3270usually increases ISO sensitivity, and adjusts exposure for the low light
3271conditions.</entry>
3272 </row>
3273 <row>
3274 <entry><constant>V4L2_SCENE_MODE_PORTRAIT</constant>&nbsp;</entry>
3275 <entry>Portrait. The camera adjusts the aperture so that the
3276depth of field is reduced, which helps to isolate the subject against a smooth
3277background. Most cameras recognize the presence of faces in the scene and focus
3278on them. The color hue is adjusted to enhance skin tones. The intensity of the
3279flash is often reduced.</entry>
3280 </row>
3281 <row>
3282 <entry><constant>V4L2_SCENE_MODE_SPORTS</constant>&nbsp;</entry>
3283 <entry>Sports. Significantly increases ISO and uses a fast
3284shutter speed to freeze motion of rapidly-moving subjects. Increased image
3285noise may be seen in this mode.</entry>
3286 </row>
3287 <row>
3288 <entry><constant>V4L2_SCENE_MODE_SUNSET</constant>&nbsp;</entry>
3289 <entry>Sunset. Preserves deep hues seen in sunsets and
3290sunrises. It bumps up the saturation.</entry>
3291 </row>
3292 <row>
3293 <entry><constant>V4L2_SCENE_MODE_TEXT</constant>&nbsp;</entry>
3294 <entry>Text. It applies extra contrast and sharpness, it is
3295typically a black-and-white mode optimized for readability. Automatic focus
3296may be switched to close-up mode and this setting may also involve some
3297lens-distortion correction.</entry>
3298 </row>
3299 </tbody>
3300 </entrytbl>
3301 </row>
3302 <row><entry></entry></row>
3303
3187 </tbody> 3304 </tbody>
3188 </tgroup> 3305 </tgroup>
3189 </table> 3306 </table>
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 55dd813b7341..d4dc8ba7b755 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -273,6 +273,23 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
273 "Auto", 273 "Auto",
274 NULL 274 NULL
275 }; 275 };
276 static const char * const scene_mode[] = {
277 "None",
278 "Backlight",
279 "Beach/Snow",
280 "Candle Light",
281 "Dusk/Dawn",
282 "Fall Colors",
283 "Fireworks",
284 "Landscape",
285 "Night",
286 "Party/Indoor",
287 "Portrait",
288 "Sports",
289 "Sunset",
290 "Text",
291 NULL
292 };
276 static const char * const tune_preemphasis[] = { 293 static const char * const tune_preemphasis[] = {
277 "No Preemphasis", 294 "No Preemphasis",
278 "50 Microseconds", 295 "50 Microseconds",
@@ -448,6 +465,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
448 return auto_n_preset_white_balance; 465 return auto_n_preset_white_balance;
449 case V4L2_CID_ISO_SENSITIVITY_AUTO: 466 case V4L2_CID_ISO_SENSITIVITY_AUTO:
450 return camera_iso_sensitivity_auto; 467 return camera_iso_sensitivity_auto;
468 case V4L2_CID_SCENE_MODE:
469 return scene_mode;
451 case V4L2_CID_TUNE_PREEMPHASIS: 470 case V4L2_CID_TUNE_PREEMPHASIS:
452 return tune_preemphasis; 471 return tune_preemphasis;
453 case V4L2_CID_FLASH_LED_MODE: 472 case V4L2_CID_FLASH_LED_MODE:
@@ -641,6 +660,7 @@ const char *v4l2_ctrl_get_name(u32 id)
641 case V4L2_CID_ISO_SENSITIVITY: return "ISO Sensitivity"; 660 case V4L2_CID_ISO_SENSITIVITY: return "ISO Sensitivity";
642 case V4L2_CID_ISO_SENSITIVITY_AUTO: return "ISO Sensitivity, Auto"; 661 case V4L2_CID_ISO_SENSITIVITY_AUTO: return "ISO Sensitivity, Auto";
643 case V4L2_CID_EXPOSURE_METERING: return "Exposure, Metering Mode"; 662 case V4L2_CID_EXPOSURE_METERING: return "Exposure, Metering Mode";
663 case V4L2_CID_SCENE_MODE: return "Scene Mode";
644 664
645 /* FM Radio Modulator control */ 665 /* FM Radio Modulator control */
646 /* Keep the order of the 'case's the same as in videodev2.h! */ 666 /* Keep the order of the 'case's the same as in videodev2.h! */
@@ -793,6 +813,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
793 case V4L2_CID_JPEG_CHROMA_SUBSAMPLING: 813 case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
794 case V4L2_CID_ISO_SENSITIVITY_AUTO: 814 case V4L2_CID_ISO_SENSITIVITY_AUTO:
795 case V4L2_CID_EXPOSURE_METERING: 815 case V4L2_CID_EXPOSURE_METERING:
816 case V4L2_CID_SCENE_MODE:
796 *type = V4L2_CTRL_TYPE_MENU; 817 *type = V4L2_CTRL_TYPE_MENU;
797 break; 818 break;
798 case V4L2_CID_LINK_FREQ: 819 case V4L2_CID_LINK_FREQ:
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index a3e47ad60a6d..092bf5aaf348 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1740,6 +1740,24 @@ enum v4l2_exposure_metering {
1740 V4L2_EXPOSURE_METERING_SPOT = 2, 1740 V4L2_EXPOSURE_METERING_SPOT = 2,
1741}; 1741};
1742 1742
1743#define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26)
1744enum v4l2_scene_mode {
1745 V4L2_SCENE_MODE_NONE = 0,
1746 V4L2_SCENE_MODE_BACKLIGHT = 1,
1747 V4L2_SCENE_MODE_BEACH_SNOW = 2,
1748 V4L2_SCENE_MODE_CANDLE_LIGHT = 3,
1749 V4L2_SCENE_MODE_DAWN_DUSK = 4,
1750 V4L2_SCENE_MODE_FALL_COLORS = 5,
1751 V4L2_SCENE_MODE_FIREWORKS = 6,
1752 V4L2_SCENE_MODE_LANDSCAPE = 7,
1753 V4L2_SCENE_MODE_NIGHT = 8,
1754 V4L2_SCENE_MODE_PARTY_INDOOR = 9,
1755 V4L2_SCENE_MODE_PORTRAIT = 10,
1756 V4L2_SCENE_MODE_SPORTS = 11,
1757 V4L2_SCENE_MODE_SUNSET = 12,
1758 V4L2_SCENE_MODE_TEXT = 13,
1759};
1760
1743/* FM Modulator class control IDs */ 1761/* FM Modulator class control IDs */
1744#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) 1762#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
1745#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) 1763#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)