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
d7f4a223
Commit
d7f4a223
authored
Dec 01, 2013
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed several compile errors/warnings; reacted on the PR comments
parent
6da5d213
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
22 deletions
+19
-22
matrix.cpp
modules/core/src/matrix.cpp
+1
-1
ocl.cpp
modules/core/src/ocl.cpp
+11
-14
test_umat.cpp
modules/core/test/test_umat.cpp
+2
-2
cvtcolor.cl
modules/imgproc/src/opencl/cvtcolor.cl
+5
-4
test_api.cpp
modules/ocl/test/test_api.cpp
+0
-1
No files found.
modules/core/src/matrix.cpp
View file @
d7f4a223
...
@@ -126,7 +126,7 @@ void MatAllocator::upload(UMatData* u, const void* srcptr, int dims, const size_
...
@@ -126,7 +126,7 @@ void MatAllocator::upload(UMatData* u, const void* srcptr, int dims, const size_
void
MatAllocator
::
copy
(
UMatData
*
usrc
,
UMatData
*
udst
,
int
dims
,
const
size_t
sz
[],
void
MatAllocator
::
copy
(
UMatData
*
usrc
,
UMatData
*
udst
,
int
dims
,
const
size_t
sz
[],
const
size_t
srcofs
[],
const
size_t
srcstep
[],
const
size_t
srcofs
[],
const
size_t
srcstep
[],
const
size_t
dstofs
[],
const
size_t
dststep
[],
bool
sync
)
const
const
size_t
dstofs
[],
const
size_t
dststep
[],
bool
/*sync*/
)
const
{
{
if
(
!
usrc
||
!
udst
)
if
(
!
usrc
||
!
udst
)
return
;
return
;
...
...
modules/core/src/ocl.cpp
View file @
d7f4a223
...
@@ -2258,25 +2258,21 @@ bool Kernel::run(int dims, size_t _globalsize[], size_t _localsize[],
...
@@ -2258,25 +2258,21 @@ bool Kernel::run(int dims, size_t _globalsize[], size_t _localsize[],
return
false
;
return
false
;
cl_command_queue
qq
=
getQueue
(
q
);
cl_command_queue
qq
=
getQueue
(
q
);
size_t
offset
[
CV_MAX_DIM
]
=
{
0
},
globalsize
[
CV_MAX_DIM
]
=
{
1
,
1
,
1
}
,
localsize
[
CV_MAX_DIM
]
=
{
1
,
1
,
1
}
;
size_t
offset
[
CV_MAX_DIM
]
=
{
0
},
globalsize
[
CV_MAX_DIM
]
=
{
1
,
1
,
1
};
size_t
total
=
1
;
size_t
total
=
1
;
CV_Assert
(
_globalsize
!=
0
);
for
(
int
i
=
0
;
i
<
dims
;
i
++
)
for
(
int
i
=
0
;
i
<
dims
;
i
++
)
{
{
size_t
val0
=
_localsize
?
_localsize
[
i
]
:
size_t
val
=
_localsize
?
_localsize
[
i
]
:
dims
==
1
?
64
:
dims
==
2
?
16
>>
i
:
dims
==
3
?
8
>>
(
i
>
0
)
:
1
;
dims
==
1
?
64
:
dims
==
2
?
(
16
>>
i
)
:
dims
==
3
?
(
8
>>
(
int
)(
i
>
0
))
:
1
;
size_t
val
=
1
;
CV_Assert
(
val
>
0
);
while
(
val
*
2
<
val0
)
val
*=
2
;
if
(
_localsize
)
localsize
[
i
]
=
val
;
CV_Assert
(
_globalsize
&&
_globalsize
[
i
]
>=
0
);
total
*=
_globalsize
[
i
];
total
*=
_globalsize
[
i
];
globalsize
[
i
]
=
((
_globalsize
[
i
]
+
val
-
1
)
/
val
)
*
val
;
globalsize
[
i
]
=
((
_globalsize
[
i
]
+
val
-
1
)
/
val
)
*
val
;
}
}
if
(
total
==
0
)
if
(
total
==
0
)
return
true
;
return
true
;
cl_int
retval
=
clEnqueueNDRangeKernel
(
qq
,
p
->
handle
,
(
cl_uint
)
dims
,
cl_int
retval
=
clEnqueueNDRangeKernel
(
qq
,
p
->
handle
,
(
cl_uint
)
dims
,
offset
,
globalsize
,
_localsize
?
localsize
:
0
,
0
,
0
,
offset
,
globalsize
,
_localsize
,
0
,
0
,
sync
?
0
:
&
p
->
e
);
sync
?
0
:
&
p
->
e
);
if
(
sync
||
retval
<
0
)
if
(
sync
||
retval
<
0
)
{
{
...
@@ -2976,7 +2972,7 @@ public:
...
@@ -2976,7 +2972,7 @@ public:
return
;
return
;
// there should be no user-visible CPU copies of the UMat which we are going to copy to
// there should be no user-visible CPU copies of the UMat which we are going to copy to
CV_Assert
(
u
->
refcount
==
0
);
CV_Assert
(
u
->
refcount
==
0
||
u
->
tempUMat
()
);
size_t
total
=
0
,
new_sz
[]
=
{
0
,
0
,
0
};
size_t
total
=
0
,
new_sz
[]
=
{
0
,
0
,
0
};
size_t
srcrawofs
=
0
,
new_srcofs
[]
=
{
0
,
0
,
0
},
new_srcstep
[]
=
{
0
,
0
,
0
};
size_t
srcrawofs
=
0
,
new_srcofs
[]
=
{
0
,
0
,
0
},
new_srcstep
[]
=
{
0
,
0
,
0
};
...
@@ -3028,7 +3024,7 @@ public:
...
@@ -3028,7 +3024,7 @@ public:
void
copy
(
UMatData
*
src
,
UMatData
*
dst
,
int
dims
,
const
size_t
sz
[],
void
copy
(
UMatData
*
src
,
UMatData
*
dst
,
int
dims
,
const
size_t
sz
[],
const
size_t
srcofs
[],
const
size_t
srcstep
[],
const
size_t
srcofs
[],
const
size_t
srcstep
[],
const
size_t
dstofs
[],
const
size_t
dststep
[],
bool
sync
)
const
const
size_t
dstofs
[],
const
size_t
dststep
[],
bool
_
sync
)
const
{
{
if
(
!
src
||
!
dst
)
if
(
!
src
||
!
dst
)
return
;
return
;
...
@@ -3072,14 +3068,15 @@ public:
...
@@ -3072,14 +3068,15 @@ public:
cl_int
retval
;
cl_int
retval
;
CV_Assert
(
(
retval
=
clEnqueueCopyBufferRect
(
q
,
(
cl_mem
)
src
->
handle
,
(
cl_mem
)
dst
->
handle
,
CV_Assert
(
(
retval
=
clEnqueueCopyBufferRect
(
q
,
(
cl_mem
)
src
->
handle
,
(
cl_mem
)
dst
->
handle
,
new_srcofs
,
new_dstofs
,
new_sz
,
new_srcofs
,
new_dstofs
,
new_sz
,
new_srcstep
[
0
],
new_srcstep
[
1
],
new_dststep
[
0
],
new_dststep
[
1
],
new_srcstep
[
0
],
new_srcstep
[
1
],
new_dststep
[
0
],
new_dststep
[
1
],
0
,
0
,
0
))
>=
0
);
0
,
0
,
0
))
>=
0
);
}
}
dst
->
markHostCopyObsolete
(
true
);
dst
->
markHostCopyObsolete
(
true
);
dst
->
markDeviceCopyObsolete
(
false
);
dst
->
markDeviceCopyObsolete
(
false
);
if
(
sync
)
if
(
_
sync
)
clFinish
(
q
);
clFinish
(
q
);
}
}
...
...
modules/core/test/test_umat.cpp
View file @
d7f4a223
...
@@ -201,7 +201,7 @@ void CV_UMatTest::run( int /* start_from */)
...
@@ -201,7 +201,7 @@ void CV_UMatTest::run( int /* start_from */)
TEST
(
Core_UMat
,
base
)
{
CV_UMatTest
test
;
test
.
safe_run
();
}
TEST
(
Core_UMat
,
base
)
{
CV_UMatTest
test
;
test
.
safe_run
();
}
TEST
(
Core_UMat
,
simple
)
TEST
(
Core_UMat
,
getUMat
)
{
{
{
{
int
a
[
3
]
=
{
1
,
2
,
3
};
int
a
[
3
]
=
{
1
,
2
,
3
};
...
@@ -216,7 +216,7 @@ TEST(Core_UMat, simple)
...
@@ -216,7 +216,7 @@ TEST(Core_UMat, simple)
{
{
uchar
*
const
ptr
=
m
.
ptr
<
uchar
>
(
y
);
uchar
*
const
ptr
=
m
.
ptr
<
uchar
>
(
y
);
for
(
int
x
=
0
;
x
<
m
.
cols
;
++
x
)
for
(
int
x
=
0
;
x
<
m
.
cols
;
++
x
)
ptr
[
x
]
=
x
+
y
*
2
;
ptr
[
x
]
=
(
uchar
)(
x
+
y
*
2
)
;
}
}
ref
=
m
.
clone
();
ref
=
m
.
clone
();
...
...
modules/imgproc/src/opencl/cvtcolor.cl
View file @
d7f4a223
...
@@ -124,16 +124,17 @@ __kernel void RGB2Gray(__global const uchar* srcptr, int srcstep, int srcoffset,
...
@@ -124,16 +124,17 @@ __kernel void RGB2Gray(__global const uchar* srcptr, int srcstep, int srcoffset,
#
endif
#
endif
}
}
#
else
#
else
const
int
x
0
=
get_global_id
(
0
)
*STRIPE_SIZE
;
const
int
x
_min
=
get_global_id
(
0
)
*STRIPE_SIZE
;
const
int
x
1
=
min
(
x0
+
STRIPE_SIZE,
cols
)
;
const
int
x
_max
=
min
(
x_min
+
STRIPE_SIZE,
cols
)
;
const
int
y
=
get_global_id
(
1
)
;
const
int
y
=
get_global_id
(
1
)
;
if
(
y
<
rows
)
if
(
y
<
rows
)
{
{
__global
const
DATA_TYPE*
src
=
(
__global
const
DATA_TYPE*
)(
srcptr
+
mad24
(
y,
srcstep,
srcoffset
))
+
x0*scn
;
__global
const
DATA_TYPE*
src
=
(
__global
const
DATA_TYPE*
)(
srcptr
+
mad24
(
y,
srcstep,
srcoffset
))
+
x_min*scn
;
__global
DATA_TYPE*
dst
=
(
__global
DATA_TYPE*
)(
dstptr
+
mad24
(
y,
dststep,
dstoffset
))
;
__global
DATA_TYPE*
dst
=
(
__global
DATA_TYPE*
)(
dstptr
+
mad24
(
y,
dststep,
dstoffset
))
;
int
x
;
int
x
;
for
(
x
=
x
0
; x < x1
; x++, src += scn )
for
(
x
=
x
_min
; x < x_max
; x++, src += scn )
#
ifdef
DEPTH_5
#
ifdef
DEPTH_5
dst[x]
=
src[bidx]
*
0.114f
+
src[1]
*
0.587f
+
src[
(
bidx^2
)
]
*
0.299f
;
dst[x]
=
src[bidx]
*
0.114f
+
src[1]
*
0.587f
+
src[
(
bidx^2
)
]
*
0.299f
;
#
else
#
else
...
...
modules/ocl/test/test_api.cpp
View file @
d7f4a223
...
@@ -136,4 +136,3 @@ TEST(OCL_TestTAPI, performance)
...
@@ -136,4 +136,3 @@ TEST(OCL_TestTAPI, performance)
cv::destroyWindow("result0");
cv::destroyWindow("result0");
cv::destroyWindow("result1");*/
cv::destroyWindow("result1");*/
}
}
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