Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
c7fe1628
Commit
c7fe1628
authored
Jan 31, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed **2 -> **
parent
42ac3123
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
186 additions
and
92 deletions
+186
-92
.project
.project
+100
-0
cl2cpp.cmake
cmake/cl2cpp.cmake
+2
-2
directx.hpp
modules/core/include/opencv2/core/directx.hpp
+4
-4
ocl.hpp
modules/core/include/opencv2/core/ocl.hpp
+36
-36
directx.cpp
modules/core/src/directx.cpp
+20
-20
dxt.cpp
modules/core/src/dxt.cpp
+6
-6
ocl.cpp
modules/core/src/ocl.cpp
+0
-0
imgwarp.cpp
modules/imgproc/src/imgwarp.cpp
+1
-1
pyramids.cpp
modules/imgproc/src/pyramids.cpp
+9
-15
ocl_test.cpp
modules/ts/src/ocl_test.cpp
+2
-2
d3d_base.inl.hpp
samples/directx/d3d_base.inl.hpp
+6
-6
No files found.
.project
0 → 100644
View file @
c7fe1628
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
opencv
</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>
org.eclipse.cdt.managedbuilder.core.genmakebuilder
</name>
<triggers>
clean,full,incremental,
</triggers>
<arguments>
<dictionary>
<key>
?children?
</key>
<value>
?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|\||
</value>
</dictionary>
<dictionary>
<key>
?name?
</key>
<value></value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.append_environment
</key>
<value>
true
</value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.autoBuildTarget
</key>
<value>
all
</value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.buildArguments
</key>
<value></value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.buildCommand
</key>
<value>
make
</value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.buildLocation
</key>
<value>
/home/ilya/Documents/Programming/Builds/opencv_debug/bin
</value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.cleanBuildTarget
</key>
<value>
clean
</value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.contents
</key>
<value>
org.eclipse.cdt.make.core.activeConfigSettings
</value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.enableAutoBuild
</key>
<value>
false
</value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.enableCleanBuild
</key>
<value>
true
</value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.enableFullBuild
</key>
<value>
true
</value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.fullBuildTarget
</key>
<value>
all
</value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.stopOnError
</key>
<value>
true
</value>
</dictionary>
<dictionary>
<key>
org.eclipse.cdt.make.core.useDefaultBuildCmd
</key>
<value>
true
</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
</name>
<triggers>
full,incremental,
</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.cdt.codan.core.codanBuilder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.cdt.core.cnature
</nature>
<nature>
org.eclipse.cdt.core.ccnature
</nature>
<nature>
org.eclipse.cdt.managedbuilder.core.managedBuildNature
</nature>
<nature>
org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
</nature>
<nature>
org.eclipse.cdt.codan.core.codanNature
</nature>
</natures>
<linkedResources>
<link>
<name>
bin
</name>
<type>
2
</type>
<location>
/home/ilya/Documents/Programming/Builds/opencv_debug/bin
</location>
</link>
</linkedResources>
</projectDescription>
cmake/cl2cpp.cmake
View file @
c7fe1628
...
...
@@ -65,8 +65,8 @@ foreach(cl ${cl_list})
set
(
STR_CPP_DECL
"const struct ProgramEntry
${
cl_filename
}
={
\"
${
cl_filename
}
\"
,
\n\"
${
lines
}
,
\"
${
hash
}
\"
};
\n
"
)
set
(
STR_HPP_DECL
"extern const struct ProgramEntry
${
cl_filename
}
;
\n
"
)
if
(
new_mode
)
set
(
STR_CPP_DECL
"
${
STR_CPP_DECL
}
ProgramSource
2
${
cl_filename
}
_oclsrc(
${
cl_filename
}
.programStr);
\n
"
)
set
(
STR_HPP_DECL
"
${
STR_HPP_DECL
}
extern ProgramSource
2
${
cl_filename
}
_oclsrc;
\n
"
)
set
(
STR_CPP_DECL
"
${
STR_CPP_DECL
}
ProgramSource
${
cl_filename
}
_oclsrc(
${
cl_filename
}
.programStr);
\n
"
)
set
(
STR_HPP_DECL
"
${
STR_HPP_DECL
}
extern ProgramSource
${
cl_filename
}
_oclsrc;
\n
"
)
endif
()
set
(
STR_CPP
"
${
STR_CPP
}${
STR_CPP_DECL
}
"
)
...
...
modules/core/include/opencv2/core/directx.hpp
View file @
c7fe1628
...
...
@@ -67,10 +67,10 @@ namespace ocl {
using
namespace
cv
::
ocl
;
// TODO static functions in the Context class
CV_EXPORTS
Context
2
&
initializeContextFromD3D11Device
(
ID3D11Device
*
pD3D11Device
);
CV_EXPORTS
Context
2
&
initializeContextFromD3D10Device
(
ID3D10Device
*
pD3D10Device
);
CV_EXPORTS
Context
2
&
initializeContextFromDirect3DDevice9Ex
(
IDirect3DDevice9Ex
*
pDirect3DDevice9Ex
);
CV_EXPORTS
Context
2
&
initializeContextFromDirect3DDevice9
(
IDirect3DDevice9
*
pDirect3DDevice9
);
CV_EXPORTS
Context
&
initializeContextFromD3D11Device
(
ID3D11Device
*
pD3D11Device
);
CV_EXPORTS
Context
&
initializeContextFromD3D10Device
(
ID3D10Device
*
pD3D10Device
);
CV_EXPORTS
Context
&
initializeContextFromDirect3DDevice9Ex
(
IDirect3DDevice9Ex
*
pDirect3DDevice9Ex
);
CV_EXPORTS
Context
&
initializeContextFromDirect3DDevice9
(
IDirect3DDevice9
*
pDirect3DDevice9
);
}
// namespace cv::directx::ocl
...
...
modules/core/include/opencv2/core/ocl.hpp
View file @
c7fe1628
...
...
@@ -51,15 +51,15 @@ CV_EXPORTS bool useOpenCL();
CV_EXPORTS
bool
haveAmdBlas
();
CV_EXPORTS
bool
haveAmdFft
();
CV_EXPORTS
void
setUseOpenCL
(
bool
flag
);
CV_EXPORTS
void
finish
2
();
CV_EXPORTS
void
finish
();
class
CV_EXPORTS
Context
2
;
class
CV_EXPORTS
Context
;
class
CV_EXPORTS
Device
;
class
CV_EXPORTS
Kernel
;
class
CV_EXPORTS
Program
;
class
CV_EXPORTS
ProgramSource
2
;
class
CV_EXPORTS
ProgramSource
;
class
CV_EXPORTS
Queue
;
class
CV_EXPORTS
PlatformInfo
2
;
class
CV_EXPORTS
PlatformInfo
;
class
CV_EXPORTS
Image2D
;
class
CV_EXPORTS
Device
...
...
@@ -206,26 +206,26 @@ protected:
};
class
CV_EXPORTS
Context
2
class
CV_EXPORTS
Context
{
public
:
Context
2
();
explicit
Context
2
(
int
dtype
);
~
Context
2
();
Context
2
(
const
Context2
&
c
);
Context
2
&
operator
=
(
const
Context2
&
c
);
Context
();
explicit
Context
(
int
dtype
);
~
Context
();
Context
(
const
Context
&
c
);
Context
&
operator
=
(
const
Context
&
c
);
bool
create
();
bool
create
(
int
dtype
);
size_t
ndevices
()
const
;
const
Device
&
device
(
size_t
idx
)
const
;
Program
getProg
(
const
ProgramSource
2
&
prog
,
Program
getProg
(
const
ProgramSource
&
prog
,
const
String
&
buildopt
,
String
&
errmsg
);
static
Context
2
&
getDefault
(
bool
initialize
=
true
);
static
Context
&
getDefault
(
bool
initialize
=
true
);
void
*
ptr
()
const
;
friend
void
initializeContextFromHandle
(
Context
2
&
ctx
,
void
*
platform
,
void
*
context
,
void
*
device
);
friend
void
initializeContextFromHandle
(
Context
&
ctx
,
void
*
platform
,
void
*
context
,
void
*
device
);
protected
:
struct
Impl
;
Impl
*
p
;
...
...
@@ -242,25 +242,25 @@ public:
void
*
ptr
()
const
;
static
Platform
&
getDefault
();
friend
void
initializeContextFromHandle
(
Context
2
&
ctx
,
void
*
platform
,
void
*
context
,
void
*
device
);
friend
void
initializeContextFromHandle
(
Context
&
ctx
,
void
*
platform
,
void
*
context
,
void
*
device
);
protected
:
struct
Impl
;
Impl
*
p
;
};
// TODO Move to internal header
void
initializeContextFromHandle
(
Context
2
&
ctx
,
void
*
platform
,
void
*
context
,
void
*
device
);
void
initializeContextFromHandle
(
Context
&
ctx
,
void
*
platform
,
void
*
context
,
void
*
device
);
class
CV_EXPORTS
Queue
{
public
:
Queue
();
explicit
Queue
(
const
Context
2
&
c
,
const
Device
&
d
=
Device
());
explicit
Queue
(
const
Context
&
c
,
const
Device
&
d
=
Device
());
~
Queue
();
Queue
(
const
Queue
&
q
);
Queue
&
operator
=
(
const
Queue
&
q
);
bool
create
(
const
Context
2
&
c
=
Context2
(),
const
Device
&
d
=
Device
());
bool
create
(
const
Context
&
c
=
Context
(),
const
Device
&
d
=
Device
());
void
finish
();
void
*
ptr
()
const
;
static
Queue
&
getDefault
();
...
...
@@ -314,7 +314,7 @@ class CV_EXPORTS Kernel
public
:
Kernel
();
Kernel
(
const
char
*
kname
,
const
Program
&
prog
);
Kernel
(
const
char
*
kname
,
const
ProgramSource
2
&
prog
,
Kernel
(
const
char
*
kname
,
const
ProgramSource
&
prog
,
const
String
&
buildopts
=
String
(),
String
*
errmsg
=
0
);
~
Kernel
();
Kernel
(
const
Kernel
&
k
);
...
...
@@ -322,7 +322,7 @@ public:
bool
empty
()
const
;
bool
create
(
const
char
*
kname
,
const
Program
&
prog
);
bool
create
(
const
char
*
kname
,
const
ProgramSource
2
&
prog
,
bool
create
(
const
char
*
kname
,
const
ProgramSource
&
prog
,
const
String
&
buildopts
,
String
*
errmsg
=
0
);
int
set
(
int
i
,
const
void
*
value
,
size_t
sz
);
...
...
@@ -508,7 +508,7 @@ class CV_EXPORTS Program
{
public
:
Program
();
Program
(
const
ProgramSource
2
&
src
,
Program
(
const
ProgramSource
&
src
,
const
String
&
buildflags
,
String
&
errmsg
);
explicit
Program
(
const
String
&
buf
);
Program
(
const
Program
&
prog
);
...
...
@@ -516,12 +516,12 @@ public:
Program
&
operator
=
(
const
Program
&
prog
);
~
Program
();
bool
create
(
const
ProgramSource
2
&
src
,
bool
create
(
const
ProgramSource
&
src
,
const
String
&
buildflags
,
String
&
errmsg
);
bool
read
(
const
String
&
buf
,
const
String
&
buildflags
);
bool
write
(
String
&
buf
)
const
;
const
ProgramSource
2
&
source
()
const
;
const
ProgramSource
&
source
()
const
;
void
*
ptr
()
const
;
String
getPrefix
()
const
;
...
...
@@ -533,17 +533,17 @@ protected:
};
class
CV_EXPORTS
ProgramSource
2
class
CV_EXPORTS
ProgramSource
{
public
:
typedef
uint64
hash_t
;
ProgramSource
2
();
explicit
ProgramSource
2
(
const
String
&
prog
);
explicit
ProgramSource
2
(
const
char
*
prog
);
~
ProgramSource
2
();
ProgramSource
2
(
const
ProgramSource2
&
prog
);
ProgramSource
2
&
operator
=
(
const
ProgramSource2
&
prog
);
ProgramSource
();
explicit
ProgramSource
(
const
String
&
prog
);
explicit
ProgramSource
(
const
char
*
prog
);
~
ProgramSource
();
ProgramSource
(
const
ProgramSource
&
prog
);
ProgramSource
&
operator
=
(
const
ProgramSource
&
prog
);
const
String
&
source
()
const
;
hash_t
hash
()
const
;
...
...
@@ -553,15 +553,15 @@ protected:
Impl
*
p
;
};
class
CV_EXPORTS
PlatformInfo
2
class
CV_EXPORTS
PlatformInfo
{
public
:
PlatformInfo
2
();
explicit
PlatformInfo
2
(
void
*
id
);
~
PlatformInfo
2
();
PlatformInfo
();
explicit
PlatformInfo
(
void
*
id
);
~
PlatformInfo
();
PlatformInfo
2
(
const
PlatformInfo2
&
i
);
PlatformInfo
2
&
operator
=
(
const
PlatformInfo2
&
i
);
PlatformInfo
(
const
PlatformInfo
&
i
);
PlatformInfo
&
operator
=
(
const
PlatformInfo
&
i
);
String
name
()
const
;
String
vendor
()
const
;
...
...
@@ -578,7 +578,7 @@ CV_EXPORTS const char* convertTypeStr(int sdepth, int ddepth, int cn, char* buf)
CV_EXPORTS
const
char
*
typeToStr
(
int
t
);
CV_EXPORTS
const
char
*
memopTypeToStr
(
int
t
);
CV_EXPORTS
String
kernelToStr
(
InputArray
_kernel
,
int
ddepth
=
-
1
);
CV_EXPORTS
void
getPlatfomsInfo
(
std
::
vector
<
PlatformInfo
2
>&
platform_info
);
CV_EXPORTS
void
getPlatfomsInfo
(
std
::
vector
<
PlatformInfo
>&
platform_info
);
class
CV_EXPORTS
Image2D
{
...
...
modules/core/src/directx.cpp
View file @
c7fe1628
...
...
@@ -236,7 +236,7 @@ namespace ocl {
static
bool
g_isDirect3DDevice9Ex
=
false
;
// Direct3DDevice9Ex or Direct3DDevice9 was used
#endif
Context
2
&
initializeContextFromD3D11Device
(
ID3D11Device
*
pD3D11Device
)
Context
&
initializeContextFromD3D11Device
(
ID3D11Device
*
pD3D11Device
)
{
(
void
)
pD3D11Device
;
#if !defined(HAVE_DIRECTX)
...
...
@@ -338,13 +338,13 @@ Context2& initializeContextFromD3D11Device(ID3D11Device* pD3D11Device)
}
Context
2
&
ctx
=
Context2
::
getDefault
(
false
);
Context
&
ctx
=
Context
::
getDefault
(
false
);
initializeContextFromHandle
(
ctx
,
platforms
[
found
],
context
,
device
);
return
ctx
;
#endif
}
Context
2
&
initializeContextFromD3D10Device
(
ID3D10Device
*
pD3D10Device
)
Context
&
initializeContextFromD3D10Device
(
ID3D10Device
*
pD3D10Device
)
{
(
void
)
pD3D10Device
;
#if !defined(HAVE_DIRECTX)
...
...
@@ -446,13 +446,13 @@ Context2& initializeContextFromD3D10Device(ID3D10Device* pD3D10Device)
}
Context
2
&
ctx
=
Context2
::
getDefault
(
false
);
Context
&
ctx
=
Context
::
getDefault
(
false
);
initializeContextFromHandle
(
ctx
,
platforms
[
found
],
context
,
device
);
return
ctx
;
#endif
}
Context
2
&
initializeContextFromDirect3DDevice9Ex
(
IDirect3DDevice9Ex
*
pDirect3DDevice9Ex
)
Context
&
initializeContextFromDirect3DDevice9Ex
(
IDirect3DDevice9Ex
*
pDirect3DDevice9Ex
)
{
(
void
)
pDirect3DDevice9Ex
;
#if !defined(HAVE_DIRECTX)
...
...
@@ -555,14 +555,14 @@ Context2& initializeContextFromDirect3DDevice9Ex(IDirect3DDevice9Ex* pDirect3DDe
CV_Error
(
cv
::
Error
::
OpenCLInitError
,
"OpenCL: Can't create context for DirectX interop"
);
}
Context
2
&
ctx
=
Context2
::
getDefault
(
false
);
Context
&
ctx
=
Context
::
getDefault
(
false
);
initializeContextFromHandle
(
ctx
,
platforms
[
found
],
context
,
device
);
g_isDirect3DDevice9Ex
=
true
;
return
ctx
;
#endif
}
Context
2
&
initializeContextFromDirect3DDevice9
(
IDirect3DDevice9
*
pDirect3DDevice9
)
Context
&
initializeContextFromDirect3DDevice9
(
IDirect3DDevice9
*
pDirect3DDevice9
)
{
(
void
)
pDirect3DDevice9
;
#if !defined(HAVE_DIRECTX)
...
...
@@ -665,7 +665,7 @@ Context2& initializeContextFromDirect3DDevice9(IDirect3DDevice9* pDirect3DDevice
CV_Error
(
cv
::
Error
::
OpenCLInitError
,
"OpenCL: Can't create context for DirectX interop"
);
}
Context
2
&
ctx
=
Context2
::
getDefault
(
false
);
Context
&
ctx
=
Context
::
getDefault
(
false
);
initializeContextFromHandle
(
ctx
,
platforms
[
found
],
context
,
device
);
g_isDirect3DDevice9Ex
=
false
;
return
ctx
;
...
...
@@ -720,7 +720,7 @@ void convertToD3D11Texture2D(InputArray src, ID3D11Texture2D* pD3D11Texture2D)
CV_Assert
(
srcSize
.
width
==
(
int
)
desc
.
Width
&&
srcSize
.
height
==
(
int
)
desc
.
Height
);
using
namespace
cv
::
ocl
;
Context
2
&
ctx
=
Context2
::
getDefault
();
Context
&
ctx
=
Context
::
getDefault
();
cl_context
context
=
(
cl_context
)
ctx
.
ptr
();
UMat
u
=
src
.
getUMat
();
...
...
@@ -736,7 +736,7 @@ void convertToD3D11Texture2D(InputArray src, ID3D11Texture2D* pD3D11Texture2D)
cl_mem
clBuffer
=
(
cl_mem
)
u
.
handle
(
ACCESS_READ
);
cl_command_queue
q
=
(
cl_command_queue
)
Queue
::
getDefault
().
ptr
();
cl_command_queue
q
=
(
cl_command_queue
)
Command
Queue
::
getDefault
().
ptr
();
status
=
clEnqueueAcquireD3D11ObjectsKHR
(
q
,
1
,
&
clImage
,
0
,
NULL
,
NULL
);
if
(
status
!=
CL_SUCCESS
)
CV_Error
(
cv
::
Error
::
OpenCLApiCallError
,
"OpenCL: clEnqueueAcquireD3D11ObjectsKHR failed"
);
...
...
@@ -777,7 +777,7 @@ void convertFromD3D11Texture2D(ID3D11Texture2D* pD3D11Texture2D, OutputArray dst
CV_Assert
(
textureType
>=
0
);
using
namespace
cv
::
ocl
;
Context
2
&
ctx
=
Context2
::
getDefault
();
Context
&
ctx
=
Context
::
getDefault
();
cl_context
context
=
(
cl_context
)
ctx
.
ptr
();
// TODO Need to specify ACCESS_WRITE here somehow to prevent useless data copying!
...
...
@@ -795,7 +795,7 @@ void convertFromD3D11Texture2D(ID3D11Texture2D* pD3D11Texture2D, OutputArray dst
cl_mem
clBuffer
=
(
cl_mem
)
u
.
handle
(
ACCESS_READ
);
cl_command_queue
q
=
(
cl_command_queue
)
Queue
::
getDefault
().
ptr
();
cl_command_queue
q
=
(
cl_command_queue
)
Command
Queue
::
getDefault
().
ptr
();
status
=
clEnqueueAcquireD3D11ObjectsKHR
(
q
,
1
,
&
clImage
,
0
,
NULL
,
NULL
);
if
(
status
!=
CL_SUCCESS
)
CV_Error
(
cv
::
Error
::
OpenCLApiCallError
,
"OpenCL: clEnqueueAcquireD3D11ObjectsKHR failed"
);
...
...
@@ -868,7 +868,7 @@ void convertToD3D10Texture2D(InputArray src, ID3D10Texture2D* pD3D10Texture2D)
CV_Assert
(
srcSize
.
width
==
(
int
)
desc
.
Width
&&
srcSize
.
height
==
(
int
)
desc
.
Height
);
using
namespace
cv
::
ocl
;
Context
2
&
ctx
=
Context2
::
getDefault
();
Context
&
ctx
=
Context
::
getDefault
();
cl_context
context
=
(
cl_context
)
ctx
.
ptr
();
UMat
u
=
src
.
getUMat
();
...
...
@@ -884,7 +884,7 @@ void convertToD3D10Texture2D(InputArray src, ID3D10Texture2D* pD3D10Texture2D)
cl_mem
clBuffer
=
(
cl_mem
)
u
.
handle
(
ACCESS_READ
);
cl_command_queue
q
=
(
cl_command_queue
)
Queue
::
getDefault
().
ptr
();
cl_command_queue
q
=
(
cl_command_queue
)
Command
Queue
::
getDefault
().
ptr
();
status
=
clEnqueueAcquireD3D10ObjectsKHR
(
q
,
1
,
&
clImage
,
0
,
NULL
,
NULL
);
if
(
status
!=
CL_SUCCESS
)
CV_Error
(
cv
::
Error
::
OpenCLApiCallError
,
"OpenCL: clEnqueueAcquireD3D10ObjectsKHR failed"
);
...
...
@@ -925,7 +925,7 @@ void convertFromD3D10Texture2D(ID3D10Texture2D* pD3D10Texture2D, OutputArray dst
CV_Assert
(
textureType
>=
0
);
using
namespace
cv
::
ocl
;
Context
2
&
ctx
=
Context2
::
getDefault
();
Context
&
ctx
=
Context
::
getDefault
();
cl_context
context
=
(
cl_context
)
ctx
.
ptr
();
// TODO Need to specify ACCESS_WRITE here somehow to prevent useless data copying!
...
...
@@ -943,7 +943,7 @@ void convertFromD3D10Texture2D(ID3D10Texture2D* pD3D10Texture2D, OutputArray dst
cl_mem
clBuffer
=
(
cl_mem
)
u
.
handle
(
ACCESS_READ
);
cl_command_queue
q
=
(
cl_command_queue
)
Queue
::
getDefault
().
ptr
();
cl_command_queue
q
=
(
cl_command_queue
)
Command
Queue
::
getDefault
().
ptr
();
status
=
clEnqueueAcquireD3D10ObjectsKHR
(
q
,
1
,
&
clImage
,
0
,
NULL
,
NULL
);
if
(
status
!=
CL_SUCCESS
)
CV_Error
(
cv
::
Error
::
OpenCLApiCallError
,
"OpenCL: clEnqueueAcquireD3D10ObjectsKHR failed"
);
...
...
@@ -1019,7 +1019,7 @@ void convertToDirect3DSurface9(InputArray src, IDirect3DSurface9* pDirect3DSurfa
CV_Assert
(
srcSize
.
width
==
(
int
)
desc
.
Width
&&
srcSize
.
height
==
(
int
)
desc
.
Height
);
using
namespace
cv
::
ocl
;
Context
2
&
ctx
=
Context2
::
getDefault
();
Context
&
ctx
=
Context
::
getDefault
();
cl_context
context
=
(
cl_context
)
ctx
.
ptr
();
UMat
u
=
src
.
getUMat
();
...
...
@@ -1038,7 +1038,7 @@ void convertToDirect3DSurface9(InputArray src, IDirect3DSurface9* pDirect3DSurfa
cl_mem
clBuffer
=
(
cl_mem
)
u
.
handle
(
ACCESS_READ
);
cl_command_queue
q
=
(
cl_command_queue
)
Queue
::
getDefault
().
ptr
();
cl_command_queue
q
=
(
cl_command_queue
)
Command
Queue
::
getDefault
().
ptr
();
status
=
clEnqueueAcquireDX9MediaSurfacesKHR
(
q
,
1
,
&
clImage
,
0
,
NULL
,
NULL
);
if
(
status
!=
CL_SUCCESS
)
CV_Error
(
cv
::
Error
::
OpenCLApiCallError
,
"OpenCL: clEnqueueAcquireDX9MediaSurfacesKHR failed"
);
...
...
@@ -1083,7 +1083,7 @@ void convertFromDirect3DSurface9(IDirect3DSurface9* pDirect3DSurface9, OutputArr
CV_Assert
(
surfaceType
>=
0
);
using
namespace
cv
::
ocl
;
Context
2
&
ctx
=
Context2
::
getDefault
();
Context
&
ctx
=
Context
::
getDefault
();
cl_context
context
=
(
cl_context
)
ctx
.
ptr
();
// TODO Need to specify ACCESS_WRITE here somehow to prevent useless data copying!
...
...
@@ -1104,7 +1104,7 @@ void convertFromDirect3DSurface9(IDirect3DSurface9* pDirect3DSurface9, OutputArr
cl_mem
clBuffer
=
(
cl_mem
)
u
.
handle
(
ACCESS_WRITE
);
cl_command_queue
q
=
(
cl_command_queue
)
Queue
::
getDefault
().
ptr
();
cl_command_queue
q
=
(
cl_command_queue
)
Command
Queue
::
getDefault
().
ptr
();
status
=
clEnqueueAcquireDX9MediaSurfacesKHR
(
q
,
1
,
&
clImage
,
0
,
NULL
,
NULL
);
if
(
status
!=
CL_SUCCESS
)
CV_Error
(
cv
::
Error
::
OpenCLApiCallError
,
"OpenCL: clEnqueueAcquireDX9MediaSurfacesKHR failed"
);
...
...
modules/core/src/dxt.cpp
View file @
c7fe1628
...
...
@@ -1545,7 +1545,7 @@ class PlanCache
clStridesOut
[
2
]
=
dft_rows
?
clStridesOut
[
1
]
:
dft_size
.
width
*
clStridesOut
[
1
];
// TODO remove all plans if context changed
CLAMDDFT_Assert
(
clAmdFftCreateDefaultPlan
(
&
plHandle
,
(
cl_context
)
ocl
::
Context
2
::
getDefault
().
ptr
(),
dim
,
clLengthsIn
))
CLAMDDFT_Assert
(
clAmdFftCreateDefaultPlan
(
&
plHandle
,
(
cl_context
)
ocl
::
Context
::
getDefault
().
ptr
(),
dim
,
clLengthsIn
))
// setting plan properties
CLAMDDFT_Assert
(
clAmdFftSetPlanPrecision
(
plHandle
,
doubleFP
?
CLFFT_DOUBLE
:
CLFFT_SINGLE
));
...
...
@@ -1560,8 +1560,8 @@ class PlanCache
CLAMDDFT_Assert
(
clAmdFftSetPlanScale
(
plHandle
,
dft_inverse
?
CLFFT_BACKWARD
:
CLFFT_FORWARD
,
scale
))
// ready to bake
cl_command_queue
commandQ
ueue
=
(
cl_command_queue
)
ocl
::
Queue
::
getDefault
().
ptr
();
CLAMDDFT_Assert
(
clAmdFftBakePlan
(
plHandle
,
1
,
&
commandQ
ueue
,
NULL
,
NULL
))
cl_command_queue
q
ueue
=
(
cl_command_queue
)
ocl
::
Queue
::
getDefault
().
ptr
();
CLAMDDFT_Assert
(
clAmdFftBakePlan
(
plHandle
,
1
,
&
q
ueue
,
NULL
,
NULL
))
}
~
FftPlan
()
...
...
@@ -1593,7 +1593,7 @@ public:
clAmdFftPlanHandle
getPlanHandle
(
const
Size
&
dft_size
,
int
src_step
,
int
dst_step
,
bool
doubleFP
,
bool
inplace
,
int
flags
,
FftType
fftType
)
{
cl_context
currentContext
=
(
cl_context
)
ocl
::
Context
2
::
getDefault
().
ptr
();
cl_context
currentContext
=
(
cl_context
)
ocl
::
Context
::
getDefault
().
ptr
();
for
(
size_t
i
=
0
,
size
=
planStorage
.
size
();
i
<
size
;
i
++
)
{
...
...
@@ -1704,11 +1704,11 @@ static bool ocl_dft(InputArray _src, OutputArray _dst, int flags)
cl_mem
srcarg
=
(
cl_mem
)
src
.
handle
(
ACCESS_READ
);
cl_mem
dstarg
=
(
cl_mem
)
dst
.
handle
(
ACCESS_RW
);
cl_command_queue
commandQ
ueue
=
(
cl_command_queue
)
ocl
::
Queue
::
getDefault
().
ptr
();
cl_command_queue
q
ueue
=
(
cl_command_queue
)
ocl
::
Queue
::
getDefault
().
ptr
();
cl_event
e
=
0
;
CLAMDDFT_Assert
(
clAmdFftEnqueueTransform
(
plHandle
,
dft_inverse
?
CLFFT_BACKWARD
:
CLFFT_FORWARD
,
1
,
&
commandQ
ueue
,
0
,
NULL
,
&
e
,
1
,
&
q
ueue
,
0
,
NULL
,
&
e
,
&
srcarg
,
&
dstarg
,
(
cl_mem
)
tmpBuffer
.
handle
(
ACCESS_RW
)))
tmpBuffer
.
addref
();
...
...
modules/core/src/ocl.cpp
View file @
c7fe1628
This diff is collapsed.
Click to expand it.
modules/imgproc/src/imgwarp.cpp
View file @
c7fe1628
...
...
@@ -3900,7 +3900,7 @@ static bool ocl_warpTransform(InputArray _src, OutputArray _dst, InputArray _M0,
return
false
;
const
char
*
const
interpolationMap
[
3
]
=
{
"NEAREST"
,
"LINEAR"
,
"CUBIC"
};
ocl
::
ProgramSource
2
program
=
op_type
==
OCL_OP_AFFINE
?
ocl
::
ProgramSource
program
=
op_type
==
OCL_OP_AFFINE
?
ocl
::
imgproc
::
warp_affine_oclsrc
:
ocl
::
imgproc
::
warp_perspective_oclsrc
;
const
char
*
const
kernelName
=
op_type
==
OCL_OP_AFFINE
?
"warpAffine"
:
"warpPerspective"
;
...
...
modules/imgproc/src/pyramids.cpp
View file @
c7fe1628
...
...
@@ -407,8 +407,7 @@ static bool ocl_pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, in
{
int
type
=
_src
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
),
channels
=
CV_MAT_CN
(
type
);
if
(((
channels
!=
1
)
&&
(
channels
!=
2
)
&&
(
channels
!=
4
))
||
(
borderType
!=
BORDER_DEFAULT
))
if
((
channels
!=
1
&&
channels
!=
2
&&
channels
!=
4
)
||
borderType
!=
BORDER_DEFAULT
)
return
false
;
bool
doubleSupport
=
ocl
::
Device
::
getDefault
().
doubleFPConfig
()
>
0
;
...
...
@@ -425,18 +424,16 @@ static bool ocl_pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, in
_dst
.
create
(
dsize
,
src
.
type
()
);
UMat
dst
=
_dst
.
getUMat
();
const
char
*
const
kernelName
=
"pyrDown"
;
ocl
::
ProgramSource2
program
=
ocl
::
imgproc
::
pyr_down_oclsrc
;
ocl
::
Kernel
k
;
int
float_depth
=
depth
==
CV_64F
?
CV_64F
:
CV_32F
;
char
cvt
[
2
][
50
];
k
.
create
(
kernelName
,
program
,
ocl
::
Kernel
k
(
"pyrDown"
,
ocl
::
imgproc
::
pyr_down_oclsrc
,
format
(
"-D T=%s -D FT=%s -D convertToT=%s -D convertToFT=%s%s"
,
ocl
::
typeToStr
(
type
),
ocl
::
typeToStr
(
CV_MAKETYPE
(
float_depth
,
channels
)),
ocl
::
convertTypeStr
(
float_depth
,
depth
,
channels
,
cvt
[
0
]),
ocl
::
convertTypeStr
(
depth
,
float_depth
,
channels
,
cvt
[
1
]),
doubleSupport
?
" -D DOUBLE_SUPPORT"
:
""
));
if
(
k
.
empty
())
return
false
;
k
.
args
(
ocl
::
KernelArg
::
ReadOnly
(
src
),
ocl
::
KernelArg
::
WriteOnly
(
dst
));
...
...
@@ -449,12 +446,11 @@ static bool ocl_pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int
{
int
type
=
_src
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
),
channels
=
CV_MAT_CN
(
type
);
if
(((
channels
!=
1
)
&&
(
channels
!=
2
)
&&
(
channels
!=
4
))
||
(
borderType
!=
BORDER_DEFAULT
))
if
((
channels
!=
1
&&
channels
!=
2
&&
channels
!=
4
)
||
borderType
!=
BORDER_DEFAULT
)
return
false
;
bool
doubleSupport
=
ocl
::
Device
::
getDefault
().
doubleFPConfig
()
>
0
;
if
(
(
depth
==
CV_64F
)
&&
!
(
doubleSupport
)
)
if
(
depth
==
CV_64F
&&
!
doubleSupport
)
return
false
;
Size
ssize
=
_src
.
size
();
...
...
@@ -466,18 +462,16 @@ static bool ocl_pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int
_dst
.
create
(
dsize
,
src
.
type
()
);
UMat
dst
=
_dst
.
getUMat
();
const
char
*
const
kernelName
=
"pyrUp"
;
ocl
::
ProgramSource2
program
=
ocl
::
imgproc
::
pyr_up_oclsrc
;
ocl
::
Kernel
k
;
int
float_depth
=
depth
==
CV_64F
?
CV_64F
:
CV_32F
;
char
cvt
[
2
][
50
];
k
.
create
(
kernelName
,
program
,
ocl
::
Kernel
k
(
"pyrUp"
,
ocl
::
imgproc
::
pyr_up_oclsrc
,
format
(
"-D T=%s -D FT=%s -D convertToT=%s -D convertToFT=%s%s"
,
ocl
::
typeToStr
(
type
),
ocl
::
typeToStr
(
CV_MAKETYPE
(
float_depth
,
channels
)),
ocl
::
convertTypeStr
(
float_depth
,
depth
,
channels
,
cvt
[
0
]),
ocl
::
convertTypeStr
(
depth
,
float_depth
,
channels
,
cvt
[
1
]),
doubleSupport
?
" -D DOUBLE_SUPPORT"
:
""
));
if
(
k
.
empty
())
return
false
;
k
.
args
(
ocl
::
KernelArg
::
ReadOnly
(
src
),
ocl
::
KernelArg
::
WriteOnly
(
dst
));
size_t
globalThreads
[
2
]
=
{
dst
.
cols
,
dst
.
rows
};
...
...
modules/ts/src/ocl_test.cpp
View file @
c7fe1628
...
...
@@ -98,14 +98,14 @@ void dumpOpenCLDevice()
using
namespace
cv
::
ocl
;
try
{
std
::
vector
<
PlatformInfo
2
>
platforms
;
std
::
vector
<
PlatformInfo
>
platforms
;
cv
::
ocl
::
getPlatfomsInfo
(
platforms
);
if
(
platforms
.
size
()
>
0
)
{
DUMP_MESSAGE_STDOUT
(
"OpenCL Platforms: "
);
for
(
size_t
i
=
0
;
i
<
platforms
.
size
();
i
++
)
{
const
PlatformInfo
2
*
platform
=
&
platforms
[
i
];
const
PlatformInfo
*
platform
=
&
platforms
[
i
];
DUMP_MESSAGE_STDOUT
(
" "
<<
platform
->
name
().
c_str
());
Device
current_device
;
for
(
int
j
=
0
;
j
<
platform
->
deviceNumber
();
j
++
)
...
...
samples/directx/d3d_base.inl.hpp
View file @
c7fe1628
...
...
@@ -134,7 +134,7 @@ static void renderToD3DObject(void)
const
float
fps
=
getFps
();
String
deviceName
=
cv
::
ocl
::
useOpenCL
()
?
cv
::
ocl
::
Context
2
::
getDefault
().
device
(
0
).
name
()
:
"No OpenCL device"
;
String
deviceName
=
cv
::
ocl
::
useOpenCL
()
?
cv
::
ocl
::
Context
::
getDefault
().
device
(
0
).
name
()
:
"No OpenCL device"
;
if
((
frame
%
std
::
max
(
1
,
(
int
)(
fps
/
25
)))
==
0
)
{
...
...
@@ -360,7 +360,7 @@ static cv::Mat getInputTexture()
{
cv
::
resize
(
inputMat
,
inputMat
,
cv
::
Size
(
WIDTH
,
HEIGHT
));
}
String
deviceName
=
cv
::
ocl
::
useOpenCL
()
?
cv
::
ocl
::
Context
2
::
getDefault
().
device
(
0
).
name
()
:
"No OpenCL device"
;
String
deviceName
=
cv
::
ocl
::
useOpenCL
()
?
cv
::
ocl
::
Context
::
getDefault
().
device
(
0
).
name
()
:
"No OpenCL device"
;
cv
::
Scalar
color
(
64
,
255
,
64
,
255
);
cv
::
putText
(
inputMat
,
cv
::
format
(
"OpenCL Device name: %s"
,
deviceName
.
c_str
()),
...
...
@@ -396,13 +396,13 @@ static int mainLoop()
if
(
cv
::
ocl
::
haveOpenCL
())
{
#if defined(USE_D3D9)
cv
::
ocl
::
Context
2
&
ctx
=
cv
::
directx
::
ocl
::
initializeContextFromDirect3DDevice9
(
dev
);
cv
::
ocl
::
Context
&
ctx
=
cv
::
directx
::
ocl
::
initializeContextFromDirect3DDevice9
(
dev
);
#elif defined (USE_D3DEX)
cv
::
ocl
::
Context
2
&
ctx
=
cv
::
directx
::
ocl
::
initializeContextFromDirect3DDevice9Ex
(
dev
);
cv
::
ocl
::
Context
&
ctx
=
cv
::
directx
::
ocl
::
initializeContextFromDirect3DDevice9Ex
(
dev
);
#elif defined(USE_D3D10)
cv
::
ocl
::
Context
2
&
ctx
=
cv
::
directx
::
ocl
::
initializeContextFromD3D10Device
(
dev
);
cv
::
ocl
::
Context
&
ctx
=
cv
::
directx
::
ocl
::
initializeContextFromD3D10Device
(
dev
);
#elif defined(USE_D3D11)
cv
::
ocl
::
Context
2
&
ctx
=
cv
::
directx
::
ocl
::
initializeContextFromD3D11Device
(
dev
);
cv
::
ocl
::
Context
&
ctx
=
cv
::
directx
::
ocl
::
initializeContextFromD3D11Device
(
dev
);
#else
#error "Invalid USE_D3D value"
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment