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
aa61728d
Commit
aa61728d
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_cropdetect: switch to filter_frame
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
71f82c38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
vf_cropdetect.c
libavfilter/vf_cropdetect.c
+13
-15
No files found.
libavfilter/vf_cropdetect.c
View file @
aa61728d
...
...
@@ -117,11 +117,10 @@ static int config_input(AVFilterLink *inlink)
return
0
;
}
static
int
end_frame
(
AVFilterLink
*
inlink
)
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
frame
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
CropDetectContext
*
cd
=
ctx
->
priv
;
AVFilterBufferRef
*
picref
=
inlink
->
cur_buf
;
int
bpp
=
cd
->
max_pixsteps
[
0
];
int
w
,
h
,
x
,
y
,
shrink_by
;
...
...
@@ -129,36 +128,36 @@ static int end_frame(AVFilterLink *inlink)
if
(
++
cd
->
frame_nb
>
0
)
{
// Reset the crop area every reset_count frames, if reset_count is > 0
if
(
cd
->
reset_count
>
0
&&
cd
->
frame_nb
>
cd
->
reset_count
)
{
cd
->
x1
=
picref
->
video
->
w
-
1
;
cd
->
y1
=
picref
->
video
->
h
-
1
;
cd
->
x1
=
frame
->
video
->
w
-
1
;
cd
->
y1
=
frame
->
video
->
h
-
1
;
cd
->
x2
=
0
;
cd
->
y2
=
0
;
cd
->
frame_nb
=
1
;
}
for
(
y
=
0
;
y
<
cd
->
y1
;
y
++
)
{
if
(
checkline
(
ctx
,
picref
->
data
[
0
]
+
picref
->
linesize
[
0
]
*
y
,
bpp
,
picref
->
video
->
w
,
bpp
)
>
cd
->
limit
)
{
if
(
checkline
(
ctx
,
frame
->
data
[
0
]
+
frame
->
linesize
[
0
]
*
y
,
bpp
,
frame
->
video
->
w
,
bpp
)
>
cd
->
limit
)
{
cd
->
y1
=
y
;
break
;
}
}
for
(
y
=
picref
->
video
->
h
-
1
;
y
>
cd
->
y2
;
y
--
)
{
if
(
checkline
(
ctx
,
picref
->
data
[
0
]
+
picref
->
linesize
[
0
]
*
y
,
bpp
,
picref
->
video
->
w
,
bpp
)
>
cd
->
limit
)
{
for
(
y
=
frame
->
video
->
h
-
1
;
y
>
cd
->
y2
;
y
--
)
{
if
(
checkline
(
ctx
,
frame
->
data
[
0
]
+
frame
->
linesize
[
0
]
*
y
,
bpp
,
frame
->
video
->
w
,
bpp
)
>
cd
->
limit
)
{
cd
->
y2
=
y
;
break
;
}
}
for
(
y
=
0
;
y
<
cd
->
x1
;
y
++
)
{
if
(
checkline
(
ctx
,
picref
->
data
[
0
]
+
bpp
*
y
,
picref
->
linesize
[
0
],
picref
->
video
->
h
,
bpp
)
>
cd
->
limit
)
{
if
(
checkline
(
ctx
,
frame
->
data
[
0
]
+
bpp
*
y
,
frame
->
linesize
[
0
],
frame
->
video
->
h
,
bpp
)
>
cd
->
limit
)
{
cd
->
x1
=
y
;
break
;
}
}
for
(
y
=
picref
->
video
->
w
-
1
;
y
>
cd
->
x2
;
y
--
)
{
if
(
checkline
(
ctx
,
picref
->
data
[
0
]
+
bpp
*
y
,
picref
->
linesize
[
0
],
picref
->
video
->
h
,
bpp
)
>
cd
->
limit
)
{
for
(
y
=
frame
->
video
->
w
-
1
;
y
>
cd
->
x2
;
y
--
)
{
if
(
checkline
(
ctx
,
frame
->
data
[
0
]
+
bpp
*
y
,
frame
->
linesize
[
0
],
frame
->
video
->
h
,
bpp
)
>
cd
->
limit
)
{
cd
->
x2
=
y
;
break
;
}
...
...
@@ -189,12 +188,12 @@ static int end_frame(AVFilterLink *inlink)
av_log
(
ctx
,
AV_LOG_INFO
,
"x1:%d x2:%d y1:%d y2:%d w:%d h:%d x:%d y:%d pos:%"
PRId64
" pts:%"
PRId64
" t:%f crop=%d:%d:%d:%d
\n
"
,
cd
->
x1
,
cd
->
x2
,
cd
->
y1
,
cd
->
y2
,
w
,
h
,
x
,
y
,
picref
->
pos
,
picref
->
pts
,
picref
->
pts
==
AV_NOPTS_VALUE
?
-
1
:
picref
->
pts
*
av_q2d
(
inlink
->
time_base
),
cd
->
x1
,
cd
->
x2
,
cd
->
y1
,
cd
->
y2
,
w
,
h
,
x
,
y
,
frame
->
pos
,
frame
->
pts
,
frame
->
pts
==
AV_NOPTS_VALUE
?
-
1
:
frame
->
pts
*
av_q2d
(
inlink
->
time_base
),
w
,
h
,
x
,
y
);
}
return
ff_
end_frame
(
inlink
->
dst
->
outputs
[
0
]
);
return
ff_
filter_frame
(
inlink
->
dst
->
outputs
[
0
],
frame
);
}
static
const
AVFilterPad
avfilter_vf_cropdetect_inputs
[]
=
{
...
...
@@ -203,8 +202,7 @@ static const AVFilterPad avfilter_vf_cropdetect_inputs[] = {
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
config_props
=
config_input
,
.
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