G-API: oneVPL (simplification) source base commit#20546
G-API: oneVPL (simplification) source base commit#20546alalek merged 9 commits intoopencv:masterfrom
Conversation
|
@alalek Could you please review |
alalek
left a comment
There was a problem hiding this comment.
Currently there is no images on public CI with oneVPL available.
I plan to add oneAPI builders later which have oneVPL SDK (~2-3 weeks).
| // Create source | ||
| cv::Ptr<cv::gapi::wip::IStreamSource> cap; | ||
| try { | ||
| cap = cv::gapi::wip::make_vpl_src(file_path); |
There was a problem hiding this comment.
Could we implement that through "Kernel packages"?
Their definition can be header-only, but implementation requires extra dependencies, or be dynamically loadable.
/cc @dmatveev
There was a problem hiding this comment.
@alalek For media sources, it is not clear yet.
Sure we can move the decode to the graph level so it becomes an "Operation" (with a single-header definition), and its implementations become "Kernels", so VPL or GStreamer could be specified via a kernel package -- and this mechanism would work there for free.
This approach has its cons, though, so I doubt if decode should be a graph operation or be a graph source. Let it (and GStreamer) be sources for now -- and for sources, probably sooner or later we'll introduce something factory-like to construct them based on capabilities, options, and so on
| project(oneVPL-download NONE) | ||
|
|
||
| include(ExternalProject) | ||
| ExternalProject_Add(oneVPL |
There was a problem hiding this comment.
We don't use ExternalProject_Add in OpenCV.
find_package(VPL) should be enough.
There was a problem hiding this comment.
I thought about automatic "download & build" feature for oneVPL in case it not installed or not found in the system.
It completely reduces required configuration steps for developers: no need worries about how to get oneVPL, configure, sourcing PATH and so on
If ExternalProjecy_Add is abandoned cmake feature in opencv - Then I'll remove it and we loose "download & build" for oneVPL.
@alalek Please respond - did I understand you comment correctly?
There was a problem hiding this comment.
Consider oneVPL dependency as prerequisite.
There was a problem hiding this comment.
done. entire file removed from PR
| if (NOT ONEVPL_DIR) | ||
| message("Search oneVPL package by PATH") | ||
| find_package(VPL QUIET) |
There was a problem hiding this comment.
ONEVPL_DIR may be unused in find_package(). There are tons of other methods for searching packages. We shuold not stick to this one.
Refer to CMake documentation.
There was a problem hiding this comment.
definitely. is it unused here in this part of branch but has worth in else() branch for searching VPL in specific location
The idea behind this implementation is the following:
I) If -DWITH_ONEVPL is set ON then we tried to search it in default PATH and used found one or downloaded new from github
It works when:
a) user sourced vars.sh from oneVPL package before (Normal way as oneAPI usage suggested). In this case we do not need to find_package, just for sanity check
b) oneVPL installed by default SYSTEM PATH. In this case find_package do not use ONEVPL_DIR as well
c) If no one found, then we clone it from git hub using ExternalProjectAdd
II) another option is passing ONEVPL_DIR as external oneVPL package location:
a) In this case we force find_package to find oneVPL by ONEVPL_DIR only (do not check PATH). It's else() branch for this if-condition. I suggest this options for "Custom-oneVPL" package to work-around issues which are not fixed in main oneVPL repo or official release package or some customization
If I understood your previous comment about ExternalProject_Add correctly then you suggest to eliminate "download&build" from github feature and we should retain I-a,b and II-a
But I find "download&build" very usefull at least for current development :) (May we wrapped it by additional FORCE_DOWNLOAD_ONEVPL flag ?)
There was a problem hiding this comment.
No download. No check for ONEVPL_DIR.
Just find_package(VPL)
There was a problem hiding this comment.
removed. just bare find_package is used at now
| message("No oneVPL found, clone it from repository") | ||
| set(ONEVPL_PROJECT_PREFIX "${OpenCV_BINARY_DIR}/3rdparty/oneVPL") | ||
| configure_file("${CMAKE_CURRENT_LIST_DIR}/DownloadOneVPL.cmake.in" ${ONEVPL_PROJECT_PREFIX}/oneVPL-download/CMakeLists.txt) | ||
| execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . |
There was a problem hiding this comment.
This doesn't support cross-compilation at least.
There was a problem hiding this comment.
I do no nothing about that before... But current oneVPL implementation for GAPI means Windows only
cc @dmatveev could you confirm or reject it?
@alalek & @dmatveev what do you think about wrapped externalProject_add and such non-cross execute_process for WINDOWS only (if this kind of check in present in build system) or some kind of DEV_* cmake flag?
There was a problem hiding this comment.
I do no nothing about that before... But current oneVPL implementation for GAPI means Windows only
cc @dmatveev could you confirm or reject it?
Our target use-cases are Windows only but VPL is cross-platform (I believe) so we could continue using/testing it on Linux, too.
dmatveev
left a comment
There was a problem hiding this comment.
Ok to go, looking forward for the initial implementation PR.
| endif() | ||
| endif() | ||
|
|
||
| if(WITH_GAPI_ONEVPL) |
There was a problem hiding this comment.
Should it be WITH_GAPI_ or just WITH_? The above two options don't have GAPI in the name.. @alalek do any other modules react to WITH_VPL?
| // Create source | ||
| cv::Ptr<cv::gapi::wip::IStreamSource> cap; | ||
| try { | ||
| cap = cv::gapi::wip::make_vpl_src(file_path); |
There was a problem hiding this comment.
@alalek For media sources, it is not clear yet.
Sure we can move the decode to the graph level so it becomes an "Operation" (with a single-header definition), and its implementations become "Kernels", so VPL or GStreamer could be specified via a kernel package -- and this mechanism would work there for free.
This approach has its cons, though, so I doubt if decode should be a graph operation or be a graph source. Let it (and GStreamer) be sources for now -- and for sources, probably sooner or later we'll introduce something factory-like to construct them based on capabilities, options, and so on
|
@alalek |
modules/gapi/cmake/init.cmake
Outdated
|
|
||
| if(WITH_GAPI_ONEVPL) | ||
| find_package(VPL) | ||
| set(HAVE_GAPI_ONEVPL TRUE) |
There was a problem hiding this comment.
if(VPL_FOUND)
set(HAVE_GAPI_ONEVPL TRUE)
endif()
here and below
There was a problem hiding this comment.
applied in both places
| if (!writer.isOpened()) { | ||
| const auto sz = cv::Size{outMat.cols, outMat.rows}; | ||
| writer.open(output, cv::VideoWriter::fourcc('M','J','P','G'), 25.0, sz); | ||
| CV_Assert(writer.isOpened()); | ||
| } |
There was a problem hiding this comment.
It makes sense to open writer before the main processing loop.
G-API: oneVPL (simplification) source base commit * oneVPL source initial * Fix compilation * Fix compilation path * Fix NO VPL compile * Fix unused vars * Fix unused vars in example * Simplify oneVPL search: no custom path & download * Fix standalone GAPI * Apply comments
this PR is the single one in series of #20469
Introduce base oneVPLSource in gapi
It's activated by configuration stage with the following options:
It will try to search VPL in PATH and if doesn't find it then do use
git cloneto download & build it from sourcesor tries to find specific installed implementation by ONEVPL_DIR
with error if not founded
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.
Build configuration