Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
c3ad91a3
Commit
c3ad91a3
authored
12 years ago
by
Stefano Sabatini
Browse files
Options
Downloads
Patches
Plain Diff
lavfi/alphaextract: switch to filter_frame() API
parent
1f467220
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavfilter/vf_alphaextract.c
+21
-7
21 additions, 7 deletions
libavfilter/vf_alphaextract.c
with
21 additions
and
7 deletions
libavfilter/vf_alphaextract.c
+
21
−
7
View file @
c3ad91a3
...
...
@@ -28,6 +28,7 @@
#include
"libavutil/pixfmt.h"
#include
"avfilter.h"
#include
"drawutils.h"
#include
"internal.h"
#include
"formats.h"
#include
"video.h"
...
...
@@ -59,16 +60,24 @@ static int config_input(AVFilterLink *inlink)
return
0
;
}
static
int
draw_slic
e
(
AVFilterLink
*
inlink
,
int
y0
,
int
h
,
int
slice_dir
)
static
int
filter_fram
e
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
cur_buf
)
{
AlphaExtractContext
*
extract
=
inlink
->
dst
->
priv
;
AVFilterBufferRef
*
cur_buf
=
inlink
->
cur_buf
;
AVFilterBufferRef
*
out_buf
=
inlink
->
dst
->
outputs
[
0
]
->
out_buf
;
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
AVFilterBufferRef
*
out_buf
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
int
ret
;
if
(
!
out_buf
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
end
;
}
avfilter_copy_buffer_ref_props
(
out_buf
,
cur_buf
);
if
(
extract
->
is_packed_rgb
)
{
int
x
,
y
;
uint8_t
*
pin
,
*
pout
;
for
(
y
=
y
0
;
y
<
(
y0
+
h
)
;
y
++
)
{
for
(
y
=
0
;
y
<
out_buf
->
video
->
h
;
y
++
)
{
pin
=
cur_buf
->
data
[
0
]
+
y
*
cur_buf
->
linesize
[
0
]
+
extract
->
rgba_map
[
A
];
pout
=
out_buf
->
data
[
0
]
+
y
*
out_buf
->
linesize
[
0
];
for
(
x
=
0
;
x
<
out_buf
->
video
->
w
;
x
++
)
{
...
...
@@ -80,13 +89,18 @@ static int draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)
}
else
{
const
int
linesize
=
FFMIN
(
out_buf
->
linesize
[
Y
],
cur_buf
->
linesize
[
A
]);
int
y
;
for
(
y
=
y
0
;
y
<
(
y0
+
h
)
;
y
++
)
{
for
(
y
=
0
;
y
<
out_buf
->
video
->
h
;
y
++
)
{
memcpy
(
out_buf
->
data
[
Y
]
+
y
*
out_buf
->
linesize
[
Y
],
cur_buf
->
data
[
A
]
+
y
*
cur_buf
->
linesize
[
A
],
linesize
);
}
}
return
ff_draw_slice
(
inlink
->
dst
->
outputs
[
0
],
y0
,
h
,
slice_dir
);
ret
=
ff_filter_frame
(
outlink
,
out_buf
);
end:
avfilter_unref_buffer
(
cur_buf
);
return
ret
;
}
static
const
AVFilterPad
alphaextract_inputs
[]
=
{
...
...
@@ -94,7 +108,7 @@ static const AVFilterPad alphaextract_inputs[] = {
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
config_props
=
config_input
,
.
draw_slice
=
draw_slic
e
,
.
filter_frame
=
filter_fram
e
,
.
min_perms
=
AV_PERM_READ
,
},
{
NULL
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment