[Libva] [PATCH Libva-intel-driver V2 6/6] H264_encoding: Don't update the slice qp for CBR mode when finding packed slice_header data

Zhao, Yakui yakui.zhao at intel.com
Wed May 21 17:51:32 PDT 2014


From: "Zhao, Yakui" <yakui.zhao at intel.com>

Otherwise the slice qp is inconsistent and the encoding is incorrect.

Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
 src/gen6_mfc.c  | 6 ++++--
 src/gen75_mfc.c | 6 ++++--
 src/gen8_mfc.c  | 6 ++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/gen6_mfc.c b/src/gen6_mfc.c
index f1b29b9..0a10054 100644
--- a/src/gen6_mfc.c
+++ b/src/gen6_mfc.c
@@ -794,7 +794,8 @@ gen6_mfc_avc_pipeline_slice_programing(VADriverContextP ctx,
 
     if (rate_control_mode == VA_RC_CBR) {
         qp = mfc_context->bit_rate_control_context[slice_type].QpPrimeY;
-        pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
+        if (encode_state->slice_header_index[slice_index] == 0)
+            pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
     }
 
     /* only support for 8-bit pixel bit-depth */
@@ -1173,7 +1174,8 @@ gen6_mfc_avc_batchbuffer_slice(VADriverContextP ctx,
 
     if (rate_control_mode == VA_RC_CBR) {
         qp = mfc_context->bit_rate_control_context[slice_type].QpPrimeY;
-        pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
+        if (encode_state->slice_header_index[slice_index] == 0)
+            pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
     }
 
     /* only support for 8-bit pixel bit-depth */
diff --git a/src/gen75_mfc.c b/src/gen75_mfc.c
index 4c54e08..8f15aae 100644
--- a/src/gen75_mfc.c
+++ b/src/gen75_mfc.c
@@ -1172,7 +1172,8 @@ gen75_mfc_avc_pipeline_slice_programing(VADriverContextP ctx,
 
     if (rate_control_mode == VA_RC_CBR) {
         qp = mfc_context->bit_rate_control_context[slice_type].QpPrimeY;
-        pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
+        if (encode_state->slice_header_index[slice_index] == 0)
+            pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
     }
 
     /* only support for 8-bit pixel bit-depth */
@@ -1512,7 +1513,8 @@ gen75_mfc_avc_batchbuffer_slice(VADriverContextP ctx,
 
     if (rate_control_mode == VA_RC_CBR) {
         qp = mfc_context->bit_rate_control_context[slice_type].QpPrimeY;
-        pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
+        if (encode_state->slice_header_index[slice_index] == 0)
+            pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
     }
 
     /* only support for 8-bit pixel bit-depth */
diff --git a/src/gen8_mfc.c b/src/gen8_mfc.c
index b0f3a5c..265b2db 100644
--- a/src/gen8_mfc.c
+++ b/src/gen8_mfc.c
@@ -1036,7 +1036,8 @@ gen8_mfc_avc_pipeline_slice_programing(VADriverContextP ctx,
 
     if (rate_control_mode == VA_RC_CBR) {
         qp = mfc_context->bit_rate_control_context[slice_type].QpPrimeY;
-        pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
+        if (encode_state->slice_header_index[slice_index] == 0)
+            pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
     }
 
     /* only support for 8-bit pixel bit-depth */
@@ -1407,7 +1408,8 @@ gen8_mfc_avc_batchbuffer_slice(VADriverContextP ctx,
 
     if (rate_control_mode == VA_RC_CBR) {
         qp = mfc_context->bit_rate_control_context[slice_type].QpPrimeY;
-        pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
+        if (encode_state->slice_header_index[slice_index] == 0)
+            pSliceParameter->slice_qp_delta = qp - pPicParameter->pic_init_qp;
     }
 
     /* only support for 8-bit pixel bit-depth */
-- 
1.7.12-rc1



More information about the Libva mailing list