VirtualBox

Changeset 108358 in vbox


Ignore:
Timestamp:
Feb 24, 2025 4:36:40 PM (8 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167718
Message:

libs/dxvk-2.3.1: Video decode: cleanups. bugref:10529

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/dxvk-2.3.1/src/dxvk/dxvk_video_decoder.cpp

    r108315 r108358  
    769769
    770770    /* Reference pictures and the destination slot to be bound for video decoding. */
     771    std::vector<VkVideoDecodeH264DpbSlotInfoKHR> h264DpbSlotInfo(maxRefSlotsCount + 1);
    771772    std::vector<VkVideoPictureResourceInfoKHR> pictureResourceInfo(maxRefSlotsCount + 1);
    772773    std::vector<VkVideoReferenceSlotInfoKHR> referenceSlotsInfo(maxRefSlotsCount + 1);
     
    787788        continue;
    788789      }
     790
     791      h264DpbSlotInfo[refSlotsCount] =
     792        { VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_KHR };
     793      h264DpbSlotInfo[refSlotsCount].pStdReferenceInfo = &m_DPB.slots[dpbSlotIndex].stdRefInfo;
    789794
    790795      pictureResourceInfo[refSlotsCount] =
     
    796801
    797802      referenceSlotsInfo[refSlotsCount] =
    798         { VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR };
     803        { VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR, &h264DpbSlotInfo[refSlotsCount] };
    799804      referenceSlotsInfo[refSlotsCount].slotIndex         = dpbSlotIndex;
    800805      referenceSlotsInfo[refSlotsCount].pPictureResource  = &pictureResourceInfo[refSlotsCount];
     
    804809
    805810    /* Destination picture. */
     811    h264DpbSlotInfo[refSlotsCount] =
     812      { VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_KHR };
     813    h264DpbSlotInfo[refSlotsCount].pStdReferenceInfo = &dstDPBSlot.stdRefInfo;
     814
    806815    pictureResourceInfo[refSlotsCount] =
    807816      { VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR };
     
    809818    pictureResourceInfo[refSlotsCount].codedExtent      = { m_sampleWidth, m_sampleHeight };
    810819    pictureResourceInfo[refSlotsCount].baseArrayLayer   = 0; /* "relative to the image subresource range" of the view */
    811     pictureResourceInfo[refSlotsCount].imageViewBinding = m_DPB.slots[dstSlotIndex].imageView->handle();
     820    pictureResourceInfo[refSlotsCount].imageViewBinding = dstDPBSlot.imageView->handle();
    812821
    813822    referenceSlotsInfo[refSlotsCount] =
    814       { VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR };
     823      { VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR, &h264DpbSlotInfo[refSlotsCount] };
    815824    referenceSlotsInfo[refSlotsCount].slotIndex         = -1;
    816825    referenceSlotsInfo[refSlotsCount].pPictureResource  = &pictureResourceInfo[refSlotsCount];
     
    851860
    852861    /*
    853      * Setup "active reference pictures."
    854      */
    855     /* Reuse first refFramesCount elements in pictureResourceInfo and referenceSlotsInfo.
    856      * Add h264DpbSlotInfo to referenceSlotsInfo.
    857      */
    858     /* VkVideoReferenceSlotInfoKHR refSlotInfo[idxRefSlot].pNext */
    859     std::vector<VkVideoDecodeH264DpbSlotInfoKHR> h264DpbSlotInfo(refSlotsCount);
    860 
    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] =
    867         { VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_KHR };
    868       h264DpbSlotInfo[i].pStdReferenceInfo = &stdRefInfo;
    869 
    870       referenceSlotsInfo[i].pNext = &h264DpbSlotInfo[i];
    871     }
    872 
    873     /*
    874862     * Setup video decoding parameters 'decodeInfo' (VkVideoDecodeInfoKHR).
    875      */
     863     *
     864     * Reuse first refFramesCount elements in referenceSlotsInfo as pReferenceSlots for decodeVideo.
     865     * The last element is the destination picture for pSetupReferenceSlot.
     866     */
     867
     868    /* Update the destination DPB slot index. It was set to -1 for beginVideoCoding above. */
     869    referenceSlotsInfo[refSlotsCount].slotIndex = dstSlotIndex;
     870
    876871    /* VkVideoDecodeInfoKHR decodeInfo.pNext */
    877872    VkVideoDecodeH264PictureInfoKHR h264PictureInfo =
     
    880875    h264PictureInfo.sliceCount      = parms.sliceOffsets.size();
    881876    h264PictureInfo.pSliceOffsets   = parms.sliceOffsets.data();
    882 
    883     /* VkVideoReferenceSlotInfoKHR dstSlotInfo.pNext */
    884     VkVideoDecodeH264DpbSlotInfoKHR dstH264DpbSlotInfo =
    885       { VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_KHR };
    886     dstH264DpbSlotInfo.pStdReferenceInfo    = &dstDPBSlot.stdRefInfo;
    887 
    888     /* VkVideoReferenceSlotInfoKHR  dstSlotInfo.pPictureResource */
    889     VkVideoPictureResourceInfoKHR dstPictureResourceInfo =
    890       { VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR };
    891     dstPictureResourceInfo.codedOffset      = { 0, 0 };
    892     dstPictureResourceInfo.codedExtent      = { m_sampleWidth, m_sampleHeight };
    893     dstPictureResourceInfo.baseArrayLayer   = 0; /* "relative to the image subresource range" of the view */
    894     dstPictureResourceInfo.imageViewBinding = dstDPBSlot.imageView->handle();
    895 
    896     /* VkVideoDecodeInfoKHR decodeInfo.pSetupReferenceSlot */
    897     VkVideoReferenceSlotInfoKHR dstSlotInfo =
    898       { VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR, &dstH264DpbSlotInfo };
    899     dstSlotInfo.slotIndex                   = dstSlotIndex;
    900     dstSlotInfo.pPictureResource            = &dstPictureResourceInfo;
    901877
    902878    VkVideoDecodeInfoKHR decodeInfo =
     
    920896      decodeInfo.dstPictureResource.imageViewBinding = dstDPBSlot.imageView->handle();
    921897    }
    922     decodeInfo.pSetupReferenceSlot = &dstSlotInfo;
     898    decodeInfo.pSetupReferenceSlot = &referenceSlotsInfo[refSlotsCount];
    923899    decodeInfo.referenceSlotCount  = refSlotsCount;
    924900    decodeInfo.pReferenceSlots     = referenceSlotsInfo.data();
     
    932908        ", view=", s.pPictureResource->imageViewBinding));
    933909    }
    934     Logger::info(str::format("VREF:  dst: slotIndex=", dstSlotInfo.slotIndex,
    935       ", FrameNum=", dstH264DpbSlotInfo.pStdReferenceInfo->FrameNum,
     910    Logger::info(str::format("VREF:  dst: slotIndex=", dstSlotIndex,
     911      ", FrameNum=", dstDPBSlot.stdRefInfo.FrameNum,
    936912      ", is_ref=", parms.stdH264PictureInfo.flags.is_reference,
    937       ", view=", dstSlotInfo.pPictureResource->imageViewBinding));
     913      ", view=", dstDPBSlot.imageView->handle()));
    938914#endif
    939915
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette