[Libva] [PATCH Libva-intel-driver 05/18] H264_Encoding: Pass the Qp parameter into VME shader
Zhao, Yakui
yakui.zhao at intel.com
Mon Jan 12 05:01:28 PST 2015
From: Zhao Yakui <yakui.zhao at intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
src/gen6_mfc_common.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c
index a44d328..625f7a0 100644
--- a/src/gen6_mfc_common.c
+++ b/src/gen6_mfc_common.c
@@ -1003,6 +1003,16 @@ gen7_vme_walker_fill_vme_batchbuffer(VADriverContextP ctx,
int mb_row;
int s;
unsigned int *command_ptr;
+ struct gen6_mfc_context *mfc_context = encoder_context->mfc_context;
+ VAEncPictureParameterBufferH264 *pic_param = (VAEncPictureParameterBufferH264 *)encode_state->pic_param_ext->buffer;
+ VAEncSliceParameterBufferH264 *slice_param = (VAEncSliceParameterBufferH264 *)encode_state->slice_params_ext[0]->buffer;
+ int qp;
+ int slice_type = intel_avc_enc_slice_type_fixup(slice_param->slice_type);
+
+ if (encoder_context->rate_control_mode == VA_RC_CQP)
+ qp = pic_param->pic_init_qp + slice_param->slice_qp_delta;
+ else
+ qp = mfc_context->bit_rate_control_context[slice_type].QpPrimeY;
#define USE_SCOREBOARD (1 << 21)
@@ -1042,7 +1052,7 @@ gen7_vme_walker_fill_vme_batchbuffer(VADriverContextP ctx,
}
}
- *command_ptr++ = (CMD_MEDIA_OBJECT | (8 - 2));
+ *command_ptr++ = (CMD_MEDIA_OBJECT | (9 - 2));
*command_ptr++ = kernel;
*command_ptr++ = USE_SCOREBOARD;
/* Indirect data */
@@ -1053,6 +1063,8 @@ gen7_vme_walker_fill_vme_batchbuffer(VADriverContextP ctx,
/*inline data */
*command_ptr++ = (mb_width << 16 | y_inner << 8 | x_inner);
*command_ptr++ = ((1 << 18) | (1 << 16) | transform_8x8_mode_flag | (mb_intra_ub << 8));
+ /* qp occupies one byte */
+ *command_ptr++ = qp;
x_inner -= 2;
y_inner += 1;
}
@@ -1086,7 +1098,7 @@ gen7_vme_walker_fill_vme_batchbuffer(VADriverContextP ctx,
}
}
- *command_ptr++ = (CMD_MEDIA_OBJECT | (8 - 2));
+ *command_ptr++ = (CMD_MEDIA_OBJECT | (9 - 2));
*command_ptr++ = kernel;
*command_ptr++ = USE_SCOREBOARD;
/* Indirect data */
@@ -1097,6 +1109,8 @@ gen7_vme_walker_fill_vme_batchbuffer(VADriverContextP ctx,
/*inline data */
*command_ptr++ = (mb_width << 16 | y_inner << 8 | x_inner);
*command_ptr++ = ((1 << 18) | (1 << 16) | transform_8x8_mode_flag | (mb_intra_ub << 8));
+ /* qp occupies one byte */
+ *command_ptr++ = qp;
x_inner -= 2;
y_inner += 1;
--
1.7.10.1
More information about the Libva
mailing list