Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
f7641be4
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f7641be4
编写于
4月 15, 2013
作者:
A
Andrey Kamaev
提交者:
OpenCV Buildbot
4月 15, 2013
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #812 from bitwangyaoyao:master_uhp
上级
6168bf00
40d0e0ed
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
47 deletion
+31
-47
modules/ocl/include/opencv2/ocl.hpp
modules/ocl/include/opencv2/ocl.hpp
+4
-2
modules/ocl/include/opencv2/ocl/private/util.hpp
modules/ocl/include/opencv2/ocl/private/util.hpp
+2
-1
modules/ocl/src/initialization.cpp
modules/ocl/src/initialization.cpp
+12
-7
modules/ocl/src/matrix_operations.cpp
modules/ocl/src/matrix_operations.cpp
+13
-37
未找到文件。
modules/ocl/include/opencv2/ocl.hpp
浏览文件 @
f7641be4
...
...
@@ -263,8 +263,10 @@ namespace cv
void
create
(
Size
size
,
int
type
);
//! allocates new oclMatrix with specified device memory type.
void
createEx
(
int
rows
,
int
cols
,
int
type
,
DevMemRW
rw_type
,
DevMemType
mem_type
);
void
createEx
(
Size
size
,
int
type
,
DevMemRW
rw_type
,
DevMemType
mem_type
);
void
createEx
(
int
rows
,
int
cols
,
int
type
,
DevMemRW
rw_type
,
DevMemType
mem_type
,
void
*
hptr
=
0
);
void
createEx
(
Size
size
,
int
type
,
DevMemRW
rw_type
,
DevMemType
mem_type
,
void
*
hptr
=
0
);
//! decreases reference counter;
// deallocate the data when reference counter reaches 0.
...
...
modules/ocl/include/opencv2/ocl/private/util.hpp
浏览文件 @
f7641be4
...
...
@@ -68,7 +68,8 @@ namespace cv
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
,
DevMemRW
rw_type
,
DevMemType
mem_type
);
size_t
widthInBytes
,
size_t
height
,
DevMemRW
rw_type
,
DevMemType
mem_type
,
void
*
hptr
=
0
);
void
CV_EXPORTS
openCLMemcpy2D
(
Context
*
clCxt
,
void
*
dst
,
size_t
dpitch
,
const
void
*
src
,
size_t
spitch
,
size_t
width
,
size_t
height
,
openCLMemcpyKind
kind
,
int
channels
=
-
1
);
...
...
modules/ocl/src/initialization.cpp
浏览文件 @
f7641be4
...
...
@@ -163,7 +163,7 @@ namespace cv
{
releaseResources
();
delete
this
;
}
}
}
Impl
*
copy
()
...
...
@@ -260,9 +260,8 @@ namespace cv
int
setDevMemType
(
DevMemRW
rw_type
,
DevMemType
mem_type
)
{
if
(
(
mem_type
==
DEVICE_MEM_PM
&&
Context
::
getContext
()
->
impl
->
unified_memory
==
0
)
||
mem_type
==
DEVICE_MEM_UHP
||
mem_type
==
DEVICE_MEM_CHP
)
if
(
(
mem_type
==
DEVICE_MEM_PM
&&
Context
::
getContext
()
->
impl
->
unified_memory
==
0
)
)
return
-
1
;
gDeviceMemRW
=
rw_type
;
gDeviceMemType
=
mem_type
;
...
...
@@ -432,11 +431,17 @@ namespace cv
}
void
openCLMallocPitchEx
(
Context
*
clCxt
,
void
**
dev_ptr
,
size_t
*
pitch
,
size_t
widthInBytes
,
size_t
height
,
DevMemRW
rw_type
,
DevMemType
mem_type
)
size_t
widthInBytes
,
size_t
height
,
DevMemRW
rw_type
,
DevMemType
mem_type
,
void
*
hptr
)
{
cl_int
status
;
*
dev_ptr
=
clCreateBuffer
(
clCxt
->
impl
->
oclcontext
,
gDevMemRWValueMap
[
rw_type
]
|
gDevMemTypeValueMap
[
mem_type
],
widthInBytes
*
height
,
0
,
&
status
);
if
(
hptr
&&
(
mem_type
==
DEVICE_MEM_UHP
||
mem_type
==
DEVICE_MEM_CHP
))
*
dev_ptr
=
clCreateBuffer
(
clCxt
->
impl
->
oclcontext
,
gDevMemRWValueMap
[
rw_type
]
|
gDevMemTypeValueMap
[
mem_type
],
widthInBytes
*
height
,
hptr
,
&
status
);
else
*
dev_ptr
=
clCreateBuffer
(
clCxt
->
impl
->
oclcontext
,
gDevMemRWValueMap
[
rw_type
]
|
gDevMemTypeValueMap
[
mem_type
],
widthInBytes
*
height
,
0
,
&
status
);
openCLVerifyCall
(
status
);
*
pitch
=
widthInBytes
;
}
...
...
modules/ocl/src/matrix_operations.cpp
浏览文件 @
f7641be4
...
...
@@ -177,15 +177,9 @@ void cv::ocl::oclMat::upload(const Mat &m)
Size
wholeSize
;
Point
ofs
;
m
.
locateROI
(
wholeSize
,
ofs
);
// int type = m.type();
// if(m.oclchannels() == 3)
//{
// type = CV_MAKETYPE(m.depth(), 4);
//}
create
(
wholeSize
,
m
.
type
());
if
(
m
.
channels
()
==
3
)
{
create
(
wholeSize
,
m
.
type
());
int
pitch
=
wholeSize
.
width
*
3
*
m
.
elemSize1
();
int
tail_padding
=
m
.
elemSize1
()
*
3072
;
int
err
;
...
...
@@ -195,35 +189,20 @@ void cv::ocl::oclMat::upload(const Mat &m)
openCLMemcpy2D
(
clCxt
,
temp
,
pitch
,
m
.
datastart
,
m
.
step
,
wholeSize
.
width
*
m
.
elemSize
(),
wholeSize
.
height
,
clMemcpyHostToDevice
,
3
);
convert_C3C4
(
temp
,
*
this
);
//int* cputemp=new int[wholeSize.height*wholeSize.width * 3];
//int* cpudata=new int[this->step*this->wholerows/sizeof(int)];
//openCLSafeCall(clEnqueueReadBuffer(clCxt->impl->clCmdQueue, temp, CL_TRUE,
// 0, wholeSize.height*wholeSize.width * 3* sizeof(int), cputemp, 0, NULL, NULL));
//openCLSafeCall(clEnqueueReadBuffer(clCxt->impl->clCmdQueue, (cl_mem)data, CL_TRUE,
// 0, this->step*this->wholerows, cpudata, 0, NULL, NULL));
//for(int i=0;i<wholeSize.height;i++)
//{
// int *a = cputemp+i*wholeSize.width * 3,*b = cpudata + i*this->step/sizeof(int);
// for(int j=0;j<wholeSize.width;j++)
// {
// if((a[3*j] != b[4*j])||(a[3*j+1] != b[4*j+1])||(a[3*j+2] != b[4*j+2]))
// printf("rows=%d,cols=%d,cputtemp=%d,%d,%d;cpudata=%d,%d,%d\n",
// i,j,a[3*j],a[3*j+1],a[3*j+2],b[4*j],b[4*j+1],b[4*j+2]);
// }
//}
//delete []cputemp;
//delete []cpudata;
openCLSafeCall
(
clReleaseMemObject
(
temp
));
}
else
{
openCLMemcpy2D
(
clCxt
,
data
,
step
,
m
.
datastart
,
m
.
step
,
wholeSize
.
width
*
elemSize
(),
wholeSize
.
height
,
clMemcpyHostToDevice
);
// try to use host ptr
createEx
(
wholeSize
,
m
.
type
(),
gDeviceMemRW
,
gDeviceMemType
,
m
.
datastart
);
if
(
gDeviceMemType
!=
DEVICE_MEM_UHP
&&
gDeviceMemType
!=
DEVICE_MEM_CHP
)
openCLMemcpy2D
(
clCxt
,
data
,
step
,
m
.
datastart
,
m
.
step
,
wholeSize
.
width
*
elemSize
(),
wholeSize
.
height
,
clMemcpyHostToDevice
);
}
rows
=
m
.
rows
;
cols
=
m
.
cols
;
offset
=
ofs
.
y
*
step
+
ofs
.
x
*
elemSize
();
//download_channels = m.channels();
}
void
cv
::
ocl
::
oclMat
::
download
(
cv
::
Mat
&
m
)
const
...
...
@@ -908,9 +887,10 @@ oclMat cv::ocl::oclMat::reshape(int new_cn, int new_rows) const
}
void
cv
::
ocl
::
oclMat
::
createEx
(
Size
size
,
int
type
,
DevMemRW
rw_type
,
DevMemType
mem_type
)
void
cv
::
ocl
::
oclMat
::
createEx
(
Size
size
,
int
type
,
DevMemRW
rw_type
,
DevMemType
mem_type
,
void
*
hptr
)
{
createEx
(
size
.
height
,
size
.
width
,
type
,
rw_type
,
mem_type
);
createEx
(
size
.
height
,
size
.
width
,
type
,
rw_type
,
mem_type
,
hptr
);
}
void
cv
::
ocl
::
oclMat
::
create
(
int
_rows
,
int
_cols
,
int
_type
)
...
...
@@ -918,16 +898,12 @@ void cv::ocl::oclMat::create(int _rows, int _cols, int _type)
createEx
(
_rows
,
_cols
,
_type
,
gDeviceMemRW
,
gDeviceMemType
);
}
void
cv
::
ocl
::
oclMat
::
createEx
(
int
_rows
,
int
_cols
,
int
_type
,
DevMemRW
rw_type
,
DevMemType
mem_type
)
void
cv
::
ocl
::
oclMat
::
createEx
(
int
_rows
,
int
_cols
,
int
_type
,
DevMemRW
rw_type
,
DevMemType
mem_type
,
void
*
hptr
)
{
clCxt
=
Context
::
getContext
();
/* core logic */
_type
&=
Mat
::
TYPE_MASK
;
//download_channels = CV_MAT_CN(_type);
//if(download_channels==3)
//{
// _type = CV_MAKE_TYPE((CV_MAT_DEPTH(_type)),4);
//}
if
(
rows
==
_rows
&&
cols
==
_cols
&&
type
()
==
_type
&&
data
)
return
;
if
(
data
)
...
...
@@ -943,8 +919,8 @@ void cv::ocl::oclMat::createEx(int _rows, int _cols, int _type, DevMemRW rw_type
size_t
esz
=
elemSize
();
void
*
dev_ptr
;
openCLMallocPitchEx
(
clCxt
,
&
dev_ptr
,
&
step
,
GPU_MATRIX_MALLOC_STEP
(
esz
*
cols
),
rows
,
rw_type
,
mem_type
);
//openCLMallocPitch(clCxt,&dev_ptr, &step, esz * cols, rows
);
openCLMallocPitchEx
(
clCxt
,
&
dev_ptr
,
&
step
,
GPU_MATRIX_MALLOC_STEP
(
esz
*
cols
),
rows
,
rw_type
,
mem_type
,
hptr
);
if
(
esz
*
cols
==
step
)
flags
|=
Mat
::
CONTINUOUS_FLAG
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录