Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
66266455
Commit
66266455
authored
Apr 14, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sws/output: factor yuv2rgb_write_full() out
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
f359be96
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
86 deletions
+98
-86
output.c
libswscale/output.c
+98
-86
No files found.
libswscale/output.c
View file @
66266455
...
...
@@ -1217,45 +1217,13 @@ YUV2RGBWRAPPER(yuv2rgb,, 8, AV_PIX_FMT_RGB8, 0)
YUV2RGBWRAPPER
(
yuv2rgb
,,
4
,
AV_PIX_FMT_RGB4
,
0
)
YUV2RGBWRAPPER
(
yuv2rgb
,,
4
b
,
AV_PIX_FMT_RGB4_BYTE
,
0
)
static
av_always_inline
void
yuv2rgb_full_X_c_template
(
SwsContext
*
c
,
const
int16_t
*
lumFilter
,
const
int16_t
**
lumSrc
,
int
lumFilterSize
,
const
int16_t
*
chrFilter
,
const
int16_t
**
chrUSrc
,
const
int16_t
**
chrVSrc
,
int
chrFilterSize
,
const
int16_t
**
alpSrc
,
uint8_t
*
dest
,
int
dstW
,
int
y
,
enum
AVPixelFormat
target
,
int
hasAlpha
)
static
av_always_inline
void
yuv2rgb_write_full
(
SwsContext
*
c
,
uint8_t
*
dest
,
int
i
,
int
Y
,
int
A
,
int
U
,
int
V
,
int
y
,
enum
AVPixelFormat
target
,
int
hasAlpha
,
int
err
[
4
])
{
int
i
;
int
step
=
(
target
==
AV_PIX_FMT_RGB24
||
target
==
AV_PIX_FMT_BGR24
)
?
3
:
4
;
int
err
[
4
]
=
{
0
};
int
R
,
G
,
B
;
int
isrgb8
=
target
==
AV_PIX_FMT_BGR8
||
target
==
AV_PIX_FMT_RGB8
;
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
int
j
;
int
Y
=
1
<<
9
;
int
U
=
(
1
<<
9
)
-
(
128
<<
19
);
int
V
=
(
1
<<
9
)
-
(
128
<<
19
);
int
R
,
G
,
B
,
A
;
for
(
j
=
0
;
j
<
lumFilterSize
;
j
++
)
{
Y
+=
lumSrc
[
j
][
i
]
*
lumFilter
[
j
];
}
for
(
j
=
0
;
j
<
chrFilterSize
;
j
++
)
{
U
+=
chrUSrc
[
j
][
i
]
*
chrFilter
[
j
];
V
+=
chrVSrc
[
j
][
i
]
*
chrFilter
[
j
];
}
Y
>>=
10
;
U
>>=
10
;
V
>>=
10
;
if
(
hasAlpha
)
{
A
=
1
<<
18
;
for
(
j
=
0
;
j
<
lumFilterSize
;
j
++
)
{
A
+=
alpSrc
[
j
][
i
]
*
lumFilter
[
j
];
}
A
>>=
19
;
if
(
A
&
0x100
)
A
=
av_clip_uint8
(
A
);
}
Y
-=
c
->
yuv2rgb_y_offset
;
Y
*=
c
->
yuv2rgb_y_coeff
;
Y
+=
1
<<
21
;
...
...
@@ -1337,9 +1305,53 @@ yuv2rgb_full_X_c_template(SwsContext *c, const int16_t *lumFilter,
dest
[
0
]
=
b
+
4
*
g
+
32
*
r
;
}
else
av_assert2
(
0
);
step
=
1
;
break
;}
}
}
static
av_always_inline
void
yuv2rgb_full_X_c_template
(
SwsContext
*
c
,
const
int16_t
*
lumFilter
,
const
int16_t
**
lumSrc
,
int
lumFilterSize
,
const
int16_t
*
chrFilter
,
const
int16_t
**
chrUSrc
,
const
int16_t
**
chrVSrc
,
int
chrFilterSize
,
const
int16_t
**
alpSrc
,
uint8_t
*
dest
,
int
dstW
,
int
y
,
enum
AVPixelFormat
target
,
int
hasAlpha
)
{
int
i
;
int
step
=
(
target
==
AV_PIX_FMT_RGB24
||
target
==
AV_PIX_FMT_BGR24
)
?
3
:
4
;
int
err
[
4
]
=
{
0
};
if
(
target
==
AV_PIX_FMT_BGR4_BYTE
||
target
==
AV_PIX_FMT_RGB4_BYTE
||
target
==
AV_PIX_FMT_BGR8
||
target
==
AV_PIX_FMT_RGB8
)
step
=
1
;
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
int
j
;
int
Y
=
1
<<
9
;
int
U
=
(
1
<<
9
)
-
(
128
<<
19
);
int
V
=
(
1
<<
9
)
-
(
128
<<
19
);
int
A
;
for
(
j
=
0
;
j
<
lumFilterSize
;
j
++
)
{
Y
+=
lumSrc
[
j
][
i
]
*
lumFilter
[
j
];
}
for
(
j
=
0
;
j
<
chrFilterSize
;
j
++
)
{
U
+=
chrUSrc
[
j
][
i
]
*
chrFilter
[
j
];
V
+=
chrVSrc
[
j
][
i
]
*
chrFilter
[
j
];
}
Y
>>=
10
;
U
>>=
10
;
V
>>=
10
;
if
(
hasAlpha
)
{
A
=
1
<<
18
;
for
(
j
=
0
;
j
<
lumFilterSize
;
j
++
)
{
A
+=
alpSrc
[
j
][
i
]
*
lumFilter
[
j
];
}
A
>>=
19
;
if
(
A
&
0x100
)
A
=
av_clip_uint8
(
A
);
}
yuv2rgb_write_full
(
c
,
dest
,
i
,
Y
,
A
,
U
,
V
,
y
,
target
,
hasAlpha
,
err
);
dest
+=
step
;
}
c
->
dither_error
[
0
][
i
]
=
err
[
0
];
...
...
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