[Libva] [libva-intel-driver PATH] Add support for quality level for H.264 encoding on SKL

Xiang, Haihao haihao.xiang at intel.com
Thu Dec 11 19:05:15 PST 2014


Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
 src/gen9_vme.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/gen9_vme.c b/src/gen9_vme.c
index 13ac838..b4310f2 100644
--- a/src/gen9_vme.c
+++ b/src/gen9_vme.c
@@ -556,7 +556,7 @@ gen9_vme_fill_vme_batchbuffer(VADriverContextP ctx,
 
             /*inline data */
             *command_ptr++ = (mb_width << 16 | mb_y << 8 | mb_x);
-            *command_ptr++ = ( (1 << 16) | transform_8x8_mode_flag | (mb_intra_ub << 8));
+            *command_ptr++ = ((encoder_context->quality_level << 24) | (1 << 16) | transform_8x8_mode_flag | (mb_intra_ub << 8));
 
             *command_ptr++ = CMD_MEDIA_STATE_FLUSH;
             *command_ptr++ = 0;
@@ -602,13 +602,18 @@ static void gen9_vme_pipeline_programing(VADriverContextP ctx,
     int kernel_shader;
     bool allow_hwscore = true;
     int s;
-
-    for (s = 0; s < encode_state->num_slice_params_ext; s++) {
-        pSliceParameter = (VAEncSliceParameterBufferH264 *)encode_state->slice_params_ext[s]->buffer;
-        if ((pSliceParameter->macroblock_address % width_in_mbs)) {
-            allow_hwscore = false;
-            break;
-	}
+    unsigned int is_low_quality = (encoder_context->quality_level == ENCODER_LOW_QUALITY);
+
+    if (is_low_quality)
+        allow_hwscore = false;
+    else {
+        for (s = 0; s < encode_state->num_slice_params_ext; s++) {
+            pSliceParameter = (VAEncSliceParameterBufferH264 *)encode_state->slice_params_ext[s]->buffer;
+            if ((pSliceParameter->macroblock_address % width_in_mbs)) {
+                allow_hwscore = false;
+                break;
+            }
+        }
     }
 
     if ((pSliceParameter->slice_type == SLICE_TYPE_I) ||
-- 
1.9.1



More information about the Libva mailing list