[FFmpeg-devel] [RFC] AES init

Trent Piepho xyzzy
Mon May 14 02:49:09 CEST 2007


On Sun, 13 May 2007, Rich Felker wrote:
> On Mon, May 14, 2007 at 01:57:42AM +0200, Michael Niedermayer wrote:
> > what about making it optional?
> > i think having the code which can generate the table in the source is
> > a good idea anyway
> > and its so trivial to make it optional :)
> > #ifdef CONFIG_PREFER_RODATA
> > table[1234]={ 1,2,3,4,5,2,4,6,8,0,
> > ...
> > #define ff_init_table()
> > #else
> > table[1234]
> > ff_init_table(){
> >     for ...
> >         table[i]= ...
> > }
> > #endif
>
> I like it! As usual, Michael has a great solution! Now write the
> script to compile and run the program to generate the static table and
> update the C source file. :)

If you stick each table in its own header file, it's easy to write a C
program that generates the header, and have make automatically run the
program to create the table.

Simplified makefile:

aes.h: table-foo.h

table-foo.h: make-foo
	make-foo > table-foo.h

make-foo: make-foo.c
	$(HOSTCC) make-foo.c -o make-foo   # HOSTCC, for cross compiling

It's especially useful if the contents of the table itself are being
developed.




More information about the ffmpeg-devel mailing list