[FFmpeg-devel] [RFC] cpu specific implementation of libavutil functions

Nigel Pearson nigel
Mon Sep 10 09:23:35 CEST 2007


> Poking around the filesystem is also not OK for such a
> purely-computational library as libavutil...

I agree, but was thinking more about libavcodec.
(where we currently get has_altivec()).

Though, this sort of stuff isn't anything
to do with codecs, so it shouldn't be in
libavcodec/ppc/dsputil_altivec.c either.

Maybe a libffutil or libffmisc ?

e.g.:


% cat libffmisc/cputest.c
...
int ff_cputype = 0;
...
#ifdef HAVE_MMX
int mm_support(void)
...
#ifdef ENABLE_SPARC
static int vis_level ()
...
#ifdef HAVE_ALTIVEC
int has_altivec(void)
...
void init_cputype(void)
{
#ifdef HAVE_MMX
     ff_cputype = mm_support();
#endif

#ifdef ENABLE_SPARC
     ff_cputype = vis_level();
#endif

#ifdef HAVE_ALTIVEC
     if (has_altivec())
         ff_cputype = FF_MM_ALTIVEC;
     else
         ff_cputype = 0;
#endif
}

% cat libffmisc/cputest.h
extern int ff_cputype;
...

#define FF_CPU_ALTIVEC (ff_cputype & FF_MM_ALTIVEC)
...


% cat libavutil/adler32.c
...
#include <cputest.h>
...
unsigned long av_adler32_update(...
#ifdef HAVE_ALTIVEC
     if (FF_CPU_ALTIVEC)
         av_adler32_update(...
#else
     /* Standard C implementation */

     unsigned long s1 = adler & 0xffff;
...





> Actally the headers
> should #define all the file io functions to *_is_disabled_in_libavutil
> or similar.

Cruel!

--
Nigel Pearson, nigel at ind.tansu.com.au|"Things you own-
Telstra Net. Eng., Sydney, Australia | end up owning you"
Office: 9202 3900    Fax:  9261 3912 |      Tyler,
Mobile: 0408 664435  Home: 9792 6998 |    Fight Club




More information about the ffmpeg-devel mailing list