mirror of https://github.com/mpv-player/mpv
vf_yadif: switch to option parser, allow disabling by default
Use the option parser instead of sscanf. Remove the parameter changing the field dominance (it has been marked deprecated for ages). Add a new suboption "enabled", which can be used to disable the filter by default, until it's enabled at runtime: mpv -vf yadif=enabled=no
This commit is contained in:
parent
5374e26f9e
commit
2e1063d781
|
@ -601,7 +601,7 @@ phase[=t|b|p|a|u|T|B|A|U][:v]
|
|||
average squared difference between fields for t, b, and p
|
||||
alternatives.
|
||||
|
||||
yadif=[mode[:field_dominance]]
|
||||
yadif=[mode[:enabled=yes|no]]
|
||||
Yet another deinterlacing filter
|
||||
|
||||
<mode>
|
||||
|
@ -610,11 +610,10 @@ yadif=[mode[:field_dominance]]
|
|||
:2: Like 0 but skips spatial interlacing check.
|
||||
:3: Like 1 but skips spatial interlacing check.
|
||||
|
||||
<field_dominance> (DEPRECATED)
|
||||
Operates like tfields.
|
||||
|
||||
*NOTE*: This option will possibly be removed in a future version. Use
|
||||
``--field-dominance`` instead.
|
||||
<enabled>
|
||||
:yes: Filter is active (default).
|
||||
:no: Filter is not active, but can be deactivated with the ``D`` key
|
||||
(or any other key that toggles the ``deinterlace`` property).
|
||||
|
||||
down3dright[=lines]
|
||||
Reposition and resize stereoscopic images. Extracts both stereo fields and
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "config.h"
|
||||
#include "core/cpudetect.h"
|
||||
#include "core/options.h"
|
||||
#include "core/m_struct.h"
|
||||
|
||||
#include "core/mp_msg.h"
|
||||
#include "video/img_format.h"
|
||||
|
@ -50,6 +51,10 @@ struct vf_priv_s {
|
|||
int do_deinterlace;
|
||||
};
|
||||
|
||||
static const struct vf_priv_s vf_priv_default = {
|
||||
.do_deinterlace = 1,
|
||||
};
|
||||
|
||||
static void (*filter_line)(struct vf_priv_s *p, uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int refs, int parity);
|
||||
|
||||
static void store_ref(struct vf_priv_s *p, uint8_t *src[3], int src_stride[3], int width, int height){
|
||||
|
@ -470,8 +475,6 @@ static void uninit(struct vf_instance *vf){
|
|||
if(*p) free(*p - 3*vf->priv->stride[i/3]);
|
||||
*p= NULL;
|
||||
}
|
||||
free(vf->priv);
|
||||
vf->priv=NULL;
|
||||
}
|
||||
|
||||
//===========================================================================//
|
||||
|
@ -501,13 +504,9 @@ static int vf_open(vf_instance_t *vf, char *args){
|
|||
vf->filter_ext=filter_image;
|
||||
vf->query_format=query_format;
|
||||
vf->uninit=uninit;
|
||||
vf->priv=malloc(sizeof(struct vf_priv_s));
|
||||
vf->control=control;
|
||||
memset(vf->priv, 0, sizeof(struct vf_priv_s));
|
||||
|
||||
vf->priv->mode=0;
|
||||
vf->priv->parity= -1;
|
||||
vf->priv->do_deinterlace=1;
|
||||
|
||||
if (args) sscanf(args, "%d:%d", &vf->priv->mode, &vf->priv->parity);
|
||||
|
||||
|
@ -519,11 +518,26 @@ static int vf_open(vf_instance_t *vf, char *args){
|
|||
return 1;
|
||||
}
|
||||
|
||||
#undef ST_OFF
|
||||
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
|
||||
static const m_option_t vf_opts_fields[] = {
|
||||
{"mode", ST_OFF(mode), CONF_TYPE_INT, M_OPT_RANGE, 0, 3},
|
||||
{"enabled", ST_OFF(do_deinterlace), CONF_TYPE_FLAG, 0, 0, 1},
|
||||
{0}
|
||||
};
|
||||
|
||||
static const m_struct_t vf_opts = {
|
||||
"yadif",
|
||||
sizeof(struct vf_priv_s),
|
||||
&vf_priv_default,
|
||||
vf_opts_fields
|
||||
};
|
||||
|
||||
const vf_info_t vf_info_yadif = {
|
||||
"Yet Another DeInterlacing Filter",
|
||||
"yadif",
|
||||
"Michael Niedermayer",
|
||||
"",
|
||||
vf_open,
|
||||
NULL
|
||||
&vf_opts
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue