Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
ffmpeg
Commits
83ab46a5
Commit
83ab46a5
authored
Dec 01, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/blackdetect: switch to new ff_filter_frame() API
parent
86a24868
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
18 deletions
+6
-18
vf_blackdetect.c
libavfilter/vf_blackdetect.c
+6
-18
No files found.
libavfilter/vf_blackdetect.c
View file @
83ab46a5
...
...
@@ -146,30 +146,20 @@ static int request_frame(AVFilterLink *outlink)
return
ret
;
}
static
int
draw_slice
(
AVFilterLink
*
inlink
,
int
y
,
int
h
,
int
slice_dir
)
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
picref
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
BlackDetectContext
*
blackdetect
=
ctx
->
priv
;
AVFilterBufferRef
*
picref
=
inlink
->
cur_buf
;
double
picture_black_ratio
=
0
;
const
uint8_t
*
p
=
picref
->
data
[
0
];
int
x
,
i
;
const
uint8_t
*
p
=
picref
->
data
[
0
]
+
y
*
picref
->
linesize
[
0
];
for
(
i
=
0
;
i
<
h
;
i
++
)
{
for
(
i
=
0
;
i
<
inlink
->
h
;
i
++
)
{
for
(
x
=
0
;
x
<
inlink
->
w
;
x
++
)
blackdetect
->
nb_black_pixels
+=
p
[
x
]
<=
blackdetect
->
pixel_black_th_i
;
p
+=
picref
->
linesize
[
0
];
}
return
ff_draw_slice
(
ctx
->
outputs
[
0
],
y
,
h
,
slice_dir
);
}
static
int
end_frame
(
AVFilterLink
*
inlink
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
BlackDetectContext
*
blackdetect
=
ctx
->
priv
;
AVFilterBufferRef
*
picref
=
inlink
->
cur_buf
;
double
picture_black_ratio
=
0
;
picture_black_ratio
=
(
double
)
blackdetect
->
nb_black_pixels
/
(
inlink
->
w
*
inlink
->
h
);
av_log
(
ctx
,
AV_LOG_DEBUG
,
...
...
@@ -194,7 +184,7 @@ static int end_frame(AVFilterLink *inlink)
blackdetect
->
last_picref_pts
=
picref
->
pts
;
blackdetect
->
frame_count
++
;
blackdetect
->
nb_black_pixels
=
0
;
return
ff_
end_frame
(
inlink
->
dst
->
outputs
[
0
]
);
return
ff_
filter_frame
(
inlink
->
dst
->
outputs
[
0
],
picref
);
}
static
const
AVFilterPad
blackdetect_inputs
[]
=
{
...
...
@@ -202,10 +192,8 @@ static const AVFilterPad blackdetect_inputs[] = {
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
config_props
=
config_input
,
.
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