[Libva] [PATCH 1/3] HEVC: Fix the Wrong slice type usage
Zhao, Yakui
yakui.zhao at intel.com
Mon May 25 17:26:19 PDT 2015
On Thu, 2015-05-21 at 19:46 -0600, sreerenj.balachandran at intel.com
wrote:
> From: Sreerenj Balachandran <sreerenj.balachandran at intel.com>
>
> Don't mix the slice_type values of h264 and h265.
Good catch. Based on H264/HEVC spec it uses the different slice type.
This patch looks good to me.
>
> The SLICE_TYPE values of H264 and HEVC are different.
> H264: Bslice_type = 1, Pslice_type = 0
> HEVC: Bslice_type = 0, Pslice_type = 1
> ---
> src/gen6_mfc_common.c | 4 ++--
> src/gen9_vme.c | 12 ++++++------
> src/i965_encoder_utils.c | 16 ++++++++--------
> 3 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c
> index 6ae29f3..2babb99 100644
> --- a/src/gen6_mfc_common.c
> +++ b/src/gen6_mfc_common.c
> @@ -1811,7 +1811,7 @@ void intel_vme_hevc_update_mbmv_cost(VADriverContextP ctx,
>
> assert(qp <= QP_MAX);
> lambda = intel_lambda_qp(qp);
> - if (slice_type == SLICE_TYPE_I) {
> + if (slice_type == HEVC_SLICE_I) {
> vme_state_message[MODE_INTRA_16X16] = 0;
> m_cost = lambda * 4;
> vme_state_message[MODE_INTRA_8X8] = intel_format_lutvalue(m_cost, 0x8f);
> @@ -1857,7 +1857,7 @@ void intel_vme_hevc_update_mbmv_cost(VADriverContextP ctx,
> m_costf = lambda * 3.5;
> m_cost = m_costf;
> vme_state_message[MODE_INTRA_NONPRED] = intel_format_lutvalue(m_cost, 0x6f);
> - if (slice_type == SLICE_TYPE_P) {
> + if (slice_type == HEVC_SLICE_P) {
> m_costf = lambda * 2.5;
> m_cost = m_costf;
> vme_state_message[MODE_INTER_16X16] = intel_format_lutvalue(m_cost, 0x8f);
> diff --git a/src/gen9_vme.c b/src/gen9_vme.c
> index 39ac180..b28470b 100644
> --- a/src/gen9_vme.c
> +++ b/src/gen9_vme.c
> @@ -1334,7 +1334,7 @@ gen9_vme_hevc_output_buffer_setup(VADriverContextP ctx,
> struct gen6_vme_context *vme_context = encoder_context->vme_context;
> VAEncSequenceParameterBufferHEVC *pSequenceParameter = (VAEncSequenceParameterBufferHEVC *)encode_state->seq_param_ext->buffer;
> VAEncSliceParameterBufferHEVC *pSliceParameter = (VAEncSliceParameterBufferHEVC *)encode_state->slice_params_ext[0]->buffer;
> - int is_intra = pSliceParameter->slice_type == SLICE_TYPE_I;
> + int is_intra = pSliceParameter->slice_type == HEVC_SLICE_I;
> int width_in_mbs = (pSequenceParameter->pic_width_in_luma_samples + 15)/16;
> int height_in_mbs = (pSequenceParameter->pic_height_in_luma_samples + 15)/16;
>
> @@ -1405,12 +1405,12 @@ gen9_vme_hevc_surface_setup(VADriverContextP ctx,
> int slice_type;
>
> slice_type = slice_param->slice_type;
> - assert(slice_type != SLICE_TYPE_I && slice_type != SLICE_TYPE_SI);
> + assert(slice_type != HEVC_SLICE_I);
>
> /* to do HEVC */
> intel_hevc_vme_reference_state(ctx, encode_state, encoder_context, 0, 1, gen9_vme_source_surface_state);
>
> - if (slice_type == SLICE_TYPE_B)
> + if (slice_type == HEVC_SLICE_B)
> intel_hevc_vme_reference_state(ctx, encode_state, encoder_context, 1, 2, gen9_vme_source_surface_state);
> }
>
> @@ -1669,9 +1669,9 @@ static void gen9_vme_hevc_pipeline_programing(VADriverContextP ctx,
> }
> }
>
> - if (pSliceParameter->slice_type == SLICE_TYPE_I) {
> + if (pSliceParameter->slice_type == HEVC_SLICE_I) {
> kernel_shader = VME_INTRA_SHADER;
> - } else if (pSliceParameter->slice_type == SLICE_TYPE_P) {
> + } else if (pSliceParameter->slice_type == HEVC_SLICE_P) {
> kernel_shader = VME_INTER_SHADER;
> } else {
> kernel_shader = VME_BINTER_SHADER;
> @@ -1715,7 +1715,7 @@ static VAStatus gen9_vme_hevc_prepare(VADriverContextP ctx,
> {
> VAStatus vaStatus = VA_STATUS_SUCCESS;
> VAEncSliceParameterBufferHEVC *pSliceParameter = (VAEncSliceParameterBufferHEVC *)encode_state->slice_params_ext[0]->buffer;
> - int is_intra = pSliceParameter->slice_type == SLICE_TYPE_I;
> + int is_intra = pSliceParameter->slice_type == HEVC_SLICE_I;
> VAEncSequenceParameterBufferHEVC *pSequenceParameter = (VAEncSequenceParameterBufferHEVC *)encode_state->seq_param_ext->buffer;
> struct gen6_vme_context *vme_context = encoder_context->vme_context;
>
> diff --git a/src/i965_encoder_utils.c b/src/i965_encoder_utils.c
> index 6638491..9c9619c 100644
> --- a/src/i965_encoder_utils.c
> +++ b/src/i965_encoder_utils.c
> @@ -902,20 +902,20 @@ void hevc_short_term_ref_pic_set(avc_bitstream *bs,VAEncSliceParameterBufferHEVC
>
> hevc_rps.inter_ref_pic_set_prediction_flag = 0;
> /* s0: between I and P/B; s1 : between P and B */
> - hevc_rps.num_negative_pics = (slice_param->slice_type!=SLICE_TYPE_I) ? 1 : 0;
> - hevc_rps.num_positive_pics = (slice_param->slice_type==SLICE_TYPE_B) ? 1 : 0;
> + hevc_rps.num_negative_pics = (slice_param->slice_type!=HEVC_SLICE_I) ? 1 : 0;
> + hevc_rps.num_positive_pics = (slice_param->slice_type==HEVC_SLICE_B) ? 1 : 0;
> hevc_rps.delta_poc_s0_minus1[0] = 0;
> hevc_rps.used_by_curr_pic_s0_flag[0] = 0;
> hevc_rps.delta_poc_s1_minus1[0] = 0;
> hevc_rps.used_by_curr_pic_s1_flag[0] = 0;
> if(slice_param->num_ref_idx_l0_active_minus1==0 )
> {
> - hevc_rps.delta_poc_s0_minus1[0] = (slice_param->slice_type==SLICE_TYPE_I) ? 0 : ( curPicOrderCnt - slice_param->ref_pic_list0[0].pic_order_cnt-1); //0;
> + hevc_rps.delta_poc_s0_minus1[0] = (slice_param->slice_type==HEVC_SLICE_I) ? 0 : ( curPicOrderCnt - slice_param->ref_pic_list0[0].pic_order_cnt-1); //0;
> hevc_rps.used_by_curr_pic_s0_flag[0] = 1;
> }
> if(slice_param->num_ref_idx_l1_active_minus1==0 )
> {
> - hevc_rps.delta_poc_s1_minus1[0] = (slice_param->slice_type==SLICE_TYPE_I) ? 0 : ( slice_param->ref_pic_list1[0].pic_order_cnt -curPicOrderCnt -1);
> + hevc_rps.delta_poc_s1_minus1[0] = (slice_param->slice_type==HEVC_SLICE_I) ? 0 : ( slice_param->ref_pic_list1[0].pic_order_cnt -curPicOrderCnt -1);
> hevc_rps.used_by_curr_pic_s1_flag[0] = 1;
> }
>
> @@ -1045,7 +1045,7 @@ static void slice_rbsp(avc_bitstream *bs,
> avc_bitstream_put_ui(bs, slice_param->slice_fields.bits.slice_sao_chroma_flag, 1);
> }
>
> - if (slice_param->slice_type != SLICE_TYPE_I)
> + if (slice_param->slice_type != HEVC_SLICE_I)
> {
> /* num_ref_idx_active_override_flag. 0 */
> avc_bitstream_put_ui(bs, 0, 1);
> @@ -1054,7 +1054,7 @@ static void slice_rbsp(avc_bitstream *bs,
> /* No reference picture set modification */
>
> /* MVD_l1_zero_flag */
> - if (slice_param->slice_type == SLICE_TYPE_B)
> + if (slice_param->slice_type == HEVC_SLICE_B)
> avc_bitstream_put_ui(bs, slice_param->slice_fields.bits.mvd_l1_zero_flag, 1);
>
> /* cabac_init_present_flag. 0 */
> @@ -1068,9 +1068,9 @@ static void slice_rbsp(avc_bitstream *bs,
> */
> }
> if (((pic_param->pic_fields.bits.weighted_pred_flag) &&
> - (slice_param->slice_type == SLICE_TYPE_P)) ||
> + (slice_param->slice_type == HEVC_SLICE_P)) ||
> ((pic_param->pic_fields.bits.weighted_bipred_flag) &&
> - (slice_param->slice_type == SLICE_TYPE_B)))
> + (slice_param->slice_type == HEVC_SLICE_B)))
> {
> /* TBD:
> * add the weighted table
More information about the Libva
mailing list