[Ffmpeg-devel] RUNTIME_CPUDETECT broken on PPC due to -maltivec

Sam Hocevar sam+ffmpeg
Fri Mar 9 18:53:25 CET 2007


   FFmpeg's runtime AltiVec detection doesn't work, the library crashes
in random places on a G3 machine.

   Contrary to common belief, when using -maltivec gcc *can* generate
AltiVec code in unexpected, non-vector-using places. Whether this is the
correct behaviour or not, I don't know, but it's gcc's behaviour. And
without -maltivec, there is no way to include <altivec.h> and use vector
types.

   Fixing that is not easy. It requires least the following:
    - use -maltivec only for source files that use <altivec.h>
    - ensure that no codepath leads to a source file built with
      -maltivec when the CPU does not support AltiVec, which means
      monsters such as postprocess.c and swscale.c need to be
      split

   I have started working on this for the Debian FFmpeg packages, my
work in progress can be followed here:

     http://trac.videolan.org/pkg-multimedia/browser/experimental/ffmpeg/debian/patches/040_only_use_maltivec_when_needed.diff

   Before I spend time polishing that patch, I'd like to know whether
there is interest from the FFmpeg developers to integrate a proper fix
upstream, or if you're more of the opinion that it's gcc that needs
fixing or that runtime G3 support is not a requirement (in which case I
won't probably bother cleaning up the patch).

   Any comments welcome.

Regards,
-- 
Sam.




More information about the ffmpeg-devel mailing list