Download modules/gapi/src/streaming/onevpl/engine/preproc_engine_interface.cpp from tgollogly/test: direct link, hf CLI and curl.
- Browser
- Download file 4.55 kB
-
https://huggingface.co/tgollogly/test/resolve/main/modules/gapi/src/streaming/onevpl/engine/preproc_engine_interface.cpp
- Command line
-
hf download hf://tgollogly/test/modules/gapi/src/streaming/onevpl/engine/preproc_engine_interface.cpp
-
curl -L -o preproc_engine_interface.cpp https://huggingface.co/tgollogly/test/resolve/main/modules/gapi/src/streaming/onevpl/engine/preproc_engine_interface.cpp
4.55 kB
| // This file is part of OpenCV project. | |
| // It is subject to the license terms in the LICENSE file found in the top-level directory | |
| // of this distribution and at http://opencv.org/license.html. | |
| // | |
| // Copyright (C) 2022 Intel Corporation | |
| namespace cv { | |
| namespace gapi { | |
| namespace wip { | |
| template<typename SpecificPreprocEngine, typename ...PreprocEngineArgs > | |
| std::unique_ptr<SpecificPreprocEngine> | |
| IPreprocEngine::create_preproc_engine_impl(const PreprocEngineArgs& ...) { | |
| GAPI_Error("Unsupported "); | |
| } | |
| template <> | |
| std::unique_ptr<onevpl::VPPPreprocDispatcher> | |
| IPreprocEngine::create_preproc_engine_impl(const onevpl::Device &device, | |
| const onevpl::Context &context) { | |
| using namespace onevpl; | |
| cv::util::suppress_unused_warning(device); | |
| cv::util::suppress_unused_warning(context); | |
| std::unique_ptr<VPPPreprocDispatcher> dispatcher(new VPPPreprocDispatcher); | |
| bool pp_is_created = false; | |
| switch (device.get_type()) { | |
| case onevpl::AccelType::DX11: { | |
| GAPI_LOG_INFO(nullptr, "Creating DX11 VPP preprocessing engine"); | |
| // create GPU VPP preproc engine | |
| dispatcher->insert_worker<VPPPreprocEngine>( | |
| std::unique_ptr<VPLAccelerationPolicy>{ | |
| new VPLDX11AccelerationPolicy( | |
| std::make_shared<CfgParamDeviceSelector>( | |
| device, context, CfgParams{})) | |
| }); | |
| GAPI_LOG_INFO(nullptr, "DX11 VPP preprocessing engine created"); | |
| pp_is_created = true; | |
| break; | |
| } | |
| case onevpl::AccelType::VAAPI: { | |
| GAPI_LOG_INFO(nullptr, "Creating VAAPI VPP preprocessing engine"); | |
| // create GPU VPP preproc engine | |
| dispatcher->insert_worker<VPPPreprocEngine>( | |
| std::unique_ptr<VPLAccelerationPolicy>{ | |
| new VPLVAAPIAccelerationPolicy( | |
| std::make_shared<CfgParamDeviceSelector>( | |
| device, context, CfgParams{})) | |
| }); | |
| GAPI_LOG_INFO(nullptr, "VAAPI VPP preprocessing engine created"); | |
| pp_is_created = true; | |
| break; | |
| } | |
| default: { | |
| GAPI_LOG_INFO(nullptr, "Creating CPU VPP preprocessing engine"); | |
| dispatcher->insert_worker<VPPPreprocEngine>( | |
| std::unique_ptr<VPLAccelerationPolicy>{ | |
| new VPLCPUAccelerationPolicy( | |
| std::make_shared<CfgParamDeviceSelector>(CfgParams{}))}); | |
| GAPI_LOG_INFO(nullptr, "CPU VPP preprocessing engine created"); | |
| pp_is_created = true; | |
| break; | |
| } | |
| } | |
| if (!pp_is_created) { | |
| GAPI_LOG_WARNING(nullptr, "Cannot create VPP preprocessing engine: configuration unsupported"); | |
| GAPI_Error("VPP preproc unsupported"); | |
| } | |
| return dispatcher; | |
| } | |
| // Force instantiation | |
| template | |
| std::unique_ptr<onevpl::VPPPreprocDispatcher> | |
| IPreprocEngine::create_preproc_engine_impl<onevpl::VPPPreprocDispatcher, | |
| const onevpl::Device &,const onevpl::Context &> | |
| (const onevpl::Device &device, | |
| const onevpl::Context &ctx); | |
| } // namespace wip | |
| } // namespace gapi | |
| } // namespace cv | |