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
fef7b2e0
Commit
fef7b2e0
authored
Dec 06, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/tinterlace: switch to filter_frame API
Also add missing NULL checks.
parent
656500c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
27 deletions
+19
-27
vf_tinterlace.c
libavfilter/vf_tinterlace.c
+19
-27
No files found.
libavfilter/vf_tinterlace.c
View file @
fef7b2e0
...
@@ -202,28 +202,20 @@ void copy_picture_field(uint8_t *dst[4], int dst_linesize[4],
...
@@ -202,28 +202,20 @@ void copy_picture_field(uint8_t *dst[4], int dst_linesize[4],
}
}
}
}
static
int
start
_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
picref
)
static
int
filter
_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
picref
)
{
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
TInterlaceContext
*
tinterlace
=
ctx
->
priv
;
TInterlaceContext
*
tinterlace
=
ctx
->
priv
;
AVFilterBufferRef
*
cur
,
*
next
,
*
out
;
int
field
,
tff
,
ret
;
avfilter_unref_buffer
(
tinterlace
->
cur
);
avfilter_unref_buffer
(
tinterlace
->
cur
);
tinterlace
->
cur
=
tinterlace
->
next
;
tinterlace
->
cur
=
tinterlace
->
next
;
tinterlace
->
next
=
picref
;
tinterlace
->
next
=
picref
;
inlink
->
cur_buf
=
NULL
;
return
0
;
}
static
int
end_frame
(
AVFilterLink
*
inlink
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
TInterlaceContext
*
tinterlace
=
ctx
->
priv
;
AVFilterBufferRef
*
cur
=
tinterlace
->
cur
;
AVFilterBufferRef
*
next
=
tinterlace
->
next
;
AVFilterBufferRef
*
out
=
NULL
;
int
field
,
tff
;
cur
=
tinterlace
->
cur
;
next
=
tinterlace
->
next
;
/* we need at least two frames */
/* we need at least two frames */
if
(
!
tinterlace
->
cur
)
if
(
!
tinterlace
->
cur
)
return
0
;
return
0
;
...
@@ -232,6 +224,8 @@ static int end_frame(AVFilterLink *inlink)
...
@@ -232,6 +224,8 @@ static int end_frame(AVFilterLink *inlink)
case
MODE_MERGE
:
/* move the odd frame into the upper field of the new image, even into
case
MODE_MERGE
:
/* move the odd frame into the upper field of the new image, even into
* the lower field, generating a double-height video at half framerate */
* the lower field, generating a double-height video at half framerate */
out
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
out
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
if
(
!
out
)
return
AVERROR
(
ENOMEM
);
avfilter_copy_buffer_ref_props
(
out
,
cur
);
avfilter_copy_buffer_ref_props
(
out
,
cur
);
out
->
video
->
h
=
outlink
->
h
;
out
->
video
->
h
=
outlink
->
h
;
out
->
video
->
interlaced
=
1
;
out
->
video
->
interlaced
=
1
;
...
@@ -281,6 +275,8 @@ static int end_frame(AVFilterLink *inlink)
...
@@ -281,6 +275,8 @@ static int end_frame(AVFilterLink *inlink)
case
MODE_INTERLEAVE_BOTTOM
:
/* bottom field first */
case
MODE_INTERLEAVE_BOTTOM
:
/* bottom field first */
tff
=
tinterlace
->
mode
==
MODE_INTERLEAVE_TOP
;
tff
=
tinterlace
->
mode
==
MODE_INTERLEAVE_TOP
;
out
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
out
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
if
(
!
out
)
return
AVERROR
(
ENOMEM
);
avfilter_copy_buffer_ref_props
(
out
,
cur
);
avfilter_copy_buffer_ref_props
(
out
,
cur
);
out
->
video
->
interlaced
=
1
;
out
->
video
->
interlaced
=
1
;
out
->
video
->
top_field_first
=
tff
;
out
->
video
->
top_field_first
=
tff
;
...
@@ -300,15 +296,18 @@ static int end_frame(AVFilterLink *inlink)
...
@@ -300,15 +296,18 @@ static int end_frame(AVFilterLink *inlink)
case
MODE_INTERLACEX2
:
/* re-interlace preserving image height, double frame rate */
case
MODE_INTERLACEX2
:
/* re-interlace preserving image height, double frame rate */
/* output current frame first */
/* output current frame first */
out
=
avfilter_ref_buffer
(
cur
,
~
AV_PERM_WRITE
);
out
=
avfilter_ref_buffer
(
cur
,
~
AV_PERM_WRITE
);
if
(
!
out
)
return
AVERROR
(
ENOMEM
);
out
->
video
->
interlaced
=
1
;
out
->
video
->
interlaced
=
1
;
ff_start_frame
(
outlink
,
out
);
if
((
ret
=
ff_filter_frame
(
outlink
,
out
))
<
0
)
ff_draw_slice
(
outlink
,
0
,
outlink
->
h
,
1
);
return
ret
;
ff_end_frame
(
outlink
);
/* output mix of current and next frame */
/* output mix of current and next frame */
tff
=
next
->
video
->
top_field_first
;
tff
=
next
->
video
->
top_field_first
;
out
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
out
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
if
(
!
out
)
return
AVERROR
(
ENOMEM
);
avfilter_copy_buffer_ref_props
(
out
,
next
);
avfilter_copy_buffer_ref_props
(
out
,
next
);
out
->
video
->
interlaced
=
1
;
out
->
video
->
interlaced
=
1
;
...
@@ -325,13 +324,10 @@ static int end_frame(AVFilterLink *inlink)
...
@@ -325,13 +324,10 @@ static int end_frame(AVFilterLink *inlink)
break
;
break
;
}
}
ff_start_frame
(
outlink
,
out
);
ret
=
ff_filter_frame
(
outlink
,
out
);
ff_draw_slice
(
outlink
,
0
,
outlink
->
h
,
1
);
ff_end_frame
(
outlink
);
tinterlace
->
frame
++
;
tinterlace
->
frame
++
;
return
0
;
return
ret
;
}
}
static
int
request_frame
(
AVFilterLink
*
outlink
)
static
int
request_frame
(
AVFilterLink
*
outlink
)
...
@@ -349,15 +345,11 @@ static int request_frame(AVFilterLink *outlink)
...
@@ -349,15 +345,11 @@ static int request_frame(AVFilterLink *outlink)
return
0
;
return
0
;
}
}
static
int
null_draw_slice
(
AVFilterLink
*
link
,
int
y
,
int
h
,
int
slice_dir
)
{
return
0
;
}
static
const
AVFilterPad
tinterlace_inputs
[]
=
{
static
const
AVFilterPad
tinterlace_inputs
[]
=
{
{
{
.
name
=
"default"
,
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
start_frame
=
start_frame
,
.
filter_frame
=
filter_frame
,
.
draw_slice
=
null_draw_slice
,
.
end_frame
=
end_frame
,
},
},
{
NULL
}
{
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