From: Michael Niedermayer Date: Sat, 16 Feb 2013 07:48:45 +0000 (+0100) Subject: Merge commit 'ccd70d9c1689990e5aef2de383199bbc7cf60d13' X-Git-Tag: n1.3-dev~422 X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff_plain/fab8a89abeae6bab5d2556d0116ca270ff6da5ed Merge commit 'ccd70d9c1689990e5aef2de383199bbc7cf60d13' * commit 'ccd70d9c1689990e5aef2de383199bbc7cf60d13': vf_yadif: factorize initializing the filtering callbacks Conflicts: libavfilter/vf_yadif.c Merged-by: Michael Niedermayer --- fab8a89abeae6bab5d2556d0116ca270ff6da5ed diff --cc libavfilter/vf_yadif.c index f43a0d4,2808540..9ac1f3e --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@@ -386,46 -365,40 +381,49 @@@ static int query_formats(AVFilterContex static av_cold int init(AVFilterContext *ctx, const char *args) { YADIFContext *yadif = ctx->priv; + static const char *shorthand[] = { "mode", "parity", "deint", NULL }; + int ret; - yadif->csp = NULL; - - yadif->mode = 0; - yadif->parity = -1; - yadif->auto_enable = 0; + yadif->class = &yadif_class; + av_opt_set_defaults(yadif); - if (args) - sscanf(args, "%d:%d:%d", - &yadif->mode, &yadif->parity, &yadif->auto_enable); + if ((ret = av_opt_set_from_string(yadif, args, shorthand, "=", ":")) < 0) + return ret; - 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); + av_log(ctx, AV_LOG_VERBOSE, "mode:%d parity:%d deint:%d\n", + yadif->mode, yadif->parity, yadif->deint); return 0; } static int config_props(AVFilterLink *link) { + AVFilterContext *ctx = link->src; - YADIFContext *yadif = ctx->priv; + 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; - if(yadif->mode&1) ++ if(s->mode&1) + link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1}); + + if (link->w < 3 || link->h < 3) { + av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines is not supported\n"); + return AVERROR(EINVAL); + } + + 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; }