diff options
author | Clément Bœsch <ubitux@gmail.com> | 2013-05-30 20:13:04 +0400 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2013-05-30 20:13:04 +0400 |
commit | 4a85390d29b614bd5eb5fa3dde1756cf6b5c21b4 (patch) | |
tree | 51dc4a913622e7610c00b31a1f5d3bad582cdfba /libavfilter/vf_vignette.c | |
parent | 0ab9362fcb77c2d442fa20afcc2f1d9151228f06 (diff) |
lavfi/vignette: make sure a sane sar is set.
Diffstat (limited to 'libavfilter/vf_vignette.c')
-rw-r--r-- | libavfilter/vf_vignette.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavfilter/vf_vignette.c b/libavfilter/vf_vignette.c index 892d70c1b3..17af5145cd 100644 --- a/libavfilter/vf_vignette.c +++ b/libavfilter/vf_vignette.c @@ -269,6 +269,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int config_props(AVFilterLink *inlink) { VignetteContext *s = inlink->dst->priv; + AVRational sar = inlink->sample_aspect_ratio; s->desc = av_pix_fmt_desc_get(inlink->format); s->var_values[VAR_W] = inlink->w; @@ -277,12 +278,14 @@ static int config_props(AVFilterLink *inlink) s->var_values[VAR_R] = inlink->frame_rate.num == 0 || inlink->frame_rate.den == 0 ? NAN : av_q2d(inlink->frame_rate); - if (inlink->sample_aspect_ratio.num > inlink->sample_aspect_ratio.den) { - s->xscale = av_q2d(inlink->sample_aspect_ratio); + if (!sar.num || !sar.den) + sar.num = sar.den = 1; + if (sar.num > sar.den) { + s->xscale = av_q2d(sar); s->yscale = 1; s->dmax = hypot(inlink->w / 2., s->yscale * inlink->h / 2.); } else { - s->yscale = av_q2d(inlink->sample_aspect_ratio); + s->yscale = av_q2d(sar); s->xscale = 1; s->dmax = hypot(s->xscale * inlink->w / 2., inlink->h / 2.); } |