[FFmpeg-devel] [PATCH v2 161/162] avcodec/mpegaudiodec: Hardcode tables to save space

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri Nov 27 21:56:46 EET 2020


Michael Niedermayer:
> On Fri, Nov 20, 2020 at 08:33:26AM +0100, Andreas Rheinhardt wrote:
>> The csa_tables (which always consist of 32 entries of four byte each,
>> but the type depends upon whether the decoder is fixed or
>> floating-point) are currently initialized once during decoder
>> initialization; yet it turns out that this is actually no benefit: The
>> code used to initialize these tables takes up 153 (fixed point) and 122
>> (floating point) bytes when compiled with GCC 9.3 with -O3 on x64, so it
>> is better to just hardcode these tables.
>>
>> Essentially the same applies to the is_tables: They have a size or 128
>> each and the code to initialize them occupies 149 (fixed point) resp.
>> 140 (floating point) bytes. So hardcode them, too.
> 
> Is it intended not to use CONFIG_HARDCODED_TABLES ?
> 
Yes. It makes no sense to ever generate the tables at runtime if the
code for this takes more space than the tables itself.

> also if the code generating the tables is removed then it should be made
> easy to re-build the tables. That would be in the spirit of the *GPL
> (to be able to change and rebuild a binary\H table 
>  for potentially a different use)
> 
How about I refer to the git history for that? (I don't even have the
mp3-spec, so I don't know on what part of it these tables are based.)

- Andreas


More information about the ffmpeg-devel mailing list