avfilter/colorize: add speed option
This commit is contained in:
parent
e757726e89
commit
2d76984390
|
@ -29,6 +29,7 @@ typedef struct ColorizeContext {
|
||||||
float saturation;
|
float saturation;
|
||||||
float lightness;
|
float lightness;
|
||||||
float mix;
|
float mix;
|
||||||
|
float speed;
|
||||||
|
|
||||||
int depth;
|
int depth;
|
||||||
int c[3];
|
int c[3];
|
||||||
|
@ -205,6 +206,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||||
ff_filter_execute(ctx, do_slice, frame, NULL,
|
ff_filter_execute(ctx, do_slice, frame, NULL,
|
||||||
FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx)));
|
FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx)));
|
||||||
|
|
||||||
|
s->hue += s->speed;
|
||||||
|
if (s->hue < 0.f) {
|
||||||
|
s->hue += 360.f;
|
||||||
|
} else if(s->hue > 360.f) {
|
||||||
|
s->hue -= 360.f;
|
||||||
|
}
|
||||||
|
|
||||||
return ff_filter_frame(ctx->outputs[0], frame);
|
return ff_filter_frame(ctx->outputs[0], frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,6 +275,7 @@ static const AVOption colorize_options[] = {
|
||||||
{ "saturation", "set the saturation", OFFSET(saturation), AV_OPT_TYPE_FLOAT, {.dbl=0.5},0, 1, VF },
|
{ "saturation", "set the saturation", OFFSET(saturation), AV_OPT_TYPE_FLOAT, {.dbl=0.5},0, 1, VF },
|
||||||
{ "lightness", "set the lightness", OFFSET(lightness), AV_OPT_TYPE_FLOAT, {.dbl=0.5},0, 1, VF },
|
{ "lightness", "set the lightness", OFFSET(lightness), AV_OPT_TYPE_FLOAT, {.dbl=0.5},0, 1, VF },
|
||||||
{ "mix", "set the mix of source lightness", OFFSET(mix), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, VF },
|
{ "mix", "set the mix of source lightness", OFFSET(mix), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, VF },
|
||||||
|
{ "speed", "set the change of hue per frame", OFFSET(speed), AV_OPT_TYPE_FLOAT, {.dbl=0}, -180, 180, VF },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user