[Libva] [PATCH] HEVC: Fix the Wrong slice type usage
sreerenj.balachandran at intel.com
sreerenj.balachandran at intel.com
Thu May 28 20:27:21 PDT 2015
From: Sreerenj Balachandran <sreerenj.balachandran at intel.com>
Don't mix the slice_type values of h264 and h265.
The SLICE_TYPE values of H264 and HEVC are different.
H264: Bslice_type = 1, Pslice_type = 0
HEVC: Bslice_type = 0, Pslice_type = 1
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran at intel.com>
---
src/gen6_mfc_common.c | 1 +
src/gen9_vme.c | 12 ++++++------
src/i965_encoder_utils.c | 16 ++++++++--------
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c
index 3b3d0e7..37a355b 100644
--- a/src/gen6_mfc_common.c
+++ b/src/gen6_mfc_common.c
@@ -1864,6 +1864,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);
+ /* Use SLICE_TYPE_P instead of HEVC_SLICE_P since we use AVC VME hardware */
if (slice_type == SLICE_TYPE_P) {
m_costf = lambda * 2.5;
m_cost = m_costf;
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 08b38a2..8237598 100644
--- a/src/i965_encoder_utils.c
+++ b/src/i965_encoder_utils.c
@@ -891,20 +891,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;
}
@@ -1033,7 +1033,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);
@@ -1042,7 +1042,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 */
@@ -1057,9 +1057,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
--
2.1.4
More information about the Libva
mailing list