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
74fcefed
Commit
74fcefed
authored
Aug 27, 2015
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
giving a chance for OpenCL 1.1 devices
parent
80317428
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
CLprocessor.cpp
samples/android/tutorial-4-opencl/jni/CLprocessor.cpp
+4
-3
GLrender.cpp
samples/android/tutorial-4-opencl/jni/GLrender.cpp
+4
-4
No files found.
samples/android/tutorial-4-opencl/jni/CLprocessor.cpp
View file @
74fcefed
#define __CL_ENABLE_EXCEPTIONS
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
/*let's give a chance for OpenCL 1.1 devices*/
#include <CL/cl.hpp>
#include <EGL/egl.h>
...
...
@@ -182,12 +183,12 @@ void procOCL_I2I(int texIn, int texOut, int w, int h)
LOGD
(
"enqueueReleaseGLObjects() costs %d ms"
,
getTimeInterval
(
t
));
}
void
procOCL_OCV
(
int
tex
,
int
w
,
int
h
)
void
procOCL_OCV
(
int
tex
In
,
int
texOut
,
int
w
,
int
h
)
{
if
(
!
haveOpenCL
)
return
;
int64_t
t
=
getTimeMs
();
cl
::
ImageGL
imgIn
(
theContext
,
CL_MEM_READ_ONLY
,
GL_TEXTURE_2D
,
0
,
tex
);
cl
::
ImageGL
imgIn
(
theContext
,
CL_MEM_READ_ONLY
,
GL_TEXTURE_2D
,
0
,
tex
In
);
std
::
vector
<
cl
::
Memory
>
images
(
1
,
imgIn
);
theQueue
.
enqueueAcquireGLObjects
(
&
images
);
theQueue
.
finish
();
...
...
@@ -204,7 +205,7 @@ void procOCL_OCV(int tex, int w, int h)
LOGD
(
"OpenCV processing costs %d ms"
,
getTimeInterval
(
t
));
t
=
getTimeMs
();
cl
::
ImageGL
imgOut
(
theContext
,
CL_MEM_WRITE_ONLY
,
GL_TEXTURE_2D
,
0
,
tex
);
cl
::
ImageGL
imgOut
(
theContext
,
CL_MEM_WRITE_ONLY
,
GL_TEXTURE_2D
,
0
,
tex
Out
);
images
.
clear
();
images
.
push_back
(
imgOut
);
theQueue
.
enqueueAcquireGLObjects
(
&
images
);
...
...
samples/android/tutorial-4-opencl/jni/GLrender.cpp
View file @
74fcefed
...
...
@@ -31,7 +31,7 @@ const char vss[] = \
"varying vec2 texCoord;
\n
"
\
"void main() {
\n
"
\
" texCoord = vTexCoord;
\n
"
\
" gl_Position = vec4 ( vPosition, 0.0
f, 1.0f
);
\n
"
\
" gl_Position = vec4 ( vPosition, 0.0
, 1.0
);
\n
"
\
"}"
;
const
char
fssOES
[]
=
\
...
...
@@ -268,7 +268,7 @@ void drawFrameProcCPU()
}
void
procOCL_I2I
(
int
texIn
,
int
texOut
,
int
w
,
int
h
);
void
procOCL_OCV
(
int
tex
,
int
w
,
int
h
);
void
procOCL_OCV
(
int
tex
In
,
int
texOut
,
int
w
,
int
h
);
void
drawFrameProcOCL
()
{
drawTex
(
texOES
,
GL_TEXTURE_EXTERNAL_OES
,
FBO
);
...
...
@@ -285,10 +285,10 @@ void drawFrameProcOCLOCV()
drawTex
(
texOES
,
GL_TEXTURE_EXTERNAL_OES
,
FBO
);
// modify pixels in FBO texture using OpenCL and CL-GL interop
procOCL_OCV
(
FBOtex
,
texWidth
,
texHeight
);
procOCL_OCV
(
FBOtex
,
FBOtex2
,
texWidth
,
texHeight
);
// render to screen
drawTex
(
FBOtex
,
GL_TEXTURE_2D
,
0
);
drawTex
(
FBOtex
2
,
GL_TEXTURE_2D
,
0
);
}
extern
"C"
void
drawFrame
()
...
...
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