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
a5172dca
Commit
a5172dca
authored
Apr 24, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_mix: add scale option
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
161e006c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
filters.texi
doc/filters.texi
+10
-0
vf_mix.c
libavfilter/vf_mix.c
+8
-1
No files found.
doc/filters.texi
View file @
a5172dca
...
...
@@ -11154,6 +11154,11 @@ The number of inputs. If unspecified, it defaults to 2.
Specify weight of each input video stream as sequence.
Each weight is separated by space.
@item scale
Specify scale, if it is set it will be multiplied with sum
of each weight multiplied with pixel values to give final destination
pixel value. By default @var{scale} is auto scaled to sum of weights.
@item duration
Specify how end of stream is determined.
@table @samp
...
...
@@ -15574,6 +15579,11 @@ The number of successive frames to mix. If unspecified, it defaults to 3.
@item weights
Specify weight of each input video frame.
Each weight is separated by space.
@item scale
Specify scale, if it is set it will be multiplied with sum
of each weight multiplied with pixel values to give final destination
pixel value. By default @var{scale} is auto scaled to sum of weights.
@end table
@section tonemap
...
...
libavfilter/vf_mix.c
View file @
a5172dca
...
...
@@ -37,6 +37,7 @@ typedef struct MixContext {
int
nb_inputs
;
int
duration
;
float
*
weights
;
float
scale
;
float
wfactor
;
int
tmix
;
...
...
@@ -109,7 +110,11 @@ static av_cold int init(AVFilterContext *ctx)
sscanf
(
arg
,
"%f"
,
&
s
->
weights
[
i
]);
s
->
wfactor
+=
s
->
weights
[
i
];
}
s
->
wfactor
=
1
/
s
->
wfactor
;
if
(
s
->
scale
==
0
)
{
s
->
wfactor
=
1
/
s
->
wfactor
;
}
else
{
s
->
wfactor
=
s
->
scale
;
}
return
0
;
}
...
...
@@ -275,6 +280,7 @@ static int activate(AVFilterContext *ctx)
static
const
AVOption
mix_options
[]
=
{
{
"inputs"
,
"set number of inputs"
,
OFFSET
(
nb_inputs
),
AV_OPT_TYPE_INT
,
{.
i64
=
2
},
2
,
INT_MAX
,
.
flags
=
FLAGS
},
{
"weights"
,
"set weight for each input"
,
OFFSET
(
weights_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"1 1"
},
0
,
0
,
.
flags
=
FLAGS
},
{
"scale"
,
"set scale"
,
OFFSET
(
scale
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
},
0
,
INT16_MAX
,
.
flags
=
FLAGS
},
{
"duration"
,
"how to determine end of stream"
,
OFFSET
(
duration
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
2
,
.
flags
=
FLAGS
,
"duration"
},
{
"longest"
,
"Duration of longest input"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
FLAGS
,
"duration"
},
{
"shortest"
,
"Duration of shortest input"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"duration"
},
...
...
@@ -340,6 +346,7 @@ static int tmix_filter_frame(AVFilterLink *inlink, AVFrame *in)
static
const
AVOption
tmix_options
[]
=
{
{
"frames"
,
"set number of successive frames to mix"
,
OFFSET
(
nb_inputs
),
AV_OPT_TYPE_INT
,
{.
i64
=
3
},
2
,
128
,
.
flags
=
FLAGS
},
{
"weights"
,
"set weight for each frame"
,
OFFSET
(
weights_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"1 1 1"
},
0
,
0
,
.
flags
=
FLAGS
},
{
"scale"
,
"set scale"
,
OFFSET
(
scale
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
},
0
,
INT16_MAX
,
.
flags
=
FLAGS
},
{
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