[FFmpeg-devel] [RFC] [PATCH] CPU caps detection in FFmpeg

Stefano Sabatini stefano.sabatini-lala
Sun Mar 22 14:46:21 CET 2009


On date Sunday 2009-03-22 13:38:40 +0100, Diego Biurrun encoded:
> On Sun, Mar 22, 2009 at 09:52:17AM +0100, Stefano Sabatini wrote:
> > On date Sunday 2009-03-22 02:16:56 +0100, Michael Niedermayer encoded:
> > > On Sun, Mar 22, 2009 at 02:00:12AM +0100, Stefano Sabatini wrote:
> > > > 
> > > > I took Michael request for having in vf_scale.c all the features of
> > > > the libmpcodecs one very seriously ;-), so here it is an experimental
> > > > attempt for implementing the sws CPU flags detection, so I ported the
> > > > code from Mess^H^H^HPlayer.
> > > > 
> > > > It is not meant for review, but just to see if it could be eventually
> > > > accepted, and if this is the right approach.
> > > > 
> > > > Just in the case, should I allocate av_cpu_caps statically?
> > > 
> > > what problem does
> > > libavcodec/x86/cpuid.c
> > > have?
> > 
> > 1) first of all I didn't know of its existence ;-)
> > 
> > 2) it fails at compilation with:
> > 
> > cd ~/src/libavfilter-soc/ffmpeg/libavcodec; make x86/cpuid-test; and
> > x86/cpuid-test gcc -DHAVE_AV_CONFIG_H
> > -I.. -I"/home/stefano/src/libavfilter-soc/ffmpeg"
> > -I/home/stefano/include -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
> > -std=c99 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -g3
> > -Wdeclaration-after-statement -Wall -Wno-switch
> > -Wdisabled-optimization -Wpointer-arith -Wredundant-decls
> > -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef
> > -fno-math-errno -fno-signed-zeros -DTEST -c -o x86/cpuid-test.o
> > x86/cpuid.c
> > cc1: warning: -funit-at-a-time is required for inlining of functions that are only called once
> > x86/cpuid.c:42:20: error: macro "mm_support" passed 1 arguments, but takes just 0
> > x86/cpuid.c:43: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?{? token
> > x86/cpuid.c: In function ?main?:
> > x86/cpuid.c:127: error: expected identifier or ?(? before numeric constant
> > x86/cpuid.c:128: error: lvalue required as left operand of assignment
> > make: *** [x86/cpuid-test.o] Error 1
> > 
> > This is due to the fact that the mm_support() and mm_flags are defined
> > as macro by dsputil.h.
> 
> No, the problem is that you have a broken tree or whatever.  Just
> 
> make libavcodec/x86/cpuid-test
> 
> works absolutely fine here.

I forgot to say that I'm compiling with --disable-mmx (unfortunately
MMX + -disable-optimization can't even compile), so in dsputil.h I'm
in the case:

#define mm_flags 0
#define mm_support() 0

Also I wonder why cpuid.h should have to do with dsputil.h? I think
some refactoring is required there.

Regards.
-- 
FFmpeg = Fundamental & Fundamentalist Multimedia Power EniGma



More information about the ffmpeg-devel mailing list