Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

G-API: oneVPL (simplification) Add simple decode pipeline #20739

Merged
merged 3 commits into from Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/gapi/CMakeLists.txt
Expand Up @@ -174,6 +174,10 @@ set(gapi_srcs
src/streaming/onevpl/accelerators/surface/surface_pool.cpp
src/streaming/onevpl/accelerators/accel_policy_cpu.cpp
src/streaming/onevpl/accelerators/accel_policy_dx11.cpp
src/streaming/onevpl/engine/engine_session.cpp
src/streaming/onevpl/engine/processing_engine_base.cpp
src/streaming/onevpl/engine/decode/decode_engine_legacy.cpp
src/streaming/onevpl/engine/decode/decode_session.cpp

# Utils (ITT tracing)
src/utils/itt.cpp
Expand Down
Expand Up @@ -20,6 +20,7 @@
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {

VPLCPUAccelerationPolicy::VPLCPUAccelerationPolicy() {
GAPI_LOG_INFO(nullptr, "created");
Expand Down Expand Up @@ -219,6 +220,7 @@ cv::MediaFrame::AdapterPtr VPLCPUAccelerationPolicy::create_frame_adapter(pool_k
return cv::MediaFrame::AdapterPtr{new VPLMediaFrameCPUAdapter(*it)};
#endif // TEST_PERF
}
} // namespace onevpl
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down
Expand Up @@ -22,6 +22,7 @@
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {

// GAPI_EXPORTS for tests
struct GAPI_EXPORTS VPLCPUAccelerationPolicy final : public VPLAccelerationPolicy
Expand All @@ -47,6 +48,7 @@ struct GAPI_EXPORTS VPLCPUAccelerationPolicy final : public VPLAccelerationPolic
private:
std::map<pool_key_t, pool_t> pool_table;
};
} // namespace onevpl
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down
Expand Up @@ -8,6 +8,7 @@
#include "streaming/onevpl/accelerators/accel_policy_dx11.hpp"
#include "streaming/onevpl/accelerators/surface/cpu_frame_adapter.hpp"
#include "streaming/onevpl/accelerators/surface/surface.hpp"
#include "streaming/onevpl/utils.hpp"
#include "logger.hpp"

#ifdef HAVE_DIRECTX
Expand All @@ -27,6 +28,8 @@
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {

VPLDX11AccelerationPolicy::VPLDX11AccelerationPolicy()
{
#ifdef CPU_ACCEL_ADAPTER
Expand All @@ -47,7 +50,8 @@ void VPLDX11AccelerationPolicy::init(session_t session) {
mfxStatus sts = MFXVideoCORE_GetHandle(session, MFX_HANDLE_D3D11_DEVICE, reinterpret_cast<mfxHDL*>(&hw_handle));
if (sts != MFX_ERR_NONE)
{
throw std::logic_error("Cannot create VPLDX11AccelerationPolicy, MFXVideoCORE_GetHandle error");
throw std::logic_error("Cannot create VPLDX11AccelerationPolicy, MFXVideoCORE_GetHandle error: " +
mfxstatus_to_string(sts));
}

GAPI_LOG_INFO(nullptr, "VPLDX11AccelerationPolicy initialized, session: " << session);
Expand Down Expand Up @@ -106,6 +110,7 @@ cv::MediaFrame::AdapterPtr VPLDX11AccelerationPolicy::create_frame_adapter(pool_
(void)surface;
throw std::runtime_error("VPLDX11AccelerationPolicy::create_frame_adapter() is not implemented");
}
} // namespace onevpl
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down
Expand Up @@ -32,6 +32,7 @@
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {

// GAPI_EXPORTS for tests
struct GAPI_EXPORTS VPLDX11AccelerationPolicy final: public VPLAccelerationPolicy
Expand All @@ -57,6 +58,7 @@ struct GAPI_EXPORTS VPLDX11AccelerationPolicy final: public VPLAccelerationPolic
std::unique_ptr<VPLCPUAccelerationPolicy> adapter;
#endif
};
} // namespace onevpl
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down
Expand Up @@ -19,6 +19,7 @@
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {

class Surface;
struct VPLAccelerationPolicy
Expand Down Expand Up @@ -51,6 +52,7 @@ struct VPLAccelerationPolicy
virtual cv::MediaFrame::AdapterPtr create_frame_adapter(pool_key_t key,
mfxFrameSurface1* surface) = 0;
};
} // namespace onevpl
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down
Expand Up @@ -19,6 +19,7 @@
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {

VPLMediaFrameCPUAdapter::VPLMediaFrameCPUAdapter(std::shared_ptr<Surface> surface):
parent_surface_ptr(surface) {
Expand Down Expand Up @@ -111,6 +112,7 @@ void VPLMediaFrameCPUAdapter::serialize(cv::gapi::s11n::IOStream&) {
void VPLMediaFrameCPUAdapter::deserialize(cv::gapi::s11n::IIStream&) {
GAPI_Assert("VPLMediaFrameCPUAdapter::deserialize() is not implemented");
}
} // namespace onevpl
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down
Expand Up @@ -16,6 +16,7 @@
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {

class Surface;
class VPLMediaFrameCPUAdapter : public cv::MediaFrame::IAdapter {
Expand All @@ -33,6 +34,7 @@ class VPLMediaFrameCPUAdapter : public cv::MediaFrame::IAdapter {
private:
std::shared_ptr<Surface> parent_surface_ptr;
};
} // namespace onevpl
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down
Expand Up @@ -12,6 +12,7 @@
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {

Surface::Surface(std::unique_ptr<handle_t>&& surf, std::shared_ptr<void> associated_memory) :
workspace_memory_ptr(associated_memory),
Expand Down Expand Up @@ -69,6 +70,7 @@ size_t Surface::release_lock() {
", locked times: " << locked_count - 1);
return locked_count; // return preceding value
}
} // namespace onevpl
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down
Expand Up @@ -23,6 +23,7 @@
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {

/**
* @brief Inner class for managing oneVPL surface through interface `mfxFrameSurface1`.
Expand Down Expand Up @@ -95,6 +96,7 @@ class Surface {

using surface_ptr_t = std::shared_ptr<Surface>;
using surface_weak_ptr_t = std::weak_ptr<Surface>;
} // namespace onevpl
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down
Expand Up @@ -7,6 +7,7 @@
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {

void CachedPool::reserve(size_t size) {
surfaces.reserve(size);
Expand Down Expand Up @@ -63,6 +64,7 @@ CachedPool::surface_ptr_t CachedPool::find_by_handle(mfxFrameSurface1* handle) {
GAPI_Assert(it != cache.end() && "Cannot find cached surface from pool. Data corruption is possible");
return it->second;
}
} // namespace onevpl
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down
Expand Up @@ -17,6 +17,7 @@
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {

class Surface;
// GAPI_EXPORTS for tests
Expand All @@ -38,6 +39,7 @@ class GAPI_EXPORTS CachedPool {
free_surface_iterator_t next_free_it;
cached_surface_container_t cache;
};
} // namespace onevpl
} // namespace wip
} // namespace gapi
} // namespace cv
Expand Down