[Libva] [PATCH Intel-FEI 1/2] Add left buffers type and some parameters for FEI case

Hu, Kelvin kelvin.hu at intel.com
Sun May 4 23:59:16 PDT 2014


>From e69c8bca40de5ec22733fe8074967415a4c41799 Mon Sep 17 00:00:00 2001
From: Kelvin Hu <kelvin.hu at intel.com>
Date: Mon, 5 May 2014 22:18:20 +0800
Subject: [PATCH 1/2] Add left buffers type and some parameters for FEI case

Add three new optional FEI buffers and MV layout VAMotionVectorIntel,
and updated FEI/statistics frame level control parameters.
---
 va/Makefile.am                        |    2 ++
 va/va.h                               |   34 ++++++++++++++++++++++++
 va/vendor/intel/va_intel_fei.h        |   47 +++++++++++++++++++++++++--------
 va/vendor/intel/va_intel_statistics.h |   42 ++++++++++-------------------
 4 files changed, 86 insertions(+), 39 deletions(-)

diff --git a/va/Makefile.am b/va/Makefile.am
index 13ea35a..09225ea 100644
--- a/va/Makefile.am
+++ b/va/Makefile.am
@@ -58,6 +58,8 @@ libva_source_h = \
        va_tpi.h                \
        va_version.h            \
        va_vpp.h                \
+       vendor/intel/va_intel_fei.h  \
+       vendor/intel/va_intel_statistics.h \
        $(NULL)
 
 libva_source_h_priv = \
diff --git a/va/va.h b/va/va.h
index 794ffb5..1c2eade 100644
--- a/va/va.h
+++ b/va/va.h
@@ -1316,9 +1316,12 @@ typedef enum
     VAEncFEIMVBufferTypeIntel                 = 1001,
     VAEncFEIModeBufferTypeIntel,
     VAEncFEIDistortionBufferTypeIntel,
+    VAEncFEIMBControlBufferTypeIntel,
+    VAEncFEIMVPredictorBufferTypeIntel,
     VAStatsStatisticsParameterBufferTypeIntel,
     VAStatsStatisticsBufferTypeIntel,
     VAStatsMotionVectorBufferTypeIntel,
+    VAStatsMVPredictorBufferTypeIntel,
 
     VABufferTypeMax
 } VABufferType;
@@ -1760,6 +1763,37 @@ typedef struct _VASliceParameterBufferBase
     unsigned int slice_data_flag;      /* see VA_SLICE_DATA_FLAG_XXX definitions */
 } VASliceParameterBufferBase;
 
+/** \brief VAEncFEIMVBufferTypeIntel and VAStatsMotionVectorBufferTypeIntel. Motion vector buffer layout.
+ * Motion vector output is per 4x4 block. For each 4x4 block there is a pair of past and future 
+ * reference MVs as defined in VAMotionVectorIntel. Depending on Subblock partition, 
+ * for the shape that is not 4x4, the MV is replicated so each 4x4 block has a pair of MVs. 
+ * If only past reference is used, future MV should be ignored, and vice versa. 
+ * The 16x16 block is in raster scan order, within the 16x16 block, each 4x4 block MV is ordered as below in memory. 
+ * The buffer size shall be greater than or equal to the number of 16x16 blocks multiplied by (sizeof(VAMotionVector) * 16).
+ *
+ *                      16x16 Block        
+ *        -----------------------------------------
+ *        |    1    |    2    |    5    |    6    |
+ *        -----------------------------------------
+ *        |    3    |    4    |    7    |    8    |
+ *        -----------------------------------------
+ *        |    9    |    10   |    13   |    14   |
+ *        -----------------------------------------
+ *        |    11   |    12   |    15   |    16   |
+ *        -----------------------------------------
+ *
+ **/
+
+/** \brief Motion vector data structure. */
+typedef struct _VAMotionVectorIntel {
+    /** \mv0[0]: horizontal motion vector for past reference */
+    /** \mv0[1]: vertical motion vector for past reference */
+    /** \mv1[0]: horizontal motion vector for future reference */
+    /** \mv1[1]: vertical motion vector for future reference */
+    short  mv0[2];  /* past reference */
+    short  mv1[2];  /* future reference */
+} VAMotionVectorIntel;
+
 #include <va/va_dec_jpeg.h>
 
 /****************************
diff --git a/va/vendor/intel/va_intel_fei.h b/va/vendor/intel/va_intel_fei.h
index a036bea..48e4811 100644
--- a/va/vendor/intel/va_intel_fei.h
+++ b/va/vendor/intel/va_intel_fei.h
@@ -46,21 +46,44 @@ extern "C" {
 
 /** \brief FEI frame level control buffer for H.264 */
 typedef struct _VAEncMiscParameterFEIFrameControlH264Intel {
-    unsigned int function; /* one of the VAConfigAttribEncFunctionType values */   
-    /** \brief MB (16x16) control input surface. It is valid only when (mb_input | mb_size_ctrl) 
+    unsigned int      function; /* one of the VAConfigAttribEncFunctionType values */   
+    /** \brief MB (16x16) control input buffer. It is valid only when (mb_input | mb_size_ctrl) 
      * is set to 1. The data in this buffer correspond to the input source. 16x16 MB is in raster scan order, 
      * each MB control data structure is defined by VAEncFEIMBControlBufferH264. 
      * Buffer size shall not be less than the number of 16x16 blocks multiplied by 
      * sizeof(VAEncFEIMBControlBufferH264Intel). 
      * Note: if mb_qp is set, VAEncQpBufferH264 is expected.
      */
-    VASurfaceID       mb_ctrl;
+    VABufferID        mb_ctrl;
+    /** \brief distortion output of MB ENC or ENC_PAK.
+     * Each 16x16 block has one distortion data with VAEncFEIDistortionBufferH264Intel layout
+     * Buffer size shall not be less than the number of 16x16 blocks multiplied by 
+     * sizeof(VAEncFEIDistortionBufferH264Intel). 
+     */
+    VABufferID        distortion;
+    /** \brief MVs data output of MB ENC.
+     * Each 16x16 block has one MVs data with layout VAMotionVectorIntel 
+     * Buffer size shall not be less than the number of 16x16 blocks multiplied by 
+     * sizeof(VAMotionVectorIntel). 
+     */
+    VABufferID        mv_data;
+    /** \brief MBCode data output of MB ENC.
+     * Each 16x16 block has one MB Code data with layout VAEncFEIModeBufferH264Intel
+     * Buffer size shall not be less than the number of 16x16 blocks multiplied by 
+     * sizeof(VAEncFEIModeBufferH264Intel). 
+     */
+    VABufferID        mb_code_data;
+    /** \brief Qp input buffer. It is valid only when mb_qp is set to 1. 
+     * The data in this buffer correspond to the input source. 
+     * One Qp per 16x16 block in raster scan order, each Qp is a signed char (8-bit) value. 
+     **/
+    VABufferID        qp;
     /** \brief MV predictor. It is valid only when mv_predictor_enable is set to 1. 
      * Each 16x16 block has one or more pair of motion vectors and the corresponding 
      * reference indexes as defined by VAEncMVPredictorBufferH264. 16x16 block is in raster scan order. 
      * Buffer size shall not be less than the number of 16x16 blocks multiplied by 
      * sizeof(VAEncMVPredictorBufferH264). */
-    VASurfaceID       mv_predictor;
+    VABufferID        mv_predictor;
 
     /** \brief number of MV predictors. It must not be greater than maximum supported MV predictor. */
     unsigned int      num_mv_predictors;
@@ -95,18 +118,20 @@ typedef struct _VAEncMiscParameterFEIFrameControlH264Intel {
 
 /** \brief FEI MB level control data structure */
 typedef struct _VAEncFEIMBControlH264Intel {
-    /** \brief when set, correposndent MB is coded as skip */
-    unsigned int force_to_skip       : 1;     
     /** \brief when set, correposndent MB is coded as intra */
     unsigned int force_to_intra      : 1;     
-    unsigned int reserved1           : 30;    
+    /** \brief when set, correposndent MB is coded as skip */
+    unsigned int force_to_skip       : 1;     
+    unsigned int reserved0           : 30;    
+
+    unsigned int reserved1;    
+
+    unsigned int reserved2;    
 
     /** \brief when mb_size_ctrl is set, size here is used to budget accumulatively. Set to 0xFF if don't care. */
-    unsigned int max_size_in_word    : 8;     
+    unsigned int reserved3           : 16;    
     unsigned int target_size_in_word : 8;     
-    unsigned int reserved2           : 16;    
-
-    unsigned int reserved3;    
+    unsigned int max_size_in_word    : 8;     
 } VAEncFEIMBControlH264Intel;
 
 
diff --git a/va/vendor/intel/va_intel_statistics.h b/va/vendor/intel/va_intel_statistics.h
index 8b326e1..8c2f77b 100644
--- a/va/vendor/intel/va_intel_statistics.h
+++ b/va/vendor/intel/va_intel_statistics.h
@@ -56,29 +56,29 @@ typedef struct _VAStatsStatisticsParameter16x16Intel
     VASurfaceID     *future_references;
     unsigned int    num_future_references;
 
-    /** \brief ID of the output surface. 
+    /** \brief ID of the output buffer. 
      * The number of outputs is determined by below DisableMVOutput and DisableStatisticsOutput. 
      * The output layout is defined by VAStatsStatisticsBufferType and VAStatsMotionVectorBufferType. 
      **/
-    VASurfaceID     *outputs;
+    VABufferID      *outputs;
 
     /** \brief MV predictor. It is valid only when mv_predictor_ctrl is not 0. 
      * Each 16x16 block has a pair of MVs, one for past and one for future reference 
      * as defined by VAMotionVector. The 16x16 block is in raster scan order. 
      * Buffer size shall not be less than the number of 16x16 blocks multiplied by sizeof(VAMotionVector). 
      **/
-    VASurfaceID     mv_predictor;
+    VABufferID      mv_predictor;
 
-    /** \brief Qp input surface. It is valid only when mb_qp is set to 1. 
+    /** \brief Qp input buffer. It is valid only when mb_qp is set to 1. 
      * The data in this buffer correspond to the input source. 
      * One Qp per 16x16 block in raster scan order, each Qp is a signed char (8-bit) value. 
      **/
-    VASurfaceID     qp;
+    VABufferID      qp;
 
     unsigned int    frame_qp                    : 8;     
     unsigned int    len_sp                      : 8;     
     unsigned int    max_len_sp                  : 8;     
-    unsigned int    reserved0                   : 8;     
+    unsigned int    reserved0                   : 8;
 
     unsigned int    sub_mb_part_mask            : 7;     
     unsigned int    sub_pel_mode                : 2;     
@@ -105,31 +105,17 @@ typedef struct _VAStatsStatisticsParameter16x16Intel
     unsigned int       disable_mv_output           : 1;    
     /** \brief StatisticsOutput. When set to 1, Statistics output is NOT provided. */
     unsigned int    disable_statistics_output   : 1;    
-    unsigned int    reserved3                   : 30;    
+    /** \brief interlaced.
+     * 0  : progressive
+     * 1  : top field
+     * 2  : bottom field
+     * 3-7: reserved
+     **/
+    unsigned int    interlaced                  : 3;
+    unsigned int    reserved3                   : 27;    
 
 } VAStatsStatisticsParameter16x16Intel;
 
-/** \brief VAStatsMotionVectorBufferTypeIntel. Motion vector buffer layout.
- * Motion vector output is per 4x4 block. For each 4x4 block there is a pair of past and future 
- * reference MVs as defined in VAMotionVector. Depending on Subblock partition, 
- * for the shape that is not 4x4, the MV is replicated so each 4x4 block has a pair of MVs. 
- * If only past reference is used, future MV should be ignored, and vice versa. 
- * The 16x16 block is in raster scan order, within the 16x16 block, each 4x4 block MV is ordered as below in memory. 
- * The buffer size shall be greater than or equal to the number of 16x16 blocks multiplied by (sizeof(VAMotionVector) * 16).
- *
- *                      16x16 Block        
- *        -----------------------------------------
- *        |    1    |    2    |    5    |    6    |
- *        -----------------------------------------
- *        |    3    |    4    |    7    |    8    |
- *        -----------------------------------------
- *        |    9    |    10   |    13   |    14   |
- *        -----------------------------------------
- *        |    11   |    12   |    15   |    16   |
- *        -----------------------------------------
- *
- **/
-
 /** \brief VAStatsStatisticsBufferTypeIntel. Statistics buffer layout.
  * Statistics output is per 16x16 block. Data structure per 16x16 block is defined below. 
  * The 16x16 block is in raster scan order. The buffer size shall be greater than or equal to 
-- 
1.7.9.5


Hi,
We add some left buffers definition and parameters to support FEI(flexible encoder infrastructure) , this patch will enable libva support all FEI features, so suggest above changes to fix.

Thanks,
Kelvin



More information about the Libva mailing list