[FFmpeg-devel] [PATCH 0/4] more accurate constants

Ganesh Ajjanagadde gajjanag at mit.edu
Thu Nov 26 14:26:54 CET 2015

On Thu, Nov 26, 2015 at 8:07 AM, Ganesh Ajjanagadde <gajjanag at mit.edu> wrote:
> On Thu, Nov 26, 2015 at 5:23 AM, John Warburton <john at johnwarburton.net> wrote:
>> On Fri, Nov 13, 2015 at 4:42 PM, Ganesh Ajjanagadde
>> <gajjanagadde at gmail.com> wrote:
>>> 4/4 is a "best effort" patch that maximizes accuracy on all platforms for
>>> avcodec/faandct. It results in concrete accuracy benefits on the "default" x86-64
>>> GNU/Linux platform.
>>> Patches tested with FATE. ppc untested.
>> Sorry to say the libavcodec/faandct.c patch prevents compilation on a
>> ppc using GCC 5.2.0. In all cases (the first of which are given
>> below), the GCC "note" states:
>> "in expansion of macro 'Bn'"
>> ...where n is the digit following B
> Does removing the L fix it?

Read up a bit and suspect it should, and more generally long double is
a can of worms on ppc with bugs on some compilers:
https://gcc.gnu.org/wiki/Ieee128PowerPC, ABI in transition,
https://llvm.org/bugs/show_bug.cgi?id=11933 etc etc. Well known
projects have gone through pain:

So basically, a good lesson for FFmpeg is not to touch long double for
at least some time to come, even though ironically it is C89.
I am pretty sure with appropriate configure flags something can be
done, but I have negative interest in hacking around upstream for such

I will push the removal soon unless there are further comments.

>> libavcodec/faandct.c:39:12: error: initializer element is not constant
>>  #define B1 0.720959822006947913789091890943021267L // (cos(pi*1/16)sqrt(2))^-1
>> ...
>> libavcodec/faandct.c:40:12: error: initializer element is not constant
>>  #define B2 0.765366864730179543456919968060797734L // (cos(pi*2/16)sqrt(2))^-1
>> ...
>> libavcodec/faandct.c:41:12: error: initializer element is not constant
>>  #define B3 0.850430094767256448766702844371412325L // (cos(pi*3/16)sqrt(2))^-1
>> ...
>> libavcodec/faandct.c:43:12: error: initializer element is not constant
>>  #define B5 1.272758580572833938461007018281767032L // (cos(pi*5/16)sqrt(2))^-1
>> ...
>> libavcodec/faandct.c:44:12: error: initializer element is not constant
>>  #define B6 1.847759065022573512256366378793576574L // (cos(pi*6/16)sqrt(2))^-1
>> ...
>> libavcodec/faandct.c:45:12: error: initializer element is not constant
>>  #define B7 3.624509785411551372409941227504289587L // (cos(pi*7/16)sqrt(2))^-1
>> ...
>> kind regards,
>> John
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

More information about the ffmpeg-devel mailing list