[FFmpeg-devel] [PATCH] avfilter, swresample, swscale: use fabs, fabsf instead of FFABS

Ganesh Ajjanagadde gajjanag at mit.edu
Mon Oct 12 13:59:11 CEST 2015


On Mon, Oct 12, 2015 at 7:46 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Ganesh Ajjanagadde <gajjanag <at> mit.edu> writes:
>
>> It is well known that fabs and fabsf are at least as fast and usually
>> faster than the FFABS macro, at least on the gcc+glibc combination.
>
> I wasn't aware of this.
> And I believe we support other compilers and other
> libc implementations.

Indeed, which is why performance comparisons are welcome. I argue
below why any sane configuration should not regress performance wise.
This is also "relevant information" in my view.

>
>> For instance, see the reference:
>> http://patchwork.sourceware.org/patch/6735/.
>> This was a patch to glibc in order to remove their usages. Given their
>> general performance obsession (more than FFmpeg in many cases), they
>> have ensured that fabs and fabsf never peform worse than FFABS.
>
> Ok but is this really related?

The reference is, the comment may not be, I was slightly annoyed at
FFABS usage when libc provides them on all our platforms, and wanted a
justification that would appeal to the FFmpeg crowd, namely peformance
to move away from them.

>
>> I have tested on x86-64 Haswell with GCC 5.2 - even with no strict IEEE
>> mode enabled, and just the standard -O3 optimizations, there is a
>> performance benefit.
>
> This is the only relevant information imo.
> Please provide (very, very short) information
> on what you tested.

Random integers, same style as before. I have not posted numbers,
since my numbers are anyway meaningless: I lack non
x86-64+(gcc/clang)+glibc configurations.
As for that being the only relevant message, I do intend to shorten
the message. The long stuff was simply my own personal motivation to
make people understand why I did this stuff. Otherwise, I would have
sent a separate message anyway in the patch thread, let me know what
style you prefer.

>
> Since you mention libc so often: Does the patch
> work on win*, aix and other strange platforms?

Why not, any standard, conformant fabs/fabsf should. Again, I lack the
configurations and am just a university student with a single laptop.
fabs and fabsf are already being used elsewhere. Inf anything, they
are far better specified on IEEE 754 than FFABS - behavior with NaN,
Inf, etc.

>
> Carl Eugen
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list