[FFmpeg-devel] [PATCH] Make postprocess.c's replaceTable fall into .rodata

Diego 'Flameeyes' Pettenò flameeyes
Tue Jan 8 22:19:49 CET 2008


Michael Niedermayer <michaelni at gmx.at> writes:

> The change to fixed sizes arrays is only ok if its not larger or more
> messy!

For what concerns object file size and code size, the current code is
the smaller:

flame at enterprise replaceTable-cmp % codiff original.o chararray.o
postprocess.c:
  pp_get_mode_by_name_and_quality |  +23
 1 function changed, 23 bytes added
flame at enterprise replaceTable-cmp % codiff original.o fixedarray.o
postprocess.c:
  pp_get_mode_by_name_and_quality |  +45
 1 function changed, 45 bytes added
flame at enterprise replaceTable-cmp % ls -l *.o
-rw-r--r-- 1 flame flame 87432  8 gen 22:10 chararray.o
-rw-r--r-- 1 flame flame 87296  8 gen 22:10 fixedarray.o
-rw-r--r-- 1 flame flame 87176  8 gen 22:10 original.o

For what concerns in-memory space, current code is the worse:

flame at enterprise replaceTable-cmp % objdump -t original.o | grep replaceTable
0000000000000030 l     O .data.rel.ro.local     0000000000000058 replaceTable
flame at enterprise replaceTable-cmp % objdump -t chararray.o| grep replaceTable
00000000000000a0 l     O .rodata        000000000000006a replaceTable
flame at enterprise replaceTable-cmp % objdump -t fixedarray.o| grep replaceTable
00000000000000a0 l     O .rodata        00000000000000c8 replaceTable

(note that in the case of original.o, the size is _just_ for the
pointers, the strings are not counted, so it's almost certainly bigger
than the dynamic-sized character array).

You should add to the current code that it requires runtime relocation
for PIC code (non-PIC code shouldn't need them) thus causing a COW.

As for messy... I'm attaching the two patch if you want to take a look.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libpostproc-replaceTable-fixedsize.patch
Type: text/x-patch
Size: 2348 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080108/80e69cc7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libpostproc-replaceTable-chararray.patch
Type: text/x-patch
Size: 2768 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080108/80e69cc7/attachment-0001.bin>
-------------- next part --------------


-- 
Diego "Flameeyes" Petten?
http://farragut.flameeyes.is-a-geek.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080108/80e69cc7/attachment.pgp>



More information about the ffmpeg-devel mailing list