X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=va%2Fva.h;h=a1ab4a821fd672a60befa54de5b896347a09447e;hb=acbc209b9bed133e2feadb74a07d34f8c933dcc0;hp=cd0032b898fbb5fc33cad3cd5259d2f782b2b780;hpb=05f296c6b8177601d816b45cd6256865b7ba8f57;p=android-x86%2Fhardware-intel-common-libva.git diff --git a/va/va.h b/va/va.h index cd0032b..a1ab4a8 100644 --- a/va/va.h +++ b/va/va.h @@ -222,6 +222,29 @@ typedef int VAStatus; /** Return status type from functions */ */ const char *vaErrorStr(VAStatus error_status); +typedef struct _VARectangle +{ + short x; + short y; + unsigned short width; + unsigned short height; +} VARectangle; + +/** Type of a message callback, used for both error and info log. */ +typedef void (*vaMessageCallback)(const char *message); + +/** + * Set the callback for error messages, or NULL for no logging. + * Returns the previous one, or NULL if it was disabled. + */ +vaMessageCallback vaSetErrorCallback(vaMessageCallback); + +/** + * Set the callback for info messages, or NULL for no logging. + * Returns the previous one, or NULL if it was disabled. + */ +vaMessageCallback vaSetInfoCallback(vaMessageCallback); + /** * Initialization: * A display must be obtained by calling vaGetDisplay() before calling @@ -268,7 +291,7 @@ const char *vaQueryVendorString ( VADisplay dpy ); -typedef int (*VAPrivFunc)(); +typedef int (*VAPrivFunc)(void); /** * Return a function pointer given a function name in the library. @@ -303,7 +326,10 @@ typedef enum VAProfileH264StereoHigh = 16, VAProfileHEVCMain = 17, VAProfileHEVCMain10 = 18, - VAProfileVP9Profile0 = 19 + VAProfileVP9Profile0 = 19, + VAProfileVP9Profile1 = 20, + VAProfileVP9Profile2 = 21, + VAProfileVP9Profile3 = 22 } VAProfile; /** @@ -318,6 +344,15 @@ 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. */ } VAEntrypoint; @@ -440,6 +475,26 @@ 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, + /**@}*/ VAConfigAttribTypeMax } VAConfigAttribType; @@ -461,6 +516,9 @@ typedef struct _VAConfigAttrib { #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 */ @@ -481,6 +539,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 */ @@ -550,6 +612,81 @@ typedef union _VAConfigAttribValEncJPEG { unsigned int value; } VAConfigAttribValEncJPEG; +/** \brief Attribute value for VAConfigAttribEncROI */ +typedef union _VAConfigAttribValEncROI { + struct { + /** \brief The number of ROI regions supported, 0 if ROI is not supported. */ + unsigned int num_roi_regions : 8; + /** + * \brief A flag indicates whether ROI priority is supported + * + * \ref roi_rc_priority_support equal to 1 specifies the underlying driver supports + * ROI priority when VAConfigAttribRateControl != VA_RC_CQP, user can use \c roi_value + * in #VAEncROI to set ROI priority. \ref roi_rc_priority_support equal to 0 specifies + * the underlying driver doesn't support ROI priority. + * + * User should ignore \ref roi_rc_priority_support when VAConfigAttribRateControl == VA_RC_CQP + * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP. + */ + unsigned int roi_rc_priority_support : 1; + /** + * \brief A flag indicates whether ROI delta QP is supported + * + * \ref roi_rc_qp_delat_support equal to 1 specifies the underlying driver supports + * ROI delta QP when VAConfigAttribRateControl != VA_RC_CQP, user can use \c roi_value + * in #VAEncROI to set ROI delta QP. \ref roi_rc_qp_delat_support equal to 0 specifies + * the underlying driver doesn't support ROI delta QP. + * + * User should ignore \ref roi_rc_qp_delat_support when VAConfigAttribRateControl == VA_RC_CQP + * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP. + */ + unsigned int roi_rc_qp_delat_support : 1; + unsigned int reserved : 22; + } bits; + unsigned int value; +} VAConfigAttribValEncROI; + +/** \brief Attribute value for VAConfigAttribEncRateControlExt */ +typedef union _VAConfigAttribValEncRateControlExt { + struct { + /** + * \brief The maximum number of temporal layers minus 1 + * + * \ref max_num_temporal_layers_minus1 plus 1 specifies the maximum number of temporal + * layers that supported by the underlying driver. \ref max_num_temporal_layers_minus1 + * equal to 0 implies the underlying driver doesn't support encoding with temporal layer. + */ + unsigned int max_num_temporal_layers_minus1 : 8; + + /** + * /brief support temporal layer bit-rate control flag + * + * \ref temporal_layer_bitrate_control_flag equal to 1 specifies the underlying driver + * can support bit-rate control per temporal layer when (#VAConfigAttribRateControl == #VA_RC_CBR || + * #VAConfigAttribRateControl == #VA_RC_VBR). + * + * The underlying driver must set \ref temporal_layer_bitrate_control_flag to 0 when + * \c max_num_temporal_layers_minus1 is equal to 0 + * + * To use bit-rate control per temporal layer, an application must send the right layer + * structure via #VAEncMiscParameterTemporalLayerStructure at the beginning of a coded sequence + * and then followed by #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate structures + * for each layer, using the \c temporal_id field as the layer identifier. Otherwise + * the driver doesn't use bitrate control per temporal layer if an application doesn't send the + * layer structure via #VAEncMiscParameterTemporalLayerStructure to the driver. The driver returns + * VA_STATUS_ERROR_INVALID_PARAMETER if an application sends a wrong layer structure or doesn't send + * #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate for each layer. + * + * The driver will ignore #VAEncMiscParameterTemporalLayerStructure and the \c temporal_id field + * in #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate if + * \ref temporal_layer_bitrate_control_flag is equal to 0 or #VAConfigAttribRateControl == #VA_RC_CQP + */ + unsigned int temporal_layer_bitrate_control_flag : 1; + unsigned int reserved : 23; + } bits; + unsigned int value; +} VAConfigAttribValEncRateControlExt; + /** * if an attribute is not applicable for a given * profile/entrypoint pair, then set the value to the following @@ -1023,7 +1160,11 @@ typedef enum VAEncMiscParameterTypeQualityLevel = 6, /** \brief Buffer type used for sending skip frame parameters to the encoder's * rate control, when the user has externally skipped frames. */ - VAEncMiscParameterTypeSkipFrame = 9 + VAEncMiscParameterTypeSkipFrame = 9, + /** \brief Buffer type used for region-of-interest (ROI) parameters. */ + VAEncMiscParameterTypeROI = 10, + /** \brief Buffer type used for temporal layer structure */ + VAEncMiscParameterTypeTemporalLayerStructure = 12, } VAEncMiscParameterType; /** \brief Packed header type. */ @@ -1080,6 +1221,22 @@ typedef struct _VAEncMiscParameterBuffer unsigned int data[0]; } VAEncMiscParameterBuffer; +/** \brief Temporal layer Structure*/ +typedef struct _VAEncMiscParameterTemporalLayerStructure +{ + /** \brief The number of temporal layers */ + unsigned int number_of_layers; + /** \brief The length of the array defining frame layer membership. Should be 1-32 */ + unsigned int periodicity; + /** + * \brief The array indicating the layer id for each frame + * + * The layer id for the first frame in a coded sequence is always 0, so layer_id[] specifies the layer + * ids for frames starting from the 2nd frame. + */ + unsigned int layer_id[32]; +} VAEncMiscParameterTemporalLayerStructure; + /** \brief Rate control parameters */ typedef struct _VAEncMiscParameterRateControl @@ -1106,6 +1263,12 @@ typedef struct _VAEncMiscParameterRateControl unsigned int reset : 1; unsigned int disable_frame_skip : 1; /* Disable frame skip in rate control mode */ unsigned int disable_bit_stuffing : 1; /* Disable bit stuffing in rate control mode */ + unsigned int mb_rate_control : 4; /* Control VA_RC_MB 0: default, 1: enable, 2: disable, other: reserved*/ + /* + * The temporal layer that the rate control parameters are specified for. + */ + unsigned int temporal_id : 8; + unsigned int reserved : 17; } bits; unsigned int value; } rc_flags; @@ -1113,7 +1276,37 @@ typedef struct _VAEncMiscParameterRateControl typedef struct _VAEncMiscParameterFrameRate { + /* + * The framerate is specified as a number of frames per second, as a + * fraction. The denominator of the fraction is given in the top half + * (the high two bytes) of the framerate field, and the numerator is + * given in the bottom half (the low two bytes). + * + * That is: + * denominator = framerate >> 16 & 0xffff; + * numerator = framerate & 0xffff; + * fps = numerator / denominator; + * + * For example, if framerate is set to (100 << 16 | 750), this is + * 750 / 100, hence 7.5fps. + * + * If the denominator is zero (the high two bytes are both zero) then + * it takes the value one instead, so the framerate is just the integer + * in the low 2 bytes. + */ unsigned int framerate; + union + { + struct + { + /* + * The temporal id the framerate parameters are specified for. + */ + unsigned int temporal_id : 8; + unsigned int reserved : 24; + } bits; + unsigned int value; + } framerate_flags; } VAEncMiscParameterFrameRate; /** @@ -1197,7 +1390,77 @@ typedef struct _VAEncMiscParameterSkipFrame { unsigned int size_skip_frames; } VAEncMiscParameterSkipFrame; -/* +/** + * \brief Encoding region-of-interest (ROI). + * + * The encoding ROI can be set through VAEncMiscParameterBufferROI, if the implementation + * supports ROI input. The ROI set through this structure is applicable only to the + * current frame or field, so must be sent every frame or field to be applied. The number of + * supported ROIs can be queried through the VAConfigAttribEncROI. The encoder will use the + * ROI information to adjust the QP values of the MB's that fall within the ROIs. + */ +typedef struct _VAEncROI +{ + /** \brief Defines the ROI boundary in pixels, the driver will map it to appropriate + * codec coding units. It is relative to frame coordinates for the frame case and + * to field coordinates for the field case. */ + VARectangle roi_rectangle; + /** + * \brief ROI value + * + * \ref roi_value specifies ROI delta QP or ROI priority. + * -- ROI delta QP is the value that will be added on top of the frame level QP. + * -- ROI priority specifies the priority of a region, it can be positive (more important) + * or negative (less important) values and is compared with non-ROI region (taken as value 0), + * E.g. ROI region with \ref roi_value -3 is less important than the non-ROI region (\ref roi_value + * implied to be 0) which is less important than ROI region with roi_value +2. For overlapping + * regions, the roi_value that is first in the ROI array will have priority. + * + * \ref roi_value always specifes ROI delta QP when VAConfigAttribRateControl == VA_RC_CQP, no matter + * the value of \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI. + * + * \ref roi_value depends on \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI when + * VAConfigAttribRateControl != VA_RC_CQP. \ref roi_value specifies ROI_delta QP if \c roi_value_is_qp_delta + * in VAEncMiscParameterBufferROI is 1, otherwise \ref roi_value specifies ROI priority. + */ + char roi_value; +} VAEncROI; + +typedef struct _VAEncMiscParameterBufferROI { + /** \brief Number of ROIs being sent.*/ + unsigned int num_roi; + + /** \brief Valid when VAConfigAttribRateControl != VA_RC_CQP, then the encoder's + * rate control will determine actual delta QPs. Specifies the max/min allowed delta + * QPs. */ + char max_delta_qp; + char min_delta_qp; + + /** \brief Pointer to a VAEncROI array with num_roi elements. It is relative to frame + * coordinates for the frame case and to field coordinates for the field case.*/ + VAEncROI *roi; + union { + struct { + /** + * \brief An indication for roi value. + * + * \ref roi_value_is_qp_delta equal to 1 indicates \c roi_value in #VAEncROI should + * be used as ROI delta QP. \ref roi_value_is_qp_delta equal to 0 indicates \c roi_value + * in #VAEncROI should be used as ROI priority. + * + * \ref roi_value_is_qp_delta is only available when VAConfigAttribRateControl != VA_RC_CQP, + * the setting must comply with \c roi_rc_priority_support and \c roi_rc_qp_delat_support in + * #VAConfigAttribValEncROI. The underlying driver should ignore this field + * when VAConfigAttribRateControl == VA_RC_CQP. + */ + uint32_t roi_value_is_qp_delta : 1; + uint32_t reserved : 31; + } bits; + uint32_t value; + } roi_flags; +} VAEncMiscParameterBufferROI; + +/** * There will be cases where the bitstream buffer will not have enough room to hold * the data for the entire slice, and the following flags will be used in the slice * parameter to signal to the server for the possible cases. @@ -2286,6 +2549,16 @@ VAStatus vaQuerySurfaceError( * 8-bit Y plane, followed by 8-bit 2x1 subsampled V and U planes */ #define VA_FOURCC_YV16 0x36315659 +/** + * 10-bit and 16-bit Planar YUV 4:2:0. + */ +#define VA_FOURCC_P010 0x30313050 +#define VA_FOURCC_P016 0x36313050 + +/** + * 10-bit Planar YUV 420 and occupy the lower 10-bit. + */ +#define VA_FOURCC_I010 0x30313049 /* byte order */ #define VA_LSB_FIRST 1 @@ -2598,14 +2871,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, @@ -2850,6 +3115,7 @@ typedef struct _VAPictureHEVC #include #include #include +#include #include /**@}*/