1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge pull request #19755 from mikhail-nikolskiy:ffmpeg-umat

cv::UMat output/input in VideoCapture/VideoWriter (data stays in GPU memory)

* FFMPEG with UMat input/output

* OpenCL_D3D* context

* fix Linux build

* cosmetic changes

* fix build if USE_AV_HW_CODECS=0

* simplify how child context pointer stored in parent context

* QSV interop with OpenCL on Windows

* detect_msdk.cmake via pkg-config

* fix av_buffer_ref() usage

* revert windows-decode-mfx whitelisting; remove debug msg

* address review comments

* rename property to HW_ACCELERATION_USE_OPENCL

* fix issue with "cl_khr_d3d11_sharing" extension not reported by OpenCL GPU+CPU platform

* core(ocl): add OpenCL stubs for configurations without OpenCL

* videoio(ffmpeg): update #if guards

* Put OpenCL related code under HAVE_OPENCL; simplify reuse of media context from OpenCL context

* videoio(test): skip unsupported tests

- plugins don't support OpenCL/UMat yet
- change handling of *_USE_OPENCL flag

* videoio(ffmpeg): OpenCL dependency

* videoio(ffmpeg): MediaSDK/oneVPL dependency

* cleanup, logging

* cmake: fix handling of 3rdparty interface targets

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
This commit is contained in:
Mikhail Nikolskii
2021-05-14 19:48:50 +03:00
committed by GitHub
parent bb92eb5a93
commit a604d44d06
17 changed files with 1347 additions and 783 deletions
+23
View File
@@ -43,6 +43,8 @@
#define OPENCV_OPENCL_HPP
#include "opencv2/core.hpp"
#include <typeinfo>
#include <typeindex>
namespace cv { namespace ocl {
@@ -277,6 +279,12 @@ public:
/** @returns cl_context value */
void* ptr() const;
/**
* @brief Get OpenCL context property specified on context creation
* @param propertyId Property id (CL_CONTEXT_* as defined in cl_context_properties type)
* @returns Property value if property was specified on clCreateContext, or NULL if context created without the property
*/
void* getOpenCLContextProperty(int propertyId) const;
bool useSVM() const;
void setUseSVM(bool enabled);
@@ -290,6 +298,21 @@ public:
void release();
class CV_EXPORTS UserContext {
public:
virtual ~UserContext();
};
template <typename T>
inline void setUserContext(const std::shared_ptr<T>& userContext) {
setUserContext(typeid(T), userContext);
}
template <typename T>
inline std::shared_ptr<T> getUserContext() {
return std::dynamic_pointer_cast<T>(getUserContext(typeid(T)));
}
void setUserContext(std::type_index typeId, const std::shared_ptr<UserContext>& userContext);
std::shared_ptr<UserContext> getUserContext(std::type_index typeId);
struct Impl;
inline Impl* getImpl() const { return (Impl*)p; }
inline bool empty() const { return !p; }