vf_yadif: change options, reroute to vf_lavfi

Also remove the ability to disable deinterlacing at runtime. You can
still disable deinterlacing at runtime by using the ``D`` key and its
automatical filter insertion/removal.
This commit is contained in:
wm4 2013-12-03 22:21:24 +01:00
parent 25635a62c3
commit 86ba9a7f24
3 changed files with 39 additions and 30 deletions

View File

@ -682,26 +682,29 @@ Available filters are:
Yet another deinterlacing filter Yet another deinterlacing filter
``<mode>`` ``<mode>``
:0: Output 1 frame for each frame. :frame: Output 1 frame for each frame.
:1: Output 1 frame for each field. :field: Output 1 frame for each field.
:2: Like 0 but skips spatial interlacing check. :frame-nospatial: Like ``frame`` but skips spatial interlacing check.
:3: Like 1 but skips spatial interlacing check. :field-nospatial: Like ``field`` but skips spatial interlacing check.
``<enabled>`` ``<enabled>``
:yes: Filter is active (default). :yes: Filter is active (default).
:no: Filter is not active, but can be activated with the ``D`` key :no: Filter is not active, but can be activated with the ``D`` key
(or any other key that toggles the ``deinterlace`` property). (or any other key that toggles the ``deinterlace`` property).
.. note:: This filter, is automatically inserted when using the ``D`` key (or any
other key that toggles the ``deinterlace`` property or when using the
Deprecated. Use libavfilter's ``yadif`` filter through ``--vf=lavfi`` ``--deinterlace`` switch), assuming the video output does not have native
instead.
This filter, or libavfilter's implementation if available, is automatically
inserted when using the ``D`` key (or any other key that toggles the
``deinterlace`` property), assuming the video output does not have native
deinterlacing support. deinterlacing support.
If you just want to set the default mode, put this filter and its options
into ``--vf-defaults`` instead, and enable deinterlacing with ``D`` or
``--deinterlace``.
Also note that the ``D`` key is stupid enough to insert an interlacer twice
when inserting yadif with ``--vf``, so using the above methods is
recommended.
``down3dright[=lines]`` ``down3dright[=lines]``
Reposition and resize stereoscopic images. Extracts both stereo fields and Reposition and resize stereoscopic images. Extracts both stereo fields and
places them side by side, resizing them to maintain the original movie places them side by side, resizing them to maintain the original movie

View File

@ -1165,9 +1165,6 @@ static int mp_property_fullscreen(m_option_t *prop,
#define VF_DEINTERLACE_LABEL "deinterlace" #define VF_DEINTERLACE_LABEL "deinterlace"
static const char *deint_filters[] = { static const char *deint_filters[] = {
#if HAVE_VF_LAVFI
"lavfi=yadif",
#endif
"yadif", "yadif",
#if HAVE_VAAPI_VPP #if HAVE_VAAPI_VPP
"vavpp", "vavpp",

View File

@ -35,6 +35,8 @@
#include "video/memcpy_pic.h" #include "video/memcpy_pic.h"
#include "libavutil/common.h" #include "libavutil/common.h"
#include "vf_lavfi.h"
//===========================================================================// //===========================================================================//
struct vf_priv_s { struct vf_priv_s {
@ -48,6 +50,8 @@ struct vf_priv_s {
int stride[3]; int stride[3];
uint8_t *ref[4][3]; uint8_t *ref[4][3];
int do_deinterlace; int do_deinterlace;
// for when using the lavfi wrapper
struct vf_lw_opts *lw_opts;
}; };
static const struct vf_priv_s vf_priv_default = { static const struct vf_priv_s vf_priv_default = {
@ -486,25 +490,25 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){
return 0; return 0;
} }
static int control(struct vf_instance *vf, int request, void* data){
switch (request){
case VFCTRL_GET_DEINTERLACE:
*(int*)data = vf->priv->do_deinterlace;
return CONTROL_OK;
case VFCTRL_SET_DEINTERLACE:
vf->priv->do_deinterlace = 2*!!*(int*)data;
return CONTROL_OK;
}
return vf_next_control (vf, request, data);
}
static int vf_open(vf_instance_t *vf, char *args){ static int vf_open(vf_instance_t *vf, char *args){
vf->config=config; vf->config=config;
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->control=control;
struct vf_priv_s *p = vf->priv;
// Earlier libavfilter yadif versions used pure integers for the first
// option. We can't/don't handle this, but at least allow usage of the
// filter with default settings. So use an empty string for "send_frame".
const char *mode[] = {"", "send_field", "send_frame_nospatial",
"send_field_nospatial"};
if (vf_lw_set_graph(vf, p->lw_opts, "yadif", "%s", mode[p->mode]) >= 0)
{
return 1;
}
vf->priv->parity= -1; vf->priv->parity= -1;
@ -518,8 +522,13 @@ static int vf_open(vf_instance_t *vf, char *args){
#define OPT_BASE_STRUCT struct vf_priv_s #define OPT_BASE_STRUCT struct vf_priv_s
static const m_option_t vf_opts_fields[] = { static const m_option_t vf_opts_fields[] = {
OPT_INTRANGE("mode", mode, 0, 0, 3), OPT_CHOICE("mode", mode, 0,
OPT_INTRANGE("enabled", do_deinterlace, 0, 0, 1), ({"frame", 0},
{"field", 1},
{"frame-nospatial", 2},
{"field-nospatial", 3})),
OPT_FLAG("enabled", do_deinterlace, 0),
OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0),
{0} {0}
}; };