summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-04-03 14:28:40 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-08-27 11:16:43 +0200
commitc20b5fc7c8d21f53f4b646a0812832ea001d04c8 (patch)
tree10f54f9d70924f1857fba584f9cc2699fda35cbc
parent8b374ab6702beee64a886db3e921a12ca54a885e (diff)
downloadlibva-c20b5fc7c8d21f53f4b646a0812832ea001d04c8.tar.gz
API: vpp: add blend state for composition.
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@intel.com>
-rw-r--r--va/va.h2
-rw-r--r--va/va_vpp.h60
2 files changed, 62 insertions, 0 deletions
diff --git a/va/va.h b/va/va.h
index c30ec53..7f1ec61 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 9aed5d8..c94028f 100644
--- a/va/va_vpp.h
+++ b/va/va_vpp.h
@@ -310,6 +310,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. */
@@ -371,6 +410,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. */
@@ -510,6 +551,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