[FFmpeg-devel] [PATCH v2 2/2] random_seed: Improve behaviour with small timer increments with high precision timers
Michael Niedermayer
michael at niedermayer.cc
Wed Feb 12 21:45:20 EET 2025
Hi Martin
On Wed, Feb 12, 2025 at 11:25:03AM +0200, Martin Storsjö wrote:
[...]
> > Heres an example where the SWAP is needed:
> > noswap swap
> > 5 -> [x 5] [x 5]
> > 4 -> [5 4] [5 4]
> > 5 -> [5 4] [4 5]
> > 6 -> [4 6] [5 6]
> > 5 -> [6 5] [6 5]
> >
> > In the last case the 5 is in the old* when the swap was used but not
> > when it was not used
>
> Sorry, but your examples do not make sense or do not contain enough context
> (it does not include the initial states of the two old values, and it
> requires guesswork which ones of the two [x y] values is old and which one
> is old2).
>
> But to be clear:
>
> Please specify the initial values of the variables new, old and old2, for a
> case where
>
> > > if (old2 == new) {
> > > FFSWAP(old,old2);
> > > } else if (old != new) {
> > > old2 = old;
> > > old = new;
> > > }
>
> produces a different end result than
>
> > > if (old != new) {
> > > old2 = old;
> > > old = new;
> > > }
>
> I claim that for any values of these variables, the end result is the same.
yes, you are correct, i thought you intended to run the old2/old update only if
new differs from both old and old2.
The actual code you wrote is fine and nicely optimizes the swap out
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- 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/20250212/44f96f57/attachment.sig>
More information about the ffmpeg-devel
mailing list