diff --git a/src/intel/vulkan/genX_cmd_video.c b/src/intel/vulkan/genX_cmd_video.c index 7ac5a406847..8f5d602e441 100644 --- a/src/intel/vulkan/genX_cmd_video.c +++ b/src/intel/vulkan/genX_cmd_video.c @@ -811,6 +811,7 @@ anv_h265_decode_video(struct anv_cmd_buffer *cmd_buffer, ref.ReferenceListEntry[i].ListEntry = dpb_idx[slot_idx]; ref.ReferenceListEntry[i].ReferencePicturetbValue = CLAMP(diff_poc, -128, 127) & 0xff; ref.ReferenceListEntry[i].TopField = true; + ref.ReferenceListEntry[i].LongTermReference = ref_slots[0][i].lt; } } } @@ -830,6 +831,7 @@ anv_h265_decode_video(struct anv_cmd_buffer *cmd_buffer, ref.ReferenceListEntry[i].ListEntry = dpb_idx[slot_idx]; ref.ReferenceListEntry[i].ReferencePicturetbValue = CLAMP(diff_poc, -128, 127) & 0xff; ref.ReferenceListEntry[i].TopField = true; + ref.ReferenceListEntry[i].LongTermReference = ref_slots[1][i].lt; } } } diff --git a/src/vulkan/runtime/vk_video.c b/src/vulkan/runtime/vk_video.c index 2c0ecff8eef..b0be11b348f 100644 --- a/src/vulkan/runtime/vk_video.c +++ b/src/vulkan/runtime/vk_video.c @@ -1259,10 +1259,15 @@ vk_fill_video_h265_reference_info(const VkVideoDecodeInfoKHR *frame_info, const uint8_t *cur_rps = rps[i]; for (j = 0; (cur_rps[j] != 0xff) && ((j + ref_idx) < 8); j++) { + ref_slots_tmp[list_idx][j + ref_idx].slot_index = cur_rps[j]; ref_slots_tmp[list_idx][j + ref_idx].pic_order_cnt = vk_video_h265_poc_by_slot(frame_info, cur_rps[j]); + if (i == 2) + ref_slots_tmp[list_idx][j + ref_idx].lt = true; } + /* TODO handle pps_curr_pic_ref_enabled_flag here */ + ref_idx += j; } @@ -1274,9 +1279,11 @@ vk_fill_video_h265_reference_info(const VkVideoDecodeInfoKHR *frame_info, ref_slots_tmp[list_idx][slice_params->list_entry_lx[list_idx][i]].slot_index; ref_slots[list_idx][i].pic_order_cnt = ref_slots_tmp[list_idx][slice_params->list_entry_lx[list_idx][i]].pic_order_cnt; + ref_slots[list_idx][i].lt = + ref_slots_tmp[list_idx][slice_params->list_entry_lx[list_idx][i]].lt; } } else { - memcpy(ref_slots, &ref_slots_tmp, sizeof(ref_slots_tmp)); + memcpy(ref_slots[list_idx], &ref_slots_tmp[list_idx], sizeof(ref_slots_tmp[list_idx])); } } } @@ -1549,12 +1556,12 @@ vk_video_parse_h265_slice_header(const struct VkVideoDecodeInfoKHR *frame_info, for (unsigned i = 0; i < num_refs; i++) { if (i < num_lt_sps) { + int lt_idx_sps = 0; if (sps->num_long_term_ref_pics_sps > 1) - /* lt_idx_sps */ - vl_rbsp_u(&rbsp, + lt_idx_sps = vl_rbsp_u(&rbsp, util_logbase2_ceil(sps->num_long_term_ref_pics_sps)); - if (sps->pLongTermRefPicsSps->used_by_curr_pic_lt_sps_flag) + if (sps->pLongTermRefPicsSps->used_by_curr_pic_lt_sps_flag & (1 << lt_idx_sps)) nb_refs++; } else { /* poc_lsb_lt */ diff --git a/src/vulkan/runtime/vk_video.h b/src/vulkan/runtime/vk_video.h index be76edb52c6..c9bf90d78fb 100644 --- a/src/vulkan/runtime/vk_video.h +++ b/src/vulkan/runtime/vk_video.h @@ -304,6 +304,7 @@ struct vk_video_h265_reference { StdVideoDecodeH265ReferenceInfoFlags flags; uint32_t slot_index; int32_t pic_order_cnt; + bool lt; }; int vk_video_h265_poc_by_slot(const struct VkVideoDecodeInfoKHR *frame_info, int slot);