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

Michael Niedermayer michaelni
Tue Jan 8 20:32:32 CET 2008

On Tue, Jan 08, 2008 at 02:27:53PM +0100, Diego 'Flameeyes' Petten? wrote:
> Michael Niedermayer <michaelni at gmx.at> writes:
> > the strings used for replacements are not in their shorest form ...
> > x1hdeblock == h1 for example
> > this would change the distribution of the lengths and maybe make your
> > proposed change not need more mem
> You were right, I didn't look at that before. The attached patch reduces
> the replacements with their short form, so an entry would be at most 21
> bytes, I've used 24 so that 8 + 24 = 32 bytes would be a power of two.
> The table should still be using more memory on 32-bit systems (but not
> so much), but it should be smaller on 64-bit systems.

The shortening should be in a seperate patch and is ok.

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

Maybe something along the line of:
-for(i=0; replaceTable[2*i]!=NULL; i++){
-    if(!strcmp(replaceTable[2*i], filterName)){
-         int newlen= strlen(replaceTable[2*i + 1]);
+for(p= replaceTable; *p; p= p2 + strlen(p2)+1){
+    p2= p + strlen(p) + 1;
+    if(!strcmp(p, filterName)){
+         int newlen= strlen(p2);

But again it depends on being clean and not make the object file larger.

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is not what we do, but why we do it that matters.
-------------- 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/20080108/d087bfd3/attachment.pgp>

More information about the ffmpeg-devel mailing list