[FFmpeg-devel] [PATCH] Automatically generate ac3enc_data.h

Måns Rullgård mans
Sat Jan 12 19:24:56 CET 2008


Michael Niedermayer <michaelni at gmx.at> writes:

> On Sat, Jan 12, 2008 at 04:32:57PM +0000, M?ns Rullg?rd wrote:
>> flameeyes at gmail.com (Diego 'Flameeyes' Petten?) writes:
>> 
>> > It's not the nicest thing out there, but it should work...
>> >
>> > Autogenerate ac3enc_data.h through Makefile rules.
>> >
>> > From: Diego 'Flameeyes' Petten?? <flameeyes at gmail.com>
>> >
>> >
>> > ---
>> >
>> >  libavcodec/Makefile        |   14 +++++
>> >  libavcodec/ac3enc_data.h   |  115 --------------------------------------------
>> >  libavcodec/ac3enc_tables.c |    1 
>> >  3 files changed, 14 insertions(+), 116 deletions(-)
>> >  delete mode 100644 libavcodec/ac3enc_data.h
>> >
>> >
>> > diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>> > index 139689a..352feff 100644
>> > --- a/libavcodec/Makefile
>> > +++ b/libavcodec/Makefile
>> > @@ -463,7 +463,8 @@ clean::
>> >  	   ps2/*.o ps2/*~ \
>> >  	   sh4/*.o sh4/*~ \
>> >  	   sparc/*.o sparc/*~ \
>> > -	   apiexample $(TESTS)
>> > +	   apiexample $(TESTS) \
>> > +	   $(TABLEGEN) $(TABLES)
>> >  
>> >  TESTS= imgresample-test fft-test dct-test
>> >  ifeq ($(ARCH_X86),yes)
>> > @@ -486,4 +487,15 @@ imgresample-test: imgresample.c $(LIBNAME)
>> >  
>> >  motion-test: motion-test.o $(LIBNAME)
>> >  
>> > +TABLEGEN= ac3enc-gentables
>> > +TABLES= ac3enc_data.h
>> > +
>> > +ac3enc.c: ac3enc_data.h
>> > +
>> > +%-gentables: %_tables.c
>> > +	$(CC) $(CFLAGS) -DGENTABLES -o $@ $^ $(EXTRALIBS)
>> > +
>> > +%_data.h: %-gentables
>> > +	./$^ > $@
>> > +
>> 
>> I'm not opposed to the idea of generating tables at build time, but
>> this will break cross-compiling.  To make it work, we'd need to
>> introduce a HOSTCC variable, or use something like Perl to generate
>> the tables.
>
> Iam not a fan of perl ...
> Actually id remove it from my system if i could easily :)

s/Perl/an interpreted language/

> That said, i think the chances of perl being unavailable might be higher
> than no host cc being available. But iam just guessing ...
> cygwin/mingw contain perl by default?

It was just a random thought of mine.  The need to maintain two
versions of the table generation code is reason enough not to do it.
(Ignoring the possibility to write code obfuscated enough to pass as
both C and Perl.)

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list