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
340e23a4
Commit
340e23a4
authored
Sep 28, 2011
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed TBB-related bug in YUV420 to RGB conversion
parent
fcaa587b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
16 deletions
+23
-16
color.cpp
modules/imgproc/src/color.cpp
+23
-16
No files found.
modules/imgproc/src/color.cpp
View file @
340e23a4
...
...
@@ -91,6 +91,7 @@
#include "precomp.hpp"
#include <limits>
#include <iostream>
namespace
cv
{
...
...
@@ -2657,18 +2658,21 @@ struct YUV4202BGR888Invoker
const
uchar
*
my1
,
*
muv
;
int
width
;
YUV4202BGR888Invoker
(
Mat
&
_dst
,
int
_width
,
const
uchar
*
_y1
,
const
uchar
*
_uv
)
:
dst
(
&
_dst
),
my1
(
_y1
),
muv
(
_uv
),
width
(
_width
)
{}
YUV4202BGR888Invoker
(
Mat
*
_dst
,
int
_width
,
const
uchar
*
_y1
,
const
uchar
*
_uv
)
:
dst
(
_dst
),
my1
(
_y1
),
muv
(
_uv
),
width
(
_width
)
{}
void
operator
()(
const
BlockedRange
&
range
)
const
{
int
rangeBegin
=
range
.
begin
()
*
2
;
int
rangeEnd
=
range
.
end
()
*
2
;
//B = 1.164(Y - 16) + 2.018(U - 128)
//G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)
//R = 1.164(Y - 16) + 1.596(V - 128)
const
uchar
*
y1
=
my1
+
range
.
begin
()
*
width
,
*
uv
=
muv
+
range
.
begin
()
*
width
/
2
;
const
uchar
*
y1
=
my1
+
range
Begin
*
width
,
*
uv
=
muv
+
rangeBegin
*
width
/
2
;
for
(
int
j
=
range
.
begin
();
j
<
range
.
end
()
;
j
+=
2
,
y1
+=
width
*
2
,
uv
+=
width
)
for
(
int
j
=
range
Begin
;
j
<
rangeEnd
;
j
+=
2
,
y1
+=
width
*
2
,
uv
+=
width
)
{
uchar
*
row1
=
dst
->
ptr
<
uchar
>
(
j
);
uchar
*
row2
=
dst
->
ptr
<
uchar
>
(
j
+
1
);
...
...
@@ -2714,18 +2718,21 @@ struct YUV4202BGRA8888Invoker
const
uchar
*
my1
,
*
muv
;
int
width
;
YUV4202BGRA8888Invoker
(
Mat
&
_dst
,
int
_width
,
const
uchar
*
_y1
,
const
uchar
*
_uv
)
:
dst
(
&
_dst
),
my1
(
_y1
),
muv
(
_uv
),
width
(
_width
)
{}
YUV4202BGRA8888Invoker
(
Mat
*
_dst
,
int
_width
,
const
uchar
*
_y1
,
const
uchar
*
_uv
)
:
dst
(
_dst
),
my1
(
_y1
),
muv
(
_uv
),
width
(
_width
)
{}
void
operator
()(
const
BlockedRange
&
range
)
const
{
int
rangeBegin
=
range
.
begin
()
*
2
;
int
rangeEnd
=
range
.
end
()
*
2
;
//B = 1.164(Y - 16) + 2.018(U - 128)
//G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)
//R = 1.164(Y - 16) + 1.596(V - 128)
const
uchar
*
y1
=
my1
+
range
.
begin
()
*
width
,
*
uv
=
muv
+
range
.
begin
()
*
width
/
2
;
const
uchar
*
y1
=
my1
+
range
Begin
*
width
,
*
uv
=
muv
+
rangeBegin
*
width
/
2
;
for
(
int
j
=
range
.
begin
();
j
<
range
.
end
()
;
j
+=
2
,
y1
+=
width
*
2
,
uv
+=
width
)
for
(
int
j
=
range
Begin
;
j
<
rangeEnd
;
j
+=
2
,
y1
+=
width
*
2
,
uv
+=
width
)
{
uchar
*
row1
=
dst
->
ptr
<
uchar
>
(
j
);
uchar
*
row2
=
dst
->
ptr
<
uchar
>
(
j
+
1
);
...
...
@@ -3133,30 +3140,30 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
if
(
CV_YUV420sp2RGB
==
code
||
CV_YUV420sp2RGBA
==
code
)
{
if
(
dcn
==
3
)
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
,
2
),
YUV4202BGR888Invoker
<
2
,
0
>
(
dst
,
dstSz
.
width
,
y
,
uv
));
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
/
2
),
YUV4202BGR888Invoker
<
2
,
0
>
(
&
dst
,
dstSz
.
width
,
y
,
uv
));
else
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
,
2
),
YUV4202BGRA8888Invoker
<
2
,
0
>
(
dst
,
dstSz
.
width
,
y
,
uv
));
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
/
2
),
YUV4202BGRA8888Invoker
<
2
,
0
>
(
&
dst
,
dstSz
.
width
,
y
,
uv
));
}
else
if
(
CV_YUV420sp2BGR
==
code
||
CV_YUV420sp2BGRA
==
code
)
{
if
(
dcn
==
3
)
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
,
2
),
YUV4202BGR888Invoker
<
0
,
0
>
(
dst
,
dstSz
.
width
,
y
,
uv
));
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
/
2
),
YUV4202BGR888Invoker
<
0
,
0
>
(
&
dst
,
dstSz
.
width
,
y
,
uv
));
else
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
,
2
),
YUV4202BGRA8888Invoker
<
0
,
0
>
(
dst
,
dstSz
.
width
,
y
,
uv
));
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
/
2
),
YUV4202BGRA8888Invoker
<
0
,
0
>
(
&
dst
,
dstSz
.
width
,
y
,
uv
));
}
else
if
(
CV_YUV420i2RGB
==
code
||
CV_YUV420i2RGBA
==
code
)
{
if
(
dcn
==
3
)
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
,
2
),
YUV4202BGR888Invoker
<
2
,
1
>
(
dst
,
dstSz
.
width
,
y
,
uv
));
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
/
2
),
YUV4202BGR888Invoker
<
2
,
1
>
(
&
dst
,
dstSz
.
width
,
y
,
uv
));
else
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
,
2
),
YUV4202BGRA8888Invoker
<
2
,
1
>
(
dst
,
dstSz
.
width
,
y
,
uv
));
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
/
2
),
YUV4202BGRA8888Invoker
<
2
,
1
>
(
&
dst
,
dstSz
.
width
,
y
,
uv
));
}
else
if
(
CV_YUV420i2BGR
==
code
||
CV_YUV420i2BGRA
==
code
)
{
if
(
dcn
==
3
)
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
,
2
),
YUV4202BGR888Invoker
<
0
,
1
>
(
dst
,
dstSz
.
width
,
y
,
uv
));
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
/
2
),
YUV4202BGR888Invoker
<
0
,
1
>
(
&
dst
,
dstSz
.
width
,
y
,
uv
));
else
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
,
2
),
YUV4202BGRA8888Invoker
<
0
,
1
>
(
dst
,
dstSz
.
width
,
y
,
uv
));
parallel_for
(
BlockedRange
(
0
,
dstSz
.
height
/
2
),
YUV4202BGRA8888Invoker
<
0
,
1
>
(
&
dst
,
dstSz
.
width
,
y
,
uv
));
}
}
}
...
...
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