[FFmpeg-devel] [PATCH] swscale: have --enable-runtime-cpudetect actually detect cpu capabilities at runtime

Darren Horrocks killallthehumans
Sat Mar 5 18:15:30 CET 2011


i have had a look into making swscale use the AV_CPU flags while i
have been extending the patch and beginning the patching of postproc,
it seems that the 2 sets of defines clash (in value) with non-cpu
flags within sws.

should all the flags be re-assigned new values or should we keep the 2
different flag prefixes?

-Darren

2011/3/5 M?ns Rullg?rd <mans at mansr.com>:
> Darren Horrocks <killallthehumans at gmail.com> writes:
>
>> Hi,
>>
>> used av_get_cpu_flags to get all cpu capabilities, then checked for
>> mmx2 mmx and 3dnow.
>>
>> if the cpu supports any of these, it gets added to the flags for use later.
>>
>> Regards,
>> Darren Horrocks
>>
>> diff --git a/libswscale/swscale.c b/libswscale/swscale.c
>> index 375171f..246a9d2 100644
>> --- a/libswscale/swscale.c
>> +++ b/libswscale/swscale.c
>> @@ -62,6 +62,7 @@ untested special converters
>> ?#include "rgb2rgb.h"
>> ?#include "libavutil/intreadwrite.h"
>> ?#include "libavutil/x86_cpu.h"
>> +#include "libavutil/cpu.h"
>> ?#include "libavutil/avutil.h"
>> ?#include "libavutil/mathematics.h"
>> ?#include "libavutil/bswap.h"
>> @@ -1260,6 +1261,12 @@ SwsFunc ff_getSwsFunc(SwsContext *c)
>> ?#if CONFIG_RUNTIME_CPUDETECT
>> ? ? ?int flags = c->flags;
>>
>> + ? ?int cpuflags = av_get_cpu_flags();
>> +
>> + ? ?flags |= (cpuflags & AV_CPU_FLAG_MMX ? SWS_CPU_CAPS_MMX : 0);
>> + ? ?flags |= (cpuflags & AV_CPU_FLAG_MMX2 ? SWS_CPU_CAPS_MMX2 : 0);
>> + ? ?flags |= (cpuflags & AV_CPU_FLAG_3DNOW ? SWS_CPU_CAPS_3DNOW : 0);
>
> libswscale should be changed to use the AV_CPU flags instead.
>
> --
> M?ns Rullg?rd
> mans at mansr.com
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>



More information about the ffmpeg-devel mailing list