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

Stefano Sabatini stefano.sabatini-lala
Sun Mar 22 09:52:17 CET 2009

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:
> > Hi all,
> > 
> > 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
-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
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.

Attached there is a workaround, but I don't think that's the right fix.

FFmpeg = Faithless and Fast Mastering Portentous Enlightened Guru
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-cpuid-test.patch
Type: text/x-diff
Size: 658 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090322/562a1bec/attachment.patch>

More information about the ffmpeg-devel mailing list