[Libva] [PATCH 2/2] API: vpp: add blend state for composition.
Gwenole Beauchesne
gb.devel at gmail.com
Fri Jul 13 05:56:34 PDT 2012
Add a new VABlendState structure that defines the blending operations for
composition. So far, only luma keying, alpha blending and premultiplied
alpha are supported.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
va/va.h | 2 ++
va/va_vpp.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
diff --git a/va/va.h b/va/va.h
index 0daad64..6f589b1 100644
--- a/va/va.h
+++ b/va/va.h
@@ -179,6 +179,8 @@ typedef int VAStatus; /* Return status type from functions */
#define VA_STATUS_ERROR_INVALID_FILTER_CHAIN 0x00000021
/** \brief Indicate HW busy (e.g. run multiple encoding simultaneously). */
#define VA_STATUS_ERROR_HW_BUSY 0x00000022
+/** \brief An invalid blend state was supplied. */
+#define VA_STATUS_ERROR_INVALID_BLEND_STATE 0x00000023
#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
/* De-interlacing flags for vaPutSurface() */
diff --git a/va/va_vpp.h b/va/va_vpp.h
index 1f2acbc..d96c33f 100644
--- a/va/va_vpp.h
+++ b/va/va_vpp.h
@@ -312,6 +312,45 @@ typedef enum _VAProcColorStandardType {
VAProcColorStandardCount
} VAProcColorStandardType;
+/** @name Video blending flags */
+/**@{*/
+/** \brief Global alpha blending. */
+#define VA_BLEND_GLOBAL_ALPHA 0x0002
+/** \brief Premultiplied alpha blending (RGBA surfaces only). */
+#define VA_BLEND_PREMULTIPLIED_ALPHA 0x0008
+/** \brief Luma color key (YUV surfaces only). */
+#define VA_BLEND_LUMA_KEY 0x0010
+/**@}*/
+
+/** \brief Video blending state definition. */
+typedef struct _VABlendState {
+ /** \brief Video blending flags. */
+ unsigned int flags;
+ /**
+ * \brief Global alpha value.
+ *
+ * Valid if \flags has VA_BLEND_GLOBAL_ALPHA.
+ * Valid range is 0.0 to 1.0 inclusive.
+ */
+ float global_alpha;
+ /**
+ * \brief Minimum luma value.
+ *
+ * Valid if \flags has VA_BLEND_LUMA_KEY.
+ * Valid range is 0.0 to 1.0 inclusive.
+ * \ref min_luma shall be set to a sensible value lower than \ref max_luma.
+ */
+ float min_luma;
+ /**
+ * \brief Maximum luma value.
+ *
+ * Valid if \flags has VA_BLEND_LUMA_KEY.
+ * Valid range is 0.0 to 1.0 inclusive.
+ * \ref max_luma shall be set to a sensible value larger than \ref min_luma.
+ */
+ float max_luma;
+} VABlendState;
+
/** @name Video pipeline flags */
/**@{*/
/** \brief Specifies whether to apply subpictures when processing a surface. */
@@ -367,6 +406,8 @@ typedef struct _VAProcPipelineCaps {
* \endcode
*/
unsigned int rotation_flags;
+ /** \brief Blend flags. See "Video blending flags". */
+ unsigned int blend_flags;
/** \brief Number of forward reference frames that are needed. */
unsigned int num_forward_references;
/** \brief Number of backward reference frames that are needed. */
@@ -506,6 +547,25 @@ typedef struct _VAProcPipelineParameterBuffer {
*/
unsigned int rotation_state;
/**
+ * \brief blending state. See "Video blending state definition".
+ *
+ * If \ref blend_state is NULL, then default operation mode depends
+ * on the source \ref surface format:
+ * - RGB: per-pixel alpha blending ;
+ * - YUV: no blending, i.e override the underlying pixels.
+ *
+ * Otherwise, \ref blend_state is a pointer to a #VABlendState
+ * structure that shall be live until vaEndPicture().
+ *
+ * Implementation note: the driver is responsible for checking the
+ * blend state flags against the actual source \ref surface format.
+ * e.g. premultiplied alpha blending is only applicable to RGB
+ * surfaces, and luma keying is only applicable to YUV surfaces.
+ * If a mismatch occurs, then #VA_STATUS_ERROR_INVALID_BLEND_STATE
+ * is returned.
+ */
+ const VABlendState *blend_state;
+ /**
* \brief Pipeline filters. See video pipeline flags.
*
* Flags to control the pipeline, like whether to apply subpictures
--
1.7.9.5
More information about the Libva
mailing list