Opened 5 years ago

Closed 5 years ago

Last modified 5 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, 5 years ago

Resolution: invalid
Status: newclosed

comment:2 by Hendrik, 5 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, 5 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.