summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-03 22:24:49 +0100
committerwm4 <wm4@nowhere>2013-12-04 00:07:39 +0100
commit7d04327e7158d42ff62bc8b607d2832bb0b73d08 (patch)
tree986995e68c398bc02f8884684a15d710e0689534 /video
parent5064ef87c3efbcd6bb04d835f6950172a457a473 (diff)
downloadmpv-7d04327e7158d42ff62bc8b607d2832bb0b73d08.tar.bz2
mpv-7d04327e7158d42ff62bc8b607d2832bb0b73d08.tar.xz
vf_gradfun: reroute to vf_lavfi
Also update the manpage. We changed defaults and added a suboption quite some time ago, and we forgot to update the manpage at all.
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_gradfun.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/video/filter/vf_gradfun.c b/video/filter/vf_gradfun.c
index f7b39fa999..28916e7871 100644
--- a/video/filter/vf_gradfun.c
+++ b/video/filter/vf_gradfun.c
@@ -45,6 +45,8 @@
#include "mpvcore/m_option.h"
+#include "vf_lavfi.h"
+
struct vf_priv_s {
float cfg_thresh;
int cfg_radius;
@@ -56,6 +58,7 @@ struct vf_priv_s {
int width, int thresh, const uint16_t *dithers);
void (*blur_line)(uint16_t *dc, uint16_t *buf, uint16_t *buf1,
uint8_t *src, int sstride, int width);
+ struct vf_lw_opts *lw_opts;
} const vf_priv_dflt = {
.cfg_thresh = 1.5,
.cfg_radius = -1,
@@ -353,6 +356,18 @@ static void uninit(struct vf_instance *vf)
av_free(vf->priv->buf);
}
+static void lavfi_recreate(struct vf_instance *vf)
+{
+ struct vf_priv_s *p = vf_lw_old_priv(vf);
+ int w = vf->fmt_in.params.w;
+ int h = vf->fmt_in.params.h;
+ p->radius = p->cfg_radius;
+ if (p->cfg_size > -1)
+ p->radius = (p->cfg_size / 100.0f) * sqrtf(w * w + h * h);
+ p->radius = av_clip((p->radius+1)&~1, 4, 32);
+ vf_lw_update_graph(vf, "gradfun", "%f:%d", p->cfg_thresh, p->radius);
+}
+
static int vf_open(vf_instance_t *vf, char *args)
{
vf->filter=filter;
@@ -372,6 +387,13 @@ static int vf_open(vf_instance_t *vf, char *args)
if (!have_radius && !have_size)
vf->priv->cfg_size = 1.0;
+ if (vf_lw_set_graph(vf, vf->priv->lw_opts, "gradfun", "%f:4",
+ vf->priv->cfg_thresh) >= 0)
+ {
+ vf_lw_set_recreate_cb(vf, lavfi_recreate);
+ return 1;
+ }
+
vf->priv->thresh = (1<<15)/av_clipf(vf->priv->cfg_thresh,0.51,255);
vf->priv->blur_line = blur_line_c;
@@ -397,6 +419,7 @@ static const m_option_t vf_opts_fields[] = {
OPT_FLOATRANGE("strength", cfg_thresh, 0, 0.51, 255),
OPT_INTRANGE("radius", cfg_radius, 0, 4, 32),
OPT_FLOATRANGE("size", cfg_size, 0, 0.1, 5.0),
+ OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0),
{0}
};