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

Måns Rullgård mans
Sat Jan 12 17:32:57 CET 2008


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.

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




More information about the ffmpeg-devel mailing list