[FFmpeg-devel] [PATCH] avutil/eval: Use better PRNG

Michael Niedermayer michael at niedermayer.cc
Thu Jan 4 05:19:43 EET 2024


On Thu, Jan 04, 2024 at 12:58:43AM +0100, Stefano Sabatini wrote:
> On date Wednesday 2024-01-03 23:24:33 +0100, Michael Niedermayer wrote:

[...]

> 
> > +typedef struct KISS64State{
> > +    uint64_t x,y,z,c;
> > +}KISS64State;
> 
> missing namespace here and in the functions below.
> 
> For this you could probably use AVKISS64PRNG (or AVKISS64), and use
> av_kiss64prng_ or av_kiss64_ as function prefix (I'd probably go with
> the shortest variant).
> 
> > +
> > +static inline uint64_t get_random64(KISS64State *s){
> 
> av_kiss64_get() ?

as its not a public API yet, ill leave the av_ out but will
switch to your names, they are nice and short



[...]
> 
> > +    //Constants based on SHA512 of "FFmpeg" and Marsaglias values so seed=0 matches his
> > +    s->x = 1234567890987654321ULL ^ seed;
> > +    s->y =( 362436362436362436ULL ^ (0xd255973df01e5086*seed)) | 4;
> > +    s->z =    1066149217761810ULL + seed;
> > +    s->c =  123456123456123456ULL -  0x33730c0524f137da*seed;
> > +}
> > +
> > +#endif /* AVUTIL_KISS__PRNGH */
> > diff --git a/tests/fate/libswresample.mak b/tests/fate/libswresample.mak
> > index 0d29f760248..ea421d45fb6 100644
> > --- a/tests/fate/libswresample.mak
> > +++ b/tests/fate/libswresample.mak
> > @@ -359,7 +359,7 @@ fate-swr-resample_nn-s16p-8000-44100: SIZE_TOLERANCE = 96000 - 20480
> >  define ARESAMPLE_ASYNC
> >  FATE_SWR_RESAMPLE += fate-swr-resample_async-$(3)-$(1)-$(2)
> >  fate-swr-resample_async-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
> > -fate-swr-resample_async-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,asetpts=PTS+random\(0\)*200-100,aresample=$(2):async=50:min_hard_comp=0.100000:first_pts=0:linear_interp=0:exact_rational=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):linear_interp=0:exact_rational=0:internal_sample_fmt=$(3) -f wav -c:a pcm_s16le -
> > +fate-swr-resample_async-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,asetpts=PTS+random\(1\)*200-100,aresample=$(2):async=50:min_hard_comp=0.100000:first_pts=0:linear_interp=0:exact_rational=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):linear_interp=0:exact_rational=0:internal_sample_fmt=$(3) -f wav -c:a pcm_s16le -
> 
> any reason to change the random() index?

yes because i forgot removing that hunk. That was not intended to be in the
patch

[....]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell
-------------- 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/20240104/5c337fcf/attachment.sig>


More information about the ffmpeg-devel mailing list