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
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to