[MPlayer-dev-eng] [PATCH] Make mp3lib SIMD optimizations work on AMD64, Part 5

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri May 25 13:12:35 CEST 2007


Hello,
On Fri, May 25, 2007 at 02:14:49PM +0800, Zuxy Meng wrote:
>  We've reached Part 5. This is again a big diff, replacing many 'long'
>  to 'int', and several 'real' to 'short'. Among those, many are
>  necessary because under LP64 environment, sizeof(long) != sizeof(int)
>  and sizeof(long) != sizeof(float); others are optimizations simply
>  because we really don't need such a long type, or the declaration
>  didn't match its use (declared as float, used as short).

These are separate issues and should be fixed in different patches. Also
if you changed long to int because the code assumes 32 bits, it would
make more sense to change it to int32_t. Replacing long with int without
thinking can make the code even slower on 64 bit systems.

[...]
> Index: mp3lib/sr1.c
> ===================================================================
> --- mp3lib/sr1.c	?????? 23383??
> +++ mp3lib/sr1.c	????????????
> @@ -50,7 +50,6 @@
>  int MP3_channels=0;
>  int MP3_bps=2;
>  
> -static long outscale = 32768;
>  #include "tabinit.c"
>  
>  #if 1

> @@ -413,7 +412,7 @@
>      _has_mmx = 0;
>      dct36_func = dct36;
>  
> -    make_decode_tables(outscale);
> +    make_decode_tables();
>  
>  #ifdef CAN_COMPILE_X86_ASM
>  
[...]
> @@ -36,9 +36,9 @@
>   64019, 65290, 66494, 67629, 68692, 69679, 70590, 71420, 72169, 72835,
>   73415, 73908, 74313, 74630, 74856, 74992, 75038 };
>  
> -static void make_decode_tables(long scaleval)
> +static void make_decode_tables()
>  {
> -  int i,j,k,kr,divv;
> +  int i,j,k,kr,divv,scaleval=32768;

This is unrelated and also completely useless since a static function
that is used in only one place will be inlined anyway.
In addition it is wrong since "static void make_decode_tables()" !=
"static void make_decode_tables(void)"

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list