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
1c1c41d3
Commit
1c1c41d3
authored
Oct 07, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cv::cvtColor (Luv2RGB CV_8U)
parent
06461b40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
3 deletions
+72
-3
color.cpp
modules/imgproc/src/color.cpp
+72
-3
No files found.
modules/imgproc/src/color.cpp
View file @
1c1c41d3
...
...
@@ -4074,7 +4074,18 @@ struct Luv2RGB_b
Luv2RGB_b
(
int
_dstcn
,
int
blueIdx
,
const
float
*
_coeffs
,
const
float
*
_whitept
,
bool
_srgb
)
:
dstcn
(
_dstcn
),
cvt
(
3
,
blueIdx
,
_coeffs
,
_whitept
,
_srgb
)
{}
:
dstcn
(
_dstcn
),
cvt
(
3
,
blueIdx
,
_coeffs
,
_whitept
,
_srgb
)
{
#if CV_NEON
v_scale_inv
=
vdupq_n_f32
(
100.
f
/
255.
f
);
v_coeff1
=
vdupq_n_f32
(
1.388235294117647
f
);
v_coeff2
=
vdupq_n_f32
(
1.027450980392157
f
);
v_134
=
vdupq_n_f32
(
134.
f
);
v_140
=
vdupq_n_f32
(
140.
f
);
v_scale
=
vdupq_n_f32
(
255.
f
);
v_alpha
=
vdup_n_u8
(
ColorChannel
<
uchar
>::
max
());
#endif
}
void
operator
()(
const
uchar
*
src
,
uchar
*
dst
,
int
n
)
const
{
...
...
@@ -4085,8 +4096,29 @@ struct Luv2RGB_b
for
(
i
=
0
;
i
<
n
;
i
+=
BLOCK_SIZE
,
src
+=
BLOCK_SIZE
*
3
)
{
int
dn
=
std
::
min
(
n
-
i
,
(
int
)
BLOCK_SIZE
);
j
=
0
;
for
(
j
=
0
;
j
<
dn
*
3
;
j
+=
3
)
#if CV_NEON
for
(
;
j
<=
(
dn
-
8
)
*
3
;
j
+=
24
)
{
uint8x8x3_t
v_src
=
vld3_u8
(
src
+
j
);
uint16x8_t
v_t0
=
vmovl_u8
(
v_src
.
val
[
0
]),
v_t1
=
vmovl_u8
(
v_src
.
val
[
1
]),
v_t2
=
vmovl_u8
(
v_src
.
val
[
2
]);
float32x4x3_t
v_dst
;
v_dst
.
val
[
0
]
=
vmulq_f32
(
vcvtq_f32_u32
(
vmovl_u16
(
vget_low_u16
(
v_t0
))),
v_scale_inv
);
v_dst
.
val
[
1
]
=
vsubq_f32
(
vmulq_f32
(
vcvtq_f32_u32
(
vmovl_u16
(
vget_low_u16
(
v_t1
))),
v_coeff1
),
v_134
);
v_dst
.
val
[
2
]
=
vsubq_f32
(
vmulq_f32
(
vcvtq_f32_u32
(
vmovl_u16
(
vget_low_u16
(
v_t2
))),
v_coeff2
),
v_140
);
vst3q_f32
(
buf
+
j
,
v_dst
);
v_dst
.
val
[
0
]
=
vmulq_f32
(
vcvtq_f32_u32
(
vmovl_u16
(
vget_high_u16
(
v_t0
))),
v_scale_inv
);
v_dst
.
val
[
1
]
=
vsubq_f32
(
vmulq_f32
(
vcvtq_f32_u32
(
vmovl_u16
(
vget_high_u16
(
v_t1
))),
v_coeff1
),
v_134
);
v_dst
.
val
[
2
]
=
vsubq_f32
(
vmulq_f32
(
vcvtq_f32_u32
(
vmovl_u16
(
vget_high_u16
(
v_t2
))),
v_coeff2
),
v_140
);
vst3q_f32
(
buf
+
j
+
12
,
v_dst
);
}
#endif
for
(
;
j
<
dn
*
3
;
j
+=
3
)
{
buf
[
j
]
=
src
[
j
]
*
(
100.
f
/
255.
f
);
buf
[
j
+
1
]
=
(
float
)(
src
[
j
+
1
]
*
1.388235294117647
f
-
134.
f
);
...
...
@@ -4094,7 +4126,39 @@ struct Luv2RGB_b
}
cvt
(
buf
,
buf
,
dn
);
for
(
j
=
0
;
j
<
dn
*
3
;
j
+=
3
,
dst
+=
dcn
)
j
=
0
;
#if CV_NEON
for
(
;
j
<=
(
dn
-
8
)
*
3
;
j
+=
24
,
dst
+=
dcn
*
8
)
{
float32x4x3_t
v_src0
=
vld3q_f32
(
buf
+
j
),
v_src1
=
vld3q_f32
(
buf
+
j
+
12
);
uint8x8_t
v_dst0
=
vqmovn_u16
(
vcombine_u16
(
vqmovn_u32
(
cv_vrndq_u32_f32
(
vmulq_f32
(
v_src0
.
val
[
0
],
v_scale
))),
vqmovn_u32
(
cv_vrndq_u32_f32
(
vmulq_f32
(
v_src1
.
val
[
0
],
v_scale
)))));
uint8x8_t
v_dst1
=
vqmovn_u16
(
vcombine_u16
(
vqmovn_u32
(
cv_vrndq_u32_f32
(
vmulq_f32
(
v_src0
.
val
[
1
],
v_scale
))),
vqmovn_u32
(
cv_vrndq_u32_f32
(
vmulq_f32
(
v_src1
.
val
[
1
],
v_scale
)))));
uint8x8_t
v_dst2
=
vqmovn_u16
(
vcombine_u16
(
vqmovn_u32
(
cv_vrndq_u32_f32
(
vmulq_f32
(
v_src0
.
val
[
2
],
v_scale
))),
vqmovn_u32
(
cv_vrndq_u32_f32
(
vmulq_f32
(
v_src1
.
val
[
2
],
v_scale
)))));
if
(
dcn
==
4
)
{
uint8x8x4_t
v_dst
;
v_dst
.
val
[
0
]
=
v_dst0
;
v_dst
.
val
[
1
]
=
v_dst1
;
v_dst
.
val
[
2
]
=
v_dst2
;
v_dst
.
val
[
3
]
=
v_alpha
;
vst4_u8
(
dst
,
v_dst
);
}
else
{
uint8x8x3_t
v_dst
;
v_dst
.
val
[
0
]
=
v_dst0
;
v_dst
.
val
[
1
]
=
v_dst1
;
v_dst
.
val
[
2
]
=
v_dst2
;
vst3_u8
(
dst
,
v_dst
);
}
}
#endif
for
(
;
j
<
dn
*
3
;
j
+=
3
,
dst
+=
dcn
)
{
dst
[
0
]
=
saturate_cast
<
uchar
>
(
buf
[
j
]
*
255.
f
);
dst
[
1
]
=
saturate_cast
<
uchar
>
(
buf
[
j
+
1
]
*
255.
f
);
...
...
@@ -4107,6 +4171,11 @@ struct Luv2RGB_b
int
dstcn
;
Luv2RGB_f
cvt
;
#if CV_NEON
float32x4_t
v_scale
,
v_scale_inv
,
v_coeff1
,
v_coeff2
,
v_134
,
v_140
;
uint8x8_t
v_alpha
;
#endif
};
...
...
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