Changeset 108315 in vbox
- Timestamp:
- Feb 20, 2025 4:15:42 PM (3 weeks ago)
- svn:sync-xref-src-repo-rev:
- 167659
- Location:
- trunk/src/libs/dxvk-2.3.1/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/dxvk-2.3.1/src/d3d11/d3d11_video.cpp
r108229 r108315 254 254 ? (pPicParams->delta_pic_order_always_zero_flag ? 1 : 0) 255 255 : 0; 256 p.sps.flags.separate_colour_plane_flag = 0; /* 4:4:4 only. Apparently DXVA decoding profiles do not use this flags. */256 p.sps.flags.separate_colour_plane_flag = 0; /* 4:4:4 only. Apparently DXVA decoding profiles do not support this format. */ 257 257 p.sps.flags.gaps_in_frame_num_value_allowed_flag = 1; /// @todo unknown 258 258 p.sps.flags.qpprime_y_zero_transform_bypass_flag = 0; /// @todo unknown … … 281 281 p.sps.reserved1 = 0; 282 282 p.sps.pic_width_in_mbs_minus1 = pPicParams->wFrameWidthInMbsMinus1; 283 p.sps.pic_height_in_map_units_minus1 = pPicParams->wFrameHeightInMbsMinus1; /// @todo Is it? 283 p.sps.pic_height_in_map_units_minus1 = pPicParams->frame_mbs_only_flag /* H.264 (V15) (08/2024) (7.18) */ 284 ? pPicParams->wFrameHeightInMbsMinus1 285 : (pPicParams->wFrameHeightInMbsMinus1 + 1) / 2 - 1; 284 286 p.sps.frame_crop_left_offset = 0; /* not used */ 285 287 p.sps.frame_crop_right_offset = 0; /* not used */ … … 354 356 p.stdH264PictureInfo.frame_num = pPicParams->frame_num; 355 357 p.stdH264PictureInfo.idr_pic_id = 0; /// @todo unknown 356 p.stdH264PictureInfo.PicOrderCnt[0] = pPicParams->CurrFieldOrderCnt[0]; /// @todo Is it?358 p.stdH264PictureInfo.PicOrderCnt[0] = pPicParams->CurrFieldOrderCnt[0]; 357 359 p.stdH264PictureInfo.PicOrderCnt[1] = pPicParams->CurrFieldOrderCnt[1]; 358 360 … … 365 367 p.stdH264ReferenceInfo.FrameNum = pPicParams->frame_num; 366 368 p.stdH264ReferenceInfo.reserved = 0; 367 p.stdH264ReferenceInfo.PicOrderCnt[0] = pPicParams->CurrFieldOrderCnt[0]; /// @todo Is it?369 p.stdH264ReferenceInfo.PicOrderCnt[0] = pPicParams->CurrFieldOrderCnt[0]; 368 370 p.stdH264ReferenceInfo.PicOrderCnt[1] = pPicParams->CurrFieldOrderCnt[1]; 371 372 /* The picture identifier of destination uncompressed surface. */ 373 p.idSurface = pPicParams->CurrPic.Index7Bits; 374 375 if (pPicParams->IntraPicFlag) { 376 p.refFramesCount = 0; 377 } 378 else { 379 /* Reference frame surfaces. */ 380 uint32_t idxRefFrame = 0; 381 for (uint32_t i = 0; i < 16; ++i) { 382 const DXVA_PicEntry_H264& r = pPicParams->RefFrameList[i]; 383 if (r.bPicEntry == 0xFF) 384 continue; 385 386 DxvkRefFrameInfo& refFrameInfo = p.refFrames[idxRefFrame]; 387 refFrameInfo.idSurface = r.Index7Bits; 388 refFrameInfo.longTermReference = r.AssociatedFlag; 389 refFrameInfo.usedForReference = (uint8_t)(pPicParams->UsedForReferenceFlags >> (2 * i)) & 0x3; 390 refFrameInfo.nonExistingFrame = (uint8_t)(pPicParams->NonExistingFrameFlags >> i) & 0x1; 391 refFrameInfo.frame_num = pPicParams->FrameNumList[i]; 392 refFrameInfo.PicOrderCnt[0] = pPicParams->FieldOrderCntList[i][0]; 393 refFrameInfo.PicOrderCnt[1] = pPicParams->FieldOrderCntList[i][1]; 394 395 ++idxRefFrame; 396 } 397 398 p.refFramesCount = idxRefFrame; 399 } 369 400 370 401 return true; -
trunk/src/libs/dxvk-2.3.1/src/dxvk/dxvk_video_decoder.cpp
r108240 r108315 306 306 bindMemoryInfo.memory = m_videoSessionMemory[i].memory(); 307 307 bindMemoryInfo.memoryOffset = m_videoSessionMemory[i].offset(); 308 bindMemoryInfo.memorySize = m_videoSessionMemory[i].length(); 308 /* Use original size instead of m_videoSessionMemory[i].length() because the latter 309 * can be greater and then Vulkan validation complains. 310 */ 311 bindMemoryInfo.memorySize = requirement.memoryRequirements.size; 309 312 bindMemoryInfo.memoryBindIndex = requirement.memoryBindIndex; 310 313 } … … 440 443 #define DXVK_VD_CMP_SPS_FIELDS(_f) \ 441 444 if (sps1._f != sps2._f) { \ 442 Logger::debug(str::format("SPS.", #_f ,": ", sps1._f, " != ",sps2._f)); \445 Logger::debug(str::format("SPS.", #_f ,": ", (int32_t)sps1._f, " != ", (int32_t)sps2._f)); \ 443 446 return false; \ 444 447 } … … 485 488 #define DXVK_VD_CMP_PPS_FIELDS(_f) \ 486 489 if (pps1._f != pps2._f) { \ 487 Logger::debug(str::format("PPS.", #_f ,": ", pps1._f, " != ",pps2._f)); \490 Logger::debug(str::format("PPS.", #_f ,": ", (int32_t)pps1._f, " != ", (int32_t)pps2._f)); \ 488 491 return false; \ 489 492 } … … 625 628 626 629 /* 627 * Reset frames if requested. 628 */ 629 if (parms.nal_unit_type == 5) { /* IDR immediate decoder reset. */ 630 m_DPB.idxCurrentDPBSlot = 0; 631 for (auto &slot: m_DPB.slots) { 632 slot.isReferencePicture = false; 630 * Reset Decoded Picture Buffer if requested. 631 */ 632 if (parms.nal_unit_type == 5) /* IDR, immediate decoder reset. */ 633 m_DPB.reset(); 634 635 /* 636 * Update information about decoded reference frames. 637 */ 638 for (uint32_t i = 0; i < parms.refFramesCount; ++i) { 639 const DxvkRefFrameInfo& r = parms.refFrames[i]; 640 641 /* Update ref frame info if the frame exists and is associated with a DPB slot. 642 * This is always true for valid video streams. 643 */ 644 if (m_DPB.refFrames.find(r.idSurface) != m_DPB.refFrames.end() 645 && m_DPB.refFrames[r.idSurface].dpbSlotIndex != -1) { 646 DxvkRefFrame& refFrame = m_DPB.refFrames[r.idSurface]; 647 refFrame.refFrameInfo = r; 648 649 /* Update stdRefInfo with now known values from DxvkRefFrameInfo */ 650 StdVideoDecodeH264ReferenceInfo& stdRefInfo = m_DPB.slots[refFrame.dpbSlotIndex].stdRefInfo; 651 stdRefInfo.flags.used_for_long_term_reference = r.longTermReference; 652 stdRefInfo.flags.is_non_existing = r.nonExistingFrame; 653 stdRefInfo.FrameNum = r.frame_num; 654 stdRefInfo.PicOrderCnt[0] = r.PicOrderCnt[0]; 655 stdRefInfo.PicOrderCnt[1] = r.PicOrderCnt[1]; 633 656 } 634 657 } … … 637 660 * Begin video decoding. 638 661 */ 662 auto itRefFrame = m_DPB.refFrames.find(parms.idSurface); 663 if (itRefFrame != m_DPB.refFrames.end()) { 664 /* The surface id is being reused for a new decoded picture. Remove old information. */ 665 DxvkRefFrame& refFrame = itRefFrame->second; 666 667 if (refFrame.dpbSlotIndex != -1) 668 m_DPB.slots[refFrame.dpbSlotIndex].deactivate(); 669 670 m_DPB.refFrames.erase(itRefFrame); 671 } 672 673 /* Find a destination DPB slot, i.e. the slot where the reconstructed picture will be placed. */ 674 int32_t dstSlotIndex = -1; 675 676 /* Scan DPB slots for a free slot or a short term reference. */ 677 for (uint32_t i = 0; i < m_DPB.slots.size(); ++i) { 678 DxvkDPBSlot& slot = m_DPB.slots[m_DPB.idxCurrentDPBSlot]; 679 if (slot.isReferencePicture 680 && slot.stdRefInfo.flags.used_for_long_term_reference) { 681 m_DPB.idxCurrentDPBSlot = (m_DPB.idxCurrentDPBSlot + 1) % m_DPB.slots.size(); 682 continue; 683 } 684 685 /* This slot can be (re-)used. */ 686 dstSlotIndex = m_DPB.idxCurrentDPBSlot; 687 688 if (slot.idSurface != DXVK_VIDEO_DECODER_SURFACE_INVALID) { 689 /* If this slot contained a short-term reference, erase it. */ 690 itRefFrame = m_DPB.refFrames.find(slot.idSurface); 691 if (itRefFrame != m_DPB.refFrames.end()) 692 m_DPB.refFrames.erase(itRefFrame); 693 slot.idSurface = DXVK_VIDEO_DECODER_SURFACE_INVALID; 694 } 695 696 break; 697 } 698 699 if (dstSlotIndex == -1) { 700 /* No free slots. This can happen only if entire DPB is occupied by long-term references, 701 * which is probably due to an invalid video stream. 702 * Try to recover by resetting the DPB. 703 */ 704 m_DPB.reset(); 705 dstSlotIndex = 0; 706 } 707 639 708 /* Init the target DPB slot, i.e. the slot where the reconstructed picture will be placed. */ 640 const int32_t dstSlotIndex = m_DPB.idxCurrentDPBSlot; /* Destination DPB slot for the decoded frame. */641 642 709 DxvkDPBSlot &dstDPBSlot = m_DPB.slots[dstSlotIndex]; 643 710 dstDPBSlot.isReferencePicture = false; 644 711 dstDPBSlot.stdRefInfo = parms.stdH264ReferenceInfo; 645 646 /* 647 * Prepare destination DPB image. 712 dstDPBSlot.idSurface = DXVK_VIDEO_DECODER_SURFACE_INVALID; /* Reference picture will be associated later. */ 713 714 /* 715 * Prepare destination DPB image layout. 648 716 */ 649 717 VkImageMemoryBarrier2 barrier = … … 673 741 ctx->emitPipelineBarrier(DxvkCmdBuffer::VDecBuffer, &dependencyInfo); 674 742 675 const int DPBCapacity = m_DPB.slots.size();676 677 /* Reference pictures and the destination slot to be bound for video decoding. */678 std::vector<VkVideoPictureResourceInfoKHR> pictureResourceInfo(DPBCapacity);679 std::vector<VkVideoReferenceSlotInfoKHR> referenceSlotsInfo(DPBCapacity);680 681 for (int i = 0; i < DPBCapacity; ++i) {682 /* Deactivate DPB slots that contain frames with the same FrameNum as the currently decoded frame. */683 if (m_DPB.slots[i].isReferencePicture684 && m_DPB.slots[i].stdRefInfo.FrameNum == dstDPBSlot.stdRefInfo.FrameNum)685 m_DPB.slots[i].isReferencePicture = false;686 687 pictureResourceInfo[i] =688 { VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR };689 pictureResourceInfo[i].codedOffset = { 0, 0 };690 pictureResourceInfo[i].codedExtent = { m_sampleWidth, m_sampleHeight };691 pictureResourceInfo[i].baseArrayLayer = 0; /* "relative to the image subresource range" of the view */692 pictureResourceInfo[i].imageViewBinding = m_DPB.slots[i].imageView->handle();693 694 referenceSlotsInfo[i] =695 { VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR };696 referenceSlotsInfo[i].slotIndex = m_DPB.slots[i].isReferencePicture ? i : -1;697 referenceSlotsInfo[i].pPictureResource = &pictureResourceInfo[i];698 }699 700 VkVideoBeginCodingInfoKHR beginCodingInfo =701 { VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR };702 beginCodingInfo.flags = 0; /* reserved for future use */703 beginCodingInfo.videoSession = m_videoSession->handle();704 beginCodingInfo.videoSessionParameters = m_videoSessionParameters->handle();705 beginCodingInfo.referenceSlotCount = referenceSlotsInfo.size();706 beginCodingInfo.pReferenceSlots = referenceSlotsInfo.data();707 708 #ifdef DEBUG709 Logger::info(str::format("VREF: beginVideoCoding: dstSlotIndex=", dstSlotIndex, " ", m_sampleWidth, "x", m_sampleHeight));710 for (uint32_t i = 0; i < beginCodingInfo.referenceSlotCount; ++i) {711 auto &s = beginCodingInfo.pReferenceSlots[i];712 Logger::info(str::format(" DPB[", i, "]: slotIndex=", s.slotIndex, ", FrameNum=", m_DPB.slots[i].stdRefInfo.FrameNum, ", image=", s.pPictureResource->imageViewBinding, "/", m_DPB.slots[i].imageView->imageHandle()));713 }714 #endif715 716 ctx->beginVideoCodingKHR(&beginCodingInfo);717 718 if (!m_fControlResetSubmitted) {719 VkVideoCodingControlInfoKHR controlInfo =720 { VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR };721 controlInfo.flags = VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR;722 723 ctx->controlVideoCodingKHR(&controlInfo);724 725 m_fControlResetSubmitted = true;726 }727 728 743 if (m_caps.distinctOutputImage) { 729 744 /* 730 * Prepare decode destination .745 * Prepare decode destination layout. 731 746 */ 732 747 barrier.srcStageMask = VK_PIPELINE_STAGE_2_NONE; … … 751 766 } 752 767 768 const uint32_t maxRefSlotsCount = std::min(parms.refFramesCount, (uint32_t)parms.sps.max_num_ref_frames); 769 770 /* Reference pictures and the destination slot to be bound for video decoding. */ 771 std::vector<VkVideoPictureResourceInfoKHR> pictureResourceInfo(maxRefSlotsCount + 1); 772 std::vector<VkVideoReferenceSlotInfoKHR> referenceSlotsInfo(maxRefSlotsCount + 1); 773 774 uint32_t refSlotsCount = 0; /* How many reference frames are actually added to referenceSlotsInfo */ 775 for (uint32_t i = 0; i < maxRefSlotsCount; ++i) { 776 const DxvkRefFrameInfo& r = parms.refFrames[i]; 777 778 itRefFrame = m_DPB.refFrames.find(r.idSurface); 779 if (itRefFrame == m_DPB.refFrames.end()) { 780 /* Skip invalid reference frame. */ 781 continue; 782 } 783 784 const int32_t dpbSlotIndex = itRefFrame->second.dpbSlotIndex; 785 if (dpbSlotIndex == -1) { 786 /* Skip invalid reference frame. */ 787 continue; 788 } 789 790 pictureResourceInfo[refSlotsCount] = 791 { VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR }; 792 pictureResourceInfo[refSlotsCount].codedOffset = { 0, 0 }; 793 pictureResourceInfo[refSlotsCount].codedExtent = { m_sampleWidth, m_sampleHeight }; 794 pictureResourceInfo[refSlotsCount].baseArrayLayer = 0; /* "relative to the image subresource range" of the view */ 795 pictureResourceInfo[refSlotsCount].imageViewBinding = m_DPB.slots[dpbSlotIndex].imageView->handle(); 796 797 referenceSlotsInfo[refSlotsCount] = 798 { VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR }; 799 referenceSlotsInfo[refSlotsCount].slotIndex = dpbSlotIndex; 800 referenceSlotsInfo[refSlotsCount].pPictureResource = &pictureResourceInfo[refSlotsCount]; 801 802 ++refSlotsCount; 803 } 804 805 /* Destination picture. */ 806 pictureResourceInfo[refSlotsCount] = 807 { VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR }; 808 pictureResourceInfo[refSlotsCount].codedOffset = { 0, 0 }; 809 pictureResourceInfo[refSlotsCount].codedExtent = { m_sampleWidth, m_sampleHeight }; 810 pictureResourceInfo[refSlotsCount].baseArrayLayer = 0; /* "relative to the image subresource range" of the view */ 811 pictureResourceInfo[refSlotsCount].imageViewBinding = m_DPB.slots[dstSlotIndex].imageView->handle(); 812 813 referenceSlotsInfo[refSlotsCount] = 814 { VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR }; 815 referenceSlotsInfo[refSlotsCount].slotIndex = -1; 816 referenceSlotsInfo[refSlotsCount].pPictureResource = &pictureResourceInfo[refSlotsCount]; 817 818 /* Begin video coding scope. */ 819 VkVideoBeginCodingInfoKHR beginCodingInfo = 820 { VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR }; 821 beginCodingInfo.flags = 0; /* reserved for future use */ 822 beginCodingInfo.videoSession = m_videoSession->handle(); 823 beginCodingInfo.videoSessionParameters = m_videoSessionParameters->handle(); 824 beginCodingInfo.referenceSlotCount = refSlotsCount + 1; 825 beginCodingInfo.pReferenceSlots = referenceSlotsInfo.data(); 826 827 #ifdef DEBUG 828 Logger::debug(str::format("VREF: beginVideoCoding: dstSlotIndex=", dstSlotIndex, 829 " ", m_sampleWidth, "x", m_sampleHeight)); 830 for (uint32_t i = 0; i < beginCodingInfo.referenceSlotCount; ++i) { 831 auto &s = beginCodingInfo.pReferenceSlots[i]; 832 const DxvkDPBSlot& dpbSlot = m_DPB.slots[s.slotIndex == -1 ? dstSlotIndex : s.slotIndex]; 833 Logger::debug(str::format("VREF: RefSlot[", i, "]: slotIndex=", s.slotIndex, 834 ", FrameNum=", dpbSlot.stdRefInfo.FrameNum, 835 ", image=", dpbSlot.imageView->imageHandle(), 836 ", view=", s.pPictureResource->imageViewBinding)); 837 } 838 #endif 839 840 ctx->beginVideoCodingKHR(&beginCodingInfo); 841 842 if (!m_fControlResetSubmitted) { 843 VkVideoCodingControlInfoKHR controlInfo = 844 { VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR }; 845 controlInfo.flags = VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR; 846 847 ctx->controlVideoCodingKHR(&controlInfo); 848 849 m_fControlResetSubmitted = true; 850 } 851 753 852 /* 754 853 * Setup "active reference pictures." 755 854 */ 756 /* Count the number of reference pictures in the DPB. */ 757 uint32_t refSlotsCount = 0; 758 for (auto &slot: m_DPB.slots) { 759 if (slot.isReferencePicture) 760 ++refSlotsCount; 761 } 762 855 /* Reuse first refFramesCount elements in pictureResourceInfo and referenceSlotsInfo. 856 * Add h264DpbSlotInfo to referenceSlotsInfo. 857 */ 763 858 /* VkVideoReferenceSlotInfoKHR refSlotInfo[idxRefSlot].pNext */ 764 859 std::vector<VkVideoDecodeH264DpbSlotInfoKHR> h264DpbSlotInfo(refSlotsCount); 765 860 766 /* VkVideoReferenceSlotInfoKHR refSlotInfo[idxRefSlot].pPictureResource */ 767 std::vector<VkVideoPictureResourceInfoKHR> refSlotPictureResourceInfo(refSlotsCount); 768 769 /* VkVideoDecodeInfoKHR decodeInfo.pReferenceSlots */ 770 std::vector<VkVideoReferenceSlotInfoKHR> refSlotInfo(refSlotsCount); 771 772 uint32_t idxRefSlot = 0; 773 for (unsigned i = 0; i < m_DPB.slots.size(); ++i) { 774 if (!m_DPB.slots[i].isReferencePicture) { 775 continue; 776 } 777 778 h264DpbSlotInfo[idxRefSlot] = 861 for (uint32_t i = 0; i < refSlotsCount; ++i) { 862 const DxvkRefFrameInfo& r = parms.refFrames[i]; 863 864 StdVideoDecodeH264ReferenceInfo& stdRefInfo = m_DPB.slots[referenceSlotsInfo[i].slotIndex].stdRefInfo; 865 866 h264DpbSlotInfo[i] = 779 867 { VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_KHR }; 780 h264DpbSlotInfo[idxRefSlot].pStdReferenceInfo = &m_DPB.slots[i].stdRefInfo; 781 782 refSlotPictureResourceInfo[idxRefSlot] = 783 { VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR }; 784 refSlotPictureResourceInfo[idxRefSlot].codedOffset = { 0, 0 }; 785 refSlotPictureResourceInfo[idxRefSlot].codedExtent = { m_sampleWidth, m_sampleHeight }; 786 refSlotPictureResourceInfo[idxRefSlot].baseArrayLayer = 0; /* "relative to the image subresource range" of the view */ 787 refSlotPictureResourceInfo[idxRefSlot].imageViewBinding = m_DPB.slots[i].imageView->handle(); 788 789 refSlotInfo[idxRefSlot] = 790 { VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR, &h264DpbSlotInfo[idxRefSlot] }; 791 refSlotInfo[idxRefSlot].slotIndex = i; 792 refSlotInfo[idxRefSlot].pPictureResource = &refSlotPictureResourceInfo[idxRefSlot]; 793 794 ++idxRefSlot; 868 h264DpbSlotInfo[i].pStdReferenceInfo = &stdRefInfo; 869 870 referenceSlotsInfo[i].pNext = &h264DpbSlotInfo[i]; 795 871 } 796 872 … … 845 921 } 846 922 decodeInfo.pSetupReferenceSlot = &dstSlotInfo; 847 decodeInfo.referenceSlotCount = refSlot Info.size();848 decodeInfo.pReferenceSlots = ref SlotInfo.data();923 decodeInfo.referenceSlotCount = refSlotsCount; 924 decodeInfo.pReferenceSlots = referenceSlotsInfo.data(); 849 925 850 926 #ifdef DEBUG 851 Logger:: info(str::format("VREF: decodeVideo: dstSlotIndex=", dstSlotIndex));927 Logger::debug(str::format("VREF: decodeVideo: dstSlotIndex=", dstSlotIndex)); 852 928 for (uint32_t i = 0; i < decodeInfo.referenceSlotCount; ++i) { 853 929 auto &s = decodeInfo.pReferenceSlots[i]; 854 Logger::info(str::format(" ref[", i, "]: slotIndex=", s.slotIndex, ", FrameNum=", h264DpbSlotInfo[i].pStdReferenceInfo->FrameNum, ", image=", s.pPictureResource->imageViewBinding)); 855 } 856 Logger::info(str::format(" dst: slotIndex=", dstSlotInfo.slotIndex, ", FrameNum=", dstH264DpbSlotInfo.pStdReferenceInfo->FrameNum, " ref=", parms.stdH264PictureInfo.flags.is_reference, ", image=", dstSlotInfo.pPictureResource->imageViewBinding)); 930 Logger::debug(str::format("VREF: RefSlot[", i, "]: slotIndex=", s.slotIndex, 931 ", FrameNum=", h264DpbSlotInfo[i].pStdReferenceInfo->FrameNum, 932 ", view=", s.pPictureResource->imageViewBinding)); 933 } 934 Logger::info(str::format("VREF: dst: slotIndex=", dstSlotInfo.slotIndex, 935 ", FrameNum=", dstH264DpbSlotInfo.pStdReferenceInfo->FrameNum, 936 ", is_ref=", parms.stdH264PictureInfo.flags.is_reference, 937 ", view=", dstSlotInfo.pPictureResource->imageViewBinding)); 857 938 #endif 858 939 … … 966 1047 barrier.subresourceRange.layerCount = 1; 967 1048 968 /* Output image iswill be release back to the graphics queue in EndFrame. */1049 /* Output image will be release back to the graphics queue in EndFrame. */ 969 1050 970 1051 dependencyInfo = … … 1093 1174 } 1094 1175 1095 /* Make sure that the involved objects are alive during command buffer execution. */ 1176 /* 1177 * Make sure that the involved objects are alive during command buffer execution. 1178 */ 1096 1179 ctx->trackResource(DxvkAccess::None, m_videoSession); 1097 1180 ctx->trackResource(DxvkAccess::None, m_videoSessionParameters); … … 1107 1190 ctx->trackResource(DxvkAccess::Read, m_bitstreamBuffer.buffer); 1108 1191 1109 /* Keep reference picture. */ 1192 /* 1193 * Keep reference picture. 1194 */ 1110 1195 if (parms.stdH264PictureInfo.flags.is_reference) { 1111 1196 dstDPBSlot.isReferencePicture = true; 1112 m_DPB.idxCurrentDPBSlot = (m_DPB.idxCurrentDPBSlot + 1) % DPBCapacity; 1197 1198 /* Remember the surface id. */ 1199 dstDPBSlot.idSurface = parms.idSurface; 1200 m_DPB.refFrames[parms.idSurface] = { dstSlotIndex, { parms.idSurface } }; 1201 1202 m_DPB.idxCurrentDPBSlot = (m_DPB.idxCurrentDPBSlot + 1) % m_DPB.slots.size(); 1113 1203 } 1114 1204 } -
trunk/src/libs/dxvk-2.3.1/src/dxvk/dxvk_video_decoder.h
r108240 r108315 38 38 class DxvkDevice; 39 39 40 #define DXVK_VIDEO_DECODER_SURFACE_INVALID 0xff 41 40 42 struct DxvkVideoDecodeProfileInfo { 41 43 const char * profileName; … … 60 62 61 63 64 struct DxvkRefFrameInfo { 65 uint8_t idSurface; 66 uint8_t longTermReference : 1; 67 uint8_t usedForReference : 2; 68 uint8_t nonExistingFrame : 1; 69 uint16_t frame_num; 70 int32_t PicOrderCnt[2]; 71 }; 72 73 62 74 struct DxvkVideoDecodeInputParameters { 63 75 StdVideoH264SequenceParameterSet sps; … … 75 87 76 88 uint8_t nal_unit_type; 89 90 uint8_t idSurface; 91 uint32_t refFramesCount; 92 std::array<DxvkRefFrameInfo, 16> refFrames; 77 93 78 94 std::vector<uint8_t> bitstream; … … 208 224 Rc<DxvkImageView> imageView = nullptr; 209 225 uint32_t baseArrayLayer = 0; 210 bool isReferencePicture = 0;226 bool isReferencePicture = false; 211 227 StdVideoDecodeH264ReferenceInfo stdRefInfo = {}; 228 uint8_t idSurface = DXVK_VIDEO_DECODER_SURFACE_INVALID; 229 230 void deactivate() { 231 this->isReferencePicture = false; 232 this->stdRefInfo = {}; 233 this->idSurface = DXVK_VIDEO_DECODER_SURFACE_INVALID; 234 } 235 }; 236 237 /* Information about an uncompressed surface. */ 238 struct DxvkRefFrame { 239 int32_t dpbSlotIndex = -1; 240 DxvkRefFrameInfo refFrameInfo = {}; 212 241 }; 213 242 … … 215 244 std::vector<DxvkDPBSlot> slots; 216 245 int idxCurrentDPBSlot = 0; 246 247 /* Uncompressed surface id (idSurface) -> frame information. */ 248 std::map<uint8_t, DxvkRefFrame> refFrames; 249 250 void reset() { 251 for (auto &slot: this->slots) 252 slot.deactivate(); 253 this->idxCurrentDPBSlot = 0; 254 this->refFrames.clear(); 255 } 217 256 }; 218 257 struct DxvkDPB m_DPB;
Note:
See TracChangeset
for help on using the changeset viewer.