OSDN Git Service

add Encoding quantization
[android-x86/hardware-intel-common-libva.git] / va / va.h
diff --git a/va/va.h b/va/va.h
index fb3066f..d215080 100644 (file)
--- a/va/va.h
+++ b/va/va.h
 extern "C" {
 #endif
 
+#ifdef __GNUC__
+#define va_deprecated __attribute__((deprecated))
+#if __GNUC__ >= 6
+#define va_deprecated_enum va_deprecated
+#else
+#define va_deprecated_enum
+#endif
+#else
+#define va_deprecated
+#define va_deprecated_enum
+#endif
+
 /**
  * \mainpage Video Acceleration (VA) API
  *
@@ -95,11 +107,13 @@ extern "C" {
  * 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).
+ * AVC/H.264, VC-1/VMW3, and JPEG, HEVC/H265, VP8, VP9) and video pre/post
+ * processing
  *
  * VA-API is split into several modules:
  * - \ref api_core
- * - \ref api_enc_h264
+ * - \ref api_enc_xxx (xxx = h264, hevc, jpec, mpeg2, vp8, vp9)
+ * - \ref api_dec_xxx (xxx = hevc, jpec, vp8, vp9)
  * - \ref api_vpp
  */
 
@@ -112,9 +126,9 @@ extern "C" {
 /**
 Overview 
 
-The VA API is intended to provide an interface between a video decode/encode/display
+The VA API is intended to provide an interface between a video decode/encode/processing
 application (client) and a hardware accelerator (server), to off-load 
-video decode/encode/display operations from the host to the hardware accelerator at various 
+video decode/encode/processing operations from the host to the hardware accelerator at various
 entry-points.
 
 The basic operation steps are:
@@ -122,18 +136,18 @@ The basic operation steps are:
 - Negotiate a mutually acceptable configuration with the server to lock
   down profile, entrypoints, and other attributes that will not change on 
   a frame-by-frame basis.
-- Create a decode context which represents a "virtualized" hardware decode 
-  device
-- Get and fill decode buffers with picture level, slice level and macroblock 
-  level data (depending on entrypoints)
-- Pass the decode buffers to the server to decode the current frame
+- Create a video decode, encode or processing context which represents a
+  "virtualized" hardware device
+- Get and fill the render buffers with the corresponding data (depending on
+  profiles and entrypoints)
+- Pass the render buffers to the server to handle the current frame
 
 Initialization & Configuration Management 
 
 - Find out supported profiles
 - Find out entrypoints for a given profile
 - Find out configuration attributes for a given profile/entrypoint pair
-- Create a configuration for use by the decoder
+- Create a configuration for use by the application
 
 */
 
@@ -217,11 +231,50 @@ typedef int VAStatus;     /** Return status type from functions */
 #define VA_FILTER_SCALING_NL_ANAMORPHIC 0x00000300
 #define VA_FILTER_SCALING_MASK          0x00000f00
 
+/** Padding size in 4-bytes */
+#define VA_PADDING_LOW          4
+#define VA_PADDING_MEDIUM       8
+#define VA_PADDING_HIGH         16
+#define VA_PADDING_LARGE        32
+
 /**
  * Returns a short english description of error_status
  */
 const char *vaErrorStr(VAStatus error_status);
 
+typedef struct _VARectangle
+{
+    int16_t x;
+    int16_t y;
+    uint16_t width;
+    uint16_t height;
+} VARectangle;
+
+/** \brief Generic motion vector data structure. */
+typedef struct _VAMotionVector {
+    /** \mv0[0]: horizontal motion vector for past reference */
+    /** \mv0[1]: vertical motion vector for past reference */
+    /** \mv1[0]: horizontal motion vector for future reference */
+    /** \mv1[1]: vertical motion vector for future reference */
+    int16_t  mv0[2];  /* past reference */
+    int16_t  mv1[2];  /* future reference */
+} VAMotionVector;
+
+/** Type of a message callback, used for both error and info log. */
+typedef void (*VAMessageCallback)(void *user_context, 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(VADisplay dpy, VAMessageCallback callback, void *user_context);
+
+/**
+ * Set the callback for info messages, or NULL for no logging.
+ * Returns the previous one, or NULL if it was disabled.
+ */
+VAMessageCallback vaSetInfoCallback(VADisplay dpy, VAMessageCallback callback, void *user_context);
+
 /**
  * Initialization:
  * A display must be obtained by calling vaGetDisplay() before calling
@@ -268,7 +321,7 @@ const char *vaQueryVendorString (
     VADisplay dpy
 );
 
-typedef int (*VAPrivFunc)();
+typedef int (*VAPrivFunc)(void);
 
 /**
  * Return a function pointer given a function name in the library.
@@ -289,7 +342,7 @@ typedef enum
     VAProfileMPEG4Simple               = 2,
     VAProfileMPEG4AdvancedSimple       = 3,
     VAProfileMPEG4Main                 = 4,
-    VAProfileH264Baseline              = 5,
+    VAProfileH264Baseline va_deprecated_enum = 5,
     VAProfileH264Main                  = 6,
     VAProfileH264High                  = 7,
     VAProfileVC1Simple                 = 8,
@@ -303,7 +356,10 @@ typedef enum
     VAProfileH264StereoHigh             = 16,
     VAProfileHEVCMain                   = 17,
     VAProfileHEVCMain10                 = 18,
-    VAProfileVP9Profile0                = 19
+    VAProfileVP9Profile0                = 19,
+    VAProfileVP9Profile1                = 20,
+    VAProfileVP9Profile2                = 21,
+    VAProfileVP9Profile3                = 22
 } VAProfile;
 
 /**
@@ -318,7 +374,33 @@ typedef enum
     VAEntrypointDeblocking     = 5,
     VAEntrypointEncSlice       = 6,    /* slice level encode */
     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. */
+    /**
+     * \brief VAEntrypointFEI
+     *
+     * The purpose of FEI (Flexible Encoding Infrastructure) is to allow applications to
+     * have more controls and trade off quality for speed with their own IPs.
+     * The application can optionally provide input to ENC for extra encode control
+     * and get the output from ENC. Application can chose to modify the ENC
+     * output/PAK input during encoding, but the performance impact is significant.
+     *
+     * On top of the existing buffers for normal encode, there will be
+     * one extra input buffer (VAEncMiscParameterFEIFrameControl) and
+     * three extra output buffers (VAEncFEIMVBufferType, VAEncFEIMBModeBufferType
+     * and VAEncFEIDistortionBufferType) for VAEntrypointFEI entry function.
+     * If separate PAK is set, two extra input buffers
+     * (VAEncFEIMVBufferType, VAEncFEIMBModeBufferType) are needed for PAK input.
+     **/
+    VAEntrypointFEI         = 11,
 } VAEntrypoint;
 
 /** Currently defined configuration attribute types */
@@ -345,7 +427,14 @@ typedef enum
      * See \c VA_DEC_SLICE_MODE_xxx for the list of slice decoding modes.
      */
     VAConfigAttribDecSliceMode         = 6,
-
+   /**
+     * \brief JPEG decoding 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
+     * VAConfigAttribValDecJPEG union.
+     */
+    VAConfigAttribDecJPEG             = 7,
     /** @name Attributes for encoding */
     /**@{*/
     /**
@@ -416,6 +505,20 @@ typedef enum
      */
     VAConfigAttribEncMacroblockInfo     = 16,
     /**
+     * \brief Maximum picture width. Read-only.
+     *
+     * This attribute determines the maximum picture width the driver supports
+     * for a given configuration.
+     */
+    VAConfigAttribMaxPictureWidth     = 18,
+    /**
+     * \brief Maximum picture height. Read-only.
+     *
+     * This attribute determines the maximum picture height the driver supports
+     * for a given configuration.
+     */
+    VAConfigAttribMaxPictureHeight    = 19,
+    /**
      * \brief JPEG encoding attribute. Read-only.
      *
      * This attribute exposes a number of capabilities of the underlying
@@ -433,6 +536,13 @@ typedef enum
      */
     VAConfigAttribEncQualityRange     = 21,
     /**
+     * \brief Encoding quantization attribute. Read-only.
+     *
+     * This attribute conveys whether the driver supports certain types of quantization methods
+     * for encoding (e.g. trellis). See \c VA_ENC_QUANTIZATION_xxx for the list of quantization methods
+     */
+    VAConfigAttribEncQuantization     = 22,
+    /**
      * \brief Encoding skip frame attribute. Read-only.
      *
      * This attribute conveys whether the driver supports sending skip frame parameters 
@@ -440,6 +550,43 @@ typedef enum
      * externally skipped frames. 
      */
     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,
+
+    /**
+     * \brief Encode function type for FEI.
+     *
+     * This attribute conveys whether the driver supports different function types for encode.
+     * It can be VA_FEI_FUNCTION_ENC, VA_FEI_FUNCTION_PAK, or VA_FEI_FUNCTION_ENC_PAK. Currently
+     * it is for FEI entry point only.
+     * Default is VA_FEI_FUNCTION_ENC_PAK.
+     */
+    VAConfigAttribFEIFunctionType     = 32,
+    /**
+     * \brief Maximum number of FEI MV predictors. Read-only.
+     *
+     * This attribute determines the maximum number of MV predictors the driver
+     * can support to encode a single frame. 0 means no MV predictor is supported.
+     * Currently it is for FEI entry point only.
+     */
+    VAConfigAttribFEIMVPredictors     = 33,
     /**@}*/
     VAConfigAttribTypeMax
 } VAConfigAttribType;
@@ -452,7 +599,7 @@ typedef enum
  */
 typedef struct _VAConfigAttrib {
     VAConfigAttribType type;
-    unsigned int value; /* OR'd flags (bits) for this attribute */
+    uint32_t value; /* OR'd flags (bits) for this attribute */
 } VAConfigAttrib;
 
 /** attribute value for VAConfigAttribRTFormat */
@@ -484,6 +631,10 @@ typedef struct _VAConfigAttrib {
 #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 VAConfigAttribDecSliceMode */
@@ -492,19 +643,54 @@ typedef struct _VAConfigAttrib {
 #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 VAConfigAttribDecJPEG */
+/**@{*/
+typedef union _VAConfigAttribValDecJPEG {
+    struct{
+    /** \brief Set to (1 << VA_ROTATION_xxx) for supported rotation angles. */
+    uint32_t rotation : 4;
+    /** \brief Reserved for future use. */
+    uint32_t reserved : 28;
+    }bits;
+    uint32_t value;
+    uint32_t va_reserved[VA_PADDING_LOW];
+} VAConfigAttribValDecJPEG;
 /**@}*/
 
 /** @name Attribute values for VAConfigAttribEncPackedHeaders */
 /**@{*/
 /** \brief Driver does not support any packed headers mode. */
 #define VA_ENC_PACKED_HEADER_NONE       0x00000000
-/** \brief Driver supports packed sequence headers. e.g. SPS for H.264. */
+/**
+ * \brief Driver supports packed sequence headers. e.g. SPS for H.264.
+ *
+ * Application must provide it to driver once this flag is returned through
+ * vaGetConfigAttributes()
+ */
 #define VA_ENC_PACKED_HEADER_SEQUENCE   0x00000001
-/** \brief Driver supports packed picture headers. e.g. PPS for H.264. */
+/**
+ * \brief Driver supports packed picture headers. e.g. PPS for H.264.
+ *
+ * Application must provide it to driver once this falg is returned through
+ * vaGetConfigAttributes()
+ */
 #define VA_ENC_PACKED_HEADER_PICTURE    0x00000002
-/** \brief Driver supports packed slice headers. e.g. \c slice_header() for H.264. */
+/**
+ * \brief Driver supports packed slice headers. e.g. slice_header() for H.264.
+ *
+ * Application must provide it to driver once this flag is returned through
+ * vaGetConfigAttributes()
+ */
 #define VA_ENC_PACKED_HEADER_SLICE      0x00000004
-/** \brief Driver supports misc packed headers. e.g. SEI for H.264. */
+/**
+ * \brief Driver supports misc packed headers. e.g. SEI for H.264.
+ *
+ * @deprecated
+ * This is a deprecated packed header flag, All applications can use
+ * \c VA_ENC_PACKED_HEADER_RAW_DATA to pass the corresponding packed
+ * header data buffer to the driver
+ */
 #define VA_ENC_PACKED_HEADER_MISC       0x00000008
 /** \brief Driver supports raw packed header, see VAEncPackedHeaderRawData */
 #define VA_ENC_PACKED_HEADER_RAW_DATA   0x00000010
@@ -526,33 +712,119 @@ typedef struct _VAConfigAttrib {
 
 /** @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 rows per slice. */
+/** \brief Driver supports an arbitrary number of macroblocks per slice. */
 #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS    0x00000002
+/** \brief Dirver support 1 rows  per slice */
+#define VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS               0x00000004
+/** \brief Dirver support max encoded slice size per slice */
+#define VA_ENC_SLICE_STRUCTURE_MAX_SLICE_SIZE           0x00000008
+/** \brief Driver supports an arbitrary number of rows per slice. */
+#define VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS           0x00000010
 /**@}*/
 
 /** \brief Attribute value for VAConfigAttribEncJPEG */
 typedef union _VAConfigAttribValEncJPEG {
     struct {
         /** \brief set to 1 for arithmatic coding. */
-        unsigned int arithmatic_coding_mode : 1;
+        uint32_t arithmatic_coding_mode : 1;
         /** \brief set to 1 for progressive dct. */
-        unsigned int progressive_dct_mode : 1;
+        uint32_t progressive_dct_mode : 1;
         /** \brief set to 1 for non-interleaved. */
-        unsigned int non_interleaved_mode : 1;
+        uint32_t 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;
+        uint32_t differential_mode : 1;
+        uint32_t max_num_components : 3;
+        uint32_t max_num_scans : 4;
+        uint32_t max_num_huffman_tables : 3;
+        uint32_t max_num_quantization_tables : 3;
     } bits;
-    unsigned int value;
+    uint32_t value;
 } VAConfigAttribValEncJPEG;
 
+/** @name Attribute values for VAConfigAttribEncQuantization */
+/**@{*/
+/** \brief Driver does not support special types of quantization */
+#define VA_ENC_QUANTIZATION_NONE                        0x00000000
+/** \brief Driver supports trellis quantization */
+#define VA_ENC_QUANTIZATION_TRELLIS_SUPPORTED           0x00000001
+/**@}*/
+/** \brief Attribute value for VAConfigAttribEncROI */
+typedef union _VAConfigAttribValEncROI {
+    struct {
+        /** \brief The number of ROI regions supported, 0 if ROI is not supported. */
+        uint32_t 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.
+         */
+        uint32_t roi_rc_priority_support       : 1;
+        /**
+         * \brief A flag indicates whether ROI delta QP is supported
+         *
+         * \ref roi_rc_qp_delta_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_delta_support equal to 0 specifies
+         * the underlying driver doesn't support ROI delta QP.
+         *
+         * User should ignore \ref roi_rc_qp_delta_support when VAConfigAttribRateControl == VA_RC_CQP
+         * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP.
+         */
+        uint32_t roi_rc_qp_delta_support    : 1;
+        uint32_t reserved                   : 22;
+     } bits;
+     uint32_t 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.
+         */
+        uint32_t 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
+         */
+        uint32_t temporal_layer_bitrate_control_flag : 1;
+        uint32_t reserved                            : 23;
+    } bits;
+    uint32_t value;
+} VAConfigAttribValEncRateControlExt;
+
 /**
  * if an attribute is not applicable for a given
  * profile/entrypoint pair, then set the value to the following 
@@ -621,7 +893,7 @@ typedef unsigned int VAGenericID;
 typedef VAGenericID VAConfigID;
 
 /**
- * Create a configuration for the decode pipeline 
+ * Create a configuration for the video decode/encode/processing pipeline
  * it passes in the attribute list that specifies the attributes it cares 
  * about, with the rest taking default values.  
  */
@@ -663,14 +935,17 @@ VAStatus vaQueryConfigAttributes (
 /**
  * Contexts and Surfaces
  *
- * Context represents a "virtual" video decode pipeline. Surfaces are render 
- * targets for a given context. The data in the surfaces are not accessible  
- * to the client and the internal data format of the surface is implementatin 
- * specific. 
+ * Context represents a "virtual" video decode, encode or video processing
+ * pipeline. Surfaces are render targets for a given context. The data in the
+ * surfaces are not accessible to the client except if derived image is supported
+ * and the internal data format of the surface is implementation specific.
  *
- * Surfaces will be bound to a context when the context is created. Once
- * a surface is bound to a given context, it can not be used to create  
- * another context. The association is removed when the context is destroyed
+ * Surfaces are provided as a hint of what surfaces will be used when the context
+ * is created through vaCreateContext(). A surface may be used by different contexts
+ * at the same time as soon as application can make sure the operations are synchronized
+ * between different contexts, e.g. a surface is used as the output of a decode context
+ * and the input of a video process context. Surfaces can only be destroyed after all
+ * contexts using these surfaces have been destroyed.
  * 
  * Both contexts and surfaces are identified by unique IDs and its
  * implementation specific internals are kept opaque to the clients
@@ -701,7 +976,7 @@ typedef struct _VAGenericValue {
     /** \brief Value holder. */
     union {
         /** \brief 32-bit signed integer. */
-        int             i;
+        int32_t             i;
         /** \brief 32-bit float. */
         float           f;
         /** \brief Generic pointer. */
@@ -759,7 +1034,7 @@ typedef struct _VASurfaceAttrib {
     /** \brief Type. */
     VASurfaceAttribType type;
     /** \brief Flags. See "Surface attribute flags". */
-    unsigned int        flags;
+    uint32_t        flags;
     /** \brief Value. See "Surface attribute types" for the expected types. */
     VAGenericValue      value;
 } VASurfaceAttrib;
@@ -785,25 +1060,25 @@ typedef struct _VASurfaceAttrib {
  */
 typedef struct _VASurfaceAttribExternalBuffers {
     /** \brief pixel format in fourcc. */
-    unsigned int pixel_format;
+    uint32_t pixel_format;
     /** \brief width in pixels. */
-    unsigned int width;
+    uint32_t width;
     /** \brief height in pixels. */
-    unsigned int height;
+    uint32_t height;
     /** \brief total size of the buffer in bytes. */
-    unsigned int data_size;
+    uint32_t data_size;
     /** \brief number of planes for planar layout */
-    unsigned int num_planes;
+    uint32_t num_planes;
     /** \brief pitch for each plane in bytes */
-    unsigned int pitches[4];
+    uint32_t pitches[4];
     /** \brief offset for each plane in bytes */
-    unsigned int offsets[4];
+    uint32_t offsets[4];
     /** \brief buffer handles or user pointers */
-    unsigned long *buffers;
+    uintptr_t *buffers;
     /** \brief number of elements in the "buffers" array */
-    unsigned int num_buffers;
+    uint32_t num_buffers;
     /** \brief flags. See "Surface external buffer descriptor flags". */
-    unsigned int flags;
+    uint32_t flags;
     /** \brief reserved for passing private data */
     void *private_data;
 } VASurfaceAttribExternalBuffers;
@@ -841,11 +1116,10 @@ typedef struct _VASurfaceAttribExternalBuffers {
 /**
  * \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.
+ * 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
@@ -878,9 +1152,8 @@ vaQuerySurfaceAttributes(
  * \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().
+ * be constructed 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_*
@@ -906,7 +1179,7 @@ vaCreateSurfaces(
     
 /**
  * vaDestroySurfaces - Destroy resources associated with surfaces. 
- *  Surfaces can only be destroyed after the context associated has been 
+ *  Surfaces can only be destroyed after all contexts using these surfaces have been
  *  destroyed.  
  *  dpy: display
  *  surfaces: array of surfaces to destroy
@@ -927,7 +1200,7 @@ VAStatus vaDestroySurfaces (
  *  picture_height: coded picture height
  *  flag: any combination of the following:
  *    VA_PROGRESSIVE (only progressive frame pictures in the sequence when set)
- *  render_targets: render targets (surfaces) tied to the context
+ *  render_targets: a hint for render targets (surfaces) tied to the context
  *  num_render_targets: number of render targets in the above array
  *  context: created context id upon return
  */
@@ -952,6 +1225,86 @@ VAStatus vaDestroyContext (
     VAContextID context
 );
 
+//Multi-frame context
+typedef VAGenericID VAMFContextID;
+/**
+ * vaCreateMFContext - Create a multi-frame context
+ *  interface encapsulating common for all streams memory objects and structures
+ *  required for single GPU task submission from several VAContextID's.
+ *  Allocation: This call only creates an instance, doesn't allocate any additional memory.
+ *  Support identification: Application can identify multi-frame feature support by ability
+ *  to create multi-frame context. If driver supports multi-frame - call successful,
+ *  mf_context != NULL and VAStatus = VA_STATUS_SUCCESS, otherwise if multi-frame processing
+ *  not supported driver returns VA_STATUS_ERROR_UNIMPLEMENTED and mf_context = NULL.
+ *  return values:
+ *  VA_STATUS_SUCCESS - operation successful.
+ *  VA_STATUS_ERROR_UNIMPLEMENTED - no support for multi-frame.
+ *  dpy: display adapter.
+ *  mf_context: Multi-Frame context encapsulating all associated context
+ *  for multi-frame submission.
+ */
+VAStatus vaCreateMFContext (
+    VADisplay dpy,
+    VAMFContextID *mf_context    /* out */
+);
+
+/**
+ * vaMFAddContext - Provide ability to associate each context used for
+ *  Multi-Frame submission and common Multi-Frame context.
+ *  Try to add context to understand if it is supported.
+ *  Allocation: this call allocates and/or reallocates all memory objects
+ *  common for all contexts associated with particular Multi-Frame context.
+ *  All memory required for each context(pixel buffers, internal driver
+ *  buffers required for processing) allocated during standard vaCreateContext call for each context.
+ *  Runtime dependency - if current implementation doesn't allow to run different entry points/profile,
+ *  first context added will set entry point/profile for whole Multi-Frame context,
+ *  all other entry points and profiles can be rejected to be added.
+ *  Return values:
+ *  VA_STATUS_SUCCESS - operation successful, context was added.
+ *  VA_STATUS_ERROR_OPERATION_FAILED - something unexpected happened - application have to close
+ *  current mf_context and associated contexts and start working with new ones.
+ *  VA_STATUS_ERROR_INVALID_CONTEXT - ContextID is invalid, means:
+ *  1 - mf_context is not valid context or
+ *  2 - driver can't suport different VAEntrypoint or VAProfile simultaneosly
+ *  and current context contradicts with previously added, application can continue with current mf_context
+ *  and other contexts passed this call, rejected context can continue work in stand-alone
+ *  mode or other mf_context.
+ *  VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT - particular context being added was created with with
+ *  unsupported VAEntrypoint. Application can continue with current mf_context
+ *  and other contexts passed this call, rejected context can continue work in stand-alone
+ *  mode.
+ *  VA_STATUS_ERROR_UNSUPPORTED_PROFILE - Current context with Particular VAEntrypoint is supported
+ *  but VAProfile is not supported. Application can continue with current mf_context
+ *  and other contexts passed this call, rejected context can continue work in stand-alone
+ *  mode.
+ *  dpy: display adapter.
+ *  context: context being associated with Multi-Frame context.
+ *  mf_context: - multi-frame context used to associate contexts for multi-frame submission.
+ */
+VAStatus vaMFAddContext (
+    VADisplay dpy,
+    VAMFContextID mf_context,
+    VAContextID context
+);
+
+/**
+ * vaMFReleaseContext - Removes context from multi-frame and
+ *  association with multi-frame context.
+ *  After association removed vaEndPicture will submit tasks, but not vaMFSubmit.
+ *  Return values:
+ *  VA_STATUS_SUCCESS - operation successful, context was removed.
+ *  VA_STATUS_ERROR_OPERATION_FAILED - something unexpected happened.
+ *  application need to destroy this VAMFContextID and all assotiated VAContextID
+ *  dpy: display
+ *  mf_context: VAMFContextID where context is added
+ *  context: VAContextID to be added
+ */
+VAStatus vaMFReleaseContext (
+    VADisplay dpy,
+    VAMFContextID mf_context,
+    VAContextID context
+);
+
 /**
  * Buffers 
  * Buffers are used to pass various types of data from the
@@ -989,6 +1342,15 @@ typedef enum
     VAEncMiscParameterBufferType       = 27,
     VAEncMacroblockParameterBufferType = 28,
     VAEncMacroblockMapBufferType        = 29,
+
+    /**
+     * \brief Encoding QP buffer
+     *
+     * This buffer contains QP per MB for encoding. Currently
+     * VAEncQPBufferH264 is defined for H.264 encoding, see
+     * #VAEncQPBufferH264 for details
+     */
+    VAEncQPBufferType                   = 30,
 /* Following are video processing buffer types */
     /**
      * \brief Video processing pipeline parameter buffer.
@@ -1010,6 +1372,14 @@ typedef enum
      * color balance (#VAProcFilterParameterBufferColorBalance), etc.
      */
     VAProcFilterParameterBufferType     = 42,
+    /**
+     * \brief FEI specific buffer types
+     */
+    VAEncFEIMVBufferType                = 43,
+    VAEncFEIMBCodeBufferType            = 44,
+    VAEncFEIDistortionBufferType        = 45,
+    VAEncFEIMBControlBufferType         = 46,
+    VAEncFEIMVPredictorBufferType       = 47,
     VABufferTypeMax
 } VABufferType;
 
@@ -1024,9 +1394,17 @@ typedef enum
     /** \brief Buffer type used for HRD parameters. */
     VAEncMiscParameterTypeHRD           = 5,
     VAEncMiscParameterTypeQualityLevel  = 6,
+    /** \brief Buffer type used for quantization parameters, it's per-sequence parameter*/
+    VAEncMiscParameterTypeQuantization  = 8,
     /** \brief Buffer type used for sending skip frame parameters to the encoder's
       * rate control, when the user has externally skipped frames. */
-    VAEncMiscParameterTypeSkipFrame     = 9
+    VAEncMiscParameterTypeSkipFrame     = 9,
+    /** \brief Buffer type used for region-of-interest (ROI) parameters. */
+    VAEncMiscParameterTypeROI           = 10,
+    /** \brief Buffer type used for temporal layer structure */
+    VAEncMiscParameterTypeTemporalLayerStructure   = 12,
+    /** \brief Buffer type used for FEI input frame level parameters */
+    VAEncMiscParameterTypeFEIFrameControl = 18,
 } VAEncMiscParameterType;
 
 /** \brief Packed header type. */
@@ -1046,18 +1424,27 @@ typedef enum {
      * in the packed header parameter structure.
      */
     VAEncPackedHeaderRawData    = 4,
-    /** \brief Misc packed header. See codec-specific definitions. */
-    VAEncPackedHeaderMiscMask   = 0x80000000,
+    /**
+     * \brief Misc packed header. See codec-specific definitions.
+     *
+     * @deprecated
+     * This is a deprecated packed header type. All applications can use
+     * \c VAEncPackedHeaderRawData to insert a codec-specific packed header
+     */
+    VAEncPackedHeaderMiscMask va_deprecated_enum  = 0x80000000,
 } VAEncPackedHeaderType;
 
 /** \brief Packed header parameter. */
 typedef struct _VAEncPackedHeaderParameterBuffer {
     /** Type of the packed header buffer. See #VAEncPackedHeaderType. */
-    unsigned int                type;
+    uint32_t                type;
     /** \brief Size of the #VAEncPackedHeaderDataBuffer in bits. */
-    unsigned int                bit_length;
+    uint32_t                bit_length;
     /** \brief Flag: buffer contains start code emulation prevention bytes? */
-    unsigned char               has_emulation_bytes;
+    uint8_t               has_emulation_bytes;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncPackedHeaderParameterBuffer;
 
 /**
@@ -1080,43 +1467,105 @@ typedef struct _VAEncPackedHeaderParameterBuffer {
 typedef struct _VAEncMiscParameterBuffer
 {
     VAEncMiscParameterType type;
-    unsigned int data[0];
+    uint32_t data[];
 } VAEncMiscParameterBuffer;
 
+/** \brief Temporal layer Structure*/
+typedef struct _VAEncMiscParameterTemporalLayerStructure
+{
+    /** \brief The number of temporal layers */
+    uint32_t number_of_layers;
+    /** \brief The length of the array defining frame layer membership. Should be 1-32 */
+    uint32_t 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.
+     */
+    uint32_t layer_id[32];
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
+} VAEncMiscParameterTemporalLayerStructure;
+
 
 /** \brief Rate control parameters */
 typedef struct _VAEncMiscParameterRateControl
 {
     /* this is the maximum bit-rate to be constrained by the rate control implementation */
-    unsigned int bits_per_second;
+    uint32_t 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;
+    uint32_t 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;
+    uint32_t window_size;
     /* initial QP at I frames */
-    unsigned int initial_qp;
-    unsigned int min_qp;
-    unsigned int basic_unit_size;
+    uint32_t initial_qp;
+    uint32_t min_qp;
+    uint32_t 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 */
+            uint32_t reset : 1;
+            uint32_t disable_frame_skip : 1; /* Disable frame skip in rate control mode */
+            uint32_t disable_bit_stuffing : 1; /* Disable bit stuffing in rate control mode */
+            uint32_t 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.
+             */
+            uint32_t temporal_id : 8;
+            /** \brief Reserved for future use, must be zero */
+            uint32_t reserved : 17;
         } bits;
-        unsigned int value;
+        uint32_t value;
     } rc_flags;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_MEDIUM];
 } VAEncMiscParameterRateControl;
 
 typedef struct _VAEncMiscParameterFrameRate
 {
-    unsigned int framerate;
+    /*
+     * 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.
+     */
+    uint32_t framerate;
+    union
+    {
+        struct
+        {
+            /*
+             * The temporal id the framerate parameters are specified for.
+             */
+            uint32_t temporal_id : 8;
+            uint32_t reserved : 24;
+         } bits;
+         uint32_t value;
+     } framerate_flags;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncMiscParameterFrameRate;
 
 /**
@@ -1126,20 +1575,29 @@ typedef struct _VAEncMiscParameterFrameRate
  */
 typedef struct _VAEncMiscParameterMaxSliceSize
 {
-    unsigned int max_slice_size;
+    uint32_t max_slice_size;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncMiscParameterMaxSliceSize;
 
 typedef struct _VAEncMiscParameterAIR
 {
-    unsigned int air_num_mbs;
-    unsigned int air_threshold;
-    unsigned int air_auto; /* if set to 1 then hardware auto-tune the AIR threshold */
+    uint32_t air_num_mbs;
+    uint32_t air_threshold;
+    uint32_t air_auto; /* if set to 1 then hardware auto-tune the AIR threshold */
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncMiscParameterAIR;
 
 typedef struct _VAEncMiscParameterHRD
 {
-    unsigned int initial_buffer_fullness;       /* in bits */
-    unsigned int buffer_size;                   /* in bits */
+    uint32_t initial_buffer_fullness;       /* in bits */
+    uint32_t buffer_size;                   /* in bits */
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncMiscParameterHRD;
 
 /**
@@ -1155,7 +1613,10 @@ 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;
+    uint32_t                max_frame_size;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncMiscParameterBufferMaxFrameSize;
 
 /**
@@ -1173,10 +1634,40 @@ typedef struct _VAEncMiscParameterBufferQualityLevel {
     /** \brief Encoding quality level setting. When set to 0, default quality
      * level is used.
      */
-    unsigned int                quality_level;
+    uint32_t                quality_level;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncMiscParameterBufferQualityLevel;
 
 /**
+ * \brief Quantization settings for encoding.
+ *
+ * Some encoders support special types of quantization such as trellis, and this structure
+ * can be used by the app to control these special types of quantization by the encoder.
+ */
+typedef struct _VAEncMiscParameterQuantization
+{
+    union
+    {
+    /* if no flags is set then quantization is determined by the driver */
+        struct
+        {
+           /* \brief disable trellis for all frames/fields */
+            uint64_t disable_trellis : 1;
+           /* \brief enable trellis for I frames/fields */
+            uint64_t enable_trellis_I : 1;
+           /* \brief enable trellis for P frames/fields */
+            uint64_t enable_trellis_P : 1;
+           /* \brief enable trellis for B frames/fields */
+            uint64_t enable_trellis_B : 1;
+            uint64_t reserved : 28;
+        } bits;
+        uint64_t value;
+    } quantization_flags;
+} VAEncMiscParameterQuantization;
+
+/**
  * \brief Encoding skip frame.
  *
  * The application may choose to skip frames externally to the encoder (e.g. drop completely or 
@@ -1192,15 +1683,91 @@ typedef struct _VAEncMiscParameterSkipFrame {
       * 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;
+    uint8_t               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;
+    uint8_t               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;
+    uint32_t                size_skip_frames;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } 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.
+         */
+        int8_t            roi_value;
+} VAEncROI;
+
+typedef struct _VAEncMiscParameterBufferROI {
+    /** \brief Number of ROIs being sent.*/
+    uint32_t        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. */
+    int8_t                max_delta_qp;
+    int8_t                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_delta_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;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
+} 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.
@@ -1216,9 +1783,9 @@ typedef struct _VAEncMiscParameterSkipFrame {
 /* Codec-independent Slice Parameter Buffer base */
 typedef struct _VASliceParameterBufferBase
 {
-    unsigned int slice_data_size;      /* number of bytes in the slice data buffer for this slice */
-    unsigned int slice_data_offset;    /* the offset to the first byte of slice data */
-    unsigned int slice_data_flag;      /* see VA_SLICE_DATA_FLAG_XXX definitions */
+    uint32_t slice_data_size;  /* number of bytes in the slice data buffer for this slice */
+    uint32_t slice_data_offset;        /* the offset to the first byte of slice data */
+    uint32_t slice_data_flag;  /* see VA_SLICE_DATA_FLAG_XXX definitions */
 } VASliceParameterBufferBase;
 
 /**********************************
@@ -1238,26 +1805,29 @@ typedef struct _VASliceParameterBufferBase
  */
 typedef struct _VAHuffmanTableBufferJPEGBaseline {
     /** \brief Specifies which #huffman_table is valid. */
-    unsigned char       load_huffman_table[2];
+    uint8_t       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];
+        uint8_t   num_dc_codes[16];
         /** \brief Value associated with each Huffman code (Vij). */
-        unsigned char   dc_values[12];
+        uint8_t   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];
+        uint8_t   num_ac_codes[16];
         /** \brief Value associated with each Huffman code (Vij). */
-        unsigned char   ac_values[162];
+        uint8_t   ac_values[162];
         /** \brief Padding to 4-byte boundaries. Must be set to zero. */
-        unsigned char   pad[2];
+        uint8_t   pad[2];
         /**@}*/
     }                   huffman_table[2];
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAHuffmanTableBufferJPEGBaseline;
 
 /****************************
@@ -1271,86 +1841,95 @@ typedef struct _VAHuffmanTableBufferJPEGBaseline {
  */
 typedef struct _VAPictureParameterBufferMPEG2
 {
-    unsigned short horizontal_size;
-    unsigned short vertical_size;
+    uint16_t horizontal_size;
+    uint16_t vertical_size;
     VASurfaceID forward_reference_picture;
     VASurfaceID backward_reference_picture;
     /* meanings of the following fields are the same as in the standard */
-    int picture_coding_type;
-    int f_code; /* pack all four fcode into this */
+    int32_t picture_coding_type;
+    int32_t f_code; /* pack all four fcode into this */
     union {
         struct {
-            unsigned int intra_dc_precision            : 2; 
-            unsigned int picture_structure             : 2; 
-            unsigned int top_field_first               : 1; 
-            unsigned int frame_pred_frame_dct          : 1; 
-            unsigned int concealment_motion_vectors    : 1;
-            unsigned int q_scale_type                  : 1;
-            unsigned int intra_vlc_format              : 1;
-            unsigned int alternate_scan                        : 1;
-            unsigned int repeat_first_field            : 1;
-            unsigned int progressive_frame             : 1;
-            unsigned int is_first_field                        : 1; /* indicate whether the current field
+            uint32_t intra_dc_precision                : 2; 
+            uint32_t picture_structure         : 2; 
+            uint32_t top_field_first           : 1; 
+            uint32_t frame_pred_frame_dct              : 1; 
+            uint32_t concealment_motion_vectors        : 1;
+            uint32_t q_scale_type                      : 1;
+            uint32_t intra_vlc_format          : 1;
+            uint32_t alternate_scan                    : 1;
+            uint32_t repeat_first_field                : 1;
+            uint32_t progressive_frame         : 1;
+            uint32_t is_first_field                    : 1; /* indicate whether the current field
                                                               * is the first field for field picture
                                                               */
         } bits;
-        unsigned int value;
+        uint32_t value;
     } picture_coding_extension;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAPictureParameterBufferMPEG2;
 
 /** MPEG-2 Inverse Quantization Matrix Buffer */
 typedef struct _VAIQMatrixBufferMPEG2
 {
     /** \brief Same as the MPEG-2 bitstream syntax element. */
-    int load_intra_quantiser_matrix;
+    int32_t load_intra_quantiser_matrix;
     /** \brief Same as the MPEG-2 bitstream syntax element. */
-    int load_non_intra_quantiser_matrix;
+    int32_t load_non_intra_quantiser_matrix;
     /** \brief Same as the MPEG-2 bitstream syntax element. */
-    int load_chroma_intra_quantiser_matrix;
+    int32_t load_chroma_intra_quantiser_matrix;
     /** \brief Same as the MPEG-2 bitstream syntax element. */
-    int load_chroma_non_intra_quantiser_matrix;
+    int32_t load_chroma_non_intra_quantiser_matrix;
     /** \brief Luminance intra matrix, in zig-zag scan order. */
-    unsigned char intra_quantiser_matrix[64];
+    uint8_t intra_quantiser_matrix[64];
     /** \brief Luminance non-intra matrix, in zig-zag scan order. */
-    unsigned char non_intra_quantiser_matrix[64];
+    uint8_t non_intra_quantiser_matrix[64];
     /** \brief Chroma intra matrix, in zig-zag scan order. */
-    unsigned char chroma_intra_quantiser_matrix[64];
+    uint8_t chroma_intra_quantiser_matrix[64];
     /** \brief Chroma non-intra matrix, in zig-zag scan order. */
-    unsigned char chroma_non_intra_quantiser_matrix[64];
+    uint8_t chroma_non_intra_quantiser_matrix[64];
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAIQMatrixBufferMPEG2;
 
 /** MPEG-2 Slice Parameter Buffer */
 typedef struct _VASliceParameterBufferMPEG2
 {
-    unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
-    unsigned int slice_data_offset;/* the offset to the first byte of slice data */
-    unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
-    unsigned int macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
-    unsigned int slice_horizontal_position;
-    unsigned int slice_vertical_position;
-    int quantiser_scale_code;
-    int intra_slice_flag;
+    uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
+    uint32_t slice_data_offset;/* the offset to the first byte of slice data */
+    uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
+    uint32_t macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
+    uint32_t slice_horizontal_position;
+    uint32_t slice_vertical_position;
+    int32_t quantiser_scale_code;
+    int32_t intra_slice_flag;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VASliceParameterBufferMPEG2;
 
 /** MPEG-2 Macroblock Parameter Buffer */
 typedef struct _VAMacroblockParameterBufferMPEG2
 {
-    unsigned short macroblock_address;
+    uint16_t macroblock_address;
     /* 
      * macroblock_address (in raster scan order)
      * top-left: 0
      * bottom-right: picture-height-in-mb*picture-width-in-mb - 1
      */
-    unsigned char macroblock_type;  /* see definition below */
+    uint8_t macroblock_type;  /* see definition below */
     union {
         struct {
-            unsigned int frame_motion_type             : 2; 
-            unsigned int field_motion_type             : 2; 
-            unsigned int dct_type                      : 1; 
+            uint32_t frame_motion_type         : 2; 
+            uint32_t field_motion_type         : 2; 
+            uint32_t dct_type                  : 1; 
         } bits;
-        unsigned int value;
+        uint32_t value;
     } macroblock_modes;
-    unsigned char motion_vertical_field_select; 
+    uint8_t motion_vertical_field_select; 
     /* 
      * motion_vertical_field_select:
      * see section 6.3.17.2 in the spec
@@ -1360,15 +1939,18 @@ typedef struct _VAMacroblockParameterBufferMPEG2
      * bit 2: second vector forward
      * bit 3: second vector backward
      */
-    short PMV[2][2][2]; /* see Table 7-7 in the spec */
-    unsigned short coded_block_pattern;
+    int16_t PMV[2][2][2]; /* see Table 7-7 in the spec */
+    uint16_t coded_block_pattern;
     /* 
      * The bitplanes for coded_block_pattern are described 
      * in Figure 6.10-12 in the spec
      */
      
     /* Number of skipped macroblocks after this macroblock */
-    unsigned short num_skipped_macroblocks;
+    uint16_t num_skipped_macroblocks;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAMacroblockParameterBufferMPEG2;
 
 /* 
@@ -1396,74 +1978,83 @@ typedef struct _VAMacroblockParameterBufferMPEG2
  */
 typedef struct _VAPictureParameterBufferMPEG4
 {
-    unsigned short vop_width;
-    unsigned short vop_height;
+    uint16_t vop_width;
+    uint16_t vop_height;
     VASurfaceID forward_reference_picture;
     VASurfaceID backward_reference_picture;
     union {
         struct {
-            unsigned int short_video_header            : 1; 
-            unsigned int chroma_format                 : 2; 
-            unsigned int interlaced                    : 1; 
-            unsigned int obmc_disable                  : 1; 
-            unsigned int sprite_enable                 : 2; 
-            unsigned int sprite_warping_accuracy       : 2; 
-            unsigned int quant_type                    : 1; 
-            unsigned int quarter_sample                        : 1; 
-            unsigned int data_partitioned              : 1; 
-            unsigned int reversible_vlc                        : 1; 
-            unsigned int resync_marker_disable         : 1; 
+            uint32_t short_video_header                : 1; 
+            uint32_t chroma_format                     : 2; 
+            uint32_t interlaced                        : 1; 
+            uint32_t obmc_disable                      : 1; 
+            uint32_t sprite_enable                     : 2; 
+            uint32_t sprite_warping_accuracy   : 2; 
+            uint32_t quant_type                        : 1; 
+            uint32_t quarter_sample                    : 1; 
+            uint32_t data_partitioned          : 1; 
+            uint32_t reversible_vlc                    : 1; 
+            uint32_t resync_marker_disable             : 1; 
         } bits;
-        unsigned int value;
+        uint32_t value;
     } vol_fields;
-    unsigned char no_of_sprite_warping_points;
-    short sprite_trajectory_du[3];
-    short sprite_trajectory_dv[3];
-    unsigned char quant_precision;
+    uint8_t no_of_sprite_warping_points;
+    int16_t sprite_trajectory_du[3];
+    int16_t sprite_trajectory_dv[3];
+    uint8_t quant_precision;
     union {
         struct {
-            unsigned int vop_coding_type               : 2; 
-            unsigned int backward_reference_vop_coding_type    : 2; 
-            unsigned int vop_rounding_type             : 1; 
-            unsigned int intra_dc_vlc_thr              : 3; 
-            unsigned int top_field_first               : 1; 
-            unsigned int alternate_vertical_scan_flag  : 1; 
+            uint32_t vop_coding_type           : 2; 
+            uint32_t backward_reference_vop_coding_type        : 2; 
+            uint32_t vop_rounding_type         : 1; 
+            uint32_t intra_dc_vlc_thr          : 3; 
+            uint32_t top_field_first           : 1; 
+            uint32_t alternate_vertical_scan_flag      : 1; 
         } bits;
-        unsigned int value;
+        uint32_t value;
     } vop_fields;
-    unsigned char vop_fcode_forward;
-    unsigned char vop_fcode_backward;
-    unsigned short vop_time_increment_resolution;
+    uint8_t vop_fcode_forward;
+    uint8_t vop_fcode_backward;
+    uint16_t vop_time_increment_resolution;
     /* short header related */
-    unsigned char num_gobs_in_vop;
-    unsigned char num_macroblocks_in_gob;
+    uint8_t num_gobs_in_vop;
+    uint8_t num_macroblocks_in_gob;
     /* for direct mode prediction */
-    short TRB;
-    short TRD;
+    int16_t TRB;
+    int16_t TRD;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAPictureParameterBufferMPEG4;
 
 /** MPEG-4 Inverse Quantization Matrix Buffer */
 typedef struct _VAIQMatrixBufferMPEG4
 {
     /** Same as the MPEG-4:2 bitstream syntax element. */
-    int load_intra_quant_mat;
+    int32_t load_intra_quant_mat;
     /** Same as the MPEG-4:2 bitstream syntax element. */
-    int load_non_intra_quant_mat;
+    int32_t load_non_intra_quant_mat;
     /** The matrix for intra blocks, in zig-zag scan order. */
-    unsigned char intra_quant_mat[64];
+    uint8_t intra_quant_mat[64];
     /** The matrix for non-intra blocks, in zig-zag scan order. */
-    unsigned char non_intra_quant_mat[64];
+    uint8_t non_intra_quant_mat[64];
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAIQMatrixBufferMPEG4;
 
 /** MPEG-4 Slice Parameter Buffer */
 typedef struct _VASliceParameterBufferMPEG4
 {
-    unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
-    unsigned int slice_data_offset;/* the offset to the first byte of slice data */
-    unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
-    unsigned int macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
-    unsigned int macroblock_number;
-    int quant_scale;
+    uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
+    uint32_t slice_data_offset;/* the offset to the first byte of slice data */
+    uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
+    uint32_t macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
+    uint32_t macroblock_number;
+    int32_t quant_scale;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VASliceParameterBufferMPEG4;
 
 /**
@@ -1504,138 +2095,146 @@ typedef struct _VAPictureParameterBufferVC1
     /* sequence layer for AP or meta data for SP and MP */
     union {
         struct {
-            unsigned int pulldown      : 1; /* SEQUENCE_LAYER::PULLDOWN */
-            unsigned int interlace     : 1; /* SEQUENCE_LAYER::INTERLACE */
-            unsigned int tfcntrflag    : 1; /* SEQUENCE_LAYER::TFCNTRFLAG */
-            unsigned int finterpflag   : 1; /* SEQUENCE_LAYER::FINTERPFLAG */
-            unsigned int psf           : 1; /* SEQUENCE_LAYER::PSF */
-            unsigned int multires      : 1; /* METADATA::MULTIRES */
-            unsigned int overlap       : 1; /* METADATA::OVERLAP */
-            unsigned int syncmarker    : 1; /* METADATA::SYNCMARKER */
-            unsigned int rangered      : 1; /* METADATA::RANGERED */
-            unsigned int max_b_frames  : 3; /* METADATA::MAXBFRAMES */
-            unsigned int profile       : 2; /* SEQUENCE_LAYER::PROFILE or The MSB of METADATA::PROFILE */
+            uint32_t pulldown  : 1; /* SEQUENCE_LAYER::PULLDOWN */
+            uint32_t interlace : 1; /* SEQUENCE_LAYER::INTERLACE */
+            uint32_t tfcntrflag        : 1; /* SEQUENCE_LAYER::TFCNTRFLAG */
+            uint32_t finterpflag       : 1; /* SEQUENCE_LAYER::FINTERPFLAG */
+            uint32_t psf               : 1; /* SEQUENCE_LAYER::PSF */
+            uint32_t multires  : 1; /* METADATA::MULTIRES */
+            uint32_t overlap   : 1; /* METADATA::OVERLAP */
+            uint32_t syncmarker        : 1; /* METADATA::SYNCMARKER */
+            uint32_t rangered  : 1; /* METADATA::RANGERED */
+            uint32_t max_b_frames      : 3; /* METADATA::MAXBFRAMES */
+            uint32_t profile   : 2; /* SEQUENCE_LAYER::PROFILE or The MSB of METADATA::PROFILE */
         } bits;
-        unsigned int value;
+        uint32_t value;
     } sequence_fields;
 
-    unsigned short coded_width;                /* ENTRY_POINT_LAYER::CODED_WIDTH */
-    unsigned short coded_height;       /* ENTRY_POINT_LAYER::CODED_HEIGHT */
+    uint16_t coded_width;              /* ENTRY_POINT_LAYER::CODED_WIDTH */
+    uint16_t coded_height;     /* ENTRY_POINT_LAYER::CODED_HEIGHT */
     union {
        struct {
-            unsigned int broken_link   : 1; /* ENTRY_POINT_LAYER::BROKEN_LINK */
-            unsigned int closed_entry  : 1; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */
-            unsigned int panscan_flag  : 1; /* ENTRY_POINT_LAYER::PANSCAN_FLAG */
-            unsigned int loopfilter    : 1; /* ENTRY_POINT_LAYER::LOOPFILTER */
+            uint32_t broken_link       : 1; /* ENTRY_POINT_LAYER::BROKEN_LINK */
+            uint32_t closed_entry      : 1; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */
+            uint32_t panscan_flag      : 1; /* ENTRY_POINT_LAYER::PANSCAN_FLAG */
+            uint32_t loopfilter        : 1; /* ENTRY_POINT_LAYER::LOOPFILTER */
        } bits;
-       unsigned int value;
+       uint32_t value;
     } entrypoint_fields;
-    unsigned char conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */
-    unsigned char fast_uvmc_flag;      /* ENTRY_POINT_LAYER::FASTUVMC */
+    uint8_t conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */
+    uint8_t fast_uvmc_flag;    /* ENTRY_POINT_LAYER::FASTUVMC */
     union {
         struct {
-            unsigned int luma_flag     : 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */
-            unsigned int luma          : 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */
-            unsigned int chroma_flag   : 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */
-            unsigned int chroma                : 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */
+            uint32_t luma_flag : 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */
+            uint32_t luma              : 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */
+            uint32_t chroma_flag       : 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */
+            uint32_t chroma            : 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */
         } bits;
-        unsigned int value;
+        uint32_t value;
     } range_mapping_fields;
 
-    unsigned char b_picture_fraction;  /* PICTURE_LAYER::BFRACTION */
-    unsigned char cbp_table;           /* PICTURE_LAYER::CBPTAB/ICBPTAB */
-    unsigned char mb_mode_table;       /* PICTURE_LAYER::MBMODETAB */
-    unsigned char range_reduction_frame;/* PICTURE_LAYER::RANGEREDFRM */
-    unsigned char rounding_control;    /* PICTURE_LAYER::RNDCTRL */
-    unsigned char post_processing;     /* PICTURE_LAYER::POSTPROC */
-    unsigned char picture_resolution_index;    /* PICTURE_LAYER::RESPIC */
-    unsigned char luma_scale;          /* PICTURE_LAYER::LUMSCALE */
-    unsigned char luma_shift;          /* PICTURE_LAYER::LUMSHIFT */
+    uint8_t b_picture_fraction;        /* Index for PICTURE_LAYER::BFRACTION value in Table 40 (7.1.1.14) */
+    uint8_t cbp_table;         /* PICTURE_LAYER::CBPTAB/ICBPTAB */
+    uint8_t mb_mode_table;     /* PICTURE_LAYER::MBMODETAB */
+    uint8_t range_reduction_frame;/* PICTURE_LAYER::RANGEREDFRM */
+    uint8_t rounding_control;  /* PICTURE_LAYER::RNDCTRL */
+    uint8_t post_processing;   /* PICTURE_LAYER::POSTPROC */
+    uint8_t picture_resolution_index;  /* PICTURE_LAYER::RESPIC */
+    uint8_t luma_scale;                /* PICTURE_LAYER::LUMSCALE */
+    uint8_t luma_shift;                /* PICTURE_LAYER::LUMSHIFT */
+
     union {
         struct {
-            unsigned int picture_type          : 3; /* PICTURE_LAYER::PTYPE */
-            unsigned int frame_coding_mode     : 3; /* PICTURE_LAYER::FCM */
-            unsigned int top_field_first       : 1; /* PICTURE_LAYER::TFF */
-            unsigned int is_first_field                : 1; /* set to 1 if it is the first field */
-            unsigned int intensity_compensation        : 1; /* PICTURE_LAYER::INTCOMP */
+            uint32_t picture_type              : 3; /* PICTURE_LAYER::PTYPE */
+            uint32_t frame_coding_mode : 3; /* PICTURE_LAYER::FCM */
+            uint32_t top_field_first   : 1; /* PICTURE_LAYER::TFF */
+            uint32_t is_first_field            : 1; /* set to 1 if it is the first field */
+            uint32_t intensity_compensation    : 1; /* PICTURE_LAYER::INTCOMP */
         } bits;
-        unsigned int value;
+        uint32_t value;
     } picture_fields;
     union {
         struct {
-            unsigned int mv_type_mb    : 1;    /* PICTURE::MVTYPEMB */
-            unsigned int direct_mb     : 1;    /* PICTURE::DIRECTMB */
-            unsigned int skip_mb       : 1;    /* PICTURE::SKIPMB */
-            unsigned int field_tx      : 1;    /* PICTURE::FIELDTX */
-            unsigned int forward_mb    : 1;    /* PICTURE::FORWARDMB */
-            unsigned int ac_pred       : 1;    /* PICTURE::ACPRED */
-            unsigned int overflags     : 1;    /* PICTURE::OVERFLAGS */
+            uint32_t mv_type_mb        : 1;    /* PICTURE::MVTYPEMB */
+            uint32_t direct_mb : 1;    /* PICTURE::DIRECTMB */
+            uint32_t skip_mb   : 1;    /* PICTURE::SKIPMB */
+            uint32_t field_tx  : 1;    /* PICTURE::FIELDTX */
+            uint32_t forward_mb        : 1;    /* PICTURE::FORWARDMB */
+            uint32_t ac_pred   : 1;    /* PICTURE::ACPRED */
+            uint32_t overflags : 1;    /* PICTURE::OVERFLAGS */
         } flags;
-        unsigned int value;
+        uint32_t value;
     } raw_coding;
     union {
         struct {
-            unsigned int bp_mv_type_mb   : 1;    /* PICTURE::MVTYPEMB */
-            unsigned int bp_direct_mb    : 1;    /* PICTURE::DIRECTMB */
-            unsigned int bp_skip_mb      : 1;    /* PICTURE::SKIPMB */  
-            unsigned int bp_field_tx     : 1;    /* PICTURE::FIELDTX */ 
-            unsigned int bp_forward_mb   : 1;    /* PICTURE::FORWARDMB */
-            unsigned int bp_ac_pred      : 1;    /* PICTURE::ACPRED */   
-            unsigned int bp_overflags    : 1;    /* PICTURE::OVERFLAGS */
+            uint32_t bp_mv_type_mb   : 1;    /* PICTURE::MVTYPEMB */
+            uint32_t bp_direct_mb    : 1;    /* PICTURE::DIRECTMB */
+            uint32_t bp_skip_mb      : 1;    /* PICTURE::SKIPMB */  
+            uint32_t bp_field_tx     : 1;    /* PICTURE::FIELDTX */ 
+            uint32_t bp_forward_mb   : 1;    /* PICTURE::FORWARDMB */
+            uint32_t bp_ac_pred      : 1;    /* PICTURE::ACPRED */   
+            uint32_t bp_overflags    : 1;    /* PICTURE::OVERFLAGS */
         } flags;
-        unsigned int value;
+        uint32_t value;
     } bitplane_present; /* signal what bitplane is being passed via the bitplane buffer */
     union {
         struct {
-            unsigned int reference_distance_flag : 1;/* PICTURE_LAYER::REFDIST_FLAG */
-            unsigned int reference_distance    : 5;/* PICTURE_LAYER::REFDIST */
-            unsigned int num_reference_pictures: 1;/* PICTURE_LAYER::NUMREF */
-            unsigned int reference_field_pic_indicator : 1;/* PICTURE_LAYER::REFFIELD */
+            uint32_t reference_distance_flag : 1;/* PICTURE_LAYER::REFDIST_FLAG */
+            uint32_t reference_distance        : 5;/* PICTURE_LAYER::REFDIST */
+            uint32_t num_reference_pictures: 1;/* PICTURE_LAYER::NUMREF */
+            uint32_t reference_field_pic_indicator     : 1;/* PICTURE_LAYER::REFFIELD */
         } bits;
-        unsigned int value;
+        uint32_t value;
     } reference_fields;
     union {
         struct {
-            unsigned int mv_mode               : 3; /* PICTURE_LAYER::MVMODE */
-            unsigned int mv_mode2              : 3; /* PICTURE_LAYER::MVMODE2 */
-            unsigned int mv_table              : 3; /* PICTURE_LAYER::MVTAB/IMVTAB */
-            unsigned int two_mv_block_pattern_table: 2; /* PICTURE_LAYER::2MVBPTAB */
-            unsigned int four_mv_switch                : 1; /* PICTURE_LAYER::4MVSWITCH */
-            unsigned int four_mv_block_pattern_table : 2; /* PICTURE_LAYER::4MVBPTAB */
-            unsigned int extended_mv_flag      : 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */
-            unsigned int extended_mv_range     : 2; /* PICTURE_LAYER::MVRANGE */
-            unsigned int extended_dmv_flag     : 1; /* ENTRY_POINT_LAYER::EXTENDED_DMV */
-            unsigned int extended_dmv_range    : 2; /* PICTURE_LAYER::DMVRANGE */
+            uint32_t mv_mode           : 3; /* PICTURE_LAYER::MVMODE */
+            uint32_t mv_mode2          : 3; /* PICTURE_LAYER::MVMODE2 */
+            uint32_t mv_table          : 3; /* PICTURE_LAYER::MVTAB/IMVTAB */
+            uint32_t two_mv_block_pattern_table: 2; /* PICTURE_LAYER::2MVBPTAB */
+            uint32_t four_mv_switch            : 1; /* PICTURE_LAYER::4MVSWITCH */
+            uint32_t four_mv_block_pattern_table : 2; /* PICTURE_LAYER::4MVBPTAB */
+            uint32_t extended_mv_flag  : 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */
+            uint32_t extended_mv_range : 2; /* PICTURE_LAYER::MVRANGE */
+            uint32_t extended_dmv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_DMV */
+            uint32_t extended_dmv_range        : 2; /* PICTURE_LAYER::DMVRANGE */
         } bits;
-        unsigned int value;
+        uint32_t value;
     } mv_fields;
     union {
         struct {
-            unsigned int dquant        : 2;    /* ENTRY_POINT_LAYER::DQUANT */
-            unsigned int quantizer     : 2;    /* ENTRY_POINT_LAYER::QUANTIZER */
-            unsigned int half_qp       : 1;    /* PICTURE_LAYER::HALFQP */
-            unsigned int pic_quantizer_scale : 5;/* PICTURE_LAYER::PQUANT */
-            unsigned int pic_quantizer_type : 1;/* PICTURE_LAYER::PQUANTIZER */
-            unsigned int dq_frame      : 1;    /* VOPDQUANT::DQUANTFRM */
-            unsigned int dq_profile    : 2;    /* VOPDQUANT::DQPROFILE */
-            unsigned int dq_sb_edge    : 2;    /* VOPDQUANT::DQSBEDGE */
-            unsigned int dq_db_edge    : 2;    /* VOPDQUANT::DQDBEDGE */
-            unsigned int dq_binary_level : 1;  /* VOPDQUANT::DQBILEVEL */
-            unsigned int alt_pic_quantizer : 5;/* VOPDQUANT::ALTPQUANT */
+            uint32_t dquant    : 2;    /* ENTRY_POINT_LAYER::DQUANT */
+            uint32_t quantizer     : 2;        /* ENTRY_POINT_LAYER::QUANTIZER */
+            uint32_t half_qp   : 1;    /* PICTURE_LAYER::HALFQP */
+            uint32_t pic_quantizer_scale : 5;/* PICTURE_LAYER::PQUANT */
+            uint32_t pic_quantizer_type : 1;/* PICTURE_LAYER::PQUANTIZER */
+            uint32_t dq_frame  : 1;    /* VOPDQUANT::DQUANTFRM */
+            uint32_t dq_profile        : 2;    /* VOPDQUANT::DQPROFILE */
+            uint32_t dq_sb_edge        : 2;    /* VOPDQUANT::DQSBEDGE */
+            uint32_t dq_db_edge        : 2;    /* VOPDQUANT::DQDBEDGE */
+            uint32_t dq_binary_level : 1;      /* VOPDQUANT::DQBILEVEL */
+            uint32_t alt_pic_quantizer : 5;/* VOPDQUANT::ALTPQUANT */
         } bits;
-        unsigned int value;
+        uint32_t value;
     } pic_quantizer_fields;
     union {
         struct {
-            unsigned int variable_sized_transform_flag : 1;/* ENTRY_POINT_LAYER::VSTRANSFORM */
-            unsigned int mb_level_transform_type_flag  : 1;/* PICTURE_LAYER::TTMBF */
-            unsigned int frame_level_transform_type    : 2;/* PICTURE_LAYER::TTFRM */
-            unsigned int transform_ac_codingset_idx1   : 2;/* PICTURE_LAYER::TRANSACFRM */
-            unsigned int transform_ac_codingset_idx2   : 2;/* PICTURE_LAYER::TRANSACFRM2 */
-            unsigned int intra_transform_dc_table      : 1;/* PICTURE_LAYER::TRANSDCTAB */
+            uint32_t variable_sized_transform_flag     : 1;/* ENTRY_POINT_LAYER::VSTRANSFORM */
+            uint32_t mb_level_transform_type_flag      : 1;/* PICTURE_LAYER::TTMBF */
+            uint32_t frame_level_transform_type        : 2;/* PICTURE_LAYER::TTFRM */
+            uint32_t transform_ac_codingset_idx1       : 2;/* PICTURE_LAYER::TRANSACFRM */
+            uint32_t transform_ac_codingset_idx2       : 2;/* PICTURE_LAYER::TRANSACFRM2 */
+            uint32_t intra_transform_dc_table  : 1;/* PICTURE_LAYER::TRANSDCTAB */
         } bits;
-        unsigned int value;
+        uint32_t value;
     } transform_fields;
+
+    uint8_t luma_scale2;                  /* PICTURE_LAYER::LUMSCALE2 */
+    uint8_t luma_shift2;                  /* PICTURE_LAYER::LUMSHIFT2 */
+    uint8_t intensity_compensation_field; /* Index for PICTURE_LAYER::INTCOMPFIELD value in Table 109 (9.1.1.48) */
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_MEDIUM - 1];
 } VAPictureParameterBufferVC1;
 
 /** VC-1 Bitplane Buffer
@@ -1659,11 +2258,14 @@ Macroblock #2 in the first row.
 /* VC-1 Slice Parameter Buffer */
 typedef struct _VASliceParameterBufferVC1
 {
-    unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
-    unsigned int slice_data_offset;/* the offset to the first byte of slice data */
-    unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
-    unsigned int macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
-    unsigned int slice_vertical_position;
+    uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
+    uint32_t slice_data_offset;/* the offset to the first byte of slice data */
+    uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
+    uint32_t macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
+    uint32_t slice_vertical_position;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VASliceParameterBufferVC1;
 
 /* VC-1 Slice Data Buffer */
@@ -1678,10 +2280,13 @@ This is simplely a buffer containing raw bit-stream bytes
 typedef struct _VAPictureH264
 {
     VASurfaceID picture_id;
-    unsigned int frame_idx;
-    unsigned int flags;
-    signed int TopFieldOrderCnt;
-    signed int BottomFieldOrderCnt;
+    uint32_t frame_idx;
+    uint32_t flags;
+    int32_t TopFieldOrderCnt;
+    int32_t BottomFieldOrderCnt;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAPictureH264;
 /* flags in VAPictureH264 could be OR of the following */
 #define VA_PICTURE_H264_INVALID                        0x00000001
@@ -1699,78 +2304,75 @@ typedef struct _VAPictureParameterBufferH264
 {
     VAPictureH264 CurrPic;
     VAPictureH264 ReferenceFrames[16]; /* in DPB */
-    unsigned short picture_width_in_mbs_minus1;
-    unsigned short picture_height_in_mbs_minus1;
-    unsigned char bit_depth_luma_minus8;
-    unsigned char bit_depth_chroma_minus8;
-    unsigned char num_ref_frames;
+    uint16_t picture_width_in_mbs_minus1;
+    uint16_t picture_height_in_mbs_minus1;
+    uint8_t bit_depth_luma_minus8;
+    uint8_t bit_depth_chroma_minus8;
+    uint8_t num_ref_frames;
     union {
         struct {
-            unsigned int chroma_format_idc                     : 2; 
-            unsigned int residual_colour_transform_flag                : 1; 
-            unsigned int gaps_in_frame_num_value_allowed_flag  : 1; 
-            unsigned int frame_mbs_only_flag                   : 1; 
-            unsigned int mb_adaptive_frame_field_flag          : 1; 
-            unsigned int direct_8x8_inference_flag             : 1; 
-            unsigned int MinLumaBiPredSize8x8                  : 1; /* see A.3.3.2 */
-            unsigned int log2_max_frame_num_minus4             : 4;
-            unsigned int pic_order_cnt_type                    : 2;
-            unsigned int log2_max_pic_order_cnt_lsb_minus4     : 4;
-            unsigned int delta_pic_order_always_zero_flag      : 1;
+            uint32_t chroma_format_idc                 : 2; 
+            uint32_t residual_colour_transform_flag            : 1; /* Renamed to separate_colour_plane_flag in newer standard versions. */
+            uint32_t gaps_in_frame_num_value_allowed_flag      : 1; 
+            uint32_t frame_mbs_only_flag                       : 1; 
+            uint32_t mb_adaptive_frame_field_flag              : 1; 
+            uint32_t direct_8x8_inference_flag         : 1; 
+            uint32_t MinLumaBiPredSize8x8                      : 1; /* see A.3.3.2 */
+            uint32_t log2_max_frame_num_minus4         : 4;
+            uint32_t pic_order_cnt_type                        : 2;
+            uint32_t log2_max_pic_order_cnt_lsb_minus4 : 4;
+            uint32_t delta_pic_order_always_zero_flag  : 1;
         } bits;
-        unsigned int value;
+        uint32_t value;
     } seq_fields;
-    unsigned char num_slice_groups_minus1;
-    unsigned char slice_group_map_type;
-    unsigned short slice_group_change_rate_minus1;
-    signed char pic_init_qp_minus26;
-    signed char pic_init_qs_minus26;
-    signed char chroma_qp_index_offset;
-    signed char second_chroma_qp_index_offset;
+    // FMO is not supported.
+    va_deprecated uint8_t num_slice_groups_minus1;
+    va_deprecated uint8_t slice_group_map_type;
+    va_deprecated uint16_t slice_group_change_rate_minus1;
+    int8_t pic_init_qp_minus26;
+    int8_t pic_init_qs_minus26;
+    int8_t chroma_qp_index_offset;
+    int8_t second_chroma_qp_index_offset;
     union {
         struct {
-            unsigned int entropy_coding_mode_flag      : 1;
-            unsigned int weighted_pred_flag            : 1;
-            unsigned int weighted_bipred_idc           : 2;
-            unsigned int transform_8x8_mode_flag       : 1;
-            unsigned int field_pic_flag                        : 1;
-            unsigned int constrained_intra_pred_flag   : 1;
-            unsigned int pic_order_present_flag                        : 1;
-            unsigned int deblocking_filter_control_present_flag : 1;
-            unsigned int redundant_pic_cnt_present_flag                : 1;
-            unsigned int reference_pic_flag                    : 1; /* nal_ref_idc != 0 */
+            uint32_t entropy_coding_mode_flag  : 1;
+            uint32_t weighted_pred_flag                : 1;
+            uint32_t weighted_bipred_idc               : 2;
+            uint32_t transform_8x8_mode_flag   : 1;
+            uint32_t field_pic_flag                    : 1;
+            uint32_t constrained_intra_pred_flag       : 1;
+            uint32_t pic_order_present_flag                    : 1; /* Renamed to bottom_field_pic_order_in_frame_present_flag in newer standard versions. */
+            uint32_t deblocking_filter_control_present_flag : 1;
+            uint32_t redundant_pic_cnt_present_flag            : 1;
+            uint32_t reference_pic_flag                        : 1; /* nal_ref_idc != 0 */
         } bits;
-        unsigned int value;
+        uint32_t value;
     } pic_fields;
-    unsigned short frame_num;
+    uint16_t frame_num;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_MEDIUM];
 } VAPictureParameterBufferH264;
 
 /** H.264 Inverse Quantization Matrix Buffer */
 typedef struct _VAIQMatrixBufferH264
 {
     /** \brief 4x4 scaling list, in raster scan order. */
-    unsigned char ScalingList4x4[6][16];
+    uint8_t ScalingList4x4[6][16];
     /** \brief 8x8 scaling list, in raster scan order. */
-    unsigned char ScalingList8x8[2][64];
-} VAIQMatrixBufferH264;
+    uint8_t ScalingList8x8[2][64];
 
-/**
- * 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
- * is sent only when there is a change in the mapping values.
- * The slice group map buffer map "map units" to slice groups as specified in 
- * section 8.2.2 of the H.264 spec. The buffer will contain one byte for each macroblock 
- * in raster scan order
- */ 
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
+} VAIQMatrixBufferH264;
 
 /** H.264 Slice Parameter Buffer */
 typedef struct _VASliceParameterBufferH264
 {
-    unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
+    uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
     /** \brief Byte offset to the NAL Header Unit for this slice. */
-    unsigned int slice_data_offset;
-    unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
+    uint32_t slice_data_offset;
+    uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
     /**
      * \brief Bit offset from NAL Header Unit to the begining of slice_data().
      *
@@ -1781,33 +2383,48 @@ typedef struct _VASliceParameterBufferH264
      * the original bitstream, thus including any emulation prevention
      * bytes.
      */
-    unsigned short slice_data_bit_offset;
-    unsigned short first_mb_in_slice;
-    unsigned char slice_type;
-    unsigned char direct_spatial_mv_pred_flag;
-    unsigned char num_ref_idx_l0_active_minus1;
-    unsigned char num_ref_idx_l1_active_minus1;
-    unsigned char cabac_init_idc;
-    char slice_qp_delta;
-    unsigned char disable_deblocking_filter_idc;
-    char slice_alpha_c0_offset_div2;
-    char slice_beta_offset_div2;
+    uint16_t slice_data_bit_offset;
+    uint16_t first_mb_in_slice;
+    uint8_t slice_type;
+    uint8_t direct_spatial_mv_pred_flag;
+    /**
+     * H264/AVC syntax element
+     *
+     * if num_ref_idx_active_override_flag equals 0, host decoder should
+     * set its value to num_ref_idx_l0_default_active_minus1.
+     */
+    uint8_t num_ref_idx_l0_active_minus1;
+    /**
+     * H264/AVC syntax element
+     *
+     * if num_ref_idx_active_override_flag equals 0, host decoder should
+     * set its value to num_ref_idx_l1_default_active_minus1.
+     */
+    uint8_t num_ref_idx_l1_active_minus1;
+    uint8_t cabac_init_idc;
+    int8_t slice_qp_delta;
+    uint8_t disable_deblocking_filter_idc;
+    int8_t slice_alpha_c0_offset_div2;
+    int8_t slice_beta_offset_div2;
     VAPictureH264 RefPicList0[32];     /* See 8.2.4.2 */
     VAPictureH264 RefPicList1[32];     /* See 8.2.4.2 */
-    unsigned char luma_log2_weight_denom;
-    unsigned char chroma_log2_weight_denom;
-    unsigned char luma_weight_l0_flag;
-    short luma_weight_l0[32];
-    short luma_offset_l0[32];
-    unsigned char chroma_weight_l0_flag;
-    short chroma_weight_l0[32][2];
-    short chroma_offset_l0[32][2];
-    unsigned char luma_weight_l1_flag;
-    short luma_weight_l1[32];
-    short luma_offset_l1[32];
-    unsigned char chroma_weight_l1_flag;
-    short chroma_weight_l1[32][2];
-    short chroma_offset_l1[32][2];
+    uint8_t luma_log2_weight_denom;
+    uint8_t chroma_log2_weight_denom;
+    uint8_t luma_weight_l0_flag;
+    int16_t luma_weight_l0[32];
+    int16_t luma_offset_l0[32];
+    uint8_t chroma_weight_l0_flag;
+    int16_t chroma_weight_l0[32][2];
+    int16_t chroma_offset_l0[32][2];
+    uint8_t luma_weight_l1_flag;
+    int16_t luma_weight_l1[32];
+    int16_t luma_offset_l1[32];
+    uint8_t chroma_weight_l1_flag;
+    int16_t chroma_weight_l1[32][2];
+    int16_t chroma_offset_l1[32][2];
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VASliceParameterBufferH264;
 
 /****************************
@@ -1823,17 +2440,20 @@ typedef enum
 /* Encode Slice Parameter Buffer */
 typedef struct _VAEncSliceParameterBuffer
 {
-    unsigned int start_row_number;     /* starting MB row number for this slice */
-    unsigned int slice_height; /* slice height measured in MB */
+    uint32_t start_row_number; /* starting MB row number for this slice */
+    uint32_t slice_height;     /* slice height measured in MB */
     union {
         struct {
-            unsigned int is_intra      : 1;
-            unsigned int disable_deblocking_filter_idc : 2;
-            unsigned int uses_long_term_ref            :1;
-            unsigned int is_long_term_ref              :1;
+            uint32_t is_intra  : 1;
+            uint32_t disable_deblocking_filter_idc : 2;
+            uint32_t uses_long_term_ref                :1;
+            uint32_t is_long_term_ref          :1;
         } bits;
-        unsigned int value;
+        uint32_t value;
     } slice_flags;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncSliceParameterBuffer;
 
 
@@ -1843,11 +2463,14 @@ typedef struct _VAEncSliceParameterBuffer
 
 typedef struct _VAEncSequenceParameterBufferH263
 {
-    unsigned int intra_period;
-    unsigned int bits_per_second;
-    unsigned int frame_rate;
-    unsigned int initial_qp;
-    unsigned int min_qp;
+    uint32_t intra_period;
+    uint32_t bits_per_second;
+    uint32_t frame_rate;
+    uint32_t initial_qp;
+    uint32_t min_qp;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncSequenceParameterBufferH263;
 
 typedef struct _VAEncPictureParameterBufferH263
@@ -1855,9 +2478,12 @@ typedef struct _VAEncPictureParameterBufferH263
     VASurfaceID reference_picture;
     VASurfaceID reconstructed_picture;
     VABufferID coded_buf;
-    unsigned short picture_width;
-    unsigned short picture_height;
+    uint16_t picture_width;
+    uint16_t picture_height;
     VAEncPictureType picture_type;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncPictureParameterBufferH263;
 
 /****************************
@@ -1866,17 +2492,20 @@ typedef struct _VAEncPictureParameterBufferH263
 
 typedef struct _VAEncSequenceParameterBufferMPEG4
 {
-    unsigned char profile_and_level_indication;
-    unsigned int intra_period;
-    unsigned int video_object_layer_width;
-    unsigned int video_object_layer_height;
-    unsigned int vop_time_increment_resolution;
-    unsigned int fixed_vop_rate;
-    unsigned int fixed_vop_time_increment;
-    unsigned int bits_per_second;
-    unsigned int frame_rate;
-    unsigned int initial_qp;
-    unsigned int min_qp;
+    uint8_t profile_and_level_indication;
+    uint32_t intra_period;
+    uint32_t video_object_layer_width;
+    uint32_t video_object_layer_height;
+    uint32_t vop_time_increment_resolution;
+    uint32_t fixed_vop_rate;
+    uint32_t fixed_vop_time_increment;
+    uint32_t bits_per_second;
+    uint32_t frame_rate;
+    uint32_t initial_qp;
+    uint32_t min_qp;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncSequenceParameterBufferMPEG4;
 
 typedef struct _VAEncPictureParameterBufferMPEG4
@@ -1884,11 +2513,14 @@ typedef struct _VAEncPictureParameterBufferMPEG4
     VASurfaceID reference_picture;
     VASurfaceID reconstructed_picture;
     VABufferID coded_buf;
-    unsigned short picture_width;
-    unsigned short picture_height;
-    unsigned int modulo_time_base; /* number of 1s */
-    unsigned int vop_time_increment;
+    uint16_t picture_width;
+    uint16_t picture_height;
+    uint32_t modulo_time_base; /* number of 1s */
+    uint32_t vop_time_increment;
     VAEncPictureType picture_type;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncPictureParameterBufferMPEG4;
 
 
@@ -1906,6 +2538,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.
  */
@@ -1920,6 +2553,28 @@ VAStatus vaCreateBuffer (
 );
 
 /**
+ * Create a buffer for given width & height get unit_size, pitch, buf_id for 2D buffer
+ * for permb qp buffer, it will return unit_size for one MB or LCU and the pitch for alignments
+ * can call vaMapBuffer with this Buffer ID to get virtual address.
+ * e.g. AVC 1080P encode, 1920x1088, the size in MB is 120x68,but inside driver,
+ * maybe it should align with 256, and one byte present one Qp.so, call the function.
+ * then get unit_size = 1, pitch = 256. call vaMapBuffer to get the virtual address (pBuf).
+ * then read write the memory like 2D. the size is 256x68, application can only use 120x68
+ * pBuf + 256 is the start of next line.
+ * different driver implementation maybe return different unit_size and pitch
+ */
+VAStatus vaCreateBuffer2(
+    VADisplay dpy,
+    VAContextID context,
+    VABufferType type,
+    unsigned int width,
+    unsigned int height,
+    unsigned int *unit_size,
+    unsigned int *pitch,
+    VABufferID *buf_id
+);
+
+/**
  * 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
@@ -1984,13 +2639,13 @@ typedef  struct _VACodedBufferSegment  {
     /**
      * \brief Size of the data buffer in this segment (in bytes).
      */
-    unsigned int        size;
+    uint32_t        size;
     /** \brief Bit offset into the data buffer where the video data starts. */
-    unsigned int        bit_offset;
+    uint32_t        bit_offset;
     /** \brief Status set by the driver. See \c VA_CODED_BUF_STATUS_*. */
-    unsigned int        status;
+    uint32_t        status;
     /** \brief Reserved for future use. */
-    unsigned int        reserved;
+    uint32_t        reserved;
     /** \brief Pointer to the start of the data buffer. */
     void               *buf;
     /**
@@ -1998,6 +2653,9 @@ typedef  struct _VACodedBufferSegment  {
      * or \c NULL if there is none.
      */
     void               *next;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VACodedBufferSegment;
      
 /**
@@ -2026,7 +2684,12 @@ VAStatus vaUnmapBuffer (
 
 /**
  * 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,
@@ -2050,6 +2713,9 @@ typedef struct {
     uint32_t            mem_type;
     /** \brief Size of the underlying buffer. */
     size_t              mem_size;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VABufferInfo;
 
 /**
@@ -2135,16 +2801,20 @@ vaAcquireBufferHandle(VADisplay dpy, VABufferID buf_id, VABufferInfo *buf_info);
 VAStatus
 vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id);
 
-/*
-Render (Decode) Pictures
-
-A picture represents either a frame or a field.
-
-The Begin/Render/End sequence sends the decode buffers to the server
-*/
+/**
+ * Render (Video Decode/Encode/Processing) Pictures
+ *
+ * A picture represents either a frame or a field.
+ *
+ * The Begin/Render/End sequence sends the video decode/encode/processing buffers
+ * to the server
+ */
 
 /**
- * Get ready to decode a picture to a target surface
+ * Get ready for a video pipeline
+ * - decode a picture to a target surface
+ * - encode a picture from a target surface
+ * - process a picture to a target surface
  */
 VAStatus vaBeginPicture (
     VADisplay dpy,
@@ -2153,8 +2823,7 @@ VAStatus vaBeginPicture (
 );
 
 /**
- * Send decode buffers to the server.
- * Buffers are automatically destroyed afterwards
+ * Send video decode, encode or processing buffers to the server.
  */
 VAStatus vaRenderPicture (
     VADisplay dpy,
@@ -2168,12 +2837,40 @@ VAStatus vaRenderPicture (
  * The server should start processing all pending operations for this 
  * surface. This call is non-blocking. The client can start another 
  * Begin/Render/End sequence on a different render target.
+ * if VAContextID used in this function previously successfully passed
+ * vaMFAddContext call, real processing will be started during vaMFSubmit
  */
 VAStatus vaEndPicture (
     VADisplay dpy,
     VAContextID context
 );
 
+/**
+ * Make the end of rendering for a pictures in contexts passed with submission.
+ * The server should start processing all pending operations for contexts.
+ * All contexts passed should be associated through vaMFAddContext
+ * and call sequence Begin/Render/End performed.
+ * This call is non-blocking. The client can start another
+ * Begin/Render/End/vaMFSubmit sequence on a different render targets.
+ * Return values:
+ * VA_STATUS_SUCCESS - operation successful, context was removed.
+ * VA_STATUS_ERROR_INVALID_CONTEXT - mf_context or one of contexts are invalid
+ * due to mf_context not created or one of contexts not assotiated with mf_context
+ * through vaAddContext.
+ * VA_STATUS_ERROR_INVALID_PARAMETER - one of context has not submitted it's frame
+ * through vaBeginPicture vaRenderPicture vaEndPicture call sequence.
+ * dpy: display
+ * mf_context: Multi-Frame context
+ * contexts: list of contexts submitting their tasks for multi-frame operation.
+ * num_contexts: number of passed contexts.
+ */
+VAStatus vaMFSubmit (
+    VADisplay dpy,
+    VAMFContextID mf_context,
+    VAContextID * contexts,
+    int num_contexts
+);
+
 /*
 
 Synchronization 
@@ -2221,10 +2918,13 @@ typedef enum
 */
 typedef struct _VASurfaceDecodeMBErrors
 {
-    int status; /* 1 if hardware has returned detailed info below, -1 means this record is invalid */
-    unsigned int start_mb; /* start mb address with errors */
-    unsigned int end_mb;  /* end mb address with errors */
+    int32_t status; /* 1 if hardware has returned detailed info below, -1 means this record is invalid */
+    uint32_t start_mb; /* start mb address with errors */
+    uint32_t end_mb;  /* end mb address with errors */
     VADecodeErrorType decode_error_type;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VASurfaceDecodeMBErrors;
 
 /**
@@ -2272,7 +2972,9 @@ VAStatus vaQuerySurfaceError(
 #define VA_FOURCC_NV11          0x3131564e
 #define VA_FOURCC_YV12          0x32315659
 #define VA_FOURCC_P208          0x38303250
+/* IYUV same as I420, but most user perfer I420, will deprecate it */
 #define VA_FOURCC_IYUV          0x56555949
+#define VA_FOURCC_I420          0x30323449
 #define VA_FOURCC_YV24          0x34325659
 #define VA_FOURCC_YV32          0x32335659
 #define VA_FOURCC_Y800          0x30303859
@@ -2295,21 +2997,29 @@ VAStatus vaQuerySurfaceError(
 #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
 #define VA_MSB_FIRST           2
 
 typedef struct _VAImageFormat
 {
-    unsigned int       fourcc;
-    unsigned int       byte_order; /* VA_LSB_FIRST, VA_MSB_FIRST */
-    unsigned int       bits_per_pixel;
+    uint32_t   fourcc;
+    uint32_t   byte_order; /* VA_LSB_FIRST, VA_MSB_FIRST */
+    uint32_t   bits_per_pixel;
     /* for RGB formats */
-    unsigned int       depth; /* significant bits per pixel */
-    unsigned int       red_mask;
-    unsigned int       green_mask;
-    unsigned int       blue_mask;
-    unsigned int       alpha_mask;
+    uint32_t   depth; /* significant bits per pixel */
+    uint32_t   red_mask;
+    uint32_t   green_mask;
+    uint32_t   blue_mask;
+    uint32_t   alpha_mask;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAImageFormat;
 
 typedef VAGenericID VAImageID;
@@ -2326,33 +3036,36 @@ typedef struct _VAImage
      * size and format. This buffer is managed by the library implementation, and 
      * accessed by the client through the buffer Map/Unmap functions.
      */
-    unsigned short     width; 
-    unsigned short     height;
-    unsigned int       data_size;
-    unsigned int       num_planes;     /* can not be greater than 3 */
+    uint16_t   width; 
+    uint16_t   height;
+    uint32_t   data_size;
+    uint32_t   num_planes;     /* can not be greater than 3 */
     /* 
      * An array indicating the scanline pitch in bytes for each plane.
      * Each plane may have a different pitch. Maximum 3 planes for planar formats
      */
-    unsigned int       pitches[3];
+    uint32_t   pitches[3];
     /* 
      * An array indicating the byte offset from the beginning of the image data 
      * to the start of each plane.
      */
-    unsigned int       offsets[3];
+    uint32_t   offsets[3];
 
     /* The following fields are only needed for paletted formats */
-    int num_palette_entries;   /* set to zero for non-palette images */
+    int32_t num_palette_entries;   /* set to zero for non-palette images */
     /* 
      * Each component is one byte and entry_bytes indicates the number of components in 
      * each entry (eg. 3 for YUV palette entries). set to zero for non-palette images   
      */
-    int entry_bytes; 
+    int32_t entry_bytes; 
     /*
      * An array of ascii characters describing the order of the components within the bytes.
      * Only entry_bytes characters of the string are used.
      */
-    char component_order[4];
+    int8_t component_order[4];
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAImage;
 
 /** Get maximum number of image formats supported by the implementation */
@@ -2581,19 +3294,19 @@ VAStatus vaAssociateSubpicture (
     VASubpictureID subpicture,
     VASurfaceID *target_surfaces,
     int num_surfaces,
-    short src_x, /* upper left offset in subpicture */
-    short src_y,
-    unsigned short src_width,
-    unsigned short src_height,
-    short dest_x, /* upper left offset in surface */
-    short dest_y,
-    unsigned short dest_width,
-    unsigned short dest_height,
+    int16_t src_x, /* upper left offset in subpicture */
+    int16_t src_y,
+    uint16_t src_width,
+    uint16_t src_height,
+    int16_t dest_x, /* upper left offset in surface */
+    int16_t dest_y,
+    uint16_t dest_width,
+    uint16_t dest_height,
     /*
      * whether to enable chroma-keying, global-alpha, or screen relative mode
      * see VA_SUBPICTURE_XXX values
      */
-    unsigned int flags
+    uint32_t flags
 );
 
 /**
@@ -2606,14 +3319,6 @@ 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,
@@ -2636,6 +3341,23 @@ typedef enum
 #define VA_ROTATION_90          0x00000001
 #define VA_ROTATION_180         0x00000002
 #define VA_ROTATION_270         0x00000003
+/**@}*/
+
+/**
+ * @name Mirroring directions
+ *
+ * Those values could be used for VADisplayAttribMirror attribute or
+ * VAProcPipelineParameterBuffer::mirror_state.
+
+ */
+/**@{*/
+/** \brief No Mirroring. */
+#define VA_MIRROR_NONE              0x00000000
+/** \brief Horizontal Mirroring. */
+#define VA_MIRROR_HORIZONTAL        0x00000001
+/** \brief Vertical Mirroring. */
+#define VA_MIRROR_VERTICAL          0x00000002
+/**@}*/
 
 /** attribute value for VADisplayAttribOutOfLoopDeblock */
 #define VA_OOL_DEBLOCKING_FALSE 0x00000000
@@ -2735,11 +3457,14 @@ typedef enum
 typedef struct _VADisplayAttribute
 {
     VADisplayAttribType type;
-    int min_value;
-    int max_value;
-    int value; /* used by the set/get attribute functions */
+    int32_t min_value;
+    int32_t max_value;
+    int32_t value;     /* used by the set/get attribute functions */
 /* flags can be VA_DISPLAY_ATTRIB_GETTABLE or VA_DISPLAY_ATTRIB_SETTABLE or OR'd together */
-    unsigned int flags;
+    uint32_t flags;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VADisplayAttribute;
 
 /** Get maximum number of display attributs supported by the implementation */
@@ -2808,6 +3533,9 @@ typedef struct _VAPictureHEVC
     int32_t                 pic_order_cnt;
     /* described below */
     uint32_t                flags;
+
+    /** \brief Reserved bytes for future use, must be zero */
+    uint32_t                va_reserved[VA_PADDING_LOW];
 } VAPictureHEVC;
 
 /* flags in VAPictureHEVC could be OR of the following */
@@ -2858,6 +3586,9 @@ typedef struct _VAPictureHEVC
 #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_fei.h>
+#include <va/va_fei_h264.h>
 #include <va/va_vpp.h>
 
 /**@}*/