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
02ad0416
Commit
02ad0416
authored
Oct 21, 2018
by
Martin Vignali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/setparams : merge setfield and setrange filter to setparams filter
setfield and setrange filters are kept.
parent
18d391cf
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
146 additions
and
98 deletions
+146
-98
Changelog
Changelog
+1
-0
filters.texi
doc/filters.texi
+46
-0
Makefile
libavfilter/Makefile
+2
-1
allfilters.c
libavfilter/allfilters.c
+1
-0
version.h
libavfilter/version.h
+1
-1
vf_setfield.c
libavfilter/vf_setfield.c
+0
-94
vf_setparams.c
libavfilter/vf_setparams.c
+95
-2
No files found.
Changelog
View file @
02ad0416
...
...
@@ -36,6 +36,7 @@ version <next>:
- SER demuxer
- sinc audio filter source
- chromahold filter
- setparams filter
version 4.0:
...
...
doc/filters.texi
View file @
02ad0416
...
...
@@ -14967,6 +14967,52 @@ Mark the frame as progressive.
@
end
table
@
end
table
@
anchor
{
setparams
}
@
section
setparams
Force
frame
parameter
for
the
output
video
frame
.
The
@
code
{
setparams
}
filter
marks
interlace
and
color
range
for
the
output
frames
.
It
does
not
change
the
input
frame
,
but
only
sets
the
corresponding
property
,
which
affects
how
the
frame
is
treated
by
filters
/
encoders
.
@
table
@
option
@
item
field_mode
Available
values
are
:
@
table
@
samp
@
item
auto
Keep
the
same
field
property
(
default
).
@
item
bff
Mark
the
frame
as
bottom
-
field
-
first
.
@
item
tff
Mark
the
frame
as
top
-
field
-
first
.
@
item
prog
Mark
the
frame
as
progressive
.
@
end
table
@
item
range
Available
values
are
:
@
table
@
samp
@
item
auto
Keep
the
same
color
range
property
(
default
).
@
item
unspecified
,
unknown
Mark
the
frame
as
unspecified
color
range
.
@
item
limited
,
tv
,
mpeg
Mark
the
frame
as
limited
range
.
@
item
full
,
pc
,
jpeg
Mark
the
frame
as
full
range
.
@
end
table
@
end
table
@
section
showinfo
Show
a
line
containing
various
information
for
each
input
video
frame
.
...
...
libavfilter/Makefile
View file @
02ad0416
...
...
@@ -342,7 +342,8 @@ OBJS-$(CONFIG_SELECTIVECOLOR_FILTER) += vf_selectivecolor.o
OBJS-$(CONFIG_SENDCMD_FILTER)
+=
f_sendcmd.o
OBJS-$(CONFIG_SEPARATEFIELDS_FILTER)
+=
vf_separatefields.o
OBJS-$(CONFIG_SETDAR_FILTER)
+=
vf_aspect.o
OBJS-$(CONFIG_SETFIELD_FILTER)
+=
vf_setfield.o
OBJS-$(CONFIG_SETFIELD_FILTER)
+=
vf_setparams.o
OBJS-$(CONFIG_SETPARAMS_FILTER)
+=
vf_setparams.o
OBJS-$(CONFIG_SETPTS_FILTER)
+=
setpts.o
OBJS-$(CONFIG_SETRANGE_FILTER)
+=
vf_setparams.o
OBJS-$(CONFIG_SETSAR_FILTER)
+=
vf_aspect.o
...
...
libavfilter/allfilters.c
View file @
02ad0416
...
...
@@ -327,6 +327,7 @@ extern AVFilter ff_vf_sendcmd;
extern
AVFilter
ff_vf_separatefields
;
extern
AVFilter
ff_vf_setdar
;
extern
AVFilter
ff_vf_setfield
;
extern
AVFilter
ff_vf_setparams
;
extern
AVFilter
ff_vf_setpts
;
extern
AVFilter
ff_vf_setrange
;
extern
AVFilter
ff_vf_setsar
;
...
...
libavfilter/version.h
View file @
02ad0416
...
...
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 7
#define LIBAVFILTER_VERSION_MINOR 3
5
#define LIBAVFILTER_VERSION_MINOR 3
6
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
...
...
libavfilter/vf_setfield.c
deleted
100644 → 0
View file @
18d391cf
/*
* Copyright (c) 2012 Stefano Sabatini
*
* 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
*/
/**
* @file
* set field order
*/
#include "libavutil/opt.h"
#include "avfilter.h"
#include "internal.h"
#include "video.h"
enum
SetFieldMode
{
MODE_AUTO
=
-
1
,
MODE_BFF
,
MODE_TFF
,
MODE_PROG
,
};
typedef
struct
SetFieldContext
{
const
AVClass
*
class
;
int
mode
;
///< SetFieldMode
}
SetFieldContext
;
#define OFFSET(x) offsetof(SetFieldContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
setfield_options
[]
=
{
{
"mode"
,
"select interlace mode"
,
OFFSET
(
mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
MODE_AUTO
},
-
1
,
MODE_PROG
,
FLAGS
,
"mode"
},
{
"auto"
,
"keep the same input field"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_AUTO
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"bff"
,
"mark as bottom-field-first"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_BFF
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"tff"
,
"mark as top-field-first"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_TFF
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"prog"
,
"mark as progressive"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_PROG
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
NULL
}
};
AVFILTER_DEFINE_CLASS
(
setfield
);
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
picref
)
{
SetFieldContext
*
setfield
=
inlink
->
dst
->
priv
;
if
(
setfield
->
mode
==
MODE_PROG
)
{
picref
->
interlaced_frame
=
0
;
}
else
if
(
setfield
->
mode
!=
MODE_AUTO
)
{
picref
->
interlaced_frame
=
1
;
picref
->
top_field_first
=
setfield
->
mode
;
}
return
ff_filter_frame
(
inlink
->
dst
->
outputs
[
0
],
picref
);
}
static
const
AVFilterPad
setfield_inputs
[]
=
{
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
filter_frame
=
filter_frame
,
},
{
NULL
}
};
static
const
AVFilterPad
setfield_outputs
[]
=
{
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
},
{
NULL
}
};
AVFilter
ff_vf_setfield
=
{
.
name
=
"setfield"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Force field for the output video frame."
),
.
priv_size
=
sizeof
(
SetFieldContext
),
.
priv_class
=
&
setfield_class
,
.
inputs
=
setfield_inputs
,
.
outputs
=
setfield_outputs
,
};
libavfilter/vf_setparams.c
View file @
02ad0416
/*
* Copyright (c) 2012 Stefano Sabatini
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
...
...
@@ -22,15 +24,29 @@
#include "internal.h"
#include "video.h"
enum
SetFieldMode
{
MODE_AUTO
=
-
1
,
MODE_BFF
,
MODE_TFF
,
MODE_PROG
,
};
typedef
struct
SetParamsContext
{
const
AVClass
*
class
;
int
field_mode
;
int
color_range
;
}
SetParamsContext
;
#define OFFSET(x) offsetof(SetParamsContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
setrange_options
[]
=
{
static
const
AVOption
setparams_options
[]
=
{
{
"field_mode"
,
"select interlace mode"
,
OFFSET
(
field_mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
MODE_AUTO
},
-
1
,
MODE_PROG
,
FLAGS
,
"mode"
},
{
"auto"
,
"keep the same input field"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_AUTO
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"bff"
,
"mark as bottom-field-first"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_BFF
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"tff"
,
"mark as top-field-first"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_TFF
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"prog"
,
"mark as progressive"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_PROG
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"range"
,
"select color range"
,
OFFSET
(
color_range
),
AV_OPT_TYPE_INT
,
{.
i64
=-
1
},
-
1
,
AVCOL_RANGE_NB
-
1
,
FLAGS
,
"range"
},
{
"auto"
,
"keep the same color range"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=-
1
},
0
,
0
,
FLAGS
,
"range"
},
{
"unspecified"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
AVCOL_RANGE_UNSPECIFIED
},
0
,
0
,
FLAGS
,
"range"
},
...
...
@@ -44,13 +60,22 @@ static const AVOption setrange_options[] = {
{
NULL
}
};
AVFILTER_DEFINE_CLASS
(
set
range
);
AVFILTER_DEFINE_CLASS
(
set
params
);
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
frame
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
SetParamsContext
*
s
=
ctx
->
priv
;
/* set field */
if
(
s
->
field_mode
==
MODE_PROG
)
{
frame
->
interlaced_frame
=
0
;
}
else
if
(
s
->
field_mode
!=
MODE_AUTO
)
{
frame
->
interlaced_frame
=
1
;
frame
->
top_field_first
=
s
->
field_mode
;
}
/* set range */
if
(
s
->
color_range
>=
0
)
frame
->
color_range
=
s
->
color_range
;
return
ff_filter_frame
(
ctx
->
outputs
[
0
],
frame
);
...
...
@@ -73,11 +98,79 @@ static const AVFilterPad outputs[] = {
{
NULL
}
};
AVFilter
ff_vf_setparams
=
{
.
name
=
"setparams"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Force field, or color range for the output video frame."
),
.
priv_size
=
sizeof
(
SetParamsContext
),
.
priv_class
=
&
setparams_class
,
.
inputs
=
inputs
,
.
outputs
=
outputs
,
};
#if CONFIG_SETRANGE_FILTER
static
const
AVOption
setrange_options
[]
=
{
{
"range"
,
"select color range"
,
OFFSET
(
color_range
),
AV_OPT_TYPE_INT
,
{.
i64
=-
1
},
-
1
,
AVCOL_RANGE_NB
-
1
,
FLAGS
,
"range"
},
{
"auto"
,
"keep the same color range"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=-
1
},
0
,
0
,
FLAGS
,
"range"
},
{
"unspecified"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
AVCOL_RANGE_UNSPECIFIED
},
0
,
0
,
FLAGS
,
"range"
},
{
"unknown"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
AVCOL_RANGE_UNSPECIFIED
},
0
,
0
,
FLAGS
,
"range"
},
{
"limited"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
AVCOL_RANGE_MPEG
},
0
,
0
,
FLAGS
,
"range"
},
{
"tv"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
AVCOL_RANGE_MPEG
},
0
,
0
,
FLAGS
,
"range"
},
{
"mpeg"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
AVCOL_RANGE_MPEG
},
0
,
0
,
FLAGS
,
"range"
},
{
"full"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
AVCOL_RANGE_JPEG
},
0
,
0
,
FLAGS
,
"range"
},
{
"pc"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
AVCOL_RANGE_JPEG
},
0
,
0
,
FLAGS
,
"range"
},
{
"jpeg"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
AVCOL_RANGE_JPEG
},
0
,
0
,
FLAGS
,
"range"
},
{
NULL
}
};
AVFILTER_DEFINE_CLASS
(
setrange
);
static
av_cold
int
init_setrange
(
AVFilterContext
*
ctx
)
{
SetParamsContext
*
s
=
ctx
->
priv
;
s
->
field_mode
=
MODE_AUTO
;
/* set field mode to auto */
return
0
;
}
AVFilter
ff_vf_setrange
=
{
.
name
=
"setrange"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Force color range for the output video frame."
),
.
priv_size
=
sizeof
(
SetParamsContext
),
.
init
=
init_setrange
,
.
priv_class
=
&
setrange_class
,
.
inputs
=
inputs
,
.
outputs
=
outputs
,
};
#endif
/* CONFIG_SETRANGE_FILTER */
#if CONFIG_SETFIELD_FILTER
static
const
AVOption
setfield_options
[]
=
{
{
"mode"
,
"select interlace mode"
,
OFFSET
(
field_mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
MODE_AUTO
},
-
1
,
MODE_PROG
,
FLAGS
,
"mode"
},
{
"auto"
,
"keep the same input field"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_AUTO
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"bff"
,
"mark as bottom-field-first"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_BFF
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"tff"
,
"mark as top-field-first"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_TFF
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"prog"
,
"mark as progressive"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_PROG
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
NULL
}
};
AVFILTER_DEFINE_CLASS
(
setfield
);
static
av_cold
int
init_setfield
(
AVFilterContext
*
ctx
)
{
SetParamsContext
*
s
=
ctx
->
priv
;
s
->
color_range
=
-
1
;
/* set range mode to auto */
return
0
;
}
AVFilter
ff_vf_setfield
=
{
.
name
=
"setfield"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Force field for the output video frame."
),
.
priv_size
=
sizeof
(
SetParamsContext
),
.
init
=
init_setfield
,
.
priv_class
=
&
setfield_class
,
.
inputs
=
inputs
,
.
outputs
=
outputs
,
};
#endif
/* CONFIG_SETFIELD_FILTER */
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