v4l: New camera controls
Subsystems (2)
cover v4l: New camera controls
Hi All,
I put some effort in preparing a documentation for a couple of new controls in the camera control class. It's a preeliminary work, it's mainly just documentation. There is yet no patches for any driver using these controls. I just wanted to get some possible feedback on them, if this sort of stuff is welcome and what might need to be done differently.
Thanks,
Sylwester
Heungjun Kim (1):
uvc: Adapt the driver to new type of V4L2_CID_FOCUS_AUTO control
Sylwester Nawrocki (4):
v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
v4l: Add V4L2_CID_METERING_MODE camera control
v4l: Add V4L2_CID_EXPOSURE_BIAS camera control
v4l: Add V4L2_CID_ISO and V4L2_CID_ISO_AUTO controls
Documentation/DocBook/media/v4l/biblio.xml | 11 +++ Documentation/DocBook/media/v4l/controls.xml | 122 ++++++++++++++++++++++++- drivers/media/video/uvc/uvc_ctrl.c | 9 ++- drivers/media/video/v4l2-ctrls.c | 19 ++++- include/linux/videodev2.h | 19 ++++ 5 files changed, 173 insertions(+), 7 deletions(-)
--
1.7.4.1
PATCH 1/5 v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Change the V4L2_CID_FOCUS_AUTO control type from boolean to a menu type. In case of boolean control we had values 0 and 1 corresponding to manual and automatic focus respectively.
The V4L2_CID_FOCUS_AUTO menu control has currently following items:
0 - V4L2_FOCUS_MANUAL,
1 - V4L2_FOCUS_AUTO,
2 - V4L2_FOCUS_AUTO_MACRO,
3 - V4L2_FOCUS_AUTO_CONTINUOUS.
To trigger single auto focus action in V4L2_FOCUS_AUTO mode the V4L2_DO_AUTO_FOCUS control can be used, which is also added in this patch.
--- Documentation/DocBook/media/v4l/controls.xml | 52 +++++++++++++++++++++++-- drivers/media/video/v4l2-ctrls.c | 13 ++++++- include/linux/videodev2.h | 8 ++++ 3 files changed, 67 insertions(+), 6 deletions(-)
Documentation/DocBook/media/v4l/controls.xml +47 -5
@@ -2782,12 +2782,54 @@ negative values towards infinity. This is a write-only control.</entry> </row> <row><entry></entry></row> - <row> + <row id="v4l2-focus-auto-type"> <entry spanname="id"><constant>V4L2_CID_FOCUS_AUTO</constant> </entry> - <entry>boolean</entry> - </row><row><entry spanname="descr">Enables automatic focus -adjustments. The effect of manual focus adjustments while this feature -is enabled is undefined, drivers should ignore such requests.</entry> + <entry>enum v4l2_focus_auto_type</entry> + </row><row><entry spanname="descr">Determines the camera +focus mode. The effect of manual focus adjustments while <constant> +V4L2_CID_FOCUS_AUTO </constant> is not set to <constant> +V4L2_FOCUS_MANUAL</constant> is undefined, drivers should ignore such +requests.</entry> + </row> + <row> + <entrytbl spanname="descr" cols="2"> + <tbody valign="top"> + <row> + <entry><constant>V4L2_FOCUS_MANUAL</constant> </entry> + <entry>Manual focus.</entry> + </row> + <row> + <entry><constant>V4L2_FOCUS_AUTO</constant> </entry> + <entry>Single shot auto focus. When switched to +this mode the camera focuses on a subject just once. <constant> +V4L2_CID_DO_AUTO_FOCUS</constant> control can be used to manually +invoke auto focusing.</entry> + </row> + <row> + <entry><constant>V4L2_FOCUS_AUTO_MACRO</constant> </entry> + <entry>Macro (close-up) auto focus. Usually camera +auto focus algorithms do not attempt to focus on a subject that is +closer than a given distance. This mode can be used to tell the camera +to use minimum distance for focus that it is capable of.</entry> + </row> + <row> + <entry><constant>V4L2_FOCUS_AUTO_CONTINUOUS</constant> </entry> + <entry>Continuous auto focus. When switched to this +mode the camera continually adjusts focus.</entry> + </row> + </tbody> + </entrytbl> + </row> + <row><entry></entry></row> + + <row> + <entry spanname="id"><constant>V4L2_CID_DO_AUTO_FOCUS</constant> </entry> + <entry>button</entry> + </row><row><entry spanname="descr">When this control is set +the camera will perform one shot auto focus. The effect of using this +control when <constant>V4L2_CID_FOCUS_AUTO</constant> is in mode +different than <constant>V4L2_FOCUS_AUTO</constant> is undefined, +drivers should ignore such requests. </entry> </row> <row><entry></entry></row>
drivers/media/video/v4l2-ctrls.c +12 -1
@@ -221,6 +221,13 @@ const char * const *v4l2_ctrl_get_menu(u32 id)"Aperture Priority Mode" ,NULL }; +static const char *const camera_focus_auto[] = { +"Manual Focus" , +"One-shot Auto Focus" , +"Macro Auto Focus" , +"Continuous Auto Focus" , +NULL + };static const char *const colorfx[] = {"None" , "Black & White",
@@ -388,6 +395,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)return camera_power_line_frequency;case V4L2_CID_EXPOSURE_AUTO :return camera_exposure_auto; +case V4L2_CID_FOCUS_AUTO : +return camera_focus_auto;case V4L2_CID_COLORFX :return colorfx;case V4L2_CID_TUNE_PREEMPHASIS :
@@ -567,6 +576,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_PRIVACY :return "Privacy" ;case V4L2_CID_IRIS_ABSOLUTE :return "Iris, Absolute" ;case V4L2_CID_IRIS_RELATIVE :return "Iris, Relative" ; +case V4L2_CID_DO_AUTO_FOCUS :return "Do Auto Focus" ;/* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */
@@ -633,7 +643,6 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE :case V4L2_CID_MPEG_VIDEO_PULLDOWN :case V4L2_CID_EXPOSURE_AUTO_PRIORITY : -case V4L2_CID_FOCUS_AUTO :case V4L2_CID_PRIVACY :case V4L2_CID_AUDIO_LIMITER_ENABLED :case V4L2_CID_AUDIO_COMPRESSION_ENABLED :
@@ -658,6 +667,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,case V4L2_CID_TILT_RESET :case V4L2_CID_FLASH_STROBE :case V4L2_CID_FLASH_STROBE_STOP : +case V4L2_CID_DO_AUTO_FOCUS : *type =V4L2_CTRL_TYPE_BUTTON ; *flags |=V4L2_CTRL_FLAG_WRITE_ONLY ; *min = *max = *step = *def =0 ;
@@ -679,6 +689,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,case V4L2_CID_MPEG_STREAM_TYPE :case V4L2_CID_MPEG_STREAM_VBI_FMT :case V4L2_CID_EXPOSURE_AUTO : +case V4L2_CID_FOCUS_AUTO :case V4L2_CID_COLORFX :case V4L2_CID_TUNE_PREEMPHASIS :case V4L2_CID_FLASH_LED_MODE :
include/linux/videodev2.h +8 -0
@@ -1608,6 +1608,12 @@ enum v4l2_exposure_auto_type {#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10)#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) +enum v4l2_focus_auto_type { +V4L2_FOCUS_MANUAL =0 , +V4L2_FOCUS_AUTO =1 , +V4L2_FOCUS_AUTO_MACRO =2 , +V4L2_FOCUS_AUTO_CONTINUOUS =3 , +};#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
@@ -1618,6 +1624,8 @@ enum v4l2_exposure_auto_type {#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) +#define V4L2_CID_DO_AUTO_FOCUS (V4L2_CID_CAMERA_CLASS_BASE+19) +/* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
Signature · 1 line
1.7.4.1
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Hi Sylwester,
Quoted 9 lines · On Sunday 04 December 2011 16:16:12 Sylwester Nawrocki wrote:
Change the
V4L2_CID_FOCUS_AUTOcontrol type from boolean to a menu type. In case of boolean control we had values 0 and 1 corresponding to manual and automatic focus respectively.The
V4L2_CID_FOCUS_AUTOmenu control has currently following items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.
I think the mapping is wrong, please see my answer to 2/5.
Quoted 42 lines
To trigger single auto focus action in
V4L2_FOCUS_AUTOmode theV4L2_DO_AUTO_FOCUScontrol can be used, which is also added in this patch.Signed-off-by Heungjun Kim <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Signed-off-by Sylwester Nawrocki <[email protected]>--- Documentation/DocBook/media/v4l/controls.xml | 52 +++++++++++++++++++++++-- drivers/media/video/v4l2-ctrls.c | 13 ++++++- include/linux/videodev2.h | 8 ++++ 3 files changed, 67 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/controls.xmlindex 3bc5ee8..5ccb0b0 100644Documentation/DocBook/media/v4l/controls.xml +0
-0@@ -2782,12 +2782,54 @@ negative values towards infinity. This is awrite-only control.</entry> </row>
Documentation/DocBook/media/v4l/controls.xml +1
-1<row><entry></entry></row> - <row> + <row id="v4l2-focus-auto-type"> <entryspanname="id"><constant>V4L2_CID_FOCUS_AUTO</constant> </entry> - <entry>boolean</entry>
Documentation/DocBook/media/v4l/controls.xml +11
-3- </row><row><entry spanname="descr">Enables automatic focus -adjustments. The effect of manual focus adjustments while this feature -is enabled is undefined, drivers should ignore such requests.</entry> + <entry>enum v4l2_focus_auto_type</entry> + </row><row><entry spanname="descr">Determines the camera +focus mode. The effect of manual focus adjustments while <constant> +V4L2_CID_FOCUS_AUTO </constant> is not set to <constant> +V4L2_FOCUS_MANUAL</constant> is undefined, drivers should ignore such +requests.</entry> + </row> + <row> + <entrytbl spanname="descr" cols="2"> + <tbody valign="top"> + <row>
Documentation/DocBook/media/v4l/controls.xml negative values towards infinity. This is a write-only control.</entry> · line 2807
Quoted 10 lines
Documentation/DocBook/media/v4l/controls.xml +10
-0+ <entry><constant>V4L2_FOCUS_MANUAL</constant> </entry> + <entry>Manual focus.</entry> + </row> + <row> + <entry><constant>V4L2_FOCUS_AUTO</constant> </entry> + <entry>Single shot auto focus. When switched to +this mode the camera focuses on a subject just once. <constant> +V4L2_CID_DO_AUTO_FOCUS</constant> control can be used to manually +invoke auto focusing.</entry> + </row>
Do we need this single-shot auto-focus menu entry ? We could just use V4L2_CID_DO_AUTO_FOCUS in V4L2_FOCUS_MANUAL mode to do this. This is what happens with one-shot white balance.
Quoted 21 lines
Documentation/DocBook/media/v4l/controls.xml +19
-0+ <row> + <entry><constant>V4L2_FOCUS_AUTO_MACRO</constant> </entry> + <entry>Macro (close-up) auto focus. Usually camera +auto focus algorithms do not attempt to focus on a subject that is +closer than a given distance. This mode can be used to tell the camera +to use minimum distance for focus that it is capable of.</entry> + </row> + <row> + <entry><constant>V4L2_FOCUS_AUTO_CONTINUOUS</constant> </entry> + <entry>Continuous auto focus. When switched to this +mode the camera continually adjusts focus.</entry> + </row> + </tbody> + </entrytbl> + </row> + <row><entry></entry></row> + + <row> + <entryspanname="id"><constant>V4L2_CID_DO_AUTO_FOCUS</constant> </entry> +
<entry>button</entry>
Documentation/DocBook/media/v4l/controls.xml negative values towards infinity. This is a write-only control.</entry> · line 2828
Quoted 1 line
Documentation/DocBook/media/v4l/controls.xml +1
-0+ </row><row><entry spanname="descr">When this control is set
Wouldn't "written" be better than "set" here ? I understand "When this control is set" as "while the control has a non-zero value" (but it might just be me).
Quoted 92 lines
Documentation/DocBook/media/v4l/controls.xml +4
-0+the camera will perform one shot auto focus. The effect of using this +control when <constant>V4L2_CID_FOCUS_AUTO</constant> is in mode +different than <constant>V4L2_FOCUS_AUTO</constant> is undefined, +drivers should ignore such requests. </entry> </row> <row><entry></entry></row>(quoted diff) +0
-0
b/drivers/media/video/v4l2-ctrls.cindex 0f415da..7d8862f 100644drivers/media/video/v4l2-ctrls.c +10
-0@@ -221,6 +221,13 @@ const char * const *v4l2_ctrl_get_menu(u32 id)"Aperture Priority Mode" ,NULL }; +static const char *const camera_focus_auto[] = { +"Manual Focus" , +"One-shot Auto Focus" , +"Macro Auto Focus" , +"Continuous Auto Focus" , +NULL + };static const char *const colorfx[] = {"None" , "Black & White",@@ -388,6 +395,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)return camera_power_line_frequency;case V4L2_CID_EXPOSURE_AUTO :return camera_exposure_auto; +case V4L2_CID_FOCUS_AUTO : +return camera_focus_auto;case V4L2_CID_COLORFX :return colorfx;case V4L2_CID_TUNE_PREEMPHASIS :@@ -567,6 +576,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_PRIVACY :return "Privacy" ;case V4L2_CID_IRIS_ABSOLUTE :return "Iris, Absolute" ;case V4L2_CID_IRIS_RELATIVE :return "Iris, Relative" ; +case V4L2_CID_DO_AUTO_FOCUS :return "Do Auto Focus" ;/* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */ @@ -633,7 +643,6 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum
v4l2_ctrl_type*type, caseV4L2_CID_MPEG_VIDEO_GOP_CLOSURE:drivers/media/video/v4l2-ctrls.c +0
-1case V4L2_CID_MPEG_VIDEO_PULLDOWN :case V4L2_CID_EXPOSURE_AUTO_PRIORITY : -case V4L2_CID_FOCUS_AUTO :case V4L2_CID_PRIVACY :case V4L2_CID_AUDIO_LIMITER_ENABLED :case V4L2_CID_AUDIO_COMPRESSION_ENABLED :@@ -658,6 +667,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum
v4l2_ctrl_type*type, caseV4L2_CID_TILT_RESET:drivers/media/video/v4l2-ctrls.c +1
-0case V4L2_CID_FLASH_STROBE :case V4L2_CID_FLASH_STROBE_STOP : +case V4L2_CID_DO_AUTO_FOCUS : *type =V4L2_CTRL_TYPE_BUTTON ; *flags |=V4L2_CTRL_FLAG_WRITE_ONLY ; *min = *max = *step = *def =0 ;@@ -679,6 +689,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum
v4l2_ctrl_type*type, caseV4L2_CID_MPEG_STREAM_TYPE:drivers/media/video/v4l2-ctrls.c +1
-0case V4L2_CID_MPEG_STREAM_VBI_FMT :case V4L2_CID_EXPOSURE_AUTO : +case V4L2_CID_FOCUS_AUTO :case V4L2_CID_COLORFX :case V4L2_CID_TUNE_PREEMPHASIS :case V4L2_CID_FLASH_LED_MODE :include/linux/videodev2.h +8
-0@@ -1608,6 +1608,12 @@ enum v4l2_exposure_auto_type {#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10)#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) +enum v4l2_focus_auto_type { +V4L2_FOCUS_MANUAL =0 , +V4L2_FOCUS_AUTO =1 , +V4L2_FOCUS_AUTO_MACRO =2 , +V4L2_FOCUS_AUTO_CONTINUOUS =3 , +};#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)@@ -1618,6 +1624,8 @@ enum v4l2_exposure_auto_type {#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) +#define V4L2_CID_DO_AUTO_FOCUS (V4L2_CID_CAMERA_CLASS_BASE+19) +/* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
Signature · 3 lines
Regards, Laurent Pinchart
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Hi Laurent,
Quoted 7 lines · Laurent Pinchart
Hi Sylwester,
Quoted 4 lines · On Sunday 04 December 2011 16:16:12 Sylwester Nawrocki wrote:
Change the
V4L2_CID_FOCUS_AUTOcontrol type from boolean to a menu type. In case of boolean control we had values 0 and 1 corresponding to manual and automatic focus respectively.
Quoted 7 lines
Quoted 5 lines
The
V4L2_CID_FOCUS_AUTOmenu control has currently following items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.I think the mapping is wrong, please see my answer to 2/5.
Yes, agreed. Please see my answer to you answer to 2/5 :)
Quoted 49 lines
Quoted 49 lines
To trigger single auto focus action in
V4L2_FOCUS_AUTOmode theV4L2_DO_AUTO_FOCUScontrol can be used, which is also added in this patch.Signed-off-by Heungjun Kim <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Signed-off-by Sylwester Nawrocki <[email protected]>--- Documentation/DocBook/media/v4l/controls.xml | 52 +++++++++++++++++++++++-- drivers/media/video/v4l2-ctrls.c | 13 ++++++- include/linux/videodev2.h | 8 ++++ 3 files changed, 67 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/controls.xmlindex 3bc5ee8..5ccb0b0 100644Documentation/DocBook/media/v4l/controls.xml +0
-0@@ -2782,12 +2782,54 @@ negative values towards infinity. This is awrite-only control.</entry> </row>
Documentation/DocBook/media/v4l/controls.xml +1
-1<row><entry></entry></row> - <row> + <row id="v4l2-focus-auto-type"> <entryspanname="id"><constant>V4L2_CID_FOCUS_AUTO</constant> </entry> - <entry>boolean</entry>
Documentation/DocBook/media/v4l/controls.xml +17
-3- </row><row><entry spanname="descr">Enables automatic focus -adjustments. The effect of manual focus adjustments while this feature -is enabled is undefined, drivers should ignore such requests.</entry> + <entry>enum v4l2_focus_auto_type</entry> + </row><row><entry spanname="descr">Determines the camera +focus mode. The effect of manual focus adjustments while <constant> +V4L2_CID_FOCUS_AUTO </constant> is not set to <constant> +V4L2_FOCUS_MANUAL</constant> is undefined, drivers should ignore such +requests.</entry> + </row> + <row> + <entrytbl spanname="descr" cols="2"> + <tbody valign="top"> + <row> + <entry><constant>V4L2_FOCUS_MANUAL</constant> </entry> + <entry>Manual focus.</entry> + </row> + <row> + <entry><constant>V4L2_FOCUS_AUTO</constant> </entry> + <entry>Single shot auto focus. When switched to
Quoted 8 lines
Documentation/DocBook/media/v4l/controls.xml negative values towards infinity. This is a write-only control.</entry> · line 2807
Quoted 4 lines
Documentation/DocBook/media/v4l/controls.xml +4
-0+this mode the camera focuses on a subject just once. <constant> +V4L2_CID_DO_AUTO_FOCUS</constant> control can be used to manually +invoke auto focusing.</entry> + </row>Do we need this single-shot auto-focus menu entry ? We could just use
V4L2_CID_DO_AUTO_FOCUSinV4L2_FOCUS_MANUALmode to do this. This is what happens with one-shot white balance.
There might be various flavours of single-shot auto focus, there may be some more focus modes than those in this patch.
If we have removed them from the menu entry then we would likely have to come up with more V4L2_CID_DO_AUTO_FOCUS_* controls.
Quoted 18 lines
Quoted 18 lines
Documentation/DocBook/media/v4l/controls.xml +17
-0+ <row> + <entry><constant>V4L2_FOCUS_AUTO_MACRO</constant> </entry> + <entry>Macro (close-up) auto focus. Usually camera +auto focus algorithms do not attempt to focus on a subject that is +closer than a given distance. This mode can be used to tell the camera +to use minimum distance for focus that it is capable of.</entry> + </row> + <row> + <entry><constant>V4L2_FOCUS_AUTO_CONTINUOUS</constant> </entry> + <entry>Continuous auto focus. When switched to this +mode the camera continually adjusts focus.</entry> + </row> + </tbody> + </entrytbl> + </row> + <row><entry></entry></row> +
Quoted 8 lines
Documentation/DocBook/media/v4l/controls.xml negative values towards infinity. This is a write-only control.</entry> · line 2828
Quoted 5 lines
Documentation/DocBook/media/v4l/controls.xml +2
-0+ <row> + <entryspanname="id"><constant>V4L2_CID_DO_AUTO_FOCUS</constant> </entry> +
<entry>button</entry>Documentation/DocBook/media/v4l/controls.xml +1
-0+ </row><row><entry spanname="descr">When this control is setWouldn't "written" be better than "set" here ? I understand "When this control is set" as "while the control has a non-zero value" (but it might just be me).
Sure, I could change to that. However this is a button control, so "written" doesn't quite match IMHO. And we do set/get controls, rather than read/write.
Originally I had (copied form V4L2_CID_DO_WHITE_BALANCE):
"This is an action control. When it is set (the value is ignored)..."
How about "When this control is applied.." ?
Quoted 6 lines
Documentation/DocBook/media/v4l/controls.xml negative values towards infinity. This is a write-only control.</entry> · line 2833
Quoted 6 lines
Documentation/DocBook/media/v4l/controls.xml +4
-0+the camera will perform one shot auto focus. The effect of using this +control when <constant>V4L2_CID_FOCUS_AUTO</constant> is in mode +different than <constant>V4L2_FOCUS_AUTO</constant> is undefined, +drivers should ignore such requests. </entry> </row>
--
Thanks,
Sylwester
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
In reply to Sylwester NawrockiHi Sylwester,
Quoted 9 lines · Sylwester Nawrocki
Change the
V4L2_CID_FOCUS_AUTOcontrol type from boolean to a menu type. In case of boolean control we had values 0 and 1 corresponding to manual and automatic focus respectively.The
V4L2_CID_FOCUS_AUTOmenu control has currently following items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.
I would put the macro mode to a separate menu since it's configuration for how the regular AF works rather than really different mode.
...
drivers/media/video/v4l2-ctrls.c const char *v4l2_ctrl_get_name(u32 id) · line 579
Quoted 5 lines
drivers/media/video/v4l2-ctrls.c +1
-0@@ -567,6 +576,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_PRIVACY :return "Privacy" ;case V4L2_CID_IRIS_ABSOLUTE :return "Iris, Absolute" ;case V4L2_CID_IRIS_RELATIVE :return "Iris, Relative" ; +case V4L2_CID_DO_AUTO_FOCUS :return "Do Auto Focus" ;
I'd perhaps use "begin" or "start". How does the user learn the autofocus has finished? I think this looks like quite similar problem than telling the flash strobe status to the user. The solution could also be similar to that.
Cheers,
Signature · 2 lines
Sakari Ailus e-mail: [email protected] jabber/XMPP/Gmail: [email protected]
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Hi Sakari,
Quoted 5 lines · Sakari Ailus
Quoted 4 lines · Sylwester Nawrocki
Change the
V4L2_CID_FOCUS_AUTOcontrol type from boolean to a menu type. In case of boolean control we had values 0 and 1 corresponding to manual and automatic focus respectively.
Quoted 8 lines
Quoted 5 lines
The
V4L2_CID_FOCUS_AUTOmenu control has currently following items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.I would put the macro mode to a separate menu since it's configuration for how the regular AF works rather than really different mode.
Yes, makes sense. Most likely there could be also continuous macro auto focus.. I don't have yet an idea what could be a name for that new menu though.
Many Samsung devices have also something like guided auto focus, where the application can specify location in the frame for focusing on. IIRC this could be also single-shot or continuous. So it could make sense to group MACRO and "guided" auto focus in one menu, what do you think ?
Quoted 7 lines
drivers/media/video/v4l2-ctrls.c const char *v4l2_ctrl_get_name(u32 id) · line 579
Quoted 5 lines
drivers/media/video/v4l2-ctrls.c +1
-0@@ -567,6 +576,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_PRIVACY :return "Privacy" ;case V4L2_CID_IRIS_ABSOLUTE :return "Iris, Absolute" ;case V4L2_CID_IRIS_RELATIVE :return "Iris, Relative" ; +case V4L2_CID_DO_AUTO_FOCUS :return "Do Auto Focus" ;I'd perhaps use "begin" or "start". How does the user learn the autofocus
I agree, it's not something than is finished after G_CTRL call returns.
V4L2_CID_START_AUTO_FOCUS sounds better to me.
Quoted 2 lines
has finished? I think this looks like quite similar problem than telling the flash strobe status to the user. The solution could also be similar to that.
I guess you're suggesting an auto focus status control? Together with the control events it would be nice interface for notifying the applications.
Signature · 2 lines
Regards, Sylwester
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Hi Sylwester,
Apologies for my late answer.
Quoted 14 lines · Sylwester Nawrocki
Hi Sakari,
Quoted 11 lines · Sakari Ailus
Quoted 9 lines · Sylwester Nawrocki
Change the
V4L2_CID_FOCUS_AUTOcontrol type from boolean to a menu type. In case of boolean control we had values 0 and 1 corresponding to manual and automatic focus respectively.The
V4L2_CID_FOCUS_AUTOmenu control has currently following items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.
Quoted 5 lines
Quoted 2 lines
I would put the macro mode to a separate menu since it's configuration for how the regular AF works rather than really different mode.
Yes, makes sense. Most likely there could be also continuous macro auto focus.. I don't have yet an idea what could be a name for that new menu though.
V4L2_CID_FOCUS_AUTO_DISTANCE? It could then have choices FULL or MACRO.
Quoted 4 lines
Many Samsung devices have also something like guided auto focus, where the application can specify location in the frame for focusing on. IIRC this could be also single-shot or continuous. So it could make sense to group MACRO and "guided" auto focus in one menu, what do you think ?
I think it could be a separate menu. It's not connected to the distance parameter. We also need to discuss how the af statistics window configuration is done. I'm not certain there could even be a standardised interface which could be used to control it all.
Quoted 10 lines
Quoted 7 lines
drivers/media/video/v4l2-ctrls.c const char *v4l2_ctrl_get_name(u32 id) · line 579
Quoted 5 lines
drivers/media/video/v4l2-ctrls.c +1
-0@@ -567,6 +576,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_PRIVACY :return "Privacy" ;case V4L2_CID_IRIS_ABSOLUTE :return "Iris, Absolute" ;case V4L2_CID_IRIS_RELATIVE :return "Iris, Relative" ; +case V4L2_CID_DO_AUTO_FOCUS :return "Do Auto Focus" ;I'd perhaps use "begin" or "start". How does the user learn the autofocus
I agree, it's not something than is finished after
G_CTRLcall returns.
Quoted 7 lines
V4L2_CID_START_AUTO_FOCUSsounds better to me.Quoted 2 lines
has finished? I think this looks like quite similar problem than telling the flash strobe status to the user. The solution could also be similar to that.
I guess you're suggesting an auto focus status control? Together with the control events it would be nice interface for notifying the applications.
I agree.
Signature · 2 lines
Sakari Ailus e-mail: [email protected] jabber/XMPP/Gmail: [email protected]
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Quoted 3 lines · Sakari Ailus
Hi Sylwester,
Apologies for my late answer.
No problem, thanks for your comments!
Quoted 15 lines · Sylwester Nawrocki
Quoted 14 lines
Hi Sakari,
Quoted 11 lines · Sakari Ailus
Quoted 9 lines · Sylwester Nawrocki
Change the
V4L2_CID_FOCUS_AUTOcontrol type from boolean to a menu type. In case of boolean control we had values 0 and 1 corresponding to manual and automatic focus respectively.The
V4L2_CID_FOCUS_AUTOmenu control has currently following items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I would put the macro mode to a separate menu since it's configuration for how the regular AF works rather than really different mode.
Yes, makes sense. Most likely there could be also continuous macro auto focus.. I don't have yet an idea what could be a name for that new menu though.
V4L2_CID_FOCUS_AUTO_DISTANCE? It could then have choices FULL or MACRO.
How about V4L2_CID_FOCUS_AUTO_SCAN_RANGE ? Which would then have choices:
NORMAL,
MACRO,
INFINITY
?
Quoted 6 lines
Quoted 4 lines
Many Samsung devices have also something like guided auto focus, where the application can specify location in the frame for focusing on. IIRC this could be also single-shot or continuous. So it could make sense to group MACRO and "guided" auto focus in one menu, what do you think ?
I think it could be a separate menu. It's not connected to the distance
OK, let me summarize
* controls for starting/stopping auto focusing (V4L2_CID_FOCUS_AUTO == false)
V4L2_CID_START_AUTO_FOCUS (button) - start auto focusing, V4L2_CID_STOP_AUTO_FOCUS (button) - stop auto focusing (might be also
useful in V4L2_FOCUS_AUTO == true),
* auto focus status
V4L2_CID_AUTO_FOCUS_STATUS (menu, read-only) - whether focusing is in
progress or not,
possible entries:
- V4L2_AUTO_FOCUS_STATUS_IDLE, // auto focusing not enabled or force stopped
- V4L2_AUTO_FOCUS_STATUS_BUSY, // focusing in progress
- V4L2_AUTO_FOCUS_STATUS_SUCCESS, // single-shot auto focusing succeed
// or continuous AF in progress
- V4L2_AUTO_FOCUS_STATUS_FAIL, // auto focusing failed
* V4L2_CID_FOCUS_AUTO would retain its current semantics:
V4L2_CID_FOCUS_AUTO (boolean) - selects auto/manual focus
false - manual
true - auto continuous
* AF algorithm scan range, V4L2_CID_FOCUS_AUTO_SCAN_RANGE with choices:
- V4L2_AUTO_FOCUS_SCAN_RANGE_NORMAL,
- V4L2_AUTO_FOCUS_SCAN_RANGE_MACRO,
- V4L2_AUTO_FOCUS_SCAN_RANGE_INFINITY
New menu control to choose behaviour of auto focus (either single-shot or continuous):
* select auto focus mode
V4L2_CID_AUTO_FOCUS_MODE
V4L2_AUTO_FOCUS_MODE_NORMAL - "normal" auto focus (whole frame?)
V4L2_AUTO_FOCUS_MODE_SPOT - spot location passed with other
controls or selection API
V4L2_AUTO_FOCUS_MODE_RECTANGLE - rectangle passed with other
controls or selection API
Quoted 2 lines
parameter. We also need to discuss how the af statistics window configuration is done. I'm not certain there could even be a standardised
Do we need multiple windows for AF statistics ?
If not, I'm inclined to use four separate controls for window configuration. (X, Y, WIDTH, HEIGHT). This was Hans' preference in previous discussions [1].
Quoted 1 line
interface which could be used to control it all.
[1] http://www.mail-archive.com/[email protected]/msg25647.html
Signature · 2 lines
Regards, Sylwester
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Hi Sylwester,
Quoted 36 lines · On Sunday 01 January 2012 17:49:11 Sylwester Nawrocki wrote:
Quoted 13 lines · Sakari Ailus
Quoted 12 lines · Sylwester Nawrocki
Quoted 11 lines · Sakari Ailus
Quoted 9 lines · Sylwester Nawrocki
Change the
V4L2_CID_FOCUS_AUTOcontrol type from boolean to a menu type. In case of boolean control we had values 0 and 1 corresponding to manual and automatic focus respectively.The
V4L2_CID_FOCUS_AUTOmenu control has currently following items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I would put the macro mode to a separate menu since it's configuration for how the regular AF works rather than really different mode.
Yes, makes sense. Most likely there could be also continuous macro auto focus.. I don't have yet an idea what could be a name for that new menu though.
V4L2_CID_FOCUS_AUTO_DISTANCE? It could then have choices FULL or MACRO.How about
V4L2_CID_FOCUS_AUTO_SCAN_RANGE? Which would then have choices:
NORMAL,
MACRO,
INFINITY
?Quoted 6 lines
Quoted 4 lines
Many Samsung devices have also something like guided auto focus, where the application can specify location in the frame for focusing on. IIRC this could be also single-shot or continuous. So it could make sense to group MACRO and "guided" auto focus in one menu, what do you think ?
I think it could be a separate menu. It's not connected to the distance
Quoted 8 lines
OK, let me summarize
* controls for starting/stopping auto focusing (
V4L2_CID_FOCUS_AUTO== false)
V4L2_CID_START_AUTO_FOCUS(button) - start auto focusing,V4L2_CID_STOP_AUTO_FOCUS(button) - stop auto focusing (might be alsouseful in V4L2_FOCUS_AUTO == true),
Maybe V4L2_CID_AUTO_FOCUS_START and V4L2_CID_AUTO_FOCUS_STOP to be consistent with the other proposed controls ?
Quoted 29 lines
* auto focus status
V4L2_CID_AUTO_FOCUS_STATUS(menu, read-only) - whether focusing is in
progress or not,
possible entries:-
V4L2_AUTO_FOCUS_STATUS_IDLE, // auto focusing not enabled or force
stopped -V4L2_AUTO_FOCUS_STATUS_BUSY, // focusing in progress
-V4L2_AUTO_FOCUS_STATUS_SUCCESS, // single-shot auto focusing succeed// or continuous AF in progress-
V4L2_AUTO_FOCUS_STATUS_FAIL, // auto focusing failed*
V4L2_CID_FOCUS_AUTOwould retain its current semantics:
V4L2_CID_FOCUS_AUTO(boolean) - selects auto/manual focus
false - manual
true - auto continuous* AF algorithm scan range,
V4L2_CID_FOCUS_AUTO_SCAN_RANGEwith choices:-
V4L2_AUTO_FOCUS_SCAN_RANGE_NORMAL,
-V4L2_AUTO_FOCUS_SCAN_RANGE_MACRO,
-V4L2_AUTO_FOCUS_SCAN_RANGE_INFINITYNew menu control to choose behaviour of auto focus (either single-shot or continuous):
Quoted 8 lines
* select auto focus mode
V4L2_CID_AUTO_FOCUS_MODE
V4L2_AUTO_FOCUS_MODE_NORMAL- "normal" auto focus (whole frame?)
V4L2_AUTO_FOCUS_MODE_SPOT- spot location passed with other
controls or selection APIV4L2_AUTO_FOCUS_MODE_RECTANGLE- rectangle passed with other controls or selection API
Soudns good to me.
Quoted 8 lines
Quoted 2 lines
parameter. We also need to discuss how the af statistics window configuration is done. I'm not certain there could even be a standardised
Do we need multiple windows for AF statistics ?
If not, I'm inclined to use four separate controls for window configuration. (X, Y, WIDTH, HEIGHT). This was Hans' preference in previous discussions [1].
For the OMAP3 ISP we need multiple statistics windows. AEWB can use more than 32 windows. Having separate controls for that wouldn't be practical.
Quoted 3 lines
Quoted 1 line
interface which could be used to control it all.
[1] http://www.mail-archive.com/[email protected]/msg25647.html
Signature · 3 lines
Regards, Laurent Pinchart
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Hi Laurent,
Quoted 9 lines · Laurent Pinchart
Quoted 6 lines
* controls for starting/stopping auto focusing (
V4L2_CID_FOCUS_AUTO== false)
V4L2_CID_START_AUTO_FOCUS(button) - start auto focusing,V4L2_CID_STOP_AUTO_FOCUS(button) - stop auto focusing (might be alsouseful in V4L2_FOCUS_AUTO == true),Maybe
V4L2_CID_AUTO_FOCUS_STARTandV4L2_CID_AUTO_FOCUS_STOPto be consistent with the other proposed controls ?
Yes, you're right, I'll change them to make consistent with others. I've noticed that too, but a little bit too late:)
Quoted 26 lines
Quoted 26 lines
* auto focus status
V4L2_CID_AUTO_FOCUS_STATUS(menu, read-only) - whether focusing is in
progress or not,
possible entries:-
V4L2_AUTO_FOCUS_STATUS_IDLE, // auto focusing not enabled or force
stopped
-V4L2_AUTO_FOCUS_STATUS_BUSY, // focusing in progress
-V4L2_AUTO_FOCUS_STATUS_SUCCESS, // single-shot auto focusing succeed// or continuous AF in progress-
V4L2_AUTO_FOCUS_STATUS_FAIL, // auto focusing failed*
V4L2_CID_FOCUS_AUTOwould retain its current semantics:
V4L2_CID_FOCUS_AUTO(boolean) - selects auto/manual focus
false - manual
true - auto continuous* AF algorithm scan range,
V4L2_CID_FOCUS_AUTO_SCAN_RANGEwith choices:-
V4L2_AUTO_FOCUS_SCAN_RANGE_NORMAL,
-V4L2_AUTO_FOCUS_SCAN_RANGE_MACRO,
-V4L2_AUTO_FOCUS_SCAN_RANGE_INFINITY
...
Quoted 15 lines
Quoted 9 lines
* select auto focus mode
V4L2_CID_AUTO_FOCUS_MODE
V4L2_AUTO_FOCUS_MODE_NORMAL- "normal" auto focus (whole frame?)
V4L2_AUTO_FOCUS_MODE_SPOT- spot location passed with other
controls or selection APIV4L2_AUTO_FOCUS_MODE_RECTANGLE- rectangle passed with other controls or selection APISoudns good to me.
Quoted 3 lines
Quoted 2 lines
parameter. We also need to discuss how the af statistics window configuration is done. I'm not certain there could even be a standardised
Quoted 8 lines
Quoted 5 lines
Do we need multiple windows for AF statistics ?
If not, I'm inclined to use four separate controls for window configuration. (X, Y, WIDTH, HEIGHT). This was Hans' preference in previous discussions [1].
For the OMAP3 ISP we need multiple statistics windows. AEWB can use more than 32 windows. Having separate controls for that wouldn't be practical.
OK, so the control API in current form doesn't seem capable of setting up the statistics windows. There is also little space in struct v4l2_ext_control for any major extensions.
We might need to define dedicated set of selection targets in the selection API for handling multiple windows.
Yet, to avoid forcing applications to use the selection API where rectangles aren't needed - only single spot coordinates, how about defining following two controls ?
* AF spot coordinates when focus mode is set to V4L2_AUTO_FOCUS_MODE_SPOT
- V4L2_CID_AUTO_FOCUS_POSITION_X - horizontal position in pixels relative to the left of frame
- V4L2_CID_AUTO_FOCUS_POSITION_Y - vertical position in pixels relative to the top of frame
--
Thanks,
Sylwester
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Hi Sylwester,
Quoted 86 lines · On Monday 02 January 2012 21:55:31 Sylwester Nawrocki wrote:
Quoted 11 lines · Laurent Pinchart
Quoted 8 lines
* controls for starting/stopping auto focusing (
V4L2_CID_FOCUS_AUTO== false)
V4L2_CID_START_AUTO_FOCUS(button) - start auto focusing,V4L2_CID_STOP_AUTO_FOCUS(button) - stop auto focusing (might be alsouseful in V4L2_FOCUS_AUTO == true),Maybe
V4L2_CID_AUTO_FOCUS_STARTandV4L2_CID_AUTO_FOCUS_STOPto be consistent with the other proposed controls ?Yes, you're right, I'll change them to make consistent with others. I've noticed that too, but a little bit too late:)
Quoted 30 lines
Quoted 30 lines
* auto focus status
V4L2_CID_AUTO_FOCUS_STATUS(menu, read-only) - whether focusing is inprogress or not,
possible entries:
-
V4L2_AUTO_FOCUS_STATUS_IDLE, // auto focusing not enabled or
forcestopped
-
V4L2_AUTO_FOCUS_STATUS_BUSY, // focusing in progress
-V4L2_AUTO_FOCUS_STATUS_SUCCESS, // single-shot auto focusing succeed// or continuous AF in progress-
V4L2_AUTO_FOCUS_STATUS_FAIL, // auto focusing failed*
V4L2_CID_FOCUS_AUTOwould retain its current semantics:
V4L2_CID_FOCUS_AUTO(boolean) - selects auto/manual focusfalse - manual
true - auto continuous* AF algorithm scan range,
V4L2_CID_FOCUS_AUTO_SCAN_RANGEwith choices:
-V4L2_AUTO_FOCUS_SCAN_RANGE_NORMAL,
-V4L2_AUTO_FOCUS_SCAN_RANGE_MACRO,
-V4L2_AUTO_FOCUS_SCAN_RANGE_INFINITY...
Quoted 18 lines
Quoted 9 lines
* select auto focus mode
V4L2_CID_AUTO_FOCUS_MODE
V4L2_AUTO_FOCUS_MODE_NORMAL- "normal" auto focus (whole
frame?)V4L2_AUTO_FOCUS_MODE_SPOT- spot location passed
with other controls or selection APIV4L2_AUTO_FOCUS_MODE_RECTANGLE- rectangle passed with other controls or selection APISoudns good to me.
Quoted 6 lines
Quoted 3 lines
parameter. We also need to discuss how the af statistics window configuration is done. I'm not certain there could even be a standardised
Do we need multiple windows for AF statistics ?
Quoted 7 lines
Quoted 3 lines
If not, I'm inclined to use four separate controls for window configuration. (X, Y, WIDTH, HEIGHT). This was Hans' preference in previous discussions [1].
For the OMAP3 ISP we need multiple statistics windows. AEWB can use more than 32 windows. Having separate controls for that wouldn't be practical.
OK, so the control API in current form doesn't seem capable of setting up the statistics windows. There is also little space in struct
v4l2_ext_controlfor any major extensions.We might need to define dedicated set of selection targets in the selection API for handling multiple windows.
Yet, to avoid forcing applications to use the selection API where rectangles aren't needed - only single spot coordinates, how about defining following two controls ?
Quoted 6 lines
* AF spot coordinates when focus mode is set to
V4L2_AUTO_FOCUS_MODE_SPOT-
V4L2_CID_AUTO_FOCUS_POSITION_X- horizontal position in pixels relative to the left of frame
-V4L2_CID_AUTO_FOCUS_POSITION_Y- vertical position in pixels relative to the top of frame
What about a point control type instead ? :-) X and Y coordinates could be stored on 32 bits each.
Signature · 3 lines
Regards, Laurent Pinchart
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Hi Laurent,
Quoted 27 lines · Laurent Pinchart
Quoted 27 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
parameter. We also need to discuss how the af statistics window configuration is done. I'm not certain there could even be a standardised
Do we need multiple windows for AF statistics ?
Quoted 7 lines
Quoted 3 lines
If not, I'm inclined to use four separate controls for window configuration. (X, Y, WIDTH, HEIGHT). This was Hans' preference in previous discussions [1].
For the OMAP3 ISP we need multiple statistics windows. AEWB can use more than 32 windows. Having separate controls for that wouldn't be practical.
OK, so the control API in current form doesn't seem capable of setting up the statistics windows. There is also little space in struct
v4l2_ext_controlfor any major extensions.We might need to define dedicated set of selection targets in the selection API for handling multiple windows.
Yet, to avoid forcing applications to use the selection API where rectangles aren't needed - only single spot coordinates, how about defining following two controls ?
* AF spot coordinates when focus mode is set to
V4L2_AUTO_FOCUS_MODE_SPOT
Quoted 7 lines
Quoted 4 lines
-
V4L2_CID_AUTO_FOCUS_POSITION_X- horizontal position in pixels relative to the left of frame
-V4L2_CID_AUTO_FOCUS_POSITION_Y- vertical position in pixels relative to the top of frameWhat about a point control type instead ? :-) X and Y coordinates could be stored on 32 bits each.
That's more appealing than two separate controls :-) If Hans agrees to add a point control type (fingers crossed :)) I could prepare relevant patch to see how it looks like. I've analysed roughly what would need to be changed, the effort is quite significant but not so invasive for drivers.
I thought about using new V4L2_CTRL_FLAG* for VIDIOC_QUERYCTRL to indicate which field of the point data structure is queried.
The only real problem seem to be events, I can't see simple method for adding two sets of min/max/step/def values to the control event payload. There would probably have to be two separate control change events for each point structure field.
Signature · 2 lines
Regards, Sylwester
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
In reply to Sylwester NawrockiHi Sylwester,
Quoted 78 lines · Sylwester Nawrocki
Hi Laurent,
Quoted 9 lines · Laurent Pinchart
Quoted 6 lines
* controls for starting/stopping auto focusing (
V4L2_CID_FOCUS_AUTO== false)
V4L2_CID_START_AUTO_FOCUS(button) - start auto focusing,V4L2_CID_STOP_AUTO_FOCUS(button) - stop auto focusing (might be alsouseful in V4L2_FOCUS_AUTO == true),Maybe
V4L2_CID_AUTO_FOCUS_STARTandV4L2_CID_AUTO_FOCUS_STOPto be consistent with the other proposed controls ?Yes, you're right, I'll change them to make consistent with others. I've noticed that too, but a little bit too late:)
Quoted 26 lines
Quoted 26 lines
* auto focus status
V4L2_CID_AUTO_FOCUS_STATUS(menu, read-only) - whether focusing is in
progress or not,
possible entries:-
V4L2_AUTO_FOCUS_STATUS_IDLE, // auto focusing not enabled or force
stopped
-V4L2_AUTO_FOCUS_STATUS_BUSY, // focusing in progress
-V4L2_AUTO_FOCUS_STATUS_SUCCESS, // single-shot auto focusing succeed// or continuous AF in progress-
V4L2_AUTO_FOCUS_STATUS_FAIL, // auto focusing failed*
V4L2_CID_FOCUS_AUTOwould retain its current semantics:
V4L2_CID_FOCUS_AUTO(boolean) - selects auto/manual focus
false - manual
true - auto continuous* AF algorithm scan range,
V4L2_CID_FOCUS_AUTO_SCAN_RANGEwith choices:-
V4L2_AUTO_FOCUS_SCAN_RANGE_NORMAL,
-V4L2_AUTO_FOCUS_SCAN_RANGE_MACRO,
-V4L2_AUTO_FOCUS_SCAN_RANGE_INFINITY...
Quoted 15 lines
Quoted 9 lines
* select auto focus mode
V4L2_CID_AUTO_FOCUS_MODE
V4L2_AUTO_FOCUS_MODE_NORMAL- "normal" auto focus (whole frame?)
V4L2_AUTO_FOCUS_MODE_SPOT- spot location passed with other
controls or selection APIV4L2_AUTO_FOCUS_MODE_RECTANGLE- rectangle passed with other controls or selection APISoudns good to me.
Quoted 3 lines
Quoted 2 lines
parameter. We also need to discuss how the af statistics window configuration is done. I'm not certain there could even be a standardised
Quoted 8 lines
Quoted 5 lines
Do we need multiple windows for AF statistics ?
If not, I'm inclined to use four separate controls for window configuration. (X, Y, WIDTH, HEIGHT). This was Hans' preference in previous discussions [1].
For the OMAP3 ISP we need multiple statistics windows. AEWB can use more than 32 windows. Having separate controls for that wouldn't be practical.
OK, so the control API in current form doesn't seem capable of setting up the statistics windows. There is also little space in struct
v4l2_ext_controlfor any major extensions.We might need to define dedicated set of selection targets in the selection API for handling multiple windows.
Yet, to avoid forcing applications to use the selection API where rectangles aren't needed - only single spot coordinates, how about defining following two controls ?
Quoted 6 lines
* AF spot coordinates when focus mode is set to
V4L2_AUTO_FOCUS_MODE_SPOT-
V4L2_CID_AUTO_FOCUS_POSITION_X- horizontal position in pixels relative to the left of frame
-V4L2_CID_AUTO_FOCUS_POSITION_Y- vertical position in pixels relative to the top of frame
What's a spot focus mode?
Any AF statistics from a single pixel have no meaning, so there has to be more. It sounds like a small rectangle to me. :-)
But being able to provide more windows would be rather important. You don't need to look at too special cameras before you can have seven or so focus windows.
The selection API could be used for this, as proposed already. We could have a new V4L2_(SUBDEV_)SELECTION_STAT_AF target to configure windows. We could add an id field to define the window ID to struct v4l2_(subdev_)selection. One control would be required to tell how many statistics windows do you have.
Cheers,
Signature · 2 lines
Sakari Ailus e-mail: [email protected] jabber/XMPP/Gmail: [email protected]
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Hi Sakari,
Quoted 83 lines · Sakari Ailus
Quoted 76 lines · Laurent Pinchart
Quoted 9 lines
Quoted 6 lines
* controls for starting/stopping auto focusing (
V4L2_CID_FOCUS_AUTO== false)
V4L2_CID_START_AUTO_FOCUS(button) - start auto focusing,V4L2_CID_STOP_AUTO_FOCUS(button) - stop auto focusing (might be alsouseful in V4L2_FOCUS_AUTO == true),Maybe
V4L2_CID_AUTO_FOCUS_STARTandV4L2_CID_AUTO_FOCUS_STOPto be consistent with the other proposed controls ?Yes, you're right, I'll change them to make consistent with others. I've noticed that too, but a little bit too late:)
Quoted 26 lines
Quoted 26 lines
* auto focus status
V4L2_CID_AUTO_FOCUS_STATUS(menu, read-only) - whether focusing is in
progress or not,
possible entries:-
V4L2_AUTO_FOCUS_STATUS_IDLE, // auto focusing not enabled or force
stopped
-V4L2_AUTO_FOCUS_STATUS_BUSY, // focusing in progress
-V4L2_AUTO_FOCUS_STATUS_SUCCESS, // single-shot auto focusing succeed// or continuous AF in progress-
V4L2_AUTO_FOCUS_STATUS_FAIL, // auto focusing failed*
V4L2_CID_FOCUS_AUTOwould retain its current semantics:
V4L2_CID_FOCUS_AUTO(boolean) - selects auto/manual focus
false - manual
true - auto continuous* AF algorithm scan range,
V4L2_CID_FOCUS_AUTO_SCAN_RANGEwith choices:-
V4L2_AUTO_FOCUS_SCAN_RANGE_NORMAL,
-V4L2_AUTO_FOCUS_SCAN_RANGE_MACRO,
-V4L2_AUTO_FOCUS_SCAN_RANGE_INFINITY...
Quoted 15 lines
Quoted 9 lines
* select auto focus mode
V4L2_CID_AUTO_FOCUS_MODE
V4L2_AUTO_FOCUS_MODE_NORMAL- "normal" auto focus (whole frame?)
V4L2_AUTO_FOCUS_MODE_SPOT- spot location passed with other
controls or selection APIV4L2_AUTO_FOCUS_MODE_RECTANGLE- rectangle passed with other controls or selection APISoudns good to me.
Quoted 3 lines
Quoted 2 lines
parameter. We also need to discuss how the af statistics window configuration is done. I'm not certain there could even be a standardised
Quoted 8 lines
Quoted 5 lines
Do we need multiple windows for AF statistics ?
If not, I'm inclined to use four separate controls for window configuration. (X, Y, WIDTH, HEIGHT). This was Hans' preference in previous discussions [1].
For the OMAP3 ISP we need multiple statistics windows. AEWB can use more than 32 windows. Having separate controls for that wouldn't be practical.
OK, so the control API in current form doesn't seem capable of setting up the statistics windows. There is also little space in struct
v4l2_ext_controlfor any major extensions.We might need to define dedicated set of selection targets in the selection API for handling multiple windows.
Yet, to avoid forcing applications to use the selection API where rectangles aren't needed - only single spot coordinates, how about defining following two controls ?
Quoted 6 lines
* AF spot coordinates when focus mode is set to
V4L2_AUTO_FOCUS_MODE_SPOT-
V4L2_CID_AUTO_FOCUS_POSITION_X- horizontal position in pixels relative to the left of frame
-V4L2_CID_AUTO_FOCUS_POSITION_Y- vertical position in pixels relative to the top of frame
Quoted 4 lines
What's a spot focus mode?
Any AF statistics from a single pixel have no meaning, so there has to be more. It sounds like a small rectangle to me. :-)
Yes, it must be a small rectangle. But there may be no way to configure or read this rectangle's parameters, hence this menu option. If some hardware doesn't implement such feature it can just skip the spot focus menu item.
And in case camera doesn't provide any interface for AF statistics windows configuration I don't see a good reason to use the selection API.
Quoted 9 lines
But being able to provide more windows would be rather important. You don't need to look at too special cameras before you can have seven or so focus windows.
The selection API could be used for this, as proposed already. We could have a new V4L2_(SUBDEV_)SELECTION_STAT_AF target to configure windows. We could add an id field to define the window ID to struct v4l2_(subdev_)selection. One control would be required to tell how many statistics windows do you have.
Yeah, sounds good to me, better than defining selection target base and the target pool size. :) Ack.
--
Regards,
Sylwester
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
In reply to Sylwester NawrockiHi Sylwester,
Quoted 28 lines · Sylwester Nawrocki
Quoted 3 lines · Sakari Ailus
Hi Sylwester,
Apologies for my late answer.
No problem, thanks for your comments!
Quoted 21 lines · Sylwester Nawrocki
Quoted 19 lines
Hi Sakari,
Quoted 5 lines · Sakari Ailus
Quoted 4 lines · Sylwester Nawrocki
Change the
V4L2_CID_FOCUS_AUTOcontrol type from boolean to a menu type. In case of boolean control we had values 0 and 1 corresponding to manual and automatic focus respectively.Quoted 8 lines
Quoted 5 lines
The
V4L2_CID_FOCUS_AUTOmenu control has currently following items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.I would put the macro mode to a separate menu since it's configuration for how the regular AF works rather than really different mode.
Yes, makes sense. Most likely there could be also continuous macro auto focus.. I don't have yet an idea what could be a name for that new menu though.
Quoted 7 lines
Quoted 1 line
V4L2_CID_FOCUS_AUTO_DISTANCE? It could then have choices FULL or MACRO.How about
V4L2_CID_FOCUS_AUTO_SCAN_RANGE? Which would then have choices:
NORMAL,
MACRO,
INFINITY
?
What does INFINITY signify? That lens is permanently positioned there?
The name of the control sounds good to me, but I might change the order of FOCUS and AUTO in it.
Quoted 69 lines
Quoted 6 lines
Quoted 4 lines
Many Samsung devices have also something like guided auto focus, where the application can specify location in the frame for focusing on. IIRC this could be also single-shot or continuous. So it could make sense to group MACRO and "guided" auto focus in one menu, what do you think ?
I think it could be a separate menu. It's not connected to the distance
OK, let me summarize
* controls for starting/stopping auto focusing (
V4L2_CID_FOCUS_AUTO== false)
V4L2_CID_START_AUTO_FOCUS(button) - start auto focusing,V4L2_CID_STOP_AUTO_FOCUS(button) - stop auto focusing (might be alsouseful in V4L2_FOCUS_AUTO == true),* auto focus status
V4L2_CID_AUTO_FOCUS_STATUS(menu, read-only) - whether focusing is in
progress or not,
possible entries:-
V4L2_AUTO_FOCUS_STATUS_IDLE, // auto focusing not enabled or force stopped
-V4L2_AUTO_FOCUS_STATUS_BUSY, // focusing in progress
-V4L2_AUTO_FOCUS_STATUS_SUCCESS, // single-shot auto focusing succeed// or continuous AF in progress-
V4L2_AUTO_FOCUS_STATUS_FAIL, // auto focusing failed*
V4L2_CID_FOCUS_AUTOwould retain its current semantics:
V4L2_CID_FOCUS_AUTO(boolean) - selects auto/manual focus
false - manual
true - auto continuous* AF algorithm scan range,
V4L2_CID_FOCUS_AUTO_SCAN_RANGEwith choices:-
V4L2_AUTO_FOCUS_SCAN_RANGE_NORMAL,
-V4L2_AUTO_FOCUS_SCAN_RANGE_MACRO,
-V4L2_AUTO_FOCUS_SCAN_RANGE_INFINITYNew menu control to choose behaviour of auto focus (either single-shot or continuous):
* select auto focus mode
V4L2_CID_AUTO_FOCUS_MODE
V4L2_AUTO_FOCUS_MODE_NORMAL- "normal" auto focus (whole frame?)
V4L2_AUTO_FOCUS_MODE_SPOT- spot location passed with other
controls or selection API
V4L2_AUTO_FOCUS_MODE_RECTANGLE- rectangle passed with other
controls or selection APIQuoted 2 lines
parameter. We also need to discuss how the af statistics window configuration is done. I'm not certain there could even be a standardised
Do we need multiple windows for AF statistics ?
If not, I'm inclined to use four separate controls for window configuration. (X, Y, WIDTH, HEIGHT). This was Hans' preference in previous discussions [1].
Quoted 1 line
interface which could be used to control it all.
[1] http://www.mail-archive.com/[email protected]/msg25647.html
Signature · 2 lines
Regards, Sylwester
Signature · 2 lines
Sakari Ailus e-mail: [email protected] jabber/XMPP/Gmail: [email protected]
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
Hi Sakari,
Quoted 14 lines · Sakari Ailus
Quoted 14 lines
Quoted 13 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
The
V4L2_CID_FOCUS_AUTOmenu control has currently following items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.I would put the macro mode to a separate menu since it's configuration for how the regular AF works rather than really different mode.
Yes, makes sense. Most likely there could be also continuous macro auto focus.. I don't have yet an idea what could be a name for that new menu though.
V4L2_CID_FOCUS_AUTO_DISTANCE? It could then have choices FULL or MACRO.
Quoted 7 lines
Quoted 5 lines
How about
V4L2_CID_FOCUS_AUTO_SCAN_RANGE? Which would then have choices:
NORMAL,
MACRO,
INFINITY
?What does INFINITY signify? That lens is permanently positioned there?
Yes, I think that's just what it is supposed to mean, but I would have to double check in the specs.
HeungJun, would you have some more details about the INFINITY setting ?
Quoted 2 lines
The name of the control sounds good to me, but I might change the order of FOCUS and AUTO in it.
Ok, I'll fix it.
--
Thanks,
Sylwester
Re: [RFC/PATCH 1/5] v4l: Convert V4L2_CID_FOCUS_AUTO control to a menu control
In reply to Sakari AilusQuoted 16 lines · Sakari Ailus
Quoted 9 lines · Sylwester Nawrocki
Change the
V4L2_CID_FOCUS_AUTOcontrol type from boolean to a menu type. In case of boolean control we had values 0 and 1 corresponding to manual and automatic focus respectively.The
V4L2_CID_FOCUS_AUTOmenu control has currently following items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.I would put the macro mode to a separate menu since it's configuration for how the regular AF works rather than really different mode.
...
Quoted 9 lines
drivers/media/video/v4l2-ctrls.c const char *v4l2_ctrl_get_name(u32 id) · line 579
Quoted 5 lines
drivers/media/video/v4l2-ctrls.c +1
-0@@ -567,6 +576,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_PRIVACY :return "Privacy" ;case V4L2_CID_IRIS_ABSOLUTE :return "Iris, Absolute" ;case V4L2_CID_IRIS_RELATIVE :return "Iris, Relative" ; +case V4L2_CID_DO_AUTO_FOCUS :return "Do Auto Focus" ;I'd perhaps use "begin" or "start". How does the user learn the autofocus has finished? I think this looks like quite similar problem than telling the flash strobe status to the user. The solution could also be similar to that.
Hi,
considering your previous comments, how about the below focusing control set ?
Controls for starting/stopping auto focusing (for V4L2_CID_FOCUS_AUTO == V4L2_FOCUS_MANUAL):
V4L2_CID_START_AUTO_FOCUS - (button) - start auto focusing,V4L2_CID_STOP_AUTO_FOCUS - (button) - stop auto focusing (might be also
useful in V4L2_FOCUS_AUTO_CONTINUOUS mode)
and auto focus status:
V4L2_CID_AUTO_FOCUS_STATUS - (boolean) - whether focusing is in progress or not
(when V4L2_CID_FOCUS_AUTO == V4L2_FOCUS_MANUAL)
V4L2_CID_FOCUS_AUTO would basically retain it's current semantics:
V4L2_CID_FOCUS_AUTO - (boolean) - select focus type (manual/auto
continuous)
V4L2_FOCUS_MANUAL - manual focus
V4L2_FOCUS_AUTO_CONTINUOUS - continuous auto focus
(or V4L2_FOCUS_AUTO)
New menu control to choose behaviour of auto focus (either single-shot or continuous):
V4L2_CID_AF_MODE - select auto focus mode
V4L2_AF_MODE_NORMAL - "normal" auto focus
V4L2_AF_MODE_MACRO - macro (close-up)
V4L2_AF_MODE_SPOT - spot location passed with selection API or other control
V4L2_AF_MODE_FACE_DETECTION - focus point indicated by internal
face detector
I might try it out and implement in M-5MOLS driver, to see how it works in practice.
Does it make sense for you ?
--
Regards,
Sylwester
PATCH 2/5 uvc: Adapt the driver to new type of V4L2_CID_FOCUS_AUTO control
In reply to Sylwester NawrockiFrom: Heungjun Kim <[email protected]>
The V4L2_CID_FOCUS_AUTO control has been converted from boolean type, where control's value 0 and 1 were corresponding to manual and automatic focus respectively, to menu type with following menu items:
0 - V4L2_FOCUS_MANUAL,
1 - V4L2_FOCUS_AUTO,
2 - V4L2_FOCUS_AUTO_MACRO,
3 - V4L2_FOCUS_AUTO_CONTINUOUS.
According to this change the uvc control mappings are modified to retain original sematics, where 0 corresponds to manual and 1 to auto focus.
---
The V4L2_CID_FOCUS_AUTO control in V4L2_FOCUS_AUTO mode does only a one-shot auto focus, when switched from V4L2_FOCUS_MANUAL. It might be worth to implement also the V4L2_CID_DO_AUTO_FOCUS button control in uvc, however I didn't take time yet to better understand the driver and add this. I also don't have any uvc hardware to test this patch so it's just compile tested.
--- drivers/media/video/uvc/uvc_ctrl.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/media/video/uvc/uvc_ctrl.c +8 -1
@@ -365,6 +365,11 @@ static struct uvc_menu_info exposure_auto_controls[] = { { 8, "Aperture Priority Mode" }, }; +static struct uvc_menu_info focus_auto_controls[] = { + {0 ,"Manual Mode" }, + {1 ,"Auto Mode" }, +}; +static __s32 uvc_ctrl_get_zoom (struct uvc_control_mapping *mapping,__u8 query,const __u8 *data) {
@@ -592,8 +597,10 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = { .selector = UVC_CT_FOCUS_AUTO_CONTROL, .size = 1, .offset = 0, - .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, + .v4l2_type = V4L2_CTRL_TYPE_MENU, .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN, + .menu_info = focus_auto_controls, + .menu_count = ARRAY_SIZE(focus_auto_controls), }, { .id = V4L2_CID_IRIS_ABSOLUTE,
Signature · 1 line
1.7.4.1
Re: [RFC/PATCH 2/5] uvc: Adapt the driver to new type of V4L2_CID_FOCUS_AUTO control
Hi Sylwester and Heungjun,
Quoted 10 lines · On Sunday 04 December 2011 16:16:13 Sylwester Nawrocki wrote:
From: Heungjun Kim <[email protected]>
The
V4L2_CID_FOCUS_AUTOcontrol has been converted from boolean type, where control's value 0 and 1 were corresponding to manual and automatic focus respectively, to menu type with following menu items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.
Quoted 2 lines
According to this change the uvc control mappings are modified to retain original sematics, where 0 corresponds to manual and 1 to auto focus.
UVC auto-focus works in continuous mode, not single-shot mode. As the existing V4L2_CID_FOCUS_AUTO uses 0 to mean manual focus and 1 to mean continuous auto- focus, shouldn't this patch set define the following values instead ?
0 - V4L2_FOCUS_MANUAL
1 - V4L2_FOCUS_AUTO
2 - V4L2_FOCUS_AUTO_MACRO
3 - V4L2_FOCUS_AUTO_SINGLE_SHOT
V4L2_FOCUS_AUTO_SINGLE_SHOT could also be named V4L2_FOCUS_SINGLE_SHOT.
Quoted 43 lines
Signed-off-by Heungjun Kim <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Signed-off-by Sylwester Nawrocki <[email protected]>---
TheV4L2_CID_FOCUS_AUTOcontrol inV4L2_FOCUS_AUTOmode does only a one-shot auto focus, when switched fromV4L2_FOCUS_MANUAL. It might be worth to implement also theV4L2_CID_DO_AUTO_FOCUSbutton control in uvc, however I didn't take time yet to better understand the driver and add this. I also don't have any uvc hardware to test this patch so it's just compile tested.--- drivers/media/video/uvc/uvc_ctrl.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)(quoted diff) +0
-0
b/drivers/media/video/uvc/uvc_ctrl.cindex 254d326..6860ca1 100644drivers/media/video/uvc/uvc_ctrl.c +8
-1@@ -365,6 +365,11 @@ static struct uvc_menu_info exposure_auto_controls[] = { { 8, "Aperture Priority Mode" }, }; +static struct uvc_menu_info focus_auto_controls[] = { + { 0, "Manual Mode" }, + { 1, "Auto Mode" }, +}; + static __s32 uvc_ctrl_get_zoom(struct uvc_control_mapping *mapping, __u8 query, const __u8 *data) {@@ -592,8 +597,10 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = { .selector = UVC_CT_FOCUS_AUTO_CONTROL, .size = 1, .offset = 0, - .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, + .v4l2_type = V4L2_CTRL_TYPE_MENU, .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN, + .menu_info = focus_auto_controls, + .menu_count = ARRAY_SIZE(focus_auto_controls), }, { .id = V4L2_CID_IRIS_ABSOLUTE,
Signature · 3 lines
Regards, Laurent Pinchart
Re: [RFC/PATCH 2/5] uvc: Adapt the driver to new type of V4L2_CID_FOCUS_AUTO control
Hi Laurent,
Quoted 11 lines · Laurent Pinchart
Quoted 10 lines · On Sunday 04 December 2011 16:16:13 Sylwester Nawrocki wrote:
From: Heungjun Kim <[email protected]>
The
V4L2_CID_FOCUS_AUTOcontrol has been converted from boolean type, where control's value 0 and 1 were corresponding to manual and automatic focus respectively, to menu type with following menu items:
0 -V4L2_FOCUS_MANUAL,
1 -V4L2_FOCUS_AUTO,
2 -V4L2_FOCUS_AUTO_MACRO,
3 -V4L2_FOCUS_AUTO_CONTINUOUS.
Quoted 4 lines
Quoted 2 lines
According to this change the uvc control mappings are modified to retain original sematics, where 0 corresponds to manual and 1 to auto focus.
UVC auto-focus works in continuous mode, not single-shot mode. As the existing
Hmm, I suspected that.
Quoted 7 lines
V4L2_CID_FOCUS_AUTOuses 0 to mean manual focus and 1 to mean continuous auto- focus, shouldn't this patch set define the following values instead ?0 - V4L2_FOCUS_MANUAL 1 - V4L2_FOCUS_AUTO 2 - V4L2_FOCUS_AUTO_MACRO 3 - V4L2_FOCUS_AUTO_SINGLE_SHOT
It's not that bad, at least we would not have changed the existing ABI.
It depends how other focus modes are defined, e.g. V4L2_FOCUS_AUTO_MACRO. There is also an auto focus driven by face detection module output.
The question would be whether we want to append _SINGLE_SHOT or _CONTINUOUS to the names. And if most of the focus modes are single-shot we will probably need a common "do auto-focus" control for them.
What do you think about such assignment:
0 - V4L2_FOCUS_MANUAL,
1 - V4L2_FOCUS_AUTO_CONTINUOUS,
2 - V4L2_FOCUS_AUTO,
3 - V4L2_FOCUS_AUTO_MACRO,
?
I'm not 100% sure right now, but the macro and "face detection" are rather "single-shot". Single-shot focus might be more common. Perhaps someone else can put more light on that :-)
Using a "single-shot notation" we might have something like:
0 - V4L2_FOCUS_MANUAL,
1 - V4L2_FOCUS_AUTO,
2 - V4L2_FOCUS_AUTO_SINGLE_SHOT,
3 - V4L2_FOCUS_AUTO_MACRO_SINGLE_SHOT, 3 - V4L2_FOCUS_AUTO_FACE_DETECTION_SINGLE_SHOT,
I'm not sure if this convention is the best one.
Alternatively we could define a "do-focus" control for each mode, but then these controls have to be properly coordinated, for exclusive operation.
Quoted 26 lines
V4L2_FOCUS_AUTO_SINGLE_SHOTcould also be namedV4L2_FOCUS_SINGLE_SHOT.Quoted 23 lines
Signed-off-by Heungjun Kim <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Signed-off-by Sylwester Nawrocki <[email protected]>---
TheV4L2_CID_FOCUS_AUTOcontrol inV4L2_FOCUS_AUTOmode does only a one-shot auto focus, when switched fromV4L2_FOCUS_MANUAL. It might be worth to implement also theV4L2_CID_DO_AUTO_FOCUSbutton control in uvc, however I didn't take time yet to better understand the driver and add this. I also don't have any uvc hardware to test this patch so it's just compile tested.--- drivers/media/video/uvc/uvc_ctrl.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)(quoted diff) +0
-0
b/drivers/media/video/uvc/uvc_ctrl.cindex 254d326..6860ca1 100644drivers/media/video/uvc/uvc_ctrl.c +0
-0@@ -365,6 +365,11 @@ static struct uvc_menu_info exposure_auto_controls[] = { { 8, "Aperture Priority Mode" }, };
Quoted 3 lines
drivers/media/video/uvc/uvc_ctrl.c static struct uvc_menu_info exposure_auto_controls[] = { · line 370
Quoted 3 lines
drivers/media/video/uvc/uvc_ctrl.c +3
-0+static struct uvc_menu_info focus_auto_controls[] = { + {0 ,"Manual Mode" }, + {1 ,"Auto Mode" },
Do you think it could be better to change this to:
+ { 0, "Manual Focus" },
+ { 1, "Continuous Auto Focus" },
?
--
Regards,
Sylwester
PATCH 3/5 v4l: Add V4L2_CID_METERING_MODE camera control
In reply to Sylwester NawrockiThe V4L2_CID_METERING_MODE control allows to determine what method is used by the camera to measure the amount of light available for automatic exposure control.
--- Documentation/DocBook/media/v4l/controls.xml | 31 ++++++++++++++++++++++++++ drivers/media/video/v4l2-ctrls.c | 2 + include/linux/videodev2.h | 7 ++++++ 3 files changed, 40 insertions(+), 0 deletions(-)
Documentation/DocBook/media/v4l/controls.xml +31 -0
@@ -2893,6 +2893,7 @@ mechanical obturation of the sensor and firmware image processing, but the device is not restricted to these methods. Devices that implement the privacy control must support read access and may support write access.</entry> </row> + <row><entry></entry></row> <row> <entry spanname="id"><constant>V4L2_CID_BAND_STOP_FILTER</constant> </entry>
@@ -2902,6 +2903,36 @@ camera sensor on or off, or specify its strength. Such band-stop filters can be used, for example, to filter out the fluorescent light component.</entry> </row> <row><entry></entry></row> + + <row id="v4l2-metering-mode"> + <entry spanname="id"><constant>V4L2_CID_METERING_MODE</constant> </entry> + <entry>enum v4l2_metering_mode</entry> + </row><row><entry spanname="descr">Determines how the camera measures +the amount of light available to expose a frame. Possible values are:</entry> + </row> + <row> + <entrytbl spanname="descr" cols="2"> + <tbody valign="top"> + <row> + <entry><constant>V4L2_METERING_MODE_AVERAGE</constant> </entry> + <entry>Use the light information coming from the entire scene +and average giving no weighting to any particular portion of the metered area. + </entry> + </row> + <row> + <entry><constant>V4L2_METERING_MODE_CENTER_WEIGHTED</constant> </entry> + <entry>Average the light information coming from the entire scene +giving priority to the center of the metered area.</entry> + </row> + <row> + <entry><constant>V4L2_METERING_MODE_SPOT</constant> </entry> + <entry>Measure only very small area at the cent-re of the scene.</entry> + </row> + </tbody> + </entrytbl> + </row> + <row><entry></entry></row> + </tbody> </tgroup> </table>
drivers/media/video/v4l2-ctrls.c +2 -0
@@ -577,6 +577,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_IRIS_ABSOLUTE :return "Iris, Absolute" ;case V4L2_CID_IRIS_RELATIVE :return "Iris, Relative" ;case V4L2_CID_DO_AUTO_FOCUS :return "Do Auto Focus" ; +case V4L2_CID_METERING_MODE :return "Metering Mode" ;/* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */
@@ -703,6 +704,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC :case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL :case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE : +case V4L2_CID_METERING_MODE : *type =V4L2_CTRL_TYPE_MENU ;break ;case V4L2_CID_RDS_TX_PS_NAME :
include/linux/videodev2.h +7 -0
@@ -1626,6 +1626,13 @@ enum v4l2_focus_auto_type {#define V4L2_CID_DO_AUTO_FOCUS (V4L2_CID_CAMERA_CLASS_BASE+19) +#define V4L2_CID_METERING_MODE (V4L2_CID_CAMERA_CLASS_BASE+20) +enum v4l2_metering_mode { +V4L2_METERING_MODE_AVERAGE , +V4L2_METERING_MODE_CENTER_WEIGHTED , +V4L2_METERING_MODE_SPOT , +}; +/* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
Signature · 1 line
1.7.4.1
Re: [RFC/PATCH 3/5] v4l: Add V4L2_CID_METERING_MODE camera control
Hi Sylwester,
Quoted 57 lines · On Sunday 04 December 2011 16:16:14 Sylwester Nawrocki wrote:
The
V4L2_CID_METERING_MODEcontrol allows to determine what method is used by the camera to measure the amount of light available for automatic exposure control.Signed-off-by Sylwester Nawrocki <[email protected]>--- Documentation/DocBook/media/v4l/controls.xml | 31 ++++++++++++++++++++++++++ drivers/media/video/v4l2-ctrls.c | 2 + include/linux/videodev2.h | 7 ++++++ 3 files changed, 40 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/controls.xmlindex 5ccb0b0..53d7c08 100644Documentation/DocBook/media/v4l/controls.xml +0
-0@@ -2893,6 +2893,7 @@ mechanical obturation of the sensor and firmwareimage processing, but the device is not restricted to these methods. Devices that implement the privacy control must support read access and may support write access.</entry> </row>
Documentation/DocBook/media/v4l/controls.xml +1
-0+ <row><entry></entry></row> <row> <entryspanname="id"><constant>V4L2_CID_BAND_STOP_FILTER</constant> </entry>
Documentation/DocBook/media/v4l/controls.xml +0
-0@@ -2902,6 +2903,36 @@ camera sensor on or off, or specify its strength.Such band-stop filters can be used, for example, to filter out the fluorescent light component.</entry> </row>
Documentation/DocBook/media/v4l/controls.xml +3
-0<row><entry></entry></row> + + <row id="v4l2-metering-mode"> + <entryspanname="id"><constant>V4L2_CID_METERING_MODE</constant> </entry> +
<entry>enum v4l2_metering_mode</entry>Documentation/DocBook/media/v4l/controls.xml +2
-0+ </row><row><entry spanname="descr">Determines how the camera measures +the amount of light available to expose a frame. Possible valuesare:</entry> + </row>
Documentation/DocBook/media/v4l/controls.xml +7
-0+ <row> + <entrytbl spanname="descr" cols="2"> + <tbody valign="top"> + <row> + <entry><constant>V4L2_METERING_MODE_AVERAGE</constant> </entry> + <entry>Use the light information coming from the entire scene +and average giving no weighting to any particular portion of the meteredarea. + </entry>
Documentation/DocBook/media/v4l/controls.xml +3
-0+ </row> + <row> +<entry><constant>V4L2_METERING_MODE_CENTER_WEIGHTED</constant> </entr
y> + <entry>Average the light information coming from the entire sceneDocumentation/DocBook/media/v4l/controls.xml +5
-0+giving priority to the center of the metered area.</entry> + </row> + <row> + <entry><constant>V4L2_METERING_MODE_SPOT</constant> </entry> + <entry>Measure only very small area at the cent-re of thescene.</entry> + </row>
Documentation/DocBook/media/v4l/controls.xml camera sensor on or off, or specify its strength. Such band-stop filters can · line 2931
Quoted 1 line
Documentation/DocBook/media/v4l/controls.xml +1
-0+ </tbody>
For the last two cases, would it also make sense to specify the center of the weighted area and the spot location ?
Quoted 45 lines
Documentation/DocBook/media/v4l/controls.xml +4
-0+ </entrytbl> + </row> + <row><entry></entry></row> + </tbody> </tgroup> </table>(quoted diff) +0
-0
b/drivers/media/video/v4l2-ctrls.cindex 7d8862f..8d0cd0e 100644drivers/media/video/v4l2-ctrls.c +1
-0@@ -577,6 +577,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_IRIS_ABSOLUTE :return "Iris, Absolute" ;case V4L2_CID_IRIS_RELATIVE :return "Iris, Relative" ;case V4L2_CID_DO_AUTO_FOCUS :return "Do Auto Focus" ; +case V4L2_CID_METERING_MODE :return "Metering Mode" ;/* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */ @@ -703,6 +704,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum
v4l2_ctrl_type*type, caseV4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC:drivers/media/video/v4l2-ctrls.c +1
-0case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL :case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE : +case V4L2_CID_METERING_MODE : *type =V4L2_CTRL_TYPE_MENU ;break ;case V4L2_CID_RDS_TX_PS_NAME :include/linux/videodev2.h +7
-0@@ -1626,6 +1626,13 @@ enum v4l2_focus_auto_type {#define V4L2_CID_DO_AUTO_FOCUS (V4L2_CID_CAMERA_CLASS_BASE+19) +#define V4L2_CID_METERING_MODE (V4L2_CID_CAMERA_CLASS_BASE+20) +enum v4l2_metering_mode { +V4L2_METERING_MODE_AVERAGE , +V4L2_METERING_MODE_CENTER_WEIGHTED , +V4L2_METERING_MODE_SPOT , +}; +/* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
Signature · 3 lines
Regards, Laurent Pinchart
Re: [RFC/PATCH 3/5] v4l: Add V4L2_CID_METERING_MODE camera control
Hi Laurent,
thanks for the comments.
Quoted 54 lines · Laurent Pinchart
Quoted 53 lines · On Sunday 04 December 2011 16:16:14 Sylwester Nawrocki wrote:
The
V4L2_CID_METERING_MODEcontrol allows to determine what method is used by the camera to measure the amount of light available for automatic exposure control.Signed-off-by Sylwester Nawrocki <[email protected]>--- Documentation/DocBook/media/v4l/controls.xml | 31 ++++++++++++++++++++++++++ drivers/media/video/v4l2-ctrls.c | 2 + include/linux/videodev2.h | 7 ++++++ 3 files changed, 40 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/controls.xmlindex 5ccb0b0..53d7c08 100644Documentation/DocBook/media/v4l/controls.xml +0
-0@@ -2893,6 +2893,7 @@ mechanical obturation of the sensor and firmwareimage processing, but the device is not restricted to these methods. Devices that implement the privacy control must support read access and may support write access.</entry> </row>
Documentation/DocBook/media/v4l/controls.xml +1
-0+ <row><entry></entry></row> <row> <entryspanname="id"><constant>V4L2_CID_BAND_STOP_FILTER</constant> </entry>
Documentation/DocBook/media/v4l/controls.xml +0
-0@@ -2902,6 +2903,36 @@ camera sensor on or off, or specify its strength.Such band-stop filters can be used, for example, to filter out the fluorescent light component.</entry> </row>
Documentation/DocBook/media/v4l/controls.xml +3
-0<row><entry></entry></row> + + <row id="v4l2-metering-mode"> + <entryspanname="id"><constant>V4L2_CID_METERING_MODE</constant> </entry> +
<entry>enum v4l2_metering_mode</entry>Documentation/DocBook/media/v4l/controls.xml +2
-0+ </row><row><entry spanname="descr">Determines how the camera measures +the amount of light available to expose a frame. Possible valuesare:</entry> + </row>
Documentation/DocBook/media/v4l/controls.xml +7
-0+ <row> + <entrytbl spanname="descr" cols="2"> + <tbody valign="top"> + <row> + <entry><constant>V4L2_METERING_MODE_AVERAGE</constant> </entry> + <entry>Use the light information coming from the entire scene +and average giving no weighting to any particular portion of the meteredarea. + </entry>
Documentation/DocBook/media/v4l/controls.xml +3
-0+ </row> + <row> +<entry><constant>V4L2_METERING_MODE_CENTER_WEIGHTED</constant> </entr
y> + <entry>Average the light information coming from the entire sceneDocumentation/DocBook/media/v4l/controls.xml +2
-0+giving priority to the center of the metered area.</entry> + </row>
Quoted 8 lines
Documentation/DocBook/media/v4l/controls.xml camera sensor on or off, or specify its strength. Such band-stop filters can · line 2931
Quoted 5 lines
Documentation/DocBook/media/v4l/controls.xml +3
-0+ <row> + <entry><constant>V4L2_METERING_MODE_SPOT</constant> </entry> + <entry>Measure only very small area at the cent-re of thescene.</entry> + </row>
Documentation/DocBook/media/v4l/controls.xml +1
-0+ </tbody>For the last two cases, would it also make sense to specify the center of the weighted area and the spot location ?
Yes, that's quite basic requirement as well.. A means to determine the location would be also needed for some auto focus algorithms.
Additionally for V4L2_METERING_MODE_CENTER_WEIGHTED it's also needed to specify the size of the area (width/height).
What do you think about defining new control for passing pixel position, i.e. modifying struct v4l2_ext_control to something like:
struct v4l2_ext_control {
__u32 id;
__u32 size;
__u32 reserved2[1];
union {
__s32 value;
__s64 value64;
struct v4l2_point position;
char *string;
};
} __attribute__ ((packed));where:
struct v4l2_point {
__s32 x;
__s32 y;
};or should we rather use ioctls for things like that ?
Signature · 2 lines
Regards, Sylwester
Re: [RFC/PATCH 3/5] v4l: Add V4L2_CID_METERING_MODE camera control
Quoted 35 lines · Sylwester Nawrocki
Quoted 5 lines
Quoted 5 lines
(quoted diff) +1
-0+<entry><constant>V4L2_METERING_MODE_CENTER_WEIGHTED</constant> </entr
y> + <entry>Average the light information coming from the entire scene(quoted diff) +2
-0+giving priority to the center of the metered area.</entry> + </row>Quoted 8 lines
Documentation/DocBook/media/v4l/controls.xml camera sensor on or off, or specify its strength. Such band-stop filters can · line 2931
Quoted 5 lines
Documentation/DocBook/media/v4l/controls.xml +3
-0+ <row> + <entry><constant>V4L2_METERING_MODE_SPOT</constant> </entry> + <entry>Measure only very small area at the cent-re of thescene.</entry> + </row>
Documentation/DocBook/media/v4l/controls.xml +1
-0+ </tbody>For the last two cases, would it also make sense to specify the center of the weighted area and the spot location ?
Yes, that's quite basic requirement as well.. A means to determine the location would be also needed for some auto focus algorithms.
Additionally for
V4L2_METERING_MODE_CENTER_WEIGHTEDit's also needed to specify the size of the area (width/height).What do you think about defining new control for passing pixel position, i.e. modifying struct
v4l2_ext_controlto something like:struct v4l2_ext_control { __u32 id; __u32 size; __u32 reserved2[1]; union { __s32 value; __s64 value64; struct v4l2_point position; char *string; }; } __attribute__ ((packed));
Quoted 6 lines
where:
struct v4l2_point { __s32 x; __s32 y; };
Hmm, that won't work since there is no way to handle the min/max/step for more than one value. Probably the selection API could be used for specifying the metering rectangle, or just separate controls for x, y, width, height. Since we need to specify only locations for some controls and a rectangle for others, probably separate controls would be more suitable.
Signature · 2 lines
Regards, Sylwester
Re: [RFC/PATCH 3/5] v4l: Add V4L2_CID_METERING_MODE camera control
Hi Laurent and Sylwester,
Quoted 43 lines · Sylwester Nawrocki
Quoted 35 lines · Sylwester Nawrocki
Quoted 5 lines
Quoted 5 lines
(quoted diff) +1
-0+<entry><constant>V4L2_METERING_MODE_CENTER_WEIGHTED</constant> </entr
y> + <entry>Average the light information coming from the entire scene(quoted diff) +2
-0+giving priority to the center of the metered area.</entry> + </row>Quoted 8 lines
Documentation/DocBook/media/v4l/controls.xml camera sensor on or off, or specify its strength. Such band-stop filters can · line 2931
Quoted 5 lines
Documentation/DocBook/media/v4l/controls.xml +3
-0+ <row> + <entry><constant>V4L2_METERING_MODE_SPOT</constant> </entry> + <entry>Measure only very small area at the cent-re of thescene.</entry> + </row>
Documentation/DocBook/media/v4l/controls.xml +1
-0+ </tbody>For the last two cases, would it also make sense to specify the center of the weighted area and the spot location ?
Yes, that's quite basic requirement as well.. A means to determine the location would be also needed for some auto focus algorithms.
Additionally for
V4L2_METERING_MODE_CENTER_WEIGHTEDit's also needed to specify the size of the area (width/height).What do you think about defining new control for passing pixel position, i.e. modifying struct
v4l2_ext_controlto something like:struct v4l2_ext_control { __u32 id; __u32 size; __u32 reserved2[1]; union { __s32 value; __s64 value64; struct v4l2_point position; char *string; }; } __attribute__ ((packed));Quoted 6 lines
where:
struct v4l2_point { __s32 x; __s32 y; };
Quoted 5 lines
Hmm, that won't work since there is no way to handle the min/max/step for more than one value. Probably the selection API could be used for specifying the metering rectangle, or just separate controls for x, y, width, height. Since we need to specify only locations for some controls and a rectangle for others, probably separate controls would be more suitable.
I prefer the use of the selection API over controls. Also consider you may have multiple areas for metering. Also the areas may well be different for focus, white balance and exxposure --- they often actually are.
Signature · 2 lines
Sakari Ailus e-mail: [email protected] jabber/XMPP/Gmail: [email protected]
Re: [RFC/PATCH 3/5] v4l: Add V4L2_CID_METERING_MODE camera control
Hi Sakari,
Quoted 50 lines · Sakari Ailus
Quoted 43 lines · Sylwester Nawrocki
Quoted 35 lines · Sylwester Nawrocki
Quoted 5 lines
Quoted 5 lines
(quoted diff) +1
-0+<entry><constant>V4L2_METERING_MODE_CENTER_WEIGHTED</constant> </entr
y> + <entry>Average the light information coming from the entire scene(quoted diff) +2
-0+giving priority to the center of the metered area.</entry> + </row>Quoted 8 lines
Documentation/DocBook/media/v4l/controls.xml camera sensor on or off, or specify its strength. Such band-stop filters can · line 2931
Quoted 5 lines
Documentation/DocBook/media/v4l/controls.xml +3
-0+ <row> + <entry><constant>V4L2_METERING_MODE_SPOT</constant> </entry> + <entry>Measure only very small area at the cent-re of thescene.</entry> + </row>
Documentation/DocBook/media/v4l/controls.xml +1
-0+ </tbody>For the last two cases, would it also make sense to specify the center of the weighted area and the spot location ?
Yes, that's quite basic requirement as well.. A means to determine the location would be also needed for some auto focus algorithms.
Additionally for
V4L2_METERING_MODE_CENTER_WEIGHTEDit's also needed to specify the size of the area (width/height).What do you think about defining new control for passing pixel position, i.e. modifying struct
v4l2_ext_controlto something like:struct v4l2_ext_control { __u32 id; __u32 size; __u32 reserved2[1]; union { __s32 value; __s64 value64; struct v4l2_point position; char *string; }; } __attribute__ ((packed));Quoted 6 lines
where:
struct v4l2_point { __s32 x; __s32 y; };Quoted 5 lines
Hmm, that won't work since there is no way to handle the min/max/step for more than one value. Probably the selection API could be used for specifying the metering rectangle, or just separate controls for x, y, width, height. Since we need to specify only locations for some controls and a rectangle for others, probably separate controls would be more suitable.
Quoted 3 lines
I prefer the use of the selection API over controls. Also consider you may have multiple areas for metering. Also the areas may well be different for focus, white balance and exxposure --- they often actually are.
Yes, AFAIR Laurent expressed similar opinion on that [1].
I talked to Tomasz and Marek about configuring of the metering areas and we came to conclusion that we could designate a group of targets for exposure, auto-focus, etc. Define a base and target pool size so it is possible to define multiple rectangles. And single point (pixel) would be described by struct v4l2_rect with width=1, height=1.
Then we would probably need to be able to enumerate the targets somehow.
[1] http://www.spinics.net/lists/linux-media/msg41215.html
Signature · 2 lines
Thanks, Sylwester
PATCH 4/5 v4l: Add V4L2_CID_EXPOSURE_BIAS camera control
In reply to Sylwester NawrockiThe V4L2_CID_EXPOSURE_BIAS control allows for manual exposure compensation when automatic exposure algorithm is enabled.
--- Documentation/DocBook/media/v4l/controls.xml | 16 ++++++++++++++++ drivers/media/video/v4l2-ctrls.c | 1 + include/linux/videodev2.h | 2 ++ 3 files changed, 19 insertions(+), 0 deletions(-)
Documentation/DocBook/media/v4l/controls.xml +16 -0
@@ -2691,6 +2691,22 @@ and 100000 for 10 seconds.</entry> <row><entry></entry></row> <row> + <entry spanname="id"><constant>V4L2_CID_EXPOSURE_BIAS</constant> </entry> + <entry>integer (menu?)</entry> + </row><row><entry spanname="descr"> Determines the exposure +compensation when <constant>V4L2_CID_EXPOSURE_AUTO</constant> control +is set to <constant>AUTO</constant>, <constant>SHUTTER_PRIORITY +</constant> or <constant>APERTURE_PRIORITY</constant>. It is expressed +in terms of EV, drivers should interpret the values as 0.001 EV units, +where the value 1000 stands for +1 EV. +<para>Increasing the exposure compensation value is equivalent to +decreasing the exposure value (EV) and will increase the amount of +light at the image sensor. The camera performs the exposure compensation +by adjusting absolute exposure time and/or aperture.</para></entry> + </row> + <row><entry></entry></row> + + <row> <entry spanname="id"><constant>V4L2_CID_EXPOSURE_AUTO_PRIORITY</constant> </entry> <entry>boolean</entry> </row><row><entry spanname="descr">When
drivers/media/video/v4l2-ctrls.c +1 -0
@@ -578,6 +578,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_IRIS_RELATIVE :return "Iris, Relative" ;case V4L2_CID_DO_AUTO_FOCUS :return "Do Auto Focus" ;case V4L2_CID_METERING_MODE :return "Metering Mode" ; +case V4L2_CID_EXPOSURE_BIAS :return "Exposure, Bias" ;/* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */
include/linux/videodev2.h +2 -0
@@ -1633,6 +1633,8 @@ enum v4l2_metering_mode { V4L2_METERING_MODE_SPOT, }; +#define V4L2_CID_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+21) +/* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
Signature · 1 line
1.7.4.1
PATCH 5/5 v4l: Add V4L2_CID_ISO and V4L2_CID_ISO_AUTO controls
In reply to Sylwester NawrockiAdd manual and automatic ISO controls. The ISO values are related to the level of amplification of the analog signal between image sensor and ADC, but some sensors with an integrated SoC ISP expose an interface to accept the ISO values directly.
---
These controls depend on the integer menu control support. Corresponding patches from Sakari can be found here:
http://www.mail-archive.com/[email protected]/msg39733.html
--- Documentation/DocBook/media/v4l/biblio.xml | 11 +++++++++++ Documentation/DocBook/media/v4l/controls.xml | 23 +++++++++++++++++++++++ drivers/media/video/v4l2-ctrls.c | 3 +++ include/linux/videodev2.h | 2 ++ 4 files changed, 39 insertions(+), 0 deletions(-)
Documentation/DocBook/media/v4l/biblio.xml +11 -0
@@ -177,6 +177,17 @@ in the frequency range from 87,5 to 108,0 MHz</title> <title>NTSC-4: United States RBDS Standard</title> </biblioentry> + <biblioentry id="iso12232"> + <abbrev>ISO 12232:2006</abbrev> + <authorgroup> + <corpauthor>International Organization for Standardization +(<ulink url="http://www.iso.org">http://www.iso.org</ulink>)</corpauthor> + </authorgroup> + <title>Photography — Digital still cameras — Determination + of exposure index, ISO speed ratings, standard output sensitivity, and + recommended exposure index</title> + </biblioentry> + </bibliography> <!--
Documentation/DocBook/media/v4l/controls.xml +23 -0
@@ -2949,6 +2949,29 @@ giving priority to the center of the metered area.</entry> </row> <row><entry></entry></row> + <row> + <entry spanname="id"><constant>V4L2_CID_ISO</constant> </entry> + <entry>integer menu</entry> + </row><row><entry spanname="descr">Determines ISO equivalent of an +image sensor indicating the sensor's sensitivity to light. The numbers are +expressed in arithmetic scale, as per <xref linkend="iso12232" /> standard, +where doubling the sensor sensitivity is represented by doubling the numerical +ISO value. Applications should interpret the values as standard ISO values +multiplied by 1000, e.g. control value 800 stands for ISO 0.8. Drivers will +usually support only subset of standard ISO values. +</entry> + </row> + <row><entry></entry></row> + + <row> + <entry spanname="id"><constant>V4L2_CID_ISO_AUTO</constant> </entry> + <entry>boolean</entry> + </row><row><entry spanname="descr">Enables automatic ISO control. +The effect of setting <constant>V4L2_CID_ISO</constant> while automatic +ISO control is enabled is undefined, drivers should ignore such request.</entry> + </row> + <row><entry></entry></row> + </tbody> </tgroup> </table>
drivers/media/video/v4l2-ctrls.c +3 -0
@@ -579,6 +579,8 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_DO_AUTO_FOCUS :return "Do Auto Focus" ;case V4L2_CID_METERING_MODE :return "Metering Mode" ;case V4L2_CID_EXPOSURE_BIAS :return "Exposure, Bias" ; +case V4L2_CID_ISO :return "Sensitivity (ISO)" ; +case V4L2_CID_ISO_AUTO :return "Sensitivity (ISO), Auto" ;/* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */
@@ -638,6 +640,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,case V4L2_CID_HFLIP :case V4L2_CID_VFLIP :case V4L2_CID_HUE_AUTO : +case V4L2_CID_ISO_AUTO :case V4L2_CID_CHROMA_AGC :case V4L2_CID_COLOR_KILLER :case V4L2_CID_MPEG_AUDIO_MUTE :
include/linux/videodev2.h +2 -0
@@ -1634,6 +1634,8 @@ enum v4l2_metering_mode { };#define V4L2_CID_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+21) +#define V4L2_CID_ISO (V4L2_CID_CAMERA_CLASS_BASE+22) +#define V4L2_CID_ISO_AUTO (V4L2_CID_CAMERA_CLASS_BASE+23)/* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
Signature · 1 line
1.7.4.1
Hi Sylwester,
Quoted 7 lines · On Sunday 04 December 2011 16:16:11 Sylwester Nawrocki wrote:
Hi All,
I put some effort in preparing a documentation for a couple of new controls in the camera control class. It's a preeliminary work, it's mainly just documentation. There is yet no patches for any driver using these controls. I just wanted to get some possible feedback on them, if this sort of stuff is welcome and what might need to be done differently.
Thanks for the patches.
Regarding patches 3/5, 4/5 and 5/5, we should perhaps try to brainstorm this a bit. There's more to exposure setting than just those controls, maybe it's time to think about a proper exposure API. We could start by gathering requirements on the list, and maybe have an IRC meeting if needed.
Signature · 3 lines
Regards, Laurent Pinchart
Hi Laurent,
Quoted 9 lines · Laurent Pinchart
Quoted 7 lines · On Sunday 04 December 2011 16:16:11 Sylwester Nawrocki wrote:
Hi All,
I put some effort in preparing a documentation for a couple of new controls in the camera control class. It's a preeliminary work, it's mainly just documentation. There is yet no patches for any driver using these controls. I just wanted to get some possible feedback on them, if this sort of stuff is welcome and what might need to be done differently.
Quoted 6 lines
Thanks for the patches.
Regarding patches 3/5, 4/5 and 5/5, we should perhaps try to brainstorm this a bit. There's more to exposure setting than just those controls, maybe it's time to think about a proper exposure API. We could start by gathering requirements on the list, and maybe have an IRC meeting if needed.
Certainly the existing support for exposure setting in V4L2 is not sufficient even for mobile camera control. I'll try to prepare a list of requirements. It would be great to have a brainstorming session with more people experienced in this field.
Regards,
Signature · 2 lines
Sylwester Nawrocki Samsung Poland R&D Center
Hi, all!
Quoted 19 lines · Sylwester Nawrocki
Hi Laurent,
Quoted 9 lines · Laurent Pinchart
Quoted 7 lines · On Sunday 04 December 2011 16:16:11 Sylwester Nawrocki wrote:
Hi All,
I put some effort in preparing a documentation for a couple of new controls in the camera control class. It's a preeliminary work, it's mainly just documentation. There is yet no patches for any driver using these controls. I just wanted to get some possible feedback on them, if this sort of stuff is welcome and what might need to be done differently.
Quoted 6 lines
Thanks for the patches.
Regarding patches 3/5, 4/5 and 5/5, we should perhaps try to brainstorm this a bit. There's more to exposure setting than just those controls, maybe it's time to think about a proper exposure API. We could start by gathering requirements on the list, and maybe have an IRC meeting if needed.
Quoted 4 lines
Certainly the existing support for exposure setting in V4L2 is not sufficient even for mobile camera control. I'll try to prepare a list of requirements. It would be great to have a brainstorming session with more people experienced in this field.
IRC meeting?
The proposed controls seem useful for high level control --- for example, ISO means a combination of digital and analog gain, and also the unit is different. In general, I think that even if the three are concerned with similar issues, the ISO control definitely should belong to a different
class: it requires making policy decisions rather than just providing access to the sensor features.
Cheers,
Signature · 2 lines
Sakari Ailus e-mail: [email protected] jabber/XMPP/Gmail: [email protected]