[FFmpeg-devel] [PATCH] get rid of rand() usage in libavformat/timefilter.c
Diego Biurrun
diego
Thu Apr 9 18:10:52 CEST 2009
On Mon, Mar 30, 2009 at 01:58:25PM +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().
> > >
> > > The output differs, I'm not sure if this is OK...
> >
> > could you post the diff?
> > and RAND_MAX + av_lfg() is not good
>
> unmodified (aligned for better readability):
>
> [0.800000 0.000800 0.000000] [1.021025 0.998922 0.000000] [1.021025 0.998922 0.000000] [1.021025 0.998922 0.000000]
> [0.001264 0.000002 0.019994] [0.048488 0.001118 0.039767] [0.081175 0.002607 0.059857] [0.112743 0.007936 0.096211]
> [0.001505 0.000001 0.050045] [0.024826 0.000382 0.264977] [0.043980 0.001475 0.391406] [0.064399 0.001892 0.452524]
> [0.001040 0.000002 0.464381] [0.012711 0.000210 0.879196] [0.023644 0.000493 1.418645] [0.049066 0.000790 2.186131]
> [0.001517 0.000000 0.941461] [0.003967 0.000078 2.501324] [0.010169 0.000189 4.348705] [0.024826 0.000734 4.730559]
> [0.001813 0.000013 3.654420] [0.003022 0.000062 3.557348] [0.005727 0.000125 18.313767] [0.014412 0.000256 14.544892]
>
> my version (aligned for better readability):
>
> [0.800000 0.000800 0.000000] [1.021025 0.998922 0.000000] [1.021025 0.998922 0.000000] [1.021025 0.998922 0.000000]
> [0.001063 0.000000 9.239827] [0.008825 0.000002 0.468434] [0.027876 0.000002 0.186120] [0.061885 0.000005 0.189568]
> [0.001063 0.000000 83.158444] [0.002722 0.000000 14.188897] [0.008825 0.000002 4.215902] [0.021292 0.000002 1.969699]
> [0.001063 0.000000 452.751528] [0.000780 0.000000 192.916662] [0.003279 0.000001 58.281271] [0.008825 0.000002 22.953243]
> [0.001063 0.000000 2078.961099] [0.000780 0.000000 1427.078830] [0.001010 0.000000 622.556980] [0.003674 0.000001 242.616993]
> [0.001063 0.000000 8879.473849] [0.000780 0.000000 7443.503228] [0.000995 0.000000 5070.779939] [0.001401 0.000000 2318.558951]
>
> The first line is identical, then it starts to diverge.
... ping ...
Diego
More information about the ffmpeg-devel
mailing list