intel / vpl-gpu-rt

MIT License
115 stars 92 forks source link

improve oneVPL's user experience #271

Open dyang23 opened 1 year ago

dyang23 commented 1 year ago

System information

Feature Information

Describe the feature and expected behavior

Compared with NVDEC API, MSDK needs to parse bitstream and determine whether it needs to attach SPS, PPS and other data. This is a little cumbersome for developers, and it is difficult to get started.

Customer usage and impact for this feature

int NvDecoder::Decode(const uint8_t *pData, int nSize, int nFlags, int64_t nTimestamp) { m_nDecodedFrame = 0; m_nDecodedFrameReturned = 0; CUVIDSOURCEDATAPACKET packet = { 0 }; packet.payload = pData; packet.payload_size = nSize; packet.flags = nFlags | CUVID_PKT_TIMESTAMP; packet.timestamp = nTimestamp; if (!pData || nSize == 0) { packet.flags |= CUVID_PKT_ENDOFSTREAM; } NVDEC_API_CALL(cuvidParseVideoData(m_hParser, &packet));

return m_nDecodedFrame;

}

The video bitstream pData is fed into parser using NVDECODE API cuvidParseVideoData() directly.

Application must register a function to handle any sequence
change. Parser triggers pfnSequenceCallback callback for initial sequence header or when it encounters a video format change.

Parser triggers pfnDecodePicture callback when bitstream data for one frame is
ready. In case of field pictures, there may be two decode calls per one display call since two fields make up one frame.

Parser triggers pfnDisplayPicture callback when a frame in display order is ready.

bool MFXFrameConstructor::PrepareFrame(const uint8_t* data, uint32_t size, uint64_t pts) { bool ret = true; MFX_ZERO_MEMORY(mBitstream);

switch (mFrameType) { case MFX_FRAME_AVC: ret = PrepareAVCFrame(data, size, pts); break; case MFX_FRAME_HEVC: ret = PrepareHEVCFrame(data, size, pts); break; default: MC_LOG("Unsupported codec!"); ret = false; break; }

return ret; }



Compared with NVDEC API, MSDK needs to parse bitstream and determine whether it needs to attach SPS, PPS and other data.
This is a little cumbersome for developers, and it is difficult to get started.

**Additional context**
Add any other context or screenshots about the feature request here.
intel-mediadev commented 1 year ago

Auto Created VSMGWL-63154 for further analysis.