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
b2fe053f
Commit
b2fe053f
authored
Oct 02, 2013
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Oct 02, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1548 from ilya-lavrenov:ocl_bitwise_not
parents
d019344c
a613a1a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
43 deletions
+26
-43
arithm_bitwise_not.cl
modules/ocl/src/opencl/arithm_bitwise_not.cl
+26
-43
No files found.
modules/ocl/src/opencl/arithm_bitwise_not.cl
View file @
b2fe053f
...
...
@@ -42,6 +42,7 @@
//
the
use
of
this
software,
even
if
advised
of
the
possibility
of
such
damage.
//
//M*/
#
if
defined
(
DOUBLE_SUPPORT
)
#
ifdef
cl_khr_fp64
#
pragma
OPENCL
EXTENSION
cl_khr_fp64:enable
...
...
@@ -49,10 +50,11 @@
#
pragma
OPENCL
EXTENSION
cl_amd_fp64:enable
#
endif
#
endif
//////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////BITWISE_NOT////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////BITWISE_NOT////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
/**************************************bitwise_not
without
mask**************************************/
__kernel
void
arithm_bitwise_not_D0
(
__global
uchar
*src1,
int
src1_step,
int
src1_offset,
__global
uchar
*dst,
int
dst_step,
int
dst_offset,
int
rows,
int
cols,
int
dst_step1
)
...
...
@@ -63,35 +65,22 @@ __kernel void arithm_bitwise_not_D0 (__global uchar *src1, int src1_step, int sr
if
(
x
<
cols
&&
y
<
rows
)
{
x
=
x
<<
2
;
#
ifdef
dst_align
#
undef
dst_align
#
endif
#
define
dst_align
(
dst_offset
&
3
)
int
src1_index
=
mad24
(
y,
src1_step,
x
+
src1_offset
-
dst_align
)
;
int
src1_index
=
mad24
(
y,
src1_step,
x
+
src1_offset
)
;
int
dst_start
=
mad24
(
y,
dst_step,
dst_offset
)
;
int
dst_end
=
mad24
(
y,
dst_step,
dst_offset
+
dst_step1
)
;
int
dst_index
=
mad24
(
y,
dst_step,
dst_offset
+
x
&
(
int
)
0xfffffffc
)
;
int
src1_index_fix
=
src1_index
<
0
?
0
:
src1_index
;
uchar4
src1_data
=
vload4
(
0
,
src1
+
src1_index_fix
)
;
uchar4
dst_data
=
*
((
__global
uchar4
*
)(
dst
+
dst_index
))
;
uchar4
tmp_data
=
~
src1_data
;
/*
if
(
src1_index
<
0
)
{
uchar4
tmp
;
tmp.xyzw
=
(
src1_index
==
-2
)
?
src1_data.zwxy:src1_data.yzwx
;
src1_data.xyzw
=
(
src1_index
==
-1
)
?
src1_data.wxyz:tmp.xyzw
;
}
*/
dst_data.x
=
((
dst_index
+
0
>=
dst_start
)
&&
(
dst_index
+
0
<
dst_end
))
?
tmp_data.x
:
dst_data.x
;
dst_data.y
=
((
dst_index
+
1
>=
dst_start
)
&&
(
dst_index
+
1
<
dst_end
))
?
tmp_data.y
:
dst_data.y
;
dst_data.z
=
((
dst_index
+
2
>=
dst_start
)
&&
(
dst_index
+
2
<
dst_end
))
?
tmp_data.z
:
dst_data.z
;
dst_data.w
=
((
dst_index
+
3
>=
dst_start
)
&&
(
dst_index
+
3
<
dst_end
))
?
tmp_data.w
:
dst_data.w
;
int
dst_index
=
mad24
(
y,
dst_step,
dst_offset
+
x
)
;
*
((
__global
uchar4
*
)(
dst
+
dst_index
))
=
dst_data
;
uchar4
src1_data
=
vload4
(
0
,
src1
+
src1_index
)
;
uchar4
dst_data
=
vload4
(
0
,
dst
+
dst_index
)
;
uchar4
tmp_data
=
~src1_data
;
dst_data.x
=
dst_index
+
0
<
dst_end
?
tmp_data.x
:
dst_data.x
;
dst_data.y
=
dst_index
+
1
<
dst_end
?
tmp_data.y
:
dst_data.y
;
dst_data.z
=
dst_index
+
2
<
dst_end
?
tmp_data.z
:
dst_data.z
;
dst_data.w
=
dst_index
+
3
<
dst_end
?
tmp_data.w
:
dst_data.w
;
vstore4
(
dst_data,
0
,
dst
+
dst_index
)
;
}
}
...
...
@@ -106,28 +95,22 @@ __kernel void arithm_bitwise_not_D1 (__global char *src1, int src1_step, int src
if
(
x
<
cols
&&
y
<
rows
)
{
x
=
x
<<
2
;
#
ifdef
dst_align
#
undef
dst_align
#
endif
#
define
dst_align
(
dst_offset
&
3
)
int
src1_index
=
mad24
(
y,
src1_step,
x
+
src1_offset
-
dst_align
)
;
int
src1_index
=
mad24
(
y,
src1_step,
x
+
src1_offset
)
;
int
dst_start
=
mad24
(
y,
dst_step,
dst_offset
)
;
int
dst_end
=
mad24
(
y,
dst_step,
dst_offset
+
dst_step1
)
;
int
dst_index
=
mad24
(
y,
dst_step,
dst_offset
+
x
&
(
int
)
0xfffffffc
)
;
int
dst_index
=
mad24
(
y,
dst_step,
dst_offset
+
x
)
;
char4
src1_data
=
vload4
(
0
,
src1
+
src1_index
)
;
char4
dst_data
=
vload4
(
0
,
dst
+
dst_index
)
;
char4
tmp_data
=
~src1_data
;
char4
dst_data
=
*
((
__global
char4
*
)(
dst
+
dst_index
))
;
char4
tmp_data
=
~
src1_data
;
dst_data.x
=
((
dst_index
+
0
>=
dst_start
)
&&
(
dst_index
+
0
<
dst_end
))
?
tmp_data.x
:
dst_data.x
;
dst_data.y
=
((
dst_index
+
1
>=
dst_start
)
&&
(
dst_index
+
1
<
dst_end
))
?
tmp_data.y
:
dst_data.y
;
dst_data.z
=
((
dst_index
+
2
>=
dst_start
)
&&
(
dst_index
+
2
<
dst_end
))
?
tmp_data.z
:
dst_data.z
;
dst_data.w
=
((
dst_index
+
3
>=
dst_start
)
&&
(
dst_index
+
3
<
dst_end
))
?
tmp_data.w
:
dst_data.w
;
dst_data.x
=
dst_index
+
0
<
dst_end
?
tmp_data.x
:
dst_data.x
;
dst_data.y
=
dst_index
+
1
<
dst_end
?
tmp_data.y
:
dst_data.y
;
dst_data.z
=
dst_index
+
2
<
dst_end
?
tmp_data.z
:
dst_data.z
;
dst_data.w
=
dst_index
+
3
<
dst_end
?
tmp_data.w
:
dst_data.w
;
*
((
__global
char4
*
)(
dst
+
dst_index
))
=
dst_data
;
vstore4
(
dst_data,
0
,
dst
+
dst_index
)
;
}
}
...
...
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