summaryrefslogtreecommitdiff
path: root/libavfilter/vf_yadif.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-02-09 08:28:37 +0100
committerAnton Khirnov <anton@khirnov.net>2013-02-15 16:08:00 +0100
commitccd70d9c1689990e5aef2de383199bbc7cf60d13 (patch)
tree03a9ac6fea67f4fd8afb8ddcd6572ceaf3936021 /libavfilter/vf_yadif.c
parent3594554a064d76e3514fab9781c0e63ea9e08ea9 (diff)
vf_yadif: factorize initializing the filtering callbacks
Do it all in config_props().
Diffstat (limited to 'libavfilter/vf_yadif.c')
-rw-r--r--libavfilter/vf_yadif.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index ae49013a70..280854093e 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -194,11 +194,6 @@ static int return_frame(AVFilterContext *ctx, int is_second)
yadif->out->video->interlaced = 0;
}
- if (!yadif->csp)
- yadif->csp = av_pix_fmt_desc_get(link->format);
- if (yadif->csp->comp[0].depth_minus1 / 8 == 1)
- yadif->filter_line = filter_line_c_16bit;
-
filter(ctx, yadif->out, tff ^ !is_second, tff);
if (is_second) {
@@ -374,17 +369,11 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
yadif->mode = 0;
yadif->parity = -1;
yadif->auto_enable = 0;
- yadif->csp = NULL;
if (args)
sscanf(args, "%d:%d:%d",
&yadif->mode, &yadif->parity, &yadif->auto_enable);
- yadif->filter_line = filter_line_c;
-
- if (ARCH_X86)
- ff_yadif_init_x86(yadif);
-
av_log(ctx, AV_LOG_VERBOSE, "mode:%d parity:%d auto_enable:%d\n",
yadif->mode, yadif->parity, yadif->auto_enable);
@@ -393,11 +382,23 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
static int config_props(AVFilterLink *link)
{
+ YADIFContext *s = link->src->priv;
+
link->time_base.num = link->src->inputs[0]->time_base.num;
link->time_base.den = link->src->inputs[0]->time_base.den * 2;
link->w = link->src->inputs[0]->w;
link->h = link->src->inputs[0]->h;
+ s->csp = av_pix_fmt_desc_get(link->format);
+ if (s->csp->comp[0].depth_minus1 / 8 == 1) {
+ s->filter_line = filter_line_c_16bit;
+ } else {
+ s->filter_line = filter_line_c;
+
+ if (ARCH_X86)
+ ff_yadif_init_x86(s);
+ }
+
return 0;
}