[FFmpeg-devel] [PATCH] Move the filters table in postprocess.c to .rodata

Michael Niedermayer michaelni
Sat Jan 5 19:25:12 CET 2008

On Sat, Jan 05, 2008 at 01:49:55PM +0100, Diego 'Flameeyes' Petten? wrote:
> The attached patch makes the filters table in postprocess.c entirely
> constant, using characters array rather than string pointers. Again, the
> size _might_ be bigger as the longname is sometimes bigger than the
> string used to fill it, but as none of the longnames seems to be shorter
> than 8, if it's bigger (and again I didn't do the math), it's only on
> 32-bit. For what concerns shortname, it's certainly using less memory as
> the size used is 4 (which is the size of a pointer in 32-bit). Even if
> it used a bit more memory, it now is moved to .rodata so it should be an
> improvement over before.
> [Note: I use 4 and 16 to pad the maximum size to the nearest power of
> two, to let the compiler optimise access with a left shift.]

hmm the size of the struct after your change is 36 byte, that is not left
shift friendly ...
also 3 of the ints in the struct can be changed to uint8_t
with that the struct would be 28 byte
and if you would use bitfields you could get it to 24byte

now if you would also replace the last entry by its log2 value and change the
code to assume that the first is always 2 bytes then the struct would be down
to 19 byte

and then all accesses to the struct are sequential so theres no need for a
constant size per entry and you could really store the whole in 15 bytes
per entry on average

so really, try a little harder please ;)

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080105/42970484/attachment.pgp>

More information about the ffmpeg-devel mailing list