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

Michael Niedermayer michael at niedermayer.cc
Thu Dec 28 23:25:08 EET 2023


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

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Never trust a computer, one day, it may think you are the virus. -- Compn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20231228/d644ff90/attachment.sig>


More information about the ffmpeg-devel mailing list