Re: [PATCH/RFC 1/2] v4l: Add a global color alpha control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Thursday 24 November 2011 13:22:10 Hans Verkuil wrote:
> On Thursday, November 24, 2011 13:06:09 Laurent Pinchart wrote:
> > On Thursday 24 November 2011 12:49:00 Hans Verkuil wrote:
> > > On Thursday, November 24, 2011 12:39:54 Sylwester Nawrocki wrote:
> > > > On 11/24/2011 12:09 PM, Laurent Pinchart wrote:
> > > > > On Thursday 24 November 2011 12:00:45 Hans Verkuil wrote:
> > > > >> On Thursday, November 24, 2011 11:53:16 Sylwester Nawrocki wrote:
> > > > >>> This control is intended for video capture or memory-to-memory
> > > > >>> devices that are capable of setting up the alpha conponent to
> > > > >>> some arbitrary value.
> > > > >>> The V4L2_CID_COLOR_ALPHA control allows to set the alpha channel
> > > > >>> globally to a value in range from 0 to 255.
> > > > >>> 
> > > > >>> Signed-off-by: Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx>
> > > > >>> Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
> > > > >>> ---
> > > > >>> 
> > > > >>>  Documentation/DocBook/media/v4l/controls.xml       |   20
> > > > >>>  ++++++++++++++------ .../DocBook/media/v4l/pixfmt-packed-rgb.xml
> > > > >>>  
> > > > >>>  |    7 +++++-- drivers/media/video/v4l2-ctrls.c                 
> > > > >>>  |     |
> > > > >>>  
> > > > >>>  7 +++++++ include/linux/videodev2.h                          |  
> > > > >>>   6 +++--- 4 files changed, 29 insertions(+), 11 deletions(-)
> > > > >>> 
> > > > >>> diff --git a/Documentation/DocBook/media/v4l/controls.xml
> > > > >>> b/Documentation/DocBook/media/v4l/controls.xml index
> > > > >>> 3bc5ee8..7f99222 100644
> > > > >>> --- a/Documentation/DocBook/media/v4l/controls.xml
> > > > >>> +++ b/Documentation/DocBook/media/v4l/controls.xml
> > > > >>> @@ -324,12 +324,6 @@ minimum value disables backlight
> > > > >>> compensation.</entry>
> > > > >>> 
> > > > >>>  		(usually a microscope).</entry>
> > > > >>>  		
> > > > >>>  	  </row>
> > > > >>>  	  <row>
> > > > >>> 
> > > > >>> -	    <entry><constant>V4L2_CID_LASTP1</constant></entry>
> > > > >>> -	    <entry></entry>
> > > > >>> -	    <entry>End of the predefined control IDs (currently
> > > > >>> -<constant>V4L2_CID_ILLUMINATORS_2</constant> + 1).</entry>
> > > > >>> -	  </row>
> > > > >>> -	  <row>
> > > > >>> 
> > > > >>>  	    
<entry><constant>V4L2_CID_MIN_BUFFERS_FOR_CAPTURE</constant
> > > > >>>  	    ></e ntry
> > > > >>>  	    
> > > > >>>  	    > <entry>integer</entry>
> > > > >>>  	    
> > > > >>>  	    <entry>This is a read-only control that can be read by the
> > > > >>>  	    application
> > > > >>> 
> > > > >>> @@ -345,6 +339,20 @@ and used as a hint to determine the number
> > > > >>> of OUTPUT buffers to pass to REQBUFS.
> > > > >>> 
> > > > >>>  The value is the minimum number of OUTPUT buffers that is
> > > > >>>  necessary for hardware to work.</entry>
> > > > >>>  
> > > > >>>  	  </row>
> > > > >>> 
> > > > >>> +	  <row id="v4l2-color-alpha">
> > > > >>> +	    <entry><constant>V4L2_CID_COLOR_ALPHA</constant></entry>
> > > > >>> +	    <entry>integer</entry>
> > > > >>> +	    <entry> Sets the color alpha component on the capture
> > > > >>> device. It is +	    applicable to any pixel formats that contain
> > > > >>> the alpha component, +	    e.g. <link
> > > > >>> linkend="rgb-formats">packed RGB image formats</link>. +	   
> > > > >>> </entry>
> > > > > 
> > > > > As the alpha value is global, isn't it applicable to formats with
> > > > > no alpha component as well ?
> > > > 
> > > > Hmm, I can't say no.. The control was intended as a means of setting
> > > > up the alpha value for packed RGB formats:
> > > > http://linuxtv.org/downloads/v4l-dvb-apis/packed-rgb.html#rgb-formats
> > > > 
> > > > However it could well be used for formats with no alpha. Do you think
> > > > the second sentence above should be removed or should something else
> > > > be added to indicate it doesn't necessarily have to have a
> > > > connection with ARGB color formats ?
> > 
> > I think we should make it explicit that this global alpha value is
> > applied in addition to a possibly per-pixel alpha value (if available in
> > the selected format).
> > 
> > > Huh? How can this be used for formats without an alpha channel?
> > 
> > If my understanding is correct, this control sets a global alpha value
> > for the whole overlay. For instance, with V4L2_CID_COLOR_ALPHA set to
> > 0.5, an overlay using a non-alpha format (such as YUYV), or an overlay
> > using an alpha format with the alpha value set to 1 for every pixel,
> > would be half transparent.
> > 
> > In other words, the resulting alpha value is the product of the global
> > alpha value and the per-pixel alpha value. Non-alpha formats have an
> > implicit per- pixel alpha value equal to 1 for every pixel.
> 
> Well, if that's the case, then we already have an API for that
> (http://hverkuil.home.xs4all.nl/spec/media.html#v4l2-window, field
> global_alpha).
> 
> It was my understanding that this is used with a mem2mem device where you
> just want to fill in the alpha channel to the desired value. It's not used
> inside the device at all (that happens later in the pipeline).

OK, now I understand. Maybe the documentation should describe this a bit more 
explicitly ?

-- 
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux