[Libva] [PATCH 10/12] Adjust the maximum number of motion vectors for B frame on HSW+

Pengfei Qu Pengfei.Qu at intel.com
Tue Jul 19 04:50:59 UTC 2016


From: Jia Meng <jia.meng at intel.com>

Signed-off-by: Jia Meng <jia.meng at intel.com>
Signed-off-by: Pengfei Qu <Pengfei.Qu at intel.com>
---
 src/gen75_vme.c | 13 +++++++------
 src/gen8_vme.c  | 15 ++++++++-------
 src/gen9_vme.c  | 17 +++++++++--------
 3 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/src/gen75_vme.c b/src/gen75_vme.c
index 174a642..81925fe 100644
--- a/src/gen75_vme.c
+++ b/src/gen75_vme.c
@@ -330,7 +330,8 @@ static VAStatus gen75_vme_interface_setup(VADriverContextP ctx,
 
 static VAStatus gen75_vme_constant_setup(VADriverContextP ctx, 
                                          struct encode_state *encode_state,
-                                         struct intel_encoder_context *encoder_context)
+                                         struct intel_encoder_context *encoder_context,
+                                         int denom)
 {
     struct gen6_vme_context *vme_context = encoder_context->vme_context;
     unsigned char *constant_buffer;
@@ -342,13 +343,13 @@ static VAStatus gen75_vme_constant_setup(VADriverContextP ctx,
     if (encoder_context->codec == CODEC_H264 ||
         encoder_context->codec == CODEC_H264_MVC) {
         if (vme_context->h264_level >= 30) {
-            mv_num = 16;
+            mv_num = 16 / denom;
         
             if (vme_context->h264_level >= 31)
-                mv_num = 8;
+                mv_num = 8 / denom;
         } 
     } else if (encoder_context->codec == CODEC_MPEG2) {
-        mv_num = 2;
+        mv_num = 2 / denom;
     }
 
     vme_state_message[31] = mv_num;
@@ -675,7 +676,7 @@ static VAStatus gen75_vme_prepare(VADriverContextP ctx,
     gen75_vme_surface_setup(ctx, encode_state, is_intra, encoder_context);
     gen75_vme_interface_setup(ctx, encode_state, encoder_context);
     //gen75_vme_vme_state_setup(ctx, encode_state, is_intra, encoder_context);
-    gen75_vme_constant_setup(ctx, encode_state, encoder_context);
+    gen75_vme_constant_setup(ctx, encode_state, encoder_context, (pSliceParameter->slice_type == SLICE_TYPE_B) ? 2 : 1);
 
     /*Programing media pipeline*/
     gen75_vme_pipeline_programing(ctx, encode_state, encoder_context);
@@ -987,7 +988,7 @@ gen75_vme_mpeg2_prepare(VADriverContextP ctx,
     gen75_vme_interface_setup(ctx, encode_state, encoder_context);
     gen75_vme_vme_state_setup(ctx, encode_state, slice_param->is_intra_slice, encoder_context);
     intel_vme_mpeg2_state_setup(ctx, encode_state, encoder_context);
-    gen75_vme_constant_setup(ctx, encode_state, encoder_context);
+    gen75_vme_constant_setup(ctx, encode_state, encoder_context, 1);
 
     /*Programing media pipeline*/
     gen75_vme_mpeg2_pipeline_programing(ctx, encode_state, slice_param->is_intra_slice, encoder_context);
diff --git a/src/gen8_vme.c b/src/gen8_vme.c
index 0fcc585..e86fd71 100644
--- a/src/gen8_vme.c
+++ b/src/gen8_vme.c
@@ -363,7 +363,8 @@ static VAStatus gen8_vme_interface_setup(VADriverContextP ctx,
 
 static VAStatus gen8_vme_constant_setup(VADriverContextP ctx, 
                                         struct encode_state *encode_state,
-                                        struct intel_encoder_context *encoder_context)
+                                        struct intel_encoder_context *encoder_context,
+                                        int denom)
 {
     struct gen6_vme_context *vme_context = encoder_context->vme_context;
     unsigned char *constant_buffer;
@@ -375,13 +376,13 @@ static VAStatus gen8_vme_constant_setup(VADriverContextP ctx,
     if (encoder_context->codec == CODEC_H264 ||
         encoder_context->codec == CODEC_H264_MVC) {
         if (vme_context->h264_level >= 30) {
-            mv_num = 16;
+            mv_num = 16 / denom;
         
             if (vme_context->h264_level >= 31)
-                mv_num = 8;
+                mv_num = 8 / denom;
         } 
     } else if (encoder_context->codec == CODEC_MPEG2) {
-        mv_num = 2;
+        mv_num = 2 / denom;
     }
 
     vme_state_message[31] = mv_num;
@@ -749,7 +750,7 @@ static VAStatus gen8_vme_prepare(VADriverContextP ctx,
     gen8_vme_surface_setup(ctx, encode_state, is_intra, encoder_context);
     gen8_vme_interface_setup(ctx, encode_state, encoder_context);
     //gen8_vme_vme_state_setup(ctx, encode_state, is_intra, encoder_context);
-    gen8_vme_constant_setup(ctx, encode_state, encoder_context);
+    gen8_vme_constant_setup(ctx, encode_state, encoder_context, (pSliceParameter->slice_type == SLICE_TYPE_B) ? 2 : 1);
 
     /*Programing media pipeline*/
     gen8_vme_pipeline_programing(ctx, encode_state, encoder_context);
@@ -1139,7 +1140,7 @@ gen8_vme_mpeg2_prepare(VADriverContextP ctx,
     gen8_vme_interface_setup(ctx, encode_state, encoder_context);
     //gen8_vme_vme_state_setup(ctx, encode_state, slice_param->is_intra_slice, encoder_context);
     intel_vme_mpeg2_state_setup(ctx, encode_state, encoder_context);
-    gen8_vme_constant_setup(ctx, encode_state, encoder_context);
+    gen8_vme_constant_setup(ctx, encode_state, encoder_context, 1);
 
     /*Programing media pipeline*/
     gen8_vme_mpeg2_pipeline_programing(ctx, encode_state, slice_param->is_intra_slice, encoder_context);
@@ -1272,7 +1273,7 @@ static VAStatus gen8_vme_vp8_prepare(VADriverContextP ctx,
     /*Setup all the memory object*/
     gen8_vme_vp8_surface_setup(ctx, encode_state, is_intra, encoder_context);
     gen8_vme_interface_setup(ctx, encode_state, encoder_context);
-    gen8_vme_constant_setup(ctx, encode_state, encoder_context);
+    gen8_vme_constant_setup(ctx, encode_state, encoder_context, 1);
 
     /*Programing media pipeline*/
     gen8_vme_vp8_pipeline_programing(ctx, encode_state, is_intra, encoder_context);
diff --git a/src/gen9_vme.c b/src/gen9_vme.c
index a2c65b3..8ff3cda 100644
--- a/src/gen9_vme.c
+++ b/src/gen9_vme.c
@@ -400,7 +400,8 @@ static VAStatus gen9_vme_interface_setup(VADriverContextP ctx,
 
 static VAStatus gen9_vme_constant_setup(VADriverContextP ctx,
                                         struct encode_state *encode_state,
-                                        struct intel_encoder_context *encoder_context)
+                                        struct intel_encoder_context *encoder_context,
+                                        int denom)
 {
     struct gen6_vme_context *vme_context = encoder_context->vme_context;
     unsigned char *constant_buffer;
@@ -412,13 +413,13 @@ static VAStatus gen9_vme_constant_setup(VADriverContextP ctx,
     if (encoder_context->codec == CODEC_H264 ||
         encoder_context->codec == CODEC_H264_MVC) {
         if (vme_context->h264_level >= 30) {
-            mv_num = 16;
+            mv_num = 16 / denom;
 
             if (vme_context->h264_level >= 31)
-                mv_num = 8;
+                mv_num = 8 / denom;
         }
     } else if (encoder_context->codec == CODEC_MPEG2) {
-        mv_num = 2;
+        mv_num = 2 / denom;
     }else if (encoder_context->codec == CODEC_HEVC) {
         if (vme_context->hevc_level >= 30*3) {
             mv_num = 16;
@@ -795,7 +796,7 @@ static VAStatus gen9_vme_prepare(VADriverContextP ctx,
     gen9_vme_surface_setup(ctx, encode_state, is_intra, encoder_context);
     gen9_vme_interface_setup(ctx, encode_state, encoder_context);
     //gen9_vme_vme_state_setup(ctx, encode_state, is_intra, encoder_context);
-    gen9_vme_constant_setup(ctx, encode_state, encoder_context);
+    gen9_vme_constant_setup(ctx, encode_state, encoder_context, (pSliceParameter->slice_type == SLICE_TYPE_B) ? 2 : 1);
 
     /*Programing media pipeline*/
     gen9_vme_pipeline_programing(ctx, encode_state, encoder_context);
@@ -1187,7 +1188,7 @@ gen9_vme_mpeg2_prepare(VADriverContextP ctx,
     gen9_vme_interface_setup(ctx, encode_state, encoder_context);
     //gen9_vme_vme_state_setup(ctx, encode_state, slice_param->is_intra_slice, encoder_context);
     intel_vme_mpeg2_state_setup(ctx, encode_state, encoder_context);
-    gen9_vme_constant_setup(ctx, encode_state, encoder_context);
+    gen9_vme_constant_setup(ctx, encode_state, encoder_context, 1);
 
     /*Programing media pipeline*/
     gen9_vme_mpeg2_pipeline_programing(ctx, encode_state, slice_param->is_intra_slice, encoder_context);
@@ -1322,7 +1323,7 @@ static VAStatus gen9_vme_vp8_prepare(VADriverContextP ctx,
     /*Setup all the memory object*/
     gen9_vme_vp8_surface_setup(ctx, encode_state, is_intra, encoder_context);
     gen9_vme_interface_setup(ctx, encode_state, encoder_context);
-    gen9_vme_constant_setup(ctx, encode_state, encoder_context);
+    gen9_vme_constant_setup(ctx, encode_state, encoder_context, 1);
 
     /*Programing media pipeline*/
     gen9_vme_vp8_pipeline_programing(ctx, encode_state, is_intra, encoder_context);
@@ -1754,7 +1755,7 @@ static VAStatus gen9_vme_hevc_prepare(VADriverContextP ctx,
     gen9_vme_hevc_surface_setup(ctx, encode_state, is_intra, encoder_context);
     gen9_vme_interface_setup(ctx, encode_state, encoder_context);
     //gen9_vme_vme_state_setup(ctx, encode_state, is_intra, encoder_context);
-    gen9_vme_constant_setup(ctx, encode_state, encoder_context);
+    gen9_vme_constant_setup(ctx, encode_state, encoder_context, 1);
 
     /*Programing media pipeline*/
     gen9_vme_hevc_pipeline_programing(ctx, encode_state, encoder_context);
-- 
2.7.4



More information about the Libva mailing list