hardware/intel/intel-driver
Revisão | f5cac6fd7171c801bd13f7e0c48a86cff234a004 (tree) |
---|---|
Hora | 2015-04-29 16:58:36 |
Autor | Xiang, Haihao <haihao.xiang@inte...> |
Commiter | Xiang, Haihao |
HEVC/dec: Fix collocated_ref_idx and collocated_from_l0_flag
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
@@ -197,6 +197,10 @@ gen9_hcpd_hevc_decode_init(VADriverContextP ctx, | ||
197 | 197 | size <<= 6; |
198 | 198 | ALLOC_GEN_BUFFER((&gen9_hcpd_context->sao_tile_column_buffer), "sao tile column buffer", size); |
199 | 199 | |
200 | + gen9_hcpd_context->first_inter_slice_collocated_ref_idx = 0; | |
201 | + gen9_hcpd_context->first_inter_slice_collocated_from_l0_flag = 0; | |
202 | + gen9_hcpd_context->first_inter_slice_valid = 0; | |
203 | + | |
200 | 204 | return VA_STATUS_SUCCESS; |
201 | 205 | } |
202 | 206 |
@@ -707,6 +711,9 @@ gen9_hcpd_get_collocated_ref_idx(VADriverContextP ctx, | ||
707 | 711 | if (slice_param->collocated_ref_idx > 14) |
708 | 712 | return 0; |
709 | 713 | |
714 | + if (!slice_param->LongSliceFlags.fields.slice_temporal_mvp_enabled_flag) | |
715 | + return 0; | |
716 | + | |
710 | 717 | if (slice_param->LongSliceFlags.fields.slice_type == HEVC_SLICE_I) |
711 | 718 | return 0; |
712 | 719 |
@@ -779,6 +786,7 @@ gen9_hcpd_slice_state(VADriverContextP ctx, | ||
779 | 786 | { |
780 | 787 | struct intel_batchbuffer *batch = gen9_hcpd_context->base.batch; |
781 | 788 | int slice_hor_pos, slice_ver_pos, next_slice_hor_pos, next_slice_ver_pos; |
789 | + unsigned short collocated_ref_idx, collocated_from_l0_flag; | |
782 | 790 | |
783 | 791 | slice_hor_pos = slice_param->slice_segment_address % gen9_hcpd_context->picture_width_in_ctbs; |
784 | 792 | slice_ver_pos = slice_param->slice_segment_address / gen9_hcpd_context->picture_width_in_ctbs; |
@@ -791,6 +799,25 @@ gen9_hcpd_slice_state(VADriverContextP ctx, | ||
791 | 799 | next_slice_ver_pos = 0; |
792 | 800 | } |
793 | 801 | |
802 | + collocated_ref_idx = gen9_hcpd_get_collocated_ref_idx(ctx, pic_param, slice_param, gen9_hcpd_context); | |
803 | + collocated_from_l0_flag = slice_param->LongSliceFlags.fields.collocated_from_l0_flag; | |
804 | + | |
805 | + if ((!gen9_hcpd_context->first_inter_slice_valid) && | |
806 | + (slice_param->LongSliceFlags.fields.slice_type != HEVC_SLICE_I) && | |
807 | + slice_param->LongSliceFlags.fields.slice_temporal_mvp_enabled_flag) { | |
808 | + gen9_hcpd_context->first_inter_slice_collocated_ref_idx = collocated_ref_idx; | |
809 | + gen9_hcpd_context->first_inter_slice_collocated_from_l0_flag = collocated_from_l0_flag; | |
810 | + gen9_hcpd_context->first_inter_slice_valid = 1; | |
811 | + } | |
812 | + | |
813 | + /* HW requirement */ | |
814 | + if (gen9_hcpd_context->first_inter_slice_valid && | |
815 | + ((slice_param->LongSliceFlags.fields.slice_type == HEVC_SLICE_I) || | |
816 | + (!slice_param->LongSliceFlags.fields.slice_temporal_mvp_enabled_flag))) { | |
817 | + collocated_ref_idx = gen9_hcpd_context->first_inter_slice_collocated_ref_idx; | |
818 | + collocated_from_l0_flag = gen9_hcpd_context->first_inter_slice_collocated_from_l0_flag; | |
819 | + } | |
820 | + | |
794 | 821 | BEGIN_BCS_BATCH(batch, 9); |
795 | 822 | |
796 | 823 | OUT_BCS_BATCH(batch, HCP_SLICE_STATE | (9 - 2)); |
@@ -810,12 +837,12 @@ gen9_hcpd_slice_state(VADriverContextP ctx, | ||
810 | 837 | !next_slice_param << 2 | |
811 | 838 | slice_param->LongSliceFlags.fields.slice_type); |
812 | 839 | OUT_BCS_BATCH(batch, |
813 | - gen9_hcpd_get_collocated_ref_idx(ctx, pic_param, slice_param, gen9_hcpd_context) << 26 | | |
840 | + collocated_ref_idx << 26 | | |
814 | 841 | (5 - slice_param->five_minus_max_num_merge_cand - 1) << 23 | |
815 | 842 | slice_param->LongSliceFlags.fields.cabac_init_flag << 22 | |
816 | 843 | slice_param->luma_log2_weight_denom << 19 | |
817 | 844 | ((slice_param->luma_log2_weight_denom + slice_param->delta_chroma_log2_weight_denom) & 0x7) << 16 | |
818 | - slice_param->LongSliceFlags.fields.collocated_from_l0_flag << 15 | | |
845 | + collocated_from_l0_flag << 15 | | |
819 | 846 | gen9_hcpd_is_low_delay(ctx, pic_param, slice_param) << 14 | |
820 | 847 | slice_param->LongSliceFlags.fields.mvd_l1_zero_flag << 13 | |
821 | 848 | slice_param->LongSliceFlags.fields.slice_sao_luma_flag << 12 | |
@@ -65,6 +65,10 @@ struct gen9_hcpd_context | ||
65 | 65 | GenBuffer sao_line_buffer; |
66 | 66 | GenBuffer sao_tile_line_buffer; |
67 | 67 | GenBuffer sao_tile_column_buffer; |
68 | + | |
69 | + unsigned short first_inter_slice_collocated_ref_idx; | |
70 | + unsigned short first_inter_slice_collocated_from_l0_flag; | |
71 | + int first_inter_slice_valid; | |
68 | 72 | }; |
69 | 73 | |
70 | 74 | #endif /* GEN9_MFD_H */ |