1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-04-02 20:35:37 +02:00

Merge commit 'ccd70d9c1689990e5aef2de383199bbc7cf60d13'

* commit 'ccd70d9c1689990e5aef2de383199bbc7cf60d13':
  vf_yadif: factorize initializing the filtering callbacks

Conflicts:
	libavfilter/vf_yadif.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-02-16 08:48:45 +01:00
commit fab8a89abe

View File

@ -198,11 +198,6 @@ static int return_frame(AVFilterContext *ctx, int is_second)
yadif->out->video->interlaced = 0; 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); filter(ctx, yadif->out, tff ^ !is_second, tff);
if (is_second) { if (is_second) {
@ -389,19 +384,12 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
static const char *shorthand[] = { "mode", "parity", "deint", NULL }; static const char *shorthand[] = { "mode", "parity", "deint", NULL };
int ret; int ret;
yadif->csp = NULL;
yadif->class = &yadif_class; yadif->class = &yadif_class;
av_opt_set_defaults(yadif); av_opt_set_defaults(yadif);
if ((ret = av_opt_set_from_string(yadif, args, shorthand, "=", ":")) < 0) if ((ret = av_opt_set_from_string(yadif, args, shorthand, "=", ":")) < 0)
return ret; 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 deint:%d\n", av_log(ctx, AV_LOG_VERBOSE, "mode:%d parity:%d deint:%d\n",
yadif->mode, yadif->parity, yadif->deint); yadif->mode, yadif->parity, yadif->deint);
@ -411,14 +399,14 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
static int config_props(AVFilterLink *link) static int config_props(AVFilterLink *link)
{ {
AVFilterContext *ctx = link->src; 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.num = link->src->inputs[0]->time_base.num;
link->time_base.den = link->src->inputs[0]->time_base.den * 2; link->time_base.den = link->src->inputs[0]->time_base.den * 2;
link->w = link->src->inputs[0]->w; link->w = link->src->inputs[0]->w;
link->h = link->src->inputs[0]->h; 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}); link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1});
if (link->w < 3 || link->h < 3) { if (link->w < 3 || link->h < 3) {
@ -426,6 +414,16 @@ static int config_props(AVFilterLink *link)
return AVERROR(EINVAL); 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; return 0;
} }