Skip to content

Commit

Permalink
[Decode] VP8 command buffer size calculate
Browse files Browse the repository at this point in the history
This patch is to add VP8 command buffer size calculation.
  • Loading branch information
SteveZIntel authored and intel-mediadev committed Dec 18, 2024
1 parent 3e819f8 commit 9cf488f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ MOS_STATUS Vp8DecodePkt::Init()
DecodeSubPacket *subPacket = m_vp8Pipeline->GetSubPacket(DecodePacketId(m_vp8Pipeline, vp8PictureSubPacketId));
m_picturePkt = dynamic_cast<Vp8DecodePicPkt *>(subPacket);
DECODE_CHK_NULL(m_picturePkt);
DECODE_CHK_STATUS(m_picturePkt->CalculateCommandSize(m_pictureStatesSize, m_picturePatchListSize));

subPacket = m_vp8Pipeline->GetSubPacket(DecodePacketId(m_vp8Pipeline, vp8SliceSubPacketId));
m_slicePkt = dynamic_cast<Vp8DecodeSlcPkt *>(subPacket);
DECODE_CHK_NULL(m_slicePkt);
DECODE_CHK_STATUS(m_slicePkt->CalculateCommandSize(m_sliceStatesSize, m_slicePatchListSize));

m_vp8BasicFeature = dynamic_cast<Vp8BasicFeature *>(m_featureManager->GetFeature(FeatureIDs::basicFeature));
DECODE_CHK_NULL(m_vp8BasicFeature);
Expand Down Expand Up @@ -197,6 +199,35 @@ MOS_STATUS Vp8DecodePkt::Completed(void *mfxStatus, void *rcsStatus, void *statu
return MOS_STATUS_SUCCESS;
}

uint32_t Vp8DecodePkt::CalculateCommandBufferSize()
{
uint32_t commandBufferSize = 0;
commandBufferSize = m_pictureStatesSize + m_sliceStatesSize;

return (commandBufferSize + COMMAND_BUFFER_RESERVED_SPACE);
}

uint32_t Vp8DecodePkt::CalculatePatchListSize()
{
if (!m_osInterface->bUsesPatchList)
{
return 0;
}

uint32_t requestedPatchListSize = 0;
requestedPatchListSize = m_picturePatchListSize + m_slicePatchListSize;

return requestedPatchListSize;
}

MOS_STATUS Vp8DecodePkt::CalculateCommandSize(uint32_t& commandBufferSize, uint32_t& requestedPatchListSize)
{
commandBufferSize = CalculateCommandBufferSize();
requestedPatchListSize = CalculatePatchListSize();

return MOS_STATUS_SUCCESS;
}

MOS_STATUS Vp8DecodePkt::ReadMfxStatus(MediaStatusReport* statusReport, MOS_COMMAND_BUFFER& cmdBuffer)
{
DECODE_FUNC_CALL();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ class Vp8DecodePkt : public CmdPacket, public MediaStatusReportObserver
//!
virtual MOS_STATUS Completed(void *mfxStatus, void *rcsStatus, void *statusReport) override;

//!
//! \brief Calculate Command Size
//!
//! \param [in, out] commandBufferSize
//! requested size
//! \param [in, out] requestedPatchListSize
//! requested size
//! \return MOS_STATUS
//! status
//!
MOS_STATUS CalculateCommandSize(uint32_t &commandBufferSize, uint32_t &requestedPatchListSize) override;

//!
//! \brief Get Packet Name
//! \return std::string
Expand All @@ -89,6 +101,22 @@ class Vp8DecodePkt : public CmdPacket, public MediaStatusReportObserver
}

protected:
//!
//! \brief Calculate Command Buffer Size
//!
//! \return uint32_t
//! Command buffer size calculated
//!
virtual uint32_t CalculateCommandBufferSize();

//!
//! \brief Calculate Patch List Size
//!
//! \return uint32_t
//! Patchlist size calculated
//!
virtual uint32_t CalculatePatchListSize();

void SetPerfTag(CODECHAL_MODE mode, uint16_t picCodingType);

MOS_STATUS SendPrologWithFrameTracking(MOS_COMMAND_BUFFER &cmdBuffer, bool frameTrackingRequested);
Expand Down

0 comments on commit 9cf488f

Please sign in to comment.