Skip to contentSkip to conversation

libv4l release: 0.5.97: the whitebalance release!

PATCH In review Hans de Goede 5 participants 23 messages Apr 15, 2009 – May 17, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi All,

As the version number shows this is a beta release of the 0.6.x series, the big change here is the addition of video processing to libv4l currently this only does whitebalance and normalizing (which turns out to be useless for most cams) but the basic framework for doing video processing, and being able to control it through fake v4l2 controls using for example v4l2ucp is there.

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other webcams (after instaling this release) do:

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Notice the whitebalance and normalize checkboxes in v4l2ucp, as well as low and high limits for normalize.

Now start your favorite webcam viewing app and play around with the 2 checkboxes. Note normalize seems to be useless in most cases. If whitebalancing makes a *strongly noticable* difference for your webcam please mail me info about your cam (the usb id), then I can add it to the list of cams which will have the whitebalancing algorithm (and the v4l2 control to enable/disable it) enabled by default.

Unfortunately doing videoprocessing can be quite expensive, as for example whitebalancing is quite hard todo in yuv space, so doing white balancing with the pac7302, with an apps which wants yuv changes the flow from pixart-jpeg -> yuv420 -> rotate90
to:
pixart-jpeg -> rgb24 -> whitebalance -> yuv420 -> rotate90

This is not a problem for cams which deliver (compressed) raw bayer, as bayer is rgb too, so I've implemented a version of the whitebalancing algorithm which operates directly on bayer data, so for bayer cams (like the pac207) it goes from:
bayer- > yuv
to:
bayer -> whitebalance -> yuv

For the near future I plan to change the code so that the analyse phase (which does not get done every frame) creates per component look up tables, this will make it easier to stack multiple "effects" in one pass without special casing it as the current special normalize+whitebalance in one pass code. Then we can add for example gamma correction with a negligible performance impact (when already doing white balancing that is).

libv4l-0.5.97
-------------
* As the version number shows this is a beta release of the 0.6.x series, the big change here is the addition of video processing to libv4l currently this only does whitebalance and normalizing (which turns out to be useless for most cams) but the basic framework for doing video processing, and being able to control it through fake v4l2 controls using for example v4l2ucp is there.
The initial version of this code was written by 3 of my computer science
students: Elmar Kleijn, Sjoerd Piepenbrink and Radjnies Bhansingh
* Currently whitebalancing gets enabled based on USB-ID's and it only gets enabled for Pixart webcam's. You can force it being enabled with other webcams by setting the environment variable LIBV4LCONTROL_CONTROLS, this sets a bitmask enabling certain v4l2 controls which control the video processing set it to 15 to enable both whitebalancing and normalize. You can then change the settings using a v4l2 control panel like v4l2ucp
* Only report / allow supported destination formats in enum_fmt / try_fmt / g_fmt / s_fmt when processing, rotating or flipping.
* Some applications / libs (*cough* gstreamer *cough*) will not work correctly with planar YUV formats when the width is not a multiple of 8, so crop widths which are not a multiple of 8 to the nearest multiple of 8 when converting to planar YUV
* Add dependency generation to libv4l by: Gilles Gigan <[email protected]>
* Add support to use orientation from VIDIOC_ENUMINPUT by:
Adam Baker <[email protected]>
* sn9c20x cams have occasional bad jpeg frames, drop these to avoid the flickering effect they cause, by: Brian Johnson <[email protected]>
* adjust libv4l's upside down cam detection to also work with devices which have the usb interface as parent instead of the usb device
* fix libv4l upside down detection for the new v4l minor numbering scheme
* fix reading outside of the source memory when doing yuv420->rgb conversion

Get it here:
http://people.atrpms.net/~hdegoede/libv4l-0.5.97.tar.gz

Regards,

Hans

#1 lore raw
Quoted 7 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other webcams (after instaling this release) do:

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the sq905 based camera I can't get it to appear for a pac207 based camera regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 9 lines

Notice the whitebalance and normalize checkboxes in v4l2ucp, as well as low and high limits for normalize.

Now start your favorite webcam viewing app and play around with the 2 checkboxes. Note normalize seems to be useless in most cases. If whitebalancing makes a *strongly noticable* difference for your webcam please mail me info about your cam (the usb id), then I can add it to the list of cams which will have the whitebalancing algorithm (and the v4l2 control to enable/disable it) enabled by default.

The whitebalance works really well with the sq905 (ID 2770:9120). Without it the image is very red when using artificial light, with auto whitebalance the colours look slightly desaturated but otherwise fine.

Adam

#2 lore raw
Quoted 5 lines · Adam Baker
Quoted 4 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other webcams (after instaling this release) do:

Quoted 8 lines
Quoted 3 lines

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the sq905 based camera I can't get it to appear for a pac207 based camera regardless of whether LIBV4LCONTROL_CONTROLS is set.

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

Quoted 10 lines
Quoted 9 lines

Notice the whitebalance and normalize checkboxes in v4l2ucp, as well as low and high limits for normalize.

Now start your favorite webcam viewing app and play around with the 2 checkboxes. Note normalize seems to be useless in most cases. If whitebalancing makes a *strongly noticable* difference for your webcam please mail me info about your cam (the usb id), then I can add it to the list of cams which will have the whitebalancing algorithm (and the v4l2 control to enable/disable it) enabled by default.

Quoted 4 lines

The whitebalance works really well with the sq905 (ID 2770:9120). Without it the image is very red when using artificial light, with auto whitebalance the colours look slightly desaturated but otherwise fine.

Good to hear it helps for the sq905 too, is that the only know id for sq905 cams ?

Regards,

Hans

Quoted 2 lines

Adam

#19 lore raw
In reply to Hans de Goede

Hans,
I have tested libv4lconvert with a PCI hauppauge hvr1300 DVB-T and found that v4lconvert_create() returns NULL. The problem comes from the shm_open calls in v4lcontrol_create() in libv4lcontrol.c (lines 187 & 190). libv4lconvert constructs the shared memory name based on the video device's name. And in this case the video device's name (literally "Hauppauge WinTV-HVR1300 DVB-T/H") contains a slash, which makes both calls to shm_open() fail. I can put together a quick patch to replace '/' with '-' or white spaces if you want. Gilles

Quoted 97 lines · Hans de Goede

Hi All,

As the version number shows this is a beta release of the 0.6.x series, the big change here is the addition of video processing to libv4l currently this only does whitebalance and normalizing (which turns out to be useless for most cams) but the basic framework for doing video processing, and being able to control it through fake v4l2 controls using for example v4l2ucp is there.

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other webcams (after instaling this release) do:

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Notice the whitebalance and normalize checkboxes in v4l2ucp, as well as low and high limits for normalize.

Now start your favorite webcam viewing app and play around with the 2 checkboxes. Note normalize seems to be useless in most cases. If whitebalancing makes a *strongly noticable* difference for your webcam please mail me info about your cam (the usb id), then I can add it to the list of cams which will have the whitebalancing algorithm (and the v4l2 control to enable/disable it) enabled by default.

Unfortunately doing videoprocessing can be quite expensive, as for example whitebalancing is quite hard todo in yuv space, so doing white balancing with the pac7302, with an apps which wants yuv changes the flow from pixart-jpeg -> yuv420 -> rotate90
to:
pixart-jpeg -> rgb24 -> whitebalance -> yuv420 -> rotate90

This is not a problem for cams which deliver (compressed) raw bayer, as bayer is rgb too, so I've implemented a version of the whitebalancing algorithm which operates directly on bayer data, so for bayer cams (like the pac207) it goes from:
bayer- > yuv
to:
bayer -> whitebalance -> yuv

For the near future I plan to change the code so that the analyse phase (which does not get done every frame) creates per component look up tables, this will make it easier to stack multiple "effects" in one pass without special casing it as the current special normalize+whitebalance in one pass code. Then we can add for example gamma correction with a negligible performance impact (when already doing white balancing that is).

libv4l-0.5.97
-------------
* As the version number shows this is a beta release of the 0.6.x series, the big change here is the addition of video processing to libv4l currently this only does whitebalance and normalizing (which turns out to be useless for most cams) but the basic framework for doing video processing, and being able to control it through fake v4l2 controls using for example v4l2ucp is there.
 The initial version of this code was written by 3 of my computer science
 students: Elmar Kleijn, Sjoerd Piepenbrink and Radjnies Bhansingh
* Currently whitebalancing gets enabled based on USB-ID's and it only gets enabled for Pixart webcam's. You can force it being enabled with other webcams by setting the environment variable LIBV4LCONTROL_CONTROLS, this sets a bitmask enabling certain v4l2 controls which control the video processing set it to 15 to enable both whitebalancing and normalize. You can then change the settings using a v4l2 control panel like v4l2ucp
* Only report / allow supported destination formats in enum_fmt / try_fmt / g_fmt / s_fmt when processing, rotating or flipping.
* Some applications / libs (*cough* gstreamer *cough*) will not work correctly with planar YUV formats when the width is not a multiple of 8, so crop widths which are not a multiple of 8 to the nearest multiple of 8 when converting to planar YUV
* Add dependency generation to libv4l by: Gilles Gigan <[email protected]>
* Add support to use orientation from VIDIOC_ENUMINPUT by:
 Adam Baker <[email protected]>
* sn9c20x cams have occasional bad jpeg frames, drop these to avoid the flickering effect they cause, by: Brian Johnson <[email protected]>
* adjust libv4l's upside down cam detection to also work with devices which have the usb interface as parent instead of the usb device
* fix libv4l upside down detection for the new v4l minor numbering scheme
* fix reading outside of the source memory when doing yuv420->rgb conversion

Get it here:
http://people.atrpms.net/~hdegoede/libv4l-0.5.97.tar.gz

Regards,

Hans

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#20 lore raw
Quoted 11 lines · Gilles Gigan

Hans,
I have tested libv4lconvert with a PCI hauppauge hvr1300 DVB-T and found that v4lconvert_create() returns NULL. The problem comes from the shm_open calls in v4lcontrol_create() in libv4lcontrol.c (lines 187& 190). libv4lconvert constructs the shared memory name based on the video device's name. And in this case the video device's name (literally "Hauppauge WinTV-HVR1300 DVB-T/H") contains a slash, which makes both calls to shm_open() fail. I can put together a quick patch to replace '/' with '-' or white spaces if you want. Gilles

Hi,

Thanks for reporting this! Can you please test the attached patch to see if it fixes this?

Thanks,

Hans

Quoted 100 lines · Hans de Goede
Quoted 97 lines

Hi All,

As the version number shows this is a beta release of the 0.6.x series, the big change here is the addition of video processing to libv4l currently this only does whitebalance and normalizing (which turns out to be useless for most cams) but the basic framework for doing video processing, and being able to control it through fake v4l2 controls using for example v4l2ucp is there.

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other webcams (after instaling this release) do:

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Notice the whitebalance and normalize checkboxes in v4l2ucp, as well as low and high limits for normalize.

Now start your favorite webcam viewing app and play around with the 2 checkboxes. Note normalize seems to be useless in most cases. If whitebalancing makes a *strongly noticable* difference for your webcam please mail me info about your cam (the usb id), then I can add it to the list of cams which will have the whitebalancing algorithm (and the v4l2 control to enable/disable it) enabled by default.

Unfortunately doing videoprocessing can be quite expensive, as for example whitebalancing is quite hard todo in yuv space, so doing white balancing with the pac7302, with an apps which wants yuv changes the flow from pixart-jpeg -> yuv420 -> rotate90
to:
pixart-jpeg -> rgb24 -> whitebalance -> yuv420 -> rotate90

This is not a problem for cams which deliver (compressed) raw bayer, as bayer is rgb too, so I've implemented a version of the whitebalancing algorithm which operates directly on bayer data, so for bayer cams (like the pac207) it goes from:
bayer-> yuv
to:
bayer -> whitebalance -> yuv

For the near future I plan to change the code so that the analyse phase (which does not get done every frame) creates per component look up tables, this will make it easier to stack multiple "effects" in one pass without special casing it as the current special normalize+whitebalance in one pass code. Then we can add for example gamma correction with a negligible performance impact (when already doing white balancing that is).

libv4l-0.5.97
-------------
* As the version number shows this is a beta release of the 0.6.x series, the big change here is the addition of video processing to libv4l currently this only does whitebalance and normalizing (which turns out to be useless for most cams) but the basic framework for doing video processing, and being able to control it through fake v4l2 controls using for example v4l2ucp is there.
The initial version of this code was written by 3 of my computer science
students: Elmar Kleijn, Sjoerd Piepenbrink and Radjnies Bhansingh
* Currently whitebalancing gets enabled based on USB-ID's and it only gets enabled for Pixart webcam's. You can force it being enabled with other webcams by setting the environment variable LIBV4LCONTROL_CONTROLS, this sets a bitmask enabling certain v4l2 controls which control the video processing set it to 15 to enable both whitebalancing and normalize. You can then change the settings using a v4l2 control panel like v4l2ucp
* Only report / allow supported destination formats in enum_fmt / try_fmt / g_fmt / s_fmt when processing, rotating or flipping.
* Some applications / libs (*cough* gstreamer *cough*) will not work correctly with planar YUV formats when the width is not a multiple of 8, so crop widths which are not a multiple of 8 to the nearest multiple of 8 when converting to planar YUV
* Add dependency generation to libv4l by: Gilles Gigan <[email protected]>
* Add support to use orientation from VIDIOC_ENUMINPUT by:
Adam Baker<[email protected]>
* sn9c20x cams have occasional bad jpeg frames, drop these to avoid the flickering effect they cause, by: Brian Johnson<[email protected]>
* adjust libv4l's upside down cam detection to also work with devices which have the usb interface as parent instead of the usb device
* fix libv4l upside down detection for the new v4l minor numbering scheme
* fix reading outside of the source memory when doing yuv420->rgb conversion

Get it here:
http://people.atrpms.net/~hdegoede/libv4l-0.5.97.tar.gz

Regards,

Hans

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#21 lore raw

Hans,
The patch fixes the problem.

Gilles

Quoted 139 lines · Hans de Goede
Quoted 12 lines · Gilles Gigan

Hans,
I have tested libv4lconvert with a PCI hauppauge hvr1300 DVB-T and found that v4lconvert_create() returns NULL. The problem comes from the shm_open calls in v4lcontrol_create() in libv4lcontrol.c (lines 187&  190). libv4lconvert constructs the shared memory name based on the video device's name. And in this case the video device's name (literally "Hauppauge WinTV-HVR1300 DVB-T/H") contains a slash, which makes both calls to shm_open() fail. I can put together a quick patch to replace '/' with '-' or white spaces if you want. Gilles

Hi,

Thanks for reporting this! Can you please test the attached patch to see if it
fixes this?

Thanks,

Hans

Quoted 111 lines
Quoted 107 lines · Hans de Goede

Hi All,

As the version number shows this is a beta release of the 0.6.x series, the big change here is the addition of video processing to libv4l currently this only does whitebalance and normalizing (which turns out to be useless for most cams) but the basic framework for doing video processing, and being able to control it through fake v4l2 controls using for example v4l2ucp is there.

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams
(which benefit tremendously from this). To test this with other webcams (after instaling this release) do:

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Notice the whitebalance and normalize checkboxes in v4l2ucp, as well as low and high limits for normalize.

Now start your favorite webcam viewing app and play around with the 2 checkboxes. Note normalize seems to be useless in most cases. If whitebalancing makes a *strongly noticable* difference for your webcam please mail me info about your cam (the usb id), then I can add it to the list of cams which will have the whitebalancing algorithm (and the v4l2
control to enable/disable it) enabled by default.

Unfortunately doing videoprocessing can be quite expensive, as for example
whitebalancing is quite hard todo in yuv space, so doing white balancing with the pac7302, with an apps which wants yuv changes the flow from pixart-jpeg ->  yuv420 ->  rotate90
to:
pixart-jpeg ->  rgb24 ->  whitebalance ->  yuv420 ->  rotate90

This is not a problem for cams which deliver (compressed) raw bayer, as bayer is rgb too, so I've implemented a version of the whitebalancing algorithm which operates directly on bayer data, so for bayer cams (like the pac207) it goes from:
bayer->  yuv
to:
bayer ->  whitebalance ->  yuv

For the near future I plan to change the code so that the analyse phase (which does not get done every frame) creates per component look up tables,
this will make it easier to stack multiple "effects" in one pass without special casing it as the current special normalize+whitebalance in one pass code. Then we can add for example gamma correction with a negligible performance impact (when already doing white balancing that is).

libv4l-0.5.97
-------------
* As the version number shows this is a beta release of the 0.6.x series, the big change here is the addition of video processing to libv4l currently this only does whitebalance and normalizing (which turns out to be useless for most cams) but the basic framework for doing video processing, and being able to control it through fake v4l2 controls using
 for example v4l2ucp is there.
 The initial version of this code was written by 3 of my computer science
 students: Elmar Kleijn, Sjoerd Piepenbrink and Radjnies Bhansingh
* Currently whitebalancing gets enabled based on USB-ID's and it only gets
 enabled for Pixart webcam's. You can force it being enabled with other webcams by setting the environment variable LIBV4LCONTROL_CONTROLS, this sets a bitmask enabling certain v4l2 controls which control the video processing set it to 15 to enable both whitebalancing and normalize. You can then change the settings using a v4l2 control panel like v4l2ucp
* Only report / allow supported destination formats in enum_fmt / try_fmt /
 g_fmt / s_fmt when processing, rotating or flipping.
* Some applications / libs (*cough* gstreamer *cough*) will not work correctly with planar YUV formats when the width is not a multiple of 8, so crop widths which are not a multiple of 8 to the nearest multiple of 8
 when converting to planar YUV
* Add dependency generation to libv4l by: Gilles Gigan <[email protected]>
* Add support to use orientation from VIDIOC_ENUMINPUT by:
 Adam Baker<[email protected]>
* sn9c20x cams have occasional bad jpeg frames, drop these to avoid the flickering effect they cause, by: Brian Johnson<[email protected]>
* adjust libv4l's upside down cam detection to also work with devices which have the usb interface as parent instead of the usb device
* fix libv4l upside down detection for the new v4l minor numbering scheme
* fix reading outside of the source memory when doing yuv420->rgb conversion

Get it here:
http://people.atrpms.net/~hdegoede/libv4l-0.5.97.tar.gz

Regards,

Hans

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Hans de Goede
Quoted 13 lines · Hans de Goede
Quoted 11 lines · Adam Baker
Quoted 6 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other webcams (after instaling this release) do:

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the sq905 based camera I can't get it to appear for a pac207 based camera regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 7 lines

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

I've tested it by plugging in the sq905 camera, verifying the whitebablance control is present and working, unplugging the sq905 and plugging in the pac207 and using up arrow to restart v4l2ucp and svv so I think I've eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so not the problem id. I'll have to investigate more thoroughly later.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

Notice the whitebalance and normalize checkboxes in v4l2ucp, as well as low and high limits for normalize.

Now start your favorite webcam viewing app and play around with the 2 checkboxes. Note normalize seems to be useless in most cases. If whitebalancing makes a *strongly noticable* difference for your webcam please mail me info about your cam (the usb id), then I can add it to the list of cams which will have the whitebalancing algorithm (and the v4l2 control to enable/disable it) enabled by default.

Quoted 6 lines
Quoted 3 lines

The whitebalance works really well with the sq905 (ID 2770:9120). Without it the image is very red when using artificial light, with auto whitebalance the colours look slightly desaturated but otherwise fine.

Good to hear it helps for the sq905 too, is that the only know id for sq905 cams ?

Yes

Adam

#4 lore raw
Quoted 20 lines · Adam Baker
Quoted 11 lines · Hans de Goede
Quoted 10 lines · Adam Baker
Quoted 6 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other webcams (after instaling this release) do:

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the sq905 based camera I can't get it to appear for a pac207 based camera regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 7 lines

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

Quoted 6 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance control is present and working, unplugging the sq905 and plugging in the pac207 and using up arrow to restart v4l2ucp and svv so I think I've eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so not the problem id. I'll have to investigate more thoroughly later.

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ? if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

Thanks & Regards,

Hans

#5 lore raw
Quoted 34 lines · Hans de Goede
Quoted 22 lines · Adam Baker
Quoted 13 lines · Hans de Goede
Quoted 6 lines · Adam Baker
Quoted 5 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other
webcams (after instaling this release) do:

Quoted 6 lines
Quoted 2 lines

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the
sq905 based camera I can't get it to appear for a pac207 based camera regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 7 lines

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

Quoted 8 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance
control is present and working, unplugging the sq905 and plugging in the pac207 and using up arrow to restart v4l2ucp and svv so I think I've eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so
not the problem id. I'll have to investigate more thoroughly later.

Quoted 5 lines

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ?
if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

I have the same issue as Adam when trying to test this with my gspca_stv06xx based Quickcam Web camera i. e no whitebalancing controls show up. I'm attaching a dump which logs all available pixformats and v4l2ctrls showing that libv4l is properly loaded. (And yes, LIBV4LCONTROL_CONTROLS is exported and set to 15).

Best regards,
Erik

Quoted 8 lines

Thanks & Regards,

Hans

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

ioctl VIDIOCGTUNER: Invalid argument
ioctl VIDIOCGFBUF: Invalid argument
try direct access to /dev/video0
device /dev/video0 open for read
### video4linux device info [/dev/video0] ###
general info
VIDIOCGCAP
name : "Camera"
type : 0x1 [CAPTURE]
channels : 1
audios : 0
maxwidth : 356
maxheight : 292
minwidth : 48
minheight : 32

channels
VIDIOCGCHAN(0)
channel : 0
name : "STV06xx"
tuners : 0
flags : 0x0 []
type : CAMERA
norm : 0

tuner

audio
VIDIOCGAUDIO
audio : 0
volume : 0
bass : 0
treble : 0

picture
VIDIOCGPICT
brightness : 0
hue : 0
colour : 0
contrast : 0
whiteness : 0
depth : 8
palette : unknown

buffer

window
VIDIOCGWIN
x : 0
y : 0
width : 356
height : 292
chromakey : 0
flags : 0

### v4l2 device info [/dev/video0] ###
general info
VIDIOC_QUERYCAP
driver : "STV06xx"
card : "Camera"
bus_info : "usb-0000:00:1d.0-1"
version : 2.5.0
capabilities : 0x5000001 [VIDEO_CAPTURE,READWRITE,STREAMING]

standards

inputs
VIDIOC_ENUMINPUT(0)
index : 0
name : "STV06xx"
type : CAMERA
audioset : 0
tuner : 0
std : 0x0 []
status : 0x0 []

video capture
VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)
index : 0
type : VIDEO_CAPTURE
flags : 0
description : "GRBG"
pixelformat : 0x47425247 [GRBG]
VIDIOC_ENUM_FMT(1,VIDEO_CAPTURE)
index : 1
type : VIDEO_CAPTURE
flags : 0
description : "RGB3"
pixelformat : 0x33424752 [RGB3]
VIDIOC_ENUM_FMT(2,VIDEO_CAPTURE)
index : 2
type : VIDEO_CAPTURE
flags : 0
description : "BGR3"
pixelformat : 0x33524742 [BGR3]
VIDIOC_ENUM_FMT(3,VIDEO_CAPTURE)
index : 3
type : VIDEO_CAPTURE
flags : 0
description : "YU12"
pixelformat : 0x32315559 [YU12]
VIDIOC_ENUM_FMT(4,VIDEO_CAPTURE)
index : 4
type : VIDEO_CAPTURE
flags : 0
description : "YV12"
pixelformat : 0x32315659 [YV12]
VIDIOC_G_FMT(VIDEO_CAPTURE)
type : VIDEO_CAPTURE
fmt.pix.width : 356
fmt.pix.height : 292
fmt.pix.pixelformat : 0x47425247 [GRBG]
fmt.pix.field : NONE
fmt.pix.bytesperline : 356
fmt.pix.sizeimage : 103952
fmt.pix.colorspace : SRGB
fmt.pix.priv : 0

controls

VIDIOC_QUERYCTRL (9963793)
id : 9963793
type : INTEGER
name : "exposure"
minimum : 0
maximum : 32768
step : 1
default_value : 20000
flags : 0

VIDIOC_QUERYCTRL (9963793 | V4L2_CTRL_FLAG_NEXT_CTRL)
id : 9963795
type : INTEGER
name : "analog gain"
minimum : 0
maximum : 15
step : 1
default_value : 10
flags : 0

VIDIOC_QUERYCTRL (9963795 | V4L2_CTRL_FLAG_NEXT_CTRL)
id : 9963796
type : BOOLEAN
name : "horizontal flip"
minimum : 0
maximum : 1
step : 1
default_value : 0
flags : 0

VIDIOC_QUERYCTRL (9963796 | V4L2_CTRL_FLAG_NEXT_CTRL)
id : 9963797
type : BOOLEAN
name : "vertical flip"
minimum : 0
maximum : 1
step : 1
default_value : 0
flags : 0

VIDIOC_QUERYCTRL (9963797 | V4L2_CTRL_FLAG_NEXT_CTRL)
break

#22 lore raw
In reply to Hans de Goede

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hans de Goede wrote:
[snip]

Quoted 7 lines

libv4l-0.5.97
-------------
* Some applications / libs (*cough* gstreamer *cough*) will not work correctly with planar YUV formats when the width is not a multiple of 8, so crop widths which are not a multiple of 8 to the nearest multiple of 8 when converting to planar YUV

Could you please elaborate how this is supposed to work, because it doesn't with the gspca_stv06xx driver and a sensor supporting raw bayer and 356x292.

Best regards,
Erik

Quoted 14 lines

Get it here:
http://people.atrpms.net/~hdegoede/libv4l-0.5.97.tar.gz

Regards,

Hans

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkno2PsACgkQN7qBt+4UG0GdWQCgiHC3jAVJk8znEgAk0cgrt4Cp Tg0AmQEk4TMJG2l3It7vCa9NKHiZg9eM
=NEdy
-----END PGP SIGNATURE-----

#17 lore raw
In reply to Hans de Goede
Quoted 11 lines · Hans de Goede
Quoted 6 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance control is present and working, unplugging the sq905 and plugging in the pac207 and using up arrow to restart v4l2ucp and svv so I think I've eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so not the problem id. I'll have to investigate more thoroughly later.

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ? if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

No, no / in the device name.

I've tried enabling the logging option in libv4l while running v4l2-ctl -l to list the controls present on each camera but I can't see any significant looking differences in the log other than the the fact the sq905 seems to get many more unsuccessful VIDIOC_QUERYCTRL requests. Unless you have a better idea my next step would be to extend the logging to include the parameters on the VIDIOC_QUERYCTRL ioctls, however my gut feel is that it is related the camera having controls that have CIDs both lower and higher than the ones libv4l adds and libv4l doesn't do anything with the driver returned values if V4L2_CTRL_FLAG_NEXT_CTRL is set.

Adam

normalize_low_bound (int) : min=0 max=127 step=1 default=0 value=0
whitebalance (bool) : default=1 value=1
normalize (bool) : default=0 value=0
normalize_high_bound (int) : min=128 max=255 step=1 default=255 value=255

                     brightness (int)  : min=0 max=255 step=1 default=4 value=4
                       exposure (int)  : min=5 max=26 step=1 default=5 value=5
                      auto_gain (bool) : default=1 value=1
                           gain (int)  : min=0 max=31 step=1 default=9 value=9

libv4l2: open: 3
libv4l2: open 3: setting pixelformat to RGB24
VIDIOC_S_FMT app requesting: RGB3
VIDIOC_S_FMT converting from: BA81
request == VIDIOC_S_FMT
pixelformat: RGB3 320x240
field: 1 bytesperline: 960 imagesize230400
colorspace: 8, priv: 0
result == 0
libv4l2: open 3: done setting pixelformat
request == VIDIOC_QUERYCAP
result == 0
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_G_CTRL
result == 0
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_G_CTRL
result == 0
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_G_CTRL
result == 0
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_G_CTRL
result == 0
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
libv4l2: v4l2 unknown munmap 0xb806d000, 4096
libv4l2: close: 3

libv4l2: open: 3
libv4l2: open 3: setting pixelformat to RGB24
VIDIOC_S_FMT app requesting: RGB3
VIDIOC_S_FMT converting from: P207
request == VIDIOC_S_FMT
pixelformat: RGB3 352x288
field: 1 bytesperline: 1056 imagesize304128
colorspace: 8, priv: 0
result == 0
libv4l2: open 3: done setting pixelformat
request == VIDIOC_QUERYCAP
result == 0
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_G_CTRL
result == 0
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_G_CTRL
result == 0
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_G_CTRL
result == 0
request == VIDIOC_QUERYCTRL
result == 0
request == VIDIOC_G_CTRL
result == 0
request == VIDIOC_QUERYCTRL
result == -1 (Invalid argument)
libv4l2: v4l2 unknown munmap 0xb7ef2000, 4096
libv4l2: close: 3

#18 lore raw
Quoted 14 lines · Adam Baker
Quoted 10 lines · Hans de Goede
Quoted 6 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance control is present and working, unplugging the sq905 and plugging in the pac207 and using up arrow to restart v4l2ucp and svv so I think I've eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so not the problem id. I'll have to investigate more thoroughly later.

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ? if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

No, no / in the device name.

Quoted 10 lines

I've tried enabling the logging option in libv4l while running v4l2-ctl -l to list the controls present on each camera but I can't see any significant looking differences in the log other than the the fact the sq905 seems to get many more unsuccessful VIDIOC_QUERYCTRL requests. Unless you have a better idea my next step would be to extend the logging to include the parameters on the VIDIOC_QUERYCTRL ioctls, however my gut feel is that it is related the camera having controls that have CIDs both lower and higher than the ones libv4l adds and libv4l doesn't do anything with the driver returned values if V4L2_CTRL_FLAG_NEXT_CTRL is set.

Ah, you are using v4l2-ctl, not v4l2ucp, and that uses V4L2_CTRL_FLAG_NEXT_CTRL control enumeration. My code doesn't handle V4L2_CTRL_FLAG_NEXT_CTRL (which is a bug). I'm not sure when I'll have time to fix this. Patches welcome, or in the mean time use v4l2ucp to play with the controls.

Regards,

Hans

#6 lore raw
In reply to Erik Andrén
Quoted 39 lines · Erik Andrén
Quoted 31 lines · Hans de Goede
Quoted 21 lines · Adam Baker
Quoted 13 lines · Hans de Goede
Quoted 6 lines · Adam Baker
Quoted 5 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other
webcams (after instaling this release) do:

Quoted 6 lines
Quoted 2 lines

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the
sq905 based camera I can't get it to appear for a pac207 based camera regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 7 lines

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

Quoted 8 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance
control is present and working, unplugging the sq905 and plugging in the pac207 and using up arrow to restart v4l2ucp and svv so I think I've eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so
not the problem id. I'll have to investigate more thoroughly later.

Quoted 5 lines

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ?
if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

Quoted 9 lines

I have the same issue as Adam when trying to test this with my gspca_stv06xx based Quickcam Web camera i. e no whitebalancing controls show up. I'm attaching a dump which logs all available pixformats and v4l2ctrls showing that libv4l is properly loaded. (And yes, LIBV4LCONTROL_CONTROLS is exported and set to 15).

Best regards,
Erik

Ah, you are using v4l2-ctl, not v4l2ucp, and that uses V4L2_CTRL_FLAG_NEXT_CTRL control enumeration. My code doesn't handle V4L2_CTRL_FLAG_NEXT_CTRL (which is a bug). I'm not sure when I'll have time to fix this. Patches welcome, or in the mean time use v4l2ucp to play with the controls.

Regards,

Hans

#7 lore raw
Quoted 53 lines · Hans de Goede
Quoted 40 lines · Erik Andrén
Quoted 32 lines · Hans de Goede
Quoted 21 lines · Adam Baker
Quoted 13 lines · Hans de Goede
Quoted 6 lines · Adam Baker
Quoted 5 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other
webcams (after instaling this release) do:

Quoted 6 lines
Quoted 2 lines

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the
sq905 based camera I can't get it to appear for a pac207 based camera regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 7 lines

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

Quoted 9 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance
control is present and working, unplugging the sq905 and plugging in the
pac207 and using up arrow to restart v4l2ucp and svv so I think I've eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so
not the problem id. I'll have to investigate more thoroughly later.

Quoted 5 lines

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ?
if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

Quoted 9 lines

I have the same issue as Adam when trying to test this with my gspca_stv06xx based Quickcam Web camera i. e no whitebalancing controls show up. I'm attaching a dump which logs all available pixformats and v4l2ctrls showing that libv4l is properly loaded. (And yes, LIBV4LCONTROL_CONTROLS is exported and set to 15).

Best regards,
Erik

Quoted 8 lines

Ah, you are using v4l2-ctl, not v4l2ucp, and that uses V4L2_CTRL_FLAG_NEXT_CTRL
control enumeration. My code doesn't handle V4L2_CTRL_FLAG_NEXT_CTRL (which is
a bug). I'm not sure when I'll have time to fix this. Patches welcome, or in
the mean time use v4l2ucp to play with the controls.

Actually, I've tried to use both without finding the controls. I've only tried with v4l2ucp v. 1.2. Is 1.3 necessary?

Best regards,
Erik

Quoted 4 lines

Regards,

Hans

#14 lore raw
In reply to Hans de Goede
Quoted 6 lines · Hans de Goede

Ah, you are using v4l2-ctl, not v4l2ucp, and that uses V4L2_CTRL_FLAG_NEXT_CTRL control enumeration. My code doesn't handle V4L2_CTRL_FLAG_NEXT_CTRL (which is a bug). I'm not sure when I'll have time to fix this. Patches welcome, or in the mean time use v4l2ucp to play with the controls.

I tried v4l2ucp first (I rebuilt the Debian package of 1.3 for Ubuntu) and only switched to v4l2-ctl when I wanted something command line oriented to debug with.

Not sure when I'd get time to look at V4L2_CTRL_FLAG_NEXT_CTRL support either but if I find time before you post an update then I think I know how to fix it.

Adam

#15 lore raw

PATCH 1/1 Support V4L2_CTRL_FLAG_NEXT_CTRL for fake controls

The "fake" controls added by libv4l to provide whitebalance on some cameras do not respect the V4L2_CTRL_FLAG_NEXT_CTRL and hence don't appear on control programs that try to use that flag if there are any driver controls that do support the flag. Add support for V4L2_CTRL_FLAG_NEXT_CTRL

---
This isn't extensively tested but v4l2ucp (and my version does use the flag) now lists both fake and original control for a camera with both and adds the fake controls for a camera with none.
---

libv4lconvert/control/libv4lcontrol.c +18 -1
@@ -280,7 +280,10 @@
 {
   int i;
   struct v4l2_queryctrl *ctrl = arg;
+  int retval;
+  __u32 orig_id=ctrl->id;
 
+  /* if we have an exact match return it */
   for (i = 0; i < V4LCONTROL_COUNT; i++)
     if ((data->controls & (1 << i)) &&
 	ctrl->id == fake_controls[i].id) {
@@ -288,7 +291,21 @@
       return 0;
     }
 
-  return syscall(SYS_ioctl, data->fd, VIDIOC_QUERYCTRL, arg);
+  /* find out what the kernel driver would respond. */
+  retval = syscall(SYS_ioctl, data->fd, VIDIOC_QUERYCTRL, arg);
+
+  /* if any of our controls have an id > orig_id but less than
+     ctrl->id then return that control instead. */
+  if (orig_id & V4L2_CTRL_FLAG_NEXT_CTRL)
+    for (i = 0; i < V4LCONTROL_COUNT; i++)
+      if ((data->controls & (1 << i)) &&
+          (fake_controls[i].id > (orig_id & ~V4L2_CTRL_FLAG_NEXT_CTRL)) &&
+          (fake_controls[i].id <= ctrl->id)) {
+        memcpy(ctrl, &fake_controls[i], sizeof(struct v4l2_queryctrl));
+        retval = 0;
+      }
+
+  return retval;
 }
 
 int v4lcontrol_vidioc_g_ctrl(struct v4lcontrol_data *data, void *arg)
#8 lore raw
In reply to Erik Andrén
Quoted 59 lines · Erik Andrén
Quoted 48 lines · Hans de Goede
Quoted 37 lines · Erik Andrén
Quoted 31 lines · Hans de Goede
Quoted 21 lines · Adam Baker
Quoted 13 lines · Hans de Goede
Quoted 6 lines · Adam Baker
Quoted 5 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other
webcams (after instaling this release) do:

Quoted 6 lines
Quoted 2 lines

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the
sq905 based camera I can't get it to appear for a pac207 based camera regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 7 lines

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

Quoted 9 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance
control is present and working, unplugging the sq905 and plugging in the
pac207 and using up arrow to restart v4l2ucp and svv so I think I've eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so
not the problem id. I'll have to investigate more thoroughly later.

Quoted 5 lines

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ?
if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

Quoted 9 lines

I have the same issue as Adam when trying to test this with my gspca_stv06xx based Quickcam Web camera i. e no whitebalancing controls show up. I'm attaching a dump which logs all available pixformats and v4l2ctrls showing that libv4l is properly loaded. (And yes, LIBV4LCONTROL_CONTROLS is exported and set to 15).

Best regards,
Erik

Quoted 8 lines

Ah, you are using v4l2-ctl, not v4l2ucp, and that uses V4L2_CTRL_FLAG_NEXT_CTRL
control enumeration. My code doesn't handle V4L2_CTRL_FLAG_NEXT_CTRL (which is
a bug). I'm not sure when I'll have time to fix this. Patches welcome, or in
the mean time use v4l2ucp to play with the controls.

Quoted 3 lines

Actually, I've tried to use both without finding the controls. I've only tried with v4l2ucp v. 1.2. Is 1.3 necessary?

Apparently there are different versions of v4l2ucp in different distro's and some do use the V4L2_CTRL_FLAG_NEXT_CTRL, just like v4l2-ctl. See Adam Baker's patch later in this thread. Which I will apply to my tree after I've reviewed it (when I find some time currently I've a lot of $work$ )

Regards,

Hans

#9 lore raw

2009/4/19 Hans de Goede <[email protected]>:

Quoted 75 lines · Erik Andrén
Quoted 68 lines
Quoted 57 lines · Hans de Goede
Quoted 46 lines · Erik Andrén
Quoted 39 lines · Hans de Goede
Quoted 28 lines · Adam Baker
Quoted 19 lines · Hans de Goede
Quoted 8 lines · Adam Baker
Quoted 6 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other
webcams (after instaling this release) do:

Quoted 8 lines
Quoted 2 lines

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the
sq905 based camera I can't get it to appear for a pac207 based camera
regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 7 lines

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

Quoted 9 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance
control is present and working, unplugging the sq905 and plugging in the
pac207 and using up arrow to restart v4l2ucp and svv so I think I've eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so
not the problem id. I'll have to investigate more thoroughly later.

Quoted 5 lines

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ?
if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

Quoted 9 lines

I have the same issue as Adam when trying to test this with my gspca_stv06xx based Quickcam Web camera i. e no whitebalancing controls show up. I'm attaching a dump which logs all available pixformats and v4l2ctrls showing that libv4l is properly loaded. (And yes, LIBV4LCONTROL_CONTROLS is exported and set to 15).

Best regards,
Erik

Quoted 8 lines

Ah, you are using v4l2-ctl, not v4l2ucp, and that uses V4L2_CTRL_FLAG_NEXT_CTRL
control enumeration. My code doesn't handle V4L2_CTRL_FLAG_NEXT_CTRL (which is
a bug). I'm not sure when I'll have time to fix this. Patches welcome, or in
the mean time use v4l2ucp to play with the controls.

Quoted 3 lines

Actually, I've tried to use both without finding the controls. I've only tried with v4l2ucp v. 1.2. Is 1.3 necessary?

Quoted 6 lines

Apparently there are different versions of v4l2ucp in different distro's and some do use the V4L2_CTRL_FLAG_NEXT_CTRL, just like v4l2-ctl. See Adam Baker's patch later in this thread. Which I will apply to my tree after I've reviewed it (when I find some time currently I've a lot of $work$ )

Applying Adam Bakers patch makes the control appear _but_ I can't seem to make out any difference when any of the whitebalancing and normalize options, regardless of how i tweak the max / min values.

Best regards,
Erik

Quoted 4 lines

Regards,

Hans

#10 lore raw
Quoted 70 lines · Erik Andrén

2009/4/19 Hans de Goede<[email protected]>:

Quoted 59 lines · Erik Andrén
Quoted 57 lines
Quoted 56 lines · Hans de Goede
Quoted 38 lines · Erik Andrén
Quoted 32 lines · Hans de Goede
Quoted 22 lines · Adam Baker
Quoted 14 lines · Hans de Goede
Quoted 6 lines · Adam Baker
Quoted 5 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac) webcams (which benefit tremendously from this). To test this with other
webcams (after instaling this release) do:

Quoted 7 lines
Quoted 2 lines

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the
sq905 based camera I can't get it to appear for a pac207 based camera
regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 7 lines

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

Quoted 9 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance
control is present and working, unplugging the sq905 and plugging in the
pac207 and using up arrow to restart v4l2ucp and svv so I think I've eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so
not the problem id. I'll have to investigate more thoroughly later.

Quoted 5 lines

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ?
if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

Quoted 9 lines

I have the same issue as Adam when trying to test this with my gspca_stv06xx based Quickcam Web camera i. e no whitebalancing controls show up. I'm attaching a dump which logs all available pixformats and v4l2ctrls showing that libv4l is properly loaded. (And yes, LIBV4LCONTROL_CONTROLS is exported and set to 15).

Best regards,
Erik

Ah, you are using v4l2-ctl, not v4l2ucp, and that uses V4L2_CTRL_FLAG_NEXT_CTRL
control enumeration. My code doesn't handle V4L2_CTRL_FLAG_NEXT_CTRL (which is
a bug). I'm not sure when I'll have time to fix this. Patches welcome, or in
the mean time use v4l2ucp to play with the controls.

Quoted 9 lines
Quoted 3 lines

Actually, I've tried to use both without finding the controls. I've only tried with v4l2ucp v. 1.2. Is 1.3 necessary?

Apparently there are different versions of v4l2ucp in different distro's and some do use the V4L2_CTRL_FLAG_NEXT_CTRL, just like v4l2-ctl. See Adam Baker's patch later in this thread. Which I will apply to my tree after I've reviewed it (when I find some time currently I've a lot of $work$ )

Quoted 4 lines

Applying Adam Bakers patch makes the control appear _but_ I can't seem to make out any difference when any of the whitebalancing and normalize options, regardless of how i tweak the max / min values.

Did you also do the
export LIBV4LCONTROL_CONTROLS=15

In the terminal from where you are starting the viewing application ?

Regards,

Hans

#11 lore raw
Quoted 83 lines · Hans de Goede
Quoted 75 lines · Erik Andrén

2009/4/19 Hans de Goede<[email protected]>:

Quoted 66 lines · Erik Andrén
Quoted 61 lines
Quoted 52 lines · Hans de Goede
Quoted 42 lines · Erik Andrén
Quoted 36 lines · Hans de Goede
Quoted 24 lines · Adam Baker
Quoted 16 lines · Hans de Goede
Quoted 8 lines · Adam Baker
Quoted 7 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac)
webcams (which benefit tremendously from this). To test this with
other
webcams (after instaling this release) do:

Quoted 7 lines
Quoted 2 lines

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the
sq905 based camera I can't get it to appear for a pac207 based camera
regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 7 lines

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

Quoted 11 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance
control is present and working, unplugging the sq905 and plugging in
the
pac207 and using up arrow to restart v4l2ucp and svv so I think I've
eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so
not the problem id. I'll have to investigate more thoroughly later.

Quoted 5 lines

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ?
if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

Quoted 9 lines

I have the same issue as Adam when trying to test this with my gspca_stv06xx based Quickcam Web camera i. e no whitebalancing controls show up. I'm attaching a dump which logs all available pixformats and v4l2ctrls showing that libv4l is properly loaded. (And yes, LIBV4LCONTROL_CONTROLS is exported and set to 15).

Best regards,
Erik

Quoted 8 lines

Ah, you are using v4l2-ctl, not v4l2ucp, and that uses V4L2_CTRL_FLAG_NEXT_CTRL
control enumeration. My code doesn't handle V4L2_CTRL_FLAG_NEXT_CTRL (which is
a bug). I'm not sure when I'll have time to fix this. Patches welcome, or in
the mean time use v4l2ucp to play with the controls.

Quoted 3 lines

Actually, I've tried to use both without finding the controls. I've only tried with v4l2ucp v. 1.2. Is 1.3 necessary?

Quoted 7 lines

Apparently there are different versions of v4l2ucp in different distro's and some do use the V4L2_CTRL_FLAG_NEXT_CTRL, just like v4l2-ctl. See Adam Baker's patch later in this thread. Which I will apply to my tree after I've reviewed it (when I find some time currently I've a lot of
$work$ )

Quoted 4 lines

Applying Adam Bakers patch makes the control appear _but_ I can't seem to make out any difference when any of the whitebalancing and normalize options, regardless of how i tweak the max / min values.

Quoted 5 lines

Did you also do the
export LIBV4LCONTROL_CONTROLS=15

In the terminal from where you are starting the viewing application ?

Yes.

Quoted 4 lines

Regards,

Hans

#12 lore raw
Quoted 81 lines · Erik Andrén
Quoted 79 lines · Hans de Goede
Quoted 77 lines · Erik Andrén

2009/4/19 Hans de Goede<[email protected]>:

Quoted 65 lines · Erik Andrén
Quoted 61 lines
Quoted 52 lines · Hans de Goede
Quoted 42 lines · Erik Andrén
Quoted 36 lines · Hans de Goede
Quoted 24 lines · Adam Baker
Quoted 16 lines · Hans de Goede
Quoted 8 lines · Adam Baker
Quoted 7 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts (pac)
webcams (which benefit tremendously from this). To test this with
other
webcams (after instaling this release) do:

Quoted 7 lines
Quoted 2 lines

export LIBV4LCONTROL_CONTROLS=15 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Strangely while those instructions give me a whitebalance control for the
sq905 based camera I can't get it to appear for a pac207 based camera
regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 7 lines

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

Quoted 11 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance
control is present and working, unplugging the sq905 and plugging in
the
pac207 and using up arrow to restart v4l2ucp and svv so I think I've
eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so
not the problem id. I'll have to investigate more thoroughly later.

Quoted 5 lines

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ?
if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

Quoted 9 lines

I have the same issue as Adam when trying to test this with my gspca_stv06xx based Quickcam Web camera i. e no whitebalancing controls show up. I'm attaching a dump which logs all available pixformats and v4l2ctrls showing that libv4l is properly loaded. (And yes, LIBV4LCONTROL_CONTROLS is exported and set to 15).

Best regards,
Erik

Quoted 8 lines

Ah, you are using v4l2-ctl, not v4l2ucp, and that uses V4L2_CTRL_FLAG_NEXT_CTRL
control enumeration. My code doesn't handle V4L2_CTRL_FLAG_NEXT_CTRL (which is
a bug). I'm not sure when I'll have time to fix this. Patches welcome, or in
the mean time use v4l2ucp to play with the controls.

Quoted 3 lines

Actually, I've tried to use both without finding the controls. I've only tried with v4l2ucp v. 1.2. Is 1.3 necessary?

Quoted 7 lines

Apparently there are different versions of v4l2ucp in different distro's and some do use the V4L2_CTRL_FLAG_NEXT_CTRL, just like v4l2-ctl. See Adam Baker's patch later in this thread. Which I will apply to my tree after I've reviewed it (when I find some time currently I've a lot of
$work$ )

Applying Adam Bakers patch makes the control appear _but_ I can't seem to make out any difference when any of the whitebalancing and normalize options, regardless of how i tweak the max / min values.

Quoted 8 lines
Quoted 5 lines

Did you also do the
export LIBV4LCONTROL_CONTROLS=15

In the terminal from where you are starting the viewing application ?

Yes.

Hmm,

Then the camera you are using probably already has some whitebalancing itself using the same algorithm. What happens if you enable normalize and then lower the high bound significantly? If that doesn't do anything either then somehow things are not working.

Regards,

Hans

#13 lore raw

2009/4/20 Hans de Goede <[email protected]>:

Quoted 109 lines · Erik Andrén
Quoted 97 lines
Quoted 95 lines · Hans de Goede
Quoted 93 lines · Erik Andrén

2009/4/19 Hans de Goede<[email protected]>:

Quoted 79 lines · Erik Andrén
Quoted 74 lines
Quoted 63 lines · Hans de Goede
Quoted 52 lines · Erik Andrén
Quoted 45 lines · Hans de Goede
Quoted 31 lines · Adam Baker
Quoted 22 lines · Hans de Goede
Quoted 13 lines · Adam Baker
Quoted 10 lines · Hans de Goede

Currently only whitebalancing is enabled and only on Pixarts
(pac)
webcams (which benefit tremendously from this). To test this
with
other
webcams (after instaling this release) do:

export LIBV4LCONTROL_CONTROLS=15
LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2ucp&

Quoted 6 lines

Strangely while those instructions give me a whitebalance control
for the
sq905 based camera I can't get it to appear for a pac207 based camera
regardless of whether LIBV4LCONTROL_CONTROLS is set.

Quoted 7 lines

Thats weird, there is a small bug in the handling of pac207 cams with usb id 093a:2476 causing libv4l to not automatically enable whitebalancing (and the control) for cams with that id, but if you have LIBV4LCONTROL_CONTROLS set (exported!) both when loading v4l2ucp (you must preload v4l2convert.so!) and when loading your viewer, then it should work.

Quoted 12 lines

I've tested it by plugging in the sq905 camera, verifying the whitebablance
control is present and working, unplugging the sq905 and plugging in
the
pac207 and using up arrow to restart v4l2ucp and svv so I think I've
eliminated most finger trouble possibilities. The pac207 is id 093a:2460 so
not the problem id. I'll have to investigate more thoroughly later.

Quoted 5 lines

Does the pac207 perhaps have a / in its "card" string (see v4l-info output) ?
if so try out this patch:
http://linuxtv.org/hg/~hgoede/libv4l/rev/1e08d865690a

Quoted 9 lines

I have the same issue as Adam when trying to test this with my gspca_stv06xx based Quickcam Web camera i. e no whitebalancing controls show up. I'm attaching a dump which logs all available pixformats and v4l2ctrls showing that libv4l is properly loaded. (And yes, LIBV4LCONTROL_CONTROLS is exported and set to 15).

Best regards,
Erik

Quoted 9 lines

Ah, you are using v4l2-ctl, not v4l2ucp, and that uses V4L2_CTRL_FLAG_NEXT_CTRL
control enumeration. My code doesn't handle V4L2_CTRL_FLAG_NEXT_CTRL (which is
a bug). I'm not sure when I'll have time to fix this. Patches welcome,
or in
the mean time use v4l2ucp to play with the controls.

Quoted 3 lines

Actually, I've tried to use both without finding the controls. I've only tried with v4l2ucp v. 1.2. Is 1.3 necessary?

Quoted 8 lines

Apparently there are different versions of v4l2ucp in different distro's
and some do use the V4L2_CTRL_FLAG_NEXT_CTRL, just like v4l2-ctl. See Adam Baker's patch later in this thread. Which I will apply to my tree after I've reviewed it (when I find some time currently I've a lot of
$work$ )

Applying Adam Bakers patch makes the control appear _but_ I can't seem to make out any difference when any of the whitebalancing and normalize options, regardless of how i tweak the max / min values.

Quoted 8 lines
Quoted 5 lines

Did you also do the
export LIBV4LCONTROL_CONTROLS=15

In the terminal from where you are starting the viewing application ?

Yes.

Quoted 7 lines

Hmm,

Then the camera you are using probably already has some whitebalancing itself using the same algorithm. What happens if you enable normalize and then lower the high bound significantly? If that doesn't do anything either then somehow things are not working.

I don't think this sensor/camera has any whitebalancing as the image quality is fine in normal daylight but gets yellowtones when using lightbulbs.
I'll add some printks to libv4l to verify that the whitebalance processing routines are actually called and get back to you with the results.

Best regards,
Erik

Quoted 4 lines

Regards,

Hans

#16 lore raw

Re: [PATCH][libv4l] Support V4L2_CTRL_FLAG_NEXT_CTRL for fake controls

In reply to Adam Baker
Quoted 6 lines · Adam Baker

The "fake" controls added by libv4l to provide whitebalance on some cameras do not respect the V4L2_CTRL_FLAG_NEXT_CTRL and hence don't appear on control programs that try to use that flag if there are any driver controls that do support the flag. Add support for V4L2_CTRL_FLAG_NEXT_CTRL

Thanks, reviewed and tested looks fine, so it has been applied to my tree:
http://linuxtv.org/hg/~hgoede/libv4l

And will be in the next libv4l release.

Regards,

Hans