[FFmpeg-devel] [PATCH] Clean up av_get_cpu_flag()
Måns Rullgård
mans
Fri Sep 10 11:52:19 CEST 2010
Benoit Fouet <benoit.fouet at free.fr> writes:
> 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?
The detected flags could be 0. Anyhow, I've committed a simpler variant.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list