summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-03 22:30:41 +0100
committerwm4 <wm4@nowhere>2013-12-04 00:07:39 +0100
commit5b48204e84ca78f8a8b91a2e4392917668ecb12a (patch)
tree2cf704090df474a011c58bfa128583ee79b2c7dd
parentb21cb279d7aba450faa6629adbc500773ab27f58 (diff)
downloadmpv-5b48204e84ca78f8a8b91a2e4392917668ecb12a.tar.bz2
mpv-5b48204e84ca78f8a8b91a2e4392917668ecb12a.tar.xz
vf_pullup: change options, reroute to vf_lavfi
The options are probably mostly backwards compatible.
-rw-r--r--DOCS/man/en/vf.rst2
-rw-r--r--video/filter/vf_pullup.c47
2 files changed, 38 insertions, 11 deletions
diff --git a/DOCS/man/en/vf.rst b/DOCS/man/en/vf.rst
index 323eed8349..189585a6d8 100644
--- a/DOCS/man/en/vf.rst
+++ b/DOCS/man/en/vf.rst
@@ -553,7 +553,7 @@ Available filters are:
frames in the output.
``mp`` (metric plane)
- This option may be set to 1 or 2 to use a chroma plane instead of the
+ This option may be set to ``u`` or ``v`` to use a chroma plane instead of the
luma plane for doing ``pullup``'s computations. This may improve accuracy
on very clean source material, but more likely will decrease accuracy,
especially if there is chroma noise (rainbow effect) or any grayscale
diff --git a/video/filter/vf_pullup.c b/video/filter/vf_pullup.c
index e22266bd16..357d08cae3 100644
--- a/video/filter/vf_pullup.c
+++ b/video/filter/vf_pullup.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "mpvcore/mp_msg.h"
#include "mpvcore/cpudetect.h"
+#include "mpvcore/m_option.h"
#include "video/img_format.h"
#include "video/mp_image.h"
@@ -31,6 +32,7 @@
#include "video/memcpy_pic.h"
#include "pullup.h"
+#include "vf_lavfi.h"
#undef MAX
#define MAX(a,b) ((a)>(b)?(a):(b))
@@ -41,7 +43,9 @@ struct vf_priv_s {
int fakecount;
char *qbuf;
double lastpts;
- char *args;
+ int junk_left, junk_right, junk_top, junk_bottom;
+ int strict_breaks, metric_plane;
+ struct vf_lw_opts *lw_opts;
};
static void reset(struct vf_instance *vf)
@@ -55,13 +59,12 @@ static void reset(struct vf_instance *vf)
vf->priv->ctx = c = pullup_alloc_context();
vf->priv->fakecount = 1;
c->verbose = verbose>0;
- c->junk_left = c->junk_right = 1;
- c->junk_top = c->junk_bottom = 4;
- c->strict_breaks = 0;
- c->metric_plane = 0;
- if (vf->priv->args) {
- sscanf(vf->priv->args, "%d:%d:%d:%d:%d:%d", &c->junk_left, &c->junk_right, &c->junk_top, &c->junk_bottom, &c->strict_breaks, &c->metric_plane);
- }
+ c->junk_left = vf->priv->junk_left;
+ c->junk_right = vf->priv->junk_right;
+ c->junk_top = vf->priv->junk_top;
+ c->junk_bottom = vf->priv->junk_bottom;
+ c->strict_breaks = vf->priv->strict_breaks;
+ c->metric_plane = vf->priv->metric_plane;
}
static void init_pullup(struct vf_instance *vf, mp_image_t *mpi)
@@ -279,14 +282,38 @@ static int vf_open(vf_instance_t *vf, char *args)
vf->query_format = query_format;
vf->control = control;
vf->uninit = uninit;
- vf->priv = calloc(1, sizeof(struct vf_priv_s));
- vf->priv->args = talloc_strdup(vf, args);
+ struct vf_priv_s *p = vf->priv;
+ const char *pname[3] = {"y", "u", "v"};
+ if (vf_lw_set_graph(vf, p->lw_opts, "pullup", "%d:%d:%d:%d:%d:%s",
+ p->junk_left, p->junk_right, p->junk_top, p->junk_bottom,
+ p->strict_breaks, pname[p->metric_plane]) >= 0)
+ {
+ return 1;
+ }
reset(vf);
return 1;
}
+#define OPT_BASE_STRUCT struct vf_priv_s
const vf_info_t vf_info_pullup = {
.description = "pullup (from field sequence to frames)",
.name = "pullup",
.open = vf_open,
+ .priv_size = sizeof(struct vf_priv_s),
+ .priv_defaults = &(const struct vf_priv_s){
+ .junk_left = 1,
+ .junk_right = 1,
+ .junk_top = 4,
+ .junk_bottom = 4,
+ },
+ .options = (const struct m_option[]){
+ OPT_INT("jl", junk_left, 0),
+ OPT_INT("jr", junk_right, 0),
+ OPT_INT("jt", junk_top, 0),
+ OPT_INT("jb", junk_bottom, 0),
+ OPT_INT("sb", strict_breaks, 0),
+ OPT_CHOICE("mp", metric_plane, 0, ({"y", 0}, {"u", 1}, {"v", 2})),
+ OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0),
+ {0}
+ },
};