On 09/06/2016 11:46 PM, Xiang, Haihao wrote:
In addition, change the two caller functions as well.


This looks good to me.

Thanks
   Yakui

Signed-off-by: Xiang, Haihao<haihao.xi...@intel.com>
---
  src/gen6_mfc.c        | 2 +-
  src/gen6_mfc.h        | 4 ++--
  src/gen6_mfc_common.c | 8 +++++---
  src/gen75_mfc.c       | 2 +-
  src/gen8_mfc.c        | 9 +++++----
  5 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/gen6_mfc.c b/src/gen6_mfc.c
index c480430..cf20e3b 100644
--- a/src/gen6_mfc.c
+++ b/src/gen6_mfc.c
@@ -1370,7 +1370,7 @@ gen6_mfc_avc_encode_picture(VADriverContextP ctx,
          gen6_mfc_run(ctx, encode_state, encoder_context);
          if (rate_control_mode == VA_RC_CBR /*|| rate_control_mode == 
VA_RC_VBR*/) {
              gen6_mfc_stop(ctx, encode_state, 
encoder_context,&current_frame_bits_size);
-            sts = intel_mfc_brc_postpack(encode_state, mfc_context, 
current_frame_bits_size);
+            sts = intel_mfc_brc_postpack(encode_state, encoder_context, 
current_frame_bits_size);
              if (sts == BRC_NO_HRD_VIOLATION) {
                  intel_mfc_hrd_context_update(encode_state, mfc_context);
                  break;
diff --git a/src/gen6_mfc.h b/src/gen6_mfc.h
index 04db6c8..a130c83 100644
--- a/src/gen6_mfc.h
+++ b/src/gen6_mfc.h
@@ -350,11 +350,11 @@ Bool gen75_mfc_context_init(VADriverContextP ctx, struct 
intel_encoder_context *


  extern int intel_mfc_update_hrd(struct encode_state *encode_state,
-                                struct gen6_mfc_context *mfc_context,
+                                struct intel_encoder_context *encoder_context,
                                  int frame_bits);

  extern int intel_mfc_brc_postpack(struct encode_state *encode_state,
-                                  struct gen6_mfc_context *mfc_context,
+                                  struct intel_encoder_context 
*encoder_context,
                                    int frame_bits);

  extern void intel_mfc_hrd_context_update(struct encode_state *encode_state,
diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c
index edeaef9..d388d44 100644
--- a/src/gen6_mfc_common.c
+++ b/src/gen6_mfc_common.c
@@ -147,9 +147,10 @@ static void intel_mfc_brc_init(struct encode_state 
*encode_state,
  }

  int intel_mfc_update_hrd(struct encode_state *encode_state,
-                         struct gen6_mfc_context *mfc_context,
+                         struct intel_encoder_context *encoder_context,
                           int frame_bits)
  {
+    struct gen6_mfc_context *mfc_context = encoder_context->mfc_context;
      double prev_bf = mfc_context->hrd.current_buffer_fullness;

      mfc_context->hrd.current_buffer_fullness -= frame_bits;
@@ -172,9 +173,10 @@ int intel_mfc_update_hrd(struct encode_state *encode_state,
  }

  int intel_mfc_brc_postpack(struct encode_state *encode_state,
-                           struct gen6_mfc_context *mfc_context,
+                           struct intel_encoder_context *encoder_context,
                             int frame_bits)
  {
+    struct gen6_mfc_context *mfc_context = encoder_context->mfc_context;
      gen6_brc_status sts = BRC_NO_HRD_VIOLATION;
      VAEncSliceParameterBufferH264 *pSliceParameter = (VAEncSliceParameterBufferH264 
*)encode_state->slice_params_ext[0]->buffer;
      int slicetype = 
intel_avc_enc_slice_type_fixup(pSliceParameter->slice_type);
@@ -229,7 +231,7 @@ int intel_mfc_brc_postpack(struct encode_state 
*encode_state,
      BRC_CLIP(qpn, 1, 51);

      /* checking wthether HRD compliance is still met */
-    sts = intel_mfc_update_hrd(encode_state, mfc_context, frame_bits);
+    sts = intel_mfc_update_hrd(encode_state, encoder_context, frame_bits);

      /* calculating QP delta as some function*/
      x = mfc_context->hrd.target_buffer_fullness - 
mfc_context->hrd.current_buffer_fullness;
diff --git a/src/gen75_mfc.c b/src/gen75_mfc.c
index 1ea0147..c42de38 100644
--- a/src/gen75_mfc.c
+++ b/src/gen75_mfc.c
@@ -1704,7 +1704,7 @@ gen75_mfc_avc_encode_picture(VADriverContextP ctx,
          gen75_mfc_run(ctx, encode_state, encoder_context);
          if (rate_control_mode == VA_RC_CBR /*|| rate_control_mode == 
VA_RC_VBR*/) {
              gen75_mfc_stop(ctx, encode_state, 
encoder_context,&current_frame_bits_size);
-            sts = intel_mfc_brc_postpack(encode_state, mfc_context, 
current_frame_bits_size);
+            sts = intel_mfc_brc_postpack(encode_state, encoder_context, 
current_frame_bits_size);
              if (sts == BRC_NO_HRD_VIOLATION) {
                  intel_mfc_hrd_context_update(encode_state, mfc_context);
                  break;
diff --git a/src/gen8_mfc.c b/src/gen8_mfc.c
index daef41c..9da0730 100644
--- a/src/gen8_mfc.c
+++ b/src/gen8_mfc.c
@@ -1731,7 +1731,7 @@ gen8_mfc_avc_encode_picture(VADriverContextP ctx,
          gen8_mfc_run(ctx, encode_state, encoder_context);
          if (rate_control_mode == VA_RC_CBR /*|| rate_control_mode == 
VA_RC_VBR*/) {
              gen8_mfc_stop(ctx, encode_state, 
encoder_context,&current_frame_bits_size);
-            sts = intel_mfc_brc_postpack(encode_state, mfc_context, 
current_frame_bits_size);
+            sts = intel_mfc_brc_postpack(encode_state, encoder_context, 
current_frame_bits_size);
              if (sts == BRC_NO_HRD_VIOLATION) {
                  intel_mfc_hrd_context_update(encode_state, mfc_context);
                  break;
@@ -3368,9 +3368,10 @@ static void gen8_mfc_vp8_brc_init(struct encode_state 
*encode_state,
  }

  static int gen8_mfc_vp8_brc_postpack(struct encode_state *encode_state,
-                           struct gen6_mfc_context *mfc_context,
+                           struct intel_encoder_context *encoder_context,
                             int frame_bits)
  {
+    struct gen6_mfc_context *mfc_context = encoder_context->mfc_context;
      gen6_brc_status sts = BRC_NO_HRD_VIOLATION;
      VAEncPictureParameterBufferVP8 *pic_param = (VAEncPictureParameterBufferVP8 
*)encode_state->pic_param_ext->buffer;
      int is_key_frame = !pic_param->pic_flags.bits.frame_type;
@@ -3428,7 +3429,7 @@ static int gen8_mfc_vp8_brc_postpack(struct encode_state 
*encode_state,
      BRC_CLIP(qpn, min_qindex, max_qindex);

      /* checking wthether HRD compliance is still met */
-    sts = intel_mfc_update_hrd(encode_state, mfc_context, frame_bits);
+    sts = intel_mfc_update_hrd(encode_state, encoder_context, frame_bits);

      /* calculating QP delta as some function*/
      x = mfc_context->hrd.target_buffer_fullness - 
mfc_context->hrd.current_buffer_fullness;
@@ -4466,7 +4467,7 @@ gen8_mfc_vp8_encode_picture(VADriverContextP ctx,
      current_frame_bits_size = 8 * gen8_mfc_calc_vp8_coded_buffer_size(ctx, 
encode_state, encoder_context);

      if (rate_control_mode == VA_RC_CBR /*|| rate_control_mode == VA_RC_VBR*/) 
{
-        sts = gen8_mfc_vp8_brc_postpack(encode_state, mfc_context, 
current_frame_bits_size);
+        sts = gen8_mfc_vp8_brc_postpack(encode_state, encoder_context, 
current_frame_bits_size);
          if (sts == BRC_NO_HRD_VIOLATION) {
              gen8_mfc_vp8_hrd_context_update(encode_state, mfc_context);
          }

_______________________________________________
Libva mailing list
Libva@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libva

Reply via email to