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
0a767ad7
Commit
0a767ad7
authored
Nov 28, 2012
by
Anton Khirnov
Committed by
Michael Niedermayer
Nov 28, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vf_blackframe: switch to filter_frame
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
8f21cfc6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
23 deletions
+11
-23
vf_blackframe.c
libavfilter/vf_blackframe.c
+11
-23
No files found.
libavfilter/vf_blackframe.c
View file @
0a767ad7
...
...
@@ -81,54 +81,42 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
return
0
;
}
static
int
draw_slice
(
AVFilterLink
*
inlink
,
int
y
,
int
h
,
int
slice_dir
)
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
frame
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
BlackFrameContext
*
blackframe
=
ctx
->
priv
;
AVFilterBufferRef
*
picref
=
inlink
->
cur_buf
;
int
x
,
i
;
uint8_t
*
p
=
picref
->
data
[
0
]
+
y
*
picref
->
linesize
[
0
];
int
pblack
=
0
;
uint8_t
*
p
=
frame
->
data
[
0
];
for
(
i
=
0
;
i
<
h
;
i
++
)
{
for
(
i
=
0
;
i
<
frame
->
video
->
h
;
i
++
)
{
for
(
x
=
0
;
x
<
inlink
->
w
;
x
++
)
blackframe
->
nblack
+=
p
[
x
]
<
blackframe
->
bthresh
;
p
+=
picref
->
linesize
[
0
];
p
+=
frame
->
linesize
[
0
];
}
return
ff_draw_slice
(
ctx
->
outputs
[
0
],
y
,
h
,
slice_dir
);
}
static
int
end_frame
(
AVFilterLink
*
inlink
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
BlackFrameContext
*
blackframe
=
ctx
->
priv
;
AVFilterBufferRef
*
picref
=
inlink
->
cur_buf
;
int
pblack
=
0
;
if
(
picref
->
video
->
key_frame
)
if
(
frame
->
video
->
key_frame
)
blackframe
->
last_keyframe
=
blackframe
->
frame
;
pblack
=
blackframe
->
nblack
*
100
/
(
inlink
->
w
*
inlink
->
h
);
if
(
pblack
>=
blackframe
->
bamount
)
av_log
(
ctx
,
AV_LOG_INFO
,
"frame:%u pblack:%u pos:%"
PRId64
" pts:%"
PRId64
" t:%f "
"type:%c last_keyframe:%d
\n
"
,
blackframe
->
frame
,
pblack
,
picref
->
pos
,
picref
->
pts
,
picref
->
pts
==
AV_NOPTS_VALUE
?
-
1
:
picref
->
pts
*
av_q2d
(
inlink
->
time_base
),
av_get_picture_type_char
(
picref
->
video
->
pict_type
),
blackframe
->
last_keyframe
);
blackframe
->
frame
,
pblack
,
frame
->
pos
,
frame
->
pts
,
frame
->
pts
==
AV_NOPTS_VALUE
?
-
1
:
frame
->
pts
*
av_q2d
(
inlink
->
time_base
),
av_get_picture_type_char
(
frame
->
video
->
pict_type
),
blackframe
->
last_keyframe
);
blackframe
->
frame
++
;
blackframe
->
nblack
=
0
;
return
ff_
end_frame
(
inlink
->
dst
->
outputs
[
0
]
);
return
ff_
filter_frame
(
inlink
->
dst
->
outputs
[
0
],
frame
);
}
static
const
AVFilterPad
avfilter_vf_blackframe_inputs
[]
=
{
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
draw_slice
=
draw_slice
,
.
get_video_buffer
=
ff_null_get_video_buffer
,
.
start_frame
=
ff_null_start_frame
,
.
end_frame
=
end_frame
,
.
filter_frame
=
filter_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