[FFmpeg-devel] Visibility implementation

Uoti Urpala uoti.urpala
Thu Jul 31 19:03:50 CEST 2008


On Wed, 2008-07-30 at 05:45 +0300, Uoti Urpala wrote:
> The attached patch adds visibility information for lots of symbols in

I created a new version that adds visibility information for most
libavcodec symbols. This time I split the patch into two parts. The
first one has the repeated changes per internal header marking them as
such. The second adds visibility information for some of the symbols
that are not static but not declared in any header either, adds
exceptions for some symbols which are declared in libavcodec headers but
used outside it (mainly in libavformat), and defines the macros used.

One special case is the ff_inverse symbol. It's defined in dsputil.c but
declared in libavutil/internal.h and used in the FASTDIV macro. I made
the symbol hidden, which means FASTDIV will not work outside libavcodec
as the symbol is not visible outside the library (it's not used
elsewhere now). If it's supposed to be used for cases where speed
matters then slower access to a global from another library probably
isn't good.

Does anyone have comments about the substance of the patch (something
more than M?ns's general hostility towards visibility)?

As for the effects on code, you can see from the generated asm that it
does improve. I haven't tried any large benchmarks and don't know where
access to globals would matter most (and so would be most worthwhile to
benchmark for obvious differences). I did a small test with h264 video
and h264.c compiled with -fPIC:

times without visibility: 15.212 15.247 15.192 15.238 15.206
times with visibility:    15.115 15.082 15.114 15.067 15.062

The patch does make decoding consistently faster, but I don't think such
benchmark results show much (except that it does have some effect on
generated code). Random variation in how well the compiler happens to
optimize a particular version of the code or how things happen to align
in cache can be several percent.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mark_internal.diff
Type: text/x-patch
Size: 34728 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080731/32a6242a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: other_visibility.diff
Type: text/x-patch
Size: 12821 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080731/32a6242a/attachment-0001.bin>



More information about the ffmpeg-devel mailing list