[Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ??

"René J.V. Bertin" rjvbertin at gmail.com
Wed Feb 13 20:26:13 CET 2013


On Feb 13, 2013, at 20:01, Michael Niedermayer wrote:
> 
> duplicating the tables causes a small performance increase in some
> linking configurations.

If that's the case, why not do something like this?

in libavutil/log2_tab.c :

#ifndef cdh_GLUE
#	define cdh_GLUE(a,b)         a##b
#endif
#ifndef cdh_GLUE2
#	define cdh_GLUE2(a,b)        cdh_GLUE(a,b)
#endif
#define ADD_BASENAME(name) cdh_GLUE2(LIBRARY_BASENAME,name)

#ifndef LIBRARY_BASENAME
#	define LIBRARY_BASENAME	ff_
#endif

const uint8_t ADD_BASENAME(log2_tab)[256]{ ... };


And then define LIBRARY_BASENAME to something relevant in each file outside of libavutil where (and before) you include log2_tab.c ...

(with thank to Apple's QuickTime Component stuff ;) )

R.


More information about the Libav-user mailing list