... | ... |
@@ -7005,6 +7005,13 @@ Default value is @samp{init}. |
7005 | 7005 |
@item dither |
7006 | 7006 |
Set dithering to reduce the circular banding effects. Default is @code{1} |
7007 | 7007 |
(enabled). |
7008 |
+ |
|
7009 |
+@item aspect |
|
7010 |
+Set vignette aspect. This setting allows to adjust the shape of the vignette. |
|
7011 |
+Setting this value to the SAR of the input will make a rectangular vignetting |
|
7012 |
+following the dimensions of the video. |
|
7013 |
+ |
|
7014 |
+Default is @code{1/1}. |
|
7008 | 7015 |
@end table |
7009 | 7016 |
|
7010 | 7017 |
@subsection Expressions |
... | ... |
@@ -18,6 +18,8 @@ |
18 | 18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 | 19 |
*/ |
20 | 20 |
|
21 |
+#include <float.h> /* DBL_MAX */ |
|
22 |
+ |
|
21 | 23 |
#include "libavutil/opt.h" |
22 | 24 |
#include "libavutil/eval.h" |
23 | 25 |
#include "libavutil/avassert.h" |
... | ... |
@@ -65,6 +67,8 @@ typedef struct { |
65 | 65 |
float xscale, yscale; |
66 | 66 |
uint32_t dither; |
67 | 67 |
int do_dither; |
68 |
+ AVRational aspect; |
|
69 |
+ AVRational scale; |
|
68 | 70 |
} VignetteContext; |
69 | 71 |
|
70 | 72 |
#define OFFSET(x) offsetof(VignetteContext, x) |
... | ... |
@@ -81,6 +85,7 @@ static const AVOption vignette_options[] = { |
81 | 81 |
{ "init", "eval expressions once during initialization", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT}, .flags = FLAGS, .unit = "eval" }, |
82 | 82 |
{ "frame", "eval expressions for each frame", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" }, |
83 | 83 |
{ "dither", "set dithering", OFFSET(do_dither), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, FLAGS }, |
84 |
+ { "aspect", "set aspect ratio", OFFSET(aspect), AV_OPT_TYPE_RATIONAL, {.dbl = 1}, 0, DBL_MAX, .flags = FLAGS }, |
|
84 | 85 |
{ NULL } |
85 | 86 |
}; |
86 | 87 |
|
... | ... |
@@ -281,10 +286,10 @@ static int config_props(AVFilterLink *inlink) |
281 | 281 |
if (!sar.num || !sar.den) |
282 | 282 |
sar.num = sar.den = 1; |
283 | 283 |
if (sar.num > sar.den) { |
284 |
- s->xscale = av_q2d(sar); |
|
284 |
+ s->xscale = av_q2d(av_div_q(sar, s->aspect)); |
|
285 | 285 |
s->yscale = 1; |
286 | 286 |
} else { |
287 |
- s->yscale = av_q2d(av_inv_q(sar)); |
|
287 |
+ s->yscale = av_q2d(av_div_q(s->aspect, sar)); |
|
288 | 288 |
s->xscale = 1; |
289 | 289 |
} |
290 | 290 |
s->dmax = hypot(inlink->w / 2., inlink->h / 2.); |