OSDN Git Service

Add new BRC mode AVBR
[android-x86/hardware-intel-common-libva.git] / va / va.h
diff --git a/va/va.h b/va/va.h
index 4fbf4e3..0f7431a 100644 (file)
--- a/va/va.h
+++ b/va/va.h
@@ -86,7 +86,7 @@
 extern "C" {
 #endif
 
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__COVERITY__)
 #define va_deprecated __attribute__((deprecated))
 #if __GNUC__ >= 6
 #define va_deprecated_enum va_deprecated
@@ -112,9 +112,23 @@ extern "C" {
  *
  * VA-API is split into several modules:
  * - \ref api_core
- * - \ref api_enc_xxx (xxx = h264, hevc, jpec, mpeg2, vp8, vp9)
- * - \ref api_dec_xxx (xxx = hevc, jpec, vp8, vp9)
+ * - Encoder (H264, HEVC, JPEG, MPEG2, VP8, VP9)
+ *     - \ref api_enc_h264
+ *     - \ref api_enc_hevc
+ *     - \ref api_enc_jpeg
+ *     - \ref api_enc_mpeg2
+ *     - \ref api_enc_vp8
+ *     - \ref api_enc_vp9
+ * - Decoder (HEVC, JPEG, VP8, VP9)
+ *      - \ref api_dec_hevc
+ *      - \ref api_dec_jpeg
+ *      - \ref api_dec_vp8
+ *      - \ref api_dec_vp9
  * - \ref api_vpp
+ * - FEI (H264, HEVC)
+ *     - \ref api_fei
+ *     - \ref api_fei_h264
+ *     - \ref api_fei_hevc
  */
 
 /**
@@ -196,6 +210,8 @@ typedef int VAStatus;       /** Return status type from functions */
 #define VA_STATUS_ERROR_HW_BUSY                        0x00000022
 /** \brief An unsupported memory type was supplied. */
 #define VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE 0x00000024
+/** \brief Indicate allocated buffer size is not enough for input or output. */
+#define VA_STATUS_ERROR_NOT_ENOUGH_BUFFER       0x00000025
 #define VA_STATUS_ERROR_UNKNOWN                        0xFFFFFFFF
 
 /** De-interlacing flags for vaPutSurface() */
@@ -359,7 +375,16 @@ typedef enum
     VAProfileVP9Profile0                = 19,
     VAProfileVP9Profile1                = 20,
     VAProfileVP9Profile2                = 21,
-    VAProfileVP9Profile3                = 22
+    VAProfileVP9Profile3                = 22,
+    VAProfileHEVCMain12                 = 23,
+    VAProfileHEVCMain422_10             = 24,
+    VAProfileHEVCMain422_12             = 25,
+    VAProfileHEVCMain444                = 26,
+    VAProfileHEVCMain444_10             = 27,
+    VAProfileHEVCMain444_12             = 28,
+    VAProfileHEVCSccMain                = 29,
+    VAProfileHEVCSccMain10              = 30,
+    VAProfileHEVCSccMain444             = 31
 } VAProfile;
 
 /**
@@ -401,6 +426,23 @@ typedef enum
      * (VAEncFEIMVBufferType, VAEncFEIMBModeBufferType) are needed for PAK input.
      **/
     VAEntrypointFEI         = 11,
+    /**
+     * \brief VAEntrypointStats
+     *
+     * A pre-processing function for getting some statistics and motion vectors is added,
+     * and some extra controls for Encode pipeline are provided. The application can
+     * optionally call the statistics function to get motion vectors and statistics like
+     * variances, distortions before calling Encode function via this entry point.
+     *
+     * Checking whether Statistics is supported can be performed with vaQueryConfigEntrypoints().
+     * If Statistics entry point is supported, then the list of returned entry-points will
+     * include #VAEntrypointStats. Supported pixel format, maximum resolution and statistics
+     * specific attributes can be obtained via normal attribute query. One input buffer
+     * (VAStatsStatisticsParameterBufferType) and one or two output buffers
+     * (VAStatsStatisticsBufferType, VAStatsStatisticsBottomFieldBufferType (for interlace only)
+     * and VAStatsMVBufferType) are needed for this entry point.
+     **/
+    VAEntrypointStats       = 12,
 } VAEntrypoint;
 
 /** Currently defined configuration attribute types */
@@ -678,6 +720,14 @@ typedef enum
      * Currently it is for FEI entry point only.
      */
     VAConfigAttribFEIMVPredictors     = 33,
+    /**
+     * \brief Statistics attribute. Read-only.
+     *
+     * This attribute exposes a number of capabilities of the VAEntrypointStats entry
+     * point. The attribute value is partitioned into fields as defined in the
+     * VAConfigAttribValStats union. Currently it is for VAEntrypointStats only.
+     */
+    VAConfigAttribStats               = 34,
      /**
      * \brief Tile Support Attribute. Read-only.
      *
@@ -713,27 +763,30 @@ typedef struct _VAConfigAttrib {
     uint32_t value; /* OR'd flags (bits) for this attribute */
 } VAConfigAttrib;
 
-/** attribute value for VAConfigAttribRTFormat */
-#define VA_RT_FORMAT_YUV420    0x00000001      
-#define VA_RT_FORMAT_YUV422    0x00000002
-#define VA_RT_FORMAT_YUV444    0x00000004
-#define VA_RT_FORMAT_YUV411    0x00000008
-#define VA_RT_FORMAT_YUV400    0x00000010
-/** YUV formats with more than 8 bpp */
-#define VA_RT_FORMAT_YUV420_10BPP      0x00000100
-/** RGB formats */
-#define VA_RT_FORMAT_RGB16     0x00010000
-#define VA_RT_FORMAT_RGB32     0x00020000
-/* RGBP covers RGBP and BGRP fourcc */ 
-#define VA_RT_FORMAT_RGBP      0x00100000
-/**
- * RGB 10-bit packed format with upper 2 bits as alpha channel.
- * The existing pre-defined fourcc codes can be used to signal
- * the position of each component for this RT format.
- */
-#define VA_RT_FORMAT_RGB32_10BPP 0x00200000
+/* Attribute values for VAConfigAttribRTFormat. */
+
+#define VA_RT_FORMAT_YUV420    0x00000001      ///< YUV 4:2:0 8-bit.
+#define VA_RT_FORMAT_YUV422    0x00000002      ///< YUV 4:2:2 8-bit.
+#define VA_RT_FORMAT_YUV444    0x00000004      ///< YUV 4:4:4 8-bit.
+#define VA_RT_FORMAT_YUV411    0x00000008      ///< YUV 4:1:1 8-bit.
+#define VA_RT_FORMAT_YUV400    0x00000010      ///< Greyscale 8-bit.
+#define VA_RT_FORMAT_YUV420_10 0x00000100      ///< YUV 4:2:0 10-bit.
+#define VA_RT_FORMAT_YUV422_10 0x00000200      ///< YUV 4:2:2 10-bit.
+#define VA_RT_FORMAT_YUV444_10 0x00000400      ///< YUV 4:4:4 10-bit.
+#define VA_RT_FORMAT_YUV420_12 0x00001000      ///< YUV 4:2:0 12-bit.
+#define VA_RT_FORMAT_YUV422_12 0x00002000      ///< YUV 4:2:2 12-bit.
+#define VA_RT_FORMAT_YUV444_12 0x00004000      ///< YUV 4:4:4 12-bit.
+
+#define VA_RT_FORMAT_RGB16     0x00010000      ///< Packed RGB, 16 bits per pixel.
+#define VA_RT_FORMAT_RGB32     0x00020000      ///< Packed RGB, 32 bits per pixel, 8 bits per colour sample.
+#define VA_RT_FORMAT_RGBP      0x00100000      ///< Planar RGB, 8 bits per sample.
+#define VA_RT_FORMAT_RGB32_10  0x00200000      ///< Packed RGB, 32 bits per pixel, 10 bits per colour sample.
+
 #define VA_RT_FORMAT_PROTECTED 0x80000000
 
+#define VA_RT_FORMAT_RGB32_10BPP       VA_RT_FORMAT_RGB32_10   ///< @deprecated use VA_RT_FORMAT_RGB32_10 instead.
+#define VA_RT_FORMAT_YUV420_10BPP      VA_RT_FORMAT_YUV420_10  ///< @deprecated use VA_RT_FORMAT_YUV420_10 instead.
+
 /** @name Attribute values for VAConfigAttribRateControl */
 /**@{*/
 /** \brief Driver does not support any form of rate control. */
@@ -767,6 +820,23 @@ typedef struct _VAConfigAttrib {
  *  simultaneously. And BRC would adjust accordingly. This is so called
  *  Parallel BRC. */
 #define VA_RC_PARALLEL                  0x00000200
+/** \brief Quality defined VBR
+ * Use Quality factor to determine the good enough QP for each MB such that
+ * good enough quality can be obtained without waste of bits
+ * for this BRC mode, you must set all legacy VBR parameters
+ * and reuse quality_factor in \c VAEncMiscParameterRateControl
+ * */
+#define VA_RC_QVBR                      0x00000400
+/** \brief Average VBR
+ *  Average variable bitrate control algorithm focuses on overall encoding
+ *  quality while meeting the specified target bitrate, within the accuracy
+ *  range, after a convergence period.
+ *  bits_per_second in VAEncMiscParameterRateControl is target bitrate for AVBR.
+ *  Convergence is specified in the unit of frame.
+ *  window_size in VAEncMiscParameterRateControl is equal to convergence for AVBR.
+ *  Accuracy is in the range of [1,100], 1 means one percent, and so on. 
+ *  target_percentage in VAEncMiscParameterRateControl is equal to accuracy for AVBR. */
+#define VA_RC_AVBR                      0x00000800
 
 /**@}*/
 
@@ -1280,6 +1350,9 @@ typedef struct _VASurfaceAttribExternalBuffers {
 #define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE         0x00000008
 /** \brief Surface used for display. */
 #define VA_SURFACE_ATTRIB_USAGE_HINT_DISPLAY   0x00000010
+/** \brief Surface used for export to third-party APIs, e.g. via
+ *  vaExportSurfaceHandle(). */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT    0x00000020
 
 /**@}*/
 
@@ -1550,6 +1623,13 @@ typedef enum
     VAEncFEIDistortionBufferType        = 45,
     VAEncFEIMBControlBufferType         = 46,
     VAEncFEIMVPredictorBufferType       = 47,
+    VAStatsStatisticsParameterBufferType = 48,
+    /** \brief Statistics output for VAEntrypointStats progressive and top field of interlaced case*/
+    VAStatsStatisticsBufferType         = 49,
+    /** \brief Statistics output for VAEntrypointStats bottom field of interlaced case*/
+    VAStatsStatisticsBottomFieldBufferType = 50,
+    VAStatsMVBufferType                 = 51,
+    VAStatsMVPredictorBufferType        = 52,
     /** Force MB's to be non skip for encode.it's per-mb control buffer, The width of the MB map
      * Surface is (width of the Picture in MB unit) * 1 byte, multiple of 64 bytes.
      * The height is (height of the picture in MB unit). The picture is either
@@ -1557,9 +1637,32 @@ typedef enum
      *surface, it will override the "skipCheckDisable" setting in VAEncMiscParameterEncQuality.
      */
     VAEncMacroblockDisableSkipMapBufferType = 53,
+    /**
+     * \brief HEVC FEI CTB level cmd buffer
+     * it is CTB level information for future usage.
+     */
+    VAEncFEICTBCmdBufferType            = 54,
+    /**
+     * \brief HEVC FEI CU level data buffer
+     * it's CTB level information for future usage
+     */
+    VAEncFEICURecordBufferType          = 55,
     /** decode stream out buffer, intermedia data of decode, it may include MV, MB mode etc.
       * it can be used to detect motion and analyze the frame contain  */
     VADecodeStreamoutBufferType             = 56,
+
+    /** \brief HEVC Decoding Subset Parameter buffer type
+     *
+     * The subsets parameter buffer is concatenation with one or multiple
+     * subset entry point offsets. All the offset values are layed out one
+     * by one according to slice order with first slice segment first, second
+     * slice segment second, etc... The entry number is indicated by parameter
+     * \ref num_entry_point_offsets. And the first entry position of the entry
+     * point offsets for any slice segment is indicated by parameter
+     * entry_offset_to_subset_array in VAPictureParameterBufferHEVC data structure.
+     */
+    VASubsetsParameterBufferType        = 57,
+
     VABufferTypeMax
 } VABufferType;
 
@@ -1749,37 +1852,70 @@ typedef struct _VAEncMiscParameterTemporalLayerStructure
 /** \brief Rate control parameters */
 typedef struct _VAEncMiscParameterRateControl
 {
-    /* this is the maximum bit-rate to be constrained by the rate control implementation */
+    /** The maximum bit-rate which the the rate controller should generate. */
     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
+    /** The target bit-rate which the rate controller should generate, as a percentage of the
+     * maximum bit-rate.
+     *
+     * In CBR mode this value is ignored (treated as 100%).
      */
     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
+    /** Rate control window size in milliseconds.
+     *
+     * The rate controller will attempt to guarantee that the target and maximum bit-rates are
+     * correct over this window.
      */
     uint32_t window_size;
-    /* initial QP at I frames */
+    /** Initial quantiser value used at the start of the stream.
+     *
+     * Ignored if set to zero.
+     */
     uint32_t initial_qp;
+    /** Minimum quantiser value to use.
+     *
+     * The quantiser will not go below the value - if this limit is hit, the output bitrate may
+     * be lower than the target.  Ignored if set to zero.
+     */
     uint32_t min_qp;
+    /** Basic unit size.
+     *
+     * Only used by some drivers - see driver documentation for details.  Set to zero if unused.
+     */
     uint32_t basic_unit_size;
     union
     {
         struct
         {
+            /** Force rate controller reset.
+             *
+             * The next frame will be treated as the start of a new stream, with all rate
+             * controller state reset to its initial values.
+             */
             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.
+            /** Disable frame skip in rate control mode. */
+            uint32_t disable_frame_skip : 1;
+            /** Disable bit stuffing in rate control mode. */
+            uint32_t disable_bit_stuffing : 1;
+            /** Macroblock-level rate control.
+             *
+             * 0: use default, 1: always enable, 2: always disable, other: reserved.
+             *
+             * This feature is only available if VAConfigAttribRateControl has the
+             * \ref VA_RC_MB bit set.
              */
+            uint32_t mb_rate_control : 4;
+            /** The temporal layer that these rate control parameters apply to. */
             uint32_t temporal_id : 8;
-            uint32_t cfs_I_frames : 1; /* I frame also follows CFS */
+            /** Ensure that intra frames also conform to the constant frame size. */
+            uint32_t cfs_I_frames : 1;
+            /** Enable parallel rate control for hierarchical B frames.
+             *
+             * See \ref VA_RC_PARALLEL.
+             */
             uint32_t enable_parallel_brc    : 1;
             uint32_t enable_dynamic_scaling : 1;
-             /**  \brief Frame Tolerance Mode
+            /** Frame tolerance mode.
+             *
              *  Indicates the tolerance the application has to variations in the frame size.
              *  For example, wireless display scenarios may require very steady bit rate to
              *  reduce buffering time. It affects the rate control algorithm used,
@@ -1793,19 +1929,42 @@ typedef struct _VAEncMiscParameterRateControl
              *  other       -- invalid.
              */
             uint32_t frame_tolerance_mode   : 2;
+            /** Reserved for future use, must be zero. */
             uint32_t reserved               : 12;
         } bits;
         uint32_t value;
     } rc_flags;
-    uint32_t ICQ_quality_factor; /* Initial ICQ quality factor: 1-51. */
-    /** \brief Reserved bytes for future use, must be zero */
+    /** Initial quality factor used in ICQ mode.
+     *
+     * This value must be between 1 and 51.
+     * this value will be deprecated in future, to use quality_factor instead of it.
+     */
+    uint32_t ICQ_quality_factor;
+    /** Maximum quantiser value to use.
+     *
+     * The quantiser will not go above this value - if this limit is hit, the output bitrate
+     * may exceed the target.  Ignored if set to zero.
+     */
     uint32_t max_qp;
-    uint32_t va_reserved[VA_PADDING_MEDIUM - 2];
+    /** Quality factor
+     *
+     *  the range will be different for different codec
+     */
+    uint32_t quality_factor;
+    /** Reserved bytes for future use, must be zero. */
+    uint32_t va_reserved[VA_PADDING_MEDIUM - 3];
 } VAEncMiscParameterRateControl;
 
+/** Encode framerate parameters.
+ *
+ * Sets the encode framerate used by the rate controller.  This should be
+ * provided in all modes using a bitrate target (variable framerate is not
+ * supported).
+ */
 typedef struct _VAEncMiscParameterFrameRate
 {
-    /*
+    /** Encode 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
@@ -1828,10 +1987,9 @@ typedef struct _VAEncMiscParameterFrameRate
     {
         struct
         {
-            /*
-             * The temporal id the framerate parameters are specified for.
-             */
+            /** The temporal layer that these framerate parameters apply to. */
             uint32_t temporal_id : 8;
+            /** Reserved for future use, must be zero. */
             uint32_t reserved : 24;
          } bits;
          uint32_t value;
@@ -1906,10 +2064,33 @@ typedef struct _VAEncMiscParameterRIR
     uint32_t                va_reserved[VA_PADDING_LOW];
 } VAEncMiscParameterRIR;
 
+/** HRD / VBV buffering parameters for encoding.
+ *
+ * This sets the HRD / VBV parameters which will be used by the rate
+ * controller for encoding.  It should be specified in modes using a bitrate
+ * target when the buffering of the output stream needs to be constrained.
+ *
+ * If not provided, the encoder may use arbitrary amounts of buffering.
+ */
 typedef struct _VAEncMiscParameterHRD
 {
-    uint32_t initial_buffer_fullness;       /* in bits */
-    uint32_t buffer_size;                   /* in bits */
+    /** The initial fullness of the HRD coded picture buffer, in bits.
+     *
+     * This sets how full the CPB is when encoding begins - that is, how much
+     * buffering will happen on the decoder side before the first frame.
+     * The CPB fullness will be reset to this value after any rate control
+     * reset (a change in parameters or an explicit reset).
+     *
+     * For H.264, it should match the value of initial_cpb_removal_delay in
+     * buffering_period SEI messages.
+     */
+    uint32_t initial_buffer_fullness;
+    /** The HRD coded picture buffer size, in bits.
+     *
+     * For H.264, it should match the value of cpb_size_value_minus1 in the VUI
+     * parameters.
+     */
+    uint32_t buffer_size;
 
     /** \brief Reserved bytes for future use, must be zero */
     uint32_t                va_reserved[VA_PADDING_LOW];
@@ -2893,7 +3074,13 @@ typedef enum
     VAEncPictureTypeBidirectional      = 2,
 } VAEncPictureType;
 
-/* Encode Slice Parameter Buffer */
+/**
+ * \brief Encode Slice Parameter Buffer.
+ *
+ * @deprecated
+ * This is a deprecated encode slice parameter buffer, All applications
+ * \c can use VAEncSliceParameterBufferXXX (XXX = MPEG2, HEVC, H264, JPEG)
+ */
 typedef struct _VAEncSliceParameterBuffer
 {
     uint32_t start_row_number; /* starting MB row number for this slice */
@@ -3077,6 +3264,16 @@ VAStatus vaBufferSetNumElements (
 #define VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD      0xff0000
 
 /**
+ * \brief The coded buffer segment status contains frame encoding passes number
+ *
+ * This is the mask to get the number of encoding passes from the coded
+ * buffer segment status. 
+ * NUMBER_PASS(bit24~bit27): the number for encoding passes executed for the coded frame.
+ * 
+ */
+#define VA_CODED_BUF_STATUS_NUMBER_PASSES_MASK          0xf000000
+
+/**
  * \brief The coded buffer segment contains a single NAL unit. 
  *
  * This flag indicates that the coded buffer segment contains a
@@ -3261,6 +3458,68 @@ vaAcquireBufferHandle(VADisplay dpy, VABufferID buf_id, VABufferInfo *buf_info);
 VAStatus
 vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id);
 
+/** @name vaExportSurfaceHandle() flags
+ *
+ * @{
+ */
+/** Export surface to be read by external API. */
+#define VA_EXPORT_SURFACE_READ_ONLY        0x0001
+/** Export surface to be written by external API. */
+#define VA_EXPORT_SURFACE_WRITE_ONLY       0x0002
+/** Export surface to be both read and written by external API. */
+#define VA_EXPORT_SURFACE_READ_WRITE       0x0003
+/** Export surface with separate layers.
+ *
+ * For example, NV12 surfaces should be exported as two separate
+ * planes for luma and chroma.
+ */
+#define VA_EXPORT_SURFACE_SEPARATE_LAYERS  0x0004
+/** Export surface with composed layers.
+ *
+ * For example, NV12 surfaces should be exported as a single NV12
+ * composed object.
+ */
+#define VA_EXPORT_SURFACE_COMPOSED_LAYERS  0x0008
+
+/** @} */
+
+/**
+ * \brief Export a handle to a surface for use with an external API
+ *
+ * The exported handles are owned by the caller, and the caller is
+ * responsible for freeing them when no longer needed (e.g. by closing
+ * DRM PRIME file descriptors).
+ *
+ * This does not perform any synchronisation.  If the contents of the
+ * surface will be read, vaSyncSurface() must be called before doing so.
+ * If the contents of the surface are written, then all operations must
+ * be completed externally before using the surface again by via VA-API
+ * functions.
+ *
+ * @param[in] dpy          VA display.
+ * @param[in] surface_id   Surface to export.
+ * @param[in] mem_type     Memory type to export to.
+ * @param[in] flags        Combination of flags to apply
+ *   (VA_EXPORT_SURFACE_*).
+ * @param[out] descriptor  Pointer to the descriptor structure to fill
+ *   with the handle details.  The type of this structure depends on
+ *   the value of mem_type.
+ *
+ * @return Status code:
+ * - VA_STATUS_SUCCESS:    Success.
+ * - VA_STATUS_ERROR_INVALID_DISPLAY:  The display is not valid.
+ * - VA_STATUS_ERROR_UNIMPLEMENTED:  The driver does not implement
+ *     this interface.
+ * - VA_STATUS_ERROR_INVALID_SURFACE:  The surface is not valid, or
+ *     the surface is not exportable in the specified way.
+ * - VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE:  The driver does not
+ *     support exporting surfaces to the specified memory type.
+ */
+VAStatus vaExportSurfaceHandle(VADisplay dpy,
+                               VASurfaceID surface_id,
+                               uint32_t mem_type, uint32_t flags,
+                               void *descriptor);
+
 /**
  * Render (Video Decode/Encode/Processing) Pictures
  *
@@ -3413,56 +3672,224 @@ VAStatus vaQuerySurfaceError(
     ((unsigned long)(unsigned char) (ch0) | ((unsigned long)(unsigned char) (ch1) << 8) | \
     ((unsigned long)(unsigned char) (ch2) << 16) | ((unsigned long)(unsigned char) (ch3) << 24 ))
 
-/* 
- * Pre-defined fourcc codes
+/* Pre-defined fourcc codes. */
+
+/** NV12: two-plane 8-bit YUV 4:2:0.
+ * The first plane contains Y, the second plane contains U and V in pairs of bytes.
  */
 #define VA_FOURCC_NV12         0x3231564E
+/** NV21: two-plane 8-bit YUV 4:2:0.
+ * Same as NV12, but with U and V swapped.
+ */
 #define VA_FOURCC_NV21         0x3132564E
+
+/** AI44: packed 4-bit YA.
+ *
+ * The bottom half of each byte contains luma, the top half contains alpha.
+ */
 #define VA_FOURCC_AI44         0x34344149
+
+/** RGBA: packed 8-bit RGBA.
+ *
+ * Four bytes per pixel: red, green, blue, alpha.
+ */
 #define VA_FOURCC_RGBA         0x41424752
+/** RGBX: packed 8-bit RGB.
+ *
+ * Four bytes per pixel: red, green, blue, unspecified.
+ */
 #define VA_FOURCC_RGBX         0x58424752
+/** BGRA: packed 8-bit RGBA.
+ *
+ * Four bytes per pixel: blue, green, red, alpha.
+ */
 #define VA_FOURCC_BGRA         0x41524742
+/** BGRX: packed 8-bit RGB.
+ *
+ * Four bytes per pixel: blue, green, red, unspecified.
+ */
 #define VA_FOURCC_BGRX         0x58524742
+/** ARGB: packed 8-bit RGBA.
+ *
+ * Four bytes per pixel: alpha, red, green, blue.
+ */
 #define VA_FOURCC_ARGB         0x42475241
+/** XRGB: packed 8-bit RGB.
+ *
+ * Four bytes per pixel: unspecified, red, green, blue.
+ */
 #define VA_FOURCC_XRGB         0x42475258
+/** ABGR: packed 8-bit RGBA.
+ *
+ * Four bytes per pixel: alpha, blue, green, red.
+ */
 #define VA_FOURCC_ABGR          0x52474241
+/** XBGR: packed 8-bit RGB.
+ *
+ * Four bytes per pixel: unspecified, blue, green, red.
+ */
 #define VA_FOURCC_XBGR          0x52474258
+
+/** UYUV: packed 8-bit YUV 4:2:2.
+ *
+ * Four bytes per pair of pixels: U, Y, U, V.
+ */
 #define VA_FOURCC_UYVY          0x59565955
+/** YUY2: packed 8-bit YUV 4:2:2.
+ *
+ * Four bytes per pair of pixels: Y, U, Y, V.
+ */
 #define VA_FOURCC_YUY2          0x32595559
+/** AYUV: packed 8-bit YUVA 4:4:4.
+ *
+ * Four bytes per pixel: A, Y, U, V.
+ */
 #define VA_FOURCC_AYUV          0x56555941
+/** NV11: two-plane 8-bit YUV 4:1:1.
+ *
+ * The first plane contains Y, the second plane contains U and V in pairs of bytes.
+ */
 #define VA_FOURCC_NV11          0x3131564e
+/** YV12: three-plane 8-bit YUV 4:2:0.
+ *
+ * The three planes contain Y, V and U respectively.
+ */
 #define VA_FOURCC_YV12          0x32315659
+/** P208: two-plane 8-bit YUV 4:2:2.
+ *
+ * The first plane contains Y, the second plane contains U and V in pairs of bytes.
+ */
 #define VA_FOURCC_P208          0x38303250
-/* IYUV same as I420, but most user perfer I420, will deprecate it */
-#define VA_FOURCC_IYUV          0x56555949
+/** I420: three-plane 8-bit YUV 4:2:0.
+ *
+ * The three planes contain Y, U and V respectively.
+ */
 #define VA_FOURCC_I420          0x30323449
+/** YV24: three-plane 8-bit YUV 4:4:4.
+ *
+ * The three planes contain Y, V and U respectively.
+ */
 #define VA_FOURCC_YV24          0x34325659
+/** YV32: four-plane 8-bit YUVA 4:4:4
+ *
+ * The four planes contain Y, V, U and A respectively.
+ */
 #define VA_FOURCC_YV32          0x32335659
+/** Y800: 8-bit greyscale.
+ */
 #define VA_FOURCC_Y800          0x30303859
+/** IMC3: three-plane 8-bit YUV 4:2:0.
+ *
+ * Equivalent to YV12, but with the additional constraint that the pitch of all three planes
+ * must be the same.
+ */
 #define VA_FOURCC_IMC3          0x33434D49
+/** 411P: three-plane 8-bit YUV 4:1:1.
+ *
+ * The three planes contain Y, U and V respectively.
+ */
 #define VA_FOURCC_411P          0x50313134
+/** 411R: three-plane 8-bit YUV.
+ *
+ * The subsampling is the transpose of 4:1:1 - full chroma appears on every fourth line.
+ * The three planes contain Y, U and V respectively.
+ */
+#define VA_FOURCC_411R          0x52313134
+/** 422H: three-plane 8-bit YUV 4:2:2.
+ *
+ * The three planes contain Y, U and V respectively.
+ */
 #define VA_FOURCC_422H          0x48323234
+/** 422V: three-plane 8-bit YUV 4:4:0.
+ *
+ * The three planes contain Y, U and V respectively.
+ */
 #define VA_FOURCC_422V          0x56323234
+/** 444P: three-plane 8-bit YUV 4:4:4.
+ *
+ * The three planes contain Y, U and V respectively.
+ */
 #define VA_FOURCC_444P          0x50343434
+
+/** RGBP: three-plane 8-bit RGB.
+ *
+ * The three planes contain red, green and blue respectively.
+ */
 #define VA_FOURCC_RGBP          0x50424752
+/** BGRP: three-plane 8-bit RGB.
+ *
+ * The three planes contain blue, green and red respectively.
+ */
 #define VA_FOURCC_BGRP          0x50524742
-#define VA_FOURCC_411R          0x52313134 /* rotated 411P */
-/**
- * Planar YUV 4:2:2.
- * 8-bit Y plane, followed by 8-bit 2x1 subsampled V and U planes
+/** RG16: packed 5/6-bit RGB.
+ *
+ * Each pixel is a two-byte little-endian value.
+ * Red, green and blue are found in bits 15:11, 10:5, 4:0 respectively.
+ */
+#define VA_FOURCC_RGB565        0x36314752
+/** BG16: packed 5/6-bit RGB.
+ *
+ * Each pixel is a two-byte little-endian value.
+ * Blue, green and red are found in bits 15:11, 10:5, 4:0 respectively.
+ */
+#define VA_FOURCC_BGR565        0x36314742
+
+/** Y210: packed 10-bit YUV 4:2:2.
+ *
+ * Eight bytes represent a pair of pixels.  Each sample is a two-byte little-endian value,
+ * with the bottom six bits ignored.  The samples are in the order Y, U, Y, V.
+ */
+#define VA_FOURCC_Y210          0x30313259
+/** Y216: packed 16-bit YUV 4:2:2.
+ *
+ * Eight bytes represent a pair of pixels.  Each sample is a two-byte little-endian value.
+ * The samples are in the order Y, U, Y, V.
+ */
+#define VA_FOURCC_Y216          0x36313259
+/** Y410: packed 10-bit YUVA 4:4:4.
+ *
+ * Each pixel is a four-byte little-endian value.
+ * A, V, Y, U are found in bits 31:30, 29:20, 19:10, 9:0 respectively.
+ */
+#define VA_FOURCC_Y410          0x30313459
+/** Y416: packed 16-bit YUVA 4:4:4.
+ *
+ * Each pixel is a set of four samples, each of which is a two-byte little-endian value.
+ * The samples are in the order A, V, Y, U.
+ */
+#define VA_FOURCC_Y416          0x36313459
+
+/** YV16: three-plane 8-bit YUV 4:2:2.
+ *
+ * The three planes contain Y, V and U respectively.
  */
 #define VA_FOURCC_YV16          0x36315659
-/**
- * 10-bit and 16-bit Planar YUV 4:2:0. 
+/** P010: two-plane 10-bit YUV 4:2:0.
+ *
+ * Each sample is a two-byte little-endian value with the bottom six bits ignored.
+ * The first plane contains Y, the second plane contains U and V in pairs of samples.
  */
 #define VA_FOURCC_P010          0x30313050
+/** P016: two-plane 16-bit YUV 4:2:0.
+ *
+ * Each sample is a two-byte little-endian value.  The first plane contains Y, the second
+ * plane contains U and V in pairs of samples.
+ */
 #define VA_FOURCC_P016          0x36313050
 
-/**
- * 10-bit Planar YUV 420 and occupy the lower 10-bit.
+/** I010: three-plane 10-bit YUV 4:2:0.
+ *
+ * Each sample is a two-byte little-endian value with the top six bits ignored.
+ * The three planes contain Y, V and U respectively.
  */
 #define VA_FOURCC_I010          0x30313049
 
+/** IYUV: three-plane 8-bit YUV 4:2:0.
+ *
+ * @deprecated Use I420 instead.
+ */
+#define VA_FOURCC_IYUV          0x56555949
+
 /* byte order */
 #define VA_LSB_FIRST           1
 #define VA_MSB_FIRST           2
@@ -4043,6 +4470,7 @@ typedef struct _VAPictureHEVC
 #include <va/va_dec_vp8.h>
 #include <va/va_dec_vp9.h>
 #include <va/va_enc_hevc.h>
+#include <va/va_fei_hevc.h>
 #include <va/va_enc_h264.h>
 #include <va/va_enc_jpeg.h>
 #include <va/va_enc_mpeg2.h>