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

Darren Horrocks killallthehumans
Sat Mar 12 11:03:06 CET 2011

On 5 March 2011 18:27, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> Hi,
> On Sat, Mar 5, 2011 at 12:15 PM, Darren Horrocks
> <killallthehumans at gmail.com> wrote:
>> 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.
> ? Which ones clash?
>> should all the flags be re-assigned new values or should we keep the 2
>> different flag prefixes?
> Get rid of SWS_ flags.
> Ronald

the sws flags are the flags for everything within sws, not just cpu,
so the following clash, i.e. the scalling and sampling methods are
also in there and collide with AV_CPU flags

#define AV_CPU_FLAG_MMX          0x0001 ///< standard MMX
#define AV_CPU_FLAG_MMX2         0x0002 ///< SSE integer functions or
#define AV_CPU_FLAG_3DNOW        0x0004 ///< AMD 3DNOW
#define AV_CPU_FLAG_SSE          0x0008 ///< SSE functions
#define AV_CPU_FLAG_SSE2         0x0010 ///< PIV SSE2 functions
#define AV_CPU_FLAG_3DNOWEXT     0x0020 ///< AMD 3DNowExt

#define SWS_FAST_BILINEAR     1
#define SWS_BILINEAR          2
#define SWS_BICUBIC           4
#define SWS_X                 8
#define SWS_POINT          0x10
#define SWS_AREA           0x20

and there are many more, a real fix would mean re-implementing all SWS
flags with a base of 0x40000000 to avoid collision. so all we would be
doing essentially rewriting a major part of sws, breaking binary
compatibility with applications that use ffmpeg and/or libs just to
remove about 5 SWS_ flags

More information about the ffmpeg-devel mailing list