Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
22bb5d1f
O
Opencv
项目概览
Greenplum
/
Opencv
10 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
22bb5d1f
编写于
9月 10, 2015
作者:
A
Alexey Ershov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
implemented sample build in fallback mode without interop
上级
f533c056
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
88 addition
and
11 deletion
+88
-11
cmake/OpenCVFindVA.cmake
cmake/OpenCVFindVA.cmake
+1
-1
samples/CMakeLists.txt
samples/CMakeLists.txt
+1
-1
samples/va_intel/CMakeLists.txt
samples/va_intel/CMakeLists.txt
+1
-1
samples/va_intel/display.cpp.inc
samples/va_intel/display.cpp.inc
+71
-8
samples/va_intel/va_intel_interop.cpp
samples/va_intel/va_intel_interop.cpp
+14
-0
未找到文件。
cmake/OpenCVFindVA.cmake
浏览文件 @
22bb5d1f
...
...
@@ -12,7 +12,7 @@ endif()
if
(
VA_INCLUDE_DIR
)
set
(
HAVE_VA TRUE
)
set
(
VA_LIBRARIES
"-lva"
)
set
(
VA_LIBRARIES
"-lva"
"-lva-x11"
)
else
()
set
(
HAVE_VA FALSE
)
message
(
WARNING
"libva installation is not found."
)
...
...
samples/CMakeLists.txt
浏览文件 @
22bb5d1f
...
...
@@ -22,7 +22,7 @@ if((NOT ANDROID) AND HAVE_OPENGL)
add_subdirectory
(
opengl
)
endif
()
if
(
UNIX AND NOT ANDROID AND
HAVE_VA_INTEL
)
if
(
UNIX AND NOT ANDROID
AND
(
HAVE_VA OR HAVE_VA_INTEL
)
)
add_subdirectory
(
va_intel
)
endif
()
...
...
samples/va_intel/CMakeLists.txt
浏览文件 @
22bb5d1f
...
...
@@ -17,7 +17,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
set
(
the_target
"example_
${
project
}
_
${
name
}
"
)
add_executable
(
${
the_target
}
${
srcs
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS
}
${
VA_INTEL_LIBRARIES
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS
}
${
VA_
LIBRARIES
}
${
VA_
INTEL_LIBRARIES
}
)
set_target_properties
(
${
the_target
}
PROPERTIES
OUTPUT_NAME
"
${
project
}
-example-
${
name
}
"
...
...
samples/va_intel/display.cpp.inc
浏览文件 @
22bb5d1f
...
...
@@ -7,25 +7,39 @@
#include <sys/types.h>
#include <unistd.h>
#include <va/va.h>
#include <va/va_drm.h>
#include "cvconfig.h"
#define VA_INTEL_PCI_DIR "/sys/bus/pci/devices"
#define VA_INTEL_DRI_DIR "/dev/dri/"
#define VA_INTEL_PCI_DISPLAY_CONTROLLER_CLASS 0x03
#include <va/va.h>
#if defined(HAVE_VA_INTEL)
# include <va/va_drm.h>
#elif defined(HAVE_VA)
# include <va/va_x11.h>
# include <X11/Xlib.h>
#endif //HAVE_VA_INTEL / HAVE_VA
namespace
va
{
static
unsigned
readId
(
const
char
*
devName
,
const
char
*
idName
);
static
int
findAdapter
(
unsigned
desiredVendorId
);
#if defined(HAVE_VA_INTEL) || defined(HAVE_VA)
bool
openDisplay
();
void
closeDisplay
();
int
drmfd
=
-
1
;
VADisplay
display
=
NULL
;
bool
initialized
=
false
;
#endif //HAVE_VA_INTEL || HAVE_VA
#if defined(HAVE_VA_INTEL)
#define VA_INTEL_PCI_DIR "/sys/bus/pci/devices"
#define VA_INTEL_DRI_DIR "/dev/dri/"
#define VA_INTEL_PCI_DISPLAY_CONTROLLER_CLASS 0x03
static
unsigned
readId
(
const
char
*
devName
,
const
char
*
idName
);
static
int
findAdapter
(
unsigned
desiredVendorId
);
int
drmfd
=
-
1
;
class
Directory
{
typedef
int
(
*
fsort
)(
const
struct
dirent
**
,
const
struct
dirent
**
);
...
...
@@ -205,4 +219,53 @@ void closeDisplay()
}
}
#elif defined(HAVE_VA)
static
Display
*
x11Display
=
0
;
bool
openDisplay
()
{
if
(
!
initialized
)
{
display
=
0
;
x11Display
=
XOpenDisplay
(
""
);
if
(
x11Display
!=
0
)
{
display
=
vaGetDisplay
(
x11Display
);
if
(
display
)
{
int
majorVersion
=
0
,
minorVersion
=
0
;
if
(
vaInitialize
(
display
,
&
majorVersion
,
&
minorVersion
)
==
VA_STATUS_SUCCESS
)
{
initialized
=
true
;
return
true
;
}
display
=
0
;
}
XCloseDisplay
(
x11Display
);
x11Display
=
0
;
}
return
false
;
// Can't initialize X11/VA display
}
return
true
;
}
void
closeDisplay
()
{
if
(
initialized
)
{
if
(
display
)
vaTerminate
(
display
);
if
(
x11Display
)
XCloseDisplay
(
x11Display
);
display
=
0
;
x11Display
=
0
;
initialized
=
false
;
}
}
#endif // HAVE_VA_INTEL / HAVE_VA
}
// namespace va
samples/va_intel/va_intel_interop.cpp
浏览文件 @
22bb5d1f
...
...
@@ -42,6 +42,7 @@
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/core/va_intel.hpp"
#include "cvconfig.h"
#define CHECK_VASTATUS(va_status,func) \
if (va_status != VA_STATUS_SUCCESS) { \
...
...
@@ -362,14 +363,20 @@ public:
{
int
n
=
0
;
m_files
[
0
]
=
m_files
[
1
]
=
0
;
#if defined(HAVE_VA_INTEL)
m_interop
=
true
;
#elif defined(HAVE_VA)
m_interop
=
false
;
#endif //HAVE_VA_INTEL / HAVE_VA
for
(
int
i
=
1
;
i
<
m_argc
;
++
i
)
{
const
char
*
arg
=
m_argv
[
i
];
if
(
arg
[
0
]
==
'-'
)
// option
{
#if defined(HAVE_VA_INTEL)
if
(
!
strcmp
(
arg
,
"-f"
))
m_interop
=
false
;
#endif //HAVE_VA_INTEL
}
else
// parameter
{
...
...
@@ -400,8 +407,15 @@ int main(int argc, char** argv)
if
(
!
cmd
.
run
())
{
fprintf
(
stderr
,
#if defined(HAVE_VA_INTEL)
"Usage: va_intel_interop [-f] file1 file2
\n\n
"
"Interop ON/OFF version
\n\n
"
"where: -f option indicates interop is off (fallback mode); interop is on by default
\n
"
#elif defined(HAVE_VA)
"Usage: va_intel_interop file1 file2
\n\n
"
"Interop OFF only version
\n\n
"
"where:
\n
"
#endif //HAVE_VA_INTEL / HAVE_VA
" file1 is to be created, contains original surface data (NV12)
\n
"
" file2 is to be created, contains processed surface data (NV12)
\n
"
);
exit
(
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录