summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Bian <jonathan.bian@intel.com>2017-06-13 22:30:12 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2017-11-21 23:27:31 -0800
commit2c78d8b2753f1edf785d570aa125c526b7daf081 (patch)
treeafcbbeda32976eab0e6c825eb158c98164026ee0
parent03b410ca392972c6f349b55321ba2b094ea80f16 (diff)
downloadlibva-2c78d8b2753f1edf785d570aa125c526b7daf081.tar.gz
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 <carl.zhang@intel.com>
-rw-r--r--va/va.h43
-rw-r--r--va/va_str.c1
2 files changed, 44 insertions, 0 deletions
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 "<unknown config attribute type>";