[FFmpeg-devel] [PATCH] Clean up av_get_cpu_flag()

Benoit Fouet benoit.fouet
Fri Sep 10 11:45:45 CEST 2010


On Thu, 9 Sep 2010 19:59:45 +0200 Janne Grunau wrote:
>  int av_get_cpu_flags(void)
>  {
> -    return 0;
> +    static int cpu_flags;
> +
> +    if (!cpu_flags) {
> +        if (ARCH_ARM) cpu_flags = ff_get_cpu_flags_arm();
> +        if (ARCH_PPC) cpu_flags = ff_get_cpu_flags_ppc();
> +        if (ARCH_X86) cpu_flags = ff_get_cpu_flags_x86();
> +
> +        // use AV_CPU_FLAGS_FORCE as sentinel for empty cpu flags
> +        if (!cpu_flags)
> +            cpu_flags = AV_CPU_FLAG_FORCE;
> +    }
> +    return cpu_flags & ~AV_CPU_FLAG_FORCE;
>  }

Am I missing something, or is the sentinel part useless?

-- 
Ben



More information about the ffmpeg-devel mailing list