[MPlayer-dev-eng] need swscale.c -> swscale_template.c move/copy

pl p_l at tfz.net
Tue Nov 27 10:49:24 CET 2001


On Tue, Nov 27, 2001 at 01:37:36AM +0200, Arpi wrote:
> Hi,
> 
> hmm. about runtime cpudetect stuff:
> 
> it should be optional!!!
> reasons:
> 
> 1. to force binary packagers to use --enable-dist or something
> 2. to compile possible fastest and smallest binary for people who compiles
> mplayer from source
> 
> i mean:
> 
> #ifdef RUNTIME_CPUDETECT
> if(gCpuInfo....){
> } else ...
> #else
> #ifdef HAVE_MMX
>  ...
> #endif
> #ifdef HAVE_...
> ...
> #endif
[...]

A cleanier way imho, since it limits #defines, in pseudo C:

#if RUNTIME_CPUDETECT
  int gCpuInfo_hasmmx;
#else
  #define gCpuInfo_hasmmx HAVE_MMX
(or const int ... = HAVE_MMX;)
#endif


main() {
#if RUNTIME_CPUDETECT
  printf("you'll get faster/smaller/nicer binaries by running configure ...");
  gCpuInfo_hasmmx=gCpuInfo_hasmmx();
  ...
#endif
}

if(gCpuInfo_hasmmx) {
 blah();
}

gcc won't generate the test if there's a 'if (1)' or 'if (0)'.

And --enable-dist will sets #define RUNTIME_CPUDETECT to 1.

-- 
Best regards,
  pl



More information about the MPlayer-dev-eng mailing list