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
c21a7836
Commit
c21a7836
authored
May 03, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added aligned memory allocation to CudaMem (if allocation type is ZERO_COPY)
fixed bugs in gpu::cvtColor
parent
727fbd53
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
color.cpp
modules/gpu/src/color.cpp
+4
-4
matrix_operations.cpp
modules/gpu/src/matrix_operations.cpp
+18
-1
No files found.
modules/gpu/src/color.cpp
View file @
c21a7836
...
...
@@ -243,7 +243,7 @@ namespace
if
(
dcn
<=
0
)
dcn
=
3
;
CV_Assert
((
scn
==
3
||
scn
==
4
)
&&
(
dcn
==
3
||
dcn
==
4
));
bidx
=
code
==
CV_BGR2YCrCb
||
code
==
CV_
RGB
2YUV
?
0
:
2
;
bidx
=
code
==
CV_BGR2YCrCb
||
code
==
CV_
BGR
2YUV
?
0
:
2
;
static
const
float
yuv_f
[]
=
{
0.114
f
,
0.587
f
,
0.299
f
,
0.492
f
,
0.877
f
};
static
const
int
yuv_i
[]
=
{
B2Y
,
G2Y
,
R2Y
,
8061
,
14369
};
...
...
@@ -281,7 +281,7 @@ namespace
CV_Assert
((
scn
==
3
||
scn
==
4
)
&&
(
dcn
==
3
||
dcn
==
4
));
bidx
=
code
==
CV_YCrCb2BGR
||
code
==
CV_YUV2
RGB
?
0
:
2
;
bidx
=
code
==
CV_YCrCb2BGR
||
code
==
CV_YUV2
BGR
?
0
:
2
;
static
const
float
yuv_f
[]
=
{
2.032
f
,
-
0.395
f
,
-
0.581
f
,
1.140
f
};
static
const
int
yuv_i
[]
=
{
33292
,
-
6472
,
-
9519
,
18678
};
...
...
@@ -391,9 +391,9 @@ namespace
dst
.
create
(
sz
,
CV_MAKETYPE
(
depth
,
dcn
));
//
const void* coeffs = depth == CV_32F ? (void*)coeffs_f : (void*)coeffs_i;
const
void
*
coeffs
=
depth
==
CV_32F
?
(
void
*
)
coeffs_f
:
(
void
*
)
coeffs_i
;
funcs
[
depth
](
src
,
scn
,
dst
,
dcn
,
coeffs
_i
,
stream
);
funcs
[
depth
](
src
,
scn
,
dst
,
dcn
,
coeffs
,
stream
);
break
;
}
...
...
modules/gpu/src/matrix_operations.cpp
View file @
c21a7836
...
...
@@ -590,10 +590,21 @@ void cv::gpu::ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
bool
cv
::
gpu
::
CudaMem
::
canMapHostMemory
()
{
cudaDeviceProp
prop
;
cudaGetDeviceProperties
(
&
prop
,
0
);
cudaGetDeviceProperties
(
&
prop
,
getDevice
()
);
return
(
prop
.
canMapHostMemory
!=
0
)
?
true
:
false
;
}
namespace
{
int
alignUp
(
int
what
,
int
alignment
)
{
int
alignMask
=
alignment
-
1
;
int
inverseAlignMask
=
~
alignMask
;
int
res
=
(
what
+
alignMask
)
&
inverseAlignMask
;
return
res
;
}
}
void
cv
::
gpu
::
CudaMem
::
create
(
int
_rows
,
int
_cols
,
int
_type
,
int
_alloc_type
)
{
if
(
_alloc_type
==
ALLOC_ZEROCOPY
&&
!
canMapHostMemory
())
...
...
@@ -611,6 +622,12 @@ void cv::gpu::CudaMem::create(int _rows, int _cols, int _type, int _alloc_type)
rows
=
_rows
;
cols
=
_cols
;
step
=
elemSize
()
*
cols
;
if
(
_alloc_type
==
ALLOC_ZEROCOPY
)
{
cudaDeviceProp
prop
;
cudaGetDeviceProperties
(
&
prop
,
getDevice
());
step
=
alignUp
(
step
,
prop
.
textureAlignment
);
}
int64
_nettosize
=
(
int64
)
step
*
rows
;
size_t
nettosize
=
(
size_t
)
_nettosize
;
if
(
_nettosize
!=
(
int64
)
nettosize
)
...
...
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