extern "C" {
#endif
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__COVERITY__)
#define va_deprecated __attribute__((deprecated))
#if __GNUC__ >= 6
#define va_deprecated_enum va_deprecated
* 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
+ * - 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
*/
/**
/**
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:
- 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
*/
#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() */
#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
*/
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;
/**
* (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 */
* 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,
+ /**
+ * \brief Decode processing support. Read/write.
+ *
+ * This attribute determines if the driver supports video processing
+ * with decoding using the decoding context in a single call, through
+ * vaGetConfigAttributes(); and if the user may use this feature,
+ * through vaCreateConfig(), if the driver supports the user scenario.
+ * The user will essentially create a regular decode VAContext. Therefore,
+ * the parameters of vaCreateContext() such as picture_width, picture_height
+ * and render_targets are in relation to the decode output parameters
+ * (not processing output parameters) as normal.
+ * If this attribute is not set by the user then it is assumed that no
+ * extra processing is done after decoding for this decode context.
+ *
+ * Since essentially the application is creating a decoder config and context,
+ * all function calls that take in the config (e.g. vaQuerySurfaceAttributes())
+ * or context are in relation to the decoder, except those video processing
+ * function specified in the next paragraph.
+ *
+ * Once the decode config and context are created, the user must further
+ * query the supported processing filters using vaQueryVideoProcFilters(),
+ * vaQueryVideoProcFilterCaps(), vaQueryVideoProcPipelineCaps() by specifying
+ * the created decode context. The user must provide processing information
+ * and extra processing output surfaces as "additional_outputs" to the driver
+ * through VAProcPipelineParameterBufferType. The render_target specified
+ * at vaBeginPicture() time refers to the decode output surface. The
+ * target surface for the output of processing needs to be a different
+ * surface since the decode process requires the original reconstructed buffer.
+ * The “surface” member of VAProcPipelineParameterBuffer should be set to the
+ * same as “render_target” set in vaBeginPicture(), but the driver may choose
+ * to ignore this parameter.
+ */
+ VAConfigAttribDecProcessing = 8,
/** @name Attributes for encoding */
/**@{*/
/**
*/
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
*/
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 intra refresh attribute. Read-only.
+ *
+ * This attribute conveys whether the driver supports certain types of intra refresh methods
+ * for encoding (e.g. adaptive intra refresh or rolling intra refresh).
+ * See \c VA_ENC_INTRA_REFRESH_xxx for intra refresh methods
+ */
+ VAConfigAttribEncIntraRefresh = 23,
+ /**
* \brief Encoding skip frame attribute. Read-only.
*
* This attribute conveys whether the driver supports sending skip frame parameters
* VAConfigAttribValEncRateControlExt union.
*/
VAConfigAttribEncRateControlExt = 26,
-
/**
+ * \brief Processing rate reporting attribute. Read-only.
+ *
+ * This attribute conveys whether the driver supports reporting of
+ * encode/decode processing rate based on certain set of parameters
+ * (i.e. levels, I frame internvals) for a given configuration.
+ * If this is supported, vaQueryProcessingRate() can be used to get
+ * encode or decode processing rate.
+ * See \c VA_PROCESSING_RATE_xxx for encode/decode processing rate
+ */
+ VAConfigAttribProcessingRate = 27,
+ /**
+ * \brief Encoding dirty rectangle. Read-only.
+ *
+ * This attribute conveys whether the driver supports dirty rectangle.
+ * encoding, based on user provided ROI rectangles which indicate the rectangular areas
+ * where the content has changed as compared to the previous picture. The regions of the
+ * picture that are not covered by dirty rect rectangles are assumed to have not changed
+ * compared to the previous picture. The encoder may do some optimizations based on
+ * this information. The attribute value returned indicates the number of regions that
+ * are supported. e.g. A value of 0 means dirty rect encoding is not supported. If dirty
+ * rect encoding is supported, the ROI information is passed to the driver using
+ * VAEncMiscParameterTypeDirtyRect.
+ */
+ VAConfigAttribEncDirtyRect = 28,
+ /**
+ * \brief Parallel Rate Control (hierachical B) attribute. Read-only.
+ *
+ * This attribute conveys whether the encoder supports parallel rate control.
+ * It is a integer value 0 - unsupported, > 0 - maximum layer supported.
+ * This is the way when hireachical B frames are encoded, multiple independent B frames
+ * on the same layer may be processed at same time. If supported, app may enable it by
+ * setting enable_parallel_brc in VAEncMiscParameterRateControl,and the number of B frames
+ * per layer per GOP will be passed to driver through VAEncMiscParameterParallelRateControl
+ * structure.Currently three layers are defined.
+ */
+ VAConfigAttribEncParallelRateControl = 29,
+ /**
+ * \brief Dynamic Scaling Attribute. Read-only.
+ *
+ * This attribute conveys whether encoder is capable to determine dynamic frame
+ * resolutions adaptive to bandwidth utilization and processing power, etc.
+ * It is a boolean value 0 - unsupported, 1 - supported.
+ * If it is supported,for VP9, suggested frame resolution can be retrieved from VACodedBufferVP9Status.
+ */
+ VAConfigAttribEncDynamicScaling = 30,
+ /**
+ * \brief frame size tolerance support
+ * it indicates the tolerance of frame size
+ */
+ VAConfigAttribFrameSizeToleranceSupport = 31,
+ /**
* \brief Encode function type for FEI.
*
* This attribute conveys whether the driver supports different function types for encode.
* it is for FEI entry point only.
* Default is VA_FEI_FUNCTION_ENC_PAK.
*/
- VAConfigAttribFEIFunctionType = 32,
+ VAConfigAttribFEIFunctionType = 32,
/**
* \brief Maximum number of FEI MV predictors. Read-only.
*
* 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.
+ *
+ * This attribute conveys whether encoder is capable to support tiles.
+ * If not supported, the tile related parameters sent to encoder, such as
+ * tiling structure, should be ignored. 0 - unsupported, 1 - supported.
+ */
+ VAConfigAttribEncTileSupport = 35,
+ /**
+ * \brief whether accept rouding setting from application. Read-only.
+ * This attribute is for encode quality, if it is report,
+ * application can change the rounding setting by VAEncMiscParameterTypeCustomRoundingControl
+ */
+ VAConfigAttribCustomRoundingControl = 36,
+ /**
+ * \brief Encoding QP info block size attribute. Read-only.
+ * This attribute conveys the block sizes that underlying driver
+ * support for QP info for buffer #VAEncQpBuffer.
+ */
+ VAConfigAttribQPBlockSize = 37,
/**@}*/
VAConfigAttribTypeMax
} VAConfigAttribType;
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
+/* 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. */
#define VA_RC_CQP 0x00000010
/** \brief Variable bitrate with peak rate higher than average bitrate. */
#define VA_RC_VBR_CONSTRAINED 0x00000020
+/** \brief Intelligent Constant Quality. Provided an initial ICQ_quality_factor,
+ * adjusts QP at a frame and MB level based on motion to improve subjective quality. */
+#define VA_RC_ICQ 0x00000040
/** \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
+/** \brief Constant Frame Size, it is used for small tolerent */
+#define VA_RC_CFS 0x00000100
+/** \brief Parallel BRC, for hierachical B.
+ *
+ * For hierachical B, B frames can be refered by other B frames.
+ * Currently three layers of hierachy are defined:
+ * B0 - regular B, no reference to other B frames.
+ * B1 - reference to only I, P and regular B0 frames.
+ * B2 - reference to any other frames, including B1.
+ * In Hierachical B structure, B frames on the same layer can be processed
+ * simultaneously. And BRC would adjust accordingly. This is so called
+ * Parallel BRC. */
+#define VA_RC_PARALLEL 0x00000200
/**@}*/
#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 VAConfigAttribDecProcessing */
+/**@{*/
+/** \brief No decoding + processing in a single decoding call. */
+#define VA_DEC_PROCESSING_NONE 0x00000000
+/** \brief Decode + processing in a single decoding call. */
+#define VA_DEC_PROCESSING 0x00000001
/**@}*/
/** @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.
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
+/**@}*/
+
+/** @name Attribute values for VAConfigAttribEncIntraRefresh */
+/**@{*/
+/** \brief Driver does not support intra refresh */
+#define VA_ENC_INTRA_REFRESH_NONE 0x00000000
+/** \brief Driver supports column based rolling intra refresh */
+#define VA_ENC_INTRA_REFRESH_ROLLING_COLUMN 0x00000001
+/** \brief Driver supports row based rolling intra refresh */
+#define VA_ENC_INTRA_REFRESH_ROLLING_ROW 0x00000002
+/** \brief Driver supports adaptive intra refresh */
+#define VA_ENC_INTRA_REFRESH_ADAPTIVE 0x00000010
+/** \brief Driver supports cyclic intra refresh */
+#define VA_ENC_INTRA_REFRESH_CYCLIC 0x00000020
+/** \brief Driver supports intra refresh of P frame*/
+#define VA_ENC_INTRA_REFRESH_P_FRAME 0x00010000
+/** \brief Driver supports intra refresh of B frame */
+#define VA_ENC_INTRA_REFRESH_B_FRAME 0x00020000
+/** \brief Driver supports intra refresh of multiple reference encoder */
+#define VA_ENC_INTRA_REFRESH_MULTI_REF 0x00040000
+
+/**@}*/
+
/** \brief Attribute value for VAConfigAttribEncROI */
typedef union _VAConfigAttribValEncROI {
struct {
uint32_t value;
} VAConfigAttribValEncRateControlExt;
+/** @name Attribute values for VAConfigAttribProcessingRate. */
+/**@{*/
+/** \brief Driver does not support processing rate report */
+#define VA_PROCESSING_RATE_NONE 0x00000000
+/** \brief Driver supports encode processing rate report */
+#define VA_PROCESSING_RATE_ENCODE 0x00000001
+/** \brief Driver supports decode processing rate report */
+#define VA_PROCESSING_RATE_DECODE 0x00000002
+/**@}*/
/**
* if an attribute is not applicable for a given
* profile/entrypoint pair, then set the value to the following
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.
*/
/**
* 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
#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
/**@}*/
/**
* 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
* 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
*/
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
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
+ * frame or non-interleaved top or bottom field. If the application provides this
+ *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,
VABufferTypeMax
} VABufferType;
+/**
+ * Processing rate parameter for encode.
+ */
+typedef struct _VAProcessingRateParameterEnc {
+ /** \brief Profile level */
+ uint8_t level_idc;
+ uint8_t reserved[3];
+ /** \brief quality level. When set to 0, default quality
+ * level is used.
+ */
+ uint32_t quality_level;
+ /** \brief Period between I frames. */
+ uint32_t intra_period;
+ /** \brief Period between I/P frames. */
+ uint32_t ip_period;
+} VAProcessingRateParameterEnc;
+
+/**
+ * Processing rate parameter for decode.
+ */
+typedef struct _VAProcessingRateParameterDec {
+ /** \brief Profile level */
+ uint8_t level_idc;
+ uint8_t reserved0[3];
+ uint32_t reserved;
+} VAProcessingRateParameterDec;
+
+typedef struct _VAProcessingRateParameter {
+ union {
+ VAProcessingRateParameterEnc proc_buf_enc;
+ VAProcessingRateParameterDec proc_buf_dec;
+ };
+} VAProcessingRateParameter;
+
+/**
+ * \brief Queries processing rate for the supplied config.
+ *
+ * This function queries the processing rate based on parameters in
+ * \c proc_buf for the given \c config. Upon successful return, the processing
+ * rate value will be stored in \c processing_rate. Processing rate is
+ * specified as the number of macroblocks/CTU per second.
+ *
+ * If NULL is passed to the \c proc_buf, the default processing rate for the
+ * given configuration will be returned.
+ *
+ * @param[in] dpy the VA display
+ * @param[in] config the config identifying a codec or a video
+ * processing pipeline
+ * @param[in] proc_buf the buffer that contains the parameters for
+ either the encode or decode processing rate
+ * @param[out] processing_rate processing rate in number of macroblocks per
+ second constrained by parameters specified in proc_buf
+ *
+ */
+VAStatus
+vaQueryProcessingRate(
+ VADisplay dpy,
+ VAConfigID config,
+ VAProcessingRateParameter *proc_buf,
+ unsigned int *processing_rate
+);
+
typedef enum
{
VAEncMiscParameterTypeFrameRate = 0,
/** \brief Buffer type used for HRD parameters. */
VAEncMiscParameterTypeHRD = 5,
VAEncMiscParameterTypeQualityLevel = 6,
+ /** \brief Buffer type used for Rolling intra refresh */
+ VAEncMiscParameterTypeRIR = 7,
+ /** \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,
VAEncMiscParameterTypeROI = 10,
/** \brief Buffer type used for temporal layer structure */
VAEncMiscParameterTypeTemporalLayerStructure = 12,
+ /** \brief Buffer type used for dirty region-of-interest (ROI) parameters. */
+ VAEncMiscParameterTypeDirtyRect = 13,
+ /** \brief Buffer type used for parallel BRC parameters. */
+ VAEncMiscParameterTypeParallelBRC = 14,
+ /** \brief Set MB partion mode mask and Half-pel/Quant-pel motion search */
+ VAEncMiscParameterTypeSubMbPartPel = 15,
+ /** \brief set encode quality tuning */
+ VAEncMiscParameterTypeEncQuality = 16,
+ /** \brief Buffer type used for encoder rounding offset parameters. */
+ VAEncMiscParameterTypeCustomRoundingControl = 17,
/** \brief Buffer type used for FEI input frame level parameters */
VAEncMiscParameterTypeFEIFrameControl = 18,
+ /** \brief encode extension buffer, ect. MPEG2 Sequence extenstion data */
+ VAEncMiscParameterTypeExtensionData = 19
} VAEncMiscParameterType;
/** \brief Packed header type. */
uint32_t bit_length;
/** \brief Flag: buffer contains start code emulation prevention bytes? */
uint8_t has_emulation_bytes;
+
+ /** \brief Reserved bytes for future use, must be zero */
+ uint32_t va_reserved[VA_PADDING_LOW];
} VAEncPackedHeaderParameterBuffer;
/**
* 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;
* The temporal layer that the rate control parameters are specified for.
*/
uint32_t temporal_id : 8;
- uint32_t reserved : 17;
+ uint32_t cfs_I_frames : 1; /* I frame also follows CFS */
+ uint32_t enable_parallel_brc : 1;
+ uint32_t enable_dynamic_scaling : 1;
+ /** \brief 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,
+ * but may or may not have an effect based on the combination of other BRC
+ * parameters. Only valid when the driver reports support for
+ * #VAConfigAttribFrameSizeToleranceSupport.
+ *
+ * equals 0 -- normal mode;
+ * equals 1 -- maps to sliding window;
+ * equals 2 -- maps to low delay mode;
+ * other -- invalid.
+ */
+ uint32_t frame_tolerance_mode : 2;
+ 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 */
+ uint32_t max_qp;
+ uint32_t va_reserved[VA_PADDING_MEDIUM - 2];
} VAEncMiscParameterRateControl;
typedef struct _VAEncMiscParameterFrameRate
} bits;
uint32_t value;
} framerate_flags;
+
+ /** \brief Reserved bytes for future use, must be zero */
+ uint32_t va_reserved[VA_PADDING_LOW];
} VAEncMiscParameterFrameRate;
/**
typedef struct _VAEncMiscParameterMaxSliceSize
{
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
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;
+/*
+ * \brief Rolling intra refresh data structure for encoding.
+ */
+typedef struct _VAEncMiscParameterRIR
+{
+ union
+ {
+ struct
+ /**
+ * \brief Indicate if intra refresh is enabled in column/row.
+ *
+ * App should query VAConfigAttribEncIntraRefresh to confirm RIR support
+ * by the driver before sending this structure.
+ */
+ {
+ /* \brief enable RIR in column */
+ uint32_t enable_rir_column : 1;
+ /* \brief enable RIR in row */
+ uint32_t enable_rir_row : 1;
+ uint32_t reserved : 30;
+ } bits;
+ uint32_t value;
+ } rir_flags;
+ /**
+ * \brief Indicates the column or row location in MB. It is ignored if
+ * rir_flags is 0.
+ */
+ uint16_t intra_insertion_location;
+ /**
+ * \brief Indicates the number of columns or rows in MB. It is ignored if
+ * rir_flags is 0.
+ */
+ uint16_t intra_insert_size;
+ /**
+ * \brief indicates the Qp difference for inserted intra columns or rows.
+ * App can use this to adjust intra Qp based on bitrate & max frame size.
+ */
+ uint8_t qp_delta_for_inserted_intra;
+ /** \brief Reserved bytes for future use, must be zero */
+ uint32_t va_reserved[VA_PADDING_LOW];
+} VAEncMiscParameterRIR;
+
typedef struct _VAEncMiscParameterHRD
{
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;
/**
VAEncMiscParameterType type;
/** \brief Maximum size of a frame (in bits). */
uint32_t max_frame_size;
+
+ /** \brief Reserved bytes for future use, must be zero */
+ uint32_t va_reserved[VA_PADDING_LOW];
} VAEncMiscParameterBufferMaxFrameSize;
/**
* level is used.
*/
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
/** \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. */
uint32_t size_skip_frames;
+
+ /** \brief Reserved bytes for future use, must be zero */
+ uint32_t va_reserved[VA_PADDING_LOW];
} VAEncMiscParameterSkipFrame;
/**
} bits;
uint32_t value;
} roi_flags;
+
+ /** \brief Reserved bytes for future use, must be zero */
+ uint32_t va_reserved[VA_PADDING_LOW];
} VAEncMiscParameterBufferROI;
+/*
+ * \brief Dirty rectangle data structure for encoding.
+ *
+ * The encoding dirty rect can be set through VAEncMiscParameterBufferDirtyRect, if the
+ * implementation supports dirty rect input. The rect 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 rects can be queried through the VAConfigAttribEncDirtyRect. The
+ * encoder will use the rect information to know those rectangle areas have changed while the
+ * areas not covered by dirty rect rectangles are assumed to have not changed compared to the
+ * previous picture. The encoder may do some internal optimizations.
+ */
+typedef struct _VAEncMiscParameterBufferDirtyRect
+{
+ /** \brief Number of Rectangle being sent.*/
+ uint32_t num_roi_rectangle;
+
+ /** \brief Pointer to a VARectangle array with num_roi_rectangle elements.*/
+ VARectangle *roi_rectangle;
+} VAEncMiscParameterBufferDirtyRect;
+
+/** \brief Attribute value for VAConfigAttribEncParallelRateControl */
+typedef struct _VAEncMiscParameterParallelRateControl {
+ /** brief Number of layers*/
+ uint32_t num_layers;
+ /** brief Number of B frames per layer per GOP.
+ *
+ * it should be allocated by application, and the is num_layers.
+ * num_b_in_gop[0] is the number of regular B which refers to only I or P frames. */
+ uint32_t *num_b_in_gop;
+} VAEncMiscParameterParallelRateControl;
+
+/** per frame encoder quality controls, once set they will persist for all future frames
+ *till it is updated again. */
+typedef struct _VAEncMiscParameterEncQuality
+{
+ union
+ {
+ struct
+ {
+ /** Use raw frames for reference instead of reconstructed frames.
+ * it only impact motion estimation (ME) stage, and will not impact MC stage
+ * so the reconstruct picture will can match with decode side */
+ uint32_t useRawPicForRef : 1;
+ /** Disables skip check for ME stage, it will increase the bistream size
+ * but will improve the qulity */
+ uint32_t skipCheckDisable : 1;
+ /** Indicates app will override default driver FTQ settings using FTQEnable.
+ * FTQ is forward transform quantization */
+ uint32_t FTQOverride : 1;
+ /** Enables/disables FTQ. */
+ uint32_t FTQEnable : 1;
+ /** Indicates the app will provide the Skip Threshold LUT to use when FTQ is
+ * enabled (FTQSkipThresholdLUT), else default driver thresholds will be used. */
+ uint32_t FTQSkipThresholdLUTInput : 1;
+ /** Indicates the app will provide the Skip Threshold LUT to use when FTQ is
+ * disabled (NonFTQSkipThresholdLUT), else default driver thresholds will be used. */
+ uint32_t NonFTQSkipThresholdLUTInput : 1;
+ uint32_t ReservedBit : 1;
+ /** Control to enable the ME mode decision algorithm to bias to fewer B Direct/Skip types.
+ * Applies only to B frames, all other frames will ignore this setting. */
+ uint32_t directBiasAdjustmentEnable : 1;
+ /** Enables global motion bias. global motion also is called HME (Heirarchical Motion Estimation )
+ * HME is used to handle large motions and avoiding local minima in the video encoding process
+ * down scaled the input and reference picture, then do ME. the result will be a predictor to next level HME or ME
+ * current interface divide the HME to 3 level. UltraHME , SuperHME, and HME, result of UltraHME will be input of SurperHME,
+ * result of superHME will be a input for HME. HME result will be input of ME. it is a switch for HMEMVCostScalingFactor
+ * can change the HME bias inside RDO stage*/
+ uint32_t globalMotionBiasAdjustmentEnable : 1;
+ /** MV cost scaling ratio for HME ( predictors. It is used when
+ * globalMotionBiasAdjustmentEnable == 1, else it is ignored. Values are:
+ * 0: set MV cost to be 0 for HME predictor.
+ * 1: scale MV cost to be 1/2 of the default value for HME predictor.
+ * 2: scale MV cost to be 1/4 of the default value for HME predictor.
+ * 3: scale MV cost to be 1/8 of the default value for HME predictor. */
+ uint32_t HMEMVCostScalingFactor : 2;
+ /**disable HME, if it is disabled. Super*ultraHME should also be disabled */
+ uint32_t HMEDisable : 1;
+ /**disable Super HME, if it is disabled, ultraHME should be disabled */
+ uint32_t SuperHMEDisable : 1;
+ /** disable Ultra HME */
+ uint32_t UltraHMEDisable : 1;
+ /** disable panic mode. Panic mode happened when there are extreme BRC (bit rate control) requirement
+ * frame size cant achieve the target of BRC. when Panic mode is triggered, Coefficients will
+ * be set to zero. disable panic mode will improve quality but will impact BRC */
+ uint32_t PanicModeDisable : 1;
+ /** Force RepartitionCheck
+ * 0: DEFAULT - follow driver default settings.
+ * 1: FORCE_ENABLE - enable this feature totally for all cases.
+ * 2: FORCE_DISABLE - disable this feature totally for all cases. */
+ uint32_t ForceRepartitionCheck : 2;
+
+ };
+ uint32_t encControls;
+ };
+
+ /** Maps QP to skip thresholds when FTQ is enabled. Valid range is 0-255. */
+ uint8_t FTQSkipThresholdLUT[52];
+ /** Maps QP to skip thresholds when FTQ is disabled. Valid range is 0-65535. */
+ uint16_t NonFTQSkipThresholdLUT[52];
+
+ uint32_t reserved[VA_PADDING_HIGH]; // Reserved for future use.
+
+} VAEncMiscParameterEncQuality;
/**
+ * \brief Custom Encoder Rounding Offset Control.
+ * Application may use this structure to set customized rounding
+ * offset parameters for quantization.
+ * Valid when \c VAConfigAttribCustomRoundingControl equals 1.
+ */
+typedef struct _VAEncMiscParameterCustomRoundingControl
+{
+ union {
+ struct {
+ /** \brief Enable customized rounding offset for intra blocks.
+ * If 0, default value would be taken by driver for intra
+ * rounding offset.
+ */
+ uint32_t enable_custom_rouding_intra : 1 ;
+
+ /** \brief Intra rounding offset
+ * Ignored if \c enable_custom_rouding_intra equals 0.
+ */
+ uint32_t rounding_offset_intra : 7;
+
+ /** \brief Enable customized rounding offset for inter blocks.
+ * If 0, default value would be taken by driver for inter
+ * rounding offset.
+ */
+ uint32_t enable_custom_rounding_inter : 1 ;
+
+ /** \brief Inter rounding offset
+ * Ignored if \c enable_custom_rouding_inter equals 0.
+ */
+ uint32_t rounding_offset_inter : 7;
+
+ /* Reserved */
+ uint32_t reserved :16;
+ } bits;
+ uint32_t value;
+ } rounding_offset_setting;
+} VAEncMiscParameterCustomRoundingControl;
+/**
* 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.
uint8_t pad[2];
/**@}*/
} huffman_table[2];
+
+ /** \brief Reserved bytes for future use, must be zero */
+ uint32_t va_reserved[VA_PADDING_LOW];
} VAHuffmanTableBufferJPEGBaseline;
/****************************
} bits;
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 */
uint8_t chroma_intra_quantiser_matrix[64];
/** \brief Chroma non-intra matrix, in zig-zag scan order. */
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 */
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 */
/* Number of skipped macroblocks after this macroblock */
uint16_t num_skipped_macroblocks;
+
+ /** \brief Reserved bytes for future use, must be zero */
+ uint32_t va_reserved[VA_PADDING_LOW];
} VAMacroblockParameterBufferMPEG2;
/*
/* for direct mode prediction */
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 */
uint8_t intra_quant_mat[64];
/** The matrix for non-intra blocks, in zig-zag scan order. */
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 */
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;
/**
} bits;
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
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 */
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
uint32_t value;
} pic_fields;
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 */
uint8_t ScalingList4x4[6][16];
/** \brief 8x8 scaling list, in raster scan order. */
uint8_t ScalingList8x8[2][64];
+
+ /** \brief Reserved bytes for future use, must be zero */
+ uint32_t va_reserved[VA_PADDING_LOW];
} VAIQMatrixBufferH264;
/** H.264 Slice Parameter Buffer */
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 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;
/****************************
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 */
} bits;
uint32_t value;
} slice_flags;
+
+ /** \brief Reserved bytes for future use, must be zero */
+ uint32_t va_reserved[VA_PADDING_LOW];
} VAEncSliceParameterBuffer;
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
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;
/****************************
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
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;
);
/**
+ * 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
* #VAEncMiscParameterTypeMaxFrameSize.
*/
#define VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW 0x1000
+/**
+ * \brief the bitstream is bad or corrupt.
+ */
+#define VA_CODED_BUF_STATUS_BAD_BITSTREAM 0x8000
#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
* 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;
/**
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;
/**
VAStatus
vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id);
-/*
-Render (Decode) Pictures
+/** @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
-A picture represents either a frame or a field.
+/** @} */
-The Begin/Render/End sequence sends the decode buffers to the server
-*/
+/**
+ * \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);
/**
- * Get ready to decode a picture to a target surface
+ * 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 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,
);
/**
- * Send decode buffers to the server.
+ * Send video decode, encode or processing buffers to the server.
*/
VAStatus vaRenderPicture (
VADisplay dpy,
* 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
uint32_t start_mb; /* start mb address with errors */
uint32_t end_mb; /* end mb address with errors */
VADecodeErrorType decode_error_type;
+ uint32_t num_mb; /* number of mbs with errors */
+ /** \brief Reserved bytes for future use, must be zero */
+ uint32_t va_reserved[VA_PADDING_LOW - 1];
} VASurfaceDecodeMBErrors;
/**
* Pre-defined fourcc codes
*/
#define VA_FOURCC_NV12 0x3231564E
+#define VA_FOURCC_NV21 0x3132564E
#define VA_FOURCC_AI44 0x34344149
#define VA_FOURCC_RGBA 0x41424752
#define VA_FOURCC_RGBX 0x58424752
#define VA_FOURCC_RGBP 0x50424752
#define VA_FOURCC_BGRP 0x50524742
#define VA_FOURCC_411R 0x52313134 /* rotated 411P */
+#define VA_FOURCC_RGB565 0x36314752 /* VA_FOURCC('R','G','1','6') */
+#define VA_FOURCC_BGR565 0x36314742 /* VA_FOURCC('B','G','1','6') */
+
+#define VA_FOURCC_Y210 0x30313259
+#define VA_FOURCC_Y216 0x36313259
+#define VA_FOURCC_Y410 0x30313459
+#define VA_FOURCC_Y416 0x36313459
+
/**
* Planar YUV 4:2:2.
* 8-bit Y plane, followed by 8-bit 2x1 subsampled V and U planes
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;
* Only entry_bytes characters of the string are used.
*/
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 */
#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
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 */
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 */
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 */
#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>