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

Stefano Sabatini stefasab at gmail.com
Fri Dec 29 13:51:10 EET 2023


On date Thursday 2023-12-28 22:25:08 +0100, Michael Niedermayer wrote:
> On Thu, Dec 28, 2023 at 07:49:18PM +0100, Stefano Sabatini wrote:
> > 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.
> 
> >  eval.c |   18 +++++++++++++++---
> >  1 file changed, 15 insertions(+), 3 deletions(-)
> > 94413dcc88e3046b4987715f6c152aeb1c24c703  0001-lavu-eval-add-randomi-function-to-compute-random-val.patch
> > From 4dc5213b0913a2585f75dfd03b497ca2efc093de Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefasab at gmail.com>
> > Date: Thu, 28 Dec 2023 19:09:22 +0100
> > Subject: [PATCH] lavu/eval: add randomi function to compute random value in
> >  interval
> 
> probably ok if this is usefull
> 
> thx

Will apply the edited patch in a few days if I see no comments.
-------------- 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: 4054 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20231229/6b918955/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-doc-filters-setpts-add-random-jitter-generation-exam.patch
Type: text/x-diff
Size: 717 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20231229/6b918955/attachment-0001.patch>


More information about the ffmpeg-devel mailing list