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
3e1356f7
Commit
3e1356f7
authored
Apr 18, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter: add weave filter
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
1895e3a2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
168 additions
and
1 deletion
+168
-1
Changelog
Changelog
+1
-0
filters.texi
doc/filters.texi
+21
-0
Makefile
libavfilter/Makefile
+1
-0
allfilters.c
libavfilter/allfilters.c
+1
-0
version.h
libavfilter/version.h
+1
-1
vf_weave.c
libavfilter/vf_weave.c
+143
-0
No files found.
Changelog
View file @
3e1356f7
...
...
@@ -24,6 +24,7 @@ version <next>:
- yuvtestsrc filter
- vaguedenoiser filter
- added threads option per filter instance
- weave filter
version 3.1:
...
...
doc/filters.texi
View file @
3e1356f7
...
...
@@ -14104,6 +14104,27 @@ Set scale used for displaying graticule.
Default is digital.
@end table
@section weave
The @code{weave} takes a field-based video input and join
each two sequential fields into single frame, producing a new double
height clip with half the frame rate and half the frame count.
It accepts the following option:
@table @option
@item first_field
Set first field. Available values are:
@table @samp
@item top, t
Set the frame as top-field-first.
@item bottom, b
Set the frame as bottom-field-first.
@end table
@end table
@section xbr
Apply the xBR high-quality magnification filter which is designed for pixel
art. It follows a set of edge-detection rules, see
...
...
libavfilter/Makefile
View file @
3e1356f7
...
...
@@ -295,6 +295,7 @@ OBJS-$(CONFIG_VIGNETTE_FILTER) += vf_vignette.o
OBJS-$(CONFIG_VSTACK_FILTER)
+=
vf_stack.o
framesync.o
OBJS-$(CONFIG_W3FDIF_FILTER)
+=
vf_w3fdif.o
OBJS-$(CONFIG_WAVEFORM_FILTER)
+=
vf_waveform.o
OBJS-$(CONFIG_WEAVE_FILTER)
+=
vf_weave.o
OBJS-$(CONFIG_XBR_FILTER)
+=
vf_xbr.o
OBJS-$(CONFIG_YADIF_FILTER)
+=
vf_yadif.o
OBJS-$(CONFIG_ZMQ_FILTER)
+=
f_zmq.o
...
...
libavfilter/allfilters.c
View file @
3e1356f7
...
...
@@ -311,6 +311,7 @@ void avfilter_register_all(void)
REGISTER_FILTER
(
VSTACK
,
vstack
,
vf
);
REGISTER_FILTER
(
W3FDIF
,
w3fdif
,
vf
);
REGISTER_FILTER
(
WAVEFORM
,
waveform
,
vf
);
REGISTER_FILTER
(
WEAVE
,
weave
,
vf
);
REGISTER_FILTER
(
XBR
,
xbr
,
vf
);
REGISTER_FILTER
(
YADIF
,
yadif
,
vf
);
REGISTER_FILTER
(
ZMQ
,
zmq
,
vf
);
...
...
libavfilter/version.h
View file @
3e1356f7
...
...
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 6
#define LIBAVFILTER_VERSION_MINOR 5
8
#define LIBAVFILTER_VERSION_MINOR 5
9
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
...
...
libavfilter/vf_weave.c
0 → 100644
View file @
3e1356f7
/*
* Copyright (c) 2013 Paul B Mahol
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "internal.h"
typedef
struct
WeaveContext
{
const
AVClass
*
class
;
int
first_field
;
int
nb_planes
;
int
planeheight
[
4
];
int
linesize
[
4
];
AVFrame
*
prev
;
}
WeaveContext
;
#define OFFSET(x) offsetof(WeaveContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
weave_options
[]
=
{
{
"first_field"
,
"set first field"
,
OFFSET
(
first_field
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
FLAGS
,
"field"
},
{
"top"
,
"set top field first"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
FLAGS
,
"field"
},
{
"t"
,
"set top field first"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
FLAGS
,
"field"
},
{
"bottom"
,
"set bottom field first"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"field"
},
{
"b"
,
"set bottom field first"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"field"
},
{
NULL
}
};
AVFILTER_DEFINE_CLASS
(
weave
);
static
int
config_props_output
(
AVFilterLink
*
outlink
)
{
AVFilterContext
*
ctx
=
outlink
->
src
;
WeaveContext
*
s
=
ctx
->
priv
;
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
inlink
->
format
);
int
ret
;
outlink
->
time_base
.
num
=
inlink
->
time_base
.
num
*
2
;
outlink
->
time_base
.
den
=
inlink
->
time_base
.
den
;
outlink
->
frame_rate
.
num
=
inlink
->
frame_rate
.
num
;
outlink
->
frame_rate
.
den
=
inlink
->
frame_rate
.
den
*
2
;
outlink
->
w
=
inlink
->
w
;
outlink
->
h
=
inlink
->
h
*
2
;
if
((
ret
=
av_image_fill_linesizes
(
s
->
linesize
,
inlink
->
format
,
inlink
->
w
))
<
0
)
return
ret
;
s
->
planeheight
[
1
]
=
s
->
planeheight
[
2
]
=
AV_CEIL_RSHIFT
(
inlink
->
h
,
desc
->
log2_chroma_h
);
s
->
planeheight
[
0
]
=
s
->
planeheight
[
3
]
=
inlink
->
h
;
s
->
nb_planes
=
av_pix_fmt_count_planes
(
inlink
->
format
);
return
0
;
}
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
in
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
WeaveContext
*
s
=
ctx
->
priv
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
AVFrame
*
out
;
int
i
;
if
(
!
s
->
prev
)
{
s
->
prev
=
in
;
return
0
;
}
out
=
ff_get_video_buffer
(
outlink
,
outlink
->
w
,
outlink
->
h
);
if
(
!
out
)
{
av_frame_free
(
&
in
);
av_frame_free
(
&
s
->
prev
);
return
AVERROR
(
ENOMEM
);
}
av_frame_copy_props
(
out
,
in
);
for
(
i
=
0
;
i
<
s
->
nb_planes
;
i
++
)
{
av_image_copy_plane
(
out
->
data
[
i
]
+
out
->
linesize
[
i
]
*
s
->
first_field
,
out
->
linesize
[
i
]
*
2
,
in
->
data
[
i
],
in
->
linesize
[
i
],
s
->
linesize
[
i
],
s
->
planeheight
[
i
]);
av_image_copy_plane
(
out
->
data
[
i
]
+
out
->
linesize
[
i
]
*
!
s
->
first_field
,
out
->
linesize
[
i
]
*
2
,
s
->
prev
->
data
[
i
],
s
->
prev
->
linesize
[
i
],
s
->
linesize
[
i
],
s
->
planeheight
[
i
]);
}
out
->
pts
=
in
->
pts
/
2
;
out
->
interlaced_frame
=
1
;
out
->
top_field_first
=
!
s
->
first_field
;
av_frame_free
(
&
in
);
av_frame_free
(
&
s
->
prev
);
return
ff_filter_frame
(
outlink
,
out
);
}
static
const
AVFilterPad
weave_inputs
[]
=
{
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
filter_frame
=
filter_frame
,
},
{
NULL
}
};
static
const
AVFilterPad
weave_outputs
[]
=
{
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
config_props
=
config_props_output
,
},
{
NULL
}
};
AVFilter
ff_vf_weave
=
{
.
name
=
"weave"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Weave input video fields into frames."
),
.
priv_size
=
sizeof
(
WeaveContext
),
.
priv_class
=
&
weave_class
,
.
inputs
=
weave_inputs
,
.
outputs
=
weave_outputs
,
};
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