mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-24 20:20:18 +08:00
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:
+5
-6
@@ -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
|
average squared difference between fields for t, b, and p
|
||||||
alternatives.
|
alternatives.
|
||||||
|
|
||||||
yadif=[mode[:field_dominance]]
|
yadif=[mode[:enabled=yes|no]]
|
||||||
Yet another deinterlacing filter
|
Yet another deinterlacing filter
|
||||||
|
|
||||||
<mode>
|
<mode>
|
||||||
@@ -610,11 +610,10 @@ yadif=[mode[:field_dominance]]
|
|||||||
:2: Like 0 but skips spatial interlacing check.
|
:2: Like 0 but skips spatial interlacing check.
|
||||||
:3: Like 1 but skips spatial interlacing check.
|
:3: Like 1 but skips spatial interlacing check.
|
||||||
|
|
||||||
<field_dominance> (DEPRECATED)
|
<enabled>
|
||||||
Operates like tfields.
|
:yes: Filter is active (default).
|
||||||
|
:no: Filter is not active, but can be deactivated with the ``D`` key
|
||||||
*NOTE*: This option will possibly be removed in a future version. Use
|
(or any other key that toggles the ``deinterlace`` property).
|
||||||
``--field-dominance`` instead.
|
|
||||||
|
|
||||||
down3dright[=lines]
|
down3dright[=lines]
|
||||||
Reposition and resize stereoscopic images. Extracts both stereo fields and
|
Reposition and resize stereoscopic images. Extracts both stereo fields and
|
||||||
|
|||||||
+21
-7
@@ -27,6 +27,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "core/cpudetect.h"
|
#include "core/cpudetect.h"
|
||||||
#include "core/options.h"
|
#include "core/options.h"
|
||||||
|
#include "core/m_struct.h"
|
||||||
|
|
||||||
#include "core/mp_msg.h"
|
#include "core/mp_msg.h"
|
||||||
#include "video/img_format.h"
|
#include "video/img_format.h"
|
||||||
@@ -50,6 +51,10 @@ struct vf_priv_s {
|
|||||||
int do_deinterlace;
|
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 (*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){
|
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]);
|
if(*p) free(*p - 3*vf->priv->stride[i/3]);
|
||||||
*p= NULL;
|
*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->filter_ext=filter_image;
|
||||||
vf->query_format=query_format;
|
vf->query_format=query_format;
|
||||||
vf->uninit=uninit;
|
vf->uninit=uninit;
|
||||||
vf->priv=malloc(sizeof(struct vf_priv_s));
|
|
||||||
vf->control=control;
|
vf->control=control;
|
||||||
memset(vf->priv, 0, sizeof(struct vf_priv_s));
|
|
||||||
|
|
||||||
vf->priv->mode=0;
|
|
||||||
vf->priv->parity= -1;
|
vf->priv->parity= -1;
|
||||||
vf->priv->do_deinterlace=1;
|
|
||||||
|
|
||||||
if (args) sscanf(args, "%d:%d", &vf->priv->mode, &vf->priv->parity);
|
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;
|
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 = {
|
const vf_info_t vf_info_yadif = {
|
||||||
"Yet Another DeInterlacing Filter",
|
"Yet Another DeInterlacing Filter",
|
||||||
"yadif",
|
"yadif",
|
||||||
"Michael Niedermayer",
|
"Michael Niedermayer",
|
||||||
"",
|
"",
|
||||||
vf_open,
|
vf_open,
|
||||||
NULL
|
&vf_opts
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user