[FFmpeg-devel] usage of AV_GLUE?

Ronald S. Bultje rsbultje at gmail.com
Fri Oct 16 05:21:56 CEST 2015


Hi,

On Thu, Oct 15, 2015 at 8:37 PM, Ganesh Ajjanagadde <gajjanag at mit.edu>
wrote:

> Hi all,
>
> Examining libavutil/macros, there is AV_GLUE/AV_JOIN (why are there
> two?) defined for preprocessor token pasting. However, it is not being
> used anywhere, instead people have use "##". There are a number of
> options regarding this:
> 1. Start using them, and convert the ## usage to AV_GLUE/AV_JOIN.
> 2. Don't bother at all.
> 3. Deprecate and remove them at some point.
>

 ../libavcodec/flacdsp_lpc_template.c:#define FUNC(n) AV_JOIN(n ## _,
SAMPLE_SIZE)
../libavcodec/flacdsp_template.c:#   define FSUF   AV_JOIN(SAMPLE_SIZE, p)
../libavcodec/flacdsp_template.c:#define FUNC(n) AV_JOIN(n ## _, FSUF)
../libavcodec/h264_mb_template.c:#   define FUNC(n) AV_JOIN(n ## _simple_,
BITS)

You have to understand _why_ we use this. The problem is that in some cases
(sometimes in a compiler-dependent way, other times more generally), you
need to expand preprocessor tokens before concatenating them. Older
versions of MSVC were bad at this, but you can see gcc suffers from it also
if you look for uses of cat() in
libavcodec/x86/vp9dsp_init_16bpp_template.c. If you change cat into just
##, it stops working.

And yes, cat, should probably be AV_JOIN, I forgot about AV_JOIN.

Ronald


More information about the ffmpeg-devel mailing list