Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2013-05-30 22:27:55 +0400
committerClément Bœsch <ubitux@gmail.com>2013-05-30 22:51:12 +0400
commit2886e8065e635141db1df0a5236c2551573babaa (patch)
tree3e2e9289e4ce98cfef82d28f8af0ce5d84fb2b93 /libavfilter/vf_vignette.c
parent33620e243fb6139f16c0772ea3d5c2d3148cba6c (diff)
lavfi/vignette: add aspect option.
Diffstat (limited to 'libavfilter/vf_vignette.c')
-rw-r--r--libavfilter/vf_vignette.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavfilter/vf_vignette.c b/libavfilter/vf_vignette.c
index f3af68d802..568ecc531c 100644
--- a/libavfilter/vf_vignette.c
+++ b/libavfilter/vf_vignette.c
@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <float.h> /* DBL_MAX */
+
#include "libavutil/opt.h"
#include "libavutil/eval.h"
#include "libavutil/avassert.h"
@@ -65,6 +67,8 @@ typedef struct {
float xscale, yscale;
uint32_t dither;
int do_dither;
+ AVRational aspect;
+ AVRational scale;
} VignetteContext;
#define OFFSET(x) offsetof(VignetteContext, x)
@@ -81,6 +85,7 @@ static const AVOption vignette_options[] = {
{ "init", "eval expressions once during initialization", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT}, .flags = FLAGS, .unit = "eval" },
{ "frame", "eval expressions for each frame", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" },
{ "dither", "set dithering", OFFSET(do_dither), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, FLAGS },
+ { "aspect", "set aspect ratio", OFFSET(aspect), AV_OPT_TYPE_RATIONAL, {.dbl = 1}, 0, DBL_MAX, .flags = FLAGS },
{ NULL }
};
@@ -281,10 +286,10 @@ static int config_props(AVFilterLink *inlink)
if (!sar.num || !sar.den)
sar.num = sar.den = 1;
if (sar.num > sar.den) {
- s->xscale = av_q2d(sar);
+ s->xscale = av_q2d(av_div_q(sar, s->aspect));
s->yscale = 1;
} else {
- s->yscale = av_q2d(av_inv_q(sar));
+ s->yscale = av_q2d(av_div_q(s->aspect, sar));
s->xscale = 1;
}
s->dmax = hypot(inlink->w / 2., inlink->h / 2.);