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
fa1f92a4
Commit
fa1f92a4
authored
Apr 05, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vf_idet: clean detected frame types based on a 4 frame history.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
c59e73d2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
vf_idet.c
libavfilter/vf_idet.c
+28
-3
No files found.
libavfilter/vf_idet.c
View file @
fa1f92a4
...
...
@@ -26,6 +26,8 @@
#undef NDEBUG
#include <assert.h>
#define HIST_SIZE 4
typedef
enum
{
TFF
,
BFF
,
...
...
@@ -41,6 +43,8 @@ typedef struct {
Type
prestat
[
4
];
Type
poststat
[
4
];
uint8_t
history
[
HIST_SIZE
];
AVFilterBufferRef
*
cur
;
AVFilterBufferRef
*
next
;
AVFilterBufferRef
*
prev
;
...
...
@@ -91,7 +95,8 @@ static void filter(AVFilterContext *ctx)
int
y
,
i
;
int64_t
alpha
[
2
]
=
{
0
};
int64_t
delta
=
0
;
Type
type
;
Type
type
,
best_type
;
int
match
=
0
;
for
(
i
=
0
;
i
<
idet
->
csp
->
nb_components
;
i
++
)
{
int
w
=
idet
->
cur
->
video
->
w
;
...
...
@@ -127,8 +132,27 @@ static void filter(AVFilterContext *ctx)
type
=
UNDETERMINED
;
}
if
(
type
!=
UNDETERMINED
)
idet
->
last_type
=
type
;
memmove
(
idet
->
history
+
1
,
idet
->
history
,
HIST_SIZE
-
1
);
idet
->
history
[
0
]
=
type
;
best_type
=
UNDETERMINED
;
for
(
i
=
0
;
i
<
HIST_SIZE
;
i
++
){
if
(
idet
->
history
[
i
]
!=
UNDETERMINED
){
if
(
best_type
==
UNDETERMINED
)
best_type
=
idet
->
history
[
i
];
if
(
idet
->
history
[
i
]
==
best_type
)
{
match
++
;
}
else
{
match
=
0
;
break
;
}
}
}
if
(
idet
->
last_type
==
UNDETERMINED
){
if
(
match
)
idet
->
last_type
=
best_type
;
}
else
{
if
(
match
>
2
)
idet
->
last_type
=
best_type
;
}
if
(
idet
->
last_type
==
TFF
){
idet
->
cur
->
video
->
top_field_first
=
1
;
...
...
@@ -281,6 +305,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if
(
args
)
sscanf
(
args
,
"%f:%f"
,
&
idet
->
interlace_threshold
,
&
idet
->
progressive_threshold
);
idet
->
last_type
=
UNDETERMINED
;
memset
(
idet
->
history
,
UNDETERMINED
,
HIST_SIZE
);
idet
->
filter_line
=
filter_line_c
;
...
...
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