From b8e298e35966851eabec222ed4972169e9354fd0 Mon Sep 17 00:00:00 2001 From: XuanJessica Date: Wed, 30 Oct 2024 19:23:46 +0000 Subject: [PATCH 01/15] Update decode default frame rate description --- api/vpl/mfxstructures.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/api/vpl/mfxstructures.h b/api/vpl/mfxstructures.h index 7fe67676..c588e3e8 100644 --- a/api/vpl/mfxstructures.h +++ b/api/vpl/mfxstructures.h @@ -98,7 +98,19 @@ typedef struct { Specify the frame rate with the following formula: FrameRateExtN / FrameRateExtD. For encoding, frame rate must be specified. For decoding, frame rate may be unspecified (FrameRateExtN and FrameRateExtD - are all zeros.) In this case, the frame rate is defaulted to 30 frames per second. + are all zeros.) In this case, the frame rate is defaulted to 0 frames per second, and timestamp will be calculated by 30fps in SDK. + + In decoding process: + + If there is frame rate information in bitstream, MFXVideoDECODE_DecodeHeader will carry actual frame rate in FrameRateExtN and FrameRateExtD parameters. + MFXVideoDECODE_Init, MFXVideoDECODE_Query, MFXVideoDECODE_DecodeFrameAsync and MFXVideoDECODE_GetVideoParam will also carry these values for frame rate. + Timestamp will be calculated by the actual frame rate. + + If there is no frame rate information in bitstream, MFXVideoDECODE_DecodeHeader will assign 0 for frame rate in FrameRateExtN and FrameRateExtD parameters. + MFXVideoDECODE_Init, MFXVideoDECODE_Query, MFXVideoDECODE_DecodeFrameAsync and MFXVideoDECODE_GetVideoParam will also assign 0 for frame rate. Timestamp will be calculated by 30fps. + + If these two parameters are modified through MFXVideoDECODE_Init, then the modified values for frame rate will be used in + MFXVideoDECODE_Query, MFXVideoDECODE_DecodeFrameAsync and MFXVideoDECODE_GetVideoParam. Timestamps will be calculated using the modified values. */ mfxU32 FrameRateExtN; /*!< Frame rate numerator. */ mfxU32 FrameRateExtD; /*!< Frame rate denominator. */ From 64d90565af2113e01991d5cc82aa1efa71d57494 Mon Sep 17 00:00:00 2001 From: "Ma, Caihong" Date: Thu, 31 Oct 2024 01:43:05 +0000 Subject: [PATCH 02/15] Code refinement --- .../encode_hw/av1/linux/base/av1ehw_base_va_lin.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/_studio/mfx_lib/encode_hw/av1/linux/base/av1ehw_base_va_lin.cpp b/_studio/mfx_lib/encode_hw/av1/linux/base/av1ehw_base_va_lin.cpp index cbb29144..29429480 100644 --- a/_studio/mfx_lib/encode_hw/av1/linux/base/av1ehw_base_va_lin.cpp +++ b/_studio/mfx_lib/encode_hw/av1/linux/base/av1ehw_base_va_lin.cpp @@ -114,10 +114,17 @@ void DDI_VA::Query1NoCaps(const FeatureBlocks& /*blocks*/, TPushQ1 Push) m_hw = Glob::VideoCore::Get(strg).GetHWType(); const mfxU16 bitDepth = m_pDefaults->base.GetBitDepthLuma(*m_pDefaults); - const mfxU16 chromaFormat = par.mfx.FrameInfo.ChromaFormat; + const mfxU16 profile = m_pDefaults->base.GetProfile(*m_pDefaults); + const mfxExtCodingOption3* pCO3 = ExtBuffer::Get(m_pDefaults->mvp); + mfxU16 targetChromaFormat = m_pDefaults->base.GetTargetChromaFormatPlus1(*m_pDefaults) - 1; + + if (pCO3) + { + SetIf(targetChromaFormat, pCO3->TargetChromaFormatPlus1, pCO3->TargetChromaFormatPlus1 - 1); + } - MFX_SAFE_CALL(SetDDIID(bitDepth, chromaFormat)); + MFX_SAFE_CALL(SetDDIID(bitDepth, targetChromaFormat)); return MFX_ERR_NONE; }); @@ -389,6 +396,7 @@ mfxStatus DDI_VA::QueryCaps() MFX_CHECK_STS(sts); m_caps.ChromaSupportFlags.fields.i420 = !!(AV(VAConfigAttribRTFormat) & VA_RT_FORMAT_YUV420); + m_caps.ChromaSupportFlags.fields.RGB = !!(AV(VAConfigAttribRTFormat) & VA_RT_FORMAT_RGB32); m_caps.BitDepthSupportFlags.fields.eight_bits = !!(AV(VAConfigAttribRTFormat) & VA_RT_FORMAT_YUV420); m_caps.BitDepthSupportFlags.fields.ten_bits = !!(AV(VAConfigAttribRTFormat) & VA_RT_FORMAT_YUV420_10BPP); From f461a1808f538ac9279c78bb95b5c42930a26235 Mon Sep 17 00:00:00 2001 From: sys_mediadev Date: Fri, 1 Nov 2024 09:35:39 +0800 Subject: [PATCH 03/15] [Media Common] Bump up version to 24.4.3 Auto version bump up --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b4d8f28..0aac6671 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ endif() # Througout this project MFX_VERSION refers to uAPI version and MEDIA_VERSION refers to product version -set(MEDIA_VERSION 24.4.2) # auto-update +set(MEDIA_VERSION 24.4.3) # auto-update set(MEDIA_VERSION_STR "${MEDIA_VERSION}${MEDIA_VERSION_EXTRA}" CACHE STRING "" FORCE) if(CMAKE_SYSTEM_NAME MATCHES WindowsStore) From ad8c18f6be1c77b9e14c45dc57b4296aa2817014 Mon Sep 17 00:00:00 2001 From: "Yuan, Jenny" Date: Fri, 1 Nov 2024 21:14:37 -0700 Subject: [PATCH 04/15] [RT Common] Remove WindowsStore check in makefile Remove WindowsStore check for target system in CMakeLists.txt --- CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0aac6671..e20c2c5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,12 +30,6 @@ endif() set(MEDIA_VERSION 24.4.3) # auto-update set(MEDIA_VERSION_STR "${MEDIA_VERSION}${MEDIA_VERSION_EXTRA}" CACHE STRING "" FORCE) -if(CMAKE_SYSTEM_NAME MATCHES WindowsStore) - if(NOT VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION) - set(VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION $ENV{MINIDDK_VERSION}) - endif() -endif() - set(LANG CXX C ASM) project(mfxgen1 VERSION ${MEDIA_VERSION} From 41a0168ac983e537a72c583cbd1572b7d3ef16bb Mon Sep 17 00:00:00 2001 From: "Zhang, Furong" Date: Fri, 1 Nov 2024 02:43:14 +0000 Subject: [PATCH 05/15] [VP] Added time stamp for AI VFI --- .../include/mfx_vpp_ai_frame_interpolation.h | 7 +++ .../src/mfx_vpp_ai_frame_interpolation.cpp | 56 +++++++++++++------ 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h b/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h index 74bfb5de..a55e01c2 100644 --- a/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h +++ b/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h @@ -126,6 +126,13 @@ class MFXVideoFrameInterpolation // second timestamp using task = std::pair; std::queue m_taskQueue; + + // To calculate the time stamp in mfxFrameData + // The starting time of input frame n for frame [n, n+1] interpolation in units of 90KHz. Divide TimeStamp by 90,000 (90 KHz) to obtain the time in seconds + // The value of MFX_TIMESTAMP_UNKNOWN indicates that there is no time stamp + mfxU64 m_time_stamp_start; + // The time interval of two interpolated frames [n, n+1] in units of 90KHz. Divide TimeStamp by 90,000 (90 KHz) to obtain the time in seconds + mfxU64 m_time_stamp_interval; }; #endif diff --git a/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp b/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp index 35b0f585..623ca88c 100644 --- a/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp +++ b/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp @@ -49,7 +49,9 @@ MFXVideoFrameInterpolation::MFXVideoFrameInterpolation() : m_rgbSurfForFiIn(), m_rgbSurfArray(), m_outSurfForFi(), - m_fiOut() + m_fiOut(), + m_time_stamp_start(0), + m_time_stamp_interval(0) { } @@ -107,6 +109,16 @@ mfxStatus MFXVideoFrameInterpolation::ConfigureFrameRate( m_outStamp = 0; m_outTick = (mfxU16)m_ratio; + m_time_stamp_start = (mfxU64)MFX_TIMESTAMP_UNKNOWN; + // Default to 30fps + m_time_stamp_interval = (mfxU64)((mfxF64) MFX_TIME_STAMP_FREQUENCY / (mfxF64)30); + + if (m_frcRational[VPP_OUT].FrameRateExtN != 0) + { + // Specify the frame rate: FrameRateExtN / FrameRateExtD. + m_time_stamp_interval = (mfxU64)(MFX_TIME_STAMP_FREQUENCY * (((mfxF64)m_frcRational[VPP_OUT].FrameRateExtD / (mfxF64)m_frcRational[VPP_OUT].FrameRateExtN))); + } + return MFX_ERR_NONE; } @@ -369,6 +381,8 @@ mfxStatus MFXVideoFrameInterpolation::UpdateTsAndGetStatus( mfxFrameSurface1* output, mfxStatus* intSts) { + mfxStatus sts = MFX_ERR_NONE; + if (nullptr == input) { // nullptr == input means input sequence reaches its end @@ -376,26 +390,34 @@ mfxStatus MFXVideoFrameInterpolation::UpdateTsAndGetStatus( { return MFX_ERR_MORE_DATA; } - if (m_outStamp == (m_ratio - 1)) m_sequenceEnd = true; - return MFX_ERR_NONE; - } - mfxStatus sts = MFX_ERR_NONE; - - if (m_outStamp == 0) - { - m_inputBkwd.Info = output->Info; - } - else if (m_outStamp == 1) - { - m_inputFwd.Info = output->Info; - - *intSts = MFX_ERR_MORE_SURFACE; + else + { + if (m_outStamp == (m_ratio - 1)) m_sequenceEnd = true; + sts = MFX_ERR_NONE; + } } else { - *intSts = MFX_ERR_MORE_SURFACE; - } + if (m_outStamp == 0) + { + // record the time stamp of input frame [n, n+1] + m_time_stamp_start = input->Data.TimeStamp; + m_inputBkwd.Info = output->Info; + } + else if (m_outStamp == 1) + { + m_inputFwd.Info = output->Info; + *intSts = MFX_ERR_MORE_SURFACE; + } + else + { + *intSts = MFX_ERR_MORE_SURFACE; + } + } + + output->Data.TimeStamp = m_time_stamp_start + m_outStamp * m_time_stamp_interval; + MFX_RETURN(sts); } From a0d69b37b2488e8d273402e1ce671d1124ee33f9 Mon Sep 17 00:00:00 2001 From: chuanli1 Date: Wed, 30 Oct 2024 17:35:01 +0000 Subject: [PATCH 06/15] [Decode] Jpeg decode output format change Since VP does not support IMC3 format, switch IMC3 to NV12 in decode side --- .../shared/umc/codec/jpeg_dec/src/umc_mjpeg_mfx_decode_base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_studio/shared/umc/codec/jpeg_dec/src/umc_mjpeg_mfx_decode_base.cpp b/_studio/shared/umc/codec/jpeg_dec/src/umc_mjpeg_mfx_decode_base.cpp index e0ac26c8..620dfa3d 100644 --- a/_studio/shared/umc/codec/jpeg_dec/src/umc_mjpeg_mfx_decode_base.cpp +++ b/_studio/shared/umc/codec/jpeg_dec/src/umc_mjpeg_mfx_decode_base.cpp @@ -263,7 +263,7 @@ Status MJPEGVideoDecoderBaseMFX::FillVideoParam(mfxVideoParam *par, bool /*full* } else if (par->mfx.JPEGChromaFormat == MFX_CHROMAFORMAT_YUV420) { - par->mfx.FrameInfo.FourCC = MFX_FOURCC_IMC3; + par->mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; } else if (par->mfx.JPEGChromaFormat == MFX_CHROMAFORMAT_YUV422 || par->mfx.JPEGChromaFormat == MFX_CHROMAFORMAT_YUV422H) { From dbbce73842a695c9ba280eb78ca7566db6d631fe Mon Sep 17 00:00:00 2001 From: Jay Yang Date: Mon, 4 Nov 2024 03:38:17 +0000 Subject: [PATCH 07/15] [vpp] fix vfi output out of order --- .../include/mfx_vpp_ai_frame_interpolation.h | 40 +++++++++-- .../src/mfx_vpp_ai_frame_interpolation.cpp | 66 ++++++++++++------- _studio/mfx_lib/vpp/src/mfx_vpp_hw.cpp | 8 +-- 3 files changed, 79 insertions(+), 35 deletions(-) diff --git a/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h b/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h index a55e01c2..0caf4520 100644 --- a/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h +++ b/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h @@ -62,9 +62,7 @@ class MFXVideoFrameInterpolation mfxFrameSurface1* output, mfxStatus* intSts); - mfxStatus ReturnSurface(mfxU32 taskIndex, mfxFrameSurface1* out, mfxMemId internalVidMemId = 0); - - mfxStatus AddTaskQueue(mfxU32 taskIndex); + mfxStatus ReturnSurface(mfxFrameSurface1* out, mfxMemId internalVidMemId = 0); private: mfxStatus ConfigureFrameRate( @@ -86,6 +84,8 @@ class MFXVideoFrameInterpolation mfxStatus DoInterpolation(mfxU16 leftIdx, mfxU16 rightIdx); mfxStatus InterpolateAi(mfxFrameSurface1& bkw, mfxFrameSurface1& fwd, mfxFrameSurface1& out); + mfxStatus AddTaskQueue(bool isSequenceEnd = false); + VideoCORE* m_core; MfxHwVideoProcessing::RateRational m_frcRational[2]; @@ -122,10 +122,36 @@ class MFXVideoFrameInterpolation mfxFrameAllocResponse m_outSurfForFi; mfxFrameSurface1 m_fiOut; - // first taskIndex - // second timestamp - using task = std::pair; - std::queue m_taskQueue; + struct Task + { + mfxU32 taskIndex; + mfxU16 outStamp; + bool isSequenceEnd; + }; + class tsQueue + { + public: + // first taskIndex + // second timestamp + void Enqueue(Task t) + { + std::lock_guard lock(m_mutex); + m_queue.push(t); + } + void Dequeue(Task& t) + { + while (m_queue.empty()) {} + std::lock_guard lock(m_mutex); + t = m_queue.front(); + m_queue.pop(); + } + private: + std::queue m_queue; + std::mutex m_mutex; + } ; + tsQueue m_taskQueue; + mfxU32 m_taskIndex; + std::mutex m_mutex; // To calculate the time stamp in mfxFrameData // The starting time of input frame n for frame [n, n+1] interpolation in units of 90KHz. Divide TimeStamp by 90,000 (90 KHz) to obtain the time in seconds diff --git a/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp b/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp index 623ca88c..bedbfb2b 100644 --- a/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp +++ b/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp @@ -50,6 +50,7 @@ MFXVideoFrameInterpolation::MFXVideoFrameInterpolation() : m_rgbSurfArray(), m_outSurfForFi(), m_fiOut(), + m_taskIndex(0), m_time_stamp_start(0), m_time_stamp_interval(0) { @@ -415,25 +416,24 @@ mfxStatus MFXVideoFrameInterpolation::UpdateTsAndGetStatus( *intSts = MFX_ERR_MORE_SURFACE; } } + AddTaskQueue(m_sequenceEnd); output->Data.TimeStamp = m_time_stamp_start + m_outStamp * m_time_stamp_interval; MFX_RETURN(sts); } -mfxStatus MFXVideoFrameInterpolation::ReturnSurface(mfxU32 taskIndex, mfxFrameSurface1* out, mfxMemId internalVidMemId) +mfxStatus MFXVideoFrameInterpolation::ReturnSurface(mfxFrameSurface1* out, mfxMemId internalVidMemId) { mfxStatus sts = MFX_ERR_NONE; - while (taskIndex != m_taskQueue.front().first) - { - } - mfxU32 scdDecision = 0; - task t = m_taskQueue.front(); + Task t; + m_taskQueue.Dequeue(t); //mfxU16 stamp = m_outStamp; - mfxU16 stamp = t.second; + mfxU16 stamp = t.outStamp; + bool isSequenceEnd = t.isSequenceEnd; if (stamp == 0) { if (m_IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY) @@ -475,7 +475,7 @@ mfxStatus MFXVideoFrameInterpolation::ReturnSurface(mfxU32 taskIndex, mfxFrameSu } } } - else if (stamp == 1) + else if (stamp == 1 && !isSequenceEnd) { if (m_IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY) { @@ -576,7 +576,7 @@ mfxStatus MFXVideoFrameInterpolation::ReturnSurface(mfxU32 taskIndex, mfxFrameSu } } } - else if (stamp >= 2) + else if (stamp >= 2 && !isSequenceEnd) { if (m_IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY) { @@ -607,17 +607,39 @@ mfxStatus MFXVideoFrameInterpolation::ReturnSurface(mfxU32 taskIndex, mfxFrameSu } MFX_CHECK_STS(sts); } + else if (isSequenceEnd) + { + if (m_IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY) + { + sts = m_core->DoFastCopyWrapper(out, MFX_MEMTYPE_SYSTEM_MEMORY, &m_rgbSurfArray[m_ratio], MFX_MEMTYPE_DXVA2_DECODER_TARGET); + } + else + { + if (!internalVidMemId) + { + if (m_vppForFi) + { + MFX_CHECK_STS(m_vppAfterFi->Submit(&m_rgbSurfArray[m_ratio], &m_fiOut)); + MFX_CHECK_STS(m_core->DoFastCopyWrapper( + out, MFX_MEMTYPE_DXVA2_DECODER_TARGET, + &m_fiOut, MFX_MEMTYPE_INTERNAL_FRAME | MFX_MEMTYPE_DXVA2_DECODER_TARGET)); + } + else + { + MFX_CHECK_STS(m_core->DoFastCopyWrapper( + out, MFX_MEMTYPE_DXVA2_DECODER_TARGET, + &m_rgbSurfArray[m_ratio], MFX_MEMTYPE_INTERNAL_FRAME | MFX_MEMTYPE_DXVA2_DECODER_TARGET)); + } + } + else + { + MFX_RETURN(MFX_ERR_UNDEFINED_BEHAVIOR); + } + } + MFX_CHECK_STS(sts); + + } - //stamp++; - //if (stamp == m_outTick) - //{ - // m_outStamp = 0; - // m_inputBkwd.Data.MemId = m_inputFwd.Data.MemId; - // std::swap(m_memIdBkwd, m_memIdFwd); - // m_inputFwd = {}; - // memset(m_output, 0, sizeof(m_output)); - //} - m_taskQueue.pop(); MFX_RETURN(sts); } @@ -759,10 +781,10 @@ mfxStatus MFXVideoFrameInterpolation::SceneChangeDetect(mfxFrameSurface1* input, return sts; } -mfxStatus MFXVideoFrameInterpolation::AddTaskQueue(mfxU32 taskIndex) +mfxStatus MFXVideoFrameInterpolation::AddTaskQueue(bool isSequenceEnd) { - m_taskQueue.push(task(taskIndex, m_outStamp)); - m_outStamp++; + m_taskQueue.Enqueue(Task{ m_taskIndex++, m_outStamp++, isSequenceEnd }); + if (m_outStamp == m_outTick) { m_outStamp = 0; diff --git a/_studio/mfx_lib/vpp/src/mfx_vpp_hw.cpp b/_studio/mfx_lib/vpp/src/mfx_vpp_hw.cpp index dada3be4..ac5b0f6f 100644 --- a/_studio/mfx_lib/vpp/src/mfx_vpp_hw.cpp +++ b/_studio/mfx_lib/vpp/src/mfx_vpp_hw.cpp @@ -1393,10 +1393,6 @@ mfxStatus TaskManager::AssignTask( aux); MFX_CHECK_STS(sts); - if (FRC_AI_INTERPOLATION & m_extMode) - { - m_aiFrameInterpolator->AddTaskQueue(pTask->taskIndex); - } #ifdef MFX_ENABLE_MCTF if (pTask->bMCTF) { @@ -5008,11 +5004,11 @@ mfxStatus VideoVPPHW::QueryTaskRoutine(void *pState, void *pParam, mfxU32 thread { if (SYS_TO_SYS == pHwVpp->m_ioMode || D3D_TO_SYS == pHwVpp->m_ioMode) { - pHwVpp->m_aiVfiFilter->ReturnSurface(pTask->taskIndex, pTask->output.pSurf, pHwVpp->m_internalVidSurf[VPP_OUT].mids[pTask->output.resIdx]); + pHwVpp->m_aiVfiFilter->ReturnSurface(pTask->output.pSurf, pHwVpp->m_internalVidSurf[VPP_OUT].mids[pTask->output.resIdx]); } else { - pHwVpp->m_aiVfiFilter->ReturnSurface(pTask->taskIndex, pTask->output.pSurf, 0); + pHwVpp->m_aiVfiFilter->ReturnSurface(pTask->output.pSurf, 0); } } From f7beedcc45adc5e318c8e13edae0eea5cbe65848 Mon Sep 17 00:00:00 2001 From: Jay Yang Date: Tue, 5 Nov 2024 07:02:02 +0000 Subject: [PATCH 08/15] [vpp] correct vfi output time stamp --- _studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp b/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp index bedbfb2b..65fd96fa 100644 --- a/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp +++ b/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp @@ -416,9 +416,9 @@ mfxStatus MFXVideoFrameInterpolation::UpdateTsAndGetStatus( *intSts = MFX_ERR_MORE_SURFACE; } } - AddTaskQueue(m_sequenceEnd); - output->Data.TimeStamp = m_time_stamp_start + m_outStamp * m_time_stamp_interval; + + AddTaskQueue(m_sequenceEnd); MFX_RETURN(sts); } From ab48dd417ec8a88e67933a16e3d1e8aeaa65e8b8 Mon Sep 17 00:00:00 2001 From: Miroslav Goncharenko Date: Wed, 6 Nov 2024 22:39:13 +0000 Subject: [PATCH 09/15] API: minor formatting fixes --- api/vpl/mfxencodestats.h | 2 +- api/vpl/mfxstructures.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/vpl/mfxencodestats.h b/api/vpl/mfxencodestats.h index ada15502..32c174f6 100644 --- a/api/vpl/mfxencodestats.h +++ b/api/vpl/mfxencodestats.h @@ -455,4 +455,4 @@ MFX_PACK_END() #endif -#endif \ No newline at end of file +#endif \ No newline at end of file diff --git a/api/vpl/mfxstructures.h b/api/vpl/mfxstructures.h index c588e3e8..0ad48165 100644 --- a/api/vpl/mfxstructures.h +++ b/api/vpl/mfxstructures.h @@ -110,7 +110,7 @@ typedef struct { MFXVideoDECODE_Init, MFXVideoDECODE_Query, MFXVideoDECODE_DecodeFrameAsync and MFXVideoDECODE_GetVideoParam will also assign 0 for frame rate. Timestamp will be calculated by 30fps. If these two parameters are modified through MFXVideoDECODE_Init, then the modified values for frame rate will be used in - MFXVideoDECODE_Query, MFXVideoDECODE_DecodeFrameAsync and MFXVideoDECODE_GetVideoParam. Timestamps will be calculated using the modified values. + MFXVideoDECODE_Query, MFXVideoDECODE_DecodeFrameAsync and MFXVideoDECODE_GetVideoParam. Timestamps will be calculated using the modified values. */ mfxU32 FrameRateExtN; /*!< Frame rate numerator. */ mfxU32 FrameRateExtD; /*!< Frame rate denominator. */ @@ -1769,7 +1769,7 @@ typedef struct { @note Not all codecs and implementations support these values. Use the Query API function to check if this feature is supported */ /*! - When rate control method is MFX_RATECONTROL_CBR, MFX_RATECONTROL_VBR, MFX_RATECONTROL_LA, MFX_RATECONTROL_LA_HRD, or MFX_RATECONTROL_QVBR + When rate control method is MFX_RATECONTROL_CBR, MFX_RATECONTROL_VBR, MFX_RATECONTROL_LA, MFX_RATECONTROL_LA_HRD, or MFX_RATECONTROL_QVBR this parameter specifies the maximum bitrate averaged over a sliding window specified by WinBRCSize. */ mfxU16 WinBRCMaxAvgKbps; @@ -5244,7 +5244,7 @@ MFX_PACK_BEGIN_STRUCT_W_PTR() typedef struct { mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODED_QUALITY_INFO_OUTPUT. */ mfxU32 FrameOrder; /*!< Frame display order of encoded picture. */ - mfxU32 MSE[3]; /*!< Frame level mean squared errors (MSE) for Y/U/V channel. + mfxU32 MSE[3]; /*!< Frame level mean squared errors (MSE) for Y/U/V channel. @note MSE is stored in U24.8 format. The calculation formula is: PSNR = 10 * log10(256.0 * (2^bitDepth - 1)^2 / (double)MSE)). */ mfxU32 reserved1[50]; /*!< Reserved for future use. */ mfxHDL reserved2[4]; /*!< Reserved for future use. */ From f78c0087c62e3e19b19768c393080527c4a5964a Mon Sep 17 00:00:00 2001 From: Jay Yang Date: Tue, 5 Nov 2024 08:26:10 +0000 Subject: [PATCH 10/15] [vpp] code refine --- .../include/mfx_vpp_ai_frame_interpolation.h | 10 +++--- .../src/mfx_vpp_ai_frame_interpolation.cpp | 32 ++++++++----------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h b/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h index 0caf4520..4d6a4e6c 100644 --- a/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h +++ b/_studio/mfx_lib/vpp/include/mfx_vpp_ai_frame_interpolation.h @@ -131,27 +131,27 @@ class MFXVideoFrameInterpolation class tsQueue { public: - // first taskIndex - // second timestamp + void Enqueue(Task t) { std::lock_guard lock(m_mutex); m_queue.push(t); + m_cv.notify_one(); } void Dequeue(Task& t) { - while (m_queue.empty()) {} - std::lock_guard lock(m_mutex); + std::unique_lock lock(m_mutex); + m_cv.wait(lock, [this] { return !m_queue.empty(); }); t = m_queue.front(); m_queue.pop(); } private: std::queue m_queue; std::mutex m_mutex; + std::condition_variable m_cv; } ; tsQueue m_taskQueue; mfxU32 m_taskIndex; - std::mutex m_mutex; // To calculate the time stamp in mfxFrameData // The starting time of input frame n for frame [n, n+1] interpolation in units of 90KHz. Divide TimeStamp by 90,000 (90 KHz) to obtain the time in seconds diff --git a/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp b/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp index 65fd96fa..4f324e2b 100644 --- a/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp +++ b/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp @@ -419,7 +419,7 @@ mfxStatus MFXVideoFrameInterpolation::UpdateTsAndGetStatus( output->Data.TimeStamp = m_time_stamp_start + m_outStamp * m_time_stamp_interval; AddTaskQueue(m_sequenceEnd); - + MFX_RETURN(sts); } @@ -612,32 +612,28 @@ mfxStatus MFXVideoFrameInterpolation::ReturnSurface(mfxFrameSurface1* out, mfxMe if (m_IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY) { sts = m_core->DoFastCopyWrapper(out, MFX_MEMTYPE_SYSTEM_MEMORY, &m_rgbSurfArray[m_ratio], MFX_MEMTYPE_DXVA2_DECODER_TARGET); + MFX_CHECK_STS(sts); } else { - if (!internalVidMemId) + MFX_CHECK(!internalVidMemId, MFX_ERR_UNDEFINED_BEHAVIOR); + if (m_vppForFi) { - if (m_vppForFi) - { - MFX_CHECK_STS(m_vppAfterFi->Submit(&m_rgbSurfArray[m_ratio], &m_fiOut)); - MFX_CHECK_STS(m_core->DoFastCopyWrapper( - out, MFX_MEMTYPE_DXVA2_DECODER_TARGET, - &m_fiOut, MFX_MEMTYPE_INTERNAL_FRAME | MFX_MEMTYPE_DXVA2_DECODER_TARGET)); - } - else - { - MFX_CHECK_STS(m_core->DoFastCopyWrapper( - out, MFX_MEMTYPE_DXVA2_DECODER_TARGET, - &m_rgbSurfArray[m_ratio], MFX_MEMTYPE_INTERNAL_FRAME | MFX_MEMTYPE_DXVA2_DECODER_TARGET)); - } + sts = m_vppAfterFi->Submit(&m_rgbSurfArray[m_ratio], &m_fiOut); + MFX_CHECK_STS(sts); + sts = m_core->DoFastCopyWrapper( + out, MFX_MEMTYPE_DXVA2_DECODER_TARGET, + &m_fiOut, MFX_MEMTYPE_INTERNAL_FRAME | MFX_MEMTYPE_DXVA2_DECODER_TARGET); + MFX_CHECK_STS(sts); } else { - MFX_RETURN(MFX_ERR_UNDEFINED_BEHAVIOR); + sts = m_core->DoFastCopyWrapper( + out, MFX_MEMTYPE_DXVA2_DECODER_TARGET, + &m_rgbSurfArray[m_ratio], MFX_MEMTYPE_INTERNAL_FRAME | MFX_MEMTYPE_DXVA2_DECODER_TARGET); + MFX_CHECK_STS(sts); } } - MFX_CHECK_STS(sts); - } MFX_RETURN(sts); From 80a3049438379977c21d9e0c1bf624432a5236f7 Mon Sep 17 00:00:00 2001 From: "Zhang, Furong" Date: Thu, 7 Nov 2024 07:58:15 +0000 Subject: [PATCH 11/15] [VP] ARL-H xmx enabling --- .../mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp b/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp index 4f324e2b..d78b7b97 100644 --- a/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp +++ b/_studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp @@ -130,10 +130,14 @@ mfxStatus MFXVideoFrameInterpolation::InitFrameInterpolator(VideoCORE* core, con MFX_CHECK(pD3d11, MFX_ERR_NULL_PTR); // Init xeAIVfiConfig config = { - outInfo.Width, outInfo.Height, + outInfo.Width, + outInfo.Height, (mfxU32)core->GetHWType(), pD3d11->GetD3D11Device(), - pD3d11->GetD3D11DeviceContext(), DXGI_FORMAT_R8G8B8A8_UNORM }; + pD3d11->GetD3D11DeviceContext(), + DXGI_FORMAT_R8G8B8A8_UNORM, + core->GetHWDeviceId() + }; xeAIVfiStatus xeSts = m_aiIntp.Init(config); if (xeSts != XE_AIVFI_SUCCESS) MFX_RETURN(MFX_ERR_UNKNOWN); From 1501585fea24c601d363333afa8d714572538bfe Mon Sep 17 00:00:00 2001 From: "Zhang, Furong" Date: Thu, 7 Nov 2024 00:39:06 +0000 Subject: [PATCH 12/15] Add super resolution mode and algorithm --- api/vpl/mfxstructures.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/api/vpl/mfxstructures.h b/api/vpl/mfxstructures.h index 0ad48165..0e67f943 100644 --- a/api/vpl/mfxstructures.h +++ b/api/vpl/mfxstructures.h @@ -5149,8 +5149,22 @@ MFX_PACK_END() typedef enum { MFX_AI_SUPER_RESOLUTION_MODE_DISABLED = 0, /*!< Super Resolution is disabled.*/ MFX_AI_SUPER_RESOLUTION_MODE_DEFAULT = 1, /*!< Default super resolution mode. The library selects the most appropriate super resolution mode.*/ +#ifdef ONEVPL_EXPERIMENTAL + MFX_AI_SUPER_RESOLUTION_MODE_SHARPEN = 2, /*!< In this mode, super Resolution is optimized or trained to have high sharpness level. This mode is recommended to be used in video conference(camera + noise) or similar usage scenario.*/ + MFX_AI_SUPER_RESOLUTION_MODE_ARTIFACTREMOVAL= 3, /*!< In this mode, Super Resolution is optimized or trained to remove encoding artifacts with medium sharpness level. This mode is recommended to be used in + video surveillance or similar usage scenarios which may have camera noise and encoding artifacts due to limited network bandwidth.*/ +#endif } mfxAISuperResolutionMode; +#ifdef ONEVPL_EXPERIMENTAL +typedef enum { + MFX_AI_SUPER_RESOLUTION_ALGORITHM_DEFAULT = 0, /*!< Super Resolution algorithm by default. The library selects the most appropriate super resolution algorithm.*/ + MFX_AI_SUPER_RESOLUTION_ALGORITHM_1 = 1, /*!< Super Resolution algorithm1.*/ + MFX_AI_SUPER_RESOLUTION_ALGORITHM_2 = 2, /*!< Super Resolution algorithm2, MFX_AI_SUPER_RESOLUTION_ALGORITHM_2 video quality is expected to be better than MFX_AI_SUPER_RESOLUTION_ALGORITHM_1.*/ +} mfxAISuperResolutionAlgorithm; +#endif + MFX_PACK_BEGIN_STRUCT_W_PTR() /*! A hint structure that configures AI based super resolution VPP filter. @@ -5166,8 +5180,12 @@ MFX_PACK_BEGIN_STRUCT_W_PTR() typedef struct { mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION.*/ mfxAISuperResolutionMode SRMode; /*!< Indicates Super Resolution Mode. mfxAISuperResolutionMode enumerator.*/ - +#ifdef ONEVPL_EXPERIMENTAL + mfxAISuperResolutionAlgorithm SRAlgorithm; /*!< Indicates Super Resolution Algorithm. mfxAISuperResolutionAlgorithm enumerator.*/ + mfxU32 reserved1[15]; /*!< Reserved for future use. */ +#else mfxU32 reserved1[16]; /*!< Reserved for future use. */ +#endif mfxHDL reserved2[4]; /*!< Reserved for future use. */ } mfxExtVPPAISuperResolution; MFX_PACK_END() From 5de43224643d090ebf714c3dd793ea3dd653b9ac Mon Sep 17 00:00:00 2001 From: chuanli1 Date: Fri, 1 Nov 2024 18:07:17 +0000 Subject: [PATCH 13/15] [Deode] VPL Trace event enhancement --- .../decode/av1/src/mfx_av1_dec_decode.cpp | 14 ++ .../decode/h264/src/mfx_h264_dec_decode.cpp | 24 ++ .../decode/h265/src/mfx_h265_dec_decode.cpp | 23 ++ .../decode/mjpeg/src/mfx_mjpeg_dec_decode.cpp | 20 ++ .../decode/vp9/src/mfx_vp9_dec_decode_hw.cpp | 18 ++ .../decode/vvc/src/mfx_vvc_dec_decode.cpp | 20 +- .../mfx_lib/shared/src/libmfxsw_decode.cpp | 4 +- .../mfx_lib/shared/src/libmfxsw_decode_vp.cpp | 20 ++ _studio/shared/include/libmfx_core.h | 2 + _studio/shared/include/mfx_trace.h | 18 +- _studio/shared/mfx_trace/IntelMediaSDK.man | 230 +++++++++++++++++- _studio/shared/src/mfx_umc_alloc_wrapper.cpp | 2 + 12 files changed, 389 insertions(+), 6 deletions(-) diff --git a/_studio/mfx_lib/decode/av1/src/mfx_av1_dec_decode.cpp b/_studio/mfx_lib/decode/av1/src/mfx_av1_dec_decode.cpp index 89f26691..fcdb6b98 100755 --- a/_studio/mfx_lib/decode/av1/src/mfx_av1_dec_decode.cpp +++ b/_studio/mfx_lib/decode/av1/src/mfx_av1_dec_decode.cpp @@ -464,6 +464,9 @@ mfxStatus VideoDECODEAV1::Reset(mfxVideoParam* par) { std::lock_guard guard(m_guard); + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + MFX_CHECK_NULL_PTR1(par); MFX_CHECK(m_is_init, MFX_ERR_NOT_INITIALIZED); @@ -506,6 +509,8 @@ mfxStatus VideoDECODEAV1::Reset(mfxVideoParam* par) m_decoder->SetInFrameRate(m_in_framerate); + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -700,6 +705,9 @@ mfxStatus VideoDECODEAV1::DecodeHeader(VideoCORE* core, mfxBitstream* bs, mfxVid mfxStatus VideoDECODEAV1::GetVideoParam(mfxVideoParam *par) { + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + MFX_CHECK_NULL_PTR1(par); MFX_CHECK(m_decoder, MFX_ERR_NOT_INITIALIZED); @@ -758,14 +766,20 @@ mfxStatus VideoDECODEAV1::GetVideoParam(mfxVideoParam *par) break; } + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } mfxStatus VideoDECODEAV1::GetDecodeStat(mfxDecodeStat* stat) { + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + MFX_CHECK_NULL_PTR1(stat); + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(stat ? stat->NumFrame : 0, MFX_ERR_NONE)); + return MFX_ERR_NONE; } diff --git a/_studio/mfx_lib/decode/h264/src/mfx_h264_dec_decode.cpp b/_studio/mfx_lib/decode/h264/src/mfx_h264_dec_decode.cpp index f0580f12..02aa5be5 100644 --- a/_studio/mfx_lib/decode/h264/src/mfx_h264_dec_decode.cpp +++ b/_studio/mfx_lib/decode/h264/src/mfx_h264_dec_decode.cpp @@ -552,6 +552,9 @@ mfxStatus VideoDECODEH264::Reset(mfxVideoParam *par) UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR1(par); @@ -625,6 +628,8 @@ mfxStatus VideoDECODEH264::Reset(mfxVideoParam *par) } #endif //MFX_DEC_VIDEO_POSTPROCESS_DISABLE + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -673,6 +678,9 @@ mfxStatus VideoDECODEH264::GetVideoParam(mfxVideoParam *par) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR1(par); @@ -799,6 +807,9 @@ mfxStatus VideoDECODEH264::GetVideoParam(mfxVideoParam *par) } } + + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -986,6 +997,8 @@ mfxStatus VideoDECODEH264::GetDecodeStat(mfxDecodeStat *stat) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR1(stat); @@ -1007,6 +1020,9 @@ mfxStatus VideoDECODEH264::GetDecodeStat(mfxDecodeStat *stat) m_stat.reserved[0] = m_pH264VideoDecoder->IsExistHeadersError() ? 1 : 0; *stat = m_stat; + + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(stat ? stat->NumFrame : 0, MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -1702,6 +1718,8 @@ mfxStatus VideoDECODEH264::GetPayload( mfxU64 *ts, mfxPayload *payload ) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(payload)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR3(ts, payload, payload->Data); @@ -1729,6 +1747,8 @@ mfxStatus VideoDECODEH264::GetPayload( mfxU64 *ts, mfxPayload *payload ) *ts = MFX_TIME_STAMP_INVALID; } + TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -1764,6 +1784,8 @@ mfxStatus VideoDECODEH264::SetSkipMode(mfxSkipMode mode) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(mode)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); int32_t test_num = 0; @@ -1791,6 +1813,8 @@ mfxStatus VideoDECODEH264::SetSkipMode(mfxSkipMode mode) m_pH264VideoDecoder->ChangeVideoDecodingSpeed(num); + TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(num ? MFX_WRN_VALUE_NOT_CHANGED : MFX_ERR_NONE)); + return test_num == num ? MFX_WRN_VALUE_NOT_CHANGED : MFX_ERR_NONE; } diff --git a/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp b/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp index 75ca33c6..f49b07f3 100644 --- a/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp +++ b/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp @@ -393,6 +393,9 @@ mfxStatus VideoDECODEH265::Reset(mfxVideoParam *par) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); m_globalTask = false; @@ -434,6 +437,8 @@ mfxStatus VideoDECODEH265::Reset(mfxVideoParam *par) MFX_CHECK(!isNeedChangeVideoParamWarning, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM); + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -485,6 +490,9 @@ mfxStatus VideoDECODEH265::GetVideoParam(mfxVideoParam *par) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR1(par); @@ -569,6 +577,8 @@ mfxStatus VideoDECODEH265::GetVideoParam(mfxVideoParam *par) } } + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -765,6 +775,8 @@ mfxStatus VideoDECODEH265::GetDecodeStat(mfxDecodeStat *stat) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR1(stat); @@ -783,6 +795,9 @@ mfxStatus VideoDECODEH265::GetDecodeStat(mfxDecodeStat *stat) } *stat = m_stat; + + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(stat ? stat->NumFrame : 0)); + return MFX_ERR_NONE; } @@ -1448,6 +1463,8 @@ mfxStatus VideoDECODEH265::GetPayload( mfxU64 *ts, mfxPayload *payload ) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(payload)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR3(ts, payload, payload->Data); @@ -1477,6 +1494,8 @@ mfxStatus VideoDECODEH265::GetPayload( mfxU64 *ts, mfxPayload *payload ) *ts = MFX_TIME_STAMP_INVALID; } + TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -1500,6 +1519,8 @@ mfxStatus VideoDECODEH265::SetSkipMode(mfxSkipMode mode) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(mode)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); int32_t test_num = 0; @@ -1526,6 +1547,8 @@ mfxStatus VideoDECODEH265::SetSkipMode(mfxSkipMode mode) m_pH265VideoDecoder->ChangeVideoDecodingSpeed(num); + TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(test_num == num ? MFX_WRN_VALUE_NOT_CHANGED : MFX_ERR_NONE)); + MFX_CHECK(test_num != num, MFX_WRN_VALUE_NOT_CHANGED); return MFX_ERR_NONE; } diff --git a/_studio/mfx_lib/decode/mjpeg/src/mfx_mjpeg_dec_decode.cpp b/_studio/mfx_lib/decode/mjpeg/src/mfx_mjpeg_dec_decode.cpp index 87f16b3a..02c7f8c6 100644 --- a/_studio/mfx_lib/decode/mjpeg/src/mfx_mjpeg_dec_decode.cpp +++ b/_studio/mfx_lib/decode/mjpeg/src/mfx_mjpeg_dec_decode.cpp @@ -297,6 +297,9 @@ mfxStatus VideoDECODEMJPEG::QueryImplsDescription( mfxStatus VideoDECODEMJPEG::Reset(mfxVideoParam *par) { + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR1(par); @@ -347,6 +350,8 @@ mfxStatus VideoDECODEMJPEG::Reset(mfxVideoParam *par) MFX_RETURN(MFX_WRN_PARTIAL_ACCELERATION); } + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -624,6 +629,8 @@ mfxStatus VideoDECODEMJPEG::QueryIOSurfInternal(VideoCORE *core, mfxVideoParam * mfxStatus VideoDECODEMJPEG::GetDecodeStat(mfxDecodeStat *stat) { + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + if (!m_isInit) MFX_RETURN(MFX_ERR_NOT_INITIALIZED); @@ -633,6 +640,9 @@ mfxStatus VideoDECODEMJPEG::GetDecodeStat(mfxDecodeStat *stat) decoder->m_stat.NumError = 0; *stat = decoder->m_stat; + + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(stat ? stat->NumFrame : 0, MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -909,15 +919,19 @@ mfxStatus VideoDECODEMJPEG::GetUserData(mfxU8 *ud, mfxU32 *sz, mfxU64 *ts) mfxStatus VideoDECODEMJPEG::GetPayload( mfxU64 *ts, mfxPayload *payload ) { + TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(payload)); if (!m_isInit) MFX_RETURN(MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR3(ts, payload, payload->Data); + TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_UNSUPPORTED)); + MFX_RETURN(MFX_ERR_UNSUPPORTED); } mfxStatus VideoDECODEMJPEG::SetSkipMode(mfxSkipMode mode) { + TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(mode)); // check error(s) if (!m_isInit) { @@ -947,6 +961,7 @@ mfxStatus VideoDECODEMJPEG::SetSkipMode(mfxSkipMode mode) m_skipRate = 0; break; } + TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); return MFX_ERR_NONE; @@ -1422,6 +1437,9 @@ VideoDECODEMJPEGBase::VideoDECODEMJPEGBase() mfxStatus VideoDECODEMJPEGBase::GetVideoParam(mfxVideoParam *par, UMC::MJPEGVideoDecoderBaseMFX * mjpegDecoder) { + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + mfxExtJPEGQuantTables* jpegQT = (mfxExtJPEGQuantTables*) mfx::GetExtBuffer( par->ExtParam, par->NumExtParam, MFX_EXTBUFF_JPEG_QT ); mfxExtJPEGHuffmanTables* jpegHT = (mfxExtJPEGHuffmanTables*) mfx::GetExtBuffer( par->ExtParam, par->NumExtParam, MFX_EXTBUFF_JPEG_HUFFMAN ); @@ -1444,6 +1462,8 @@ mfxStatus VideoDECODEMJPEGBase::GetVideoParam(mfxVideoParam *par, UMC::MJPEGVide return ConvertUMCStatusToMfx(umcRes); } + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } diff --git a/_studio/mfx_lib/decode/vp9/src/mfx_vp9_dec_decode_hw.cpp b/_studio/mfx_lib/decode/vp9/src/mfx_vp9_dec_decode_hw.cpp index 2d0117a1..3c18a195 100644 --- a/_studio/mfx_lib/decode/vp9/src/mfx_vp9_dec_decode_hw.cpp +++ b/_studio/mfx_lib/decode/vp9/src/mfx_vp9_dec_decode_hw.cpp @@ -536,6 +536,9 @@ mfxStatus VideoDECODEVP9_HW::Reset(mfxVideoParam *par) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR1(par); @@ -580,6 +583,8 @@ mfxStatus VideoDECODEVP9_HW::Reset(mfxVideoParam *par) (mfxF64) m_vPar.mfx.FrameInfo.FrameRateExtD / m_vPar.mfx.FrameInfo.FrameRateExtN : (mfxF64) 1 / 30; m_index = 0; + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -773,6 +778,9 @@ mfxStatus VideoDECODEVP9_HW::GetVideoParam(mfxVideoParam *par) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR1(par); @@ -795,11 +803,15 @@ mfxStatus VideoDECODEVP9_HW::GetVideoParam(mfxVideoParam *par) } #endif + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } mfxStatus VideoDECODEVP9_HW::GetDecodeStat(mfxDecodeStat *pStat) { + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); MFX_CHECK_NULL_PTR1(pStat); @@ -809,6 +821,8 @@ mfxStatus VideoDECODEVP9_HW::GetDecodeStat(mfxDecodeStat *pStat) *pStat = m_stat; + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(pStat ? pStat->NumFrame : 0)); + return MFX_ERR_NONE; } @@ -849,8 +863,12 @@ mfxStatus VideoDECODEVP9_HW::SetSkipMode(mfxSkipMode /*mode*/) { UMC::AutomaticUMCMutex guard(m_mGuard); + TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); + TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } diff --git a/_studio/mfx_lib/decode/vvc/src/mfx_vvc_dec_decode.cpp b/_studio/mfx_lib/decode/vvc/src/mfx_vvc_dec_decode.cpp index 6e7942a8..9c65503b 100644 --- a/_studio/mfx_lib/decode/vvc/src/mfx_vvc_dec_decode.cpp +++ b/_studio/mfx_lib/decode/vvc/src/mfx_vvc_dec_decode.cpp @@ -231,11 +231,16 @@ mfxStatus VideoDECODEVVC::Reset(mfxVideoParam *par) std::lock_guard guard(m_guard); + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); m_decoder->Reset(); m_decoder->SetVideoParams(*par); + TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -385,18 +390,27 @@ mfxStatus VideoDECODEVVC::DecodeHeader(VideoCORE *core, mfxBitstream *bs, mfxVid mfxStatus VideoDECODEVVC::GetVideoParam(mfxVideoParam *par) { + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0, + par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + MFX_CHECK_NULL_PTR1(par); MFX_CHECK(m_decoder, MFX_ERR_NOT_INITIALIZED); std::lock_guard guard(m_guard); - return MFX_ERR_NONE; + TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + + return MFX_ERR_NONE; } mfxStatus VideoDECODEVVC::GetDecodeStat(mfxDecodeStat *stat) { + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + MFX_CHECK_NULL_PTR1(stat); + TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(stat ? stat->NumFrame : 0)); + return MFX_ERR_NONE; } @@ -863,8 +877,12 @@ mfxStatus VideoDECODEVVC::SetSkipMode(mfxSkipMode /*mode*/) { std::lock_guard guard(m_guard); + TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); + TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } diff --git a/_studio/mfx_lib/shared/src/libmfxsw_decode.cpp b/_studio/mfx_lib/shared/src/libmfxsw_decode.cpp index cf53c685..e8fb8cfd 100644 --- a/_studio/mfx_lib/shared/src/libmfxsw_decode.cpp +++ b/_studio/mfx_lib/shared/src/libmfxsw_decode.cpp @@ -435,7 +435,7 @@ mfxStatus MFXVideoDECODE_Init(mfxSession session, mfxVideoParam *par) PERF_UTILITY_AUTO(__FUNCTION__, PERF_LEVEL_API); InitMfxLogging(); TRACE_EVENT(MFX_TRACE_API_DECODE_INIT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(session, par ? par->mfx.FrameInfo.Width : 0, - par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0)); + par ? par->mfx.FrameInfo.Height : 0, par ? par->AsyncDepth : 0, par ? par->mfx.DecodedOrder : 0, par ? par->mfx.CodecId : 0)); mfxStatus mfxRes; @@ -516,7 +516,7 @@ mfxStatus MFXVideoDECODE_DecodeFrameAsync(mfxSession session, mfxBitstream *bs, { mfxStatus mfxRes; PERF_UTILITY_AUTO(__FUNCTION__, PERF_LEVEL_API); - TRACE_EVENT(MFX_TRACE_API_DECODE_FRAME_ASYNC_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(session, surface_work, bs ? bs->DataLength : 0)); + TRACE_EVENT(MFX_TRACE_API_DECODE_FRAME_ASYNC_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(session, surface_work, bs ? bs->DataLength : 0, bs ? bs->DataFlag : 0)); MFX_AUTO_LTRACE(MFX_TRACE_LEVEL_API, __FUNCTION__); MFX_LTRACE_1(MFX_TRACE_LEVEL_API_PARAMS, "In: session = ", MFX_TRACE_FORMAT_P, session); diff --git a/_studio/mfx_lib/shared/src/libmfxsw_decode_vp.cpp b/_studio/mfx_lib/shared/src/libmfxsw_decode_vp.cpp index ec07c4c3..787ed836 100644 --- a/_studio/mfx_lib/shared/src/libmfxsw_decode_vp.cpp +++ b/_studio/mfx_lib/shared/src/libmfxsw_decode_vp.cpp @@ -51,6 +51,9 @@ class DVP_impl : public _mfxSession::DVP_base mfxStatus MFXVideoDECODE_VPP_Init(mfxSession session, mfxVideoParam* decode_par, mfxVideoChannelParam** vpp_par_array, mfxU32 num_channel_par) { + + TRACE_EVENT(MFX_TRACE_API_DECODE_VPP_INIT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + MFX_CHECK(session, MFX_ERR_INVALID_HANDLE); MFX_CHECK_NULL_PTR2(decode_par, vpp_par_array); @@ -351,6 +354,8 @@ mfxStatus MFXVideoDECODE_VPP_Init(mfxSession session, mfxVideoParam* decode_par, MFX_RETURN(MFX_ERR_UNKNOWN); } + TRACE_EVENT(MFX_TRACE_API_DECODE_VPP_INIT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -398,6 +403,9 @@ class RAIISurfaceArray mfxStatus MFXVideoDECODE_VPP_DecodeFrameAsync(mfxSession session, mfxBitstream* bs, mfxU32* skip_channels, mfxU32 num_skip_channels, mfxSurfaceArray** surf_array_out) { + + TRACE_EVENT(MFX_TRACE_API_DECODE_VPP_FRAMEASYNC_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + MFX_CHECK(session, MFX_ERR_INVALID_HANDLE); MFX_CHECK(surf_array_out, MFX_ERR_NULL_PTR); if (num_skip_channels != 0) @@ -630,6 +638,8 @@ mfxStatus MFXVideoDECODE_VPP_DecodeFrameAsync(mfxSession session, mfxBitstream* mfxRes = MFX_ERR_UNKNOWN; } + TRACE_EVENT(MFX_TRACE_API_DECODE_VPP_FRAMEASYNC_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(mfxRes)); + return mfxRes; } @@ -651,6 +661,9 @@ static inline bool CmpFrameInfoIgnoreCrops(const mfxFrameInfo& l, const mfxFrame mfxStatus MFXVideoDECODE_VPP_Reset(mfxSession session, mfxVideoParam* decode_par, mfxVideoChannelParam** vpp_par_array, mfxU32 num_channel_par) { + + TRACE_EVENT(MFX_TRACE_API_DECODE_VPP_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + MFX_CHECK(session, MFX_ERR_INVALID_HANDLE); //check if we need full reset @@ -707,6 +720,8 @@ mfxStatus MFXVideoDECODE_VPP_Reset(mfxSession session, mfxVideoParam* decode_par //MFX_SAFE_CALL(session->m_pDVP->VPPs[id]->Reset(&VppParams)); } + TRACE_EVENT(MFX_TRACE_API_DECODE_VPP_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE)); + return MFX_ERR_NONE; } @@ -718,6 +733,9 @@ static void UpdateStatus(mfxStatus& res, const mfxStatus cur) mfxStatus MFXVideoDECODE_VPP_Close(mfxSession session) { + + TRACE_EVENT(MFX_TRACE_API_DECODE_VPP_CLOSE_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0)); + MFX_CHECK(session, MFX_ERR_INVALID_HANDLE); MFX_CHECK(session->m_pScheduler, MFX_ERR_NOT_INITIALIZED); @@ -746,6 +764,8 @@ mfxStatus MFXVideoDECODE_VPP_Close(mfxSession session) UpdateStatus(res, MFX_ERR_UNKNOWN); } + TRACE_EVENT(MFX_TRACE_API_DECODE_VPP_CLOSE_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(res)); + return res; } diff --git a/_studio/shared/include/libmfx_core.h b/_studio/shared/include/libmfx_core.h index 65a19012..515059d7 100644 --- a/_studio/shared/include/libmfx_core.h +++ b/_studio/shared/include/libmfx_core.h @@ -677,6 +677,8 @@ class SurfaceCache output_surface = &m_cached_surfaces.back(); + TRACE_EVENT(MFX_TRACE_API_GETSURFACE_TASK, EVENT_TYPE_INFO, TR_KEY_INTERNAl, make_event_data(m_cached_surfaces.size())); + return MFX_ERR_NONE; } diff --git a/_studio/shared/include/mfx_trace.h b/_studio/shared/include/mfx_trace.h index 792aece3..7c5b83dd 100644 --- a/_studio/shared/include/mfx_trace.h +++ b/_studio/shared/include/mfx_trace.h @@ -145,6 +145,21 @@ enum mfxTraceTaskType VA_TRACE_API_HEVC_DPBPARAMETER_TASK, MFX_TRACE_PIPELINE_STICKER_TASK, VPLMessage_TASK, + MFX_TRACE_API_DECODE_RESET_TASK, + MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, + MFX_TRACE_API_DECODE_GETSTAT_TASK, + MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, + MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, + MFX_TRACE_API_GETSURFACE_TASK, + MFX_TRACE_API_DECODE_VPP_INIT_TASK, + MFX_TRACE_API_DECODE_VPP_CLOSE_TASK, + MFX_TRACE_API_DECODE_VPP_RESET_TASK, + MFX_TRACE_API_DECODE_VPP_FRAMEASYNC_TASK, + MFX_TRACE_API_DOFASTCOPY_WRAPPER_TASK, + MFX_TRACE_API_ADD_TASK, + MFX_TRACE_API_GET_TASK, + MFX_TRACE_API_QUERY_TASK, + MFX_TRACE_API_MARK_TASK, }; // list of output modes @@ -217,6 +232,7 @@ typedef enum _MEDIA_EVENT_FILTER_KEYID //Common key TR_KEY_MFX_API = 0, TR_KEY_DDI_API, + TR_KEY_INTERNAl, //Decode key TR_KEY_DECODE_PICPARAM, TR_KEY_DECODE_SLICEPARAM, @@ -494,7 +510,7 @@ class PerfScopedTrace }; #define TRACE_CHECK(keyWord) \ - (EventCfg & (1 << keyWord)) || keyWord == TR_KEY_MFX_API || keyWord == TR_KEY_DDI_API + (EventCfg & (1 << keyWord)) || keyWord == TR_KEY_MFX_API || keyWord == TR_KEY_DDI_API || keyWord == TR_KEY_INTERNAl // This macro is recommended to use instead creating RT Info ScopedTrace object directly #define TRACE_BUFFER_EVENT(task, level, keyWord, pData, funcName, structType) \ diff --git a/_studio/shared/mfx_trace/IntelMediaSDK.man b/_studio/shared/mfx_trace/IntelMediaSDK.man index 59cdd4b8..b0b96e67 100644 --- a/_studio/shared/mfx_trace/IntelMediaSDK.man +++ b/_studio/shared/mfx_trace/IntelMediaSDK.man @@ -48,6 +48,7 @@ + @@ -194,6 +195,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -270,6 +311,23 @@ + + + + + + + + + + + + + + + + + @@ -482,6 +540,11 @@ + + + + +