From: Jonathan Bian Date: Tue, 13 Jun 2017 14:30:12 +0000 (+0800) Subject: add Encoding quantization X-Git-Tag: android-x86-8.1-r1~95 X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fhardware-intel-common-libva.git;a=commitdiff_plain;h=2c78d8b2753f1edf785d570aa125c526b7daf081 add Encoding quantization quary or get whether the driver supports certain types of quantization methods for encoding (e.g. trellis).then set quantization setting by VAEncMiscParameterQuantization Signed-off-by: Carl.Zhang --- diff --git a/va/va.h b/va/va.h index 748e587..d215080 100644 --- a/va/va.h +++ b/va/va.h @@ -536,6 +536,13 @@ typedef enum */ VAConfigAttribEncQualityRange = 21, /** + * \brief Encoding quantization attribute. Read-only. + * + * This attribute conveys whether the driver supports certain types of quantization methods + * for encoding (e.g. trellis). See \c VA_ENC_QUANTIZATION_xxx for the list of quantization methods + */ + VAConfigAttribEncQuantization = 22, + /** * \brief Encoding skip frame attribute. Read-only. * * This attribute conveys whether the driver supports sending skip frame parameters @@ -736,6 +743,13 @@ typedef union _VAConfigAttribValEncJPEG { uint32_t value; } VAConfigAttribValEncJPEG; +/** @name Attribute values for VAConfigAttribEncQuantization */ +/**@{*/ +/** \brief Driver does not support special types of quantization */ +#define VA_ENC_QUANTIZATION_NONE 0x00000000 +/** \brief Driver supports trellis quantization */ +#define VA_ENC_QUANTIZATION_TRELLIS_SUPPORTED 0x00000001 +/**@}*/ /** \brief Attribute value for VAConfigAttribEncROI */ typedef union _VAConfigAttribValEncROI { struct { @@ -1380,6 +1394,8 @@ typedef enum /** \brief Buffer type used for HRD parameters. */ VAEncMiscParameterTypeHRD = 5, VAEncMiscParameterTypeQualityLevel = 6, + /** \brief Buffer type used for quantization parameters, it's per-sequence parameter*/ + VAEncMiscParameterTypeQuantization = 8, /** \brief Buffer type used for sending skip frame parameters to the encoder's * rate control, when the user has externally skipped frames. */ VAEncMiscParameterTypeSkipFrame = 9, @@ -1625,6 +1641,33 @@ typedef struct _VAEncMiscParameterBufferQualityLevel { } 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 diff --git a/va/va_str.c b/va/va_str.c index 48b021a..359fab9 100644 --- a/va/va_str.c +++ b/va/va_str.c @@ -101,6 +101,7 @@ const char *vaConfigAttribTypeStr(VAConfigAttribType configAttribType) TOSTR(VAConfigAttribDecJPEG); TOSTR(VAConfigAttribMaxPictureWidth); TOSTR(VAConfigAttribMaxPictureHeight); + TOSTR(VAConfigAttribEncQuantization); case VAConfigAttribTypeMax: break; } return "";