[FFmpeg-devel] [PATCH 4/4] Make the crop filter accept parametric expressions.
Michael Niedermayer
michaelni
Fri Sep 10 11:41:31 CEST 2010
On Fri, Sep 10, 2010 at 11:35:54AM +0200, Michael Niedermayer wrote:
> On Fri, Sep 10, 2010 at 09:50:14AM +0200, Stefano Sabatini wrote:
[...]
> >
> > av_log(link->dst, AV_LOG_INFO, "x:%d y:%d w:%d h:%d\n",
> > crop->x, crop->y, crop->w, crop->h);
> > @@ -110,6 +175,11 @@ static int config_input(AVFilterLink *link)
> > }
> >
> > return 0;
> > +
> > +fail_expr:
> > + av_log(NULL, AV_LOG_ERROR,
> > + "Error when evaluating the expression '%s'\n", expr);
> > + return ret;
> > }
> >
> > static int config_output(AVFilterLink *link)
>
> > @@ -131,6 +201,22 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
> > picref->video->w = crop->w;
> > picref->video->h = crop->h;
> >
> > + crop->var_values[PTS] = picref->pts;
> > + crop->var_values[POS] = picref->pos;
> > + crop->x = crop->var_values[X] = av_eval_expr(crop->x_pexpr, crop->var_values, NULL);
> > + crop->y = crop->var_values[Y] = av_eval_expr(crop->y_pexpr, crop->var_values, NULL);
>
> you must evaluate X after Y again so Y is available to X
> also i think the values should be cliped into sane integer range and maybe a
> NAN check is needed to
and you must set X/Y to NAN before the 3 evaluations
that should catch some invalid expressions refering to themselfs
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100910/ceeb4066/attachment.pgp>
More information about the ffmpeg-devel
mailing list