[FFmpeg-devel] [PATCH v2 2/2] random_seed: Improve behaviour with small timer increments with high precision timers
Martin Storsjö
martin at martin.st
Wed Feb 12 21:52:35 EET 2025
On Wed, 12 Feb 2025, Michael Niedermayer wrote:
> 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
Thanks, then I'll push it soon. And after some delay, I'd also backport it
to a couple branches if that's ok; without this, "make fate" hangs on my
machine.
// Martin
More information about the ffmpeg-devel
mailing list