avfilter/vf_mix: make setting weights more user friendly
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
@@ -11177,7 +11177,9 @@ The number of inputs. If unspecified, it defaults to 2.
|
|||||||
|
|
||||||
@item weights
|
@item weights
|
||||||
Specify weight of each input video stream as sequence.
|
Specify weight of each input video stream as sequence.
|
||||||
Each weight is separated by space.
|
Each weight is separated by space. If number of weights
|
||||||
|
is smaller than number of @var{frames} last specified
|
||||||
|
weight will be used for all remaining unset weights.
|
||||||
|
|
||||||
@item scale
|
@item scale
|
||||||
Specify scale, if it is set it will be multiplied with sum
|
Specify scale, if it is set it will be multiplied with sum
|
||||||
@@ -15603,7 +15605,9 @@ The number of successive frames to mix. If unspecified, it defaults to 3.
|
|||||||
|
|
||||||
@item weights
|
@item weights
|
||||||
Specify weight of each input video frame.
|
Specify weight of each input video frame.
|
||||||
Each weight is separated by space.
|
Each weight is separated by space. If number of weights is smaller than
|
||||||
|
number of @var{frames} last specified weight will be used for all remaining
|
||||||
|
unset weights.
|
||||||
|
|
||||||
@item scale
|
@item scale
|
||||||
Specify scale, if it is set it will be multiplied with sum
|
Specify scale, if it is set it will be multiplied with sum
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ static av_cold int init(AVFilterContext *ctx)
|
|||||||
{
|
{
|
||||||
MixContext *s = ctx->priv;
|
MixContext *s = ctx->priv;
|
||||||
char *p, *arg, *saveptr = NULL;
|
char *p, *arg, *saveptr = NULL;
|
||||||
int i, ret;
|
int i, ret, last;
|
||||||
|
|
||||||
s->tmix = !strcmp(ctx->filter->name, "tmix");
|
s->tmix = !strcmp(ctx->filter->name, "tmix");
|
||||||
|
|
||||||
@@ -110,6 +110,11 @@ static av_cold int init(AVFilterContext *ctx)
|
|||||||
p = NULL;
|
p = NULL;
|
||||||
sscanf(arg, "%f", &s->weights[i]);
|
sscanf(arg, "%f", &s->weights[i]);
|
||||||
s->wfactor += s->weights[i];
|
s->wfactor += s->weights[i];
|
||||||
|
last = i;
|
||||||
|
}
|
||||||
|
for (; i < s->nb_inputs; i++) {
|
||||||
|
s->weights[i] = s->weights[last];
|
||||||
|
s->wfactor += s->weights[i];
|
||||||
}
|
}
|
||||||
if (s->scale == 0) {
|
if (s->scale == 0) {
|
||||||
s->wfactor = 1 / s->wfactor;
|
s->wfactor = 1 / s->wfactor;
|
||||||
|
|||||||
Reference in New Issue
Block a user