[FFmpeg-devel] [PATCHv2 1/3] avutil/eval: separate AVExpr state to a new AVExprState struct

Marton Balint cus at passwd.hu
Fri Jan 10 19:42:03 EET 2020



On Fri, 10 Jan 2020, Anton Khirnov wrote:

> Quoting Marton Balint (2019-12-30 23:23:40)
>> Also add helper functions to allocate and free such a struct, and make it
>> usable by providing a new av_eval_expr2 function for which you can specify a
>> custom AVExprState.
>
> Why not just parse the expression multiple times? Performance?

For fixing the vf_geq issue in the second patch, yes parsing the 
expression multiple times should work, parsing MAX_THREADS * 4 expressions 
is totally OK.

However API-wise, it is cleaner to separate state from the expression, I 
find it totally unintuitive that an expression has a state or that 
evaluating an expression is not thread safe.

> Beyond that, it seems to me that the user now has to juggle multiple
> contexts manually, which is complex and can be avoided.

It is only a possibility, most users can use av_eval_expr as before and 
use the internal state of the expression.

> How about introducing a function for duplicating AVExpr instead? Would 
> that not solve this as well?

I don't really like this idea, you want to duplicate the state, 
not the expression.

Regards,
Marton


More information about the ffmpeg-devel mailing list