From 853696018ffbe1e18d017f6a7b6c37f5d0cc4c06 Mon Sep 17 00:00:00 2001 From: Kokoshnikov Date: Tue, 29 May 2018 18:35:10 +0300 Subject: [PATCH] [HEVCe][Linux][Windows][Android]Move h265 encoder to libmfxhw (Part 2) - Enable HEVCe HW through libmfxhw: add inmplementation to encode_hw - Disable using HEVCe HW as plugin, call with guid possible --- _studio/hevce_hw/Android.mk | 6 +- .../h265/include/mfx_h265_encode_hw.h | 166 ----------------- .../h265/include/mfx_h265_encode_plugin_hw.h | 171 ++++++++++++++++++ _studio/hevce_hw/h265/src/export.cpp | 4 +- _studio/mfx_lib/Android.mk | 6 +- _studio/mfx_lib/CMakeLists.txt | 1 + _studio/mfx_lib/encode_hw/CMakeLists.txt | 5 + .../mfx_lib/shared/src/libmfxsw_encode.cpp | 47 +++++ .../mfx_lib/shared/src/libmfxsw_plugin.cpp | 18 ++ _studio/shared/include/mfx_config.h | 2 +- android/include/mfx_android_defs.h | 2 + 11 files changed, 255 insertions(+), 173 deletions(-) create mode 100644 _studio/hevce_hw/h265/include/mfx_h265_encode_plugin_hw.h diff --git a/_studio/hevce_hw/Android.mk b/_studio/hevce_hw/Android.mk index 2392918a09..5b5327906b 100644 --- a/_studio/hevce_hw/Android.mk +++ b/_studio/hevce_hw/Android.mk @@ -37,7 +37,8 @@ LOCAL_C_INCLUDES := \ LOCAL_CFLAGS := \ $(MFX_CFLAGS_INTERNAL) \ - -DMFX_ENABLE_H265_VIDEO_ENCODE + -DMFX_ENABLE_H265_VIDEO_ENCODE \ + -DAS_HEVCE_PLUGIN LOCAL_CFLAGS_32 := $(MFX_CFLAGS_INTERNAL_32) LOCAL_STATIC_LIBRARIES := $(MFX_LOCAL_STATIC_LIBRARIES) @@ -67,7 +68,8 @@ LOCAL_C_INCLUDES := \ LOCAL_CFLAGS := \ $(MFX_CFLAGS_INTERNAL) \ - -DMFX_ENABLE_H265_VIDEO_ENCODE + -DMFX_ENABLE_H265_VIDEO_ENCODE \ + -DAS_HEVCE_PLUGIN LOCAL_CFLAGS_64 := $(MFX_CFLAGS_INTERNAL_64) LOCAL_STATIC_LIBRARIES := $(MFX_LOCAL_STATIC_LIBRARIES) diff --git a/_studio/hevce_hw/h265/include/mfx_h265_encode_hw.h b/_studio/hevce_hw/h265/include/mfx_h265_encode_hw.h index b454b46995..e4cf4396bb 100644 --- a/_studio/hevce_hw/h265/include/mfx_h265_encode_hw.h +++ b/_studio/hevce_hw/h265/include/mfx_h265_encode_hw.h @@ -28,7 +28,6 @@ #include "mfx_h265_encode_hw_ddi.h" #include "mfx_h265_encode_hw_utils.h" #include "umc_mutex.h" -#include "mfxplugin++.h" #include "mfx_h265_encode_hw_brc.h" #include "mfxvideo++int.h" #include @@ -36,7 +35,6 @@ namespace MfxHwH265Encode { -static const mfxPluginUID MFX_PLUGINID_HEVCE_HW = {{0x6f, 0xad, 0xc7, 0x91, 0xa0, 0xc2, 0xeb, 0x47, 0x9a, 0xb6, 0xdc, 0xd5, 0xea, 0x9d, 0xa3, 0x47}}; class MFXVideoENCODEH265_HW : public VideoENCODE { @@ -204,170 +202,6 @@ class MFXVideoENCODEH265_HW : public VideoENCODE }; -class Plugin : public MFXEncoderPlugin -{ -public: - static MFXEncoderPlugin* Create() - { - return new Plugin(false); - } - - static mfxStatus CreateByDispatcher(mfxPluginUID guid, mfxPlugin* mfxPlg) - { - if (memcmp(& guid , &MFX_PLUGINID_HEVCE_HW, sizeof(mfxPluginUID))) - { - return MFX_ERR_NOT_FOUND; - } - - Plugin* tmp_pplg = 0; - - try - { - tmp_pplg = new Plugin(false); - } - catch(std::bad_alloc&) - { - return MFX_ERR_MEMORY_ALLOC; - } - catch(...) - { - delete tmp_pplg; - return MFX_ERR_UNKNOWN; - } - - *mfxPlg = tmp_pplg->m_adapter; - tmp_pplg->m_createdByDispatcher = true; - - return MFX_ERR_NONE; - } - - virtual mfxStatus PluginInit(mfxCoreInterface *core) - { - MFX_TRACE_INIT(); - MFX_AUTO_LTRACE(MFX_TRACE_LEVEL_API, "Plugin::PluginInit"); - - MFX_CHECK_NULL_PTR1(core); - - m_core = *core; - - return MFX_ERR_NONE; - } - virtual mfxStatus PluginClose() - { - { - MFX_AUTO_LTRACE(MFX_TRACE_LEVEL_API, "Plugin::PluginClose"); - if (m_createdByDispatcher) - Release(); - } - - MFX_TRACE_CLOSE(); - - return MFX_ERR_NONE; - } - virtual mfxStatus GetPluginParam(mfxPluginParam *par) - { - MFX_CHECK_NULL_PTR1(par); - - par->PluginUID = MFX_PLUGINID_HEVCE_HW; - par->PluginVersion = 1; - par->ThreadPolicy = MFX_THREADPOLICY_SERIAL; - par->MaxThreadNum = 1; - par->APIVersion.Major = MFX_VERSION_MAJOR; - par->APIVersion.Minor = MFX_VERSION_MINOR; - par->Type = MFX_PLUGINTYPE_VIDEO_ENCODE; - par->CodecId = MFX_CODEC_HEVC; - - return MFX_ERR_NONE; - } - virtual mfxStatus Execute(mfxThreadTask task, mfxU32 uid_p, mfxU32 uid_a) - { - if (m_pImpl.get()) - return MFXVideoENCODEH265_HW::Execute((reinterpret_cast(m_pImpl.get())), task, uid_p, uid_a); - else - return MFX_ERR_NOT_INITIALIZED; - } - virtual mfxStatus FreeResources(mfxThreadTask /*task*/, mfxStatus /*sts*/) - { - return MFX_ERR_NONE; - } - - virtual mfxStatus Init(mfxVideoParam *par) - { - mfxStatus sts; - m_pImpl.reset(new MFXVideoENCODEH265_HW(&m_core, &sts)); - MFX_CHECK_STS(sts); - return m_pImpl->Init(par); - } - virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *in, mfxFrameAllocRequest * /*out*/) - { - return MFXVideoENCODEH265_HW::QueryIOSurf(&m_core, par, in); - } - virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) - { - return MFXVideoENCODEH265_HW::Query(&m_core, in, out); - } - virtual mfxStatus Reset(mfxVideoParam *par) - { - if (m_pImpl.get()) - return m_pImpl->Reset(par); - else - return MFX_ERR_NOT_INITIALIZED; - } - virtual mfxStatus GetVideoParam(mfxVideoParam *par) - { - if (m_pImpl.get()) - return m_pImpl->GetVideoParam(par); - else - return MFX_ERR_NOT_INITIALIZED; - } - - virtual mfxStatus EncodeFrameSubmit(mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxThreadTask *task) - { - if (m_pImpl.get()) - return m_pImpl->EncodeFrameSubmit(ctrl, surface, bs, task); - else - return MFX_ERR_NOT_INITIALIZED; - } - - virtual mfxU32 GetPluginType() - { - return MFX_PLUGINTYPE_VIDEO_ENCODE; - } - - virtual void Release() - { - delete this; - } - - virtual mfxStatus Close() - { - if (m_pImpl.get()) - return m_pImpl->Close(); - else - return MFX_ERR_NOT_INITIALIZED; - } - - virtual mfxStatus SetAuxParams(void*, int) - { - return MFX_ERR_UNSUPPORTED; - } - -protected: - explicit Plugin(bool CreateByDispatcher) - : m_createdByDispatcher(CreateByDispatcher) - , m_adapter(this) - , m_pImpl(nullptr) - {} - virtual ~Plugin() - {} - - bool m_createdByDispatcher; - MFXPluginAdapter m_adapter; - mfxCoreInterface m_core; - std::unique_ptr m_pImpl; - -}; - } //MfxHwH265Encode #endif diff --git a/_studio/hevce_hw/h265/include/mfx_h265_encode_plugin_hw.h b/_studio/hevce_hw/h265/include/mfx_h265_encode_plugin_hw.h new file mode 100644 index 0000000000..eb0b789edd --- /dev/null +++ b/_studio/hevce_hw/h265/include/mfx_h265_encode_plugin_hw.h @@ -0,0 +1,171 @@ +// Copyright (c) 2018 Intel Corporation +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +#pragma once + +#include "mfx_common.h" +#if defined(AS_HEVCE_PLUGIN) + +#include "mfxplugin++.h" + +namespace MfxHwH265Encode +{ + +static const mfxPluginUID MFX_PLUGINID_HEVCE_HW = { { 0x6f, 0xad, 0xc7, 0x91, 0xa0, 0xc2, 0xeb, 0x47, 0x9a, 0xb6, 0xdc, 0xd5, 0xea, 0x9d, 0xa3, 0x47 } }; + +class Plugin : public MFXEncoderPlugin +{ +public: + static MFXEncoderPlugin* Create() + { + return new Plugin(false); + } + static mfxStatus CreateByDispatcher(mfxPluginUID guid, mfxPlugin* mfxPlg) + { + if (!mfxPlg) + { + return MFX_ERR_NULL_PTR; + } + if (memcmp(&guid, &MFX_PLUGINID_HEVCE_HW, sizeof(mfxPluginUID))) + { + return MFX_ERR_NOT_FOUND; + } + + Plugin* tmp_pplg = nullptr; + + try + { + tmp_pplg = new Plugin(false); + } + catch (std::bad_alloc&) + { + return MFX_ERR_MEMORY_ALLOC; + } + catch (...) + { + return MFX_ERR_UNKNOWN; + } + + *mfxPlg = tmp_pplg->m_adapter; + tmp_pplg->m_createdByDispatcher = true; + + return MFX_ERR_NONE; + } + virtual mfxStatus PluginInit(mfxCoreInterface * /*core*/) + { + MFX_TRACE_INIT(); + MFX_AUTO_LTRACE(MFX_TRACE_LEVEL_API, "Plugin::PluginInit"); + return MFX_ERR_NONE; + } + virtual mfxStatus PluginClose() + { + { + MFX_AUTO_LTRACE(MFX_TRACE_LEVEL_API, "Plugin::PluginClose"); + if (m_createdByDispatcher) + Release(); + } + + MFX_TRACE_CLOSE(); + + return MFX_ERR_NONE; + } + virtual mfxStatus GetPluginParam(mfxPluginParam *par) + { + MFX_CHECK_NULL_PTR1(par); + + par->PluginUID = MFX_PLUGINID_HEVCE_HW; + par->PluginVersion = 1; + par->ThreadPolicy = MFX_THREADPOLICY_SERIAL; + par->MaxThreadNum = 1; + par->APIVersion.Major = MFX_VERSION_MAJOR; + par->APIVersion.Minor = MFX_VERSION_MINOR; + par->Type = MFX_PLUGINTYPE_VIDEO_ENCODE; + par->CodecId = MFX_CODEC_HEVC; + + return MFX_ERR_NONE; + } + virtual mfxStatus Execute(mfxThreadTask /*task*/, mfxU32 /*uid_p*/, mfxU32 /*uid_a*/) + { + return MFX_ERR_UNDEFINED_BEHAVIOR; + } + virtual mfxStatus FreeResources(mfxThreadTask /*task*/, mfxStatus /*sts*/) + { + return MFX_ERR_UNDEFINED_BEHAVIOR; + } + + virtual mfxStatus Init(mfxVideoParam * /*par*/) + { + return MFX_ERR_UNDEFINED_BEHAVIOR; + } + virtual mfxStatus QueryIOSurf(mfxVideoParam * /*par*/, mfxFrameAllocRequest * /*in*/, mfxFrameAllocRequest * /*out*/) + { + return MFX_ERR_UNDEFINED_BEHAVIOR; + } + virtual mfxStatus Query(mfxVideoParam * /*in*/, mfxVideoParam * /*out*/) + { + return MFX_ERR_UNDEFINED_BEHAVIOR; + } + virtual mfxStatus Reset(mfxVideoParam * /*par*/) + { + return MFX_ERR_UNDEFINED_BEHAVIOR; + } + virtual mfxStatus GetVideoParam(mfxVideoParam * /*par*/) + { + return MFX_ERR_UNDEFINED_BEHAVIOR; + } + + virtual mfxStatus EncodeFrameSubmit(mfxEncodeCtrl * /*ctrl*/, mfxFrameSurface1 * /*surface*/, mfxBitstream * /*bs*/, mfxThreadTask * /*task*/) + { + return MFX_ERR_UNDEFINED_BEHAVIOR; + } + + virtual mfxU32 GetPluginType() + { + return MFX_PLUGINTYPE_VIDEO_ENCODE; + } + + virtual void Release() + { + delete this; + } + + virtual mfxStatus Close() + { + return MFX_ERR_UNDEFINED_BEHAVIOR; + } + + virtual mfxStatus SetAuxParams(void*, int) + { + return MFX_ERR_UNSUPPORTED; + } +protected: + explicit Plugin(bool CreateByDispatcher) + : m_createdByDispatcher(CreateByDispatcher) + , m_adapter(this) + {} + + virtual ~Plugin() + {} + + bool m_createdByDispatcher; + MFXPluginAdapter m_adapter; +}; +} //MfxHwH265Encode + +#endif//defined(AS_HEVCE_PLUGIN) \ No newline at end of file diff --git a/_studio/hevce_hw/h265/src/export.cpp b/_studio/hevce_hw/h265/src/export.cpp index 99bcd4d9cd..a3b9adde7d 100644 --- a/_studio/hevce_hw/h265/src/export.cpp +++ b/_studio/hevce_hw/h265/src/export.cpp @@ -19,8 +19,8 @@ // SOFTWARE. #include "mfx_common.h" -#if defined(MFX_ENABLE_H265_VIDEO_ENCODE) -#include "mfx_h265_encode_hw.h" +#if defined(MFX_ENABLE_H265_VIDEO_ENCODE) && defined(AS_HEVCE_PLUGIN) +#include "mfx_h265_encode_plugin_hw.h" #include "plugin_version_linux.h" #if defined(LINUX32) diff --git a/_studio/mfx_lib/Android.mk b/_studio/mfx_lib/Android.mk index 4eadc5503a..c48ddbf959 100644 --- a/_studio/mfx_lib/Android.mk +++ b/_studio/mfx_lib/Android.mk @@ -28,7 +28,8 @@ MFX_LOCAL_SRC_FILES_IMPL := \ MFX_LOCAL_SRC_FILES_HW := \ $(MFX_LOCAL_SRC_FILES_IMPL) \ - $(patsubst $(LOCAL_PATH)/%, %, $(foreach dir, $(MFX_LOCAL_DIRS_HW), $(wildcard $(LOCAL_PATH)/mfx_lib/$(dir)/src/*.cpp))) + $(patsubst $(LOCAL_PATH)/%, %, $(foreach dir, $(MFX_LOCAL_DIRS_HW), $(wildcard $(LOCAL_PATH)/mfx_lib/$(dir)/src/*.cpp))) \ + $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/hevce_hw/h265/src/*.cpp)) MFX_LOCAL_INCLUDES := \ $(foreach dir, $(MFX_LOCAL_DIRS), $(wildcard $(LOCAL_PATH)/mfx_lib/$(dir)/include)) @@ -43,7 +44,8 @@ MFX_LOCAL_INCLUDES_HW := \ $(MFX_HOME)/_studio/mfx_lib/genx/field_copy/include \ $(MFX_HOME)/_studio/mfx_lib/genx/copy_kernels/include \ $(MFX_HOME)/_studio/mfx_lib/genx/mctf/include \ - $(MFX_HOME)/_studio/shared/asc/include + $(MFX_HOME)/_studio/shared/asc/include \ + $(MFX_HOME)/mdp_msdk-lib/_studio/hevce_hw/h265/include MFX_LOCAL_STATIC_LIBRARIES_HW := \ libmfx_lib_merged_hw \ diff --git a/_studio/mfx_lib/CMakeLists.txt b/_studio/mfx_lib/CMakeLists.txt index a1797b06ad..0f9947dcb3 100644 --- a/_studio/mfx_lib/CMakeLists.txt +++ b/_studio/mfx_lib/CMakeLists.txt @@ -88,6 +88,7 @@ endforeach() include_directories( ${MSDK_LIB_ROOT}/genx/copy_kernels/include ) include_directories( ${MSDK_STUDIO_ROOT}/shared/asc/include ) +include_directories( ${MSDK_STUDIO_ROOT}/hevce_hw/h265/include ) list( APPEND cdirs brc h264_enc mpeg2_dec vc1_dec vc1_common diff --git a/_studio/mfx_lib/encode_hw/CMakeLists.txt b/_studio/mfx_lib/encode_hw/CMakeLists.txt index ca9da9b389..91264315ea 100644 --- a/_studio/mfx_lib/encode_hw/CMakeLists.txt +++ b/_studio/mfx_lib/encode_hw/CMakeLists.txt @@ -34,6 +34,7 @@ include_directories( ${MSDK_LIB_ROOT}/pak/mpeg2/include ) include_directories( ${MSDK_LIB_ROOT}/genx/h264_encode/include ) include_directories( ${MSDK_LIB_ROOT}/fei/h264_preenc ) include_directories( ${MSDK_STUDIO_ROOT}/shared/asc/include ) +include_directories( ${MSDK_STUDIO_ROOT}/hevce_hw/h265/include ) # umc codec include_directories( ${MSDK_UMC_ROOT}/codec/brc/include ) include_directories( ${MSDK_UMC_ROOT}/codec/jpeg_common/include ) @@ -57,6 +58,10 @@ foreach( prefix ${MSDK_LIB_ROOT}/shared/src ) ) endforeach() +set( hevce_hw_dir ${MSDK_STUDIO_ROOT}/hevce_hw/h265/src ) +file( GLOB_RECURSE srcs "${hevce_hw_dir}/*.c" "${hevce_hw_dir}/*.cpp" ) +list( APPEND sources ${srcs} ) + set( defs "${WARNING_FLAGS}" ) make_library( encode hw static ) set( defs "" ) diff --git a/_studio/mfx_lib/shared/src/libmfxsw_encode.cpp b/_studio/mfx_lib/shared/src/libmfxsw_encode.cpp index 04c538c3f0..8178e98299 100644 --- a/_studio/mfx_lib/shared/src/libmfxsw_encode.cpp +++ b/_studio/mfx_lib/shared/src/libmfxsw_encode.cpp @@ -47,8 +47,14 @@ #endif #if defined (MFX_ENABLE_H265_VIDEO_ENCODE) +#if !defined(AS_HEVCE_PLUGIN) +#if defined(MFX_VA) +#include "mfx_h265_encode_hw.h" +#endif +#else #include "mfx_h265_encode_api.h" #endif +#endif // declare static file section @@ -110,6 +116,19 @@ VideoENCODE *CreateENCODESpecificClass(mfxU32 CodecId, VideoCORE *core, mfxSessi break; #endif // MFX_ENABLE_MJPEG_VIDEO_ENCODE +#if defined(MFX_ENABLE_H265_VIDEO_ENCODE) && defined(MFX_VA) && !defined(AS_HEVCE_PLUGIN) + case MFX_CODEC_HEVC: + if (session->m_bIsHWENCSupport) + { + pENCODE = new MfxHwH265Encode::MFXVideoENCODEH265_HW(&session->m_coreInt, &mfxRes); + } + else + { + pENCODE = nullptr; + } + break; +#endif // MFX_ENABLE_H265_VIDEO_ENCODE + default: break; } @@ -218,6 +237,20 @@ mfxStatus MFXVideoENCODE_Query(mfxSession session, mfxVideoParam *in, mfxVideoPa break; #endif // MFX_ENABLE_MJPEG_VIDEO_ENCODE +#if defined(MFX_ENABLE_H265_VIDEO_ENCODE) && defined(MFX_VA) && !defined(AS_HEVCE_PLUGIN) + case MFX_CODEC_HEVC: + mfxRes = MfxHwH265Encode::MFXVideoENCODEH265_HW::Query(&session->m_coreInt, in, out); + if (MFX_WRN_PARTIAL_ACCELERATION == mfxRes) + { + mfxRes = MFX_ERR_UNSUPPORTED; + } + else + { + bIsHWENCSupport = true; + } + break; +#endif // MFX_ENABLE_H265_VIDEO_ENCODE + default: mfxRes = MFX_ERR_UNSUPPORTED; } @@ -343,6 +376,20 @@ mfxStatus MFXVideoENCODE_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfx break; #endif // MFX_ENABLE_MJPEG_VIDEO_ENCODE +#if defined(MFX_ENABLE_H265_VIDEO_ENCODE) && defined(MFX_VA) && !defined(AS_HEVCE_PLUGIN) + case MFX_CODEC_HEVC: + mfxRes = MfxHwH265Encode::MFXVideoENCODEH265_HW::QueryIOSurf(&session->m_coreInt, par, request); + if (MFX_WRN_PARTIAL_ACCELERATION == mfxRes) + { + mfxRes = MFX_ERR_UNSUPPORTED; + } + else + { + bIsHWENCSupport = true; + } + break; +#endif // MFX_ENABLE_H265_VIDEO_ENCODE + default: mfxRes = MFX_ERR_UNSUPPORTED; } diff --git a/_studio/mfx_lib/shared/src/libmfxsw_plugin.cpp b/_studio/mfx_lib/shared/src/libmfxsw_plugin.cpp index de03c5df21..8f3fe2b4fd 100644 --- a/_studio/mfx_lib/shared/src/libmfxsw_plugin.cpp +++ b/_studio/mfx_lib/shared/src/libmfxsw_plugin.cpp @@ -170,6 +170,10 @@ namespace } // namespace +const mfxPluginUID NativePlugins[] = +{ + MFX_PLUGINID_HEVCE_HW +}; mfxStatus MFXVideoUSER_Register(mfxSession session, mfxU32 type, const mfxPlugin *par) @@ -178,6 +182,8 @@ mfxStatus MFXVideoUSER_Register(mfxSession session, mfxU32 type, // check error(s) MFX_CHECK(session, MFX_ERR_INVALID_HANDLE); + MFX_CHECK_NULL_PTR1(par); + MFX_CHECK_NULL_PTR1(par->GetPluginParam); try { @@ -187,12 +193,24 @@ mfxStatus MFXVideoUSER_Register(mfxSession session, mfxU32 type, std::unique_ptr &decPtr = sessionPtr.codec(); std::unique_ptr &vppPtr = sessionPtr.codec(); std::unique_ptr &preEncPtr = sessionPtr.codec(); + mfxPluginParam pluginParam = {}; // the plugin with the same type is already exist if (pluginPtr.get() || decPtr.get() || encPtr.get() || preEncPtr.get()) { return MFX_ERR_UNDEFINED_BEHAVIOR; } + + //check is this plugin was included into MSDK lib as a native component + mfxRes = par->GetPluginParam(par->pthis, &pluginParam); + MFX_CHECK_STS(mfxRes); + + for (auto& uid : NativePlugins) + { + if (!memcmp(&uid, &pluginParam.PluginUID, sizeof(uid))) + return MFX_ERR_NONE; //do nothing + } + // create a new plugin's instance pluginPtr.reset(CreateUSERSpecificClass(type)); MFX_CHECK(pluginPtr.get(), MFX_ERR_INVALID_VIDEO_PARAM); diff --git a/_studio/shared/include/mfx_config.h b/_studio/shared/include/mfx_config.h index 8c14f16d24..efde65ed8f 100644 --- a/_studio/shared/include/mfx_config.h +++ b/_studio/shared/include/mfx_config.h @@ -65,7 +65,7 @@ #define MFX_ENABLE_H264_VIDEO_ENCODE //h265e - #if defined(AS_HEVCD_PLUGIN) || defined(AS_HEVCE_PLUGIN) + #if defined(AS_HEVCD_PLUGIN) || defined(AS_HEVCE_PLUGIN) || defined(MFX_VA) #define MFX_ENABLE_H265_VIDEO_ENCODE #endif //hevc FEI ENCODE diff --git a/android/include/mfx_android_defs.h b/android/include/mfx_android_defs.h index 4fecc102d0..1fc4482d62 100644 --- a/android/include/mfx_android_defs.h +++ b/android/include/mfx_android_defs.h @@ -27,6 +27,8 @@ #define MFX_ENABLE_H265_VIDEO_DECODE + #define MFX_ENABLE_H265_VIDEO_ENCODE + #define MFX_ENABLE_H264_VIDEO_DECODE #define MFX_ENABLE_H264_VIDEO_ENCODE