[Libva] [libva-intel-driver PATCH 3/4] HEVC/dec: Fix collocated_ref_idx and collocated_from_l0_flag
Xiang, Haihao
haihao.xiang at intel.com
Wed Apr 22 00:33:50 PDT 2015
Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
src/gen9_mfd.c | 34 +++++++++++++++++++++++++++++++---
src/gen9_mfd.h | 4 ++++
2 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/src/gen9_mfd.c b/src/gen9_mfd.c
index 8e56165..33d9051 100644
--- a/src/gen9_mfd.c
+++ b/src/gen9_mfd.c
@@ -197,6 +197,10 @@ gen9_hcpd_hevc_decode_init(VADriverContextP ctx,
size <<= 6;
ALLOC_GEN_BUFFER((&gen9_hcpd_context->sao_tile_column_buffer), "sao tile column buffer", size);
+ gen9_hcpd_context->first_inter_slice_collocated_ref_idx = 0;
+ gen9_hcpd_context->first_inter_slice_collocated_from_l0_flag = 0;
+ gen9_hcpd_context->first_inter_slice_valid = 0;
+
return VA_STATUS_SUCCESS;
}
@@ -707,6 +711,9 @@ gen9_hcpd_get_collocated_ref_idx(VADriverContextP ctx,
if (slice_param->collocated_ref_idx > 14)
return 0;
+ if (!slice_param->LongSliceFlags.fields.slice_temporal_mvp_enabled_flag)
+ return 0;
+
if (slice_param->LongSliceFlags.fields.slice_type == HEVC_SLICE_I)
return 0;
@@ -774,11 +781,13 @@ static void
gen9_hcpd_slice_state(VADriverContextP ctx,
VAPictureParameterBufferHEVC *pic_param,
VASliceParameterBufferHEVC *slice_param,
+ int is_first_slice,
VASliceParameterBufferHEVC *next_slice_param,
struct gen9_hcpd_context *gen9_hcpd_context)
{
struct intel_batchbuffer *batch = gen9_hcpd_context->base.batch;
int slice_hor_pos, slice_ver_pos, next_slice_hor_pos, next_slice_ver_pos;
+ unsigned short collocated_ref_idx, collocated_from_l0_flag;
slice_hor_pos = slice_param->slice_segment_address % gen9_hcpd_context->picture_width_in_ctbs;
slice_ver_pos = slice_param->slice_segment_address / gen9_hcpd_context->picture_width_in_ctbs;
@@ -791,6 +800,25 @@ gen9_hcpd_slice_state(VADriverContextP ctx,
next_slice_ver_pos = 0;
}
+ collocated_ref_idx = gen9_hcpd_get_collocated_ref_idx(ctx, pic_param, slice_param, gen9_hcpd_context);
+ collocated_from_l0_flag = slice_param->LongSliceFlags.fields.collocated_from_l0_flag;
+
+ if ((!gen9_hcpd_context->first_inter_slice_valid) &&
+ (slice_param->LongSliceFlags.fields.slice_type != HEVC_SLICE_I) &&
+ slice_param->LongSliceFlags.fields.slice_temporal_mvp_enabled_flag) {
+ gen9_hcpd_context->first_inter_slice_collocated_ref_idx = collocated_ref_idx;
+ gen9_hcpd_context->first_inter_slice_collocated_from_l0_flag = collocated_from_l0_flag;
+ gen9_hcpd_context->first_inter_slice_valid = 1;
+ }
+
+ /* HW requirement */
+ if (gen9_hcpd_context->first_inter_slice_valid &&
+ ((slice_param->LongSliceFlags.fields.slice_type == HEVC_SLICE_I) ||
+ (!slice_param->LongSliceFlags.fields.slice_temporal_mvp_enabled_flag))) {
+ collocated_ref_idx = gen9_hcpd_context->first_inter_slice_collocated_ref_idx;
+ collocated_from_l0_flag = gen9_hcpd_context->first_inter_slice_collocated_from_l0_flag;
+ }
+
BEGIN_BCS_BATCH(batch, 9);
OUT_BCS_BATCH(batch, HCP_SLICE_STATE | (9 - 2));
@@ -810,12 +838,12 @@ gen9_hcpd_slice_state(VADriverContextP ctx,
!next_slice_param << 2 |
slice_param->LongSliceFlags.fields.slice_type);
OUT_BCS_BATCH(batch,
- gen9_hcpd_get_collocated_ref_idx(ctx, pic_param, slice_param, gen9_hcpd_context) << 26 |
+ collocated_ref_idx << 26 |
(5 - slice_param->five_minus_max_num_merge_cand - 1) << 23 |
slice_param->LongSliceFlags.fields.cabac_init_flag << 22 |
slice_param->luma_log2_weight_denom << 19 |
((slice_param->luma_log2_weight_denom + slice_param->delta_chroma_log2_weight_denom) & 0x7) << 16 |
- slice_param->LongSliceFlags.fields.collocated_from_l0_flag << 15 |
+ collocated_from_l0_flag << 15 |
gen9_hcpd_is_low_delay(ctx, pic_param, slice_param) << 14 |
slice_param->LongSliceFlags.fields.mvd_l1_zero_flag << 13 |
slice_param->LongSliceFlags.fields.slice_sao_luma_flag << 12 |
@@ -908,7 +936,7 @@ gen9_hcpd_hevc_decode_picture(VADriverContextP ctx,
else
next_slice_param = next_slice_group_param;
- gen9_hcpd_slice_state(ctx, pic_param, slice_param, next_slice_param, gen9_hcpd_context);
+ gen9_hcpd_slice_state(ctx, pic_param, slice_param, (j == 0 && i == 0), next_slice_param, gen9_hcpd_context);
gen9_hcpd_ref_idx_state(ctx, pic_param, slice_param, gen9_hcpd_context);
gen9_hcpd_weightoffset_state(ctx, pic_param, slice_param, gen9_hcpd_context);
gen9_hcpd_bsd_object(ctx, slice_param, gen9_hcpd_context);
diff --git a/src/gen9_mfd.h b/src/gen9_mfd.h
index 727c579..6e9fa5d 100644
--- a/src/gen9_mfd.h
+++ b/src/gen9_mfd.h
@@ -65,6 +65,10 @@ struct gen9_hcpd_context
GenBuffer sao_line_buffer;
GenBuffer sao_tile_line_buffer;
GenBuffer sao_tile_column_buffer;
+
+ unsigned short first_inter_slice_collocated_ref_idx;
+ unsigned short first_inter_slice_collocated_from_l0_flag;
+ int first_inter_slice_valid;
};
#endif /* GEN9_MFD_H */
--
1.9.1
More information about the Libva
mailing list