[FFmpeg-devel] [PATCH] lavfi/volume: add dynamic expression evaluation
Stefano Sabatini
stefasab at gmail.com
Tue Mar 5 22:51:33 CET 2013
On date Tuesday 2013-03-05 18:10:45 +0100, Stefano Sabatini encoded:
> On date Tuesday 2013-03-05 16:08:54 +0100, Nicolas George encoded:
> > Le quartidi 14 ventôse, an CCXXI, Stefano Sabatini a écrit :
> > > That's a solution (or add a filter variant). The other solution would
> > > be to make the filter behaves in a different way if the expression is
> > > constant (CONST OP CONST is detected as constant), which would need
> > > some hack to the eval code (of course this can't detect things like
> > > EXPR-EXPR).
> >
> > Detecting what variables / functions are used in the expression is not
> > impossible at all, and it would allow to know whether the expression is
> > constant or not even in complex cases.
> >
> > > Please tell what you prefer (and feel free to pick the patch and
> > > improve it yourself if you're in hurry).
> >
> > Could you make a quick benchmark, using a small frame size (asetnsamples=16
> > for example): that would greatly help knowing whether it is worth optimizing
> > that or not.
>
> I'm trying to implement av_expr_is_const() (and trying to clean up
> eval code a bit at the same time).
And here there is a problem. In case I have something like this:
foo(100);
assuming the function is constant (and there is no way to know in case
it is an user function), then the evaluation is obviously constant.
OTOH if we have:
foo(W+X)
we don't know which parameters we assume are going to change (which
really depends on the implementation, if the parameters are reset
after one evaluation and the next one).
So av_expr_is_const() doesn't seem like a viable choice (unless I'm
missing something), because it helps only in a few trivial cases,
when no custom functions and no variables are used in the expression.
In this specific case the best solutions seem to implement a mode
which forces re-evaluation for each frame.
--
FFmpeg = Forgiving & Furious Minimal Philosofic Elegant Gem
More information about the ffmpeg-devel
mailing list