[FFmpeg-devel] [PATCH 2/2] lavfi/setpts: introduce rand() function in expression

Stefano Sabatini stefasab at gmail.com
Thu Dec 28 20:49:18 EET 2023


On date Thursday 2023-12-28 16:00:57 +0100, Stefano Sabatini wrote:
> On date Thursday 2023-12-28 12:02:59 +0100, Andreas Rheinhardt wrote:
> > Stefano Sabatini:
> > > This is useful to simulate random jitter.
> > > ---
> > >  Changelog            |  1 +
> > >  doc/filters.texi     | 10 +++++++++-
> > >  libavfilter/setpts.c | 39 +++++++++++++++++++++++++++++++++------
> > >  3 files changed, 43 insertions(+), 7 deletions(-)
[...]
> > Why is this added here and not in lavu/eval so that it is available with
> > all expressions?
> 
> There is no specific reason. Sometimes you need to have a control over
> the seed, in this case you need to provide the PRNG context.
> 
> For the general case, probably we can place a global LFG in the eval
> module and fetch its generated values.

Another possible solution in attachment, leveraging the same affine
PRNG used in random(). For other use cases you might need to use a
high-quality PRNG and this might not be good enough.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavu-eval-add-randomi-function-to-compute-random-val.patch
Type: text/x-diff
Size: 2680 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20231228/eb7d369c/attachment.patch>


More information about the ffmpeg-devel mailing list