mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-14 00:58:38 +02:00
avfilter/vf_waveform: add option to control strechness of waveform
This commit is contained in:
parent
e0de0aa585
commit
ca788d184c
@ -22115,6 +22115,19 @@ Set background opacity.
|
|||||||
Set tint for output.
|
Set tint for output.
|
||||||
Only used with lowpass filter and when display is not overlay and input
|
Only used with lowpass filter and when display is not overlay and input
|
||||||
pixel formats are not RGB.
|
pixel formats are not RGB.
|
||||||
|
|
||||||
|
@item fitmode, fm
|
||||||
|
Set sample aspect ratio of video output frames.
|
||||||
|
Can be used to configure waveform so it is not
|
||||||
|
streched too much in one of directions.
|
||||||
|
|
||||||
|
@table @samp
|
||||||
|
@item none
|
||||||
|
Set sample aspect ration to 1/1.
|
||||||
|
@item size
|
||||||
|
Set sample aspect ratio to match input size of video
|
||||||
|
@end table
|
||||||
|
Default is @samp{none}.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@section weave, doubleweave
|
@section weave, doubleweave
|
||||||
|
@ -36,6 +36,12 @@ typedef struct ThreadData {
|
|||||||
int offset_x;
|
int offset_x;
|
||||||
} ThreadData;
|
} ThreadData;
|
||||||
|
|
||||||
|
enum FitMode {
|
||||||
|
FM_NONE,
|
||||||
|
FM_SIZE,
|
||||||
|
NB_FITMODES
|
||||||
|
};
|
||||||
|
|
||||||
enum FilterType {
|
enum FilterType {
|
||||||
LOWPASS,
|
LOWPASS,
|
||||||
FLAT,
|
FLAT,
|
||||||
@ -113,6 +119,7 @@ typedef struct WaveformContext {
|
|||||||
int rgb;
|
int rgb;
|
||||||
float ftint[2];
|
float ftint[2];
|
||||||
int tint[2];
|
int tint[2];
|
||||||
|
int fitmode;
|
||||||
|
|
||||||
int (*waveform_slice)(AVFilterContext *ctx, void *arg,
|
int (*waveform_slice)(AVFilterContext *ctx, void *arg,
|
||||||
int jobnr, int nb_jobs);
|
int jobnr, int nb_jobs);
|
||||||
@ -184,6 +191,10 @@ static const AVOption waveform_options[] = {
|
|||||||
{ "t0", "set 1st tint", OFFSET(ftint[0]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS},
|
{ "t0", "set 1st tint", OFFSET(ftint[0]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS},
|
||||||
{ "tint1", "set 2nd tint", OFFSET(ftint[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS},
|
{ "tint1", "set 2nd tint", OFFSET(ftint[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS},
|
||||||
{ "t1", "set 2nd tint", OFFSET(ftint[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS},
|
{ "t1", "set 2nd tint", OFFSET(ftint[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS},
|
||||||
|
{ "fitmode", "set fit mode", OFFSET(fitmode), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_FITMODES-1, FLAGS, "fitmode" },
|
||||||
|
{ "fm", "set fit mode", OFFSET(fitmode), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_FITMODES-1, FLAGS, "fitmode" },
|
||||||
|
{ "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_NONE}, 0, 0, FLAGS, "fitmode" },
|
||||||
|
{ "size", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_SIZE}, 0, 0, FLAGS, "fitmode" },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3357,7 +3368,20 @@ static int config_output(AVFilterLink *outlink)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
outlink->sample_aspect_ratio = (AVRational){1,1};
|
switch (s->fitmode) {
|
||||||
|
case FM_NONE:
|
||||||
|
outlink->sample_aspect_ratio = (AVRational){ 1, 1 };
|
||||||
|
break;
|
||||||
|
case FM_SIZE:
|
||||||
|
if (s->mode)
|
||||||
|
outlink->sample_aspect_ratio = (AVRational){ s->size * comp, inlink->h };
|
||||||
|
else
|
||||||
|
outlink->sample_aspect_ratio = (AVRational){ inlink->w, s->size * comp };
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
av_reduce(&outlink->sample_aspect_ratio.num, &outlink->sample_aspect_ratio.den,
|
||||||
|
outlink->sample_aspect_ratio.num, outlink->sample_aspect_ratio.den, INT_MAX);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3461,6 +3485,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
s->graticulef(s, out);
|
s->graticulef(s, out);
|
||||||
|
|
||||||
av_frame_free(&in);
|
av_frame_free(&in);
|
||||||
|
out->sample_aspect_ratio = outlink->sample_aspect_ratio;
|
||||||
return ff_filter_frame(outlink, out);
|
return ff_filter_frame(outlink, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user