Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#8022 closed defect (invalid)

Enhance performance of FFMAX macro

Reported by: Ulf Zibis Owned by:
Priority: normal Component: avutil
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
FFMAX is often used in this scenario:

original = FFMAX(original , limit);

If the original equals limit, with the current implementation limit is copied to original, which is superfluous.
So I suggest to implement FFMAX equivalent to FFMIN.
Current:

#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
#define FFMIN(a,b) ((a) > (b) ? (b) : (a))

Proposed:

#define FFMAX(a,b) ((a) < (b) ? (b) : (a))
#define FFMIN(a,b) ((a) > (b) ? (b) : (a))

Change History (3)

comment:1 by Elon Musk, 2 years ago

Resolution: invalid
Status: newclosed

comment:2 by Hendrik, 2 years ago

If you want to claim this is faster, then show generated assembly and performance numbers. Because I'm doubtful its going to change anything whatsoever.

Also, patches should be submitted to the ffmpeg-devel mailing list.

in reply to:  2 comment:3 by Ulf Zibis, 2 years ago

Replying to heleppkes:

If you want to claim this is faster, then show generated assembly and performance numbers. Because I'm doubtful its going to change anything whatsoever.

I've checked that out. You are right at least with my compiler. It optimizes equivalent for both variants, don't know if this is true for any compiler.

Anyway I think my proposal would show more consistence between FFMAX and FFMIN.

Note: See TracTickets for help on using tickets.