diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-04-03 14:28:40 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-12-14 17:45:08 +0100 |
commit | b8d3cf092c9b07cfd909552a3c160b7db3b5a91d (patch) | |
tree | 8731250ff6c96d412379e1a912d528b0faeb8d62 | |
parent | bcc6270bac5b26c1b6f2cfe0de870e3472bc0369 (diff) | |
download | libva-b8d3cf092c9b07cfd909552a3c160b7db3b5a91d.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.h | 2 | ||||
-rw-r--r-- | va/va_vpp.h | 60 |
2 files changed, 62 insertions, 0 deletions
@@ -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 fcbb196..fea5aca 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. */ @@ -373,6 +412,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. */ @@ -512,6 +553,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 |