Discussion:
[PATCH 0/4] Update some parameter setting and constant for VDEnc
(too old to reply)
Xiang, Haihao
2016-12-23 16:01:49 UTC
Permalink
This patch series adjusts some parameter setting and constant for VDEnc

Xiang, Haihao (4):
VDEnc: always enable bitrate control per mb
VDEnc: update the MFX_AVC_IMG_STATE command
VDEnc: update the value of inter rounding for CQP mode
VDEnc: update the constant buffer

src/gen9_vdenc.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
--
1.9.1
Xiang, Haihao
2016-12-23 16:01:51 UTC
Permalink
Don't enable brc domain rate control if HuC is not used.

Signed-off-by: Xiang, Haihao <***@intel.com>
---
src/gen9_vdenc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gen9_vdenc.c b/src/gen9_vdenc.c
index faad8fc..de6f510 100644
--- a/src/gen9_vdenc.c
+++ b/src/gen9_vdenc.c
@@ -1860,7 +1860,8 @@ static void
gen9_vdenc_init_mfx_avc_img_state(VADriverContextP ctx,
struct encode_state *encode_state,
struct intel_encoder_context *encoder_context,
- struct gen9_mfx_avc_img_state *pstate)
+ struct gen9_mfx_avc_img_state *pstate,
+ int use_huc)
{
struct gen9_vdenc_context *vdenc_context = encoder_context->mfc_context;
VAEncSequenceParameterBufferH264 *seq_param = (VAEncSequenceParameterBufferH264 *)encode_state->seq_param_ext->buffer;
@@ -1878,7 +1879,7 @@ gen9_vdenc_init_mfx_avc_img_state(VADriverContextP ctx,
pstate->dw3.image_structure = 0;
pstate->dw3.weighted_bipred_idc = pic_param->pic_fields.bits.weighted_bipred_idc;
pstate->dw3.weighted_pred_flag = pic_param->pic_fields.bits.weighted_pred_flag;
- pstate->dw3.brc_domain_rate_control_enable = 1;
+ pstate->dw3.brc_domain_rate_control_enable = !!use_huc;
pstate->dw3.chroma_qp_offset = pic_param->chroma_qp_index_offset;
pstate->dw3.second_chroma_qp_offset = pic_param->second_chroma_qp_index_offset;

@@ -2135,7 +2136,7 @@ gen9_vdenc_init_img_states(VADriverContextP ctx,
return;

mfx_img_cmd = (struct gen9_mfx_avc_img_state *)pbuffer;
- gen9_vdenc_init_mfx_avc_img_state(ctx, encode_state, encoder_context, mfx_img_cmd);
+ gen9_vdenc_init_mfx_avc_img_state(ctx, encode_state, encoder_context, mfx_img_cmd, 1);
pbuffer += sizeof(*mfx_img_cmd);

vdenc_img_cmd = (struct gen9_vdenc_img_state *)pbuffer;
@@ -2542,7 +2543,7 @@ gen9_vdenc_mfx_avc_img_state(VADriverContextP ctx,
struct intel_batchbuffer *batch = encoder_context->base.batch;
struct gen9_mfx_avc_img_state mfx_img_cmd;

- gen9_vdenc_init_mfx_avc_img_state(ctx, encode_state, encoder_context, &mfx_img_cmd);
+ gen9_vdenc_init_mfx_avc_img_state(ctx, encode_state, encoder_context, &mfx_img_cmd, 0);

BEGIN_BCS_BATCH(batch, (sizeof(mfx_img_cmd) >> 2));
intel_batchbuffer_data(batch, &mfx_img_cmd, sizeof(mfx_img_cmd));
--
1.9.1
Xiang, Haihao
2016-12-23 16:01:50 UTC
Permalink
Signed-off-by: Xiang, Haihao <***@intel.com>
---
src/gen9_vdenc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/gen9_vdenc.c b/src/gen9_vdenc.c
index 691faec..faad8fc 100644
--- a/src/gen9_vdenc.c
+++ b/src/gen9_vdenc.c
@@ -870,6 +870,7 @@ gen9_vdenc_update_misc_parameters(VADriverContextP ctx,
}
}

+ vdenc_context->mb_brc_enabled = 1;
vdenc_context->num_roi = MIN(encoder_context->brc.num_roi, 3);
vdenc_context->max_delta_qp = encoder_context->brc.roi_max_delta_qp;
vdenc_context->min_delta_qp = encoder_context->brc.roi_min_delta_qp;
--
1.9.1
Xiang, Haihao
2016-12-23 16:01:53 UTC
Permalink
Signed-off-by: Xiang, Haihao <***@intel.com>
---
src/gen9_vdenc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gen9_vdenc.c b/src/gen9_vdenc.c
index a1a86d1..6402d41 100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 0x4d, 0x4d,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1f, 0x2a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d
},
},
};
--
1.9.1
Xiang, Haihao
2016-12-23 16:01:52 UTC
Permalink
Signed-off-by: Xiang, Haihao <***@intel.com>
---
src/gen9_vdenc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gen9_vdenc.c b/src/gen9_vdenc.c
index de6f510..a1a86d1 100644
--- a/src/gen9_vdenc.c
+++ b/src/gen9_vdenc.c
@@ -3012,6 +3012,10 @@ gen9_vdenc_mfx_avc_slice_state(VADriverContextP ctx,
int num_ref_l0 = 0, num_ref_l1 = 0;
int slice_type = intel_avc_enc_slice_type_fixup(slice_param->slice_type);
int slice_qp = pic_param->pic_init_qp + slice_param->slice_qp_delta; // TODO: fix for CBR&VBR */
+ int inter_rounding = 0;
+
+ if (vdenc_context->internal_rate_mode != I965_BRC_CQP)
+ inter_rounding = 3;

slice_hor_pos = slice_param->macroblock_address % vdenc_context->frame_width_in_mbs;
slice_ver_pos = slice_param->macroblock_address / vdenc_context->frame_height_in_mbs;
@@ -3110,7 +3114,7 @@ gen9_vdenc_mfx_avc_slice_state(VADriverContextP ctx,
(grow << 0));
OUT_BCS_BATCH(batch,
(1 << 31) |
- (3 << 28) |
+ (inter_rounding << 28) |
(1 << 27) |
(5 << 24) |
(correct[5] << 20) |
--
1.9.1
Kelley, Sean V
2016-12-27 17:21:41 UTC
Permalink
On 12/23/16, 8:01 AM, "Libva on behalf of Xiang, Haihao" <libva-***@lists.freedesktop.org on behalf of ***@intel.com> wrote:

This patch series adjusts some parameter setting and constant for VDEnc

Xiang, Haihao (4):
VDEnc: always enable bitrate control per mb
VDEnc: update the MFX_AVC_IMG_STATE command
VDEnc: update the value of inter rounding for CQP mode
VDEnc: update the constant buffer


Lgtm,

Sean

src/gen9_vdenc.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)

--
1.9.1

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

Loading...