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
0cbfbdef
Commit
0cbfbdef
authored
May 24, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vf_fade: Support slice threaded alpha
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
a3d62f33
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
vf_fade.c
libavfilter/vf_fade.c
+27
-8
No files found.
libavfilter/vf_fade.c
View file @
0cbfbdef
...
...
@@ -208,6 +208,31 @@ static int filter_slice_chroma(AVFilterContext *ctx, void *arg, int jobnr,
return
0
;
}
static
int
filter_slice_alpha
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
)
{
FadeContext
*
s
=
ctx
->
priv
;
AVFrame
*
frame
=
arg
;
int
plane
=
s
->
is_packed_rgb
?
0
:
A
;
int
slice_start
=
(
frame
->
height
*
jobnr
)
/
nb_jobs
;
int
slice_end
=
(
frame
->
height
*
(
jobnr
+
1
))
/
nb_jobs
;
int
i
,
j
;
for
(
i
=
slice_start
;
i
<
slice_end
;
i
++
)
{
uint8_t
*
p
=
frame
->
data
[
plane
]
+
i
*
frame
->
linesize
[
plane
]
+
s
->
is_packed_rgb
*
s
->
rgba_map
[
A
];
int
step
=
s
->
is_packed_rgb
?
4
:
1
;
for
(
j
=
0
;
j
<
frame
->
width
;
j
++
)
{
/* s->factor is using 16 lower-order bits for decimal
* places. 32768 = 1 << 15, it is an integer representation
* of 0.5 and is for rounding. */
*
p
=
((
*
p
-
s
->
black_level
)
*
s
->
factor
+
s
->
black_level_scaled
)
>>
16
;
p
+=
step
;
}
}
return
0
;
}
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
frame
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
...
...
@@ -264,14 +289,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
if
(
s
->
factor
<
UINT16_MAX
)
{
if
(
s
->
alpha
)
{
// alpha only
int
plane
=
s
->
is_packed_rgb
?
0
:
A
;
// alpha is on plane 0 for packed formats
// or plane 3 for planar formats
fade_plane
(
0
,
frame
->
height
,
inlink
->
w
,
s
->
factor
,
s
->
black_level
,
s
->
black_level_scaled
,
s
->
is_packed_rgb
?
s
->
rgba_map
[
A
]
:
0
,
// alpha offset for packed formats
s
->
is_packed_rgb
?
4
:
1
,
// pixstep for 8 bit packed formats
1
,
frame
->
data
[
plane
],
frame
->
linesize
[
plane
]);
ctx
->
internal
->
execute
(
ctx
,
filter_slice_alpha
,
frame
,
NULL
,
FFMIN
(
frame
->
height
,
ctx
->
graph
->
nb_threads
));
}
else
{
/* luma or rgb plane */
ctx
->
internal
->
execute
(
ctx
,
filter_slice_luma
,
frame
,
NULL
,
...
...
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