diff --git a/src/utility/encoder.cpp b/src/utility/encoder.cpp index 4812b834fef91b8efd631041a3e33f4c739c4baa..bcfd4000672bf01f44e1cab4fff3f308cf1b0cf3 100644 --- a/src/utility/encoder.cpp +++ b/src/utility/encoder.cpp @@ -577,19 +577,28 @@ void Encoder::retrive_encoding(lava::device_ptr device, EncoderFrame::Ptr frame) bool Encoder::create_profiles(lava::device_ptr device) { - this->encode_profile.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PROFILE_EXT; + this->encode_profile.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PROFILE_INFO_EXT; this->encode_profile.pNext = nullptr; this->encode_profile.stdProfileIdc = STD_VIDEO_H264_PROFILE_IDC_HIGH; - this->video_profile.sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_KHR; - this->video_profile.pNext = &this->encode_profile; + this->usage_info.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_USAGE_INFO_KHR; + this->usage_info.pNext = &this->encode_profile; + this->usage_info.videoUsageHints = VK_VIDEO_ENCODE_USAGE_STREAMING_BIT_KHR; + this->usage_info.videoContentHints = VK_VIDEO_ENCODE_CONTENT_RENDERED_BIT_KHR; + this->usage_info.tuningMode = VK_VIDEO_ENCODE_TUNING_MODE_ULTRA_LOW_LATENCY_KHR; + + this->video_profile.sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_INFO_KHR; + this->video_profile.pNext = &this->usage_info; this->video_profile.videoCodecOperation = VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT; this->video_profile.chromaSubsampling = VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR; this->video_profile.lumaBitDepth = VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR; this->video_profile.chromaBitDepth = VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR; - this->encode_capabillities.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_CAPABILITIES_EXT; - this->encode_capabillities.pNext = nullptr; + this->codec_capabillities.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_CAPABILITIES_EXT; + this->codec_capabillities.pNext = nullptr; + + this->encode_capabillities.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_CAPABILITIES_KHR; + this->encode_capabillities.pNext = &this->codec_capabillities; this->video_capabillities.sType = VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR; this->video_capabillities.pNext = &this->encode_capabillities; @@ -605,7 +614,7 @@ bool Encoder::create_profiles(lava::device_ptr device) bool Encoder::compute_settings(const glm::uvec2& size) { const glm::uvec2 block_size = glm::uvec2(16); //Macroblock Size of 16x16. TODO: Look up this value form the capabillities. - const glm::uvec2 image_alignment = glm::uvec2(this->video_capabillities.videoPictureExtentGranularity.width, this->video_capabillities.videoPictureExtentGranularity.height); + const glm::uvec2 image_alignment = glm::uvec2(this->encode_capabillities.inputImageDataFillAlignment.width, this->encode_capabillities.inputImageDataFillAlignment.height); const uint32_t buffer_size = 1048576 * 10; //10 MB. TODO: Use a better estimation for the size of the output buffer. const uint32_t buffer_alignment = this->video_capabillities.minBitstreamBufferSizeAlignment; @@ -636,9 +645,9 @@ bool Encoder::create_session(lava::device_ptr device, const glm::uvec2& size) video_create_info.pVideoProfile = &this->video_profile; video_create_info.pictureFormat = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM; video_create_info.maxCodedExtent = max_video_extend; - video_create_info.referencePicturesFormat = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM; - video_create_info.maxReferencePicturesSlotsCount = this->setting_reference_frames + 1; - video_create_info.maxReferencePicturesActiveCount = this->setting_reference_frames + 1; + video_create_info.referencePictureFormat = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM; + video_create_info.maxDpbSlots = this->setting_reference_frames + 1; + video_create_info.maxActiveReferencePictures = this->setting_reference_frames + 1; video_create_info.pStdHeaderVersion = &extension_properties; if (vkCreateVideoSessionKHR(device->get(), &video_create_info, lava::memory::alloc(), &this->video_session) != VK_SUCCESS) @@ -672,26 +681,28 @@ bool Encoder::create_parameters(lava::device_ptr device) sps_flags.vui_parameters_present_flag = 0; // Dont send VUI StdVideoH264SequenceParameterSet sps_parameter; + sps_parameter.flags = sps_flags; sps_parameter.profile_idc = STD_VIDEO_H264_PROFILE_IDC_HIGH; // High profile - sps_parameter.level_idc = STD_VIDEO_H264_LEVEL_4_1; // Level 4.1 - sps_parameter.seq_parameter_set_id = this->sequence_parameter_id; // Id of the sequence parameter set + sps_parameter.level_idc = STD_VIDEO_H264_LEVEL_IDC_4_1; // Level 4.1 sps_parameter.chroma_format_idc = STD_VIDEO_H264_CHROMA_FORMAT_IDC_420; // Not Required + sps_parameter.seq_parameter_set_id = this->sequence_parameter_id; // Id of the sequence parameter set sps_parameter.bit_depth_luma_minus8 = 0; // Not Required sps_parameter.bit_depth_chroma_minus8 = 0; // Not Required sps_parameter.log2_max_frame_num_minus4 = 4; // Use 8 bits for frame numbers sps_parameter.pic_order_cnt_type = STD_VIDEO_H264_POC_TYPE_0; // Use picture order count type 0 - sps_parameter.log2_max_pic_order_cnt_lsb_minus4 = 4; // Use 8 bits for the ordering of the frames sps_parameter.offset_for_non_ref_pic = 0; // Not Required sps_parameter.offset_for_top_to_bottom_field = 0; // Not Required + sps_parameter.log2_max_pic_order_cnt_lsb_minus4 = 4; // Use 8 bits for the ordering of the frames sps_parameter.num_ref_frames_in_pic_order_cnt_cycle = 0; // Not Required sps_parameter.max_num_ref_frames = this->setting_reference_frames; // Set the number of reference frames + sps_parameter.reserved1 = 0; // Not Required sps_parameter.pic_width_in_mbs_minus1 = this->setting_block_count.x - 1; // Set image width in macroblocks sps_parameter.pic_height_in_map_units_minus1 = this->setting_block_count.y - 1;// Set image height in macroblocks sps_parameter.frame_crop_left_offset = 0; // Set no crop left sps_parameter.frame_crop_right_offset = this->setting_frame_crop.x >> 1; // Set crop right to get the correct frame width. Devide by two because of chroma subsampling. sps_parameter.frame_crop_top_offset = 0; // Set no crop top sps_parameter.frame_crop_bottom_offset = this->setting_frame_crop.y >> 1; // Set crop bottom to get the correct frame height. Devide by two because of chroma subsampling. - sps_parameter.flags = sps_flags; + sps_parameter.reserved2 = 0; // Not Required sps_parameter.pOffsetForRefFrame = nullptr; // Not Required sps_parameter.pScalingLists = nullptr; // Not Required sps_parameter.pSequenceParameterSetVui = nullptr; // Not Required @@ -702,13 +713,13 @@ bool Encoder::create_parameters(lava::device_ptr device) pps_flags.redundant_pic_cnt_present_flag = 0; // Set to zero pps_flags.constrained_intra_pred_flag = 0; // Set to zero pps_flags.deblocking_filter_control_present_flag = 1; // Set to zero, no deblocking - pps_flags.weighted_bipred_idc_flag = 0; // Set to zero pps_flags.weighted_pred_flag = 0; // Set to zero - pps_flags.pic_order_present_flag = 0; // Set to zero + pps_flags.bottom_field_pic_order_in_frame_present_flag = 0; // Set to zero pps_flags.entropy_coding_mode_flag = 1; // Set to zero, use CABAC for encoding pps_flags.pic_scaling_matrix_present_flag = 0; // Set to zero StdVideoH264PictureParameterSet pps_parameter; + pps_parameter.flags = pps_flags; pps_parameter.seq_parameter_set_id = this->sequence_parameter_id; // Id of the sequence parameter set that is referenced pps_parameter.pic_parameter_set_id = this->picture_parameter_id; // Id of the picture parameter set pps_parameter.num_ref_idx_l0_default_active_minus1 = 0; // Set to zero @@ -718,27 +729,27 @@ bool Encoder::create_parameters(lava::device_ptr device) pps_parameter.pic_init_qs_minus26 = 0; // Set to zero pps_parameter.chroma_qp_index_offset = 0; // Set to zero pps_parameter.second_chroma_qp_index_offset = 0; // Set to zero - pps_parameter.flags = pps_flags; pps_parameter.pScalingLists = nullptr; // Not Required VkVideoEncodeH264SessionParametersAddInfoEXT add_info; add_info.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_ADD_INFO_EXT; add_info.pNext = nullptr; - add_info.spsStdCount = 1; - add_info.pSpsStd = &sps_parameter; - add_info.ppsStdCount = 1; - add_info.pPpsStd = &pps_parameter; + add_info.stdSPSCount = 1; + add_info.pStdSPSs = &sps_parameter; + add_info.stdPPSCount = 1; + add_info.pStdPPSs = &pps_parameter; VkVideoEncodeH264SessionParametersCreateInfoEXT encode_create_info; encode_create_info.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_CREATE_INFO_EXT; encode_create_info.pNext = nullptr; - encode_create_info.maxSpsStdCount = 1; - encode_create_info.maxPpsStdCount = 1; + encode_create_info.maxStdSPSCount = 1; + encode_create_info.maxStdPPSCount = 1; encode_create_info.pParametersAddInfo = &add_info; VkVideoSessionParametersCreateInfoKHR video_create_info; video_create_info.sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR; video_create_info.pNext = &encode_create_info; + video_create_info.flags = 0; video_create_info.videoSessionParametersTemplate = nullptr; video_create_info.videoSession = this->video_session; @@ -752,34 +763,29 @@ bool Encoder::create_parameters(lava::device_ptr device) bool Encoder::bind_session_memory(lava::device_ptr device) { - uint32_t property_count = 0; - if (vkGetVideoSessionMemoryRequirementsKHR(device->get(), this->video_session, &property_count, nullptr) != VK_SUCCESS) + uint32_t requirement_count = 0; + if (vkGetVideoSessionMemoryRequirementsKHR(device->get(), this->video_session, &requirement_count, nullptr) != VK_SUCCESS) { return false; } - std::vector<VkMemoryRequirements2> requirement_list; - requirement_list.resize(property_count); - std::vector<VkVideoGetMemoryPropertiesKHR> property_list; - property_list.resize(property_count); + std::vector<VkVideoSessionMemoryRequirementsKHR> requirement_list; + requirement_list.resize(requirement_count); - for (uint32_t index = 0; index < property_count; index++) + for (uint32_t index = 0; index < requirement_count; index++) { - requirement_list[index].sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2; + requirement_list[index].sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_MEMORY_REQUIREMENTS_KHR; requirement_list[index].pNext = nullptr; - property_list[index].sType = VK_STRUCTURE_TYPE_VIDEO_GET_MEMORY_PROPERTIES_KHR; - property_list[index].pNext = nullptr; - property_list[index].pMemoryRequirements = &requirement_list[index]; } - if (vkGetVideoSessionMemoryRequirementsKHR(device->get(), this->video_session, &property_count, property_list.data()) != VK_SUCCESS) + if (vkGetVideoSessionMemoryRequirementsKHR(device->get(), this->video_session, &requirement_count, requirement_list.data()) != VK_SUCCESS) { return false; } - std::vector<VkVideoBindMemoryKHR> bind_list; + std::vector<VkBindVideoSessionMemoryInfoKHR> bind_list; - for (const VkVideoGetMemoryPropertiesKHR& property : property_list) + for (const VkVideoSessionMemoryRequirementsKHR& requirement : requirement_list) { VmaAllocationCreateInfo create_info; create_info.flags = 0; @@ -793,17 +799,17 @@ bool Encoder::bind_session_memory(lava::device_ptr device) VmaAllocation memory; VmaAllocationInfo info; - if (vmaAllocateMemory(device->alloc(), &property.pMemoryRequirements->memoryRequirements, &create_info, &memory, &info) != VK_SUCCESS) + if (vmaAllocateMemory(device->alloc(), &requirement.memoryRequirements, &create_info, &memory, &info) != VK_SUCCESS) { return false; } this->video_session_memory.push_back(memory); - VkVideoBindMemoryKHR bind; - bind.sType = VK_STRUCTURE_TYPE_VIDEO_BIND_MEMORY_KHR; + VkBindVideoSessionMemoryInfoKHR bind; + bind.sType = VK_STRUCTURE_TYPE_BIND_VIDEO_SESSION_MEMORY_INFO_KHR; bind.pNext = nullptr; - bind.memoryBindIndex = property.memoryBindIndex; + bind.memoryBindIndex = requirement.memoryBindIndex; bind.memory = info.deviceMemory; bind.memoryOffset = info.offset; bind.memorySize = info.size; @@ -1682,14 +1688,14 @@ bool Encoder::check_encode_support(lava::device_ptr device, const lava::queue& q uint32_t property_count = 0; vkGetPhysicalDeviceQueueFamilyProperties2(device->get_physical_device()->get(), &property_count, nullptr); - std::vector<VkVideoQueueFamilyProperties2KHR> video_property_list; + std::vector<VkQueueFamilyVideoPropertiesKHR> video_property_list; video_property_list.resize(property_count); std::vector<VkQueueFamilyProperties2> property_list; property_list.resize(property_count); for (uint32_t index = 0; index < property_count; index++) { - video_property_list[index].sType = VK_STRUCTURE_TYPE_VIDEO_QUEUE_FAMILY_PROPERTIES_2_KHR; + video_property_list[index].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_VIDEO_PROPERTIES_KHR; video_property_list[index].pNext = nullptr; property_list[index].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2; property_list[index].pNext = &video_property_list[index]; @@ -1707,17 +1713,16 @@ bool Encoder::check_encode_support(lava::device_ptr device, const lava::queue& q bool Encoder::check_format_support(lava::device_ptr device, VkImageUsageFlags usage, VkFormat format) const { - VkVideoProfilesKHR video_profiles; - video_profiles.sType = VK_STRUCTURE_TYPE_VIDEO_PROFILES_KHR; + VkVideoProfileListInfoKHR video_profiles; + video_profiles.sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR; video_profiles.pNext = nullptr; video_profiles.profileCount = 1; video_profiles.pProfiles = &this->video_profile; VkPhysicalDeviceVideoFormatInfoKHR video_format_info; video_format_info.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_FORMAT_INFO_KHR; - video_format_info.pNext = nullptr; + video_format_info.pNext = &video_profiles; video_format_info.imageUsage = usage; - video_format_info.pVideoProfiles = &video_profiles; uint32_t format_count = 0; @@ -1767,7 +1772,6 @@ void Encoder::encode_pass_control_setup(VkCommandBuffer command_buffer, EncoderF begin_info.sType = VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR; begin_info.pNext = nullptr; begin_info.flags = 0; - begin_info.codecQualityPreset = VK_VIDEO_CODING_QUALITY_PRESET_NORMAL_BIT_KHR; begin_info.videoSession = this->video_session; begin_info.videoSessionParameters = this->video_session_paremeters; begin_info.referenceSlotCount = 0; @@ -1837,8 +1841,8 @@ void Encoder::encode_pass_control_command(VkCommandBuffer command_buffer, Encode VkVideoCodingControlInfoKHR control_info; control_info.sType = VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR; - control_info.pNext = &layer_info; - control_info.flags = VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR; + control_info.pNext = &rate_info; + control_info.flags = VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR | VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR | VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_LAYER_BIT_KHR; vkCmdControlVideoCodingKHR(command_buffer, &control_info); } @@ -1849,7 +1853,6 @@ void Encoder::encode_pass_config_setup(VkCommandBuffer command_buffer, EncoderFr begin_info.sType = VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR; begin_info.pNext = nullptr; begin_info.flags = 0; - begin_info.codecQualityPreset = VK_VIDEO_CODING_QUALITY_PRESET_NORMAL_BIT_KHR; begin_info.videoSession = this->video_session; begin_info.videoSessionParameters = this->video_session_paremeters; begin_info.referenceSlotCount = 0; @@ -1874,8 +1877,8 @@ void Encoder::encode_pass_config_setup(VkCommandBuffer command_buffer, EncoderFr void Encoder::encode_pass_config_command(VkCommandBuffer command_buffer, EncoderFrame::Ptr frame) { - VkVideoPictureResourceKHR input_resource; - input_resource.sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_KHR; + VkVideoPictureResourceInfoKHR input_resource; + input_resource.sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR; input_resource.pNext = nullptr; input_resource.codedOffset.x = 0; input_resource.codedOffset.y = 0; @@ -1884,8 +1887,8 @@ void Encoder::encode_pass_config_command(VkCommandBuffer command_buffer, Encoder input_resource.baseArrayLayer = 0; input_resource.imageViewBinding = VK_NULL_HANDLE; - VkVideoEncodeH264EmitPictureParametersEXT config_info; - config_info.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_EMIT_PICTURE_PARAMETERS_EXT; + VkVideoEncodeH264EmitPictureParametersInfoEXT config_info; + config_info.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_EMIT_PICTURE_PARAMETERS_INFO_EXT; config_info.pNext = nullptr; config_info.spsId = this->sequence_parameter_id; config_info.emitSpsEnable = VK_TRUE; @@ -1935,8 +1938,8 @@ void Encoder::encode_pass_frame_setup(VkCommandBuffer command_buffer, EncoderFra vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, nullptr, 0, nullptr, 1, &slot_barrier); - std::vector<VkVideoPictureResourceKHR> slot_resources; - std::vector<VkVideoReferenceSlotKHR> slot_infos; + std::vector<VkVideoPictureResourceInfoKHR> slot_resources; + std::vector<VkVideoReferenceSlotInfoKHR> slot_infos; slot_resources.resize(reference_slots.size()); slot_infos.resize(reference_slots.size()); @@ -1944,8 +1947,8 @@ void Encoder::encode_pass_frame_setup(VkCommandBuffer command_buffer, EncoderFra { EncoderFrame::Ptr reference_slot = reference_slots[index]; - VkVideoPictureResourceKHR& slot_resource = slot_resources[index]; - slot_resource.sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_KHR; + VkVideoPictureResourceInfoKHR& slot_resource = slot_resources[index]; + slot_resource.sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR; slot_resource.pNext = nullptr; slot_resource.codedOffset.x = 0; slot_resource.codedOffset.y = 0; @@ -1954,8 +1957,8 @@ void Encoder::encode_pass_frame_setup(VkCommandBuffer command_buffer, EncoderFra slot_resource.baseArrayLayer = 0; slot_resource.imageViewBinding = reference_slot->slot_view; - VkVideoReferenceSlotKHR& slot_info = slot_infos[index]; - slot_info.sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_KHR; + VkVideoReferenceSlotInfoKHR& slot_info = slot_infos[index]; + slot_info.sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR; slot_info.pNext = nullptr; slot_info.slotIndex = reference_slot->slot_index; slot_info.pPictureResource = &slot_resource; @@ -1965,7 +1968,6 @@ void Encoder::encode_pass_frame_setup(VkCommandBuffer command_buffer, EncoderFra begin_info.sType = VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR; begin_info.pNext = nullptr; begin_info.flags = 0; - begin_info.codecQualityPreset = VK_VIDEO_CODING_QUALITY_PRESET_NORMAL_BIT_KHR; begin_info.videoSession = this->video_session; begin_info.videoSessionParameters = this->video_session_paremeters; begin_info.referenceSlotCount = slot_infos.size(); @@ -2009,32 +2011,32 @@ void Encoder::encode_pass_frame_command(VkCommandBuffer command_buffer, EncoderF encode_extend.width = this->setting_image_size.x; encode_extend.height = this->setting_image_size.y; - VkVideoPictureResourceKHR input_resource; - input_resource.sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_KHR; + VkVideoPictureResourceInfoKHR input_resource; + input_resource.sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR; input_resource.pNext = nullptr; input_resource.codedOffset = encode_offset; input_resource.codedExtent = encode_extend; input_resource.baseArrayLayer = 0; input_resource.imageViewBinding = frame->input_view_combined; - VkVideoPictureResourceKHR slot_resource; - slot_resource.sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_KHR; + VkVideoPictureResourceInfoKHR slot_resource; + slot_resource.sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR; slot_resource.pNext = nullptr; slot_resource.codedOffset = encode_offset; slot_resource.codedExtent = encode_extend; slot_resource.baseArrayLayer = 0; slot_resource.imageViewBinding = frame->slot_view; - VkVideoReferenceSlotKHR slot_reference; - slot_reference.sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_KHR; + VkVideoReferenceSlotInfoKHR slot_reference; + slot_reference.sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR; slot_reference.pNext = nullptr; slot_reference.slotIndex = frame->slot_index; slot_reference.pPictureResource = &slot_resource; //--- Reference Images ---------------------------------------------------------------- - std::vector<VkVideoPictureResourceKHR> reference_slot_resources; - std::vector<VkVideoReferenceSlotKHR> reference_slot_infos; + std::vector<VkVideoPictureResourceInfoKHR> reference_slot_resources; + std::vector<VkVideoReferenceSlotInfoKHR> reference_slot_infos; std::vector<StdVideoEncodeH264ReferenceInfo> reference_std_infos; std::vector<VkVideoEncodeH264DpbSlotInfoEXT> reference_dpb_slot_infos; reference_slot_resources.resize(reference_slots.size()); @@ -2046,8 +2048,8 @@ void Encoder::encode_pass_frame_command(VkCommandBuffer command_buffer, EncoderF { EncoderFrame::Ptr reference_slot = reference_slots[index]; - VkVideoPictureResourceKHR& slot_resource = reference_slot_resources[index]; - slot_resource.sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_KHR; + VkVideoPictureResourceInfoKHR& slot_resource = reference_slot_resources[index]; + slot_resource.sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR; slot_resource.pNext = nullptr; slot_resource.codedOffset.x = 0; slot_resource.codedOffset.y = 0; @@ -2056,8 +2058,8 @@ void Encoder::encode_pass_frame_command(VkCommandBuffer command_buffer, EncoderF slot_resource.baseArrayLayer = 0; slot_resource.imageViewBinding = reference_slot->slot_view; - VkVideoReferenceSlotKHR& slot_info = reference_slot_infos[index]; - slot_info.sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_KHR; + VkVideoReferenceSlotInfoKHR& slot_info = reference_slot_infos[index]; + slot_info.sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR; slot_info.pNext = nullptr; slot_info.slotIndex = reference_slot->slot_index; slot_info.pPictureResource = &slot_resource; @@ -2079,8 +2081,8 @@ void Encoder::encode_pass_frame_command(VkCommandBuffer command_buffer, EncoderF dpb_slot_info.pStdReferenceInfo = &std_info; } - VkVideoEncodeH264ReferenceListsEXT reference_lists; - reference_lists.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_REFERENCE_LISTS_EXT; + VkVideoEncodeH264ReferenceListsInfoEXT reference_lists; + reference_lists.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_REFERENCE_LISTS_INFO_EXT; reference_lists.pNext = nullptr; reference_lists.referenceList0EntryCount = reference_dpb_slot_infos.size(); reference_lists.pReferenceList0Entries = reference_dpb_slot_infos.data(); @@ -2125,8 +2127,8 @@ void Encoder::encode_pass_frame_command(VkCommandBuffer command_buffer, EncoderF slice_parameters.slice_beta_offset_div2 = 0; slice_parameters.pWeightTable = nullptr; - VkVideoEncodeH264NaluSliceEXT slice_info; - slice_info.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_NALU_SLICE_EXT; + VkVideoEncodeH264NaluSliceInfoEXT slice_info; + slice_info.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_NALU_SLICE_INFO_EXT; slice_info.pNext = nullptr; slice_info.mbCount = this->setting_block_count.x * this->setting_block_count.y; slice_info.pReferenceFinalLists = &reference_lists; diff --git a/src/utility/encoder.hpp b/src/utility/encoder.hpp index 52d74f3ca04219534ff738252daa465e4b35f9f5..77c3f5ec577ebc61e3a6bb9266d4276ecc2ed938 100644 --- a/src/utility/encoder.hpp +++ b/src/utility/encoder.hpp @@ -228,11 +228,13 @@ private: VkVideoSessionParametersKHR video_session_paremeters = nullptr; std::vector<VmaAllocation> video_session_memory; - VkVideoProfileKHR video_profile; - VkVideoEncodeH264ProfileEXT encode_profile; + VkVideoProfileInfoKHR video_profile; + VkVideoEncodeUsageInfoKHR usage_info; + VkVideoEncodeH264ProfileInfoEXT encode_profile; VkVideoCapabilitiesKHR video_capabillities; - VkVideoEncodeH264CapabilitiesEXT encode_capabillities; + VkVideoEncodeCapabilitiesKHR encode_capabillities; + VkVideoEncodeH264CapabilitiesEXT codec_capabillities; const uint8_t sequence_parameter_id = 0; const uint8_t picture_parameter_id = 0;