[FFmpeg-devel] [PATCH] get rid of rand() usage in libavformat/timefilter.c
Diego Biurrun
diego
Fri Apr 10 17:10:57 CEST 2009
On Fri, Apr 10, 2009 at 04:36:11PM +0200, Reimar D?ffinger wrote:
> On Fri, Apr 10, 2009 at 02:50:16PM +0200, Diego Biurrun wrote:
> > On Sun, Mar 29, 2009 at 07:17:43PM +0200, Michael Niedermayer wrote:
> > > On Sun, Mar 29, 2009 at 05:37:24PM +0200, Diego Biurrun wrote:
> > > > Here is a patch to use av_lfg* in libavformat/timefilter.c instead of
> > > > rand().
> > >
> > > RAND_MAX + av_lfg() is not good
> >
> > What is the alternative?
>
> RAND_MAX is the maximum value that rand() returns.
> The "alternative" is replacing RAND_MAX by the correct constant for
> av_lfg, which is (1ULL << 32) - 1
Attached patch implements your suggestion, however, the output of
timefilter-test changed and looks very suspicious:
[0.800000 0.000800 0.000000] [1.021025 0.998922 0.000000] [1.021025 0.998922 0.000000] [1.021025 0.998922 0.000000]
[1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000]
[1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000]
[1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000]
[1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000]
[1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000] [1.000000 0.001000 1000000000.000000]
Diego
-------------- next part --------------
A non-text attachment was scrubbed...
Name: timefilter.diff
Type: text/x-diff
Size: 863 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090410/61c71cd3/attachment.diff>
More information about the ffmpeg-devel
mailing list