[media] v4l: Add premultiplied alpha flag for pixel formats
When set, the new V4L2_PIX_FMT_FLAG_PREMUL_ALPHA flag indicates that the pixel values are premultiplied by the alpha channel value. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
Родитель
d52e238136
Коммит
c96fd46afb
|
@ -135,6 +135,12 @@ extended fields were set to zero. On return drivers must set the
|
||||||
<constant>V4L2_PIX_FMT_PRIV_MAGIC</constant> and all the extended fields to
|
<constant>V4L2_PIX_FMT_PRIV_MAGIC</constant> and all the extended fields to
|
||||||
applicable values.</para></entry>
|
applicable values.</para></entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>__u32</entry>
|
||||||
|
<entry><structfield>flags</structfield></entry>
|
||||||
|
<entry>Flags set by the application or driver, see <xref
|
||||||
|
linkend="format-flags" />.</entry>
|
||||||
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</table>
|
</table>
|
||||||
|
@ -220,9 +226,15 @@ codes can be used.</entry>
|
||||||
and the number of valid entries in the
|
and the number of valid entries in the
|
||||||
<structfield>plane_fmt</structfield> array.</entry>
|
<structfield>plane_fmt</structfield> array.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>__u8</entry>
|
||||||
|
<entry><structfield>flags</structfield></entry>
|
||||||
|
<entry>Flags set by the application or driver, see <xref
|
||||||
|
linkend="format-flags" />.</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>__u8</entry>
|
<entry>__u8</entry>
|
||||||
<entry><structfield>reserved[11]</structfield></entry>
|
<entry><structfield>reserved[10]</structfield></entry>
|
||||||
<entry>Reserved for future extensions. Should be zeroed by the
|
<entry>Reserved for future extensions. Should be zeroed by the
|
||||||
application.</entry>
|
application.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
@ -1079,4 +1091,21 @@ concatenated to form the JPEG stream. </para>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<table frame="none" pgwide="1" id="format-flags">
|
||||||
|
<title>Format Flags</title>
|
||||||
|
<tgroup cols="3">
|
||||||
|
&cs-def;
|
||||||
|
<tbody valign="top">
|
||||||
|
<row>
|
||||||
|
<entry><constant>V4L2_PIX_FMT_FLAG_PREMUL_ALPHA</constant></entry>
|
||||||
|
<entry>0x00000001</entry>
|
||||||
|
<entry>The color values are premultiplied by the alpha channel
|
||||||
|
value. For example, if a light blue pixel with 50% transparency was described by
|
||||||
|
RGBA values (128, 192, 255, 128), the same pixel described with premultiplied
|
||||||
|
colors would be described by RGBA values (64, 96, 128, 128) </entry>
|
||||||
|
</row>
|
||||||
|
</tbody>
|
||||||
|
</tgroup>
|
||||||
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -155,7 +155,7 @@ applications. -->
|
||||||
<revnumber>3.16</revnumber>
|
<revnumber>3.16</revnumber>
|
||||||
<date>2014-05-27</date>
|
<date>2014-05-27</date>
|
||||||
<authorinitials>lp</authorinitials>
|
<authorinitials>lp</authorinitials>
|
||||||
<revremark>Extended &v4l2-pix-format;.
|
<revremark>Extended &v4l2-pix-format;. Added format flags.
|
||||||
</revremark>
|
</revremark>
|
||||||
</revision>
|
</revision>
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,8 @@ static void v4l_print_format(const void *arg, bool write_only)
|
||||||
pix = &p->fmt.pix;
|
pix = &p->fmt.pix;
|
||||||
pr_cont(", width=%u, height=%u, "
|
pr_cont(", width=%u, height=%u, "
|
||||||
"pixelformat=%c%c%c%c, field=%s, "
|
"pixelformat=%c%c%c%c, field=%s, "
|
||||||
"bytesperline=%u, sizeimage=%u, colorspace=%d\n",
|
"bytesperline=%u, sizeimage=%u, colorspace=%d, "
|
||||||
|
"flags %u\n",
|
||||||
pix->width, pix->height,
|
pix->width, pix->height,
|
||||||
(pix->pixelformat & 0xff),
|
(pix->pixelformat & 0xff),
|
||||||
(pix->pixelformat >> 8) & 0xff,
|
(pix->pixelformat >> 8) & 0xff,
|
||||||
|
@ -264,7 +265,7 @@ static void v4l_print_format(const void *arg, bool write_only)
|
||||||
(pix->pixelformat >> 24) & 0xff,
|
(pix->pixelformat >> 24) & 0xff,
|
||||||
prt_names(pix->field, v4l2_field_names),
|
prt_names(pix->field, v4l2_field_names),
|
||||||
pix->bytesperline, pix->sizeimage,
|
pix->bytesperline, pix->sizeimage,
|
||||||
pix->colorspace);
|
pix->colorspace, pix->flags);
|
||||||
break;
|
break;
|
||||||
case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
|
case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
|
||||||
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
|
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
|
||||||
|
|
|
@ -288,6 +288,7 @@ struct v4l2_pix_format {
|
||||||
__u32 sizeimage;
|
__u32 sizeimage;
|
||||||
__u32 colorspace; /* enum v4l2_colorspace */
|
__u32 colorspace; /* enum v4l2_colorspace */
|
||||||
__u32 priv; /* private data, depends on pixelformat */
|
__u32 priv; /* private data, depends on pixelformat */
|
||||||
|
__u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Pixel format FOURCC depth Description */
|
/* Pixel format FOURCC depth Description */
|
||||||
|
@ -452,6 +453,9 @@ struct v4l2_pix_format {
|
||||||
/* priv field value to indicates that subsequent fields are valid. */
|
/* priv field value to indicates that subsequent fields are valid. */
|
||||||
#define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe
|
#define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe
|
||||||
|
|
||||||
|
/* Flags */
|
||||||
|
#define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA 0x00000001
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* F O R M A T E N U M E R A T I O N
|
* F O R M A T E N U M E R A T I O N
|
||||||
*/
|
*/
|
||||||
|
@ -1754,6 +1758,7 @@ struct v4l2_plane_pix_format {
|
||||||
* @colorspace: enum v4l2_colorspace; supplemental to pixelformat
|
* @colorspace: enum v4l2_colorspace; supplemental to pixelformat
|
||||||
* @plane_fmt: per-plane information
|
* @plane_fmt: per-plane information
|
||||||
* @num_planes: number of planes for this format
|
* @num_planes: number of planes for this format
|
||||||
|
* @flags: format flags (V4L2_PIX_FMT_FLAG_*)
|
||||||
*/
|
*/
|
||||||
struct v4l2_pix_format_mplane {
|
struct v4l2_pix_format_mplane {
|
||||||
__u32 width;
|
__u32 width;
|
||||||
|
@ -1764,7 +1769,8 @@ struct v4l2_pix_format_mplane {
|
||||||
|
|
||||||
struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
|
struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
|
||||||
__u8 num_planes;
|
__u8 num_planes;
|
||||||
__u8 reserved[11];
|
__u8 flags;
|
||||||
|
__u8 reserved[10];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче