[FFmpeg-devel] [PATCH] Move CPU detection to libavutil and cleanup

Stefano Sabatini stefano.sabatini-lala
Wed Sep 8 17:46:34 CEST 2010


On date Wednesday 2010-09-08 15:15:11 +0200, Michael Niedermayer encoded:
> On Wed, Sep 08, 2010 at 01:14:03PM +0200, Stefano Sabatini wrote:
> [...]
> > +#include "cpu.h"
> > +#include "config.h"
> > +
> > +#if   ARCH_ARM
> > +#   include "arm/cpu.h"
> > +#elif ARCH_PPC
> > +#   include "ppc/cpu.h"
> > +#elif ARCH_X86
> > +#   include "x86/cpu.h"
> > +#else
> > +int av_get_cpu_flags(void)
> > +{
> > +    return 0;
> > +}
> > +#endif
> > +
> > +#ifdef TEST
> > +
> > +#undef printf
> > +
> > +int main(void)
> > +{
> > +    int cpu_flags = av_get_cpu_flags();
> > +
> > +    printf("cpu_flags = 0x%08X\n", cpu_flags);
> > +    printf("cpu_flags = %s%s%s%s%s%s%s%s%s%s%s%s\n",
> > +#if    ARCH_ARM
> > +           cpu_flags & AV_CPU_FLAG_IWMMXT   ? "IWMMXT "     : "",
> > +#elsif ARCH_PPC
> > +           cpu_flags & AV_CPU_FLAG_ALTIVEC  ? "ALTIVEC "    : "",
> > +#else
> > +           cpu_flags & AV_CPU_FLAG_MMX      ? "MMX "        : "",
> > +#endif
> > +           cpu_flags & AV_CPU_FLAG_MMX2     ? "MMX2 "       : "",
> > +           cpu_flags & AV_CPU_FLAG_SSE      ? "SSE "        : "",
> > +           cpu_flags & AV_CPU_FLAG_SSE2     ? "SSE2 "       : "",
> > +           cpu_flags & AV_CPU_FLAG_SSE2SLOW ? "SSE2(slow) " : "",
> > +           cpu_flags & AV_CPU_FLAG_SSE3     ? "SSE3 "       : "",
> > +           cpu_flags & AV_CPU_FLAG_SSE3SLOW ? "SSE3(slow) " : "",
> > +           cpu_flags & AV_CPU_FLAG_SSSE3    ? "SSSE3 "      : "",
> > +           cpu_flags & AV_CPU_FLAG_SSE4     ? "SSE4.1 "     : "",
> > +           cpu_flags & AV_CPU_FLAG_SSE42    ? "SSE4.2 "     : "",
> > +           cpu_flags & AV_CPU_FLAG_3DNOW    ? "3DNow "      : "",
> > +           cpu_flags & AV_CPU_FLAG_3DNOWEXT ? "3DNowExt "   : "");
> 
> the rest of the x86 flags should be under that ifdef too or be defined to 0
> 
> patch should be ok otherwise if tested 

Applied.
-- 
FFmpeg = Freak and Fanciful Mythic Picky Ecumenical God



More information about the ffmpeg-devel mailing list