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
960a0eac
Commit
960a0eac
authored
Jun 07, 2013
by
yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge openCLMallocPitch and openCLMallocPitchEx into one interface
parent
61567adc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
13 deletions
+23
-13
util.hpp
modules/ocl/include/opencv2/ocl/private/util.hpp
+2
-2
initialization.cpp
modules/ocl/src/initialization.cpp
+6
-6
matrix_operations.cpp
modules/ocl/src/matrix_operations.cpp
+15
-5
No files found.
modules/ocl/include/opencv2/ocl/private/util.hpp
View file @
960a0eac
...
@@ -65,9 +65,9 @@ namespace cv
...
@@ -65,9 +65,9 @@ namespace cv
clMemcpyDeviceToDevice
clMemcpyDeviceToDevice
};
};
///////////////////////////OpenCL call wrappers////////////////////////////
///////////////////////////OpenCL call wrappers////////////////////////////
//void CV_EXPORTS openCLMallocPitch(Context *clCxt, void **dev_ptr, size_t *pitch,
// size_t widthInBytes, size_t height);
void
CV_EXPORTS
openCLMallocPitch
(
Context
*
clCxt
,
void
**
dev_ptr
,
size_t
*
pitch
,
void
CV_EXPORTS
openCLMallocPitch
(
Context
*
clCxt
,
void
**
dev_ptr
,
size_t
*
pitch
,
size_t
widthInBytes
,
size_t
height
);
void
CV_EXPORTS
openCLMallocPitchEx
(
Context
*
clCxt
,
void
**
dev_ptr
,
size_t
*
pitch
,
size_t
widthInBytes
,
size_t
height
,
size_t
widthInBytes
,
size_t
height
,
DevMemRW
rw_type
,
DevMemType
mem_type
,
void
*
hptr
=
0
);
DevMemRW
rw_type
,
DevMemType
mem_type
,
void
*
hptr
=
0
);
void
CV_EXPORTS
openCLMemcpy2D
(
Context
*
clCxt
,
void
*
dst
,
size_t
dpitch
,
void
CV_EXPORTS
openCLMemcpy2D
(
Context
*
clCxt
,
void
*
dst
,
size_t
dpitch
,
...
...
modules/ocl/src/initialization.cpp
View file @
960a0eac
...
@@ -422,13 +422,13 @@ namespace cv
...
@@ -422,13 +422,13 @@ namespace cv
return
buffer
;
return
buffer
;
}
}
void
openCLMallocPitch
(
Context
*
clCxt
,
void
**
dev_ptr
,
size_t
*
pitch
,
//
void openCLMallocPitch(Context *clCxt, void **dev_ptr, size_t *pitch,
size_t
widthInBytes
,
size_t
height
)
//
size_t widthInBytes, size_t height)
{
//
{
openCLMallocPitchEx
(
clCxt
,
dev_ptr
,
pitch
,
widthInBytes
,
height
,
gDeviceMemRW
,
gDeviceMemType
);
//
openCLMallocPitchEx(clCxt, dev_ptr, pitch, widthInBytes, height, gDeviceMemRW, gDeviceMemType);
}
//
}
void
openCLMallocPitch
Ex
(
Context
*
clCxt
,
void
**
dev_ptr
,
size_t
*
pitch
,
void
openCLMallocPitch
(
Context
*
clCxt
,
void
**
dev_ptr
,
size_t
*
pitch
,
size_t
widthInBytes
,
size_t
height
,
size_t
widthInBytes
,
size_t
height
,
DevMemRW
rw_type
,
DevMemType
mem_type
,
void
*
hptr
)
DevMemRW
rw_type
,
DevMemType
mem_type
,
void
*
hptr
)
{
{
...
...
modules/ocl/src/matrix_operations.cpp
View file @
960a0eac
...
@@ -183,11 +183,21 @@ void cv::ocl::oclMat::upload(const Mat &m)
...
@@ -183,11 +183,21 @@ void cv::ocl::oclMat::upload(const Mat &m)
int
pitch
=
wholeSize
.
width
*
3
*
m
.
elemSize1
();
int
pitch
=
wholeSize
.
width
*
3
*
m
.
elemSize1
();
int
tail_padding
=
m
.
elemSize1
()
*
3072
;
int
tail_padding
=
m
.
elemSize1
()
*
3072
;
int
err
;
int
err
;
cl_mem
temp
=
clCreateBuffer
((
cl_context
)
clCxt
->
oclContext
(),
CL_MEM_READ_WRITE
,
cl_mem
temp
;
(
pitch
*
wholeSize
.
height
+
tail_padding
-
1
)
/
tail_padding
*
tail_padding
,
0
,
&
err
);
if
(
gDeviceMemType
!=
DEVICE_MEM_UHP
&&
gDeviceMemType
!=
DEVICE_MEM_CHP
){
openCLVerifyCall
(
err
);
temp
=
clCreateBuffer
((
cl_context
)
clCxt
->
oclContext
(),
CL_MEM_READ_WRITE
,
(
pitch
*
wholeSize
.
height
+
tail_padding
-
1
)
/
tail_padding
*
tail_padding
,
0
,
&
err
);
openCLVerifyCall
(
err
);
openCLMemcpy2D
(
clCxt
,
temp
,
pitch
,
m
.
datastart
,
m
.
step
,
wholeSize
.
width
*
m
.
elemSize
(),
wholeSize
.
height
,
clMemcpyHostToDevice
,
3
);
}
else
{
temp
=
clCreateBuffer
((
cl_context
)
clCxt
->
oclContext
(),
CL_MEM_READ_WRITE
|
CL_MEM_USE_HOST_PTR
,
(
pitch
*
wholeSize
.
height
+
tail_padding
-
1
)
/
tail_padding
*
tail_padding
,
m
.
datastart
,
&
err
);
openCLVerifyCall
(
err
);
}
openCLMemcpy2D
(
clCxt
,
temp
,
pitch
,
m
.
datastart
,
m
.
step
,
wholeSize
.
width
*
m
.
elemSize
(),
wholeSize
.
height
,
clMemcpyHostToDevice
,
3
);
convert_C3C4
(
temp
,
*
this
);
convert_C3C4
(
temp
,
*
this
);
openCLSafeCall
(
clReleaseMemObject
(
temp
));
openCLSafeCall
(
clReleaseMemObject
(
temp
));
}
}
...
@@ -915,7 +925,7 @@ void cv::ocl::oclMat::createEx(int _rows, int _cols, int _type,
...
@@ -915,7 +925,7 @@ void cv::ocl::oclMat::createEx(int _rows, int _cols, int _type,
size_t
esz
=
elemSize
();
size_t
esz
=
elemSize
();
void
*
dev_ptr
;
void
*
dev_ptr
;
openCLMallocPitch
Ex
(
clCxt
,
&
dev_ptr
,
&
step
,
GPU_MATRIX_MALLOC_STEP
(
esz
*
cols
),
openCLMallocPitch
(
clCxt
,
&
dev_ptr
,
&
step
,
GPU_MATRIX_MALLOC_STEP
(
esz
*
cols
),
rows
,
rw_type
,
mem_type
,
hptr
);
rows
,
rw_type
,
mem_type
,
hptr
);
if
(
esz
*
cols
==
step
)
if
(
esz
*
cols
==
step
)
...
...
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