Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
81b9c9c1
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,发现更多精彩内容 >>
提交
81b9c9c1
编写于
11月 27, 2013
作者:
I
Ilya Lavrenov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RGB[A] -> RGB5x5
上级
af367c4f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
79 addition
and
45 deletion
+79
-45
modules/imgproc/src/color.cpp
modules/imgproc/src/color.cpp
+13
-2
modules/imgproc/src/opencl/cvtcolor.cl
modules/imgproc/src/opencl/cvtcolor.cl
+57
-0
modules/imgproc/test/ocl/test_color.cpp
modules/imgproc/test/ocl/test_color.cpp
+9
-9
modules/ocl/src/opencl/cvt_color.cl
modules/ocl/src/opencl/cvt_color.cl
+0
-34
未找到文件。
modules/imgproc/src/color.cpp
浏览文件 @
81b9c9c1
...
...
@@ -2706,8 +2706,6 @@ static bool ocl_cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
/*
case COLOR_BGR2BGR565: case COLOR_BGR2BGR555: case COLOR_RGB2BGR565: case COLOR_RGB2BGR555:
case COLOR_BGRA2BGR565: case COLOR_BGRA2BGR555: case COLOR_RGBA2BGR565: case COLOR_RGBA2BGR555:
case COLOR_BGR5652BGR: case COLOR_BGR5552BGR: case COLOR_BGR5652RGB: case COLOR_BGR5552RGB:
case COLOR_BGR5652BGRA: case COLOR_BGR5552BGRA: case COLOR_BGR5652RGBA: case COLOR_BGR5552RGBA:
*/
case
COLOR_BGR2BGRA
:
case
COLOR_RGB2BGRA
:
case
COLOR_BGRA2BGR
:
case
COLOR_RGBA2BGR
:
case
COLOR_RGB2BGR
:
case
COLOR_BGRA2RGBA
:
...
...
@@ -2720,6 +2718,19 @@ static bool ocl_cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
reverse
?
"REVERSE"
:
"ORDER"
));
break
;
}
case
COLOR_BGR5652BGR
:
case
COLOR_BGR5552BGR
:
case
COLOR_BGR5652RGB
:
case
COLOR_BGR5552RGB
:
case
COLOR_BGR5652BGRA
:
case
COLOR_BGR5552BGRA
:
case
COLOR_BGR5652RGBA
:
case
COLOR_BGR5552RGBA
:
{
dcn
=
code
==
COLOR_BGR5652BGRA
||
code
==
COLOR_BGR5552BGRA
||
code
==
COLOR_BGR5652RGBA
||
code
==
COLOR_BGR5552RGBA
?
4
:
3
;
CV_Assert
((
dcn
==
3
||
dcn
==
4
)
&&
scn
==
2
&&
depth
==
CV_8U
);
bidx
=
code
==
COLOR_BGR5652BGR
||
code
==
COLOR_BGR5552BGR
||
code
==
COLOR_BGR5652BGRA
||
code
==
COLOR_BGR5552BGRA
?
0
:
2
;
int
greenbits
=
code
==
COLOR_BGR5652BGR
||
code
==
COLOR_BGR5652RGB
||
code
==
COLOR_BGR5652BGRA
||
code
==
COLOR_BGR5652RGBA
?
6
:
5
;
k
.
create
(
"RGB5x52RGB"
,
ocl
::
imgproc
::
cvtcolor_oclsrc
,
format
(
"-D depth=%d -D scn=2 -D dcn=%s -D bidx=%d -D greenbits=%d"
,
depth
,
scn
,
dcn
,
bidx
,
greenbits
));
break
;
}
case
COLOR_BGR2GRAY
:
case
COLOR_BGRA2GRAY
:
case
COLOR_RGB2GRAY
:
case
COLOR_RGBA2GRAY
:
{
...
...
modules/imgproc/src/opencl/cvtcolor.cl
浏览文件 @
81b9c9c1
...
...
@@ -455,6 +455,63 @@ __kernel void RGB(__global const uchar* srcptr, int src_step, int src_offset,
}
/////////////////////////////////////
RGB5x5
<->
RGB
//////////////////////////////////////
__kernel
void
RGB5x52RGB
(
__global
const
uchar*
src,
int
src_step,
int
src_offset,
__global
uchar*
dst,
int
dst_step,
int
dst_offset,
int
rows,
int
cols
)
{
int
x
=
get_global_id
(
0
)
;
int
y
=
get_global_id
(
1
)
;
if
(
y
<
rows
&&
x
<
cols
)
{
int
src_idx
=
mad24
(
y,
src_step,
src_offset
+
x
*
scnbytes
)
;
int
dst_idx
=
mad24
(
y,
dst_step,
dst_offset
+
x
*
dcnbytes
)
;
ushort
t
=
*
((
__global
const
ushort*
)(
src
+
src_idx
))
;
#
if
greenbits
==
6
dst[dst_idx
+
bidx]
=
(
uchar
)(
t
<<
3
)
;
dst[dst_idx
+
1]
=
(
uchar
)((
t
>>
3
)
&
~3
)
;
dst[dst_idx
+
(
bidx^2
)
]
=
(
uchar
)((
t
>>
8
)
&
~7
)
;
#
else
dst[dst_idx
+
bidx]
=
(
uchar
)(
t
<<
3
)
;
dst[dst_idx
+
1]
=
(
uchar
)((
t
>>
2
)
&
~7
)
;
dst[dst_idx
+
(
bidx^2
)
]
=
(
uchar
)((
t
>>
7
)
&
~7
)
;
#
endif
#
if
dcn
==
4
#
if
greenbits
==
6
dst[dst_idx
+
3]
=
255
;
#
else
dst[dst_idx
+
3]
=
t
&
0x8000
?
255
:
0
;
#
endif
#
endif
}
}
//__kernel
void
RGB2RGB5x5
(
int
cols,
int
rows,
int
src_step,
int
dst_step,
int
bidx,
//
__global
const
uchar
*
src,
__global
ushort
*
dst,
//
int
src_offset,
int
dst_offset
)
//{
//
int
x
=
get_global_id
(
0
)
;
//
int
y
=
get_global_id
(
1
)
;
//
if
(
y
<
rows
&&
x
<
cols
)
//
{
//
int
src_idx
=
mad24
(
y,
src_step,
src_offset
+
(
x
<<
2
))
;
//
int
dst_idx
=
mad24
(
y,
dst_step,
dst_offset
+
x
)
;
//#if
greenbits
==
6
//
dst[dst_idx]
=
(
ushort
)((
src[src_idx
+
bidx]
>>
3
)
|((src[src_idx + 1]&~3) << 3)|
((
src[src_idx
+
(
bidx^2
)
]&~7
)
<<
8
))
;
//#elif
scn
==
3
//
dst[dst_idx]
=
(
ushort
)((
src[src_idx
+
bidx]
>>
3
)
|((src[src_idx + 1]&~7) << 2)|
((
src[src_idx
+
(
bidx^2
)
]&~7
)
<<
7
))
;
//#else
//
dst[dst_idx]
=
(
ushort
)((
src[src_idx
+
bidx]
>>
3
)
|((src[src_idx + 1]&~7) << 2)|
//
((
src[src_idx
+
(
bidx^2
)
]&~7
)
<<
7
)
|
(
src[src_idx
+
3]
?
0x8000
:
0
))
;
//#endif
//
}
//}
...
...
modules/imgproc/test/ocl/test_color.cpp
浏览文件 @
81b9c9c1
...
...
@@ -215,17 +215,17 @@ OCL_TEST_P(CvtColor, XYZ2BGRA) { performTest(3, 4, CVTCODE(XYZ2BGR)); }
// RGB5x5 <-> RGB
//
typedef CvtColor CvtColor8u;
typedef
CvtColor
CvtColor8u
;
//
OCL_TEST_P(CvtColor8u, BGR5652BGR) { performTest(2, 3, CVTCODE(BGR5652BGR)); }
//
OCL_TEST_P(CvtColor8u, BGR5652RGB) { performTest(2, 3, CVTCODE(BGR5652RGB)); }
//
OCL_TEST_P(CvtColor8u, BGR5652BGRA) { performTest(2, 4, CVTCODE(BGR5652BGRA)); }
//
OCL_TEST_P(CvtColor8u, BGR5652RGBA) { performTest(2, 4, CVTCODE(BGR5652RGBA)); }
OCL_TEST_P
(
CvtColor8u
,
BGR5652BGR
)
{
performTest
(
2
,
3
,
CVTCODE
(
BGR5652BGR
));
}
OCL_TEST_P
(
CvtColor8u
,
BGR5652RGB
)
{
performTest
(
2
,
3
,
CVTCODE
(
BGR5652RGB
));
}
OCL_TEST_P
(
CvtColor8u
,
BGR5652BGRA
)
{
performTest
(
2
,
4
,
CVTCODE
(
BGR5652BGRA
));
}
OCL_TEST_P
(
CvtColor8u
,
BGR5652RGBA
)
{
performTest
(
2
,
4
,
CVTCODE
(
BGR5652RGBA
));
}
//
OCL_TEST_P(CvtColor8u, BGR5552BGR) { performTest(2, 3, CVTCODE(BGR5552BGR)); }
//
OCL_TEST_P(CvtColor8u, BGR5552RGB) { performTest(2, 3, CVTCODE(BGR5552RGB)); }
//
OCL_TEST_P(CvtColor8u, BGR5552BGRA) { performTest(2, 4, CVTCODE(BGR5552BGRA)); }
//
OCL_TEST_P(CvtColor8u, BGR5552RGBA) { performTest(2, 4, CVTCODE(BGR5552RGBA)); }
OCL_TEST_P
(
CvtColor8u
,
BGR5552BGR
)
{
performTest
(
2
,
3
,
CVTCODE
(
BGR5552BGR
));
}
OCL_TEST_P
(
CvtColor8u
,
BGR5552RGB
)
{
performTest
(
2
,
3
,
CVTCODE
(
BGR5552RGB
));
}
OCL_TEST_P
(
CvtColor8u
,
BGR5552BGRA
)
{
performTest
(
2
,
4
,
CVTCODE
(
BGR5552BGRA
));
}
OCL_TEST_P
(
CvtColor8u
,
BGR5552RGBA
)
{
performTest
(
2
,
4
,
CVTCODE
(
BGR5552RGBA
));
}
//OCL_TEST_P(CvtColor8u, BGR2BGR565) { performTest(3, 2, CVTCODE(BGR2BGR565)); }
//OCL_TEST_P(CvtColor8u, RGB2BGR565) { performTest(3, 2, CVTCODE(RGB2BGR565)); }
...
...
modules/ocl/src/opencl/cvt_color.cl
浏览文件 @
81b9c9c1
...
...
@@ -91,40 +91,6 @@ enum
BLOCK_SIZE
=
256
}
;
/////////////////////////////////////
RGB[A]
<->
BGR[A]
//////////////////////////////////////
__kernel
void
RGB
(
int
cols,
int
rows,
int
src_step,
int
dst_step,
__global
const
DATA_TYPE
*
src,
__global
DATA_TYPE
*
dst,
int
src_offset,
int
dst_offset
)
{
int
x
=
get_global_id
(
0
)
;
int
y
=
get_global_id
(
1
)
;
if
(
y
<
rows
&&
x
<
cols
)
{
x
<<=
2
;
int
src_idx
=
mad24
(
y,
src_step,
src_offset
+
x
)
;
int
dst_idx
=
mad24
(
y,
dst_step,
dst_offset
+
x
)
;
#
ifdef
REVERSE
dst[dst_idx]
=
src[src_idx
+
2]
;
dst[dst_idx
+
1]
=
src[src_idx
+
1]
;
dst[dst_idx
+
2]
=
src[src_idx]
;
#
elif
defined
ORDER
dst[dst_idx]
=
src[src_idx]
;
dst[dst_idx
+
1]
=
src[src_idx
+
1]
;
dst[dst_idx
+
2]
=
src[src_idx
+
2]
;
#
endif
#
if
dcn
==
4
#
if
scn
==
3
dst[dst_idx
+
3]
=
MAX_NUM
;
#
else
dst[dst_idx
+
3]
=
src[src_idx
+
3]
;
#
endif
#
endif
}
}
/////////////////////////////////////
RGB5x5
<->
RGB
//////////////////////////////////////
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录