[FFmpeg-devel] [PATCH] fix --enable-runtime-cpudetect --disable-amd3dnow compilation

Michael Niedermayer michaelni
Sun Sep 5 12:10:42 CEST 2010

On Sat, Sep 04, 2010 at 10:28:07PM -0400, Ronald S. Bultje wrote:
> Hi,
> On Sat, Sep 4, 2010 at 6:59 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > id rather see dsputil gain support to have things disabled at compiletime
> > that arent relevant for some target cpu.
> That's not quite the same thing. Swscale should always do runtime CPU
> detection, but the user should be able to disable compilation of all
> MMX (i.e. all SIMD) or all SSE4 or all >=SSSE3 or all >=SSE2
> functions, etc. We already have HAVE_SSSE3, HAVE_SSE and HAVE_MMX2
> (and the relevant --disable-.. configure flags). Isn't that enough?

Like i said previously there are 2 main use cases for the end user.
1. one wants to build a binary that runs well on any cpu of some class like
   a distro maintainer wants.
2. one compiles his own binary and wants that to run optimally on ones own

it seems you want something else.and that seems to me to be worse for
actual use cases to the end user

Also the system used in swscale can handle both 1 and 2 and it can handle
the compiletime cpu detect optimally with inlined asm. Its not that pretty
or optimal in terms of code duplication for the runtime cpu detect case.

> Why doesn't swscale use this same system that dsputil uses, or if you
> dislike that, why don't they at least use the same system?

using the same system is nice if it has no disadvantages.
but simply changing one to the other and droping its advantages does not
seem like the best choice before we considered if a better system that
combines both systems advantages could be done ...

> Also, on x86-64, all <SSE2 functions should be disabled for functions
> that have a SSE2 implementation, since every x86-64 CPU has SSE2. I've
> been meaning to file a bug report for this but have forgotten so far.

the swscale system seems to be able to handle this much simpler than dsputil.
to see why:
for dsputil compilation of each sse&mmx function should be skiped if an
SSE2 function of the same kind is available and cpu is x86-64
the naive implementation of this really smells like hard to maintain ifdefery

for swscale the whole code is compiled for each cpu feature set
(like mmx / mmx+mmx2 / mmx+mmx2+sse, ...) via template
its very easy to just not compile for feature sets that dont contain SSE2

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100905/338d7b7a/attachment.pgp>

More information about the ffmpeg-devel mailing list