]> git.sesse.net Git - ffmpeg/commit
avutil/common: Move everything inside inclusion guards
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 4 Feb 2021 13:57:30 +0000 (14:57 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 11 Feb 2021 08:07:10 +0000 (09:07 +0100)
commitbd50e715a95ca58e10ed79e2d4bf796467339460
tree1bcd02ab15c8ab0ced019958cf9033a6b85626df
parenta5daadd3a9352462dde1fbccac3ae7a0bd037172
avutil/common: Move everything inside inclusion guards

libavutil/common.h is a public header that provides generic math
functions whereas libavutil/intmath.h is a private header that contains
plattform-specific optimized versions of said math functions. common.h
includes intmath.h (when building the FFmpeg libraries) so that the
optimized versions are used for them.

This interdependency sometimes causes trouble: intmath.h once contained
an inlined ff_sqrt function that relied upon av_log2_16bit. In case there
was no optimized logarithm available on this plattform, intmath.h needed
to include common.h to get the generic implementation and this has been
done after the optimized versions (if any) have been provided so that
common.h used the optimized versions; it also needed to be done before
ff_sqrt. Yet when intmath.h was included from common.h and if an ordinary
inclusion guard was used by common.h, the #include "common.h" in intmath.h
was a no-op and therefore av_log2_16bit was still unknown at the end of
intmath.h (and also in ff_sqrt) if no optimized version was available.

Before a955b5965825631986ba854d007d4e934e466c7d this was solved by
duplicating the #ifndef av_log2_16bit check after the inclusion of
common.h in intmath.h; said commit instead moved these checks to the
end of common.h, outside the inclusion guards and made common.h include
itself to get these unguarded defines. This is still the current
state of affairs.

Yet this is unnecessary since 9734b8ba56d05e970c353dfd5baafa43fdb08024
as said commit removed ff_sqrt as well as the #include "common.h" from
intmath.h. Therefore this commit moves everything inside the inclusion
guards and makes common.h not include itself.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavutil/common.h