OSDN Git Service

add Encoding quantization
authorJonathan Bian <jonathan.bian@intel.com>
Tue, 13 Jun 2017 14:30:12 +0000 (22:30 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Wed, 22 Nov 2017 07:27:31 +0000 (23:27 -0800)
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>
va/va.h
va/va_str.c

diff --git a/va/va.h b/va/va.h
index 748e587..d215080 100644 (file)
--- a/va/va.h
+++ b/va/va.h
@@ -536,6 +536,13 @@ typedef enum
      */
     VAConfigAttribEncQualityRange     = 21,
     /**
      */
     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 
      * \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;
 
     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 {
 /** \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 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,
     /** \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;
 
 /**
 } 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 Encoding skip frame.
  *
  * The application may choose to skip frames externally to the encoder (e.g. drop completely or 
index 48b021a..359fab9 100644 (file)
@@ -101,6 +101,7 @@ const char *vaConfigAttribTypeStr(VAConfigAttribType configAttribType)
     TOSTR(VAConfigAttribDecJPEG);
     TOSTR(VAConfigAttribMaxPictureWidth);
     TOSTR(VAConfigAttribMaxPictureHeight);
     TOSTR(VAConfigAttribDecJPEG);
     TOSTR(VAConfigAttribMaxPictureWidth);
     TOSTR(VAConfigAttribMaxPictureHeight);
+    TOSTR(VAConfigAttribEncQuantization);
     case VAConfigAttribTypeMax: break;
     }
     return "<unknown config attribute type>";
     case VAConfigAttribTypeMax: break;
     }
     return "<unknown config attribute type>";