OSDN Git Service

va.h: fix comments error for arbitrary number of MBs per slice.
[android-x86/hardware-intel-common-libva.git] / va / va.h
diff --git a/va/va.h b/va/va.h
index bc01e83..a0eb02f 100644 (file)
--- a/va/va.h
+++ b/va/va.h
  *  contributed to various aspects of the API.
  */
 
+/**
+ * \file va.h
+ * \brief The Core API
+ *
+ * This file contains the \ref api_core "Core API".
+ */
+
 #ifndef _VA_H_
 #define _VA_H_
 
+#include <stddef.h>
+#include <stdint.h>
 #include <va/va_version.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/* 
+/**
+ * \mainpage Video Acceleration (VA) API
+ *
+ * \section intro Introduction
+ *
+ * The main motivation for VA-API (Video Acceleration API) is to
+ * enable hardware accelerated video decode and encode at various
+ * entry-points (VLD, IDCT, Motion Compensation etc.) for the
+ * prevailing coding standards today (MPEG-2, MPEG-4 ASP/H.263, MPEG-4
+ * AVC/H.264, VC-1/VMW3, and JPEG).
+ *
+ * VA-API is split into several modules:
+ * - \ref api_core
+ * - \ref api_enc_h264
+ * - \ref api_vpp
+ */
+
+/**
+ * \defgroup api_core Core API
+ *
+ * @{
+ */
+
+/**
 Overview 
 
 The VA API is intended to provide an interface between a video decode/encode/display
@@ -107,8 +139,8 @@ Initialization & Configuration Management
 
 typedef void* VADisplay;       /* window system dependent */
 
-typedef int VAStatus;  /* Return status type from functions */
-/* Values for the return status */
+typedef int VAStatus;  /** Return status type from functions */
+/** Values for the return status */
 #define VA_STATUS_SUCCESS                      0x00000000
 #define VA_STATUS_ERROR_OPERATION_FAILED       0x00000001
 #define VA_STATUS_ERROR_ALLOCATION_FAILED      0x00000002
@@ -142,14 +174,22 @@ typedef int VAStatus;     /* Return status type from functions */
  * of generic attribute values.
  */
 #define VA_STATUS_ERROR_INVALID_VALUE           0x00000019
+/** \brief An unsupported filter was supplied. */
+#define VA_STATUS_ERROR_UNSUPPORTED_FILTER      0x00000020
+/** \brief An invalid filter chain was supplied. */
+#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 unsupported memory type was supplied. */
+#define VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE 0x00000024
 #define VA_STATUS_ERROR_UNKNOWN                        0xFFFFFFFF
 
-/* De-interlacing flags for vaPutSurface() */
+/** De-interlacing flags for vaPutSurface() */
 #define VA_FRAME_PICTURE        0x00000000 
 #define VA_TOP_FIELD            0x00000001
 #define VA_BOTTOM_FIELD         0x00000002
 
-/*
+/**
  * Enabled the positioning/cropping/blending feature:
  * 1, specify the video playback position in the isurface
  * 2, specify the cropping info for video playback
@@ -157,31 +197,55 @@ typedef int VAStatus;     /* Return status type from functions */
  */
 #define VA_ENABLE_BLEND         0x00000004 /* video area blend with the constant color */ 
     
-/*
+/**
  * Clears the drawable with background color.
  * for hardware overlay based implementation this flag
  * can be used to turn off the overlay
  */
 #define VA_CLEAR_DRAWABLE       0x00000008
 
-/* Color space conversion flags for vaPutSurface() */
+/** Color space conversion flags for vaPutSurface() */
+#define VA_SRC_COLOR_MASK       0x000000f0
 #define VA_SRC_BT601            0x00000010
 #define VA_SRC_BT709            0x00000020
 #define VA_SRC_SMPTE_240        0x00000040
 
-/* Scaling flags for vaPutSurface() */
+/** Scaling flags for vaPutSurface() */
 #define VA_FILTER_SCALING_DEFAULT       0x00000000
 #define VA_FILTER_SCALING_FAST          0x00000100
 #define VA_FILTER_SCALING_HQ            0x00000200
 #define VA_FILTER_SCALING_NL_ANAMORPHIC 0x00000300
 #define VA_FILTER_SCALING_MASK          0x00000f00
 
-/*
+/**
  * Returns a short english description of error_status
  */
 const char *vaErrorStr(VAStatus error_status);
 
-/*
+typedef struct _VARectangle
+{
+    short x;
+    short y;
+    unsigned short width;
+    unsigned short height;
+} VARectangle;
+
+/** Type of a message callback, used for both error and info log. */
+typedef void (*vaMessageCallback)(const char *message);
+
+/**
+ * Set the callback for error messages, or NULL for no logging.
+ * Returns the previous one, or NULL if it was disabled.
+ */
+vaMessageCallback vaSetErrorCallback(vaMessageCallback);
+
+/**
+ * Set the callback for info messages, or NULL for no logging.
+ * Returns the previous one, or NULL if it was disabled.
+ */
+vaMessageCallback vaSetInfoCallback(vaMessageCallback);
+
+/**
  * Initialization:
  * A display must be obtained by calling vaGetDisplay() before calling
  * vaInitialize() and other functions. This connects the API to the 
@@ -191,8 +255,15 @@ const char *vaErrorStr(VAStatus error_status);
 typedef void* VANativeDisplay; /* window system dependent */
 
 int vaDisplayIsValid(VADisplay dpy);
-    
-/*
+
+/**
+ *  Set the override driver name instead of queried driver driver.
+ */
+VAStatus vaSetDriverName(VADisplay dpy,
+                         char *driver_name
+);
+
+/**
  * Initialize the library 
  */
 VAStatus vaInitialize (
@@ -201,14 +272,14 @@ VAStatus vaInitialize (
     int *minor_version          /* out */
 );
 
-/*
+/**
  * After this call, all library internal resources will be cleaned up
  */ 
 VAStatus vaTerminate (
     VADisplay dpy
 );
 
-/*
+/**
  * vaQueryVendorString returns a pointer to a zero-terminated string
  * describing some aspects of the VA implemenation on a specific    
  * hardware accelerator. The format of the returned string is vendor
@@ -220,9 +291,9 @@ const char *vaQueryVendorString (
     VADisplay dpy
 );
 
-typedef int (*VAPrivFunc)();
+typedef int (*VAPrivFunc)(void);
 
-/*
+/**
  * Return a function pointer given a function name in the library.
  * This allows private interfaces into the library
  */ 
@@ -231,9 +302,11 @@ VAPrivFunc vaGetLibFunc (
     const char *func
 );
 
-/* Currently defined profiles */
+/** Currently defined profiles */
 typedef enum
 {
+    /** \brief Profile ID used for video processing. */
+    VAProfileNone                       = -1,
     VAProfileMPEG2Simple               = 0,
     VAProfileMPEG2Main                 = 1,
     VAProfileMPEG4Simple               = 2,
@@ -247,10 +320,19 @@ typedef enum
     VAProfileVC1Advanced               = 10,
     VAProfileH263Baseline              = 11,
     VAProfileJPEGBaseline               = 12,
-    VAProfileH264ConstrainedBaseline = 13
+    VAProfileH264ConstrainedBaseline    = 13,
+    VAProfileVP8Version0_3              = 14,
+    VAProfileH264MultiviewHigh          = 15,
+    VAProfileH264StereoHigh             = 16,
+    VAProfileHEVCMain                   = 17,
+    VAProfileHEVCMain10                 = 18,
+    VAProfileVP9Profile0                = 19,
+    VAProfileVP9Profile1                = 20,
+    VAProfileVP9Profile2                = 21,
+    VAProfileVP9Profile3                = 22
 } VAProfile;
 
-/* 
+/**
  *  Currently defined entrypoints 
  */
 typedef enum
@@ -261,10 +343,20 @@ typedef enum
     VAEntrypointMoComp         = 4,
     VAEntrypointDeblocking     = 5,
     VAEntrypointEncSlice       = 6,    /* slice level encode */
-    VAEntrypointEncPicture     = 7     /* pictuer encode, JPEG, etc */
+    VAEntrypointEncPicture     = 7,    /* pictuer encode, JPEG, etc */
+    /*
+     * For an implementation that supports a low power/high performance variant
+     * for slice level encode, it can choose to expose the
+     * VAEntrypointEncSliceLP entrypoint. Certain encoding tools may not be
+     * available with this entrypoint (e.g. interlace, MBAFF) and the
+     * application can query the encoding configuration attributes to find
+     * out more details if this entrypoint is supported.
+     */
+    VAEntrypointEncSliceLP     = 8,
+    VAEntrypointVideoProc       = 10,   /**< Video pre/post-processing. */
 } VAEntrypoint;
 
-/* Currently defined configuration attribute types */
+/** Currently defined configuration attribute types */
 typedef enum
 {
     VAConfigAttribRTFormat             = 0,
@@ -274,6 +366,21 @@ typedef enum
     VAConfigAttribEncryption           = 4,
     VAConfigAttribRateControl          = 5,
 
+    /** @name Attributes for decoding */
+    /**@{*/
+    /**
+     * \brief Slice Decoding mode. Read/write.
+     *
+     * This attribute determines what mode the driver supports for slice
+     * decoding, through vaGetConfigAttributes(); and what mode the user
+     * will be providing to the driver, through vaCreateConfig(), if the
+     * driver supports those. If this attribute is not set by the user then
+     * it is assumed that VA_DEC_SLICE_MODE_NORMAL mode is used.
+     *
+     * See \c VA_DEC_SLICE_MODE_xxx for the list of slice decoding modes.
+     */
+    VAConfigAttribDecSliceMode         = 6,
+
     /** @name Attributes for encoding */
     /**@{*/
     /**
@@ -286,7 +393,7 @@ typedef enum
      *
      * See \c VA_ENC_PACKED_HEADER_xxx for the list of packed headers.
      */
-    VAConfigAttribEncPackedHeaders      = 6,
+    VAConfigAttribEncPackedHeaders      = 10,
     /**
      * \brief Interlaced mode. Read/write.
      *
@@ -295,23 +402,104 @@ typedef enum
      *
      * See \c VA_ENC_INTERLACED_xxx for the list of interlaced modes.
      */
-    VAConfigAttribEncInterlaced         = 7,
+    VAConfigAttribEncInterlaced         = 11,
     /**
-     * \brief Max number of reference frames. Read-only.
+     * \brief Maximum number of reference frames. Read-only.
      *
      * This attribute determines the maximum number of reference
      * frames supported for encoding.
      *
-     * Note: for H.264 encoding, the value represents the maximum
-     * number of reference frames for both the reference picture list
-     * 0 (top 16 bits) and the reference picture list 1 (bottom 16
-     * bits).
+     * Note: for H.264 encoding, the value represents the maximum number
+     * of reference frames for both the reference picture list 0 (bottom
+     * 16 bits) and the reference picture list 1 (top 16 bits).
+     */
+    VAConfigAttribEncMaxRefFrames       = 13,
+    /**
+     * \brief Maximum number of slices per frame. Read-only.
+     *
+     * This attribute determines the maximum number of slices the
+     * driver can support to encode a single frame.
+     */
+    VAConfigAttribEncMaxSlices          = 14,
+    /**
+     * \brief Slice structure. Read-only.
+     *
+     * This attribute determines slice structures supported by the
+     * driver for encoding. This attribute is a hint to the user so
+     * that he can choose a suitable surface size and how to arrange
+     * the encoding process of multiple slices per frame.
+     *
+     * More specifically, for H.264 encoding, this attribute
+     * determines the range of accepted values to
+     * VAEncSliceParameterBufferH264::macroblock_address and
+     * VAEncSliceParameterBufferH264::num_macroblocks.
+     *
+     * See \c VA_ENC_SLICE_STRUCTURE_xxx for the supported slice
+     * structure types.
+     */
+    VAConfigAttribEncSliceStructure     = 15,
+    /**
+     * \brief Macroblock information. Read-only.
+     *
+     * This attribute determines whether the driver supports extra
+     * encoding information per-macroblock. e.g. QP.
+     *
+     * More specifically, for H.264 encoding, if the driver returns a non-zero
+     * value for this attribute, this means the application can create
+     * additional #VAEncMacroblockParameterBufferH264 buffers referenced
+     * through VAEncSliceParameterBufferH264::macroblock_info.
+     */
+    VAConfigAttribEncMacroblockInfo     = 16,
+    /**
+     * \brief JPEG encoding attribute. Read-only.
+     *
+     * This attribute exposes a number of capabilities of the underlying
+     * JPEG implementation. The attribute value is partitioned into fields as defined in the 
+     * VAConfigAttribValEncJPEG union.
+     */
+    VAConfigAttribEncJPEG             = 20,
+    /**
+     * \brief Encoding quality range attribute. Read-only.
+     *
+     * This attribute conveys whether the driver supports different quality level settings
+     * for encoding. A value less than or equal to 1 means that the encoder only has a single
+     * quality setting, and a value greater than 1 represents the number of quality levels 
+     * that can be configured. e.g. a value of 2 means there are two distinct quality levels. 
+     */
+    VAConfigAttribEncQualityRange     = 21,
+    /**
+     * \brief Encoding skip frame attribute. Read-only.
+     *
+     * This attribute conveys whether the driver supports sending skip frame parameters 
+     * (VAEncMiscParameterTypeSkipFrame) to the encoder's rate control, when the user has 
+     * externally skipped frames. 
      */
-    VAConfigAttribEncMaxRefFrames       = 8,
+    VAConfigAttribEncSkipFrame        = 24,
+    /**
+     * \brief Encoding region-of-interest (ROI) attribute. Read-only.
+     *
+     * This attribute conveys whether the driver supports region-of-interest (ROI) encoding,
+     * based on user provided ROI rectangles.  The attribute value is partitioned into fields
+     * as defined in the VAConfigAttribValEncROI union.
+     *
+     * If ROI encoding is supported, the ROI information is passed to the driver using
+     * VAEncMiscParameterTypeROI.
+     */
+    VAConfigAttribEncROI              = 25,
+    /**
+     * \brief Encoding extended rate control attribute. Read-only.
+     *
+     * This attribute conveys whether the driver supports any extended rate control features
+     * The attribute value is partitioned into fields as defined in the
+     * VAConfigAttribValEncRateControlExt union.
+     */
+    VAConfigAttribEncRateControlExt   = 26,
+
     /**@}*/
+    VAConfigAttribTypeMax
 } VAConfigAttribType;
 
-/*
+/**
  * Configuration attributes
  * If there is more than one value for an attribute, a default
  * value will be assigned to the attribute if the client does not
@@ -322,19 +510,50 @@ typedef struct _VAConfigAttrib {
     unsigned int value; /* OR'd flags (bits) for this attribute */
 } VAConfigAttrib;
 
-/* attribute value for VAConfigAttribRTFormat */
+/** attribute value for VAConfigAttribRTFormat */
 #define VA_RT_FORMAT_YUV420    0x00000001      
 #define VA_RT_FORMAT_YUV422    0x00000002
 #define VA_RT_FORMAT_YUV444    0x00000004
+#define VA_RT_FORMAT_YUV411    0x00000008
+#define VA_RT_FORMAT_YUV400    0x00000010
+/** YUV formats with more than 8 bpp */
+#define VA_RT_FORMAT_YUV420_10BPP      0x00000100
+/** RGB formats */
+#define VA_RT_FORMAT_RGB16     0x00010000
+#define VA_RT_FORMAT_RGB32     0x00020000
+/* RGBP covers RGBP and BGRP fourcc */ 
+#define VA_RT_FORMAT_RGBP      0x00100000
 #define VA_RT_FORMAT_PROTECTED 0x80000000
 
-/* attribute value for VAConfigAttribRateControl */
-#define VA_RC_NONE     0x00000001      
-#define VA_RC_CBR      0x00000002      
-#define VA_RC_VBR      0x00000004      
-#define VA_RC_VCM      0x00000008 /* video conference mode */
+/** @name Attribute values for VAConfigAttribRateControl */
+/**@{*/
+/** \brief Driver does not support any form of rate control. */
+#define VA_RC_NONE                      0x00000001
+/** \brief Constant bitrate. */
+#define VA_RC_CBR                       0x00000002
+/** \brief Variable bitrate. */
+#define VA_RC_VBR                       0x00000004
+/** \brief Video conference mode. */
+#define VA_RC_VCM                       0x00000008
+/** \brief Constant QP. */
+#define VA_RC_CQP                       0x00000010
+/** \brief Variable bitrate with peak rate higher than average bitrate. */
+#define VA_RC_VBR_CONSTRAINED           0x00000020
+/** \brief Macroblock based rate control.  Per MB control is decided
+ *  internally in the encoder. It may be combined with other RC modes, except CQP. */
+#define VA_RC_MB                        0x00000080
 
-/** @name Attribute values for VAConfigAttribuEncPackedHeaders */
+/**@}*/
+
+/** @name Attribute values for VAConfigAttribDecSliceMode */
+/**@{*/
+/** \brief Driver supports normal mode for slice decoding */
+#define VA_DEC_SLICE_MODE_NORMAL       0x00000001
+/** \brief Driver supports base mode for slice decoding */
+#define VA_DEC_SLICE_MODE_BASE         0x00000002
+/**@}*/
+
+/** @name Attribute values for VAConfigAttribEncPackedHeaders */
 /**@{*/
 /** \brief Driver does not support any packed headers mode. */
 #define VA_ENC_PACKED_HEADER_NONE       0x00000000
@@ -344,9 +563,13 @@ typedef struct _VAConfigAttrib {
 #define VA_ENC_PACKED_HEADER_PICTURE    0x00000002
 /** \brief Driver supports packed slice headers. e.g. \c slice_header() for H.264. */
 #define VA_ENC_PACKED_HEADER_SLICE      0x00000004
+/** \brief Driver supports misc packed headers. e.g. SEI for H.264. */
+#define VA_ENC_PACKED_HEADER_MISC       0x00000008
+/** \brief Driver supports raw packed header, see VAEncPackedHeaderRawData */
+#define VA_ENC_PACKED_HEADER_RAW_DATA   0x00000010
 /**@}*/
 
-/** @name Attribute values for VAConfigAttributeEncInterlaced */
+/** @name Attribute values for VAConfigAttribEncInterlaced */
 /**@{*/
 /** \brief Driver does not support interlaced coding. */
 #define VA_ENC_INTERLACED_NONE          0x00000000
@@ -356,32 +579,136 @@ typedef struct _VAConfigAttrib {
 #define VA_ENC_INTERLACED_FIELD         0x00000002
 /** \brief Driver supports macroblock adaptive frame field coding. */
 #define VA_ENC_INTERLACED_MBAFF         0x00000004
-/** \brief Driver support picture adaptive frame field coding. */
+/** \brief Driver supports picture adaptive frame field coding. */
 #define VA_ENC_INTERLACED_PAFF          0x00000008
 /**@}*/
 
-/*
+/** @name Attribute values for VAConfigAttribEncSliceStructure */
+/**@{*/
+/** \brief Driver supports an arbitrary number of rows per slice. */
+#define VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS           0x00000000
+/** \brief Driver supports a power-of-two number of rows per slice. */
+#define VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS        0x00000001
+/** \brief Driver supports an arbitrary number of macroblocks per slice. */
+#define VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS    0x00000002
+/**@}*/
+
+/** \brief Attribute value for VAConfigAttribEncJPEG */
+typedef union _VAConfigAttribValEncJPEG {
+    struct {
+        /** \brief set to 1 for arithmatic coding. */
+        unsigned int arithmatic_coding_mode : 1;
+        /** \brief set to 1 for progressive dct. */
+        unsigned int progressive_dct_mode : 1;
+        /** \brief set to 1 for non-interleaved. */
+        unsigned int non_interleaved_mode : 1;
+        /** \brief set to 1 for differential. */
+        unsigned int differential_mode : 1;
+        unsigned int max_num_components : 3;
+        unsigned int max_num_scans : 4;
+        unsigned int max_num_huffman_tables : 3;
+        unsigned int max_num_quantization_tables : 3;
+    } bits;
+    unsigned int value;
+} VAConfigAttribValEncJPEG;
+
+/** \brief Attribute value for VAConfigAttribEncROI */
+typedef union _VAConfigAttribValEncROI {
+    struct {
+        /** \brief The number of ROI regions supported, 0 if ROI is not supported. */
+        unsigned int num_roi_regions           : 8;
+        /**
+         * \brief A flag indicates whether ROI priority is supported
+         *
+         * \ref roi_rc_priority_support equal to 1 specifies the underlying driver supports
+         * ROI priority when VAConfigAttribRateControl != VA_RC_CQP, user can use \c roi_value
+         * in #VAEncROI to set ROI priority. \ref roi_rc_priority_support equal to 0 specifies
+         * the underlying driver doesn't support ROI priority.
+         *
+         * User should ignore \ref roi_rc_priority_support when VAConfigAttribRateControl == VA_RC_CQP
+         * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP.
+         */
+        unsigned int roi_rc_priority_support   : 1;
+        /**
+         * \brief A flag indicates whether ROI delta QP is supported
+         *
+         * \ref roi_rc_qp_delat_support equal to 1 specifies the underlying driver supports
+         * ROI delta QP when VAConfigAttribRateControl != VA_RC_CQP, user can use \c roi_value
+         * in #VAEncROI to set ROI delta QP. \ref roi_rc_qp_delat_support equal to 0 specifies
+         * the underlying driver doesn't support ROI delta QP.
+         *
+         * User should ignore \ref roi_rc_qp_delat_support when VAConfigAttribRateControl == VA_RC_CQP
+         * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP.
+         */
+        unsigned int roi_rc_qp_delat_support    : 1;
+        unsigned int reserved                   : 22;
+     } bits;
+     unsigned int value;
+} VAConfigAttribValEncROI;
+
+/** \brief Attribute value for VAConfigAttribEncRateControlExt */
+typedef union _VAConfigAttribValEncRateControlExt {
+    struct {
+        /**
+         * \brief The maximum number of temporal layers minus 1
+         *
+         * \ref max_num_temporal_layers_minus1 plus 1 specifies the maximum number of temporal
+         * layers that supported by the underlying driver. \ref max_num_temporal_layers_minus1
+         * equal to 0 implies the underlying driver doesn't support encoding with temporal layer.
+         */
+        unsigned int max_num_temporal_layers_minus1      : 8;
+
+        /**
+         * /brief support temporal layer bit-rate control flag
+         *
+         * \ref temporal_layer_bitrate_control_flag equal to 1 specifies the underlying driver
+         * can support bit-rate control per temporal layer when (#VAConfigAttribRateControl == #VA_RC_CBR ||
+         * #VAConfigAttribRateControl == #VA_RC_VBR).
+         *
+         * The underlying driver must set \ref temporal_layer_bitrate_control_flag to 0 when
+         * \c max_num_temporal_layers_minus1 is equal to 0
+         *
+         * To use bit-rate control per temporal layer, an application must send the right layer
+         * structure via #VAEncMiscParameterTemporalLayerStructure at the beginning of a coded sequence
+         * and then followed by #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate structures
+         * for each layer, using the \c temporal_id field as the layer identifier. Otherwise
+         * the driver doesn't use bitrate control per temporal layer if an application doesn't send the
+         * layer structure via #VAEncMiscParameterTemporalLayerStructure to the driver. The driver returns
+         * VA_STATUS_ERROR_INVALID_PARAMETER if an application sends a wrong layer structure or doesn't send
+         * #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate for each layer.
+         *
+         * The driver will ignore #VAEncMiscParameterTemporalLayerStructure and the \c temporal_id field
+         * in #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate if
+         * \ref temporal_layer_bitrate_control_flag is equal to 0 or #VAConfigAttribRateControl == #VA_RC_CQP
+         */
+        unsigned int temporal_layer_bitrate_control_flag : 1;
+        unsigned int reserved                            : 23;
+    } bits;
+    unsigned int value;
+} VAConfigAttribValEncRateControlExt;
+
+/**
  * if an attribute is not applicable for a given
  * profile/entrypoint pair, then set the value to the following 
  */
 #define VA_ATTRIB_NOT_SUPPORTED 0x80000000
 
-/* Get maximum number of profiles supported by the implementation */
+/** Get maximum number of profiles supported by the implementation */
 int vaMaxNumProfiles (
     VADisplay dpy
 );
 
-/* Get maximum number of entrypoints supported by the implementation */
+/** Get maximum number of entrypoints supported by the implementation */
 int vaMaxNumEntrypoints (
     VADisplay dpy
 );
 
-/* Get maximum number of attributs supported by the implementation */
+/** Get maximum number of attributs supported by the implementation */
 int vaMaxNumConfigAttributes (
     VADisplay dpy
 );
 
-/* 
+/**
  * Query supported profiles 
  * The caller must provide a "profile_list" array that can hold at
  * least vaMaxNumProfile() entries. The actual number of profiles
@@ -393,7 +720,7 @@ VAStatus vaQueryConfigProfiles (
     int *num_profiles          /* out */
 );
 
-/* 
+/**
  * Query supported entrypoints for a given profile 
  * The caller must provide an "entrypoint_list" array that can hold at
  * least vaMaxNumEntrypoints() entries. The actual number of entrypoints 
@@ -406,7 +733,7 @@ VAStatus vaQueryConfigEntrypoints (
     int *num_entrypoints               /* out */
 );
 
-/* 
+/**
  * Get attributes for a given profile/entrypoint pair 
  * The caller must provide an "attrib_list" with all attributes to be 
  * retrieved.  Upon return, the attributes in "attrib_list" have been 
@@ -422,12 +749,12 @@ VAStatus vaGetConfigAttributes (
     int num_attribs
 );
 
-/* Generic ID type, can be re-typed for specific implementation */
+/** Generic ID type, can be re-typed for specific implementation */
 typedef unsigned int VAGenericID;
 
 typedef VAGenericID VAConfigID;
 
-/* 
+/**
  * Create a configuration for the decode pipeline 
  * it passes in the attribute list that specifies the attributes it cares 
  * about, with the rest taking default values.  
@@ -441,7 +768,7 @@ VAStatus vaCreateConfig (
     VAConfigID *config_id /* out */
 );
 
-/* 
+/**
  * Free resources associdated with a given config 
  */
 VAStatus vaDestroyConfig (
@@ -449,7 +776,7 @@ VAStatus vaDestroyConfig (
     VAConfigID config_id
 );
 
-/* 
+/**
  * Query all attributes for a given configuration 
  * The profile of the configuration is returned in "profile"
  * The entrypoint of the configuration is returned in "entrypoint"
@@ -467,7 +794,7 @@ VAStatus vaQueryConfigAttributes (
 );
 
 
-/*
+/**
  * Contexts and Surfaces
  *
  * Context represents a "virtual" video decode pipeline. Surfaces are render 
@@ -518,26 +845,200 @@ typedef struct _VAGenericValue {
     }                   value;
 } VAGenericValue;
 
-/* 
- * vaCreateSurfaces - Create an array of surfaces used for decode and display  
- *  dpy: display
- *  width: surface width
- *  height: surface height
- *  format: VA_RT_FORMAT_YUV420, VA_RT_FORMAT_YUV422 or VA_RT_FORMAT_YUV444
- *  num_surfaces: number of surfaces to be created
- *  surfaces: array of surfaces created upon return
+/** @name Surface attribute flags */
+/**@{*/
+/** \brief Surface attribute is not supported. */
+#define VA_SURFACE_ATTRIB_NOT_SUPPORTED 0x00000000
+/** \brief Surface attribute can be got through vaQuerySurfaceAttributes(). */
+#define VA_SURFACE_ATTRIB_GETTABLE      0x00000001
+/** \brief Surface attribute can be set through vaCreateSurfaces(). */
+#define VA_SURFACE_ATTRIB_SETTABLE      0x00000002
+/**@}*/
+
+/** \brief Surface attribute types. */
+typedef enum {
+    VASurfaceAttribNone = 0,
+    /**
+     * \brief Pixel format (fourcc).
+     *
+     * The value is meaningful as input to vaQuerySurfaceAttributes().
+     * If zero, the driver returns the optimal pixel format for the
+     * specified config. Otherwise, if non-zero, the value represents
+     * a pixel format (FOURCC) that is kept as is on output, if the
+     * driver supports it. Otherwise, the driver sets the value to
+     * zero and drops the \c VA_SURFACE_ATTRIB_SETTABLE flag.
+     */
+    VASurfaceAttribPixelFormat,
+    /** \brief Minimal width in pixels (int, read-only). */
+    VASurfaceAttribMinWidth,
+    /** \brief Maximal width in pixels (int, read-only). */
+    VASurfaceAttribMaxWidth,
+    /** \brief Minimal height in pixels (int, read-only). */
+    VASurfaceAttribMinHeight,
+    /** \brief Maximal height in pixels (int, read-only). */
+    VASurfaceAttribMaxHeight,
+    /** \brief Surface memory type expressed in bit fields (int, read/write). */
+    VASurfaceAttribMemoryType,
+    /** \brief External buffer descriptor (pointer, write). */
+    VASurfaceAttribExternalBufferDescriptor,
+    /** \brief Surface usage hint, gives the driver a hint of intended usage 
+     *  to optimize allocation (e.g. tiling) (int, read/write). */
+    VASurfaceAttribUsageHint,
+    /** \brief Number of surface attributes. */
+    VASurfaceAttribCount
+} VASurfaceAttribType;
+
+/** \brief Surface attribute. */
+typedef struct _VASurfaceAttrib {
+    /** \brief Type. */
+    VASurfaceAttribType type;
+    /** \brief Flags. See "Surface attribute flags". */
+    unsigned int        flags;
+    /** \brief Value. See "Surface attribute types" for the expected types. */
+    VAGenericValue      value;
+} VASurfaceAttrib;
+
+/** 
+ * @name VASurfaceAttribMemoryType values in bit fields. 
+ * Bit 0:7 are reserved for generic types, Bit 31:28 are reserved for 
+ * Linux DRM, Bit 23:20 are reserved for Android. DRM and Android specific
+ * types are defined in DRM and Android header files.
  */
-VAStatus vaCreateSurfaces (
-    VADisplay dpy,
-    int width,
-    int height,
-    int format,
-    int num_surfaces,
-    VASurfaceID *surfaces      /* out */
+/**@{*/
+/** \brief VA memory type (default) is supported. */
+#define VA_SURFACE_ATTRIB_MEM_TYPE_VA                  0x00000001
+/** \brief V4L2 buffer memory type is supported. */
+#define VA_SURFACE_ATTRIB_MEM_TYPE_V4L2                        0x00000002
+/** \brief User pointer memory type is supported. */
+#define VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR            0x00000004
+/**@}*/
+
+/** 
+ * \brief VASurfaceAttribExternalBuffers structure for 
+ * the VASurfaceAttribExternalBufferDescriptor attribute.
+ */
+typedef struct _VASurfaceAttribExternalBuffers {
+    /** \brief pixel format in fourcc. */
+    unsigned int pixel_format;
+    /** \brief width in pixels. */
+    unsigned int width;
+    /** \brief height in pixels. */
+    unsigned int height;
+    /** \brief total size of the buffer in bytes. */
+    unsigned int data_size;
+    /** \brief number of planes for planar layout */
+    unsigned int num_planes;
+    /** \brief pitch for each plane in bytes */
+    unsigned int pitches[4];
+    /** \brief offset for each plane in bytes */
+    unsigned int offsets[4];
+    /** \brief buffer handles or user pointers */
+    unsigned long *buffers;
+    /** \brief number of elements in the "buffers" array */
+    unsigned int num_buffers;
+    /** \brief flags. See "Surface external buffer descriptor flags". */
+    unsigned int flags;
+    /** \brief reserved for passing private data */
+    void *private_data;
+} VASurfaceAttribExternalBuffers;
+
+/** @name VASurfaceAttribExternalBuffers flags */
+/**@{*/
+/** \brief Enable memory tiling */
+#define VA_SURFACE_EXTBUF_DESC_ENABLE_TILING   0x00000001
+/** \brief Memory is cacheable */
+#define VA_SURFACE_EXTBUF_DESC_CACHED          0x00000002
+/** \brief Memory is non-cacheable */
+#define VA_SURFACE_EXTBUF_DESC_UNCACHED                0x00000004
+/** \brief Memory is write-combined */
+#define VA_SURFACE_EXTBUF_DESC_WC              0x00000008
+/** \brief Memory is protected */
+#define VA_SURFACE_EXTBUF_DESC_PROTECTED        0x80000000
+
+/** @name VASurfaceAttribUsageHint attribute usage hint flags */
+/**@{*/
+/** \brief Surface usage not indicated. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC   0x00000000
+/** \brief Surface used by video decoder. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_DECODER   0x00000001
+/** \brief Surface used by video encoder. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER   0x00000002
+/** \brief Surface read by video post-processing. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ  0x00000004
+/** \brief Surface written by video post-processing. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE         0x00000008
+/** \brief Surface used for display. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_DISPLAY   0x00000010
+
+/**@}*/
+
+/**
+ * \brief Queries surface attributes for the supplied config.
+ *
+ * Unlike vaGetSurfaceAttributes(), this function queries for all
+ * supported attributes for the supplied VA @config. In particular, if
+ * the underlying hardware supports the creation of VA surfaces in
+ * various formats, then this function will enumerate all pixel
+ * formats that are supported.
+ *
+ * The \c attrib_list array is allocated by the user and \c
+ * num_attribs shall be initialized to the number of allocated
+ * elements in that array. Upon successful return, the actual number
+ * of attributes will be overwritten into \c num_attribs. Otherwise,
+ * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_attribs
+ * is adjusted to the number of elements that would be returned if
+ * enough space was available.
+ *
+ * Note: it is perfectly valid to pass NULL to the \c attrib_list
+ * argument when vaQuerySurfaceAttributes() is used to determine the
+ * actual number of elements that need to be allocated.
+ *
+ * @param[in] dpy               the VA display
+ * @param[in] config            the config identifying a codec or a video
+ *     processing pipeline
+ * @param[out] attrib_list      the output array of #VASurfaceAttrib elements
+ * @param[in,out] num_attribs   the number of elements allocated on
+ *      input, the number of elements actually filled in output
+ */
+VAStatus
+vaQuerySurfaceAttributes(
+    VADisplay           dpy,
+    VAConfigID          config,
+    VASurfaceAttrib    *attrib_list,
+    unsigned int       *num_attribs
 );
 
+/**
+ * \brief Creates an array of surfaces
+ *
+ * Creates an array of surfaces. The optional list of attributes shall
+ * be constructed and validated through vaGetSurfaceAttributes() or
+ * constructed based based on what the underlying hardware could
+ * expose through vaQuerySurfaceAttributes().
+ *
+ * @param[in] dpy               the VA display
+ * @param[in] format            the desired surface format. See \c VA_RT_FORMAT_*
+ * @param[in] width             the surface width
+ * @param[in] height            the surface height
+ * @param[out] surfaces         the array of newly created surfaces
+ * @param[in] num_surfaces      the number of surfaces to create
+ * @param[in] attrib_list       the list of (optional) attributes, or \c NULL
+ * @param[in] num_attribs       the number of attributes supplied in
+ *     \c attrib_list, or zero
+ */
+VAStatus
+vaCreateSurfaces(
+    VADisplay           dpy,
+    unsigned int        format,
+    unsigned int        width,
+    unsigned int        height,
+    VASurfaceID        *surfaces,
+    unsigned int        num_surfaces,
+    VASurfaceAttrib    *attrib_list,
+    unsigned int        num_attribs
+);
     
-/*
+/**
  * vaDestroySurfaces - Destroy resources associated with surfaces. 
  *  Surfaces can only be destroyed after the context associated has been 
  *  destroyed.  
@@ -552,7 +1053,7 @@ VAStatus vaDestroySurfaces (
 );
 
 #define VA_PROGRESSIVE 0x1
-/*
+/**
  * vaCreateContext - Create a context
  *  dpy: display
  *  config_id: configuration for the context
@@ -575,7 +1076,7 @@ VAStatus vaCreateContext (
     VAContextID *context               /* out */
 );
 
-/*
+/**
  * vaDestroyContext - Destroy a context 
  *  dpy: display
  *  context: context to be destroyed
@@ -585,7 +1086,7 @@ VAStatus vaDestroyContext (
     VAContextID context
 );
 
-/*
+/**
  * Buffers 
  * Buffers are used to pass various types of data from the
  * client to the server. The server maintains a data store
@@ -610,6 +1111,7 @@ typedef enum
     VAProtectedSliceDataBufferType     = 10,
     VAQMatrixBufferType                 = 11,
     VAHuffmanTableBufferType            = 12,
+    VAProbabilityBufferType             = 13,
 
 /* Following are encode buffer types */
     VAEncCodedBufferType               = 21,
@@ -620,7 +1122,29 @@ typedef enum
     VAEncPackedHeaderDataBufferType     = 26,
     VAEncMiscParameterBufferType       = 27,
     VAEncMacroblockParameterBufferType = 28,
-    VABufferTypeMax                     = 0xff
+    VAEncMacroblockMapBufferType        = 29,
+/* Following are video processing buffer types */
+    /**
+     * \brief Video processing pipeline parameter buffer.
+     *
+     * This buffer describes the video processing pipeline. See
+     * #VAProcPipelineParameterBuffer for details.
+     */
+    VAProcPipelineParameterBufferType   = 41,
+    /**
+     * \brief Video filter parameter buffer.
+     *
+     * This buffer describes the video filter parameters. All buffers
+     * inherit from #VAProcFilterParameterBufferBase, thus including
+     * a unique filter buffer type.
+     *
+     * The default buffer used by most filters is #VAProcFilterParameterBuffer.
+     * Filters requiring advanced parameters include, but are not limited to,
+     * deinterlacing (#VAProcFilterParameterBufferDeinterlacing),
+     * color balance (#VAProcFilterParameterBufferColorBalance), etc.
+     */
+    VAProcFilterParameterBufferType     = 42,
+    VABufferTypeMax
 } VABufferType;
 
 typedef enum
@@ -629,26 +1153,52 @@ typedef enum
     VAEncMiscParameterTypeRateControl          = 1,
     VAEncMiscParameterTypeMaxSliceSize = 2,
     VAEncMiscParameterTypeAIR          = 3,
+    /** \brief Buffer type used to express a maximum frame size (in bits). */
+    VAEncMiscParameterTypeMaxFrameSize  = 4,
+    /** \brief Buffer type used for HRD parameters. */
+    VAEncMiscParameterTypeHRD           = 5,
+    VAEncMiscParameterTypeQualityLevel  = 6,
+    /** \brief Buffer type used for sending skip frame parameters to the encoder's
+      * rate control, when the user has externally skipped frames. */
+    VAEncMiscParameterTypeSkipFrame     = 9,
+    /** \brief Buffer type used for region-of-interest (ROI) parameters. */
+    VAEncMiscParameterTypeROI           = 10,
+    /** \brief Buffer type used for temporal layer structure */
+    VAEncMiscParameterTypeTemporalLayerStructure   = 12,
 } VAEncMiscParameterType;
 
 /** \brief Packed header type. */
 typedef enum {
-    VAEncPackedHeaderSequence           = 1, /**< Packed sequence header. */
-    VAEncPackedHeaderPicture            = 2, /**< Packed picture header. */
-    VAEncPackedHeaderSlice              = 3, /**< Packed slice header. */
+    /** \brief Packed sequence header. */
+    VAEncPackedHeaderSequence   = 1,
+    /** \brief Packed picture header. */
+    VAEncPackedHeaderPicture    = 2,
+    /** \brief Packed slice header. */
+    VAEncPackedHeaderSlice      = 3,
+    /** 
+     * \brief Packed raw header. 
+     * 
+     * Packed raw data header can be used by the client to insert a header  
+     * into the bitstream data buffer at the point it is passed, the driver 
+     * will handle the raw packed header based on "has_emulation_bytes" field
+     * in the packed header parameter structure.
+     */
+    VAEncPackedHeaderRawData    = 4,
+    /** \brief Misc packed header. See codec-specific definitions. */
+    VAEncPackedHeaderMiscMask   = 0x80000000,
 } VAEncPackedHeaderType;
 
 /** \brief Packed header parameter. */
 typedef struct _VAEncPackedHeaderParameterBuffer {
     /** Type of the packed header buffer. See #VAEncPackedHeaderType. */
-    VAEncPackedHeaderType       type;
+    unsigned int                type;
     /** \brief Size of the #VAEncPackedHeaderDataBuffer in bits. */
     unsigned int                bit_length;
     /** \brief Flag: buffer contains start code emulation prevention bytes? */
     unsigned char               has_emulation_bytes;
 } VAEncPackedHeaderParameterBuffer;
 
-/*
+/**
  *  For application, e.g. set a new bitrate
  *    VABufferID buf_id;
  *    VAEncMiscParameterBuffer *misc_param;
@@ -671,24 +1221,95 @@ typedef struct _VAEncMiscParameterBuffer
     unsigned int data[0];
 } VAEncMiscParameterBuffer;
 
+/** \brief Temporal layer Structure*/
+typedef struct _VAEncMiscParameterTemporalLayerStructure
+{
+    /** \brief The number of temporal layers */
+    unsigned int number_of_layers;
+    /** \brief The length of the array defining frame layer membership. Should be 1-32 */
+    unsigned int periodicity;
+    /**
+     * \brief The array indicating the layer id for each frame
+     *
+     * The layer id for the first frame in a coded sequence is always 0, so layer_id[] specifies the layer
+     * ids for frames starting from the 2nd frame.
+     */
+    unsigned int layer_id[32];
+} VAEncMiscParameterTemporalLayerStructure;
+
+
+/** \brief Rate control parameters */
 typedef struct _VAEncMiscParameterRateControl
 {
-    unsigned int bits_per_second; /* this is the maximum bit-rate to be constrained by the rate control implementation */
-    unsigned int target_percentage; /* this is the bit-rate the rate control is targeting, as a percentage of the maximum bit-rate */
-                                    /* for example if target_percentage is 95 then the rate control will target a bit-rate that is */
-                                    /* 95% of the maximum bit-rate */
-    unsigned int window_size; /* windows size in milliseconds. For example if this is set to 500, then the rate control will guarantee the */
-                              /* target bit-rate over a 500 ms window */
-    unsigned int initial_qp;  /* initial QP at I frames */
-    unsigned int min_qp;     
+    /* this is the maximum bit-rate to be constrained by the rate control implementation */
+    unsigned int bits_per_second;
+    /* this is the bit-rate the rate control is targeting, as a percentage of the maximum
+     * bit-rate for example if target_percentage is 95 then the rate control will target
+     * a bit-rate that is 95% of the maximum bit-rate
+     */
+    unsigned int target_percentage;
+    /* windows size in milliseconds. For example if this is set to 500,
+     * then the rate control will guarantee the target bit-rate over a 500 ms window
+     */
+    unsigned int window_size;
+    /* initial QP at I frames */
+    unsigned int initial_qp;
+    unsigned int min_qp;
+    unsigned int basic_unit_size;
+    union
+    {
+        struct
+        {
+            unsigned int reset : 1;
+            unsigned int disable_frame_skip : 1; /* Disable frame skip in rate control mode */
+            unsigned int disable_bit_stuffing : 1; /* Disable bit stuffing in rate control mode */
+            unsigned int mb_rate_control : 4; /* Control VA_RC_MB 0: default, 1: enable, 2: disable, other: reserved*/
+            /*
+             * The temporal layer that the rate control parameters are specified for.
+             */
+            unsigned int temporal_id : 8;
+            unsigned int reserved : 17;
+        } bits;
+        unsigned int value;
+    } rc_flags;
 } VAEncMiscParameterRateControl;
 
 typedef struct _VAEncMiscParameterFrameRate
 {
+    /*
+     * The framerate is specified as a number of frames per second, as a
+     * fraction.  The denominator of the fraction is given in the top half
+     * (the high two bytes) of the framerate field, and the numerator is
+     * given in the bottom half (the low two bytes).
+     *
+     * That is:
+     * denominator = framerate >> 16 & 0xffff;
+     * numerator   = framerate & 0xffff;
+     * fps         = numerator / denominator;
+     *
+     * For example, if framerate is set to (100 << 16 | 750), this is
+     * 750 / 100, hence 7.5fps.
+     *
+     * If the denominator is zero (the high two bytes are both zero) then
+     * it takes the value one instead, so the framerate is just the integer
+     * in the low 2 bytes.
+     */
     unsigned int framerate;
+    union
+    {
+        struct
+        {
+            /*
+             * The temporal id the framerate parameters are specified for.
+             */
+            unsigned int temporal_id : 8;
+            unsigned int reserved : 24;
+         } bits;
+         unsigned int value;
+     } framerate_flags;
 } VAEncMiscParameterFrameRate;
 
-/*
+/**
  * Allow a maximum slice size to be specified (in bits).
  * The encoder will attempt to make sure that individual slices do not exceed this size
  * Or to signal applicate if the slice size exceed this size, see "status" of VACodedBufferSegment
@@ -705,8 +1326,141 @@ typedef struct _VAEncMiscParameterAIR
     unsigned int air_auto; /* if set to 1 then hardware auto-tune the AIR threshold */
 } VAEncMiscParameterAIR;
 
+typedef struct _VAEncMiscParameterHRD
+{
+    unsigned int initial_buffer_fullness;       /* in bits */
+    unsigned int buffer_size;                   /* in bits */
+} VAEncMiscParameterHRD;
 
-/* 
+/**
+ * \brief Defines a maximum frame size (in bits).
+ *
+ * This misc parameter buffer defines the maximum size of a frame (in
+ * bits). The encoder will try to make sure that each frame does not
+ * exceed this size. Otherwise, if the frame size exceeds this size,
+ * the \c status flag of #VACodedBufferSegment will contain
+ * #VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW.
+ */
+typedef struct _VAEncMiscParameterBufferMaxFrameSize {
+    /** \brief Type. Shall be set to #VAEncMiscParameterTypeMaxFrameSize. */
+    VAEncMiscParameterType      type;
+    /** \brief Maximum size of a frame (in bits). */
+    unsigned int                max_frame_size;
+} VAEncMiscParameterBufferMaxFrameSize;
+
+/**
+ * \brief Encoding quality level.
+ *
+ * The encoding quality could be set through this structure, if the implementation  
+ * supports multiple quality levels. The quality level set through this structure is 
+ * persistent over the entire coded sequence, or until a new structure is being sent.
+ * The quality level range can be queried through the VAConfigAttribEncQualityRange 
+ * attribute. A lower value means higher quality, and a value of 1 represents the highest 
+ * quality. The quality level setting is used as a trade-off between quality and speed/power 
+ * consumption, with higher quality corresponds to lower speed and higher power consumption. 
+ */
+typedef struct _VAEncMiscParameterBufferQualityLevel {
+    /** \brief Encoding quality level setting. When set to 0, default quality
+     * level is used.
+     */
+    unsigned int                quality_level;
+} VAEncMiscParameterBufferQualityLevel;
+
+/**
+ * \brief Encoding skip frame.
+ *
+ * The application may choose to skip frames externally to the encoder (e.g. drop completely or 
+ * code as all skip's). For rate control purposes the encoder will need to know the size and number 
+ * of skipped frames.  Skip frame(s) indicated through this structure is applicable only to the 
+ * current frame.  It is allowed for the application to still send in packed headers for the driver to 
+ * pack, although no frame will be encoded (e.g. for HW to encrypt the frame).  
+ */
+typedef struct _VAEncMiscParameterSkipFrame {
+    /** \brief Indicates skip frames as below.
+      * 0: Encode as normal, no skip.
+      * 1: One or more frames were skipped prior to the current frame, encode the current frame as normal.  
+      * 2: The current frame is to be skipped, do not encode it but pack/encrypt the packed header contents
+      *    (all except VAEncPackedHeaderSlice) which could contain actual frame contents (e.g. pack the frame 
+      *    in VAEncPackedHeaderPicture).  */
+    unsigned char               skip_frame_flag;
+    /** \brief The number of frames skipped prior to the current frame.  Valid when skip_frame_flag = 1. */
+    unsigned char               num_skip_frames;
+    /** \brief When skip_frame_flag = 1, the size of the skipped frames in bits.   When skip_frame_flag = 2, 
+      * the size of the current skipped frame that is to be packed/encrypted in bits. */
+    unsigned int                size_skip_frames;
+} VAEncMiscParameterSkipFrame;
+
+/**
+ * \brief Encoding region-of-interest (ROI).
+ *
+ * The encoding ROI can be set through VAEncMiscParameterBufferROI, if the implementation
+ * supports ROI input. The ROI set through this structure is applicable only to the
+ * current frame or field, so must be sent every frame or field to be applied.  The number of
+ * supported ROIs can be queried through the VAConfigAttribEncROI.  The encoder will use the
+ * ROI information to adjust the QP values of the MB's that fall within the ROIs.
+ */
+typedef struct _VAEncROI
+{
+        /** \brief Defines the ROI boundary in pixels, the driver will map it to appropriate
+         *  codec coding units.  It is relative to frame coordinates for the frame case and
+         *  to field coordinates for the field case. */
+        VARectangle     roi_rectangle;
+        /**
+         * \brief ROI value
+         *
+         * \ref roi_value specifies ROI delta QP or ROI priority.
+         * --  ROI delta QP is the value that will be added on top of the frame level QP.
+         * --  ROI priority specifies the priority of a region, it can be positive (more important)
+         * or negative (less important) values and is compared with non-ROI region (taken as value 0),
+         * E.g. ROI region with \ref roi_value -3 is less important than the non-ROI region (\ref roi_value
+         * implied to be 0) which is less important than ROI region with roi_value +2. For overlapping
+         * regions, the roi_value that is first in the ROI array will have priority.
+         *
+         * \ref roi_value always specifes ROI delta QP when VAConfigAttribRateControl == VA_RC_CQP, no matter
+         * the value of \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI.
+         *
+         * \ref roi_value depends on \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI when
+         * VAConfigAttribRateControl != VA_RC_CQP. \ref roi_value specifies ROI_delta QP if \c roi_value_is_qp_delta
+         * in VAEncMiscParameterBufferROI is 1, otherwise \ref roi_value specifies ROI priority.
+         */
+        char            roi_value;
+} VAEncROI;
+
+typedef struct _VAEncMiscParameterBufferROI {
+    /** \brief Number of ROIs being sent.*/
+    unsigned int        num_roi;
+
+    /** \brief Valid when VAConfigAttribRateControl != VA_RC_CQP, then the encoder's
+     *  rate control will determine actual delta QPs.  Specifies the max/min allowed delta
+     *  QPs. */
+    char                max_delta_qp;
+    char                min_delta_qp;
+
+   /** \brief Pointer to a VAEncROI array with num_roi elements.  It is relative to frame
+     *  coordinates for the frame case and to field coordinates for the field case.*/
+    VAEncROI            *roi;
+    union {
+        struct {
+            /**
+             * \brief An indication for roi value.
+             *
+             * \ref roi_value_is_qp_delta equal to 1 indicates \c roi_value in #VAEncROI should
+             * be used as ROI delta QP. \ref roi_value_is_qp_delta equal to 0 indicates \c roi_value
+             * in #VAEncROI should be used as ROI priority.
+             *
+             * \ref roi_value_is_qp_delta is only available when VAConfigAttribRateControl != VA_RC_CQP,
+             * the setting must comply with \c roi_rc_priority_support and \c roi_rc_qp_delat_support in
+             * #VAConfigAttribValEncROI. The underlying driver should ignore this field
+             * when VAConfigAttribRateControl == VA_RC_CQP.
+             */
+            uint32_t  roi_value_is_qp_delta    : 1;
+            uint32_t  reserved                 : 31;
+        } bits;
+        uint32_t value;
+    } roi_flags;
+} VAEncMiscParameterBufferROI;
+
+/**
  * There will be cases where the bitstream buffer will not have enough room to hold
  * the data for the entire slice, and the following flags will be used in the slice
  * parameter to signal to the server for the possible cases.
@@ -727,27 +1481,44 @@ typedef struct _VASliceParameterBufferBase
     unsigned int slice_data_flag;      /* see VA_SLICE_DATA_FLAG_XXX definitions */
 } VASliceParameterBufferBase;
 
-
-/****************************
- * JEPG data structure
- ***************************/
-typedef struct _VAQMatrixBufferJPEG
-{
-    int load_lum_quantiser_matrix;
-    int load_chroma_quantiser_matrix;
-    unsigned char lum_quantiser_matrix[64];
-    unsigned char chroma_quantiser_matrix[64];
-} VAQMatrixBufferJPEG;
-
-typedef struct _VAEncPictureParameterBufferJPEG
-{
-    VASurfaceID reconstructed_picture;
-    unsigned short picture_width;
-    unsigned short picture_height;
-    VABufferID coded_buf;
-} VAEncPictureParameterBufferJPEG;
-
-#include <va/va_dec_jpeg.h>
+/**********************************
+ * JPEG common  data structures
+ **********************************/
+/**
+ * \brief Huffman table for JPEG decoding.
+ *
+ * This structure holds the complete Huffman tables. This is an
+ * aggregation of all Huffman table (DHT) segments maintained by the
+ * application. i.e. up to 2 Huffman tables are stored in there for
+ * baseline profile.
+ *
+ * The #load_huffman_table array can be used as a hint to notify the
+ * VA driver implementation about which table(s) actually changed
+ * since the last submission of this buffer.
+ */
+typedef struct _VAHuffmanTableBufferJPEGBaseline {
+    /** \brief Specifies which #huffman_table is valid. */
+    unsigned char       load_huffman_table[2];
+    /** \brief Huffman tables indexed by table identifier (Th). */
+    struct {
+        /** @name DC table (up to 12 categories) */
+        /**@{*/
+        /** \brief Number of Huffman codes of length i + 1 (Li). */
+        unsigned char   num_dc_codes[16];
+        /** \brief Value associated with each Huffman code (Vij). */
+        unsigned char   dc_values[12];
+        /**@}*/
+        /** @name AC table (2 special codes + up to 16 * 10 codes) */
+        /**@{*/
+        /** \brief Number of Huffman codes of length i + 1 (Li). */
+        unsigned char   num_ac_codes[16];
+        /** \brief Value associated with each Huffman code (Vij). */
+        unsigned char   ac_values[162];
+        /** \brief Padding to 4-byte boundaries. Must be set to zero. */
+        unsigned char   pad[2];
+        /**@}*/
+    }                   huffman_table[2];
+} VAHuffmanTableBufferJPEGBaseline;
 
 /****************************
  * MPEG-2 data structures
@@ -787,20 +1558,28 @@ typedef struct _VAPictureParameterBufferMPEG2
     } picture_coding_extension;
 } VAPictureParameterBufferMPEG2;
 
-/* MPEG-2 Inverse Quantization Matrix Buffer */
+/** MPEG-2 Inverse Quantization Matrix Buffer */
 typedef struct _VAIQMatrixBufferMPEG2
 {
+    /** \brief Same as the MPEG-2 bitstream syntax element. */
     int load_intra_quantiser_matrix;
+    /** \brief Same as the MPEG-2 bitstream syntax element. */
     int load_non_intra_quantiser_matrix;
+    /** \brief Same as the MPEG-2 bitstream syntax element. */
     int load_chroma_intra_quantiser_matrix;
+    /** \brief Same as the MPEG-2 bitstream syntax element. */
     int load_chroma_non_intra_quantiser_matrix;
+    /** \brief Luminance intra matrix, in zig-zag scan order. */
     unsigned char intra_quantiser_matrix[64];
+    /** \brief Luminance non-intra matrix, in zig-zag scan order. */
     unsigned char non_intra_quantiser_matrix[64];
+    /** \brief Chroma intra matrix, in zig-zag scan order. */
     unsigned char chroma_intra_quantiser_matrix[64];
+    /** \brief Chroma non-intra matrix, in zig-zag scan order. */
     unsigned char chroma_non_intra_quantiser_matrix[64];
 } VAIQMatrixBufferMPEG2;
 
-/* MPEG-2 Slice Parameter Buffer */
+/** MPEG-2 Slice Parameter Buffer */
 typedef struct _VASliceParameterBufferMPEG2
 {
     unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
@@ -813,7 +1592,7 @@ typedef struct _VASliceParameterBufferMPEG2
     int intra_slice_flag;
 } VASliceParameterBufferMPEG2;
 
-/* MPEG-2 Macroblock Parameter Buffer */
+/** MPEG-2 Macroblock Parameter Buffer */
 typedef struct _VAMacroblockParameterBufferMPEG2
 {
     unsigned short macroblock_address;
@@ -860,7 +1639,7 @@ typedef struct _VAMacroblockParameterBufferMPEG2
 #define VA_MB_TYPE_MOTION_PATTERN      0x08
 #define VA_MB_TYPE_MOTION_INTRA                0x10
 
-/* 
+/**
  * MPEG-2 Residual Data Buffer 
  * For each macroblock, there wil be 64 shorts (16-bit) in the 
  * residual data buffer
@@ -923,16 +1702,20 @@ typedef struct _VAPictureParameterBufferMPEG4
     short TRD;
 } VAPictureParameterBufferMPEG4;
 
-/* MPEG-4 Inverse Quantization Matrix Buffer */
+/** MPEG-4 Inverse Quantization Matrix Buffer */
 typedef struct _VAIQMatrixBufferMPEG4
 {
+    /** Same as the MPEG-4:2 bitstream syntax element. */
     int load_intra_quant_mat;
+    /** Same as the MPEG-4:2 bitstream syntax element. */
     int load_non_intra_quant_mat;
+    /** The matrix for intra blocks, in zig-zag scan order. */
     unsigned char intra_quant_mat[64];
+    /** The matrix for non-intra blocks, in zig-zag scan order. */
     unsigned char non_intra_quant_mat[64];
 } VAIQMatrixBufferMPEG4;
 
-/* MPEG-4 Slice Parameter Buffer */
+/** MPEG-4 Slice Parameter Buffer */
 typedef struct _VASliceParameterBufferMPEG4
 {
     unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
@@ -943,7 +1726,7 @@ typedef struct _VASliceParameterBufferMPEG4
     int quant_scale;
 } VASliceParameterBufferMPEG4;
 
-/*
+/**
  VC-1 data structures
 */
 
@@ -956,7 +1739,7 @@ typedef enum   /* see 7.1.1.32 */
     VAMvModeIntensityCompensation      = 4 
 } VAMvModeVC1;
 
-/* VC-1 Picture Parameter Buffer */
+/** VC-1 Picture Parameter Buffer */
 /* 
  * For each picture, and before any slice data, a picture parameter
  * buffer must be send. Multiple picture parameter buffers may be
@@ -1115,7 +1898,7 @@ typedef struct _VAPictureParameterBufferVC1
     } transform_fields;
 } VAPictureParameterBufferVC1;
 
-/* VC-1 Bitplane Buffer 
+/** VC-1 Bitplane Buffer
 There will be at most three bitplanes coded in any picture header. To send 
 the bitplane data more efficiently, each byte is divided in two nibbles, with
 each nibble carrying three bitplanes for one macroblock.  The following table
@@ -1167,7 +1950,7 @@ typedef struct _VAPictureH264
 #define VA_PICTURE_H264_SHORT_TERM_REFERENCE   0x00000008
 #define VA_PICTURE_H264_LONG_TERM_REFERENCE    0x00000010
 
-/* H.264 Picture Parameter Buffer */
+/** H.264 Picture Parameter Buffer */
 /* 
  * For each picture, and before any slice data, a single
  * picture parameter buffer must be send.
@@ -1222,14 +2005,16 @@ typedef struct _VAPictureParameterBufferH264
     unsigned short frame_num;
 } VAPictureParameterBufferH264;
 
-/* H.264 Inverse Quantization Matrix Buffer */
+/** H.264 Inverse Quantization Matrix Buffer */
 typedef struct _VAIQMatrixBufferH264
 {
+    /** \brief 4x4 scaling list, in raster scan order. */
     unsigned char ScalingList4x4[6][16];
+    /** \brief 8x8 scaling list, in raster scan order. */
     unsigned char ScalingList8x8[2][64];
 } VAIQMatrixBufferH264;
 
-/* 
+/**
  * H.264 Slice Group Map Buffer 
  * When VAPictureParameterBufferH264::num_slice_group_minus1 is not equal to 0,
  * A slice group map buffer should be sent for each picture if required. The buffer
@@ -1239,7 +2024,7 @@ typedef struct _VAIQMatrixBufferH264
  * in raster scan order
  */ 
 
-/* H.264 Slice Parameter Buffer */
+/** H.264 Slice Parameter Buffer */
 typedef struct _VASliceParameterBufferH264
 {
     unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
@@ -1311,38 +2096,6 @@ typedef struct _VAEncSliceParameterBuffer
     } slice_flags;
 } VAEncSliceParameterBuffer;
 
-/****************************
- * H.264 specific encode data structures
- ****************************/
-
-typedef struct _VAEncSequenceParameterBufferH264Baseline
-{
-    unsigned char seq_parameter_set_id;
-    unsigned char level_idc;
-    unsigned int intra_period;
-    unsigned int intra_idr_period;
-    unsigned int max_num_ref_frames;
-    unsigned int picture_width_in_mbs;
-    unsigned int picture_height_in_mbs;
-    unsigned int bits_per_second;
-    unsigned int frame_rate;
-    unsigned int initial_qp;
-    unsigned int min_qp;
-    unsigned int basic_unit_size;
-    unsigned char vui_flag;
-} VAEncSequenceParameterBufferH264Baseline;
-
-#define H264_LAST_PICTURE_EOSEQ     0x01 /* the last picture in the sequence */
-#define H264_LAST_PICTURE_EOSTREAM  0x02 /* the last picture in the stream */
-typedef struct _VAEncPictureParameterBufferH264Baseline
-{
-    VASurfaceID reference_picture;
-    VASurfaceID reconstructed_picture;
-    VABufferID coded_buf;
-    unsigned short picture_width;
-    unsigned short picture_height;
-    unsigned char last_picture;
-} VAEncPictureParameterBufferH264Baseline;
 
 /****************************
  * H.263 specific encode data structures
@@ -1400,9 +2153,9 @@ typedef struct _VAEncPictureParameterBufferMPEG4
 
 
 
-/* Buffer functions */
+/** Buffer functions */
 
-/*
+/**
  * Creates a buffer for "num_elements" elements of "size" bytes and 
  * initalize with "data".
  * if "data" is null, then the contents of the buffer data store
@@ -1413,6 +2166,7 @@ typedef struct _VAEncPictureParameterBufferMPEG4
  * eliminates this copy is to pass null as "data" when calling vaCreateBuffer(),
  * and then use vaMapBuffer() to map the data store from the server side to the
  * client address space for access.
+ * The user must call vaDestroyBuffer() to destroy a buffer.
  *  Note: image buffers are created by the library, not the client. Please see 
  *        vaCreateImage on how image buffers are managed.
  */
@@ -1426,7 +2180,7 @@ VAStatus vaCreateBuffer (
     VABufferID *buf_id /* out */
 );
 
-/*
+/**
  * Convey to the server how many valid elements are in the buffer. 
  * e.g. if multiple slice parameters are being held in a single buffer,
  * this will communicate to the server the number of slice parameters
@@ -1439,7 +2193,7 @@ VAStatus vaBufferSetNumElements (
 );
 
 
-/*
+/**
  * device independent data structure for codedbuffer
  */
 
@@ -1458,21 +2212,56 @@ VAStatus vaBufferSetNumElements (
 #define VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK         0x200
 #define VA_CODED_BUF_STATUS_BITRATE_OVERFLOW           0x400
 #define VA_CODED_BUF_STATUS_BITRATE_HIGH               0x800
+/**
+ * \brief The frame has exceeded the maximum requested size.
+ *
+ * This flag indicates that the encoded frame size exceeds the value
+ * specified through a misc parameter buffer of type
+ * #VAEncMiscParameterTypeMaxFrameSize.
+ */
+#define VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW         0x1000
 #define VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD      0xff0000
 
-/*
- * device independent data structure for codedbuffer
+/**
+ * \brief The coded buffer segment contains a single NAL unit. 
+ *
+ * This flag indicates that the coded buffer segment contains a
+ * single NAL unit. This flag might be useful to the user for 
+ * processing the coded buffer.
+ */
+#define VA_CODED_BUF_STATUS_SINGLE_NALU                 0x10000000     
+
+/**
+ * \brief Coded buffer segment.
+ *
+ * #VACodedBufferSegment is an element of a linked list describing
+ * some information on the coded buffer. The coded buffer segment
+ * could contain either a single NAL unit, or more than one NAL unit. 
+ * It is recommended (but not required) to return a single NAL unit 
+ * in a coded buffer segment, and the implementation should set the 
+ * VA_CODED_BUF_STATUS_SINGLE_NALU status flag if that is the case.
  */
 typedef  struct _VACodedBufferSegment  {
-    unsigned int size;/* size of the data buffer in the coded buffer segment, in bytes */
-    unsigned int bit_offset; /* bit offset into the data buffer where valid bitstream data begins */
-    unsigned int status; /* status set by the driver on the coded buffer*/
-    unsigned int reserved; /* for future use */
-    void *buf; /* pointer to the beginning of the data buffer in the coded buffer segment */
-    void *next; /* pointer to the next VACodedBufferSegment */
+    /**
+     * \brief Size of the data buffer in this segment (in bytes).
+     */
+    unsigned int        size;
+    /** \brief Bit offset into the data buffer where the video data starts. */
+    unsigned int        bit_offset;
+    /** \brief Status set by the driver. See \c VA_CODED_BUF_STATUS_*. */
+    unsigned int        status;
+    /** \brief Reserved for future use. */
+    unsigned int        reserved;
+    /** \brief Pointer to the start of the data buffer. */
+    void               *buf;
+    /**
+     * \brief Pointer to the next #VACodedBufferSegment element,
+     * or \c NULL if there is none.
+     */
+    void               *next;
 } VACodedBufferSegment;
      
-/*
+/**
  * Map data store of the buffer into the client's address space
  * vaCreateBuffer() needs to be called with "data" set to NULL before
  * calling vaMapBuffer()
@@ -1486,7 +2275,7 @@ VAStatus vaMapBuffer (
     void **pbuf        /* out */
 );
 
-/*
+/**
  * After client making changes to a mapped data store, it needs to
  * "Unmap" it to let the server know that the data is ready to be
  * consumed by the server
@@ -1496,15 +2285,122 @@ VAStatus vaUnmapBuffer (
     VABufferID buf_id  /* in */
 );
 
-/*
+/**
  * After this call, the buffer is deleted and this buffer_id is no longer valid
- * Only call this if the buffer is not going to be passed to vaRenderBuffer
+ *
+ * A buffer can be re-used and sent to the server by another Begin/Render/End
+ * sequence if vaDestroyBuffer() is not called with this buffer.
+ *
+ * Note re-using a shared buffer (e.g. a slice data buffer) between the host and the
+ * hardware accelerator can result in performance dropping.
  */
 VAStatus vaDestroyBuffer (
     VADisplay dpy,
     VABufferID buffer_id
 );
 
+/** \brief VA buffer information */
+typedef struct {
+    /** \brief Buffer handle */
+    uintptr_t           handle;
+    /** \brief Buffer type (See \ref VABufferType). */
+    uint32_t            type;
+    /**
+     * \brief Buffer memory type (See \ref VASurfaceAttribMemoryType).
+     *
+     * On input to vaAcquireBufferHandle(), this field can serve as a hint
+     * to specify the set of memory types the caller is interested in.
+     * On successful return from vaAcquireBufferHandle(), the field is
+     * updated with the best matching memory type.
+     */
+    uint32_t            mem_type;
+    /** \brief Size of the underlying buffer. */
+    size_t              mem_size;
+} VABufferInfo;
+
+/**
+ * \brief Acquires buffer handle for external API usage
+ *
+ * Locks the VA buffer object \ref buf_id for external API usage like
+ * EGL or OpenCL (OCL). This function is a synchronization point. This
+ * means that any pending operation is guaranteed to be completed
+ * prior to returning from the function.
+ *
+ * If the referenced VA buffer object is the backing store of a VA
+ * surface, then this function acts as if vaSyncSurface() on the
+ * parent surface was called first.
+ *
+ * The \ref VABufferInfo argument shall be zero'ed on input. On
+ * successful output, the data structure is filled in with all the
+ * necessary buffer level implementation details like handle, type,
+ * memory type and memory size.
+ *
+ * Note: the external API implementation, or the application, can
+ * express the memory types it is interested in by filling in the \ref
+ * mem_type field accordingly. On successful output, the memory type
+ * that fits best the request and that was used is updated in the \ref
+ * VABufferInfo data structure. If none of the supplied memory types
+ * is supported, then a \ref VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE
+ * error is returned.
+ *
+ * The \ref VABufferInfo data is valid until vaReleaseBufferHandle()
+ * is called. Besides, no additional operation is allowed on any of
+ * the buffer parent object until vaReleaseBufferHandle() is called.
+ * e.g. decoding into a VA surface backed with the supplied VA buffer
+ * object \ref buf_id would fail with a \ref VA_STATUS_ERROR_SURFACE_BUSY
+ * error.
+ *
+ * Possible errors:
+ * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation
+ *   does not support this interface
+ * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied
+ * - \ref VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied
+ * - \ref VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE: the implementation
+ *   does not support exporting buffers of the specified type
+ * - \ref VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE: none of the requested
+ *   memory types in \ref VABufferInfo.mem_type was supported
+ *
+ * @param[in] dpy               the VA display
+ * @param[in] buf_id            the VA buffer
+ * @param[in,out] buf_info      the associated VA buffer information
+ * @return VA_STATUS_SUCCESS if successful
+ */
+VAStatus
+vaAcquireBufferHandle(VADisplay dpy, VABufferID buf_id, VABufferInfo *buf_info);
+
+/**
+ * \brief Releases buffer after usage from external API
+ *
+ * Unlocks the VA buffer object \ref buf_id from external API usage like
+ * EGL or OpenCL (OCL). This function is a synchronization point. This
+ * means that any pending operation is guaranteed to be completed
+ * prior to returning from the function.
+ *
+ * The \ref VABufferInfo argument shall point to the original data
+ * structure that was obtained from vaAcquireBufferHandle(), unaltered.
+ * This is necessary so that the VA driver implementation could
+ * deallocate any resources that were needed.
+ *
+ * In any case, returning from this function invalidates any contents
+ * in \ref VABufferInfo. i.e. the underlyng buffer handle is no longer
+ * valid. Therefore, VA driver implementations are free to reset this
+ * data structure to safe defaults.
+ *
+ * Possible errors:
+ * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation
+ *   does not support this interface
+ * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied
+ * - \ref VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied
+ * - \ref VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE: the implementation
+ *   does not support exporting buffers of the specified type
+ *
+ * @param[in] dpy               the VA display
+ * @param[in] buf_id            the VA buffer
+ * @return VA_STATUS_SUCCESS if successful
+ */
+VAStatus
+vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id);
+
 /*
 Render (Decode) Pictures
 
@@ -1513,7 +2409,7 @@ A picture represents either a frame or a field.
 The Begin/Render/End sequence sends the decode buffers to the server
 */
 
-/*
+/**
  * Get ready to decode a picture to a target surface
  */
 VAStatus vaBeginPicture (
@@ -1522,9 +2418,8 @@ VAStatus vaBeginPicture (
     VASurfaceID render_target
 );
 
-/* 
+/**
  * Send decode buffers to the server.
- * Buffers are automatically destroyed afterwards
  */
 VAStatus vaRenderPicture (
     VADisplay dpy,
@@ -1533,7 +2428,7 @@ VAStatus vaRenderPicture (
     int num_buffers
 );
 
-/* 
+/**
  * Make the end of rendering for a picture. 
  * The server should start processing all pending operations for this 
  * surface. This call is non-blocking. The client can start another 
@@ -1550,7 +2445,7 @@ Synchronization
 
 */
 
-/* 
+/**
  * This function blocks until all pending operations on the render target
  * have been completed.  Upon return it is safe to use the render target for a 
  * different picture. 
@@ -1570,7 +2465,7 @@ typedef enum
     VASurfaceSkipped   = 8  /* Indicate a skipped frame during encode */
 } VASurfaceStatus;
 
-/*
+/**
  * Find out any pending ops on the render target 
  */
 VAStatus vaQuerySurfaceStatus (
@@ -1585,7 +2480,7 @@ typedef enum
     VADecodeMBError                 = 1,
 } VADecodeErrorType;
 
-/*
+/**
  * Client calls vaQuerySurfaceError with VA_STATUS_ERROR_DECODING_ERROR, server side returns
  * an array of structure VASurfaceDecodeMBErrors, and the array is terminated by setting status=-1
 */
@@ -1597,7 +2492,7 @@ typedef struct _VASurfaceDecodeMBErrors
     VADecodeErrorType decode_error_type;
 } VASurfaceDecodeMBErrors;
 
-/*
+/**
  * After the application gets VA_STATUS_ERROR_DECODING_ERROR after calling vaSyncSurface(),
  * it can call vaQuerySurfaceError to find out further details on the particular error.
  * VA_STATUS_ERROR_DECODING_ERROR should be passed in as "error_status",
@@ -1612,7 +2507,7 @@ VAStatus vaQuerySurfaceError(
     void **error_info
 );
 
-/*
+/**
  * Images and Subpictures
  * VAImage is used to either get the surface data to client memory, or 
  * to copy image data in client memory to a surface. 
@@ -1623,11 +2518,19 @@ VAStatus vaQuerySurfaceError(
     ((unsigned long)(unsigned char) (ch0) | ((unsigned long)(unsigned char) (ch1) << 8) | \
     ((unsigned long)(unsigned char) (ch2) << 16) | ((unsigned long)(unsigned char) (ch3) << 24 ))
 
-/* a few common FourCCs */
+/* 
+ * Pre-defined fourcc codes
+ */
 #define VA_FOURCC_NV12         0x3231564E
 #define VA_FOURCC_AI44         0x34344149
 #define VA_FOURCC_RGBA         0x41424752
+#define VA_FOURCC_RGBX         0x58424752
 #define VA_FOURCC_BGRA         0x41524742
+#define VA_FOURCC_BGRX         0x58524742
+#define VA_FOURCC_ARGB         0x42475241
+#define VA_FOURCC_XRGB         0x42475258
+#define VA_FOURCC_ABGR          0x52474241
+#define VA_FOURCC_XBGR          0x52474258
 #define VA_FOURCC_UYVY          0x59565955
 #define VA_FOURCC_YUY2          0x32595559
 #define VA_FOURCC_AYUV          0x56555941
@@ -1635,6 +2538,32 @@ VAStatus vaQuerySurfaceError(
 #define VA_FOURCC_YV12          0x32315659
 #define VA_FOURCC_P208          0x38303250
 #define VA_FOURCC_IYUV          0x56555949
+#define VA_FOURCC_YV24          0x34325659
+#define VA_FOURCC_YV32          0x32335659
+#define VA_FOURCC_Y800          0x30303859
+#define VA_FOURCC_IMC3          0x33434D49
+#define VA_FOURCC_411P          0x50313134
+#define VA_FOURCC_422H          0x48323234
+#define VA_FOURCC_422V          0x56323234
+#define VA_FOURCC_444P          0x50343434
+#define VA_FOURCC_RGBP          0x50424752
+#define VA_FOURCC_BGRP          0x50524742
+#define VA_FOURCC_411R          0x52313134 /* rotated 411P */
+/**
+ * Planar YUV 4:2:2.
+ * 8-bit Y plane, followed by 8-bit 2x1 subsampled V and U planes
+ */
+#define VA_FOURCC_YV16          0x36315659
+/**
+ * 10-bit and 16-bit Planar YUV 4:2:0. 
+ */
+#define VA_FOURCC_P010          0x30313050
+#define VA_FOURCC_P016          0x36313050
+
+/**
+ * 10-bit Planar YUV 420 and occupy the lower 10-bit.
+ */
+#define VA_FOURCC_I010          0x30313049
 
 /* byte order */
 #define VA_LSB_FIRST           1
@@ -1696,12 +2625,12 @@ typedef struct _VAImage
     char component_order[4];
 } VAImage;
 
-/* Get maximum number of image formats supported by the implementation */
+/** Get maximum number of image formats supported by the implementation */
 int vaMaxNumImageFormats (
     VADisplay dpy
 );
 
-/* 
+/**
  * Query supported image formats 
  * The caller must provide a "format_list" array that can hold at
  * least vaMaxNumImageFormats() entries. The actual number of formats
@@ -1713,7 +2642,7 @@ VAStatus vaQueryImageFormats (
     int *num_formats           /* out */
 );
 
-/* 
+/**
  * Create a VAImage structure
  * The width and height fields returned in the VAImage structure may get 
  * enlarged for some YUV formats. Upon return from this function, 
@@ -1728,7 +2657,7 @@ VAStatus vaCreateImage (
     VAImage *image     /* out */
 );
 
-/*
+/**
  * Should call DestroyImage before destroying the surface it is bound to
  */
 VAStatus vaDestroyImage (
@@ -1747,7 +2676,7 @@ VAStatus vaSetImagePalette (
     unsigned char *palette 
 );
 
-/*
+/**
  * Retrive surface data into a VAImage
  * Image must be in a format supported by the implementation
  */
@@ -1761,7 +2690,7 @@ VAStatus vaGetImage (
     VAImageID image
 );
 
-/*
+/**
  * Copy data from a VAImage to a surface
  * Image must be in a format supported by the implementation
  * Returns a VA_STATUS_ERROR_SURFACE_BUSY if the surface
@@ -1781,7 +2710,7 @@ VAStatus vaPutImage (
     unsigned int dest_height
 );
 
-/*
+/**
  * Derive an VAImage from an existing surface.
  * This interface will derive a VAImage and corresponding image buffer from
  * an existing VA Surface. The image buffer can then be mapped/unmapped for
@@ -1818,7 +2747,7 @@ VAStatus vaDeriveImage (
     VAImage *image     /* out */
 );
 
-/*
+/**
  * Subpictures 
  * Subpicture is a special type of image that can be blended 
  * with a surface during vaPutSurface(). Subpicture can be used to render
@@ -1827,16 +2756,16 @@ VAStatus vaDeriveImage (
 
 typedef VAGenericID VASubpictureID;
 
-/* Get maximum number of subpicture formats supported by the implementation */
+/** Get maximum number of subpicture formats supported by the implementation */
 int vaMaxNumSubpictureFormats (
     VADisplay dpy
 );
 
-/* flags for subpictures */
+/** flags for subpictures */
 #define VA_SUBPICTURE_CHROMA_KEYING                    0x0001
 #define VA_SUBPICTURE_GLOBAL_ALPHA                     0x0002
 #define VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD      0x0004
-/* 
+/**
  * Query supported subpicture formats 
  * The caller must provide a "format_list" array that can hold at
  * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag 
@@ -1855,7 +2784,7 @@ VAStatus vaQuerySubpictureFormats (
     unsigned int *num_formats  /* out */
 );
 
-/* 
+/**
  * Subpictures are created with an image associated. 
  */
 VAStatus vaCreateSubpicture (
@@ -1864,7 +2793,7 @@ VAStatus vaCreateSubpicture (
     VASubpictureID *subpicture /* out */
 );
 
-/*
+/**
  * Destroy the subpicture before destroying the image it is assocated to
  */
 VAStatus vaDestroySubpicture (
@@ -1872,7 +2801,7 @@ VAStatus vaDestroySubpicture (
     VASubpictureID subpicture
 );
 
-/* 
+/**
  * Bind an image to the subpicture. This image will now be associated with 
  * the subpicture instead of the one at creation.
  */
@@ -1882,7 +2811,7 @@ VAStatus vaSetSubpictureImage (
     VAImageID image
 );
 
-/*
+/**
  * If chromakey is enabled, then the area where the source value falls within
  * the chromakey [min, max] range is transparent
  * The chromakey component format is the following:
@@ -1899,7 +2828,7 @@ VAStatus vaSetSubpictureChromakey (
     unsigned int chromakey_mask
 );
 
-/*
+/**
  * Global alpha value is between 0 and 1. A value of 1 means fully opaque and 
  * a value of 0 means fully transparent. If per-pixel alpha is also specified then
  * the overall alpha is per-pixel alpha multiplied by the global alpha
@@ -1910,7 +2839,7 @@ VAStatus vaSetSubpictureGlobalAlpha (
     float global_alpha 
 );
 
-/*
+/**
  * vaAssociateSubpicture associates the subpicture with target_surfaces.
  * It defines the region mapping between the subpicture and the target  
  * surfaces through source and destination rectangles (with the same width and height).
@@ -1937,7 +2866,7 @@ VAStatus vaAssociateSubpicture (
     unsigned int flags
 );
 
-/*
+/**
  * vaDeassociateSubpicture removes the association of the subpicture with target_surfaces.
  */
 VAStatus vaDeassociateSubpicture (
@@ -1947,15 +2876,7 @@ VAStatus vaDeassociateSubpicture (
     int num_surfaces
 );
 
-typedef struct _VARectangle
-{
-    short x;
-    short y;
-    unsigned short width;
-    unsigned short height;
-} VARectangle;
-
-/*
+/**
  * Display attributes
  * Display attributes are used to control things such as contrast, hue, saturation,
  * brightness etc. in the rendering process.  The application can query what
@@ -1972,29 +2893,29 @@ typedef enum
     VADISPLAYATTRIB_BLE_NONE,
 } VADisplayAttribBLEMode;
 
-/* attribute value for VADisplayAttribRotation   */
+/** attribute value for VADisplayAttribRotation   */
 #define VA_ROTATION_NONE        0x00000000
 #define VA_ROTATION_90          0x00000001
 #define VA_ROTATION_180         0x00000002
 #define VA_ROTATION_270         0x00000003
 
-/* attribute value for VADisplayAttribOutOfLoopDeblock */
+/** attribute value for VADisplayAttribOutOfLoopDeblock */
 #define VA_OOL_DEBLOCKING_FALSE 0x00000000
 #define VA_OOL_DEBLOCKING_TRUE  0x00000001
 
-/* Render mode */
+/** Render mode */
 #define VA_RENDER_MODE_UNDEFINED           0
 #define VA_RENDER_MODE_LOCAL_OVERLAY       1
 #define VA_RENDER_MODE_LOCAL_GPU           2
 #define VA_RENDER_MODE_EXTERNAL_OVERLAY    4
 #define VA_RENDER_MODE_EXTERNAL_GPU        8
 
-/* Render device */
+/** Render device */
 #define VA_RENDER_DEVICE_UNDEFINED  0
 #define VA_RENDER_DEVICE_LOCAL      1
 #define VA_RENDER_DEVICE_EXTERNAL   2
 
-/* Currently defined display attribute types */
+/** Currently defined display attribute types */
 typedef enum
 {
     VADisplayAttribBrightness          = 0,
@@ -2083,12 +3004,12 @@ typedef struct _VADisplayAttribute
     unsigned int flags;
 } VADisplayAttribute;
 
-/* Get maximum number of display attributs supported by the implementation */
+/** Get maximum number of display attributs supported by the implementation */
 int vaMaxNumDisplayAttributes (
     VADisplay dpy
 );
 
-/* 
+/**
  * Query display attributes 
  * The caller must provide a "attr_list" array that can hold at
  * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
@@ -2100,7 +3021,7 @@ VAStatus vaQueryDisplayAttributes (
     int *num_attributes                        /* out */
 );
 
-/* 
+/**
  * Get display attributes 
  * This function returns the current attribute values in "attr_list".
  * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
@@ -2112,7 +3033,7 @@ VAStatus vaGetDisplayAttributes (
     int num_attributes
 );
 
-/* 
+/**
  * Set display attributes 
  * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
  * from vaQueryDisplayAttributes() can be set.  If the attribute is not settable or 
@@ -2124,6 +3045,86 @@ VAStatus vaSetDisplayAttributes (
     int num_attributes
 );
 
+/****************************
+ * HEVC data structures
+ ****************************/
+/** 
+ * \brief Description of picture properties of those in DPB surfaces.
+ *
+ * If only progressive scan is supported, each surface contains one whole 
+ * frame picture.
+ * Otherwise, each surface contains two fields of whole picture.
+ * In this case, two entries of ReferenceFrames[] may share same picture_id
+ * value.
+ */
+typedef struct _VAPictureHEVC
+{
+    /** \brief reconstructed picture buffer surface index 
+     * invalid when taking value VA_INVALID_SURFACE.
+     */
+    VASurfaceID             picture_id;
+    /** \brief picture order count. 
+     * in HEVC, POCs for top and bottom fields of same picture should
+     * take different values.
+     */
+    int32_t                 pic_order_cnt;
+    /* described below */
+    uint32_t                flags;
+} VAPictureHEVC;
+
+/* flags in VAPictureHEVC could be OR of the following */
+#define VA_PICTURE_HEVC_INVALID                 0x00000001
+/** \brief indication of interlace scan picture. 
+ * should take same value for all the pictures in sequence.
+ */ 
+#define VA_PICTURE_HEVC_FIELD_PIC               0x00000002
+/** \brief polarity of the field picture.
+ * top field takes even lines of buffer surface.
+ * bottom field takes odd lines of buffer surface.
+ */
+#define VA_PICTURE_HEVC_BOTTOM_FIELD            0x00000004
+/** \brief Long term reference picture */
+#define VA_PICTURE_HEVC_LONG_TERM_REFERENCE     0x00000008
+/**
+ * VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE, VA_PICTURE_HEVC_RPS_ST_CURR_AFTER
+ * and VA_PICTURE_HEVC_RPS_LT_CURR of any picture in ReferenceFrames[] should 
+ * be exclusive. No more than one of them can be set for any picture.
+ * Sum of NumPocStCurrBefore, NumPocStCurrAfter and NumPocLtCurr
+ * equals NumPocTotalCurr, which should be equal to or smaller than 8.
+ * Application should provide valid values for both short format and long format.
+ * The pictures in DPB with any of these three flags turned on are referred by
+ * the current picture.
+ */
+/** \brief RefPicSetStCurrBefore of HEVC spec variable 
+ * Number of ReferenceFrames[] entries with this bit set equals 
+ * NumPocStCurrBefore.
+ */
+#define VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE      0x00000010
+/** \brief RefPicSetStCurrAfter of HEVC spec variable
+ * Number of ReferenceFrames[] entries with this bit set equals 
+ * NumPocStCurrAfter.
+ */
+#define VA_PICTURE_HEVC_RPS_ST_CURR_AFTER       0x00000020
+/** \brief RefPicSetLtCurr of HEVC spec variable
+ * Number of ReferenceFrames[] entries with this bit set equals 
+ * NumPocLtCurr.
+ */
+#define VA_PICTURE_HEVC_RPS_LT_CURR             0x00000040
+
+#include <va/va_dec_hevc.h>
+#include <va/va_dec_jpeg.h>
+#include <va/va_dec_vp8.h>
+#include <va/va_dec_vp9.h>
+#include <va/va_enc_hevc.h>
+#include <va/va_enc_h264.h>
+#include <va/va_enc_jpeg.h>
+#include <va/va_enc_mpeg2.h>
+#include <va/va_enc_vp8.h>
+#include <va/va_enc_vp9.h>
+#include <va/va_vpp.h>
+
+/**@}*/
+
 #ifdef __cplusplus
 }
 #endif