[FFmpeg-devel] [PATCH] Make mov_mdhd_language_map fall into .rodata

Michael Niedermayer michaelni
Tue May 6 00:30:56 CEST 2008


On Fri, May 02, 2008 at 05:46:36PM +0200, Diego 'Flameeyes' Petten? wrote:
> 
> As per summary, it simply replaces the array of strings with an array of
> arrays. Not only it avoids .data.rel, but it should also reduce the
> size, as before it was sized:
> 
> N = 149 (entries in table)
> M = 41 (NULL entries)
> 
> sizeof(char*)*N + (N-M)*4
> 
> which translated to 1028 bytes on 32-bit systems and 1624 bytes on
> 64-bit systems, while the new table is N * 4 = 596 bytes.
> 
> The codesize is the same on amd64 at least.
> 

> Make mov_mdhd_language_map fall into .rodata
[...]

> @@ -212,8 +212,8 @@ int ff_mov_iso639_to_lang(const char *lang, int mp4)
>      int i, code = 0;
>  
>      /* old way, only for QT? */
> -    for (i = 0; !mp4 && (i < (sizeof(mov_mdhd_language_map)/sizeof(char *))); i++) {
> -        if (mov_mdhd_language_map[i] && !strcmp(lang, mov_mdhd_language_map[i]))
> +    for (i = 0; !mp4 && (i < (sizeof(mov_mdhd_language_map)/sizeof(mov_mdhd_language_map[0]))); i++) {
> +        if (*(mov_mdhd_language_map[i]) && !strcmp(lang, mov_mdhd_language_map[i]))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
what is this check supposed to do?


>              return i;
>      }
>      /* XXX:can we do that in mov too? */
> @@ -248,7 +248,7 @@ int ff_mov_lang_to_iso639(int code, char *to)
>          return 1;
>      }

>      /* old fashion apple lang code */
> -    if (code >= (sizeof(mov_mdhd_language_map)/sizeof(char *)))
> +    if (code >= (sizeof(mov_mdhd_language_map)/sizeof(mov_mdhd_language_map[0])))
>          return 0;

this stuff could be a seperate patch ...
Not really important ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- 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/20080506/b2923d06/attachment.pgp>



More information about the ffmpeg-devel mailing list